import { CodeIndexStore, CodeIndexReindexScheduler } from '../state/index.js'; import type { MemoryEmbeddingProviderRegistry } from '../state/index.js'; import type { ConfigManager } from '../config/index.js'; /** * Host-local synthetic config key (not in the ConfigKey union) that * gates the code index's auto-build on construction. Default OFF, see this * module's header doc. Surfaced in /config via a synthetic entry * (settings-modal-data.ts) exactly like behavior.notifyAfterSeconds. */ export declare const CODE_INDEX_ENABLED_CONFIG_KEY = "storage.codeIndexEnabled"; /** * Honest, generous bounds passed EXPLICITLY to CodeIndexStore (values equal * to its own internal defaults) so /codebase status and the settings * description can state them in one place without reaching into store * internals or duplicating magic numbers. */ export declare const CODE_INDEX_MAX_FILES = 5000; export declare const CODE_INDEX_MAX_FILE_BYTES: number; export declare const CODE_INDEX_MAX_TOTAL_BYTES: number; export interface CodeIndexServicesDeps { readonly workingDirectory: string; /** The owning product's storage scope, the `` the index file sits under. */ readonly surfaceRoot: string; readonly configManager: Pick; readonly memoryEmbeddingRegistry: MemoryEmbeddingProviderRegistry; /** * Memory-governor backpressure (optional): when the governor pauses the * 'code-index-reindex' job, the tool-site reindex scheduler stops scheduling * new work; the critical tier refuses new reindex work outright via * admitExpensiveWork. Absent (most test fixtures) → never paused, always * admitted, exactly as before. */ readonly isReindexPaused?: (() => boolean) | undefined; readonly admitExpensiveWork?: ((label: string) => { allowed: boolean; reason?: string | undefined; }) | undefined; } /** * Whether code auto-injection / tool-site reindex may run: the SAME * storage.codeIndexEnabled switch that gates auto-build. Read live so a runtime * /config toggle takes effect without restart. (The separate, default-off * `agent-passive-code-injection` feature flag gates injection additionally; this * is only the storage-side setting the SDK asks embedders to respect.) */ export declare function isCodeInjectionSettingEnabled(configManager: Pick): boolean; export interface CodeIndexServices { readonly codeIndexStore: CodeIndexStore; /** * Tool-site incremental reindex scheduler, bound to codeIndexStore and * gated live on storage.codeIndexEnabled. Threaded into both SDK orchestrators (main + * agent) so a successful write/edit debounces an incremental reindex, and into the command * context so /codebase status can report the last reindex activity honestly. */ readonly codeIndexReindexScheduler: CodeIndexReindexScheduler; } /** Absolute path to a product's code-index sqlite file, sibling to memory.sqlite under `.goodvibes//`. */ export declare function codeIndexDbPath(workingDirectory: string, surfaceRoot: string): string; /** * Build the runtime's `rerootStores` implementation, called by * WorkspaceSwapManager after it has verified a new working directory. * * Only working-tree-bound stores move. The memory store is deliberately NOT * rerooted: it is the home-scoped canonical cross-surface store, and moving * it per project would re-silo memory back into the per-project stores that * were consolidated away. */ export declare function createStoreRerooter(deps: { readonly codeIndexStore: Pick; readonly projectIndex: { reroot(dir: string): Promise; }; /** The owning product's storage scope, so the rerooted index lands in its own directory. */ readonly surfaceRoot: string; }): (newWorkingDir: string) => Promise; /** * Whether the code index's initial build should auto-start on construction. * Exported so /codebase status and the settings modal read the exact same * config key + default this module decides auto-start from. */ export declare function isCodeIndexAutoStartEnabled(configManager: Pick): boolean; /** * Constructs the CodeIndexStore. Schema-init runs unconditionally * (init() never throws, it degrades to an honest `available: false` + * recorded error on failure, mirrored by CodeIndexStats/describeDegradation); * the initial full build only fires when isCodeIndexAutoStartEnabled() is * true, via the SAME fire-and-forget scheduleBuild() an explicit * `/codebase build` invocation uses. */ export declare function createCodeIndexServices(deps: CodeIndexServicesDeps): CodeIndexServices; //# sourceMappingURL=code-index-services.d.ts.map