feat: Add /models add hot-reload model registration (#70211)

* feat(models): add chat model registration with hot reload

* docs(changelog): add models entry for pr 70211

* fix(models): harden add flow follow-ups

* fix models add review follow-ups

* harden models add config writes

* tighten plugin boundary invariant

* move models add adapters behind sdk facades

* avoid ollama-specific core facade
This commit is contained in:
Tak Hoffman
2026-04-22 12:00:30 -05:00
committed by GitHub
parent 0623079e98
commit f328c21046
28 changed files with 2033 additions and 373 deletions

View File

@@ -3,6 +3,8 @@
import { createExtensionImportBoundaryChecker } from "./lib/extension-import-boundary-checker.mjs";
import { runAsScript } from "./lib/ts-guard-utils.mjs";
const ALLOWED_EXTENSION_PUBLIC_SURFACE_RE = /^extensions\/[^/]+\/(?:api|runtime-api)\.js$/;
const checker = createExtensionImportBoundaryChecker({
roots: ["src"],
boundaryLabel: "src",
@@ -10,6 +12,9 @@ const checker = createExtensionImportBoundaryChecker({
cleanMessage: "No src import boundary violations found.",
inventoryTitle: "Src extension import boundary inventory:",
skipSourcesWithoutBundledPluginPrefix: true,
allowResolvedPath(resolvedPath) {
return ALLOWED_EXTENSION_PUBLIC_SURFACE_RE.test(resolvedPath);
},
shouldSkipFile(relativeFile) {
return (
relativeFile.endsWith(".test.ts") ||

View File

@@ -38,7 +38,7 @@ function classifyResolvedExtensionReason(kind, boundaryLabel) {
return `${verb} bundled plugin file from ${boundaryLabel} boundary`;
}
function scanImportBoundaryViolations(sourceFile, filePath, boundaryLabel) {
function scanImportBoundaryViolations(sourceFile, filePath, boundaryLabel, allowResolvedPath) {
const entries = [];
const relativeFile = normalizeRepoPath(repoRoot, filePath);
@@ -47,6 +47,9 @@ function scanImportBoundaryViolations(sourceFile, filePath, boundaryLabel) {
if (!resolvedPath?.startsWith(BUNDLED_PLUGIN_PATH_PREFIX)) {
return;
}
if (allowResolvedPath?.(resolvedPath, { kind, specifier, file: relativeFile })) {
return;
}
entries.push({
file: relativeFile,
line: toLine(sourceFile, specifierNode),
@@ -74,7 +77,12 @@ export function createExtensionImportBoundaryChecker(params) {
files,
compareEntries,
collectEntries(sourceFile, filePath) {
return scanImportBoundaryViolations(sourceFile, filePath, params.boundaryLabel);
return scanImportBoundaryViolations(
sourceFile,
filePath,
params.boundaryLabel,
params.allowResolvedPath,
);
},
shouldParseSource: params.skipSourcesWithoutBundledPluginPrefix
? (source) => source.includes(BUNDLED_PLUGIN_PATH_PREFIX)