Merge remote-tracking branch 'upstream/main' into feat/profiles-and-alias

This commit is contained in:
Ogrodev
2026-06-08 07:47:34 -03:00
269 changed files with 11644 additions and 2982 deletions
@@ -19,7 +19,7 @@ import type { CanonicalModelVariant } from "../config/model-equivalence";
import { type CanonicalModelQueryOptions, ModelRegistry } from "../config/model-registry";
import {
formatModelString,
type ModelMatchPreferences,
getModelMatchPreferences,
resolveAllowedModels,
resolveCliModel,
resolveModelRoleValue,
@@ -542,9 +542,7 @@ async function resolveDryBalanceModel(
settings: Settings | undefined,
randomSessionId: () => string,
): Promise<{ model: Model<Api>; warning?: string }> {
const preferences: ModelMatchPreferences = {
usageOrder: settings?.getStorage()?.getModelUsageOrder(),
};
const preferences = getModelMatchPreferences(settings);
if (modelSelector) {
const resolved = resolveCliModel({
cliModel: modelSelector,
@@ -105,6 +105,10 @@ export async function renderGalleryState(
width: number,
expanded = false,
): Promise<string[]> {
if (fixture.renderState) {
return await fixture.renderState(state, width, expanded);
}
const tool = fakeToolFor(name, fixture);
const streamingArgs = state === "streaming" ? (fixture.streamingArgs ?? fixture.args) : fixture.args;
// The component only calls `requestRender` during a static render;
@@ -4,7 +4,6 @@ import type { GalleryFixture } from "./types";
export const codeintelFixtures: Record<string, GalleryFixture> = {
lsp: {
label: "LSP",
customRendered: true,
streamingArgs: {
action: "references",
file: "src/server/auth.ts",
@@ -1,6 +1,7 @@
// biome-ignore-all lint/suspicious/noTemplateCurlyInString: sample source-code strings (read fixtures) intentionally contain literal ${...}.
// Gallery fixtures for the filesystem tools (read, write, find).
import type { GalleryFixture } from "./types";
import { ReadToolGroupComponent } from "../../modes/components/read-tool-group";
import type { GalleryFixture, GalleryFixtureState, GalleryResult } from "./types";
const readSnippet = [
"export const findToolRenderer = {",
@@ -36,6 +37,64 @@ const writtenContent = [
"",
].join("\n");
const groupedReadTargets = [
"packages/coding-agent/test/streaming-preview-height.test.ts:301-409",
"packages/coding-agent/test/tool-live-region-scrollback.test.ts:143-310",
"packages/tui/test/streaming-scrollback-defer.test.ts:89-464",
];
const groupedReadDelimitedPath = groupedReadTargets.join(",");
const groupedReadRepeatedFile = "packages/coding-agent/src/task/render.ts";
const groupedReadRepeatedRanges = `${groupedReadRepeatedFile}:507-605,1070-1194,1210-1240,1270-1274`;
function textResult(text: string, details?: unknown, isError?: boolean): GalleryResult {
return { content: [{ type: "text", text }], details, isError };
}
function addGroupedReadArgs(component: ReadToolGroupComponent): void {
component.updateArgs({ path: groupedReadDelimitedPath }, "read-delimited");
component.updateArgs({ path: groupedReadRepeatedRanges }, "read-ranges");
}
function renderReadGroupFixtureState(state: GalleryFixtureState, width: number, expanded: boolean): string[] {
const component = new ReadToolGroupComponent();
component.setExpanded(expanded);
if (state === "streaming") {
component.updateArgs(
{
path: [
"packages/coding-agent/test/streaming-preview-height.test.ts:301-409",
"packages/coding-agent/test/tool-live-region-scrollback.test.ts:143-",
].join(","),
},
"read-delimited",
);
return component.render(width);
}
addGroupedReadArgs(component);
if (state === "progress") return component.render(width);
component.updateResult(
textResult("Read three focused test ranges.", { displayReadTargets: groupedReadTargets }),
false,
"read-delimited",
);
if (state === "error") {
component.updateResult(
textResult("Error: selector 1270-1274 is outside the file", undefined, true),
false,
"read-ranges",
);
return component.render(width);
}
component.updateResult(textResult("Read four render.ts ranges."), false, "read-ranges");
return component.render(width);
}
export const fsFixtures: Record<string, GalleryFixture> = {
read: {
label: "Read",
@@ -81,6 +140,14 @@ export const fsFixtures: Record<string, GalleryFixture> = {
},
},
read_group: {
label: "Read Groups",
args: {},
result: textResult("Rendered grouped read calls."),
errorResult: textResult("Rendered grouped read errors.", undefined, true),
renderState: renderReadGroupFixtureState,
},
write: {
label: "Write",
// Streaming: path known, content still arriving (only the imports so far).
@@ -11,14 +11,21 @@ export interface GalleryResult {
isError?: boolean;
}
export type GalleryFixtureState = "streaming" | "progress" | "success" | "error";
export interface GalleryFixture {
/** Display label for the tool header (defaults to the tool name). */
label?: string;
/** Edit mode for edit-like tools so the streaming preview dispatches correctly. */
editMode?: EditMode;
/**
* Custom gallery-only renderer for fixtures that are not one ToolExecutionComponent
* (for example the read-group transcript component).
*/
renderState?: (state: GalleryFixtureState, width: number, expanded: boolean) => string[] | Promise<string[]>;
/**
* Set for tools whose real `AgentTool` attaches `renderCall`/`renderResult`
* directly on the instance (e.g. `lsp`, `task`). The harness then attaches
* directly on the instance (e.g. `task`). The harness then attaches
* the registry renderer onto the fake tool so the component routes through
* the custom-tool branch — the same path production takes — instead of the
* built-in registry branch. The two branches can diverge, so exercising the