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.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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];
|
||||
Reference in New Issue
Block a user