Multiplayer agent harness for work.
Show the current default effort as Default and keep it selectable (#1751)
Joshua France867d395a9407
diff --git a/plugins/admin/test/settings-lit.test.ts b/plugins/admin/test/settings-lit.test.tsindex 75afb3b50..550318aee 100644--- a/plugins/admin/test/settings-lit.test.ts+++ b/plugins/admin/test/settings-lit.test.ts@@ -162,7 +162,7 @@ test("credential save acknowledges its submitted snapshot and retains newer edit}});-test("runtime reasoning choices follow the selected model and preserve legacy defaults", () => {+test("runtime reasoning choices follow the selected model and offer the current default", () => {const dom = setup();try {const data = {@@ -180,7 +180,7 @@ test("runtime reasoning choices follow the selected model and preserve legacy deconst select = () => dom.window.document.getElementById("base-effort") as HTMLSelectElement;const choices = () => [...select().options].map((option) => [option.value, option.textContent]);assert.deepEqual(choices(), [- ["auto", "Legacy default"],+ ["auto", "Default"],["adaptive", "Auto"],["default", "Provider default"],["high", "High"],diff --git a/plugins/admin/ui/settings.ts b/plugins/admin/ui/settings.tsindex 1f4bf5c75..4dba725bd 100644--- a/plugins/admin/ui/settings.ts+++ b/plugins/admin/ui/settings.ts@@ -162,7 +162,7 @@ const harnessLabels: Record<string, string> = {claude: "Claude Code",};const effortLabels: Record<string, string> = {- auto: "Legacy default",+ auto: "Default",adaptive: "Auto",default: "Provider default",low: "Low",diff --git a/plugins/web-ui/src/composer-loadout.ts b/plugins/web-ui/src/composer-loadout.tsindex 649822c41..5cca92b07 100644--- a/plugins/web-ui/src/composer-loadout.ts+++ b/plugins/web-ui/src/composer-loadout.ts@@ -92,7 +92,6 @@ export function reconcileLoadout(export function effortLevelsForHarness(harnessId: string,model?: Model<Api>,- selectedEffort?: string,): Array<{ value: EffortLevel; label: string }> {const advertised = (model as ModelMetadata | undefined)?.effortLevelsByHarness?.[harnessId];const levels = EFFORT_LEVELS.filter(({ value }) => {@@ -104,9 +103,7 @@ export function effortLevelsForHarness(if (harnessId === "codex") return value !== "max" && value !== "ultracode";return false;});- return selectedEffort === "auto" || !levels.length- ? [EFFORT_LEVELS.find(({ value }) => value === "auto")!, ...levels]- : levels;+ return [EFFORT_LEVELS.find(({ value }) => value === "auto")!, ...levels];}export function compatibleHarnessOptions<T extends { harnessId: string; model: { id: string } }>(diff --git a/plugins/web-ui/src/composer.ts b/plugins/web-ui/src/composer.tsindex 295ae9255..bace3ee66 100644--- a/plugins/web-ui/src/composer.ts+++ b/plugins/web-ui/src/composer.ts@@ -256,7 +256,7 @@ export function createComposerSurface(ctx: ConvCtx, options: ComposerOptions = {(restoredLoadout?.value === selected?.value ? restoredLoadout?.effort : undefined) ??(getRuntimeConfig(scopeKey())?.effective.effortLevel as EffortLevel | undefined) ??defaultEffortForModel(selected?.model);- const levels = effortLevelsForHarness(selected?.harnessId ?? "", selected?.model, effort);+ const levels = effortLevelsForHarness(selected?.harnessId ?? "", selected?.model);return levels.some((level) => level.value === effort) ? effort : levels[0]!.value;},set effortLevel(value: EffortLevel) {@@ -1034,7 +1034,7 @@ export function createComposerSurface(ctx: ConvCtx, options: ComposerOptions = {}function normalizeLoadoutEntry(entry: LoadoutEntry, option: ModelOption): LoadoutEntry {- const levels = effortLevelsForHarness(option.harnessId, option.model, entry.effort);+ const levels = effortLevelsForHarness(option.harnessId, option.model);const defaultEffort = defaultEffortForModel(option.model);const fallbackEffort = levels.some((level) => level.value === defaultEffort) ? defaultEffort : levels[0]!.value;return {@@ -1887,9 +1887,7 @@ export function createComposerSurface(ctx: ConvCtx, options: ComposerOptions = {const selected = currentModelOption();if (!selected ||- !effortLevelsForHarness(selected.harnessId, selected.model, composerState.effortLevel).some(- (option) => option.value === level,- )+ !effortLevelsForHarness(selected.harnessId, selected.model).some((option) => option.value === level))return;composerState.effortLevel = level;diff --git a/plugins/web-ui/src/context-model.ts b/plugins/web-ui/src/context-model.tsindex 9981ce3a0..c085ca1b6 100644--- a/plugins/web-ui/src/context-model.ts+++ b/plugins/web-ui/src/context-model.ts@@ -106,10 +106,9 @@ function selectedValue(config: RuntimeConfig): string {function effortLevelsFor(harnessId: string,model?: ModelOption["model"],- effort?: string,): Array<{ value: EffortLevel; label: string }> {if (!harnessSupportsEffort(harnessId)) return [];- return effortLevelsForHarness(harnessId, model, effort);+ return effortLevelsForHarness(harnessId, model);}function selectedEffort(config: RuntimeConfig): string {@@ -148,7 +147,7 @@ async function choose(scope: string, value: string, effort?: string, fast = falsharnessId,modelId: value.slice(sep + 1),fastMode: fast && harnessSupportsFastMode(harnessId) && modelSupportsFastMode(scope, value.slice(sep + 1)),- ...(effort && effortLevelsFor(harnessId, model, effort).some((o) => o.value === effort)+ ...(effort && effortLevelsFor(harnessId, model).some((o) => o.value === effort)? { effortLevel: effort }: {}),},@@ -189,7 +188,7 @@ function contextPicker(scopeId: string) {if (contextModelState.saving) return;const option = options().find((option) => option.value === entry.value);if (!option) return;- const levels = effortLevelsForHarness(option.harnessId, option.model, entry.effort);+ const levels = effortLevelsForHarness(option.harnessId, option.model);const normalized = {...entry,effort: levels.some((level) => level.value === entry.effort) ? entry.effort : levels[0]!.value,diff --git a/plugins/web-ui/src/model-picker.ts b/plugins/web-ui/src/model-picker.tsindex e939c5b85..afbe41d74 100644--- a/plugins/web-ui/src/model-picker.ts+++ b/plugins/web-ui/src/model-picker.ts@@ -295,7 +295,7 @@ export function createModelPicker<T>(bindings: ModelPickerBindings<T>) {</button>${effort- ? effortLevelsForHarness(selected.harnessId, selected.model, composerState.effortLevel).map(+ ? effortLevelsForHarness(selected.harnessId, selected.model).map((level) =>html` <buttonclass="loadout-effort"diff --git a/plugins/web-ui/src/runtime-capabilities.ts b/plugins/web-ui/src/runtime-capabilities.tsindex 299aa1197..de676bfb9 100644--- a/plugins/web-ui/src/runtime-capabilities.ts+++ b/plugins/web-ui/src/runtime-capabilities.ts@@ -3,7 +3,7 @@ import type { Api, Model } from "@earendil-works/pi-ai";export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max" | "ultracode" | "auto" | "adaptive" | "default";export const EFFORT_LEVELS: Array<{ value: EffortLevel; label: string }> = [- { value: "auto", label: "Legacy default" },+ { value: "auto", label: "Default" },{ value: "adaptive", label: "Auto" },{ value: "default", label: "Provider default" },{ value: "low", label: "Low" },diff --git a/plugins/web-ui/test/composer-loadout.test.ts b/plugins/web-ui/test/composer-loadout.test.tsindex 3d742a2b0..c9287fdcb 100644--- a/plugins/web-ui/test/composer-loadout.test.ts+++ b/plugins/web-ui/test/composer-loadout.test.ts@@ -198,23 +198,23 @@ test("the model catalog falls back from unavailable saved harnesses using only ctest("harness effort choices exclude unsupported settings and label extra high clearly", () => {assert.deepEqual(effortLevelsForHarness("pi").map(({ value }) => value),- ["low", "medium", "high", "xhigh", "max", "ultracode"],+ ["auto", "low", "medium", "high", "xhigh", "max", "ultracode"],);assert.deepEqual(effortLevelsForHarness("claude").map(({ value }) => value),- ["low", "medium", "high", "xhigh", "max"],+ ["auto", "low", "medium", "high", "xhigh", "max"],);assert.deepEqual(effortLevelsForHarness("codex").map(({ value }) => value),- ["low", "medium", "high", "xhigh"],+ ["auto", "low", "medium", "high", "xhigh"],);for (const harnessId of ["pi", "claude", "codex"])assert.equal(effortLevelsForHarness(harnessId).find(({ value }) => value === "xhigh")?.label, "Extra high");for (const harnessId of ["opencode", "mock", "unknown"])- assert.deepEqual(effortLevelsForHarness(harnessId), [{ value: "auto", label: "Legacy default" }]);+ assert.deepEqual(effortLevelsForHarness(harnessId), [{ value: "auto", label: "Default" }]);});-test("native reasoning choices require model and harness metadata while legacy settings survive", () => {+test("native reasoning choices require model and harness metadata and always offer Default", () => {const model = {...option("pi:one").model,effortLevelsByHarness: {@@ -223,26 +223,21 @@ test("native reasoning choices require model and harness metadata while legacy s},};assert.deepEqual(effortLevelsForHarness("pi", model), [+ { value: "auto", label: "Default" },{ value: "adaptive", label: "Auto" },{ value: "default", label: "Provider default" },{ value: "low", label: "Low" },{ value: "high", label: "High" },]);- assert.equal(effortLevelsForHarness("pi", model, "auto")[0]?.label, "Legacy default");for (const harness of ["claude", "codex"])- assert.ok(- effortLevelsForHarness(harness, model, "adaptive").every(- ({ value }) => value !== "adaptive" && value !== "default",- ),- );- for (const selected of ["auto", "adaptive", "default"])- assert.ok(- effortLevelsForHarness("pi", option("pi:one").model, selected).every(- ({ value }) => value !== "adaptive" && value !== "default",- ),- );+ assert.ok(effortLevelsForHarness(harness, model).every(({ value }) => value !== "adaptive" && value !== "default"));+ assert.ok(+ effortLevelsForHarness("pi", option("pi:one").model).every(+ ({ value }) => value !== "adaptive" && value !== "default",+ ),+ );const withoutEfforts = { ...model, effortLevelsByHarness: { pi: [] } };- assert.deepEqual(effortLevelsForHarness("pi", withoutEfforts), [{ value: "auto", label: "Legacy default" }]);+ assert.deepEqual(effortLevelsForHarness("pi", withoutEfforts), [{ value: "auto", label: "Default" }]);const saved = [entry("pi:one", "adaptive"), entry("pi:two", "default"), entry("pi:three", "auto")];assert.deepEqual(parseLoadout(JSON.stringify(saved)), saved);});diff --git a/plugins/web-ui/test/composer-picker.test.ts b/plugins/web-ui/test/composer-picker.test.tsindex cf27ad7c3..75d21d8f1 100644--- a/plugins/web-ui/test/composer-picker.test.ts+++ b/plugins/web-ui/test/composer-picker.test.ts@@ -655,7 +655,7 @@ test("the personal-account picker preserves composer choices and saves context dconst effortChoices = () => [...host.querySelectorAll<HTMLButtonElement>(".loadout-effort")];assert.deepEqual(effortChoices().map((item) => item.textContent?.trim()),- ["Legacy default", "Auto", "Provider default", "Low", "High"],+ ["Default", "Auto", "Provider default", "Low", "High"],);effortChoices().find((item) => item.textContent?.trim() === "Auto")!@@ -663,10 +663,12 @@ test("the personal-account picker preserves composer choices and saves context dassert.equal(composer!.state.effortLevel, "adaptive");assert.equal(saved().find(({ value }) => value === "pi:alpha")?.effort, "adaptive");button('[data-loadout-section="effort"]').click();- assert.equal(- effortChoices().some((item) => item.textContent?.trim() === "Legacy default"),- false,- );+ effortChoices()+ .find((item) => item.textContent?.trim() === "Default")!+ .click();+ assert.equal(composer!.state.effortLevel, "auto");+ assert.equal(saved().find(({ value }) => value === "pi:alpha")?.effort, "auto");+ button('[data-loadout-section="effort"]').click();effortChoices().find((item) => item.textContent?.trim() === "Provider default")!.click();diff --git a/plugins/web-ui/test/composer-source.test.ts b/plugins/web-ui/test/composer-source.test.tsindex 4eedd1cba..7dd45f4c0 100644--- a/plugins/web-ui/test/composer-source.test.ts+++ b/plugins/web-ui/test/composer-source.test.ts@@ -43,7 +43,7 @@ test("switching setups preserves prior tweaks and validates effort and Fast forcomposer.indexOf("function normalizeLoadoutEntry"),composer.indexOf("function seededLoadout"),);- assert.ok(normalize.includes("effortLevelsForHarness(option.harnessId, option.model, entry.effort)"));+ assert.ok(normalize.includes("effortLevelsForHarness(option.harnessId, option.model)"));assert.ok(/levels.some\([\s\S]*?\? entry.effort/.test(normalize));assert.ok(apply.includes("normalizeLoadoutEntry(entry, option)"));assert.ok(diff --git a/plugins/web-ui/test/context-model-source.test.ts b/plugins/web-ui/test/context-model-source.test.tsindex f2492bf94..a2f7410b5 100644--- a/plugins/web-ui/test/context-model-source.test.ts+++ b/plugins/web-ui/test/context-model-source.test.ts@@ -45,7 +45,7 @@ test("an in-flight pick wins the saving re-render — no snap-back while the sav});test("context effort and Fast use the shared harness and model capabilities", () => {- assert.match(panel, /return effortLevelsForHarness\(harnessId, model, effort\)/);+ assert.match(panel, /return effortLevelsForHarness\(harnessId, model\)/);assert.match(panel, /harnessSupportsFastMode\(harnessId\)/);assert.match(panel, /modelSupportsFastMode\(scope, value.slice\(sep \+ 1\)\)/);});