/** * Plugin configuration, declared as the Cordis `Config` schema of the profile * entry this plugin is loaded as. * * DSH 0.1.7 removed the settings-provider seam (`settings.register()` / * `settings.installSection()`, the `openviking` settings namespace and the * `settings.yaml` document). Configuration now lives in the profile patch row * that loads this plugin, and the row's `Config` schema is what DSH projects * into a configuration form. Every user-settable field is declared * `.volatile()`, which is what makes it (a) live-editable from a form, (b) * carried into the plugin as a stable reference rather than a copied value, * and (c) re-readable at any moment through `Volatile.get()`. See * {@link OpenVikingSettingsInput} and {@link resolveConfig}. * * Configuration comes ONLY from that entry config (plus built-in defaults): * `OPENVIKING_*` environment variables and `~/.openviking` config files are * never consulted. Secrets never live in source or in the entry config — * `credential` is a DSH Credential reference (an environment-style name) * resolved per request through `ctx.credentials`; the value itself is owned by * the DSH credential store. * @module openviking-memory/config */ import z from '@deepseek-ai/schemastery'; import type { Volatile } from '@deepseek-ai/cordis'; import { type CredentialRef } from '@deepseek-ai/dsh-credentials'; /** * Id of the profile entry this plugin is loaded as, declared by this bundle's * `cordis.patch.yml` (`insert` → group `openviking-memory` → row * `openviking-memory-runtime`). * * DSH 0.1.7 addresses configuration forms by profile entry id, so this literal * is the plugin's settings identity: `settings.describe()` keys its descriptor * by it, `settings/document-updated` reports it, and the browser page registers * its `plugins.item` entry under it. The browser half mirrors the same literal * in `src/client/index.tsx` (the two halves compile separately), so a change * here must be made in both places. */ export declare const OPENVIKING_ENTRY_ID = "openviking-memory-runtime"; /** Default OpenViking server endpoint. */ export declare const DEFAULT_OPENVIKING_ENDPOINT = "http://127.0.0.1:1933"; /** Default DSH Credential reference holding the OpenViking API key. */ export declare const DEFAULT_OPENVIKING_CREDENTIAL = "OPENVIKING_API_KEY"; /** User-settable fields surfaced by the settings schema. */ export interface OpenVikingSettings { /** OpenViking server base URL. */ endpoint: string; /** DSH Credential reference holding the Bearer API key (an environment-style name). */ credential: string; /** Trusted-mode account. */ account: string; /** Trusted-mode user. */ user: string; /** Explicit actor peer id (overrides the workspace-derived peer). */ peerId: string; /** Derive an actor peer from each DSH session workspace. */ workspacePeer: boolean; /** Recall peer scope: `all` for cross-workspace recall or `actor` for isolation. */ recallPeerScope: 'all' | 'actor'; /** Hard deadline (ms) for one pre-step recall attempt; past it, recall is skipped. */ recallTimeoutMs: number; /** Server-side query expansion: `off` to disable or `auto`. */ recallQueryExpansion: 'off' | 'auto'; /** Whether to capture turns synchronously on session/event. */ syncTurns: boolean; /** Token budget for each pre-step recall block. */ recallTokenBudget: number; /** Max content characters per recalled item. */ recallMaxContentChars: number; /** Prefer item abstracts over full reads in fallback recall. */ recallPreferAbstract: boolean; /** Max recalled items per pre-step block. */ recallLimit: number; /** Minimum score threshold for recall hits. */ scoreThreshold: number; /** Minimum query length before recall runs. */ minQueryLength: number; /** Token budget for the session-start profile injection. */ profileTokenBudget: number; /** Whether the per-session profile block (user-profile + available-memories) is injected. */ injectProfile: boolean; /** Pending-token threshold that triggers a commit at turn/end. */ commitTokenThreshold: number; /** Recent messages kept verbatim by a commit. */ commitKeepRecentCount: number; /** Whether tool-result messages are captured into memory. */ captureToolResults: boolean; /** Whether assistant turns are captured into memory. */ captureAssistantTurns: boolean; /** Whether skills saved in OpenViking are injected into the DSH skill catalog. */ injectSkills: boolean; /** Capture mode: `semantic` or `keyword`. */ captureMode: 'semantic' | 'keyword'; /** Max characters captured per message. */ captureMaxLength: number; /** Max characters per captured tool result. */ captureToolMaxChars: number; /** HTTP request timeout in milliseconds. */ requestTimeoutMs: number; } /** * What the loader hands `apply`: one volatile reference per user-settable * field instead of a copied value. * * `Volatile` is the only shape a schema field declared `.volatile()` has at * runtime — the loader keeps updating that one object in place so a * configuration write lands in the running plugin without a reload. Read it * with `get()`, and never hold on to the value itself: see * {@link resolveConfig}, which snapshots the whole entry at one moment. */ export type OpenVikingSettingsInput = { [K in keyof OpenVikingSettings]: Volatile; }; /** * Every shape one entry config may arrive in: the loader's volatile * references, or the plain partial a caller (or a test) passes instead. */ export type OpenVikingEntryConfig = Partial | Partial; /** Fully resolved configuration consumed by the runtime. */ export type OpenVikingConfig = Omit & { /** Validated DSH Credential reference holding the Bearer API key. */ credential: CredentialRef; /** Effective actor peer after workspace/explicit resolution. */ resolvedPeerId?: string; /** Explicit peer provided by the user (empty when none). */ explicitPeerId: string; /** User-Agent sent on OpenViking-bound requests. */ userAgent: string; /** Whether recallQueryExpansion was explicitly configured in settings. */ recallQueryExpansionConfigured: boolean; /** Whether recallLimit was explicitly configured in settings. */ recallLimitConfigured: boolean; }; /** * Cordis `Config` schema of this plugin's profile row, with documented * defaults. * * DSH resolves a row's config against this schema and hands the plugin the * mapped {@link OpenVikingSettingsInput}. Every field is `.default(...)` + * `.volatile()`, which is what puts it on DSH's configuration form: a * non-volatile field is ordinary composition configuration that no form may * edit. `default()` keeps the schema usable with no config at all, so the * plugin still activates on a bare row. * * The schema is deliberately not annotated: a volatile object schema's INPUT * and OUTPUT types differ (a plain partial in, `Volatile` references out), and * inferring both from this one declaration is what keeps them in step. */ export declare const Config: z; credential: z; account: z; user: z; peerId: z; workspacePeer: z; recallPeerScope: z<"all" | "actor", "all" | "actor", "volatile-defined">; recallTimeoutMs: z; recallQueryExpansion: z<"off" | "auto", "off" | "auto", "volatile-defined">; syncTurns: z; recallTokenBudget: z; recallMaxContentChars: z; recallPreferAbstract: z; recallLimit: z; scoreThreshold: z; minQueryLength: z; profileTokenBudget: z; injectProfile: z; commitTokenThreshold: z; commitKeepRecentCount: z; captureToolResults: z; captureAssistantTurns: z; injectSkills: z; captureMode: z<"semantic" | "keyword", "semantic" | "keyword", "volatile-defined">; captureMaxLength: z; captureToolMaxChars: z; requestTimeoutMs: z; }>>, Schemastery.ObjectT; credential: z; account: z; user: z; peerId: z; workspacePeer: z; recallPeerScope: z<"all" | "actor", "all" | "actor", "volatile-defined">; recallTimeoutMs: z; recallQueryExpansion: z<"off" | "auto", "off" | "auto", "volatile-defined">; syncTurns: z; recallTokenBudget: z; recallMaxContentChars: z; recallPreferAbstract: z; recallLimit: z; scoreThreshold: z; minQueryLength: z; profileTokenBudget: z; injectProfile: z; commitTokenThreshold: z; commitKeepRecentCount: z; captureToolResults: z; captureAssistantTurns: z; injectSkills: z; captureMode: z<"semantic" | "keyword", "semantic" | "keyword", "volatile-defined">; captureMaxLength: z; captureToolMaxChars: z; requestTimeoutMs: z; }>>, "plain">; /** Whether a value is a volatile config reference rather than a plain setting. */ export declare function isConfigReference(value: unknown): value is Volatile; /** * Snapshot one entry config into plain values, dropping absent fields. * * Accepts both the loader's volatile references and the plain object tests * hand in, because {@link resolveConfig} is the single entry point for both. * Presence is what the caller sees: a field whose reference currently holds * `undefined` is dropped rather than reported as present-and-undefined, so the * `*Configured` flags below keep meaning "the user set this". * @param input - the entry config as the loader or a caller supplied it. * @returns a detached plain partial of the same fields. */ export declare function plainConfigInput(input: OpenVikingEntryConfig): Partial; /** * Validate and normalize a resolved entry config (schema defaults already * materialized). Accepts either the loader's volatile references or a plain * partial, so the same call serves the running plugin and the tests. * Configuration comes only from the entry config — no environment variables or * `~/.openviking` config files are consulted. * @param raw - the entry config as the loader supplied it, or a plain override. * @param cwd - workspace (injectable for tests). */ export declare function resolveConfig(raw?: OpenVikingEntryConfig, cwd?: string): OpenVikingConfig; //# sourceMappingURL=config.d.ts.map