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:
@@ -53,6 +53,10 @@ export function createCliInventory(cli: unknown): {
|
||||
readonly target: string;
|
||||
}[];
|
||||
};
|
||||
export function cliCommandOptionNames(
|
||||
cli: unknown,
|
||||
name: string,
|
||||
): readonly string[];
|
||||
export function serializeProductCatalog(
|
||||
catalog: ProductCatalog,
|
||||
): Promise<string>;
|
||||
|
||||
@@ -62,6 +62,23 @@ export const createCliInventory = (cli) => {
|
||||
};
|
||||
};
|
||||
|
||||
/** Read one primary command's declared option names from the Incur router. */
|
||||
export const cliCommandOptionNames = (cli, name) => {
|
||||
const commands = Cli.toCommands.get(cli);
|
||||
const command = commands?.get(name);
|
||||
if (
|
||||
command === undefined ||
|
||||
"_alias" in command ||
|
||||
!("options" in command) ||
|
||||
command.options === undefined
|
||||
)
|
||||
return [];
|
||||
const schema = z.toJSONSchema(command.options);
|
||||
return Object.keys(schema.properties ?? {}).sort((left, right) =>
|
||||
left.localeCompare(right),
|
||||
);
|
||||
};
|
||||
|
||||
const assertSameNames = (label, actual, expected) => {
|
||||
const actualSet = new Set(actual);
|
||||
const expectedSet = new Set(expected);
|
||||
|
||||
Reference in New Issue
Block a user