import { DKGAgent } from '@origintrail-official/dkg-agent'; import { type AsyncLiftPublisherConfig } from '@origintrail-official/dkg-publisher'; import { loadConfig, type NetworkConfig } from '../config.js'; import { type ContextGraphReadinessStore } from '../context-graph-readiness.js'; import type { MemoryGraphChangedEvent } from './routes/context.js'; import { type PromoteWorkerConfig, type PromoteWorkerSupervisor } from './worker/async-promote-worker.js'; /** * Resolve the WM agentAddress the daemon hands to `ChatMemoryManager`. * * `agent.assertion.write` (the path chat-turn persistence rides on) * internally resolves the assertion graph URI from * `defaultAgentAddress ?? peerId` — see * `packages/agent/src/dkg-agent.ts::get assertion()`. The memory manager * must read under the SAME address writes land on, or the two sides * resolve to structurally different `contextGraphAssertionUri(...)` * graphs and `/api/memory/sessions` silently returns `[]` (issue #277). * * Extracted as a pure function so the daemon-wiring contract is * unit-testable without booting a real `DKGAgent` (Hardhat / libp2p). * Changes to this resolver MUST stay in lockstep with the agent-side * resolution in `get assertion()`. */ export declare function resolveMemoryAgentAddress(agent: { getDefaultAgentAddress(): string | undefined; peerId: string; }): string; export declare function isLikelyPublicRpc(url: string): boolean; export declare function mergePreferredRelays(input: { envValue: string | undefined; configPreferred: unknown; networkAndConfigRelays: readonly string[] | undefined; }): { relayPeers: string[]; envCount: number; configCount: number; preferredCount: number; }; export declare function extractPeerIdFromMultiaddr(raw: string): string | null; export declare function extractPeerIdsFromMultiaddrs(addrs: readonly string[] | undefined): string[]; export declare function resolveACKCandidatePeerIds(input: { usingNetworkRelays: boolean; networkRelays: readonly string[] | undefined; }): string[]; export declare function orderACKCandidatePeerIds(input: { connectedPeerIds: readonly string[]; selfPeerId: string; knownCorePeerIds?: ReadonlySet; preferredACKPeerIds?: readonly string[]; verifiedSameNetworkPeerIds?: ReadonlySet; }): string[]; export declare const CHAIN_FULL_SCAN_EVERY = 48; export declare const CHAIN_DISCOVERY_SCAN_PAGE_BUDGET = 30; export declare function chainDiscoveryScanOptions(input: { watermarkSeeded: boolean; run?: number; fullScanEvery?: number; pageBudget?: number; }): { mode: 'incremental'; pageBudget: number; } | { mode: 'seedFromCursor'; throwOnChainScanFailure: true; pageBudget: number; } | { mode: 'seedFull'; throwOnChainScanFailure: true; }; export declare function createChainDiscoveryScanRunner(input: { agent: { hasContextGraphRegistryScanWatermark(): Promise; discoverContextGraphsFromChain(options: ReturnType): Promise; }; log: (msg: string) => void; pageBudget?: number; fullScanEvery?: number; }): () => Promise; export interface PromoteWorkerDaemonLifecycle { waitForStartup(): Promise; stop(reason?: string | null): Promise; getSupervisor(): PromoteWorkerSupervisor | null; } export declare function startPromoteWorkerDaemonLifecycle(input: { agent: PromoteWorkerConfig['agent']; log: (msg: string) => void; emitMemoryGraphChanged: (event: MemoryGraphChangedEvent) => void; enabled?: boolean; isShuttingDown?: () => boolean; workerConfig?: Omit; }): PromoteWorkerDaemonLifecycle; type StartupGenesisValidation = { ok: true; networkId: string; } | { ok: false; networkId: string; messages: string[]; }; type StartupGenesisValidationInput = Partial>; type KnowledgeAssetVmPublishHandler = NonNullable; export declare function createKnowledgeAssetVmPublishHandler(agent: DKGAgent): KnowledgeAssetVmPublishHandler; export declare function validateStartupGenesis(network: StartupGenesisValidationInput | null | undefined): Promise; export declare function runDaemon(foreground: boolean): Promise; export declare function resolveDaemonPublishEncryption(agent: DKGAgent, publishOptions: { contextGraphId: string; subGraphName?: string; publishContextGraphId?: string; }): Promise<{ encryptInlinePayload: Awaited>; encryptInlineChunked: Awaited>; }>; /** * Activate operator/network-configured context graphs without inventing a * local definition for an unknown namespaced graph. * * A configured context graph is a sync target, not a declaration that this * node owns or knows its access policy. In particular, calling * `ensureContextGraphLocal()` for an unknown private graph creates a public * local shadow and marks it fully synced before its authoritative `_meta` * graph has arrived. That false state suppresses the authenticated metadata * bootstrap required by curated graphs. * * System graphs are activated by `DKGAgent.start()`. Network defaults and * caller-supplied local-bootstrap IDs retain their intentional local semantics * (devnets rely on this before registering seed graphs). A configured graph, * bare or namespaced, is otherwise a remote sync target: both forms are * accepted by the CG API and therefore neither spelling proves ownership. * Confirmed local subscriptions keep their existing state; every other target * remains fail-closed until sync supplies its authoritative definition. */ export declare function bootstrapConfiguredContextGraphs(input: { agent: DKGAgent; configuredContextGraphIds: Iterable; networkDefaultContextGraphIds: Iterable; localBootstrapContextGraphIds?: Iterable; readinessStore?: Partial; log: (message: string) => void; }): Promise; export declare function runDaemonInner(foreground: boolean, config: Awaited>, startedAt: number): Promise; export {}; //# sourceMappingURL=lifecycle.d.ts.map