mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 00:37:00 +01:00
The owner, on his phone (2026-10-17): "I see Building, I tap it, and I expect to see how it's building — the chat or the terminal. Here there is just so much… scary to non-technical users." The hero said "Building · 1 agent working" and could not be tapped; under it sat a builder sync line, three counters, a Workspaces list and a "Recent activity" log of the raw prompts sent to agents, safety fences included. - ControlNow: one card per job being built — what it is, what the agent is doing right now, how long — and the whole card opens the live session as a conversation (/terminal?project=…&view=chat&run=…). A job waiting for your answer leads with the question and says "Answer it". - ControlDone: the last day's results, what came of each (merged and deployed, partly done, stopped) and where to look: the site, the change, the conversation. Replaces "Recent activity". - ControlFoot: builder state, New project and Settings in one quiet line. The hero now speaks only for alarms or when someone is needed; Workspaces is desktop-only. - Titles (lib/task-title): a run named from its prompt the way a person would — a feedback fix is the report, an owner's decision is THE ASK, a site brief is its first line with the link as a domain. Never the prompt. - Live step without a viewer (lib/run-step): the runner's progress beat reads the tail of the agent's own session log and sends "Editing Header.tsx"; the server keeps it on the run (payload.lastStep) and /api/control returns it with the run's id, outcome, title and last beat. Fleet Runner 0.8.44. - The project the page auto-selects no longer becomes "your project" in the Profile · Chat · Control · Terminal strip; only one you open does. Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx Co-authored-by: Claude <noreply@anthropic.com>
104 lines
3.3 KiB
TypeScript
104 lines
3.3 KiB
TypeScript
/**
|
|
* Control names a run in plain words (src/lib/task-title.ts) and says what its
|
|
* agent is doing now (src/lib/run-step.ts). Before, the page showed the first
|
|
* 120 characters of the prompt sent to the agent — for a feedback fix, the
|
|
* safety preamble (2026-10-17).
|
|
*
|
|
* Run: npx tsx scripts/test/task-title.ts
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import { intentTitle, taskTitle } from "@/lib/task-title";
|
|
import { latestRunStep } from "@/lib/run-step";
|
|
import { UNTRUSTED_PREAMBLE, fenceUntrusted } from "@/lib/feedback/untrusted";
|
|
import type { TranscriptItem } from "@/lib/claude-transcript";
|
|
|
|
let n = 0;
|
|
const eq = (a: unknown, b: unknown, label: string) => {
|
|
assert.equal(a, b, label);
|
|
n++;
|
|
};
|
|
|
|
eq(
|
|
taskTitle(
|
|
"Develop a new version of this existing website: https://center-com.ru/\nRequested changes (the customer's exact words): Cleaner home page",
|
|
),
|
|
"Develop a new version of this existing website: center-com.ru",
|
|
"a site brief reads as its first line, the link as its domain",
|
|
);
|
|
eq(
|
|
taskTitle(
|
|
[
|
|
"The owner of loki asked for this change while looking at their live site. Make it.",
|
|
UNTRUSTED_PREAMBLE,
|
|
"",
|
|
fenceUntrusted("FEEDBACK", "The header overlaps the logo on my phone"),
|
|
"Page: https://loki.orangecat.ch/control",
|
|
].join("\n"),
|
|
),
|
|
"The header overlaps the logo on my phone",
|
|
"a feedback fix reads as the report, never as the preamble",
|
|
);
|
|
eq(
|
|
taskTitle(
|
|
"The owner of loki read this report and decided what to change. Do exactly what THE ASK says.\n" +
|
|
`${UNTRUSTED_PREAMBLE}\n\nTHE ASK: make the save button bigger\n`,
|
|
),
|
|
"Make the save button bigger",
|
|
"an owner's decision reads as THE ASK",
|
|
);
|
|
eq(
|
|
taskTitle(`Fix these 4 visitor-feedback items on heidi in one pass.\n${UNTRUSTED_PREAMBLE}`),
|
|
"Fix 4 feedback reports",
|
|
"a batch fix names how many",
|
|
);
|
|
eq(taskTitle(null, "next_best"), "Next best task", "no prompt: the library's name for the intent");
|
|
eq(taskTitle("", "test_and_fix"), intentTitle("test_and_fix"), "an intent without a prompt");
|
|
eq(intentTitle("some_new_intent"), "Some new intent", "an unknown intent is humanised");
|
|
eq(intentTitle(null), "A task", "nothing at all");
|
|
const long = taskTitle(`Add ${"a very long ".repeat(12)}feature`);
|
|
assert.ok(long.length <= 72 && long.endsWith("…"), "a long title is clipped on a word");
|
|
n++;
|
|
eq(
|
|
taskTitle("## Goal\n\n- add a contact form. Then ship it."),
|
|
"Add a contact form",
|
|
"markdown and the second sentence go",
|
|
);
|
|
|
|
const at = null;
|
|
const tool = (name: string, summary: string): TranscriptItem => ({
|
|
id: name + summary,
|
|
at,
|
|
kind: "tool",
|
|
name,
|
|
summary,
|
|
status: "done",
|
|
result: null,
|
|
});
|
|
eq(
|
|
latestRunStep([tool("Edit", "/home/u/dev/site/src/Header.tsx")]),
|
|
"Editing Header.tsx",
|
|
"a file edit names the file",
|
|
);
|
|
eq(latestRunStep([tool("Bash", "npm test")]), "Running npm test", "a command names itself");
|
|
eq(
|
|
latestRunStep([
|
|
tool("Read", "/a/b.ts"),
|
|
{
|
|
id: "a",
|
|
at,
|
|
kind: "assistant",
|
|
text: "Now I'll add the contact form. It goes under the hero.",
|
|
},
|
|
]),
|
|
"Now I'll add the contact form.",
|
|
"the agent's own words win when they are newest",
|
|
);
|
|
eq(
|
|
latestRunStep([{ id: "u", at, kind: "user", text: "fix it" }]),
|
|
"Reading the request",
|
|
"just sent",
|
|
);
|
|
eq(latestRunStep([]), null, "nothing yet");
|
|
|
|
console.log(`✓ task-title: ${n} checks passed`);
|