feat(KB-196): load extension providers for dashboard model selector
- Load pi extensions on dashboard startup to register custom model providers - Include extension-provided models in the dashboard model selector - Add comprehensive tests for extension model loading and error handling - Create changeset for patch release fixing model selector extensions
This commit is contained in:
@@ -164,6 +164,28 @@ vi.mock("@kb/engine", async (importOriginal) => {
|
||||
};
|
||||
});
|
||||
|
||||
// ── Mock @mariozechner/pi-coding-agent ──────────────────────────────
|
||||
|
||||
const mockAuthStorage = { getAuth: vi.fn(), setAuth: vi.fn() };
|
||||
const mockModelRegistry = {
|
||||
registerProvider: vi.fn(),
|
||||
refresh: vi.fn(),
|
||||
};
|
||||
const mockDiscoverAndLoadExtensions = vi.fn().mockResolvedValue({
|
||||
runtime: { pendingProviderRegistrations: [] },
|
||||
errors: [],
|
||||
});
|
||||
const mockCreateExtensionRuntime = vi.fn();
|
||||
|
||||
vi.mock("@mariozechner/pi-coding-agent", () => ({
|
||||
AuthStorage: {
|
||||
create: vi.fn(() => mockAuthStorage),
|
||||
},
|
||||
ModelRegistry: vi.fn().mockImplementation(() => mockModelRegistry),
|
||||
discoverAndLoadExtensions: mockDiscoverAndLoadExtensions,
|
||||
createExtensionRuntime: mockCreateExtensionRuntime,
|
||||
}));
|
||||
|
||||
// ── Import module under test (after mocks) ──────────────────────────
|
||||
|
||||
const { runDashboard, processPullRequestMergeTask, getMergeStrategy, getTaskBranchName } = await import("./dashboard.js");
|
||||
|
||||
Reference in New Issue
Block a user