diff --git a/packages/overlay/src/chat/build-request.test.ts b/packages/overlay/src/chat/build-request.test.ts index 2e79b58..da9ba5d 100644 --- a/packages/overlay/src/chat/build-request.test.ts +++ b/packages/overlay/src/chat/build-request.test.ts @@ -368,6 +368,28 @@ describe("buildEditRequest", () => { }); }); +describe("the backend and its model", () => { + it("carries both when the picker has chosen one", () => { + const request = buildEditRequest( + parts({ agent: "codex", model: "gpt-5.3-codex", prompt: "hi" }) + ); + expect(request?.agent).toBe("codex"); + expect(request?.model).toBe("gpt-5.3-codex"); + }); + + it("omits the model when the picker is on Default", () => { + // Absent, not empty: the daemon reads a missing model as "use the default + // resolved for this backend", and `""` would be an id of "". + const request = buildEditRequest(parts({ model: "", prompt: "hi" })); + expect(request && "model" in request && request.model).toBeFalsy(); + expect(request?.model).toBeUndefined(); + }); + + it("omits the model when the picker never set one", () => { + expect(buildEditRequest(parts({ prompt: "hi" }))?.model).toBeUndefined(); + }); +}); + describe("hasVisualDeltas", () => { it("is false for a plain typed turn", () => { const request = buildEditRequest(parts({ prompt: "hello" })); diff --git a/packages/overlay/src/chat/build-request.ts b/packages/overlay/src/chat/build-request.ts index 29e5e4c..e9588a1 100644 --- a/packages/overlay/src/chat/build-request.ts +++ b/packages/overlay/src/chat/build-request.ts @@ -24,6 +24,8 @@ export interface EditRequestParts { changeSet: ChangeSet; commentSet: CommentSet; images: ImageInput[]; + /** Which model that backend runs on. Absent leaves it to the daemon. */ + model?: string; moveSet: MoveSet; /** The turn this one continues, when refining rather than starting fresh. */ parentJobId: string | null; @@ -108,6 +110,10 @@ export function buildEditRequest(p: EditRequestParts): CreateJobRequest | null { comments, element, images: p.images?.length ? p.images : undefined, + // Absent rather than empty, like the arrays above but for a different + // reason: the daemon reads a missing model as "use the default resolved for + // this backend", and an empty string would be a model id of "". + model: p.model || undefined, moveChanges, // Feedback on an edit is a follow-up on *that* edit's session. Without // this, commenting on an older turn after starting a new chat would diff --git a/packages/overlay/src/chat/change-chips.stories.ts b/packages/overlay/src/chat/change-chips.stories.ts index 23400ef..b45d0dc 100644 --- a/packages/overlay/src/chat/change-chips.stories.ts +++ b/packages/overlay/src/chat/change-chips.stories.ts @@ -3,7 +3,14 @@ import { cls, el } from "../dom"; import { icon } from "../icons"; import { type Caption, dock, plainStage } from "../stories/chrome"; import { BRAND, noop } from "../stories/fixtures"; -import { type ChangeChip, renderChangeChips, shortValue } from "./change-chips"; +import { onStoryTeardown } from "../stories/lifecycle"; +import { + attachRailKeys, + attachRailWheel, + type ChangeChip, + renderChangeChips, + shortValue, +} from "./change-chips"; /* * The composer's pending-change strip. @@ -26,6 +33,11 @@ import { type ChangeChip, renderChangeChips, shortValue } from "./change-chips"; * * **"Discard all" appears at two chips, not one.** With a single chip it would * be a second control doing exactly what the first one does. + * + * **A chip is three fields, not a sentence.** Subject, detail and value, told + * apart by tone alone, because the strip has no colour left to spend. They were + * one space-joined string until a user pointed at "RootDocument flex 0 0" and + * asked what it meant. */ const meta: Meta = { @@ -36,38 +48,54 @@ export default meta; /** The accent selection chip the composer places before any change chips. */ function selectionChip(label: string): HTMLElement { - return el("span", { class: cls("sel-chip"), "data-tip": label }, [ - icon("tool-move", "sm"), - el("span", { text: label }), - el("span", { class: cls("chip-x"), onClick: noop }, [icon("close", "sm")]), - ]); + return el( + "span", + { + class: cls("sel-chip"), + "data-chip": "", + "data-tip": label, + tabindex: "-1", + }, + [ + icon("tool-move", "sm"), + el("span", { class: cls("chip-subject"), text: label }), + el( + "span", + { class: cls("chip-x"), onClick: noop, role: "button", tabindex: "-1" }, + [icon("close", "sm")] + ), + ] + ); } /** * One style chip, as `AirshipApp.styleChips` builds it. * - * The glyph is `settings` for *every* style chip — not a per-property icon — - * and the label carries the element, the property and a shortened value. That is - * a real decision rather than an oversight: at chip size a distinct glyph per - * CSS property would be forty unlearnable marks, and what distinguishes two - * chips is the text. Structure chips use `drag`, which is the one distinction - * that survives at this size. + * No glyph. A style chip used to carry `settings` — the same mark on every one + * of them, which is the one fact a strip of style chips never needs told twelve + * times, and it cost 26px of rail each time. A per-property icon was never the + * alternative: at chip size that would be forty unlearnable marks. What tells + * two chips apart is the text, so the text is all there is. The kinds that stay + * distinguishable at this size keep theirs — `drag` for a move, `minus` and + * `plus` for a delete and a duplicate. */ const chip = ( element: string, property: string, value: string ): ChangeChip => ({ - icon: "settings", - label: `${element} ${property} ${shortValue(value)}`, + detail: property, onRemove: noop, + subject: element, tip: `${element} — ${property}: ${value}`, + value: shortValue(value), }); const moveChip = (element: string): ChangeChip => ({ + detail: "moved", icon: "drag", - label: `${element} moved`, onRemove: noop, + subject: element, tip: `${element} moved`, }); @@ -88,10 +116,15 @@ const CHIPS: ChangeChip[] = [ * asking about them. */ function composer(chips: ChangeChip[], caption: Caption): HTMLElement { - const strip = el("div", { class: cls("sel-chips") }, [ + const strip = el("div", { class: `${cls("sel-chips")} ${cls("scroll-x")}` }, [ selectionChip("