mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Use harness labels for current options
Signed-off-by: kenny lopez <klopez4212@gmail.com>
This commit is contained in:
@@ -37,6 +37,7 @@ import {
|
||||
AUTO_PROVIDER_DROPDOWN_VALUE,
|
||||
CUSTOM_PROVIDER_DROPDOWN_VALUE,
|
||||
computeLocalModeGate,
|
||||
formatCurrentRuntimeOptionLabel,
|
||||
formatRuntimeOptionLabel,
|
||||
getDefaultPersonaRuntime,
|
||||
getPersonaHiddenProviderIds,
|
||||
@@ -602,7 +603,7 @@ export function AgentDefinitionDialog({
|
||||
!runtimeDropdownOptions.some((option) => option.value === runtime)
|
||||
) {
|
||||
runtimeDropdownOptions.push({
|
||||
label: `${runtime.trim()} (current)`,
|
||||
label: formatCurrentRuntimeOptionLabel(runtimes, runtime),
|
||||
value: runtime.trim(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import { EditAgentAdvancedFields } from "./EditAgentAdvancedFields";
|
||||
import {
|
||||
AUTO_PROVIDER_DROPDOWN_VALUE,
|
||||
CUSTOM_PROVIDER_DROPDOWN_VALUE,
|
||||
formatCurrentRuntimeOptionLabel,
|
||||
formatRuntimeOptionLabel,
|
||||
getDefaultLlmModelLabel,
|
||||
getDefaultPersonaRuntime,
|
||||
@@ -243,12 +244,12 @@ export function AgentInstanceEditDialog({
|
||||
!options.some((o) => o.value === selectedRuntimeId)
|
||||
) {
|
||||
options.push({
|
||||
label: `${selectedRuntimeId} (current)`,
|
||||
label: formatCurrentRuntimeOptionLabel(runtimes, selectedRuntimeId),
|
||||
value: selectedRuntimeId,
|
||||
});
|
||||
}
|
||||
return options;
|
||||
}, [sortedRuntimes, selectedRuntimeId]);
|
||||
}, [runtimes, sortedRuntimes, selectedRuntimeId]);
|
||||
|
||||
// Resolve the dialog-opening command as the catalog loads. Edit-state runtime
|
||||
// ids mutate during selection changes and cannot identify the original state.
|
||||
|
||||
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import {
|
||||
formatCurrentRuntimeOptionLabel,
|
||||
getDefaultPersonaRuntime,
|
||||
getPersonaHiddenProviderIds,
|
||||
getPersonaModelOptions,
|
||||
@@ -34,6 +35,25 @@ function makeRuntime(
|
||||
};
|
||||
}
|
||||
|
||||
test("formatCurrentRuntimeOptionLabel uses the catalog display label", () => {
|
||||
const runtime = {
|
||||
...makeRuntime("goose"),
|
||||
label: "Goose",
|
||||
};
|
||||
|
||||
assert.equal(
|
||||
formatCurrentRuntimeOptionLabel([runtime], "goose"),
|
||||
"Goose (current)",
|
||||
);
|
||||
});
|
||||
|
||||
test("formatCurrentRuntimeOptionLabel falls back to an unknown runtime id", () => {
|
||||
assert.equal(
|
||||
formatCurrentRuntimeOptionLabel([], " custom-runtime "),
|
||||
"custom-runtime (current)",
|
||||
);
|
||||
});
|
||||
|
||||
// ── getPersonaProviderOptions — hideProviderIds ───────────────────────────────
|
||||
|
||||
test("getPersonaProviderOptions returns databricks v1 and v2 when hideProviderIds is empty", () => {
|
||||
|
||||
@@ -489,6 +489,18 @@ export function formatRuntimeOptionLabel(runtime: AcpRuntimeCatalogEntry) {
|
||||
return `${runtime.label}${suffix}`;
|
||||
}
|
||||
|
||||
export function formatCurrentRuntimeOptionLabel(
|
||||
runtimes: readonly AcpRuntimeCatalogEntry[],
|
||||
runtimeId: string,
|
||||
) {
|
||||
const trimmedRuntimeId = runtimeId.trim();
|
||||
const runtime = runtimes.find(
|
||||
(candidate) => candidate.id === trimmedRuntimeId,
|
||||
);
|
||||
const label = runtime ? formatRuntimeOptionLabel(runtime) : trimmedRuntimeId;
|
||||
return `${label} (current)`;
|
||||
}
|
||||
|
||||
function runtimeAvailabilitySortRank(
|
||||
availability: AcpRuntimeCatalogEntry["availability"],
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user