import { type DkgConfig, type LocalAgentIntegrationCapabilities, type LocalAgentIntegrationConfig, type LocalAgentIntegrationManifest, type LocalAgentIntegrationRuntime, type LocalAgentIntegrationStatus, type LocalAgentIntegrationTransport } from '../config.js'; import { OpenClawUiAttachDeps } from './openclaw.js'; import { type HermesChannelHealthReport } from './hermes.js'; import type { HermesSetupResult } from '@origintrail-official/dkg-adapter-hermes'; export interface LocalAgentIntegrationDefinition { id: string; name: string; description: string; transportKind?: string; capabilities: LocalAgentIntegrationCapabilities; manifest?: LocalAgentIntegrationManifest; } export interface LocalAgentIntegrationRecord extends LocalAgentIntegrationConfig { id: string; name: string; description: string; enabled: boolean; transport: LocalAgentIntegrationTransport; capabilities: LocalAgentIntegrationCapabilities; runtime: LocalAgentIntegrationRuntime; status: LocalAgentIntegrationStatus; manifest?: LocalAgentIntegrationManifest; } export declare const LOCAL_AGENT_INTEGRATION_DEFINITIONS: Record; export declare function isPlainRecord(value: unknown): value is Record; export declare function normalizeIntegrationId(value: string): string; export declare function normalizeLocalAgentTransport(input: unknown): LocalAgentIntegrationTransport | undefined; export declare function normalizeLocalAgentCapabilities(input: unknown): LocalAgentIntegrationCapabilities | undefined; export declare function normalizeLocalAgentManifest(input: unknown): LocalAgentIntegrationManifest | undefined; export declare function normalizeLocalAgentRuntime(input: unknown): LocalAgentIntegrationRuntime | undefined; export declare function isLocalAgentExplicitlyUserDisabled(integration: Pick | null | undefined): boolean; export declare function isExplicitLocalAgentDisconnectPatch(patch: Pick): boolean; export declare function normalizeExplicitLocalAgentDisconnectBody(body: Record): Record; export declare function mergeLocalAgentIntegrationConfig(base: LocalAgentIntegrationConfig | undefined, patch: LocalAgentIntegrationConfig, options?: { mergeTransport?: boolean; }): LocalAgentIntegrationConfig; export declare function getStoredLocalAgentIntegrations(config: DkgConfig): Record; export declare function computeLocalAgentIntegrationStatus(record: LocalAgentIntegrationConfig): LocalAgentIntegrationStatus; export declare function buildLocalAgentIntegrationRecord(id: string, definition: LocalAgentIntegrationDefinition | undefined, stored: LocalAgentIntegrationConfig | undefined): LocalAgentIntegrationRecord; export declare function listLocalAgentIntegrations(config: DkgConfig): LocalAgentIntegrationRecord[]; export declare function getLocalAgentIntegration(config: DkgConfig, id: string): LocalAgentIntegrationRecord | null; export declare function pruneLegacyOpenClawConfig(config: DkgConfig): void; export declare function extractLocalAgentIntegrationPatch(body: Record): LocalAgentIntegrationConfig; export declare function connectLocalAgentIntegration(config: DkgConfig, body: Record, now?: Date): LocalAgentIntegrationRecord; export declare function updateLocalAgentIntegration(config: DkgConfig, id: string, body: Record, now?: Date): LocalAgentIntegrationRecord; export declare function hasConfiguredLocalAgentChat(config: DkgConfig, id: string): boolean; export declare function hasStoredLocalAgentTransportConfig(integration: Pick | null | undefined): boolean; export type LocalAgentUiAttachDeps = OpenClawUiAttachDeps & { probeHermesHealth?: (config: DkgConfig, bridgeAuthToken: string | undefined, opts?: { timeoutMs?: number; }) => Promise; resolveHermesProfile?: (options?: { profileName?: string; hermesHome?: string; }) => { profileName?: string; hermesHome: string; memoryMode?: string; }; /** Test injection: stub the Hermes UI setup entrypoint. */ runHermesSetup?: (signal?: AbortSignal) => Promise; }; /** * CONTRACT (issue #198): This handler MUST leave ~/.openclaw/openclaw.json in a state * where the OpenClaw gateway, on next restart, will load the adapter from the * workspace build and elect it into plugins.slots.memory. The post-setup invariant * check enforces this before transitioning to `ready`. */ export declare function connectLocalAgentIntegrationFromUi(config: DkgConfig, body: Record, bridgeAuthToken: string | undefined, deps?: LocalAgentUiAttachDeps): Promise<{ integration: LocalAgentIntegrationRecord; notice?: string; }>; /** * CONTRACT (issue #198 / D1 reverse-setup): This helper MUST leave * ~/.openclaw/openclaw.json in a state where `plugins.slots.memory !== * "adapter-openclaw"` and the adapter load path is no longer listed. * If the reverse-merge completes but the invariant is still violated, * callers must surface runtime.status='error' and NOT transition to * 'disconnected'. The adapter's `unmergeOpenClawConfig` is symmetric to * `mergeOpenClawConfig` and writes a `.bak.` backup. */ export type ReverseLocalAgentSetupDeps = { unmergeOpenClawConfig?: (configPath: string) => unknown; verifyUnmergeInvariants?: (configPath: string) => string | null; removeCanonicalNodeSkill?: (workspaceDir: string) => void; verifySkillRemoved?: (installedWorkspace: string) => string | null; }; export type HermesRestoreOutcome = { ok: boolean; path: 'surgical' | 'backup-file' | 'noop' | 'failed'; restoreError?: string; }; export type ReverseHermesSetupDeps = { disconnectHermesProfile?: (options: { profileName?: string; hermesHome?: string; }) => unknown; /** * Attempt to restore the prior `memory.provider` after disconnect. Per * setup-entrypoint-contract.md §6, restore failure does NOT roll back the * disconnect — it surfaces as a warning while `runtime.status` stays * `'disconnected'`. S4 step 3 will land the real `restoreHermesProfile` in * `@origintrail-official/dkg-adapter-hermes`; until then the dynamic-import * fallback returns a `'noop'` outcome so the wiring is exercise-able now * and the swap is a one-line change when S4 ships. */ restoreHermesProfile?: (options: { profileName?: string; hermesHome?: string; }) => Promise; }; export declare function reverseHermesSetupForUi(config: DkgConfig, deps?: ReverseHermesSetupDeps): Promise<{ restoreError?: string; }>; export declare function reverseLocalAgentSetupForUi(_config: DkgConfig, openclawConfigPath?: string, deps?: ReverseLocalAgentSetupDeps): Promise; export declare function refreshLocalAgentIntegrationFromUi(config: DkgConfig, id: string, bridgeAuthToken: string | undefined): Promise; //# sourceMappingURL=local-agents.d.ts.map