* Search models across all providers from the picker root * Store agent profiles in daemon config and apply agent config in one RPC An agent profile is a named bundle of provider, model, mode, thinking option, feature values and notes, stored host-wide next to terminal profiles. It carries no system prompt: AgentSessionConfig.systemPrompt is creation-only, so a profile holding one would apply when starting an agent and silently do nothing when applied to a running one. Applying a profile through the four single-field RPCs can fail halfway and leave an agent matching no profile, so agent.config.apply takes the whole bundle. Model runs first because a thinking option only means anything against the model that offers it. Old daemons parse their persisted config strictly and would drop an unknown agentProfiles key, making a save appear to succeed and vanish, so both capabilities are advertised on server_info for the client to gate on. list_profiles exposes the profiles to orchestrating agents, which read the notes to pick one and copy its values into create_agent. * Add the agent profiles settings section Profiles live behind one module boundary so removing the feature is a directory plus one mount, which is what favourites never was. The picker and composer will ask for rows and an apply function rather than learning what a profile contains. The edit form follows the form-model pattern instead of the terminal profile modal's per-field state, because provider selection cascades into which models, modes, thinking levels and features exist below it. The section is gated on server_info.features.agentProfiles: an older daemon drops the key on write, and a save that appears to work and then vanishes is worse than an unavailable state. * Document agent profiles and name the four senses of profile The glossary reserved Profile for HostProfile, terminal profiles owned the user-facing word, and custom-providers.md used it for provider aliases. Agent profile is now the term, with all four cross-referenced. data-model.md never documented terminalProfiles either, so both profile lists are backfilled together along with the whole-list patch semantics and why absent and empty differ. * Pin agent profiles to the model picker and delete favourites Applying a profile writes its values into the agent controls and is then forgotten, so rows carry no checkmark and no selected state: after applying, nothing is selected. Chevron still means navigate deeper, so the absence of one is what marks a row as an action. A running agent is its provider's process and agent.config.apply carries no provider, so the live picker only offers profiles matching the agent's provider rather than showing rows that cannot do what they say. The draft path has no such limit and switches provider freely. Draft feature values go through preferences rather than the feature callback alone, because the draft feature hook clears local values whenever the provider changes and a provider-switching profile would lose them. Favourites are deleted rather than migrated: they were device-local AsyncStorage keyed by provider and model, while profiles are host-wide daemon config. ProviderSelectionModelRow.favoriteKey stays as row identity and moves to its real owner; renaming it is its own commit. * Cover agent profiles and cross-provider search with E2E specs Model rows expressed selection only as a checkmark glyph, which assistive tech cannot see and a spec cannot assert. Rows that draw the indicator now carry aria-selected; profile rows deliberately carry none, because a profile is an action rather than a selection. That is what makes "nothing is marked selected after applying a profile" a real assertion instead of a tautology, with the materialized model one level down as the control. The search fixture extends claude rather than mock: provider-config.ts only allows the six shipped providers as extends targets, so a derived provider cannot inherit the dev-only mock provider. * State what applying a config bundle does on partial failure applyBundle is not a transaction and the earlier commit message implied it was. A step that rejects aborts the rest and the steps that already applied stay applied, which a profile omitting modelId can reach: provider setters validate against the agent's live model, so mode can land while a feature that model does not support is rejected. Nothing is hidden by that. Every setter emits agent state before returning, so what applied is streamed to the client next to the rejected response. Rolling back would re-invoke the setters that just failed, usually against a session that is gone, and pre-flight validation would restate each provider's model-dependent checks where they would drift from the setters that own them. What sending the bundle in one request removes is the multi-round-trip failure class: interruption between hops, and interleaving with another client. The test already pinned this behaviour; its name now says so. * feat(agent-profiles): refine profile discovery and appearance Make profiles discoverable from empty and provider-scoped model pickers, keep global search stable and virtualized, and move profile settings under Agents. Replace emoji identity with a shared Lucide icon and host-color picker, while requiring concrete provider selections so profiles materialize predictably. * fix(agent-profiles): defer profile swatch styles Resolving Unistyles proxies at module load can freeze the temporary startup color scheme before the persisted theme is restored. Keep only style-key names at module scope and resolve the selected swatch during render.
161 lines
5.6 KiB
TypeScript
161 lines
5.6 KiB
TypeScript
import { test } from "../support/fixtures";
|
|
import {
|
|
closeModelPicker,
|
|
expectModelSearchEmptyState,
|
|
expectModelPickerHeight,
|
|
expectModelPickerWidth,
|
|
expectModelSearchResult,
|
|
expectPinnedProfilesHidden,
|
|
openModelPicker,
|
|
readModelPickerHeight,
|
|
readModelPickerWidth,
|
|
searchAllModels,
|
|
seedAgentProfiles,
|
|
seedModelProvider,
|
|
expectSearchResultsVirtualized,
|
|
} from "../support/helpers/agent-profiles";
|
|
import { expectComposerVisible } from "../support/helpers/composer";
|
|
import { clickNewChat, gotoWorkspace } from "../support/helpers/launcher";
|
|
import { seedWorkspace } from "../support/helpers/seed-client";
|
|
|
|
const MOCK_PROVIDER_LABEL = "Mock Load Test";
|
|
|
|
// Its fast model deliberately carries the same label as the mock provider's, so
|
|
// the only thing telling the two result rows apart is the provider name.
|
|
const STUDIO = {
|
|
id: "mock-studio",
|
|
label: "Mock Studio",
|
|
models: [
|
|
{ id: "studio-fast", label: "Ten second stream", description: "Studio quick pass" },
|
|
{ id: "studio-deep", label: "Studio deep think", description: "Studio long pass" },
|
|
],
|
|
};
|
|
|
|
// The cross-provider search lives on the picker's root view, and a profile is
|
|
// what keeps the picker opening there.
|
|
const ROOT_VIEW_PROFILE = {
|
|
id: "agent_profile_e2e_search_root",
|
|
name: "Search anchor",
|
|
provider: "mock",
|
|
};
|
|
|
|
const LARGE_CATALOG_SIZE = 200;
|
|
const LARGE_CATALOG = {
|
|
id: "mock-bulk",
|
|
label: "Mock Bulk",
|
|
models: Array.from({ length: LARGE_CATALOG_SIZE }, (_, index) => ({
|
|
id: `bulk-${index}`,
|
|
label: `Bulk model ${index}`,
|
|
description: `Bulk search result ${index}`,
|
|
})),
|
|
};
|
|
|
|
test.describe("Cross-provider model search", () => {
|
|
test("one query over the picker root reaches every provider and names each result's provider", async ({
|
|
page,
|
|
}) => {
|
|
const provider = await seedModelProvider(STUDIO);
|
|
const profile = await seedAgentProfiles([ROOT_VIEW_PROFILE]);
|
|
const workspace = await seedWorkspace({ repoPrefix: "model-search-providers-" });
|
|
|
|
try {
|
|
await test.step("open a draft composer that can reach every provider", async () => {
|
|
await gotoWorkspace(page, workspace.workspaceId);
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
await openModelPicker(page);
|
|
});
|
|
const restingWidth = await readModelPickerWidth(page);
|
|
|
|
await test.step("one query returns the same model label from two providers", async () => {
|
|
await searchAllModels(page, "ten second stream");
|
|
await expectModelSearchResult(page, {
|
|
provider: "mock",
|
|
modelId: "ten-second-stream",
|
|
modelLabel: "Ten second stream",
|
|
providerLabel: MOCK_PROVIDER_LABEL,
|
|
});
|
|
await expectModelSearchResult(page, {
|
|
provider: STUDIO.id,
|
|
modelId: "studio-fast",
|
|
modelLabel: "Ten second stream",
|
|
providerLabel: STUDIO.label,
|
|
});
|
|
await expectModelPickerWidth(page, restingWidth);
|
|
});
|
|
|
|
await test.step("searching by provider name reaches that provider's own models", async () => {
|
|
await searchAllModels(page, "studio deep");
|
|
await expectModelSearchResult(page, {
|
|
provider: STUDIO.id,
|
|
modelId: "studio-deep",
|
|
modelLabel: "Studio deep think",
|
|
providerLabel: STUDIO.label,
|
|
});
|
|
});
|
|
|
|
await test.step("results replace the pinned profiles", async () => {
|
|
await expectPinnedProfilesHidden(page);
|
|
});
|
|
|
|
// Search falls back to subsequence matching, so "no matches" needs letters
|
|
// that cannot be picked out of a model label or description in order.
|
|
await test.step("a query with no matches repeats the query back", async () => {
|
|
await searchAllModels(page, "zzz");
|
|
await expectModelSearchEmptyState(page, "zzz");
|
|
await closeModelPicker(page);
|
|
});
|
|
} finally {
|
|
await workspace.cleanup();
|
|
await profile.restore();
|
|
await provider.restore();
|
|
}
|
|
});
|
|
|
|
test("desktop search keeps its frame stable and virtualizes a host-wide catalog", async ({
|
|
page,
|
|
}) => {
|
|
const provider = await seedModelProvider(LARGE_CATALOG);
|
|
const profile = await seedAgentProfiles([ROOT_VIEW_PROFILE]);
|
|
const workspace = await seedWorkspace({ repoPrefix: "model-search-large-catalog-" });
|
|
|
|
try {
|
|
await test.step("open the host-wide model picker", async () => {
|
|
await gotoWorkspace(page, workspace.workspaceId);
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
await openModelPicker(page);
|
|
});
|
|
|
|
const restingHeight = await readModelPickerHeight(page);
|
|
const restingWidth = await readModelPickerWidth(page);
|
|
|
|
await test.step("a broad query renders only the visible result window", async () => {
|
|
await searchAllModels(page, "bulk model");
|
|
await expectSearchResultsVirtualized(page, {
|
|
provider: LARGE_CATALOG.id,
|
|
total: LARGE_CATALOG_SIZE,
|
|
});
|
|
await expectModelPickerHeight(page, restingHeight);
|
|
await expectModelPickerWidth(page, restingWidth);
|
|
});
|
|
|
|
await test.step("narrowing to one result does not resize the picker", async () => {
|
|
await searchAllModels(page, "bulk model 199");
|
|
await expectModelSearchResult(page, {
|
|
provider: LARGE_CATALOG.id,
|
|
modelId: "bulk-199",
|
|
modelLabel: "Bulk model 199",
|
|
providerLabel: LARGE_CATALOG.label,
|
|
});
|
|
await expectModelPickerHeight(page, restingHeight);
|
|
await expectModelPickerWidth(page, restingWidth);
|
|
});
|
|
} finally {
|
|
await workspace.cleanup();
|
|
await profile.restore();
|
|
await provider.restore();
|
|
}
|
|
});
|
|
});
|