/** * DSH OpenViking browser plugin: the OpenViking configuration page as this * bundle's own seat on the Plugins page (`plugins.bundle.config`), rendered on * the bundle's detail page over the profile entry that loads this plugin. * * DSH 0.2.0 is why this is NOT the `plugins.item` slot. That seat now belongs * to the official settings pages and renders inside the Plugins page's Official * (官方) group, so a third-party bundle registering there presents itself as an * official plugin. A bundle's own configuration goes to * `plugins.bundle.config` (keyed by the package name the profile installs) or * `plugins.row.config` (keyed by `#`) instead; the page looks * for both under `已安装` → this plugin's detail page. * * DSH 0.1.7 dropped the `openviking` settings namespace, the settings-provider * seam, and with them the `/_dsh/openviking/settings` HTTP route this page used * to read and write through. Configuration now IS the profile entry's `Config` * schema: the entry id declared by `cordis.patch.yml` is the settings * namespace, the Plugins page hands the browser a shared form for it * (`ctx.configForms`), and this page stages edits into that form and writes * them on one save. The Host half reads the same row (`src/config.ts` mirrors * the identical entry id), so an accepted save lands in the running plugin * without a reload. * * The API key is still NOT a settings field. Its literal lives in the DSH * credential store under the reference the `credential` field names, and the * page reads and writes it through the `credentials` Remote domain * (`ctx.remote.credentials.describe` / `.set`) instead of an HTTP route. The * browser only ever learns whether the credential is configured, which source * layer supplies it, and whether the domain accepts a write — never the value. * * The card binds the slot contract with `import type` only: * `@deepseek-ai/dsh-client-ui-plugin-manager` declares `plugins.item`, and its * client entry exports types (never render values) for external plugins. The * shared `SettingsForm` frame and its field primitives are public * (`@deepseek-ai/dsh-client-ui-primitives`), so the frame is reused while the * value controls keep this plugin's own inline styling. */ import type { ReactNode } from 'react'; import type { SettingsFieldState, SettingsFormActions, SettingsFormScopeSnapshot, SettingsFormShell } from '@deepseek-ai/dsh-client-ui-primitives'; import type { Context as ClientContext } from '@deepseek-ai/cordis'; import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'; import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'; type LocaleDict = { settingsIntro: string; externalNotice: string; connection: string; endpoint: string; endpointHint: string; account: string; accountHint: string; user: string; userHint: string; peerId: string; peerIdHint: string; credential: string; credentialHint: string; apiKey: string; apiKeyHint: string; apiKeyBlank: string; apiKeyInvalid: string; apiKeyLocked: string; credentialConfigured: string; credentialMissing: string; sourceHint: string; behavior: string; workspacePeer: string; workspacePeerHint: string; recallPeerScope: string; recallPeerScopeAll: string; recallPeerScopeActor: string; recallPeerScopeHint: string; recallLimit: string; recallLimitHint: string; recallTokenBudget: string; recallTokenBudgetHint: string; scoreThreshold: string; scoreThresholdHint: string; recallTimeoutMs: string; recallTimeoutMsHint: string; commitTokenThreshold: string; commitTokenThresholdHint: string; injectProfile: string; injectProfileHint: string; injectSkills: string; injectSkillsHint: string; capture: string; captureToolResults: string; captureToolResultsHint: string; captureAssistantTurns: string; captureAssistantTurnsHint: string; syncTurns: string; syncTurnsHint: string; statusReady: string; statusLoading: string; statusUnavailable: string; overridden: string; reset: string; invalidNumber: string; readOnly: string; unavailable: string; save: string; saving: string; saveFailed: string; }; /** The `openviking-memory-runtime` entry's settings section, as the browser reads it. */ interface SettingsValue { /** OpenViking server base URL. */ endpoint?: string; /** DSH Credential reference holding the Bearer API key. */ credential?: string; /** Trusted-mode account. */ account?: string; /** Trusted-mode user. */ user?: string; /** Explicit actor peer id. */ peerId?: string; /** Derive an actor peer from each session workspace. */ workspacePeer?: boolean; /** Recall peer scope: `all` for cross-workspace recall or `actor` for isolation. */ recallPeerScope?: 'all' | 'actor'; /** Max recalled items per pre-step block. */ recallLimit?: number; /** Token budget for each pre-step recall block. */ recallTokenBudget?: number; /** Minimum score threshold for recall hits. */ scoreThreshold?: number; /** Hard deadline (ms) for one pre-step recall attempt. */ recallTimeoutMs?: number; /** Pending-token threshold that triggers a commit at turn end. */ commitTokenThreshold?: number; /** Whether the per-session profile block is injected. */ injectProfile?: boolean; /** Whether skills saved in OpenViking join the DSH skill catalog. */ injectSkills?: boolean; /** Whether tool-result messages are captured into memory. */ captureToolResults?: boolean; /** Whether assistant turns are captured into memory. */ captureAssistantTurns?: boolean; /** Whether capture runs synchronously on each session/event. */ syncTurns?: boolean; } /** Staged state of every editable setting on this page, keyed by its field name. */ interface OpenVikingFields { endpoint: SettingsFieldState; account: SettingsFieldState; user: SettingsFieldState; peerId: SettingsFieldState; workspacePeer: SettingsFieldState; recallPeerScope: SettingsFieldState; recallLimit: SettingsFieldState; recallTokenBudget: SettingsFieldState; scoreThreshold: SettingsFieldState; recallTimeoutMs: SettingsFieldState; commitTokenThreshold: SettingsFieldState; injectProfile: SettingsFieldState; injectSkills: SettingsFieldState; captureToolResults: SettingsFieldState; captureAssistantTurns: SettingsFieldState; syncTurns: SettingsFieldState; } /** Availability of this entry's form, as the shared scope reports it. */ type OpenVikingStatus = SettingsFormScopeSnapshot['status']; /** Why a pasted API key was rejected; also the locale key explaining it. */ type KeyRejection = 'apiKeyBlank' | 'apiKeyInvalid'; /** What the OpenViking page renders. */ interface OpenVikingCardState extends SettingsFormShell, OpenVikingFields { /** Availability of this entry's form, mirrored as the page's status pill. */ status: OpenVikingStatus; /** The staged credential; it starts blank on every load. */ apiKey: SettingsFieldState; /** Whether the credentials domain reports a value configured for the reference in force. */ apiKeyConfigured: boolean; /** Whether the credentials domain accepts a write for it; false disables the control. */ apiKeyWritable: boolean; /** Credential reference the entry currently names (or this plugin's default). */ credentialRef: string; /** Source layer supplying the value; absent while unconfigured. */ credentialSource?: string | undefined; /** Client-side paste rejection, shown in place of the credential hint. */ keyError?: KeyRejection | undefined; } /** The registration-side face this page's slot entry injects. */ interface OpenVikingCardFace extends SettingsFormActions { hooks: { /** Page snapshot bound by the renderer as `useOpenVikingCard`. */ openVikingCard: SnapshotStore; }; } /** Props the Plugins page binds for this page. */ type OpenVikingCardProps = PropsRuntime<'plugins.bundle.config'> & PropsLocale<'openviking'> & InjectFace; /** * Render the OpenViking page's one-liner or its settings form, as the Plugins * page asks. * @param props - the view asked for, locale copy, the form snapshot, and its actions. * @returns the one-liner, or the form. */ export declare function OpenVikingCard(props: OpenVikingCardProps): ReactNode; declare module '@deepseek-ai/dsh-client-ui-slots' { interface LocaleNamespaceMap { /** OpenViking Memory page copy. */ openviking: keyof LocaleDict; } } /** * Required client services: the slot registry, the locale registry, the Remote * domain (and its `credentials` namespace), and the shared configuration forms * keyed by profile entry id. */ export declare const inject: string[]; /** * Mount the OpenViking configuration page while the Host serves its entry. The * page is a keyed slot entry, so it needs no label of its own: the Plugins page * draws the bundle's title and description from `locale/*.json` and renders * this form on the bundle's detail page. * @param ctx - the browser plugin context. */ export declare function apply(ctx: ClientContext): void; export {}; //# sourceMappingURL=index.d.ts.map