Files
fusion/scripts/check-cli-runtime-routing.mjs
gsxdsm 1d3f6c198c FN-9096: route CLI models through installed runtimes
Route every CLI-provider selection through an explicit installed-runtime policy.

- Centralize CLI provider classifications, runtime hints, fallback behavior, and actionable missing-runtime errors.
- Validate routing coverage statically and add conformance and integration tests for CLI runtime paths.
- Document runtime routing behavior and add a published CLI changeset.

Files changed: .changeset/fn-9096-cli-runtime-routing.md          |   7 +
 docs/settings-reference.md                         |  29 +++
 docs/testing.md                                    |   6 +-
 package.json                                       |   6 +-
 .../src/__tests__/cli-provider-routing.test.ts     |  74 ++++++++
 .../__tests__/cli-runtime-routing-check.test.ts    |  25 +++
 .../cli-runtime-routing-conformance.test.ts        | 210 +++++++++++++++++++++
 .../__tests__/hermes-runtime-integration.test.ts   |  28 +++
 .../engine/src/agents/agent-session-helpers.ts     | 166 ++++------------
 packages/engine/src/agents/cli-provider-routing.ts | 174 +++++++++++++++++
 scripts/check-cli-runtime-routing.mjs              |  26 +++
 scripts/lib/cli-runtime-routing-check.mjs          |  84 +++++++++
 12 files changed, 701 insertions(+), 134 deletions(-)

Fusion-Task-Id: FN-9096

Fusion-Task-Lineage: f9f6a434-b28d-4ebb-816a-53ca75efc2c4

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-08-15 07:19:29 -07:00

27 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
import { readFileSync, readdirSync } from "node:fs";
import { join } from "node:path";
import { checkCliRuntimeRouting } from "./lib/cli-runtime-routing-check.mjs";
const route = "packages/dashboard/src/routes/register-model-routes.ts";
const cachesDir = "packages/dashboard/src";
const census = "packages/engine/src/agents/cli-provider-routing.ts";
try {
const constantSources = readdirSync(cachesDir)
.filter((name) => name.endsWith("model-cache.ts"))
.map((name) => readFileSync(join(cachesDir, name), "utf8"));
const violations = checkCliRuntimeRouting({
routeSource: readFileSync(route, "utf8"),
censusSource: readFileSync(census, "utf8"),
constantSources,
});
if (violations.length) {
console.error("check-cli-runtime-routing: FAILED\n" + violations.map((item) => `- ${item}`).join("\n"));
process.exit(1);
}
console.log("check-cli-runtime-routing: ok");
} catch (error) {
console.error(`check-cli-runtime-routing: could not inspect required source: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
}