/** * Pure helpers behind the Hindsight OpenClaw setup wizard. Kept separate from * setup.ts (the @clack/prompts entry point) so the mechanical bits are easy to * unit test without simulating an interactive terminal. * * Scanner-safe: imports no subprocess APIs and does not read any environment * variable. All config writing is an atomic rename over the OpenClaw config JSON. */ export declare const PLUGIN_ID = "hindsight-openclaw"; /** * Default Hindsight Cloud endpoint. Update this when the hosted service URL is * finalized, or users can override it at the prompt. */ export declare const HINDSIGHT_CLOUD_URL = "https://api.hindsight.vectorize.io"; export declare const DEFAULT_OPENCLAW_CONFIG_PATH: string; export interface SecretRef { source: "env" | "file" | "exec"; provider: string; id: string; } export interface PluginEntry { enabled?: boolean; config?: Record; } export interface OpenClawConfigShape { plugins?: { entries?: Record; [key: string]: unknown; }; [key: string]: unknown; } export type SetupMode = "cloud" | "api" | "embedded"; export declare const NO_KEY_PROVIDERS: ReadonlySet; export declare function loadConfig(path: string): Promise; export declare function saveConfig(path: string, cfg: OpenClawConfigShape): Promise; /** * Ensure a `plugins.entries["hindsight-openclaw"].config` object exists, set * `enabled: true`, and return the mutable config record. Idempotent — safe to * call against a fresh or already-configured OpenClaw config. */ export declare function ensurePluginConfig(cfg: OpenClawConfigShape): Record; export declare function envSecretRef(id: string): SecretRef; export declare function clearCloudFields(pluginConfig: Record): void; export declare function clearLocalLlmFields(pluginConfig: Record): void; export declare function isValidEnvVarName(value: string | undefined): boolean; export declare function defaultApiKeyEnvVar(provider: string): string; /** * Cloud mode credential: either a direct token value (stored inline as a * plaintext string in openclaw.json) or an env var name (stored as a * SecretRef that OpenClaw resolves from `process.env` at startup). * * Interactive wizard defaults to the direct-value form — simpler UX for * users pasting a freshly-issued cloud token. CI / production flows should * prefer `tokenEnvVar` via `openclaw config set ... --ref-source env` or * `--token-env` to keep secrets off disk. */ export interface CloudSetupInput { apiUrl?: string; token?: string; tokenEnvVar?: string; } export interface ApiSetupInput { apiUrl: string; token?: string; tokenEnvVar?: string; } export interface EmbeddedSetupInput { llmProvider: string; apiKey?: string; apiKeyEnvVar?: string; llmModel?: string; } /** * Apply the Cloud mode to a plugin config in place: sets `hindsightApiUrl` and * `hindsightApiToken` (either as a plaintext string or as a SecretRef — * whichever the caller provided), strips any leftover local-LLM fields so * mode switches don't carry stale state. */ export declare function applyCloudMode(pluginConfig: Record, input: CloudSetupInput): void; /** * Apply the external-API mode to a plugin config in place: sets a required * `hindsightApiUrl`, optional `hindsightApiToken` (plaintext or SecretRef), * and strips any leftover local-LLM fields so mode switches don't carry * stale state. */ export declare function applyApiMode(pluginConfig: Record, input: ApiSetupInput): void; /** * Apply the embedded-daemon mode to a plugin config in place: sets * `llmProvider`, optional `llmApiKey` (plaintext or SecretRef), optional * `llmModel`, and strips any external-API settings so mode switches don't * carry stale state. */ export declare function applyEmbeddedMode(pluginConfig: Record, input: EmbeddedSetupInput): void; export declare function summarizeCloud(input: CloudSetupInput): string; export declare function summarizeApi(input: ApiSetupInput): string; export declare function summarizeEmbedded(input: EmbeddedSetupInput): string;