/** Starter Entry ids remain reserved when DSH nests them under an include. */ export declare function isDefaultSourceInstance(instanceKey: string, sourceTypeId: string): boolean; export type MemoryParticipationMode = 'off' | 'manual' | 'automatic'; export type MemoryParticipationChannel = 'recall' | 'write' | 'projection' | 'maintenance'; export type MemoryLayerParticipation = Record; export interface MemoryTopologyDefinition { id: string; strategyId: string; layers: Array; } export interface MemoryCompositionStatus { evaluation: import('../core/contracts/index.ts').MemoryCompositionEvaluationReport; sources: MemorySourceManagementInstance[]; configuration: ResolvedMemoryTopologyConfig; } import type { RecallQualityConfig, ResolvedRecallQualityConfig, MnemonEmbeddingConfig, ResolvedMnemonEmbeddingConfig } from 'dsh-mnemon-source-memory-spaces/contracts'; import type { MemoryPersistenceStrategy, ResolvedMemoryPersistenceStrategy, MemoryProviderRuntimeStatus, MemoryBodyStats as MemorySpaceStats, MemoryBodyView as MemorySpaceView } from 'dsh-mnemon-source-memory-spaces/contracts'; import type { ConnectionHandle as DshClientConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'; import type { DocumentSnapshot } from 'dsh-mnemon-source-documents/contracts'; export declare const MNEMON_READ_CHANNEL = "/dsh-mnemon-read"; export declare const MNEMON_ACTIVATION_CHANNEL = "/dsh-mnemon-activation"; export declare const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write"; export declare const MNEMON_PACK_CHANNEL = "/dsh-mnemon-pack"; export declare const MNEMON_SETTINGS_CHANNEL = "/dsh-mnemon-settings"; /** DSH API Gateway endpoints used by paired remote Web clients. */ export declare const MNEMON_REMOTE_CHANNEL = "/api"; export declare const MNEMON_REMOTE_NAMESPACE = "dshMnemon"; export declare const MNEMON_REMOTE_READ_ENDPOINT = "dshMnemon/read"; export declare const MNEMON_REMOTE_ACTIVATION_ENDPOINT = "dshMnemon/activation"; export declare const MNEMON_REMOTE_WRITE_ENDPOINT = "dshMnemon/write"; export declare const MNEMON_REMOTE_PACK_ENDPOINT = "dshMnemon/pack"; export declare const MNEMON_REMOTE_SETTINGS_ENDPOINT = "dshMnemon/settings"; export declare const MNEMON_REMOTE_VIEW_ENDPOINT = "dshMnemon/view"; export declare const MNEMON_REMOTE_VIEW_WRITE_ENDPOINT = "dshMnemon/viewWrite"; export declare const MNEMON_SETTINGS_NAMESPACE = "mnemon"; export declare const MNEMON_UI_SETTINGS_NAMESPACE = "mnemon-ui"; export * from './view-protocol.ts'; export type JsonPrimitive = string | number | boolean | null; export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue; }; export interface MemorySourceManagementField { key: string; label: string; description?: string; input: 'text' | 'number' | 'boolean' | 'url' | 'secret' | 'select'; required: boolean; secret?: boolean; options?: Array<{ value: string; label: string; }>; } /** Browser-safe descriptor of one Source instance visible in the current scope. */ export interface MemorySourceManagementInstance { sourceInstanceKey: string; sourceTypeId: string; packageName: string; role: string; availability: 'ready' | 'degraded' | 'unavailable'; revision: string; capabilities: string[]; assistance?: readonly string[]; management: { label: string; description: string; fields?: MemorySourceManagementField[]; diagnostics?: string[]; }; hints?: JsonValue; } export interface MemorySourceManagementCatalog { generationId: string; sources: MemorySourceManagementInstance[]; } export interface MemorySourceManagementResult { revision: string; value: JsonValue; } export type RpcError = { code: 'bad-request'; message: string; details: { issues: JsonValue[]; }; } | { code: 'settings-rejected'; message: string; details: { ns: string; }; } | { code: 'internal'; message: string; details: Record; }; export type RpcResult = { ok: true; value: T; } | { ok: false; error: RpcError; }; /** Public DSH browser RPC face plus the transport boundary needed to gate local-only writes. */ export type ClientConnectionHandle = Pick & Partial>; export interface ClientSettingsSnapshot { status: 'loading' | 'ready' | 'unavailable'; value?: T; base?: unknown; user?: unknown; revision?: number; writable: boolean; mode: 'host' | 'memory'; } export interface ClientSettingsScope { getSnapshot(): ClientSettingsSnapshot; subscribe(listener: () => void): () => void; set(field: string, value: unknown): Promise; unset(field: string): Promise; setPath(path: string[], value: unknown): Promise; unsetPath(path: string[]): Promise; mutate?(ops: SettingsOperation[]): Promise; } export type SettingsOperation = { op: 'set'; path: string[]; value: unknown; } | { op: 'unset'; path: string[]; }; export type StorageScopeKind = 'global' | 'workspace' | 'custom' | 'workspaces'; export declare function isWorkspaceStorageScope(scope: string | undefined): boolean; export interface MemoryLayerConfig { enabled?: boolean; participation?: Partial; adapterIds?: string[]; } export interface MemoryTopologyConfig { id?: string; strategyId?: string; layers?: Record; } export interface ResolvedMemoryLayerConfig { enabled: boolean; participation: MemoryLayerParticipation; adapterIds: string[]; } export interface ResolvedMemoryTopologyConfig { id: string; strategyId: string; layers: Record; } export interface CustomPackConfig { id: string; name: string; dataDir: string; } export interface RuntimeMemoryConfig { /** Maximum UTF-8 bytes projected into MEMORY.md. */ memoryLimitBytes?: number; /** Maximum UTF-8 bytes projected into USER.md. */ userLimitBytes?: number; /** Completion-token budget for Runtime migration and compaction workers. */ maintenanceMaxTokens?: number; } export interface ResolvedRuntimeMemoryConfig { memoryLimitBytes: number; userLimitBytes: number; maintenanceMaxTokens: number; } export { normalizeDisplayMode } from './display-mode.ts'; export type MnemonDisplayMode = 'sidebar' | 'builtin'; export declare const DEFAULT_IDLE_REVIEW: { enabled: true; provider: "spawn"; fallback: "spawn"; minIntervalMs: number; maxPerSession: number; maxContextChars: number; maxTokens: number; }; export interface ResolvedIdleReviewConfig { enabled: boolean; provider: 'spawn' | 'fork'; /** Applies only before a child starts; a failed run is never replayed. */ fallback: 'spawn' | 'skip'; minIntervalMs: number; maxPerSession: number; maxContextChars: number; maxTokens: number; } export interface Config { storageScope?: StorageScopeKind; /** Whether USER.md follows the selected storage root or stays in the global root. */ runtimeUserScope?: 'storage' | 'global'; cliPath?: string; dataDir?: string; customPackId?: string; customPacks?: CustomPackConfig[]; store?: string; timeoutMs?: number; defaultRecallLimit?: number; runtimeMemory?: RuntimeMemoryConfig; /** Optional DSH-owned overrides injected into every Mnemon CLI process. */ embedding?: MnemonEmbeddingConfig; memoryTopology?: MemoryTopologyConfig; /** Profile-owned plugin choices on DSH 0.1.7 and newer. */ memoryView?: import('./view-protocol.ts').MemoryViewPreferences; /** Successful import of this profile's removed settings namespaces. */ legacySettingsImported?: boolean; recallQuality?: RecallQualityConfig; routingGuidance?: boolean; /** Entry placement only. Legacy `buildin` input is migrated to `builtin`. */ displayMode?: MnemonDisplayMode | 'buildin'; tabEnabled?: boolean; writeEnabled?: boolean; /** DSH rc.2 management-channel authority; ignored by DSH 0.1.2-alpha.1. */ remoteAccess?: 'read-only' | 'trusted-host'; lifecycleEnabled?: boolean; recallMode?: 'guided' | 'off'; writebackMode?: 'guided' | 'off'; idleReviewMs?: number; idleReview?: Partial; conversationInteraction?: { toolviews?: boolean; turnBar?: boolean; saveAction?: boolean; }; /** Provider policy used when an Agent must create a new Memory Space while distilling memory. */ persistenceStrategy?: MemoryPersistenceStrategy; /** Model route used by clean, session-independent maintenance Agents. */ taskAgentModel?: TaskAgentModelConfig; } export interface TaskAgentModelConfig { mode?: 'inherit' | 'fixed'; provider?: string; model?: string; } export interface ResolvedTaskAgentModelConfig { mode: 'inherit' | 'fixed'; provider?: string; model?: string; } export interface TaskAgentModelCatalogModel { id: string; name: string; description?: string; /** DSH's merge-extensible model modality ids; absent means capability is unknown. */ inputModalities?: string[]; } export interface TaskAgentModelCatalogGroup { id: string; name: string; models: TaskAgentModelCatalogModel[]; } export interface TaskAgentModelCatalogFailure { id: string; name: string; message: string; } export interface TaskAgentModelCatalog { effective?: { provider: string; model: string; source: 'fixed' | 'dsh-default' | 'active-agent'; }; defaultSelection?: { provider: string; model: string; }; groups: TaskAgentModelCatalogGroup[]; failures: TaskAgentModelCatalogFailure[]; } export interface InteractionConfig { turnBar?: boolean; saveAction?: boolean; } export interface ResolvedConfig { storageScope: StorageScopeKind; runtimeUserScope: 'storage' | 'global'; cliPath?: string; dataDir?: string; store?: string; timeoutMs: number; defaultRecallLimit: number; runtimeMemory: ResolvedRuntimeMemoryConfig; embedding: ResolvedMnemonEmbeddingConfig; memoryTopology: ResolvedMemoryTopologyConfig; recallQuality: ResolvedRecallQualityConfig; routingGuidance: boolean; displayMode: MnemonDisplayMode; tabEnabled: boolean; writeEnabled: boolean; /** DSH rc.2 management-channel authority; ignored by DSH 0.1.2-alpha.1. */ remoteAccess: 'read-only' | 'trusted-host'; lifecycleEnabled: boolean; recallMode: 'guided' | 'off'; writebackMode: 'guided' | 'off'; idleReviewMs: number; idleReview: ResolvedIdleReviewConfig; conversationInteraction: { toolviews: boolean; turnBar: boolean; saveAction: boolean; }; persistenceStrategy: ResolvedMemoryPersistenceStrategy; taskAgentModel: ResolvedTaskAgentModelConfig; } export interface ResolvedInteractionConfig { turnBar: boolean; saveAction: boolean; } /** * Provider instance identity inside one Memory Spaces Source. Built-in ids * remain stable; third-party child modules may contribute additional ids. */ export type * from 'dsh-mnemon-source-memory-spaces/contracts'; export type * from 'dsh-mnemon-source-documents/contracts'; export type * from 'dsh-mnemon-source-runtime/contracts'; export interface TurnMemoryActivity { turn: number; count: number; names: string[]; recalls: number; writes: number; documentSearches: number; inspections: number; failures: number; /** Successful evidence-bearing reads with tool-authored safe previews. */ retrieved: MemoryActivityRead[]; /** Only writes whose tool-authored result confirms durable commitment. */ writebacks: MemoryActivityWriteback[]; } export interface MemoryActivityItem { id: string; title: string; excerpt?: string; } export interface MemoryActivityRead { callId: string; toolName: string; operationId: string; reference?: string; sourceTypeId?: string; items: MemoryActivityItem[]; } export interface MemoryActivityWriteback { callId: string; toolName: string; operationId: string; reference?: string; sourceTypeId?: string; item: MemoryActivityItem; } export interface TurnMemoryActivitySnapshot { cursor: number; activities: TurnMemoryActivity[]; } export interface AssistantMessageText { messageId: string; text: string; } export type StorageAreaKind = 'runtime' | 'memory-bodies' | 'documents' | 'state'; export type StorageAreaStatus = 'ready' | 'empty' | 'missing' | 'invalid'; export interface StorageAreaInventory { kind: StorageAreaKind; path: string; status: StorageAreaStatus; bytes: number; itemCount: number; details: Record; issue?: string; } export interface StorageScopeInventory { kind: StorageScopeKind; root?: string; configured: boolean; active: boolean; available: boolean; totalBytes: number; areas: StorageAreaInventory[]; issue?: string; } export interface StorageScopeCatalog { activeKind: StorageScopeKind; activeRoot: string; scopes: StorageScopeInventory[]; generatedAt: string; } export interface ReviewActivity { totalUserTextLength: number; turnCount: number; toolCallCount: number; uniqueToolCount: number; } export interface ReviewActivityScore extends ReviewActivity { textLengthScore: number; turnScore: number; toolCallScore: number; toolDiversityScore: number; score: number; threshold: number; eligible: boolean; } export interface SubagentCounters { recalls: number; writes: number; answers: number; reviews: number; placements: number; migrations: number; compactions: number; documentArchives: number; metadataMaintenances: number; failures: number; lastRunId?: string; lastOperation?: 'recall' | 'write' | 'review' | 'placement' | 'migration' | 'compaction' | 'document-archive' | 'metadata-maintenance'; lastAt?: string; } export type LifecyclePhase = 'idle' | 'prime' | 'recall' | 'writeback' | 'review' | 'supervised' | 'error'; export interface LifecycleCounters { primes: number; recallCues: number; writebackCues: number; supervisedRequests: number; failures: number; } export interface LifecycleAgentSnapshot { sessionId: string; status: 'idle' | 'running'; startSource: 'startup' | 'resume' | 'clear' | 'compact' | 'adopted'; primePending: boolean; guidedTurns: number; memoryToolCalls: number; idleReviewPending: boolean; reviewRunning: boolean; reviewActivity: ReviewActivityScore; lastPhase: LifecyclePhase; lastReviewAt?: string; lastReviewAction?: string; lastReviewScore?: number; lastReviewDocumentIds?: string[]; idleReviewAttempts?: number; idleReviewBlocked?: 'agent-team'; nextReviewAt?: string; lastReviewFailure?: IdleReviewFailure; lastAt?: string; lastError?: string; } /** Reconciliation metadata only; raw tool arguments and memory content stay private. */ export interface IdleReviewFailure { status: 'failed' | 'partial'; runId?: string; provider: string; receipts: Array<{ tool: string; action: string; documentId?: string; target?: string; revision?: string; }>; } export interface LifecycleSnapshot { enabled: boolean; recallMode: 'guided' | 'off'; writebackMode: 'guided' | 'off'; idleReviewMs: number; activeAgents: number; sessionAvailable: boolean; /** A session-independent task Agent can be created for WebUI maintenance. */ taskAgentAvailable: boolean; counters: LifecycleCounters; subagents: SubagentCounters; current?: LifecycleAgentSnapshot; } export interface StatusView { healthy: boolean; error?: string; version?: string; dshMnemonVersion?: string; cliPath: string; commandFound: boolean; dataDir: string; /** Legacy comma-separated DSH-enabled Store list. */ store: string; mnemonDefaultStore: string; dshActiveStores: string[]; writeEnabled: boolean; timeoutMs: number; defaultRecallLimit: number; recallQuality: ResolvedRecallQualityConfig; memoryBodyDirectory: string; memoryBodies: MemorySpaceView[]; providerServices?: MemoryProviderRuntimeStatus[]; memorySystem?: MemoryCompositionStatus; lifecycle?: LifecycleSnapshot; documents?: DocumentSnapshot; storage?: StorageScopeCatalog; workspaceContext?: { mode: StorageScopeKind; selectedRoot: string; effectiveRoot: string; aligned: boolean; selectedWorkspace?: { id: string; title: string; path: string; }; effectiveWorkspace?: { id: string; title: string; path: string; }; }; stats?: MemorySpaceStats & { dbPath?: string; }; } export type MnemonPackComponent = 'runtime' | 'documents' | 'memory-spaces'; export type MnemonPackScope = 'full' | MnemonPackComponent; export type MnemonPackImportMode = 'merge' | 'replace'; export interface MnemonPackComponentSummary { component: MnemonPackComponent; files: number; bytes: number; items: number; } export interface MnemonPackManifest { format: 'mnemonpack'; version: 1; scope: MnemonPackScope; exportedAt: string; source: { plugin: 'dsh-mnemon'; pluginVersion: string; }; components: MnemonPackComponent[]; summary: MnemonPackComponentSummary[]; } export interface MnemonPackExport { fileName: string; mimeType: 'application/zip'; bytes: number; base64: string; targetRoot: string; manifest: MnemonPackManifest; } export interface MnemonPackPreview { fileName?: string; archiveBytes: number; expandedBytes: number; targetRoot: string; targetScope: StorageScopeKind; manifest: MnemonPackManifest; occupied: Record; } export interface MnemonPackImportResult { imported: true; mode: MnemonPackImportMode; targetRoot: string; components: MnemonPackComponent[]; summary: MnemonPackComponentSummary[]; } export type VersionPackageId = `dsh-mnemon-${'source' | 'strategy' | 'provider'}-${string}`; export type VersionComponentId = 'mnemon' | 'dsh-mnemon' | VersionPackageId; export type VersionInstallMode = 'homebrew' | 'go' | 'npm' | 'link' | 'manual' | 'missing'; export interface VersionComponentStatus { id: VersionComponentId; name: string; executablePath?: string; installPath?: string; installProfile?: string; current?: string; latest?: string; outdated: boolean; installMode: VersionInstallMode; updateSupported: boolean; updateHint: string; checkError?: string; restartRequired?: boolean; packages?: VersionPackageStatus[]; } export interface VersionPackageStatus extends VersionComponentStatus { id: VersionPackageId; kind: 'source' | 'strategy' | 'provider'; managedBy: 'starter' | 'profile'; expectedVersion?: string; } export interface VersionStatus { checkedAt: string; components: VersionComponentStatus[]; } export interface VersionUpdateResult { component: VersionComponentId; previousVersion?: string; currentVersion?: string; updated: boolean; restartRequired: boolean; output?: string; } export declare const CATEGORIES: readonly ["preference", "decision", "fact", "insight", "context", "general"]; export declare const SOURCES: readonly ["user", "agent", "external"]; export declare const EDGE_TYPES: readonly ["temporal", "semantic", "causal", "entity"]; export declare const INTENTS: readonly ["WHY", "WHEN", "ENTITY", "GENERAL"]; export declare const DEFAULT_EMBEDDING_ENDPOINT = "http://localhost:11434"; export declare const DEFAULT_EMBEDDING_MODEL = "nomic-embed-text"; export declare const DEFAULT_EMBEDDING_PROTOCOL = "auto"; export declare const MNEMON_EMBEDDING_PROTOCOLS: readonly ["auto", "ollama", "openai"];