mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 23:49:46 +01:00
* feat(loki): one chat across projects — the named project wins, and the switch shows A Loki chat already moves between projects: name one and the next answer works there, and the scope follows. Two edges remained. - The fast paths (business plan, profile update, screenshot) put the selection before a project named in the message. The selection now follows whatever project the last answer used, so "write the business plan for orangecat" sent after a loki build went to loki. resolveFleetCommandProjectKey now lets the named project win, as resolveDispatchTargets already does. - The switch was silent — only the thread header's label changed. The thread now draws a quiet "Now on X" rule above the message that moved the chat to another project (lib/loki/project-switches.ts, tested). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HsFC4ZgDDsMo61aFghG1xd * fix(widget): on a phone, the panel stands on the keyboard; scope tabs on one row Owner's phone, 2026-10-11: with the keyboard up, the Loki panel's "Build it / Ask Loki" buttons were under the keys and the thread was a sliver. Android Chrome lays the keyboard OVER the page (the layout viewport keeps its height), so a sheet pinned to bottom:0 with a vh height sits behind it. - sheet.ts follows the visual viewport: keyboardInset() says how much the keyboard covers (tested; <80px is a toolbar, not a keyboard), and the sheet then stands on the keyboard with its height capped to what is visible. While typing, the starters and the way into Loki step aside (.panel.kb) and come back when the keyboard goes. - The "About · This page · Whole site · An element · Loki itself" row wrapped onto two lines with the label floating beside both. On phones it is one sideways-scrolling row; the label goes (the group keeps its aria-label). The rule sits after the base .seg rule, which it overrides. Checked in Chromium at 390×800 with a simulated 330px keyboard: the panel ends at the keyboard (470px) and Ask Loki sits at 367–399px, where it was at 625px — under the keys — before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HsFC4ZgDDsMo61aFghG1xd --------- Co-authored-by: Claude <noreply@anthropic.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
// One Loki chat moving between projects draws "Now on X" at each switch,
|
|
// above the question that asked. Run: npx tsx scripts/test/project-switches.ts
|
|
import assert from "node:assert/strict";
|
|
import { projectSwitches, turnProject } from "@/lib/loki/project-switches";
|
|
|
|
const you = { role: "user", meta: null };
|
|
const on = (p: string | null, keys?: string[]) => ({
|
|
role: "assistant",
|
|
meta: p ? { projectKey: p } : keys ? { projectKeys: keys } : {},
|
|
});
|
|
|
|
assert.equal(turnProject({ projectKey: "loki" }), "loki");
|
|
assert.equal(turnProject({ projectKeys: ["a"] }), "a");
|
|
assert.equal(turnProject({ projectKeys: ["a", "b"] }), null, "a fan-out is no one project");
|
|
assert.equal(turnProject(null), null);
|
|
|
|
assert.deepEqual([...projectSwitches([you, on("loki"), you, on("loki")])], [], "no switch");
|
|
assert.deepEqual(
|
|
[...projectSwitches([you, on("loki"), you, on("orangecat"), you, on(null), you, on("loki")])],
|
|
[
|
|
[2, "orangecat"],
|
|
[6, "loki"],
|
|
],
|
|
"each switch, above the asking message; a project-less answer changes nothing",
|
|
);
|
|
assert.deepEqual(
|
|
[...projectSwitches([you, on("Loki"), you, on("loki")])],
|
|
[],
|
|
"case is not a switch",
|
|
);
|
|
assert.deepEqual([...projectSwitches([on("a"), on("b")])], [[1, "b"]], "no question before it");
|
|
|
|
console.log("project-switches: ok");
|