Fix picker layering and fork order

This commit is contained in:
Federico Jaramillo Martinez
2026-05-08 16:31:31 +02:00
parent 84dab0abe5
commit 53caabfff0
3 changed files with 15 additions and 9 deletions
+2 -2
View File
@@ -197,7 +197,7 @@ export const statusBarStyles = css`
export const autocompleteStyles = css` export const autocompleteStyles = css`
:host { display: block; } :host { display: block; }
.menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); max-height: 260px; overflow: auto; border: 1px solid #30363d; border-radius: 8px; background: #161b22; box-shadow: 0 10px 30px #0008; } .menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 10; max-height: 260px; overflow: auto; border: 1px solid #30363d; border-radius: 8px; background: #161b22; box-shadow: 0 10px 30px #0008; }
button { display: grid; grid-template-columns: minmax(120px, 1fr) auto; gap: 4px 10px; width: 100%; border: 0; border-bottom: 1px solid #30363d; border-radius: 0; background: transparent; color: #e6edf3; padding: 8px 10px; text-align: left; cursor: pointer; } button { display: grid; grid-template-columns: minmax(120px, 1fr) auto; gap: 4px 10px; width: 100%; border: 0; border-bottom: 1px solid #30363d; border-radius: 0; background: transparent; color: #e6edf3; padding: 8px 10px; text-align: left; cursor: pointer; }
button:last-child { border-bottom: 0; } button:last-child { border-bottom: 0; }
button.selected, button:hover { background: #0d2847; } button.selected, button:hover { background: #0d2847; }
@@ -239,7 +239,7 @@ export const actionPaletteStyles = css`
`; `;
export const promptEditorStyles = css` export const promptEditorStyles = css`
:host { display: block; color: #e6edf3; font: 14px system-ui, sans-serif; } :host { position: relative; z-index: 5; display: block; color: #e6edf3; font: 14px system-ui, sans-serif; }
footer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border-top: 1px solid #30363d; } footer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border-top: 1px solid #30363d; }
footer.shell-mode { border-top-color: #3fb950; background: #0f1b12; } footer.shell-mode { border-top-color: #3fb950; background: #0f1b12; }
.editor-wrap { position: relative; min-width: 0; } .editor-wrap { position: relative; min-width: 0; }
@@ -96,16 +96,22 @@ describe("SessionCommandService", () => {
expect(active.runtime.session.compact).toHaveBeenCalledWith("focus on tests"); expect(active.runtime.session.compact).toHaveBeenCalledWith("focus on tests");
}); });
it("creates fork selection requests and responds with selected entry", async () => { it("creates fork selection requests from newest message to oldest and responds with selected entry", async () => {
const active = activeSession(); const active = activeSession({
getUserMessagesForForking: vi.fn(() => [
{ entryId: "oldest", text: "oldest message" },
{ entryId: "middle", text: "middle message" },
{ entryId: "newest", text: "newest message" },
]),
});
const service = new SessionCommandService(() => getActive(active), vi.fn(), { publish: vi.fn() } as never); const service = new SessionCommandService(() => getActive(active), vi.fn(), { publish: vi.fn() } as never);
const result = await service.run("s1", "/fork"); const result = await service.run("s1", "/fork");
expect(result).toMatchObject({ type: "select", title: "Fork from message", options: [{ value: "m1" }] }); expect(result).toMatchObject({ type: "select", title: "Fork from message", options: [{ value: "newest" }, { value: "middle" }, { value: "oldest" }] });
if (result.type !== "select") throw new Error("Expected select result"); if (result.type !== "select") throw new Error("Expected select result");
await expect(service.respond("s1", result.requestId, "m1")).resolves.toMatchObject({ type: "done", message: "Session forked", session: { id: "s1" } }); await expect(service.respond("s1", result.requestId, "newest")).resolves.toMatchObject({ type: "done", message: "Session forked", session: { id: "s1" } });
expect(active.runtime.fork).toHaveBeenCalledWith("m1"); expect(active.runtime.fork).toHaveBeenCalledWith("newest");
await expect(service.respond("s1", result.requestId, "m1")).resolves.toEqual({ type: "unsupported", message: "Command request expired" }); await expect(service.respond("s1", result.requestId, "newest")).resolves.toEqual({ type: "unsupported", message: "Command request expired" });
}); });
}); });
+1 -1
View File
@@ -93,7 +93,7 @@ export class SessionCommandService {
type: "select", type: "select",
requestId, requestId,
title: "Fork from message", title: "Fork from message",
options: messages.map((message) => ({ value: message.entryId, label: truncate(message.text, 140) })), options: [...messages].reverse().map((message) => ({ value: message.entryId, label: truncate(message.text, 140) })),
}; };
} }