Files
OmniRoute/tests/unit/sidebar-tools-group.test.ts
Praveen K Palaniswamy 65e81158ab fix(ollama): route models by advertised capability (#11088)
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host.

Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean.

Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
2026-08-23 11:45:01 -03:00

83 lines
3.1 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
const sidebarVisibility = await import("../../src/shared/constants/sidebarVisibility.ts");
function getToolsGroup() {
const omniProxySection = sidebarVisibility.SIDEBAR_SECTIONS.find(
(section) => section.id === "omni-proxy"
);
assert.ok(omniProxySection, "expected omni-proxy section to exist");
const toolsGroup = omniProxySection.children.find(
(child): child is (typeof sidebarVisibility.SIDEBAR_SECTIONS)[number]["children"][number] & {
type: "group";
} =>
"type" in child &&
(child as { type: string }).type === "group" &&
(child as { id: string }).id === "tools"
);
assert.ok(toolsGroup, "expected tools group to exist in omni-proxy section");
return toolsGroup as {
type: "group";
id: string;
items: readonly { id: string; href: string; i18nKey: string }[];
};
}
test("TOOLS_GROUP items follow plan 14 order: cli-code → cli-agents → acp-agents → cloud-agents → conductor → agent-bridge → traffic-inspector → discovery", () => {
const toolsGroup = getToolsGroup();
const itemIds = toolsGroup.items.map((item) => item.id);
// cli-code/cli-agents/acp-agents/cloud-agents from plan 14 (#2839); agent-bridge/traffic-inspector from plans 11/12 (#2858); discovery from #5939; conductor from the Conductor panel (PRD RF3, #8221).
assert.deepEqual(
itemIds,
[
"cli-code",
"cli-agents",
"acp-agents",
"cloud-agents",
"conductor",
"agent-bridge",
"traffic-inspector",
"discovery",
],
"TOOLS_GROUP items order must be cli-code, cli-agents, acp-agents, cloud-agents, conductor, agent-bridge, traffic-inspector, discovery"
);
});
test("TOOLS_GROUP cli-code item has correct href and i18nKey", () => {
const toolsGroup = getToolsGroup();
const cliCode = toolsGroup.items.find((item) => item.id === "cli-code");
assert.ok(cliCode, "expected cli-code in TOOLS_GROUP");
assert.equal(cliCode.href, "/dashboard/cli-code");
assert.equal(cliCode.i18nKey, "cliCode");
});
test("TOOLS_GROUP cli-agents item has correct href and i18nKey", () => {
const toolsGroup = getToolsGroup();
const cliAgents = toolsGroup.items.find((item) => item.id === "cli-agents");
assert.ok(cliAgents, "expected cli-agents in TOOLS_GROUP");
assert.equal(cliAgents.href, "/dashboard/cli-agents");
assert.equal(cliAgents.i18nKey, "cliAgents");
});
test("TOOLS_GROUP acp-agents item has correct href and i18nKey", () => {
const toolsGroup = getToolsGroup();
const acpAgents = toolsGroup.items.find((item) => item.id === "acp-agents");
assert.ok(acpAgents, "expected acp-agents in TOOLS_GROUP");
assert.equal(acpAgents.href, "/dashboard/acp-agents");
assert.equal(acpAgents.i18nKey, "acpAgents");
});
test("TOOLS_GROUP does NOT contain legacy cli-tools or agents entries", () => {
const toolsGroup = getToolsGroup();
const legacyIds = toolsGroup.items
.map((item) => item.id)
.filter((id) => id === "cli-tools" || id === "agents");
assert.deepEqual(
legacyIds,
[],
"TOOLS_GROUP must not contain legacy 'cli-tools' or 'agents' entries"
);
});