Skip to content

armgit / cogit

Public Imported from GitHub
0

Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.

fix(inbox): close a row from its corner, colour rows by project and fold the inbox on a map

Eren95f789b06a2e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0918797..88d62cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Changed
+- The "Your turn" inbox: each row closes with an × in its top-right corner (hidden until the agent writes in that session again), rows of different projects carry their own lane colour on the left, and on a project's map the inbox starts folded to one "Your turn" line so it no longer pushes the map off the page.
## [0.14.0] - 2026-10-27
### Added
diff --git a/packages/template/src/App.tsx b/packages/template/src/App.tsx
index 16166c1..12f1c57 100644
--- a/packages/template/src/App.tsx
+++ b/packages/template/src/App.tsx
@@ -84,7 +84,7 @@ export function App({ model }: { model: LineageViewModel }) {
</header>
{/* Story 11.1: only this project's rows, same as the panel's inbox. */}
- <Inbox rows={model.inbox ?? []} />
+ <Inbox rows={model.inbox ?? []} collapsible />
</div>
<Graph model={model} search={search} />
diff --git a/packages/template/src/Inbox.tsx b/packages/template/src/Inbox.tsx
index 206a065..a91866c 100644
--- a/packages/template/src/Inbox.tsx
+++ b/packages/template/src/Inbox.tsx
@@ -21,6 +21,16 @@ function rowHref(row: ViewInboxRow): string {
return `${base}#${params.toString()}`;
}
+/**
+ * One lane colour per project, so rows of different projects never blur
+ * together: a stable hash of the path picks one of the six lane colours.
+ */
+export function projectColour(path: string): number {
+ let hash = 0;
+ for (const char of path) hash = (hash * 31 + (char.codePointAt(0) ?? 0)) >>> 0;
+ return hash % 6;
+}
+
function WhereWereWe({ row }: { row: ViewInboxRow }) {
const parts = [
row.goal === "" ? "" : `Goal: ${row.goal}`,
@@ -35,7 +45,15 @@ function WhereWereWe({ row }: { row: ViewInboxRow }) {
);
}
-export function Inbox({ rows }: { rows: ViewInboxRow[] }) {
+export function Inbox({
+ rows,
+ collapsible = false,
+}: {
+ rows: ViewInboxRow[];
+ /** On a map the inbox starts folded to one line, so it never pushes the map away. */
+ collapsible?: boolean;
+}) {
+ const [open, setOpen] = useState(!collapsible);
// A `file://` page has no server to persist a dismissal; the row hides for
// this open page, which is what the button's title says.
const [hidden, setHidden] = useState<ReadonlySet<string>>(new Set());
@@ -64,58 +82,79 @@ export function Inbox({ rows }: { rows: ViewInboxRow[] }) {
return (
<section className="inbox" aria-labelledby="inbox-title">
<h2 id="inbox-title">
- Your turn <span className="muted inbox-count">{visible.length}</span>
+ {collapsible ? (
+ <button
+ type="button"
+ className="inbox-toggle"
+ aria-expanded={open}
+ onClick={() => setOpen((value) => !value)}
+ >
+ <span className="inbox-caret">{open ? "▾" : "▸"}</span> Your turn{" "}
+ <span className="muted inbox-count">{visible.length}</span>
+ </button>
+ ) : (
+ <>
+ Your turn <span className="muted inbox-count">{visible.length}</span>
+ </>
+ )}
</h2>
- <ul className="inbox-rows">
- {visible.map((row) => (
- <li className="inbox-row" key={dismissKey(row.projectPath, row.sessionId)}>
- <div className="inbox-head">
- <span className="inbox-project" title={row.projectPath}>
- {row.projectName}
- </span>
- <span className="inbox-session">{row.sessionTitle}</span>
- <span
- className={row.signal === "record" ? "inbox-age is-record" : "inbox-age"}
- title={formatTime(row.at)}
- >
- {row.signal === "record"
- ? `the record says it needs you · ${timeSince(row.at, now)}`
- : `your turn for ${timeSince(row.at, now)}`}
- </span>
- </div>
- {row.lastMessage === undefined ? null : (
- <p className="inbox-message">{row.lastMessage}</p>
- )}
- {row.signal !== "both" ? null : (
- <p className="inbox-signal">The record says it needs you.</p>
- )}
- <WhereWereWe row={row} />
- <div className="inbox-actions">
- <a className="inbox-open" href={rowHref(row)}>
- {row.messageId === undefined ? "Open the map →" : "Open at this message →"}
- </a>
- <ResumeButton
- projectPath={row.projectPath}
- sessionId={row.sessionId}
- available={row.transcriptAvailable}
- revealCommand
- />
- <button
- type="button"
- className="inbox-dismiss"
- title={
- pageToken() === null
- ? "Hide until this page is reloaded"
- : "Hide until a new agent turn"
- }
- onClick={() => dismiss(row)}
- >
- Dismiss
- </button>
- </div>
- </li>
- ))}
- </ul>
+ {open ? (
+ <ul className="inbox-rows">
+ {visible.map((row) => (
+ <li
+ className="inbox-row"
+ key={dismissKey(row.projectPath, row.sessionId)}
+ style={{ borderLeftColor: `var(--l${projectColour(row.projectPath)})` }}
+ >
+ <div className="inbox-head">
+ <span className="inbox-project" title={row.projectPath}>
+ {row.projectName}
+ </span>
+ <span className="inbox-session">{row.sessionTitle}</span>
+ <span
+ className={row.signal === "record" ? "inbox-age is-record" : "inbox-age"}
+ title={formatTime(row.at)}
+ >
+ {row.signal === "record"
+ ? `the record says it needs you · ${timeSince(row.at, now)}`
+ : `your turn for ${timeSince(row.at, now)}`}
+ </span>
+ <button
+ type="button"
+ className="inbox-dismiss"
+ aria-label="Dismiss"
+ title={
+ pageToken() === null
+ ? "Hide until this page is reloaded"
+ : "Hide until the agent writes in this session again"
+ }
+ onClick={() => dismiss(row)}
+ >
+ ×
+ </button>
+ </div>
+ {row.lastMessage === undefined ? null : (
+ <p className="inbox-message">{row.lastMessage}</p>
+ )}
+ {row.signal !== "both" ? null : (
+ <p className="inbox-signal">The record says it needs you.</p>
+ )}
+ <WhereWereWe row={row} />
+ <div className="inbox-actions">
+ <a className="inbox-open" href={rowHref(row)}>
+ {row.messageId === undefined ? "Open the map →" : "Open at this message →"}
+ </a>
+ <ResumeButton
+ projectPath={row.projectPath}
+ sessionId={row.sessionId}
+ available={row.transcriptAvailable}
+ revealCommand
+ />
+ </div>
+ </li>
+ ))}
+ </ul>
+ ) : null}
{error === null ? null : <p className="muted inbox-error">{error}</p>}
</section>
);
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index c65ca8d..d75db29 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -1671,20 +1671,41 @@ time {
font-size: 12px;
}
+/* The close button in a row's top-right corner: hides the row until the agent
+ writes in that session again. */
.inbox-dismiss {
- margin-left: auto;
+ width: 24px;
+ height: 24px;
+ padding: 0;
color: var(--muted);
+ font-size: 18px;
+ line-height: 22px;
background: none;
- border: 1px solid var(--line);
+ border: 1px solid transparent;
border-radius: 6px;
- padding: 2px 8px;
- font-size: 12px;
cursor: pointer;
}
.inbox-dismiss:hover {
color: var(--text);
- border-color: var(--muted);
+ border-color: var(--line);
+ background: var(--hover);
+}
+
+/* On a map the inbox is one line until opened. */
+.inbox-toggle {
+ padding: 0;
+ color: inherit;
+ font: inherit;
+ background: none;
+ border: 0;
+ cursor: pointer;
+}
+
+.inbox-caret {
+ display: inline-block;
+ width: 1em;
+ color: var(--muted);
}
.inbox-error {
diff --git a/packages/template/test/inbox.test.ts b/packages/template/test/inbox.test.ts
new file mode 100644
index 0000000..5bd2006
--- /dev/null
+++ b/packages/template/test/inbox.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it } from "vitest";
+import { projectColour } from "../src/Inbox.js";
+
+describe("projectColour", () => {
+ it("gives a project the same lane colour every time", () => {
+ expect(projectColour("/home/a/cogit")).toBe(projectColour("/home/a/cogit"));
+ });
+
+ it("stays within the six lane colours", () => {
+ for (const path of ["/a", "/home/a/cogit", "/home/a/seo-toolkit", "", "/x/y/z"]) {
+ const colour = projectColour(path);
+ expect(colour).toBeGreaterThanOrEqual(0);
+ expect(colour).toBeLessThan(6);
+ }
+ });
+
+ it("tells different projects apart", () => {
+ const colours = new Set(["/p/one", "/p/two", "/p/three", "/p/four"].map(projectColour));
+ expect(colours.size).toBeGreaterThan(1);
+ });
+});