mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:17:01 +01:00
* fix(ui): plain words a non-technical person reads, and a list that agrees with the run
From the owner's walk-through of the demo on a phone, 2026-10-17 — the
words a person who does not build software would stop at:
- "NEEDS PATH" on every project → "Not connected", with the hint "Connect
a folder or code repository so an agent can work on this project."
"Loop-ready" → "Ready for agents"; "Loop paused" → "Autopilot paused".
Same states, same rules (project-loop-readiness).
- "never run" → "no agent runs yet" — and the list's "last run" now reads
the runs themselves, not only typed requests: kestrel said "never run"
while its Watch and Activity showed a run two days old. A run whose
request was a smoke probe stays out, as before.
- Today: "Nothing pressing in the private zone" → "in your goals, people
or money". Activity: "+ 2 quiet" → "+ 2 with no activity". Control:
"Launch defaults" → "Default agent and model".
- Build a preview: the form read like a database ("ACCESS CODE (YOU TELL
IT TO THEM; REMEMBERED FOR NEXT TIME) *"). Labels are now questions or
two words, each explained in one line under it (Field gains an optional
`hint`, styled by .ui-field-hint), the title says it is a first website
for someone, and while "Build it" is grey a line says what is missing.
Checked on a local build with the seeded demo at 390px.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HsFC4ZgDDsMo61aFghG1xd
* fix(ui): one thing to do first on the chat start and the project page
From the owner's walk-through of the demo on a phone, 2026-10-17:
- Chat start: "Start my day" sat above "What are we working on?" with its
setup prompt ("Choose main projects") — a dashboard chore that is
Today's job. On /loki it now shows only with projects to start
(StartMyDay onlyWithWork); Today keeps it as before.
- Build next: two worded links beside the label wrapped onto three lines
at 390px. "Other ideas" is the icon alone (named, 44px, still the
tracked "rotate"); "All suggestions" is "See all", aligned with it.
- Project page: "Ask Loki" and the kickoff's "Make it happen" were two
orange buttons a thumb apart. While the kickoff leads the page, Ask
Loki is secondary (ProjectWorkspaceHeader quiet).
Checked on a local build with the seeded demo at 390px: the chat start is
the question, one row of ideas and the box; kestrel's page has one
primary button.
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>
128 lines
4.4 KiB
TypeScript
128 lines
4.4 KiB
TypeScript
/**
|
|
* Inline tests for fleet-kick helpers and Loki NL detection.
|
|
* Run: npm run test:fleet-kick
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import {
|
|
formatFleetKickReply,
|
|
sortProjectsForKick,
|
|
normalizeKickScope,
|
|
type FleetKickReplyResult,
|
|
} from "@/lib/fleet-kick-format";
|
|
import { isDevelopAllFleetRequest } from "@/lib/loki-fleet-commands";
|
|
import { resolveDispatchTargets, shouldAskForProject } from "@/lib/loki/dispatch-targets";
|
|
import { deriveProjectLoopReadiness } from "@/lib/project-loop-readiness";
|
|
import {
|
|
shouldDispatchScreenshot,
|
|
isDefaultVisionQuestion,
|
|
isScreenshotImplementIntent,
|
|
} from "@/lib/loki/screenshot-dispatch";
|
|
import type { CommandResolution } from "@/lib/command-resolve";
|
|
|
|
function testSortProjectsForKick() {
|
|
const ready = new Set(["beta", "alpha"]);
|
|
const sorted = sortProjectsForKick(["zeta", "alpha", "beta", "gamma"], ready);
|
|
assert.deepEqual(sorted, ["alpha", "beta", "gamma", "zeta"]);
|
|
}
|
|
|
|
function testDevelopAllFleetPhrases() {
|
|
assert.equal(isDevelopAllFleetRequest("develop all my projects"), true);
|
|
assert.equal(isDevelopAllFleetRequest("build the whole fleet"), true);
|
|
assert.equal(isDevelopAllFleetRequest("start every project"), true);
|
|
assert.equal(isDevelopAllFleetRequest("code review for loki"), false);
|
|
assert.equal(isDevelopAllFleetRequest("next best for loki"), false);
|
|
}
|
|
|
|
function testDispatchTargets() {
|
|
const resolution = (partial: Partial<CommandResolution>): CommandResolution => ({
|
|
kind: "command",
|
|
projectKey: null,
|
|
intentId: "quality",
|
|
prompt: "code review",
|
|
needsProject: false,
|
|
reason: "test",
|
|
...partial,
|
|
});
|
|
|
|
assert.deepEqual(
|
|
resolveDispatchTargets({
|
|
resolution: resolution({ projectKey: "a" }),
|
|
selectedProjects: ["b", "c"],
|
|
namedInText: null,
|
|
}),
|
|
["b", "c"],
|
|
);
|
|
|
|
assert.deepEqual(
|
|
resolveDispatchTargets({
|
|
resolution: resolution({ projectKey: "a" }),
|
|
selectedProjects: ["b", "c"],
|
|
namedInText: "a",
|
|
}),
|
|
["a"],
|
|
);
|
|
|
|
// No projects: never ask "which project?" — there is nothing to pick.
|
|
assert.equal(shouldAskForProject({ needsProject: true }, []), false);
|
|
assert.equal(shouldAskForProject({ needsProject: true }, ["loki"]), true);
|
|
assert.equal(shouldAskForProject({ needsProject: false }, ["loki"]), false);
|
|
}
|
|
|
|
function testScreenshotDispatch() {
|
|
assert.equal(
|
|
shouldDispatchScreenshot("What's wrong here and what should we change?", true, "loki"),
|
|
true,
|
|
);
|
|
assert.equal(shouldDispatchScreenshot("implement this ui", true, "loki"), true);
|
|
assert.equal(shouldDispatchScreenshot("what do you think?", true, "loki"), false);
|
|
assert.equal(shouldDispatchScreenshot("implement this", true, null), false);
|
|
assert.equal(isDefaultVisionQuestion("What's wrong here and what should we change?"), true);
|
|
assert.equal(isScreenshotImplementIntent("please implement the layout"), true);
|
|
}
|
|
|
|
function testProjectLoopReadiness() {
|
|
assert.equal(deriveProjectLoopReadiness({ dirPath: "/repo/app" }).label, "Ready for agents");
|
|
const missing = deriveProjectLoopReadiness({ dirPath: null });
|
|
assert.equal(missing.reason, "no_path");
|
|
assert.equal(missing.label, "Not connected");
|
|
const paused = deriveProjectLoopReadiness({
|
|
dirPath: "/repo/app",
|
|
autoInjectModeOverride: "off",
|
|
});
|
|
assert.equal(paused.reason, "project_paused");
|
|
}
|
|
|
|
function testFleetKickReplyExplainsSkippedProjects() {
|
|
const result: FleetKickReplyResult = {
|
|
runnerConnected: false,
|
|
fleetMode: "on",
|
|
kicked: 0,
|
|
activeBefore: 0,
|
|
details: [
|
|
{ projectKey: "profile-only", outcome: "skipped", reason: "no_path" },
|
|
{ projectKey: "queued", outcome: "skipped", reason: "pending_command" },
|
|
],
|
|
message: "No idle projects to kick right now.",
|
|
};
|
|
const reply = formatFleetKickReply(result);
|
|
assert.match(reply, /\*\*Skipped:\*\*/);
|
|
assert.match(reply, /profile-only: needs a local path/);
|
|
assert.match(reply, /queued: already queued/);
|
|
}
|
|
|
|
testSortProjectsForKick();
|
|
assert.equal(
|
|
normalizeKickScope(undefined),
|
|
null,
|
|
"omitted scope keeps the explicit whole-fleet command",
|
|
);
|
|
assert.equal(normalizeKickScope([])?.size, 0, "empty selection must never start the whole fleet");
|
|
assert.deepEqual([...normalizeKickScope(["Loki", "LOKI", "Solon"])!], ["loki", "solon"]);
|
|
testDevelopAllFleetPhrases();
|
|
testDispatchTargets();
|
|
testScreenshotDispatch();
|
|
testProjectLoopReadiness();
|
|
testFleetKickReplyExplainsSkippedProjects();
|
|
|
|
console.log("✓ fleet-kick helper tests passed");
|