/** * The closed set of `senpi validate` finding codes, and their metadata. * * Same shape as `utils/event-catalog.ts`'s `SENPI_ERROR_CODE`: a const map for call sites plus a * companion record for per-code data. Two structures rather than one because the map gives call * sites `VALIDATE_CODE.scanMissing` instead of a bare string literal, and the record is a * `Record` so the compiler — not a test — enforces that every code has metadata. * * ## Why these do not reuse the supervision codes * * `SENPI_ERROR_CODE` already carries `E_SCANNER_TICK_ERROR` / `E_SCANNER_TICK_TIMEOUT`, and some * conditions here are the same *condition*. They are deliberately NOT reused. A validation finding * is an authoring-time observation; a supervision code is a production event on a running * strategy. Sharing identifiers would make authoring noise indistinguishable from production * failure the moment anything starts consuming either — dashboards, alerts, or the telemetry that * exists to show which mistakes agents actually make. * * ## Severity lives in the prefix * * `E_` fails the run; `W_` is reported and only fails under `--strict`. Severity is DERIVED from * the prefix rather than declared, so the two can never disagree. */ import type { Actor, FixKind, Severity, ValidationStage } from "./types.js"; /** * Call-site handles for every validate code. * * Grouped by the stage that produces them. Codes are added here as the layer that raises them * lands — the table is the taxonomy, so an entry with no producer is a promise, not a record. */ export declare const VALIDATE_CODE: { /** The target path does not exist. */ readonly targetNotFound: "E_VALIDATE_TARGET_NOT_FOUND"; /** A directory with no recipe in it — often a package root holding instance directories. */ readonly noRecipe: "E_VALIDATE_NO_RECIPE"; /** More than one recipe candidate and no conventional name to break the tie. */ readonly ambiguousRecipe: "E_VALIDATE_AMBIGUOUS_RECIPE"; /** A `strategy.yaml` is present and will not load, so which recipe it means is unknown. */ readonly unreadableManifest: "E_VALIDATE_UNREADABLE_MANIFEST"; /** A depth that needs a recipe was requested against a target that has none. */ readonly needsRecipe: "E_VALIDATE_NEEDS_RECIPE"; /** Inline recipe content with no directory to resolve a relative scanner path against. */ readonly needsDir: "E_VALIDATE_NEEDS_DIR"; /** `--scanner` named something the recipe does not declare. */ readonly unknownScanner: "E_VALIDATE_UNKNOWN_SCANNER"; /** `--wallet` is not a well-formed address. */ readonly badWallet: "E_VALIDATE_BAD_WALLET"; /** The recipe is not parseable. */ readonly yamlSyntax: "E_VALIDATE_YAML_SYNTAX"; /** The recipe parses but violates the schema. */ readonly schema: "E_VALIDATE_SCHEMA"; /** Two scanners share a name — they would silently share state. */ readonly dupScannerName: "E_VALIDATE_DUP_SCANNER_NAME"; /** Two actions share a name — same problem. */ readonly dupActionName: "E_VALIDATE_DUP_ACTION_NAME"; /** An action prompt references a placeholder nothing supplies. */ readonly promptPlaceholder: "E_VALIDATE_PROMPT_PLACEHOLDER"; /** The exit/protection block is absent or invalid. */ readonly exitPreset: "E_VALIDATE_EXIT_PRESET"; /** An entry action with no resolvable margin source: it starts, then declines every signal. */ readonly unsized: "E_VALIDATE_UNSIZED"; /** An entry action with no risk guardrails. */ readonly ungated: "E_VALIDATE_UNGATED"; /** A declared entrypoint file that is not on disk. */ readonly entrypointMissing: "E_VALIDATE_ENTRYPOINT_MISSING"; /** A scanner path that cannot be resolved to an absolute directory. */ readonly unresolvableScannerPath: "E_VALIDATE_UNRESOLVABLE_SCANNER_PATH"; /** A margin percentage given as a fraction — sizes a hundred times too small, silently. */ readonly marginPctFraction: "E_VALIDATE_MARGIN_PCT_FRACTION"; /** An LLM-mode decision action with no model configured. */ readonly llmNoModel: "E_VALIDATE_LLM_NO_MODEL"; /** The recipe does not bind the wallet its package manifest declares for it. */ readonly walletUnbound: "E_VALIDATE_WALLET_UNBOUND"; /** The recipe ships no DSL exit block, so every position it opens runs with nothing to close it. */ readonly noDslExit: "E_VALIDATE_NO_DSL_EXIT"; /** A scanner entry declares `enabled`, which the engine never reads — it registers and ticks. */ readonly scannerEnabled: "E_VALIDATE_SCANNER_ENABLED"; /** The package id carries capitals, so its attribution stamp is written and read under two spellings. */ readonly packageIdCase: "E_VALIDATE_PACKAGE_ID_CASE"; /** Two instances resolve to one directory, so one proof file would answer for both recipes. */ readonly instanceDirCollision: "E_VALIDATE_INSTANCE_DIR_COLLISION"; /** A syntax error in some file under the scanner root — including files never imported. */ readonly syntax: "E_VALIDATE_SYNTAX"; /** The entrypoint's import chain raised. */ readonly importFailed: "E_VALIDATE_IMPORT_FAILED"; /** The module imported but exposes no entry function. */ readonly scanMissing: "E_VALIDATE_SCAN_MISSING"; /** The entry symbol exists but is not callable. */ readonly scanNotCallable: "E_VALIDATE_SCAN_NOT_CALLABLE"; /** The entry function's signature does not match the contract. */ readonly scanBadArity: "E_VALIDATE_SCAN_BAD_ARITY"; /** A package marker in the scanner root — invites relative imports that fail at run time. */ readonly scannersIsPackage: "W_VALIDATE_SCANNERS_IS_PACKAGE"; /** A file shadowing a standard-library module for everything imported after it. */ readonly shadowsStdlib: "W_VALIDATE_SHADOWS_STDLIB"; /** Data sourced outside the sanctioned client — invisible to the runtime and to this check. */ readonly nonMcpSource: "W_VALIDATE_NON_MCP_SOURCE"; /** The tick raised. */ readonly tickException: "E_VALIDATE_TICK_EXCEPTION"; /** The tick exceeded the budget its own recipe declares. */ readonly tickTimeout: "E_VALIDATE_TICK_TIMEOUT"; /** Clean tick, no data read — nothing proves the scanner can fetch anything. */ readonly tickUnproven: "E_VALIDATE_TICK_UNPROVEN"; /** The scanner attempted to send data out. Validation collects and reports; it never delivers. */ readonly egressBlocked: "E_VALIDATE_EGRESS_BLOCKED"; /** The scanner attempted a state-changing operation. */ readonly mcpPermission: "E_VALIDATE_MCP_PERMISSION"; /** Every data read failed — the scanner could not fetch anything. */ readonly mcpToolError: "E_VALIDATE_MCP_TOOL_ERROR"; /** A data source that does not exist. Swallowed by the contract, so silent in production. */ readonly unknownMcpTool: "E_VALIDATE_UNKNOWN_MCP_TOOL"; /** A hardcoded instrument that is not tradeable. */ readonly unknownTicker: "E_VALIDATE_UNKNOWN_TICKER"; /** * A hardcoded instrument in the package that is not live on the exchange. Deploy's pre-money * check, run here too — it needs one live read, which is why it belongs to this depth. */ readonly universeNotLive: "E_VALIDATE_UNIVERSE_NOT_LIVE"; /** * That check could not run because the PACKAGE would not read — the manifest, or an instance * recipe. Reported rather than passed over: a green verdict covering a check that never ran is * the failure this command exists to correct. A warning, not an error, because it is ignorance * about the package rather than evidence of a dead name. */ readonly universeUnchecked: "W_VALIDATE_UNIVERSE_UNCHECKED"; /** * That check could not run because the LIVE INSTRUMENT LIST would not read. A separate code from * the one above because the actor differs: an unreadable list is an environment fault, and an * agent that answers it by editing the package will loop. */ readonly universeUnavailable: "W_VALIDATE_UNIVERSE_UNAVAILABLE"; /** An emitted signal the runtime would reject on arrival. */ readonly signalRejected: "E_VALIDATE_SIGNAL_REJECTED"; /** Credentials absent or partially configured. */ readonly noCredentials: "E_VALIDATE_NO_CREDENTIALS"; /** A required runtime dependency is not installed. */ readonly envMissingSdk: "E_VALIDATE_ENV_MISSING_SDK"; /** The import checker itself could not run — the environment, not the package. */ readonly importHarnessFailed: "E_VALIDATE_IMPORT_HARNESS_FAILED"; /** Loading the scanner's modules did not terminate. */ readonly importTimeout: "E_VALIDATE_IMPORT_TIMEOUT"; /** The tick process had to be killed — it stalled past where its own budget could reach. */ readonly tickUnresponsive: "E_VALIDATE_TICK_UNRESPONSIVE"; /** An exception was raised and caught — invisible in production, where it looks healthy. */ readonly suppressedException: "W_VALIDATE_SUPPRESSED_EXCEPTION"; /** Some reads failed while others succeeded. */ readonly someReadsFailed: "W_VALIDATE_MCP_TOOL_ERROR"; /** A response was fetched and none of it read — usually a key that does not exist. */ readonly unusedMcpResponse: "W_VALIDATE_UNUSED_MCP_RESPONSE"; /** Numeric values delivered as text: arithmetic raises, but comparison silently misorders. */ readonly stringNumerics: "W_VALIDATE_STRING_NUMERICS"; /** A clean tick that emitted nothing. Normal for a quiet scanner; worth surfacing. */ readonly noSignalsEmitted: "W_VALIDATE_NO_SIGNALS_EMITTED"; /** Signals emitted having read nothing — output derived from no input. */ readonly signalsWithoutReads: "W_VALIDATE_SIGNALS_WITHOUT_READS"; /** The recipe declares no author-written scanner, so there is no code to prove. */ readonly noExternalScanners: "W_VALIDATE_NO_EXTERNAL_SCANNERS"; /** An emitted margin percentage below 1 — accepted by the schema, but likely a fraction. */ readonly marginPctSuspicious: "W_VALIDATE_MARGIN_PCT_SUSPICIOUS"; /** No proof exists for this package's content. */ readonly noProof: "E_VALIDATE_NO_PROOF"; /** A proof exists, but the package has changed since it was made. */ readonly contentChanged: "E_VALIDATE_CONTENT_CHANGED"; /** The runtime moved since the proof was made, so it no longer describes this runtime. */ readonly runtimeVersionChanged: "E_VALIDATE_RUNTIME_VERSION_CHANGED"; /** The run passed but the proof could not be written. Not a defect in the strategy. */ readonly proofNotRecorded: "W_VALIDATE_PROOF_NOT_RECORDED"; }; /** The closed set of validate finding codes. */ export type ValidateCode = (typeof VALIDATE_CODE)[keyof typeof VALIDATE_CODE]; /** Per-code metadata. Severity is absent by design — it is derived from the code's prefix. */ export interface ValidateCodeMeta { stage: ValidationStage; actor: Actor; fix_kind: FixKind; /** One line, present tense: the condition that raises this code. Renders into the taxonomy doc. */ condition: string; } /** * Metadata for every code. * * Typed as a total `Record`, so adding a code to {@link VALIDATE_CODE} without describing it here * is a compile error rather than something a test has to notice. */ export declare const VALIDATE_CODE_META: Record; /** Every code, in declaration order. */ export declare const ALL_VALIDATE_CODES: readonly ValidateCode[]; /** * Severity for a code, derived from its prefix so the two can never disagree. * * `E_` fails the run. `W_` is reported and only fails under `--strict`. */ export declare function severityOf(code: ValidateCode): Severity; /** Every code raised at a given depth. Used to scope coverage while stages are still being built. */ export declare function codesForStage(stage: ValidationStage): ValidateCode[]; //# sourceMappingURL=codes.d.ts.map