Files
rea/src/contracts/providerSelection.ts
T
N0zoM1z0andN0zoM1z0 941d7101dd feat(session): add explicit provider registry and target binding
Introduce deterministic deep-provider discovery and immutable per-target routing while retaining disjoint artifact and native capability families.

Expose provider selection consistently through MCP, CLI, environment configuration, session status, prompt completion, typed diagnostics, and generated documentation. Preserve exact provider/profile provenance without request racing or transparent fallback.

Cover overlapping providers, ambiguity, rejection details, cancellation, restoration, package installation, and real Hopper target switching.
2026-07-15 22:13:48 +09:00

39 lines
1.1 KiB
TypeScript

import { z } from "zod";
/** Stable provider identifier accepted at CLI, MCP, and environment boundaries. */
export const analysisProviderIdSchema = z
.string()
.min(1)
.max(64)
.regex(/^[a-z][a-z0-9-]*$/u)
.refine((value) => value !== "auto", {
message: "auto is reserved for provider selection",
});
/** Explicit provider ID or the deterministic automatic-selection policy. */
export const analysisProviderSelectorSchema = z.union([
z.literal("auto"),
analysisProviderIdSchema,
]);
/** Stable reasons a deep provider cannot participate in target selection. */
export const PROVIDER_REJECTION_CODES = [
"not_configured",
"executable_missing",
"runtime_missing",
"unsupported_host",
"unsupported_version",
"target_kind_unsupported",
"target_format_unsupported",
"architecture_unsupported",
"open_options_invalid",
"version_unresolved",
] as const;
export type AnalysisProviderSelector = z.infer<
typeof analysisProviderSelectorSchema
>;
/** Stable reason a deep provider cannot participate in target selection. */
export type ProviderRejectionCode = (typeof PROVIDER_REJECTION_CODES)[number];