import type { IncomingMessage, ServerResponse } from 'node:http'; import type { DKGAgent } from '@origintrail-official/dkg-agent'; import { type DkgConfig, type LocalAgentIntegrationTransport } from '../config.js'; import { type ExtractionStatusRecord } from '../extraction-status.js'; export declare const OPENCLAW_UI_CONNECT_TIMEOUT_MS = 150000; export declare const OPENCLAW_UI_CONNECT_POLL_MS = 1500; export declare const OPENCLAW_CHANNEL_RESPONSE_TIMEOUT_MS: number; import { type PendingAttachJob } from './local-agent-attach-jobs.js'; export type PendingOpenClawUiAttachJob = PendingAttachJob; export declare function isOpenClawBridgeHealthCacheValid(cache: { ok: boolean; ts: number; } | null): boolean; export interface OpenClawChannelTarget { name: "bridge" | "gateway"; inboundUrl: string; streamUrl?: string; healthUrl?: string; } export declare function trimTrailingSlashes(value: string): string; export declare function buildOpenClawGatewayBase(value: string): string; export declare function loadBridgeAuthToken(): Promise; export declare function getOpenClawChannelTargets(config: DkgConfig): OpenClawChannelTarget[]; export type OpenClawBridgeHealthState = Record & { ok: boolean; channel?: string; cached?: boolean; error?: string; }; export type OpenClawGatewayHealthState = Record & { ok: boolean; channel?: string; error?: string; }; export interface OpenClawChannelHealthReport { ok: boolean; target?: 'bridge' | 'gateway'; bridge?: OpenClawBridgeHealthState; gateway?: OpenClawGatewayHealthState; error?: string; } export declare function transportPatchFromOpenClawTarget(config: DkgConfig, targetName: 'bridge' | 'gateway' | undefined): LocalAgentIntegrationTransport | undefined; export declare function probeOpenClawChannelHealth(config: DkgConfig, bridgeAuthToken: string | undefined, opts?: { ignoreBridgeCache?: boolean; timeoutMs?: number; }): Promise; export declare function runOpenClawUiSetup(signal?: AbortSignal): Promise; export declare function localOpenclawConfigPath(): string; export declare function isOpenClawMemorySlotElected(openclawConfigPath?: string): boolean; export declare function restartOpenClawGateway(signal?: AbortSignal): Promise; export declare function waitForOpenClawChatReady(config: DkgConfig, bridgeAuthToken: string | undefined, signal?: AbortSignal): Promise; export type OpenClawUiAttachDeps = { runSetup?: (signal?: AbortSignal) => Promise; restartGateway?: (signal?: AbortSignal) => Promise; waitForReady?: (config: DkgConfig, bridgeAuthToken: string | undefined, signal?: AbortSignal) => Promise; probeHealth?: (config: DkgConfig, bridgeAuthToken: string | undefined, opts?: { ignoreBridgeCache?: boolean; timeoutMs?: number; }) => Promise; saveConfig?: (config: DkgConfig) => Promise; onAttachScheduled?: (id: string, job: Promise) => void; verifyMemorySlot?: () => boolean; }; export declare function formatOpenClawUiAttachFailure(err: any): string; export declare function scheduleOpenClawUiAttachJob(integrationId: string, task: (job: PendingOpenClawUiAttachJob) => Promise, onAttachScheduled?: (id: string, job: Promise) => void): { started: boolean; job: Promise; controller: AbortController; }; export declare function cancelPendingLocalAgentAttachJob(integrationId: string): void; export declare function isOpenClawUiAttachCancelled(job: PendingOpenClawUiAttachJob): boolean; export declare function shouldTryNextOpenClawTarget(status: number): boolean; export declare function buildOpenClawChannelHeaders(target: OpenClawChannelTarget, bridgeAuthToken: string | undefined, baseHeaders?: Record): Record; export declare function ensureOpenClawBridgeAvailable(target: OpenClawChannelTarget, bridgeAuthToken: string | undefined): Promise<{ ok: boolean; status?: number; details?: string; offline?: boolean; }>; export type OpenClawStreamRequest = Pick; export type OpenClawStreamResponse = Pick; export type OpenClawStreamReader = { read: () => Promise<{ done: boolean; value?: Uint8Array; }>; cancel: () => Promise; releaseLock: () => void; }; export declare function writeOpenClawStreamChunk(res: OpenClawStreamResponse, chunk: Uint8Array): Promise; export declare function pipeOpenClawStream(req: OpenClawStreamRequest, res: OpenClawStreamResponse, reader: OpenClawStreamReader): Promise; export declare function isValidOpenClawPersistTurnPayload(payload: { sessionId?: unknown; userMessage?: unknown; assistantReply?: unknown; persistenceState?: unknown; failureReason?: unknown; attachmentRefs?: unknown; }): payload is { sessionId: string; userMessage: string; assistantReply: string; turnId?: unknown; toolCalls?: unknown; persistenceState?: unknown; failureReason?: unknown; attachmentRefs?: unknown; }; export interface OpenClawAttachmentRef { assertionUri: string; assertionName?: string; fileHash: string; contextGraphId: string; fileName: string; detectedContentType?: string; extractionStatus?: 'completed'; tripleCount?: number; rootEntity?: string; mdIntermediateHash?: string; markdownHash?: string; markdownForm?: string; } export interface OpenClawAttachmentImportResult { assertionUri: string; fileHash: string; contextGraphId: string; fileName: string; detectedContentType: string; extractionStatus: 'skipped'; pipelineUsed?: string | null; tripleCount?: number; rootEntity?: string; mdIntermediateHash?: string; error?: string; } export declare function normalizeOpenClawAttachmentRef(raw: unknown): OpenClawAttachmentRef | null; export declare function normalizeOpenClawAttachmentRefs(raw: unknown): OpenClawAttachmentRef[] | undefined; export declare function normalizeOpenClawAttachmentImportResult(raw: unknown): OpenClawAttachmentImportResult | null; export declare function normalizeOpenClawAttachmentImportResults(raw: unknown): OpenClawAttachmentImportResult[] | undefined; export declare function dedupeOpenClawAttachmentImportResults(attachmentImportResults: OpenClawAttachmentImportResult[] | undefined): OpenClawAttachmentImportResult[] | undefined; export interface OpenClawChatContextEntry { key: string; label: string; value: string; } export declare function normalizeOpenClawChatContextEntry(raw: unknown): OpenClawChatContextEntry | null; export interface OpenClawChatContextNormalization { contextEntries?: OpenClawChatContextEntry[]; attachmentImportResults?: OpenClawAttachmentImportResult[]; } export declare function normalizeOpenClawChatContextEntriesWithAttachmentImportResults(raw: unknown): OpenClawChatContextNormalization | undefined; export declare function normalizeOpenClawChatContextEntries(raw: unknown): OpenClawChatContextEntry[] | undefined; export declare function hasOpenClawChatTurnContent(text: unknown, attachmentRefs: OpenClawAttachmentRef[] | undefined, attachmentImportResults?: OpenClawAttachmentImportResult[] | undefined, contextEntries?: OpenClawChatContextEntry[] | undefined): text is string; export declare function unescapeOpenClawAttachmentLiteralBody(raw: string): string; export declare function stripOpenClawAttachmentLiteral(raw: string | undefined): string; export declare function parseOpenClawAttachmentTripleCount(raw: string | undefined): number | undefined; export declare function isOpenClawAttachmentAssertionUriForContextGraph(assertionUri: string, contextGraphId: string): boolean; export declare function extractionRecordMatchesOpenClawAttachmentRef(ref: OpenClawAttachmentRef, record: ExtractionStatusRecord): boolean; export declare function verifyOpenClawAttachmentRefsProvenance(agent: Pick, extractionStatus: Map, attachmentRefs: OpenClawAttachmentRef[] | undefined): Promise; export declare function verifyOpenClawAttachmentImportResultsProvenance(agent: Pick, extractionStatus: Map, attachmentImportResults: OpenClawAttachmentImportResult[] | undefined): Promise; export declare function buildOpenClawAttachmentImportContextEntries(attachmentImportResults: OpenClawAttachmentImportResult[] | undefined): OpenClawChatContextEntry[]; //# sourceMappingURL=openclaw.d.ts.map