loki-mode 11.145.0 → 11.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/dashboard/__init__.py +1 -1
- package/docs/CLI-REFERENCE.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/loki-ts/dist/loki.js +1693 -1689
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/ask-tools-server.js +10 -1
- package/packages/control-plane/dist/server.js +521 -26
- package/packages/control-plane/src/server/routes/index.ts +2 -1
- package/packages/control-plane/src/server/routes/workspace.ts +126 -0
- package/packages/control-plane/src/server/runs.ts +8 -0
- package/packages/control-plane/ui/dist/assets/index-CWUisTer.css +1 -0
- package/packages/control-plane/ui/dist/assets/index-CwNcWbo3.js +151 -0
- package/packages/control-plane/ui/dist/index.html +2 -2
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-Dtrte_9h.js → AdminPage-DeR4gl6L.js} +1 -1
- package/web-app/dist/assets/{Avatar-BqDxz5Iw.js → Avatar-ByWp4bxk.js} +1 -1
- package/web-app/dist/assets/{Badge-BGX45Lnh.js → Badge-D7AlqwvS.js} +1 -1
- package/web-app/dist/assets/{Button-DVr538c3.js → Button-B0Mukoh2.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-CIODjzWx.js → CockpitPage-BZRQbXD_.js} +1 -1
- package/web-app/dist/assets/{ComparePage-DSaexpQe.js → ComparePage-B_rn9nnQ.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-CnkNmsIK.js → ErrorBoundary-Cp0pyJvY.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-BOYje705.js → EvidenceReceiptPanel-DmWRoowG.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-D-obZbg0.js → GitHubIssuesPanel-B5DI_-br.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-BDP6UPrV.js → GitHubPRsPanel-CW0LYfHT.js} +1 -1
- package/web-app/dist/assets/{HomePage-CyuUJmkD.js → HomePage-DPSWa5R5.js} +2 -2
- package/web-app/dist/assets/{LoginPage-CwzpHE77.js → LoginPage-CwoGp6Vj.js} +1 -1
- package/web-app/dist/assets/{MagicPage-B-2U-xDs.js → MagicPage-gkNRlwuf.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-cNfnAqIP.js → MetricsPage-CDnOCldd.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-Bnja4u7t.js → NotFoundPage-Bnvssp3g.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-DxKwokda.js → ProjectPage-DgtG5BlM.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-D0HElwG2.js → ProjectsPage-Ckbjkg_L.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-cKZTmoDV.js → SettingsPage-D-R2gEUm.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-COCzMSj2.js → ShowcasePage-Em9ddqYI.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-DpEdU35g.js → SystemSettingsPage-gN8Y0061.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-CRa-oR3c.js → TeamsPage-CUuN5SDA.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-CqVQ2RrJ.js → TemplatesPage-CXOEV__d.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-77EBpy6w.js → TerminalOutput-BWG3HITb.js} +1 -1
- package/web-app/dist/assets/{activity-CwYJMGXJ.js → activity-DxQfYkTL.js} +1 -1
- package/web-app/dist/assets/{bell-D7tpnhHd.js → bell-BwhFGRVu.js} +1 -1
- package/web-app/dist/assets/{bot-BGEMExhD.js → bot-CyvCOo2P.js} +1 -1
- package/web-app/dist/assets/{check-DXYfUB9x.js → check-BO8HHeFn.js} +1 -1
- package/web-app/dist/assets/{chevron-left-fmjoQGhm.js → chevron-left-DHacGkaA.js} +1 -1
- package/web-app/dist/assets/{circle-alert-Bg5XeK2P.js → circle-alert-CtUDR5al.js} +1 -1
- package/web-app/dist/assets/{clock-CsKyZSPS.js → clock-eFnNWkzH.js} +1 -1
- package/web-app/dist/assets/{cloud-Bd60jog4.js → cloud-CNw2NygE.js} +1 -1
- package/web-app/dist/assets/{code-xml-Ctl0DdWZ.js → code-xml-epWPsMsv.js} +1 -1
- package/web-app/dist/assets/{database-ziASlG1B.js → database-DF7YXeji.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-Bo2f3aLO.js → dollar-sign-3qMKGL_Z.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-BZCY8u6u.js → file-code-corner-d4385evP.js} +1 -1
- package/web-app/dist/assets/{file-plus-DZX_AwtZ.js → file-plus-BdY4WvqD.js} +1 -1
- package/web-app/dist/assets/{globe-BqP4Lntz.js → globe-D-pzos7L.js} +1 -1
- package/web-app/dist/assets/{hammer-KMjpooTk.js → hammer-CKSu1dvx.js} +1 -1
- package/web-app/dist/assets/{index-B_8pnUwl.js → index-MgAdMJ-_.js} +3 -3
- package/web-app/dist/assets/{layers-Bdkz5DFw.js → layers-Df6wyWQv.js} +1 -1
- package/web-app/dist/assets/{loader-circle-BV_0L7bg.js → loader-circle-D7ToQmQ_.js} +1 -1
- package/web-app/dist/assets/{lock-DhK1z1dB.js → lock-tnSuBc1R.js} +1 -1
- package/web-app/dist/assets/{package-De8MCdUa.js → package-Bjca3WQy.js} +1 -1
- package/web-app/dist/assets/{plus-BQbDrNgm.js → plus-DuwA_qsO.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-BQ2ezlqR.js → refresh-cw-Da58kJj9.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-EuVYh2XK.js → rotate-ccw-Fkw8w7IS.js} +1 -1
- package/web-app/dist/assets/{scroll-text-BcrL2UnM.js → scroll-text-C8H6DOOY.js} +1 -1
- package/web-app/dist/assets/{server-dpdGPXDc.js → server-BM6Vt7xD.js} +1 -1
- package/web-app/dist/assets/{shield-alert-B2AnkpV_.js → shield-alert-DWYdFESN.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-Zock-j5_.js → thumbs-up-Dl3OOA_N.js} +1 -1
- package/web-app/dist/assets/{trash-2-B9zGFCn0.js → trash-2-BspuXMRV.js} +1 -1
- package/web-app/dist/assets/{trending-down-DWQW56VW.js → trending-down-DK9U9VEk.js} +1 -1
- package/web-app/dist/assets/{trending-up--6mzkyyP.js → trending-up-C5RaQYmy.js} +1 -1
- package/web-app/dist/assets/{upload-CNxdXaU0.js → upload-CMZ51Yr8.js} +1 -1
- package/web-app/dist/assets/{usePolling-CVHCrC_t.js → usePolling-DZ1CmD1A.js} +1 -1
- package/web-app/dist/assets/{user-CuL3zj1a.js → user-C-xZ3AXa.js} +1 -1
- package/web-app/dist/index.html +1 -1
- package/packages/control-plane/ui/dist/assets/index-DeSVrWgd.css +0 -1
- package/packages/control-plane/ui/dist/assets/index-Dy80VLtj.js +0 -190
|
@@ -26,6 +26,7 @@ import { mount as start } from "./start.ts";
|
|
|
26
26
|
import { mount as stats } from "./stats.ts";
|
|
27
27
|
import { mount as stream } from "./stream.ts";
|
|
28
28
|
import { mount as verify } from "./verify.ts";
|
|
29
|
+
import { mount as workspace } from "./workspace.ts";
|
|
29
30
|
|
|
30
31
|
export interface RouteCtx {
|
|
31
32
|
app: Hono;
|
|
@@ -47,7 +48,7 @@ export interface RouteCtx {
|
|
|
47
48
|
ghImpl?: GhRunner;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
export const routeModules: ReadonlyArray<(ctx: RouteCtx) => void> = [artifacts, ask, stream, start, control, stats, cost, costLedger, doctor, fleet, metrics, checkpoints, memory, sessionControl, config, providers, verify, integrations, notify, audit, mergeRisk];
|
|
51
|
+
export const routeModules: ReadonlyArray<(ctx: RouteCtx) => void> = [artifacts, ask, stream, start, control, stats, cost, costLedger, doctor, fleet, metrics, checkpoints, memory, sessionControl, config, providers, verify, integrations, notify, audit, mergeRisk, workspace];
|
|
51
52
|
|
|
52
53
|
export function registerRoutes(ctx: RouteCtx): void {
|
|
53
54
|
mountRepos(ctx.act, ctx.db, ctx.peerIsLoopback, ctx.repoDir, ctx.ghImpl);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// The three levels the Loki UI shows: an account, the projects under it (grouped by org), and the repositories of each project; plus what Loki and
|
|
2
|
+
// Claude Code know about one repository (its instruction files and Loki's notes) and the one write the UI makes there (the repository's CLAUDE.md, the
|
|
3
|
+
// file Claude Code itself reads, so instructions written in the UI work outside Loki too).
|
|
4
|
+
// Storage: one JSON file, ~/.loki/control/workspace.json (LOKI_WORKSPACE_FILE overrides). Reads follow the probe rule; writes are loopback JSON only.
|
|
5
|
+
// (New file: repos.ts lists repository names, memory.ts serves the focused project's run memory; neither owns grouping or repository instructions.)
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { homedir, userInfo } from "node:os";
|
|
8
|
+
import { dirname, join, resolve, sep } from "node:path";
|
|
9
|
+
import type { Context } from "hono";
|
|
10
|
+
import { localRepos, runs } from "../../db/schema.ts";
|
|
11
|
+
import type { Db } from "../../db/migrate.ts";
|
|
12
|
+
import { audit } from "../audit.ts";
|
|
13
|
+
import { repoNames } from "../repos.ts";
|
|
14
|
+
import { originOk } from "./start.ts";
|
|
15
|
+
import { probeAllowed, type RouteCtx } from "./index.ts";
|
|
16
|
+
|
|
17
|
+
export interface Project { id: string; name: string; repos: string[] }
|
|
18
|
+
export interface Org { id: string; name: string; projects: Project[] }
|
|
19
|
+
export interface Workspace { account: { name: string }; orgs: Org[] }
|
|
20
|
+
|
|
21
|
+
const ID = /^[a-z0-9][a-z0-9-]{0,39}$/, MAX_BYTES = 200_000;
|
|
22
|
+
export const workspaceFile = (env: NodeJS.ProcessEnv = process.env): string => env["LOKI_WORKSPACE_FILE"] || join(homedir(), ".loki", "control", "workspace.json");
|
|
23
|
+
const accountName = (): string => { try { return userInfo().username || "me"; } catch { return "me"; } };
|
|
24
|
+
const text = (v: unknown, max: number): string | null => (typeof v === "string" && v.trim() !== "" && v.length <= max ? v.trim() : null);
|
|
25
|
+
|
|
26
|
+
/** A workspace from untrusted JSON, or the reason it is refused. Unknown keys are dropped; ids must be short lowercase slugs, unique where they must be. */
|
|
27
|
+
export function parseWorkspace(raw: unknown): { ok: true; ws: Workspace } | { ok: false; error: string } {
|
|
28
|
+
const o = raw as { account?: { name?: unknown }; orgs?: unknown } | null;
|
|
29
|
+
const name = text(o?.account?.name, 80); if (!name) return { ok: false, error: "account.name must be 1 to 80 characters" };
|
|
30
|
+
if (!Array.isArray(o?.orgs) || o!.orgs.length === 0 || o!.orgs.length > 50) return { ok: false, error: "orgs must hold 1 to 50 entries" };
|
|
31
|
+
const orgs: Org[] = [], orgIds = new Set<string>();
|
|
32
|
+
for (const x of o!.orgs as { id?: unknown; name?: unknown; projects?: unknown }[]) {
|
|
33
|
+
const id = text(x?.id, 40), nm = text(x?.name, 80);
|
|
34
|
+
if (!id || !ID.test(id) || orgIds.has(id) || !nm) return { ok: false, error: "each org needs a unique lowercase id and a name" };
|
|
35
|
+
orgIds.add(id);
|
|
36
|
+
if (!Array.isArray(x.projects) || x.projects.length > 200) return { ok: false, error: `org ${id}: projects must be a list of at most 200` };
|
|
37
|
+
const projects: Project[] = [], pIds = new Set<string>();
|
|
38
|
+
for (const p of x.projects as { id?: unknown; name?: unknown; repos?: unknown }[]) {
|
|
39
|
+
const pid = text(p?.id, 40), pn = text(p?.name, 80);
|
|
40
|
+
if (!pid || !ID.test(pid) || pIds.has(pid) || !pn) return { ok: false, error: `org ${id}: each project needs a unique lowercase id and a name` };
|
|
41
|
+
pIds.add(pid);
|
|
42
|
+
const repos = Array.isArray(p.repos) ? [...new Set((p.repos as unknown[]).filter((r): r is string => typeof r === "string" && r.length > 0 && r.length <= 200))].slice(0, 500) : [];
|
|
43
|
+
projects.push({ id: pid, name: pn, repos });
|
|
44
|
+
}
|
|
45
|
+
orgs.push({ id, name: nm, projects });
|
|
46
|
+
}
|
|
47
|
+
return { ok: true, ws: { account: { name }, orgs } };
|
|
48
|
+
}
|
|
49
|
+
/** The saved workspace, or a first one: your account, one org, one project holding every repository that has a run. Never throws. */
|
|
50
|
+
export function loadWorkspace(known: string[], file = workspaceFile()): Workspace {
|
|
51
|
+
try { if (existsSync(file)) { const p = parseWorkspace(JSON.parse(readFileSync(file, "utf8"))); if (p.ok) return p.ws; } } catch { /* unreadable: fall through to the default */ }
|
|
52
|
+
return { account: { name: accountName() }, orgs: [{ id: "personal", name: "Personal", projects: [{ id: "default", name: "My project", repos: [...known] }] }] };
|
|
53
|
+
}
|
|
54
|
+
export function saveWorkspace(ws: Workspace, file = workspaceFile()): void {
|
|
55
|
+
mkdirSync(dirname(file), { recursive: true, mode: 0o700 });
|
|
56
|
+
const tmp = `${file}.${process.pid}.tmp`; writeFileSync(tmp, JSON.stringify(ws, null, 2) + "\n", { mode: 0o600 }); renameSync(tmp, file);
|
|
57
|
+
}
|
|
58
|
+
/** Short names of the repositories that have at least one run: the ones worth showing before anyone has organised anything. */
|
|
59
|
+
export function reposWithRuns(db: Db): string[] {
|
|
60
|
+
const names = db.selectDistinct({ r: runs.originRepo }).from(runs).all().map((x) => (x.r ? x.r.split("/").pop() ?? "" : "")).filter(Boolean);
|
|
61
|
+
return [...new Set(names)].sort();
|
|
62
|
+
}
|
|
63
|
+
/** Every repository the UI can name: the ones found on this machine plus the ones runs recorded. */
|
|
64
|
+
export const knownRepos = (db: Db): string[] => [...new Set([...repoNames(db), ...reposWithRuns(db)])].sort();
|
|
65
|
+
/** The repositories with runs that no project holds yet, so work is never invisible (a machine can hold hundreds of idle checkouts; those stay in the picker). */
|
|
66
|
+
export const unassigned = (ws: Workspace, withRuns: string[]): string[] => { const held = new Set(ws.orgs.flatMap((o) => o.projects.flatMap((p) => p.repos))); return withRuns.filter((r) => !held.has(r)); };
|
|
67
|
+
|
|
68
|
+
/** The local directory of a registered repository (by display name), or null. Only directories Loki itself discovered are ever read or written. */
|
|
69
|
+
export function repoDirsOf(db: Db, name: string): string[] {
|
|
70
|
+
const rows = db.select({ name: localRepos.name, realpath: localRepos.realpath }).from(localRepos).all().filter((r) => r.name === name);
|
|
71
|
+
return [...new Set(rows.map((r) => r.realpath))].filter((d) => { try { return statSync(d).isDirectory(); } catch { return false; /* moved or deleted */ } });
|
|
72
|
+
}
|
|
73
|
+
export const repoDirOf = (db: Db, name: string): string | null => repoDirsOf(db, name)[0] ?? null;
|
|
74
|
+
const INSTRUCTION_FILES = ["CLAUDE.md", "CLAUDE.local.md", ".claude/CLAUDE.md", "AGENTS.md"] as const;
|
|
75
|
+
const NOTE_DIRS = [".loki/memory", ".loki/learnings", ".claude/rules"] as const;
|
|
76
|
+
const readCapped = (p: string): { text: string; bytes: number; truncated: boolean } | null => { try { const st = statSync(p); if (!st.isFile()) return null; const b = readFileSync(p); return { text: b.subarray(0, MAX_BYTES).toString("utf8"), bytes: st.size, truncated: st.size > MAX_BYTES }; } catch { return null; } };
|
|
77
|
+
/** What is written down about one repository: the instruction files Claude Code reads, and Loki's own notes. Text is capped; nothing outside the repository is read. */
|
|
78
|
+
export function repoKnowledge(dir: string): { instructions: { path: string; bytes: number; truncated: boolean; text: string }[]; notes: { path: string; bytes: number; preview: string }[] } {
|
|
79
|
+
const instructions = INSTRUCTION_FILES.flatMap((f) => { const r = readCapped(join(dir, f)); return r ? [{ path: f, ...r }] : []; });
|
|
80
|
+
const notes: { path: string; bytes: number; preview: string }[] = [];
|
|
81
|
+
for (const d of NOTE_DIRS) {
|
|
82
|
+
let names: string[] = []; try { names = readdirSync(join(dir, d)).filter((n) => /\.(md|json|jsonl|txt)$/i.test(n)).sort().slice(0, 40); } catch { continue; }
|
|
83
|
+
for (const n of names) { const r = readCapped(join(dir, d, n)); if (r) notes.push({ path: `${d}/${n}`, bytes: r.bytes, preview: r.text.slice(0, 600) }); }
|
|
84
|
+
}
|
|
85
|
+
return { instructions, notes };
|
|
86
|
+
}
|
|
87
|
+
/** Writes the repository's CLAUDE.md (temp file, then rename). The path is fixed: the UI can never name another file. */
|
|
88
|
+
export function writeInstructions(dir: string, content: string): void {
|
|
89
|
+
const root = resolve(dir), target = join(root, "CLAUDE.md");
|
|
90
|
+
if (!target.startsWith(root + sep)) throw new Error("path outside the repository");
|
|
91
|
+
const tmp = `${target}.${process.pid}.tmp`; writeFileSync(tmp, content); renameSync(tmp, target);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function mount(ctx: RouteCtx): void {
|
|
95
|
+
const { app, act, db, local } = ctx, deny = { error: "loopback only without a token" };
|
|
96
|
+
const body = async (c: Context): Promise<{ ok: true; json: unknown } | { ok: false; res: Response }> => {
|
|
97
|
+
if (!local(c)) return { ok: false, res: c.json({ error: "loopback JSON requests only" }, 403) };
|
|
98
|
+
if (!originOk(c.req.header("origin"))) return { ok: false, res: c.json({ error: "origin not allowed" }, 403) };
|
|
99
|
+
const t = await c.req.text(); if (t.length > MAX_BYTES + 2000) return { ok: false, res: c.json({ error: "body too large" }, 413) };
|
|
100
|
+
try { return { ok: true, json: JSON.parse(t) }; } catch { return { ok: false, res: c.json({ error: "invalid JSON" }, 400) }; }
|
|
101
|
+
};
|
|
102
|
+
app.get("/v1/workspace", (c) => { if (!probeAllowed(ctx, c)) return c.json(deny, 403); const active = reposWithRuns(db), ws = loadWorkspace(active); return c.json({ ...ws, repos: knownRepos(db), unassigned: unassigned(ws, active) }); });
|
|
103
|
+
act.put("/v1/workspace", async (c) => {
|
|
104
|
+
const b = await body(c); if (!b.ok) return b.res;
|
|
105
|
+
const p = parseWorkspace(b.json); if (!p.ok) { audit(db, { kind: "workspace.save", result: "refused", detail: p.error }); return c.json({ error: p.error }, 400); }
|
|
106
|
+
try { saveWorkspace(p.ws); } catch (e) { return c.json({ error: `could not save: ${(e as Error).message}` }, 500); }
|
|
107
|
+
audit(db, { kind: "workspace.save", result: "saved", detail: `${p.ws.orgs.length} org(s), ${p.ws.orgs.reduce((a, o) => a + o.projects.length, 0)} project(s)` });
|
|
108
|
+
return c.json({ ...p.ws, repos: knownRepos(db), unassigned: unassigned(p.ws, reposWithRuns(db)) });
|
|
109
|
+
});
|
|
110
|
+
app.get("/v1/repo/knowledge", (c) => {
|
|
111
|
+
if (!probeAllowed(ctx, c)) return c.json(deny, 403);
|
|
112
|
+
const name = c.req.query("repo") ?? "", dir = name ? repoDirOf(db, name) : null;
|
|
113
|
+
if (!dir) return c.json({ error: "not a repository Loki has seen on this machine" }, 404);
|
|
114
|
+
return c.json({ repo: name, ...repoKnowledge(dir) });
|
|
115
|
+
});
|
|
116
|
+
act.put("/v1/repo/instructions", async (c) => {
|
|
117
|
+
const b = await body(c); if (!b.ok) return b.res;
|
|
118
|
+
const name = text((b.json as { repo?: unknown } | null)?.repo, 200), content = (b.json as { content?: unknown } | null)?.content;
|
|
119
|
+
if (!name || typeof content !== "string" || content.length > MAX_BYTES) return c.json({ error: `repo and content (at most ${MAX_BYTES} characters) are required` }, 400);
|
|
120
|
+
const dirs = repoDirsOf(db, name), dir = dirs[0]; if (!dir) return c.json({ error: "not a repository Loki has seen on this machine" }, 404);
|
|
121
|
+
if (dirs.length > 1) { audit(db, { kind: "repo.instructions", target: name, result: "refused", detail: `${dirs.length} checkouts share this name` }); return c.json({ error: `${dirs.length} checkouts on this machine are named ${name}; edit CLAUDE.md in the one you mean` }, 409); } // a write must never land in a checkout the person did not mean
|
|
122
|
+
try { writeInstructions(dir, content); } catch (e) { audit(db, { kind: "repo.instructions", target: name, result: "error", detail: (e as Error).message }); return c.json({ error: `could not write CLAUDE.md: ${(e as Error).message}` }, 500); }
|
|
123
|
+
audit(db, { kind: "repo.instructions", target: name, result: "saved", detail: `${content.length} characters` });
|
|
124
|
+
return c.json({ repo: name, ...repoKnowledge(dir) });
|
|
125
|
+
});
|
|
126
|
+
}
|
|
@@ -205,6 +205,13 @@ export function runDetail(db: Db, sourceId: string, runId: string) {
|
|
|
205
205
|
const done = f.run.completed?.data;
|
|
206
206
|
const sealed = evs.find((e) => e.type === "receipt.sealed")?.data;
|
|
207
207
|
const stop = stopReason(evs, r.verdict);
|
|
208
|
+
// The acceptance lines and their state, newest first: the seal's final table, else the last proof run Loki did itself, else the lines as intake read them (all waiting).
|
|
209
|
+
const sealAcc = evs.findLast((e) => e.type === "stage.completed" && e.stage === "seal")?.data as Record<string, unknown> | undefined;
|
|
210
|
+
const proofEv = evs.findLast((e) => e.type === "proof.rerun")?.data as Record<string, unknown> | undefined;
|
|
211
|
+
const intakeAcc = evs.find((e) => e.type === "stage.completed" && e.stage === "intake")?.data as Record<string, unknown> | undefined;
|
|
212
|
+
const accRows: Record<string, unknown>[] = Array.isArray(sealAcc?.issue_acceptance) ? (sealAcc!.issue_acceptance as Record<string, unknown>[]) : Array.isArray(proofEv?.statuses) ? (proofEv!.statuses as Record<string, unknown>[]) : Array.isArray(intakeAcc?.issue_acceptance) ? (intakeAcc!.issue_acceptance as unknown[]).map((l): Record<string, unknown> => ({ line: String(l), status: "waiting" })) : [];
|
|
213
|
+
const acceptance = accRows.map((x) => ({ line: String(x.line ?? ""), status: x.status === "met" ? "met" : x.status === "unmet" ? "unmet" : "waiting", checks: typeof x.checks === "number" ? x.checks : 0, reason: typeof x.reason === "string" ? x.reason : null }));
|
|
214
|
+
const proof = proofEv ? { round: Number(proofEv.round ?? 1), exit: typeof proofEv.exit === "number" ? proofEv.exit : null, proved: Number(proofEv.proved ?? 0), failed: Number(proofEv.failed ?? 0), seconds: Number(proofEv.seconds ?? 0) } : null;
|
|
208
215
|
return {
|
|
209
216
|
...withLive(db, r),
|
|
210
217
|
blocked_question: blockedQuestion(evs, r.verdict),
|
|
@@ -214,5 +221,6 @@ export function runDetail(db: Db, sourceId: string, runId: string) {
|
|
|
214
221
|
stages_completed: f.completed,
|
|
215
222
|
receipt: sealed ? { sha256: str(sealed.receipt_sha256), signed: sealed.signed === true, verdict: str(sealed.verdict), path: str(sealed.path) } : null,
|
|
216
223
|
not_proven: Array.isArray(done?.not_proven) ? (done.not_proven as string[]) : [],
|
|
224
|
+
acceptance, acceptance_source: (sealAcc?.issue_acceptance_source ?? proofEv?.source) === "plan" ? "plan" : "issue", proof,
|
|
217
225
|
};
|
|
218
226
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--bg: #fafaf9;--panel: #ffffff;--ink: #18181b;--muted: #6b7280;--line: #e7e5e4;--soft: #f4f4f5;--accent: #4f46e5;--ok: #15803d;--ok-bg: #dcfce7;--warn: #b45309;--warn-bg: #fef3c7;--bad: #b91c1c;--bad-bg: #fee2e2;--radius: 14px;--shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .04);--font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace}@media(prefers-color-scheme:dark){:root{--bg: #0b0b0f;--panel: #14141a;--ink: #f4f4f5;--muted: #9ca3af;--line: #26262e;--soft: #1c1c24;--accent: #818cf8;--ok: #4ade80;--ok-bg: #052e16;--warn: #fbbf24;--warn-bg: #2d1f02;--bad: #f87171;--bad-bg: #2d0a0a;--shadow: none}}*{box-sizing:border-box}html,body,#root{height:100%}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--font);-webkit-font-smoothing:antialiased}a{color:inherit;text-decoration:none}button,input,textarea,select{font:inherit;color:inherit}h1{font-size:26px;line-height:1.2;margin:0;letter-spacing:-.02em;font-weight:650}h2{font-size:15px;margin:0 0 12px;font-weight:600;letter-spacing:-.01em}.muted{color:var(--muted)}.mono{font-family:var(--mono);font-size:13px}.app{display:grid;grid-template-columns:264px 1fr;height:100%}.side{border-right:1px solid var(--line);padding:20px 14px;overflow-y:auto;display:flex;flex-direction:column;gap:18px}.brand{display:flex;align-items:center;gap:10px;padding:0 8px;font-weight:700;letter-spacing:-.02em;font-size:17px}.brand-dot{width:22px;height:22px;border-radius:7px;background:linear-gradient(135deg,var(--accent),#a855f7)}.nav-label{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);padding:0 8px;margin-bottom:4px}.nav a,.nav button{display:flex;align-items:center;gap:8px;width:100%;padding:7px 8px;border-radius:9px;border:0;background:none;cursor:pointer;text-align:left}.nav a:hover,.nav button:hover{background:var(--soft)}.nav a.on{background:var(--soft);font-weight:600}.nav .sub{padding-left:26px;font-size:14px}.nav .count{margin-left:auto;font-size:12px;color:var(--muted)}.main{overflow-y:auto}.page{max-width:1040px;margin:0 auto;padding:36px 32px 80px;display:flex;flex-direction:column;gap:22px}.crumbs{font-size:13px;color:var(--muted);display:flex;gap:6px;align-items:center}.crumbs a:hover{color:var(--ink)}.head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}.head p{margin:6px 0 0}.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow)}.grid{display:grid;gap:14px;grid-template-columns:repeat(auto-fill,minmax(230px,1fr))}.tile{display:block;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow);transition:transform .12s ease,border-color .12s ease}.tile:hover{transform:translateY(-1px);border-color:var(--accent)}.tile .t{font-weight:600;margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px}.stat .n{font-size:28px;font-weight:650;letter-spacing:-.02em}.stat .l{font-size:13px;color:var(--muted)}.badge{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;background:var(--soft);color:var(--muted)}.badge.ok{background:var(--ok-bg);color:var(--ok)}.badge.warn{background:var(--warn-bg);color:var(--warn)}.badge.bad{background:var(--bad-bg);color:var(--bad)}.badge.live{background:color-mix(in srgb,var(--accent) 14%,transparent);color:var(--accent)}.pulse{width:7px;height:7px;border-radius:50%;background:currentColor;animation:pulse 1.4s ease-in-out infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.3}}.rows{display:flex;flex-direction:column}.row{display:grid;grid-template-columns:1fr auto auto auto;gap:16px;align-items:center;padding:12px 4px;border-top:1px solid var(--line)}.row:first-child{border-top:0}.row:hover{background:var(--soft);border-radius:10px}.row .title{font-weight:550;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.row .meta{font-size:13px;color:var(--muted);white-space:nowrap}.stages{display:flex;gap:6px;flex-wrap:wrap}.stage{padding:6px 12px;border-radius:10px;background:var(--soft);font-size:13px;color:var(--muted);display:flex;gap:6px;align-items:center}.stage.done{color:var(--ok);background:var(--ok-bg)}.stage.now{color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent);font-weight:600}.stage.failed{color:var(--bad);background:var(--bad-bg)}.acc{display:flex;flex-direction:column}.acc-row{display:grid;grid-template-columns:28px 1fr auto;gap:12px;padding:11px 0;border-top:1px solid var(--line);align-items:start}.acc-row:first-child{border-top:0}.dot{width:20px;height:20px;border-radius:50%;display:grid;place-items:center;margin-top:2px;background:var(--soft);color:var(--muted)}.dot.met{background:var(--ok-bg);color:var(--ok)}.dot.unmet{background:var(--bad-bg);color:var(--bad)}.acc-row .why{font-size:13px;color:var(--muted);margin-top:2px}.bar{height:6px;border-radius:99px;background:var(--soft);overflow:hidden}.bar>i{display:block;height:100%;background:var(--ok);border-radius:99px;transition:width .4s ease}.btn{display:inline-flex;align-items:center;gap:8px;padding:9px 16px;border-radius:10px;border:1px solid var(--line);background:var(--panel);cursor:pointer;font-weight:550}.btn:hover{border-color:var(--accent)}.btn.primary{background:var(--ink);color:var(--bg);border-color:var(--ink)}.btn:disabled{opacity:.5;cursor:default}.field{width:100%;padding:10px 12px;border-radius:10px;border:1px solid var(--line);background:var(--panel);outline:none}.field:focus{border-color:var(--accent)}textarea.field{min-height:320px;font-family:var(--mono);font-size:13px;line-height:1.55;resize:vertical}.inline{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line)}.tab{padding:9px 14px;border:0;background:none;cursor:pointer;color:var(--muted);border-bottom:2px solid transparent;margin-bottom:-1px}.tab.on{color:var(--ink);border-bottom-color:var(--ink);font-weight:600}.empty{text-align:center;padding:36px 12px;color:var(--muted)}.err{background:var(--bad-bg);color:var(--bad);border-radius:10px;padding:10px 14px;font-size:14px}pre.note{margin:8px 0 0;padding:12px;border-radius:10px;background:var(--soft);font-family:var(--mono);font-size:12.5px;white-space:pre-wrap;word-break:break-word;max-height:220px;overflow:auto}ul.plain{margin:0;padding:0 0 0 18px;display:flex;flex-direction:column;gap:6px;font-size:14px}@media(max-width:780px){.app{grid-template-columns:1fr}.side{display:none}.page{padding:24px 16px 60px}.row{grid-template-columns:1fr auto}.row .meta{display:none}}
|