/** * Load and validate trading recipe YAML. Resolves env vars and validates with Zod. * SECURITY: Do not log the resolved config or pathOrContent; they may contain * secrets substituted from environment variables. */ import { type ZodIssue } from "zod"; import { type RuntimeConfig } from "./runtime-schema.js"; export interface LoadRuntimeConfigOptions { fromPath?: boolean; } /** * Minimal valid YAML structure shown in validation errors so users can fix their file. * Keep this in sync with runtimeConfigSchema (name + strategy with wallet). */ export declare const MINIMAL_RECIPE_YAML_SAMPLE = "# Required: name and a strategy with a wallet\nname: my-recipe\n# version: 1 # optional; defaults to current (1). Supports integer or semver string.\nstrategy:\n wallet: \"your-wallet-address\"\n # optional: slots, margin_pct, margin_per_slot, enabled, etc.\n\n# Optional: scanners, actions, exit. Run: openclaw senpi guide examples\n"; /** * The clarified form of a schema issue: the message, and the hint that explains it when one applies. * * Kept as two fields rather than one joined string because there are two consumers with different * needs. The thrown error reads as prose, so it concatenates them; `senpi validate` renders them as * separate fields (`what` and `why`), and re-splitting a joined sentence would be guesswork. */ export interface ClarifiedIssue { message: string; hint?: string; } /** * Return a clearer message for known validation paths, plus the hint that applies. * * Exported so the validate collector uses the same {@link HINTS} table as the thrown error — one * source of guidance, rendered two ways, rather than a second table that drifts. */ export declare function clarifyIssue(issue: Pick): ClarifiedIssue; /** * Rejects configs where two or more scanner entries share the same `name`. * * Scanner names are used as artifact keys for context-producing scanners and as * identifiers throughout the composition graph, so uniqueness is a hard * runtime invariant. The error message includes every offending index * (`scanners.`) so operators can locate both occurrences in YAML rather * than only the second one encountered. */ /** * Names that appear more than once, mapped to every index they appear at. * * Exported so the validate collector detects duplicates the same way the thrown assert does. Only * the detection is shared — each caller formats its own output, which is why this returns positions * rather than a message. */ export declare function findDuplicateNames(items: readonly { name: string; }[]): Map; /** * Load trading recipe from a file path or YAML string. * - If fromPath is true, pathOrContent is a file path. * - Otherwise pathOrContent is the YAML string. * After parse, env vars are resolved and the result is validated with the Zod schema. * Throws with path-based error messages on validation failure. */ export declare function loadRuntimeConfig(pathOrContent: string, options?: LoadRuntimeConfigOptions): Promise; /** * Like {@link loadRuntimeConfig} but also returns the **unresolved** parsed config (raw YAML object, * `${VAR}` placeholders intact). Telemetry fingerprints and snapshots the recipe with the unresolved * form — never the resolved one, which would inline secrets — so the boot path needs both. */ export declare function loadRuntimeConfigWithRaw(pathOrContent: string, options?: LoadRuntimeConfigOptions): Promise<{ config: RuntimeConfig; unresolved: Record; }>; //# sourceMappingURL=load-runtime-config.d.ts.map