import type { DKGAgent } from '@origintrail-official/dkg-agent'; import type { ChatMemoryManager } from '@origintrail-official/dkg-node-ui'; import type { DkgConfig, LocalAgentIntegrationTransport } from '../config.js'; import type { ExtractionStatusRecord } from '../extraction-status.js'; import { type OpenClawAttachmentImportResult, type OpenClawAttachmentRef, type OpenClawChatContextEntry, type OpenClawStreamReader, type OpenClawStreamRequest, type OpenClawStreamResponse } from './openclaw.js'; export declare const HERMES_CHANNEL_RESPONSE_TIMEOUT_MS: number; export declare const DEFAULT_HERMES_BRIDGE_URL = "http://127.0.0.1:9202"; export declare const DEFAULT_HERMES_API_SERVER_URL = "http://127.0.0.1:8642"; export type HermesChannelProtocol = 'hermes-channel' | 'hermes-openai'; export interface HermesChannelTarget { name: 'bridge' | 'gateway'; protocol?: HermesChannelProtocol; inboundUrl: string; streamUrl?: string; healthUrl?: string; } export type HermesHealthState = Record & { ok: boolean; channel?: string; error?: string; }; export interface HermesChannelHealthReport { ok: boolean; target?: 'bridge' | 'gateway'; bridge?: HermesHealthState; gateway?: HermesHealthState; error?: string; } export interface HermesChatPayload { text: string; correlationId: string; identity?: string; sessionId?: string; profile?: string; persistUserMessage?: string; attachmentRefs?: OpenClawAttachmentRef[]; attachmentImportResults?: OpenClawAttachmentImportResult[]; contextEntries?: OpenClawChatContextEntry[]; contextGraphId?: string; currentAgentAddress?: string; } export interface HermesPersistTurnPayload { sessionId: string; userMessage: string; assistantReply: string; turnId: string; correlationId?: string; idempotencyKey?: string; toolCalls?: Array<{ name: string; args: Record; result: unknown; }>; attachmentRefs?: OpenClawAttachmentRef[]; persistenceState: 'stored' | 'failed' | 'pending'; failureReason?: string; contextGraphId?: string; profile?: string; metadata?: Record; } export type HermesTurnPersistenceState = HermesPersistTurnPayload['persistenceState']; export declare function isHermesLoopbackUrl(value: string | undefined): boolean; export declare function getHermesChannelTargets(config: DkgConfig): HermesChannelTarget[]; export declare function buildHermesChannelHeaders(target: HermesChannelTarget, bridgeAuthToken: string | undefined, baseHeaders?: Record, requestUrl?: string, apiServerKey?: string): Record; /** * Resolve the Hermes API server key for the `hermes-openai` UI-chat * transport. `.env` (in the stored profile's `hermesHome`) is the source of * truth — the same file `dkg hermes setup` provisions and the one Hermes * itself reads (read fresh each call so a rotated key is picked up immediately). * `DKG_HERMES_API_SERVER_KEY` is the source for remote/WSL * gateways ONLY (whose `.env` is not on the daemon's filesystem); for loopback * the key comes exclusively from the local profile `.env`. Returns undefined * when no key is available (older key-less Hermes → no bearer is sent). */ export declare function resolveHermesApiServerKey(config: DkgConfig): string | undefined; /** * Actionable remediation for a Hermes api_server auth failure, branched on * transport: a loopback gateway is fixed by `dkg hermes setup` (which writes * the local `.env`); a remote/WSL gateway is fixed by the daemon-side * DKG_HERMES_API_SERVER_KEY override, since setup never touches a remote `.env`. */ export declare function hermesApiServerKeyRemediation(config: DkgConfig): string; /** * Remediation when Hermes explicitly REJECTS the bearer (401/403): a key is * present but wrong, so "run dkg hermes setup" is a no-op (setup never * overwrites an existing API_SERVER_KEY). The fix is to realign or rotate the * key so DKG forwards what the running gateway expects. */ export declare function hermesApiServerKeyRejectionRemediation(config: DkgConfig): string; export declare function transportPatchFromHermesTarget(config: DkgConfig, targetName: 'bridge' | 'gateway' | undefined): LocalAgentIntegrationTransport | undefined; export declare function probeHermesChannelHealth(config: DkgConfig, bridgeAuthToken: string | undefined, opts?: { timeoutMs?: number; }): Promise; export declare function ensureHermesBridgeAvailable(target: HermesChannelTarget, bridgeAuthToken: string | undefined): Promise<{ ok: boolean; status?: number; details?: string; offline?: boolean; }>; export declare function shouldTryNextHermesTarget(status: number): boolean; export declare function normalizeHermesChatPayload(raw: unknown): HermesChatPayload | { error: string; }; export declare function buildStableHermesTurnId(args: { sessionId: string; idempotencyKey?: string; correlationId?: string; profile?: string; contextGraphId?: string; nonce?: string; }): string; export declare function hermesPersistTurnKey(sessionId: string, turnId: string): string; export declare function hasPersistedHermesTurn(memoryManager: Pick & Partial>, sessionId: string, turnId: string): Promise; export declare function getPersistedHermesTurnState(memoryManager: Pick & Partial>, sessionId: string, turnId: string): Promise; export declare function normalizeHermesPersistTurnPayload(raw: unknown): HermesPersistTurnPayload | { error: string; }; export declare function verifyHermesAttachmentRefsProvenance(agent: Pick, extractionStatus: Map, attachmentRefs: OpenClawAttachmentRef[] | undefined): Promise; export declare function verifyHermesAttachmentImportResultsProvenance(agent: Pick, extractionStatus: Map, attachmentImportResults: OpenClawAttachmentImportResult[] | undefined): Promise; export declare function pipeHermesStream(req: OpenClawStreamRequest, res: OpenClawStreamResponse, reader: OpenClawStreamReader): Promise; export declare function runHermesUiSetup(signal?: AbortSignal): Promise; //# sourceMappingURL=hermes.d.ts.map