@fungi.computer/bonsai 0.6.29 → 0.6.30

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @fungi.computer/bonsai
2
2
 
3
+ ## 0.6.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Changes since 0.6.29:
8
+
9
+ - fix(bonsai): center the issue invitation at card width
10
+ - fix(ui): restore consistent first-use empty state panels
11
+ - fix(bonsai): give history filters full phone touch height
12
+ - fix(inkcap): finish responsive recovery and bundle proof
13
+ - fix(bonsai): complete first-use flow with Inkcap
14
+
15
+ - Updated dependencies
16
+ - Updated dependencies
17
+ - @fungi.computer/caps@0.10.4
18
+ - @fungi.computer/oyster@0.19.27
19
+ - @fungi.computer/trellis@0.10.6
20
+
3
21
  ## 0.6.29
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@fungi.computer/bonsai",
3
- "version": "0.6.29",
3
+ "version": "0.6.30",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "type": "module",
6
6
  "description": "Bonsai: a git platform for many agents working at once, on Workers and Artifacts",
7
7
  "dependencies": {
8
8
  "@fungi.computer/agar": "0.9.1",
9
- "@fungi.computer/caps": "0.10.3",
9
+ "@fungi.computer/caps": "0.10.4",
10
10
  "@fungi.computer/issues": "0.2.0",
11
- "@fungi.computer/oyster": "0.19.26",
11
+ "@fungi.computer/oyster": "0.19.27",
12
12
  "@fungi.computer/puffball": "0.5.5",
13
13
  "@fungi.computer/sigils": "0.3.0",
14
14
  "@fungi.computer/stipe": "0.1.1",
@@ -30,7 +30,7 @@
30
30
  "@visx/hierarchy": "3.12.0",
31
31
  "@fungi.computer/gills": "0.3.0",
32
32
  "@fungi.computer/nacre": "0.4.4",
33
- "@fungi.computer/trellis": "0.10.5",
33
+ "@fungi.computer/trellis": "0.10.6",
34
34
  "@fungi.computer/braid": "0.4.8",
35
35
  "@fungi.computer/workflows-wire": "0.4.8"
36
36
  },
@@ -43,18 +43,16 @@ export const insightLayout = z.strictObject({
43
43
  ),
44
44
  });
45
45
  export type InsightLayout = z.infer<typeof insightLayout>;
46
- /**
47
- * The default layout for a young repository: Network and Live shrink to one
48
- * row, since a graph of a few commits does not need two, and the rows below
49
- * move up to close the gap.
50
- */
46
+ /** Start with the files and next task; the full tile set stays in Arrange tiles. */
51
47
  export function compactDefaultLayout(): InsightLayout {
52
48
  return {
53
- ...defaultLayout,
54
- placements: defaultLayout.placements.map((tile) => {
55
- if (tile.id === "network" || tile.id === "live") return { ...tile, h: 1 };
56
- return tile.row >= 2 ? { ...tile, row: tile.row - 1 } : tile;
57
- }),
49
+ view: "overview",
50
+ placements: [
51
+ { id: "readme", col: 0, row: 0, w: 3, h: 1 },
52
+ { id: "next", col: 3, row: 0, w: 1, h: 1 },
53
+ { id: "network", col: 0, row: 1, w: 3, h: 1 },
54
+ { id: "live", col: 3, row: 1, w: 1, h: 1 },
55
+ ],
58
56
  };
59
57
  }
60
58
 
@@ -167,7 +167,7 @@ describe("Bonsai home page", () => {
167
167
  ),
168
168
  ).toEqual(["Start your first repository", "What happens next"]);
169
169
  expect(container.textContent).toContain(
170
- "Every Agent gets its own fork; watch them merge back here.",
170
+ "Keep files and their history, with a separate working copy for each AI helper.",
171
171
  );
172
172
  expect(
173
173
  [...container.querySelectorAll("button")].filter(
@@ -0,0 +1,138 @@
1
+ // @vitest-environment jsdom
2
+ import { act, createElement } from "react";
3
+ import { createRoot, type Root } from "react-dom/client";
4
+ import { afterEach, expect, it, vi } from "vitest";
5
+ import {
6
+ QueryClient,
7
+ QueryClientProvider,
8
+ notifyManager,
9
+ } from "@tanstack/react-query";
10
+ import { createCapabilityRegistry } from "@fungi.computer/agar";
11
+ import { appMethods } from "@fungi.computer/agar/backend";
12
+ import { appsOpen } from "@fungi.computer/agar/apps";
13
+ import type { FileContent } from "@fungi.computer/agar/roles/files";
14
+ import { IssuesPanel } from "../web/issues-panel.js";
15
+ import { firstIssuePath } from "../web/first-issue.js";
16
+ import { RouterProvider } from "../web/router.js";
17
+ import { connect } from "../web/transport.js";
18
+ import { jsonValue } from "../shared/contract.js";
19
+
20
+ let root: Root | undefined;
21
+ let client: QueryClient | undefined;
22
+ afterEach(() => {
23
+ act(() => root?.unmount());
24
+ client?.clear();
25
+ connect(null);
26
+ document.body.replaceChildren();
27
+ vi.unstubAllGlobals();
28
+ });
29
+
30
+ it.each(["pending", "failed", "conflict"] as const)(
31
+ "keeps a %s first issue visible until its committed version arrives",
32
+ async (state) => {
33
+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
34
+ vi.stubGlobal(
35
+ "ResizeObserver",
36
+ class {
37
+ observe = vi.fn();
38
+ disconnect = vi.fn();
39
+ unobserve = vi.fn();
40
+ },
41
+ );
42
+ notifyManager.setScheduler(queueMicrotask);
43
+ const text =
44
+ "# My saved first issue\n\nKeep this text while sync is unavailable.";
45
+ const file: FileContent = {
46
+ version: 1,
47
+ ref: "main",
48
+ commit: "a".repeat(40),
49
+ blob: null,
50
+ path: firstIssuePath,
51
+ size: 0,
52
+ binary: false,
53
+ text: null,
54
+ pending: { text, revision: 1, state },
55
+ };
56
+ const committed: Record<string, string> = {};
57
+ const open = vi.fn(() => Promise.resolve());
58
+ const capabilities = createCapabilityRegistry();
59
+ capabilities.provide(appsOpen, {
60
+ open,
61
+ role: () => Promise.resolve({ displayName: "Inkcap" }),
62
+ });
63
+ capabilities.provide(appMethods, {
64
+ call: (method) => {
65
+ if (method === "files.read")
66
+ return Promise.resolve(jsonValue.parse(file));
67
+ if (method === "issues.read")
68
+ return Promise.resolve({
69
+ ref: "main",
70
+ commit: {
71
+ hash: "a".repeat(40),
72
+ treeHash: "b".repeat(40),
73
+ parents: [],
74
+ message: "Save issue",
75
+ author: { name: "Ada", email: "ada@example.test" },
76
+ committer: { name: "Ada", email: "ada@example.test" },
77
+ authoredAt: 1,
78
+ committedAt: 1,
79
+ },
80
+ files: committed,
81
+ truncated: false,
82
+ });
83
+ throw new Error(`Unexpected method ${method}`);
84
+ },
85
+ });
86
+ connect({ capabilities });
87
+ const cache = new QueryClient({
88
+ defaultOptions: { queries: { retry: false } },
89
+ });
90
+ client = cache;
91
+ const container = document.createElement("div");
92
+ document.body.appendChild(container);
93
+ root = createRoot(container);
94
+ await act(async () => {
95
+ root?.render(
96
+ createElement(
97
+ QueryClientProvider,
98
+ { client: cache },
99
+ createElement(
100
+ RouterProvider,
101
+ null,
102
+ createElement(IssuesPanel, {
103
+ repo: "notes",
104
+ refName: "main",
105
+ open: "general/01-first-issue.md",
106
+ }),
107
+ ),
108
+ ),
109
+ );
110
+ await Promise.resolve();
111
+ });
112
+
113
+ expect(container.textContent).toContain("My saved first issue");
114
+ expect(container.textContent).toContain(
115
+ state === "pending"
116
+ ? "Saved · syncing"
117
+ : state === "failed"
118
+ ? "Saved · sync failed"
119
+ : "Saved · sync conflict",
120
+ );
121
+ expect(container.textContent).not.toContain("No issues yet");
122
+ const button = [...container.querySelectorAll("button")].find((item) =>
123
+ item.textContent.includes("Open saved issue"),
124
+ );
125
+ expect(button).toBeDefined();
126
+ await act(async () => {
127
+ button?.click();
128
+ await Promise.resolve();
129
+ });
130
+ expect(open).toHaveBeenCalledOnce();
131
+ committed["general/01-first-issue.md"] = text;
132
+ file.pending = { text, revision: 1, state: "synced" };
133
+ await act(async () => client?.invalidateQueries());
134
+ expect(container.textContent).toContain("My saved first issue");
135
+ expect(container.textContent).not.toContain("Saved · sync");
136
+ expect(container.querySelectorAll("h1")).toHaveLength(1);
137
+ },
138
+ );
package/web/api.ts CHANGED
@@ -63,6 +63,8 @@ export const useFile = (name: string, ref: string, path: string | null) =>
63
63
  fileContent,
64
64
  ),
65
65
  enabled: path !== null,
66
+ refetchInterval: (query) =>
67
+ query.state.data?.pending?.state === "pending" ? 1000 : false,
66
68
  });
67
69
 
68
70
  export const useFiles = (name: string, ref: string, enabled = true) =>
package/web/bonsai.css CHANGED
@@ -532,14 +532,13 @@ body {
532
532
  position: relative;
533
533
  }
534
534
  .bonsai-history-commits a {
535
- display: flex;
536
- align-items: baseline;
537
- gap: var(--spacing-xs);
535
+ display: block;
536
+ height: 100%;
538
537
  overflow: hidden;
539
538
  text-overflow: ellipsis;
540
539
  white-space: nowrap;
541
540
  }
542
- .bonsai-history-commits p {
541
+ .bonsai-history-commits .bonsai-muted {
543
542
  overflow: hidden;
544
543
  text-overflow: ellipsis;
545
544
  white-space: nowrap;
@@ -35,7 +35,7 @@ import {
35
35
  Failure,
36
36
  Loading,
37
37
  } from "./parts.js";
38
- import { firstLine, relativeTime, shortHash } from "./format.js";
38
+ import { actorLabel, firstLine, relativeTime, shortHash } from "./format.js";
39
39
  import { href, Link, useRouter } from "./router.js";
40
40
  import {
41
41
  changeStatusLabel,
@@ -527,7 +527,7 @@ export function ChangePage({ repo, number }: { repo: string; number: number }) {
527
527
  {agent ? (
528
528
  <AgentName name={agent} colors={colors} />
529
529
  ) : (
530
- commit.author.name
530
+ actorLabel(commit.author.name)
531
531
  )}{" "}
532
532
  · {shortHash(commit.hash)} ·{" "}
533
533
  {relativeTime(commit.committedAt * 1000)}
package/web/code-tab.tsx CHANGED
@@ -7,7 +7,13 @@ import { editInFilesEditor, callMethod } from "./transport.js";
7
7
  import type { RepoDetail } from "../shared/contract.js";
8
8
  import { useFiles, useFile, useFilesEditor } from "./api.js";
9
9
  import { BonsaiBoard } from "./board.js";
10
- import { firstLine, formatBytes, relativeTime, shortHash } from "./format.js";
10
+ import {
11
+ actorLabel,
12
+ firstLine,
13
+ formatBytes,
14
+ relativeTime,
15
+ shortHash,
16
+ } from "./format.js";
11
17
  import { Loading, Failure } from "./parts.js";
12
18
  import { QuickSetup } from "./quick-setup.js";
13
19
  import { href, Link, useRouter, type Route } from "./router.js";
@@ -96,7 +102,11 @@ export function CodeTab({
96
102
  <Disclosure
97
103
  open={treeOpen}
98
104
  onOpenChange={setTreeOpen}
99
- summary={`Files · ${shown ?? ref}`}
105
+ summary={
106
+ <span className="inline-flex items-center max-sm:min-h-[var(--caps-touch-target)]">
107
+ Files · {shown ?? ref}
108
+ </span>
109
+ }
100
110
  >
101
111
  {tree}
102
112
  </Disclosure>
@@ -212,7 +222,8 @@ export function CodeTab({
212
222
  ) : null}
213
223
  {files.data ? (
214
224
  <p className="text-sm text-[var(--stipe-fg-muted)]">
215
- Latest commit · {files.data.commit.author.name} ·{" "}
225
+ Latest commit · {actorLabel(files.data.commit.author.name)}{" "}
226
+ ·{" "}
216
227
  <Link
217
228
  to={href({
218
229
  page: "commit",
@@ -2,7 +2,7 @@
2
2
  import { useEffect, useMemo, useRef } from "react";
3
3
  import type { Graph, GraphNode } from "../shared/contract.js";
4
4
  import { layoutGraph } from "./network-graph.js";
5
- import { agentColor, relativeTime, shortHash } from "./format.js";
5
+ import { actorLabel, agentColor, relativeTime, shortHash } from "./format.js";
6
6
  import { href, Link } from "./router.js";
7
7
  import type { AgentColors } from "./parts.js";
8
8
 
@@ -131,17 +131,24 @@ export function CommitTree({
131
131
  hash: node.hash,
132
132
  })}
133
133
  >
134
- <span className="min-w-0 truncate">{node.message}</span>
135
- <span className="max-w-[45%] shrink-0 truncate text-xs text-[var(--stipe-fg-muted)] bonsai-history-branch">
136
- {lane?.owner ? `${lane.owner}/` : ""}
137
- {lane?.ref}
134
+ <span className="flex items-baseline gap-1">
135
+ <span className="min-w-0 truncate">{node.message}</span>
136
+ <span className="max-w-[45%] shrink-0 truncate text-xs text-[var(--stipe-fg-muted)] bonsai-history-branch">
137
+ {lane?.owner
138
+ ? `${actorLabel(lane.owner, colors.get(lane.owner)?.you)}/`
139
+ : ""}
140
+ {lane?.ref}
141
+ </span>
142
+ </span>
143
+ <span className="block text-sm text-[var(--stipe-fg-muted)] bonsai-muted">
144
+ <code>{shortHash(node.hash)}</code> ·{" "}
145
+ {actorLabel(
146
+ node.agent ?? node.author,
147
+ colors.get(node.agent ?? node.author)?.you,
148
+ )}{" "}
149
+ · {relativeTime(node.committedAt * 1000)}
138
150
  </span>
139
151
  </Link>
140
- <p className="text-sm text-[var(--stipe-fg-muted)] bonsai-muted">
141
- <code>{shortHash(node.hash)}</code> ·{" "}
142
- {node.agent ?? node.author} ·{" "}
143
- {relativeTime(node.committedAt * 1000)}
144
- </p>
145
152
  </li>
146
153
  );
147
154
  })}
@@ -1,7 +1,7 @@
1
1
  import { fileContent, fileSaveResult } from "@fungi.computer/agar/roles/files";
2
2
  import { callMethod, editInFilesEditor, filesEditor } from "./transport.js";
3
3
 
4
- const path = "issues/general/01-first-issue.md";
4
+ export const firstIssuePath = "issues/general/01-first-issue.md";
5
5
 
6
6
  /** Create the first issue through the editor's save door, then open it there. */
7
7
  export async function writeFirstIssue(repo: string, branch: string) {
@@ -9,7 +9,7 @@ export async function writeFirstIssue(repo: string, branch: string) {
9
9
  throw new Error("Choose a file editor in your App settings first.");
10
10
  const file = await callMethod(
11
11
  "files.read",
12
- { repo, ref: branch, path },
12
+ { repo, ref: branch, path: firstIssuePath },
13
13
  fileContent,
14
14
  );
15
15
  // A repeated click or an earlier editor draft must never replace someone's text.
@@ -19,7 +19,7 @@ export async function writeFirstIssue(repo: string, branch: string) {
19
19
  {
20
20
  repo,
21
21
  branch,
22
- path,
22
+ path: firstIssuePath,
23
23
  baseBlob: null,
24
24
  baseCommit: file.commit,
25
25
  revision: file.version,
@@ -59,5 +59,5 @@ Add any details that will help someone understand the issue.
59
59
  if (result.kind !== "saved" && result.kind !== "synced")
60
60
  throw new Error("The issue could not be created. Try again.");
61
61
  }
62
- await editInFilesEditor(repo, branch, path);
62
+ await editInFilesEditor(repo, branch, firstIssuePath);
63
63
  }
package/web/home-page.tsx CHANGED
@@ -97,13 +97,16 @@ function HomeNetwork({
97
97
  const nextSteps = [
98
98
  [
99
99
  "Create a repository",
100
- "Name it. Bonsai commits a README so it has content.",
100
+ "Name your collection of files. Bonsai saves a README to start its history.",
101
101
  ],
102
102
  [
103
- "Agents fork it",
104
- "Each Agent works on its own fork and never touches main.",
103
+ "Work in separate copies",
104
+ "Each AI helper gets a fork: its own copy, separate from the shared version.",
105
+ ],
106
+ [
107
+ "Review and combine",
108
+ "Merge the changes you want into main, the shared version.",
105
109
  ],
106
- ["You merge", "Review a change, merge it, and watch the network graph grow."],
107
110
  ] as const;
108
111
 
109
112
  /** What happens after the first repository, so the empty state shows its product. */
@@ -343,7 +346,7 @@ export function HomePage({ live }: { live: LiveState }) {
343
346
  <SetupNotice
344
347
  variant="panel"
345
348
  need="Bonsai needs Git access to save your repositories"
346
- cause="Every Agent gets its own fork; watch them merge back here."
349
+ cause="Keep files and their history, with a separate working copy for each AI helper."
347
350
  visual={<GitBranch aria-hidden="true" />}
348
351
  fix={{
349
352
  label: "Approve Git access",
@@ -355,9 +358,10 @@ export function HomePage({ live }: { live: LiveState }) {
355
358
  ) : (
356
359
  <>
357
360
  <EmptyState
358
- variant="panel"
361
+ variant="plain"
362
+ visual="blobs"
359
363
  title="Start your first repository"
360
- description="Every Agent gets its own fork; watch them merge back here."
364
+ description="Keep files and their history, with a separate working copy for each AI helper."
361
365
  primaryAction={{
362
366
  label: "New repository",
363
367
  onSelect: () => {
package/web/insights.tsx CHANGED
@@ -181,12 +181,12 @@ function Grid({
181
181
  editing
182
182
  ? []
183
183
  : [
184
+ "readme",
185
+ "next",
184
186
  "network",
185
187
  "live",
186
188
  "changes",
187
189
  "actors",
188
- "next",
189
- "readme",
190
190
  "contributors",
191
191
  "ages",
192
192
  "churn",
@@ -224,7 +224,7 @@ export function OverviewBoard({
224
224
  repo: string;
225
225
  definitions: BoardTile[];
226
226
  controlsTarget: HTMLElement | null;
227
- /** A young repository: Network and Live take one row, not two. */
227
+ /** A young repository starts with files and its next task. */
228
228
  compactHero?: boolean;
229
229
  }) {
230
230
  const layout = useQuery({
@@ -244,7 +244,7 @@ export function OverviewBoard({
244
244
  );
245
245
  return (
246
246
  <Grid
247
- key={repo}
247
+ key={`${repo}:${layout.data.tiles ? "saved" : compactHero ? "young" : "mature"}`}
248
248
  repo={repo}
249
249
  initial={
250
250
  (
@@ -1,3 +1,8 @@
1
+ import { FileText } from "lucide-react";
2
+ import { useQueryClient } from "@tanstack/react-query";
3
+ import { Button } from "@fungi.computer/caps/components/button";
4
+ import { FailureLine } from "@fungi.computer/caps/components/failure-line";
5
+ import { editInFilesEditor } from "./transport.js";
1
6
  import { BonsaiBoard } from "./board.js";
2
7
  import { CardTitle } from "@fungi.computer/caps/components/card";
3
8
  /**
@@ -21,8 +26,8 @@ import {
21
26
  type IssueStatus,
22
27
  } from "@fungi.computer/issues";
23
28
  import { useMemo, useState } from "react";
24
- import { writeFirstIssue } from "./first-issue.js";
25
- import { useIssueFiles } from "./api.js";
29
+ import { firstIssuePath, writeFirstIssue } from "./first-issue.js";
30
+ import { useFile, useFilesEditor, useIssueFiles } from "./api.js";
26
31
  import { Failure, Loading } from "./parts.js";
27
32
  import { href, Link } from "./router.js";
28
33
  import { Markdown } from "./views.js";
@@ -144,13 +149,82 @@ export function IssuesPanel({
144
149
  refName: string;
145
150
  open: string | null;
146
151
  }) {
152
+ const client = useQueryClient();
153
+ const editor = useFilesEditor();
147
154
  const [creating, setCreating] = useState(false);
148
155
  const [creationError, setCreationError] = useState<string | null>(null);
149
156
  const files = useIssueFiles(repo, refName);
150
- const report = useMemo(
151
- () => (files.data ? inspectIssueTree(files.data.files) : null),
152
- [files.data],
153
- );
157
+ const firstPath = firstIssuePath.slice("issues/".length);
158
+ const first = useFile(repo, refName, firstIssuePath);
159
+ const saved = first.data?.pending;
160
+ const pending = saved?.state !== "synced" ? saved : undefined;
161
+ const visibleFiles = useMemo(() => {
162
+ const result = { ...files.data?.files };
163
+ if (
164
+ saved &&
165
+ (saved.state !== "synced" || result[firstPath] === undefined)
166
+ ) {
167
+ result[firstPath] = saved.text;
168
+ }
169
+ return result;
170
+ }, [files.data, firstPath, saved]);
171
+ const report = useMemo(() => inspectIssueTree(visibleFiles), [visibleFiles]);
172
+ const openEditor = () => {
173
+ setCreationError(null);
174
+ void editInFilesEditor(repo, refName, firstIssuePath).catch(
175
+ (error: unknown) => {
176
+ setCreationError(
177
+ error instanceof Error ? error.message : "The editor could not open",
178
+ );
179
+ },
180
+ );
181
+ };
182
+ const createIssue = () => {
183
+ setCreating(true);
184
+ setCreationError(null);
185
+ void writeFirstIssue(repo, refName)
186
+ .catch((error: unknown) => {
187
+ setCreationError(
188
+ error instanceof Error ? error.message : "The editor could not open",
189
+ );
190
+ })
191
+ .finally(() => {
192
+ setCreating(false);
193
+ void client.invalidateQueries({
194
+ queryKey: ["blob", repo, refName, firstIssuePath],
195
+ });
196
+ void files.refetch();
197
+ });
198
+ };
199
+ const pendingNotice = pending ? (
200
+ <div className="flex flex-wrap items-center gap-2 mb-4">
201
+ <Status
202
+ glyph="dot"
203
+ tone={pending.state === "pending" ? "info" : "warning"}
204
+ label={
205
+ pending.state === "pending"
206
+ ? "Saved · syncing"
207
+ : pending.state === "conflict"
208
+ ? "Saved · sync conflict"
209
+ : "Saved · sync failed"
210
+ }
211
+ />
212
+ {editor.data ? (
213
+ <Button size="sm" variant="outline" onClick={openEditor}>
214
+ Open saved issue in {editor.data.displayName ?? "editor"}
215
+ </Button>
216
+ ) : null}
217
+ {creationError ? (
218
+ <FailureLine
219
+ message={creationError}
220
+ onRetry={openEditor}
221
+ onDismiss={() => {
222
+ setCreationError(null);
223
+ }}
224
+ />
225
+ ) : null}
226
+ </div>
227
+ ) : null;
154
228
  if (files.isPending) return <Loading label="Loading issues" />;
155
229
  if (files.isError)
156
230
  return (
@@ -161,41 +235,44 @@ export function IssuesPanel({
161
235
  }}
162
236
  />
163
237
  );
164
- if (report === null || Object.keys(files.data.files).length === 0)
238
+ if (first.isError)
239
+ return <Failure error={first.error} retry={() => void first.refetch()} />;
240
+ if (first.isPending) return <Loading label="Checking saved issues" />;
241
+ if (Object.keys(visibleFiles).length === 0)
165
242
  return (
166
- <div>
243
+ <div className="mx-auto w-full max-w-[26rem]">
167
244
  <EmptyState
168
245
  variant="panel"
246
+ visual={<FileText aria-hidden="true" />}
169
247
  headingLevel={3}
170
248
  title="No issues yet"
171
- description="Issues are Markdown files in your repo. Write the first one."
172
- primaryAction={{
173
- label: "Write the first issue",
174
- pending: creating,
175
- onSelect: () => {
176
- setCreating(true);
177
- setCreationError(null);
178
- void writeFirstIssue(repo, refName)
179
- .catch((error: unknown) => {
180
- setCreationError(
181
- error instanceof Error
182
- ? error.message
183
- : "The editor could not open",
184
- );
185
- })
186
- .finally(() => {
187
- setCreating(false);
188
- });
189
- },
190
- }}
249
+ description="Track changes in Markdown files."
250
+ {...(editor.data
251
+ ? {
252
+ primaryAction: {
253
+ label: "Write the first issue",
254
+ pending: creating,
255
+ onSelect: createIssue,
256
+ },
257
+ }
258
+ : {})}
191
259
  />
192
- {creationError === null ? null : <p role="alert">{creationError}</p>}
260
+ {creationError === null ? null : (
261
+ <FailureLine
262
+ message={creationError}
263
+ onRetry={createIssue}
264
+ onDismiss={() => {
265
+ setCreationError(null);
266
+ }}
267
+ />
268
+ )}
193
269
  </div>
194
270
  );
195
- const opened = open === null ? undefined : files.data.files[open];
271
+ const opened = open === null ? undefined : visibleFiles[open];
196
272
  if (open !== null && opened !== undefined)
197
273
  return (
198
274
  <div className="bonsai-issue">
275
+ {pendingNotice}
199
276
  <nav className="bonsai-crumbs" aria-label="Issue">
200
277
  <Link
201
278
  to={href({
@@ -230,101 +307,104 @@ export function IssuesPanel({
230
307
  { title: "Done", records: report.records.filter(done) },
231
308
  ];
232
309
  return (
233
- <BonsaiBoard
234
- rowHeight={0}
235
- placements={[
236
- { id: "issues", col: 0, row: 0, w: 3, h: 1 },
237
- { id: "issue-help", col: 3, row: 0, w: 1, h: 1 },
238
- ]}
239
- phoneOrder={["issues", "issue-help"]}
240
- tiles={[
241
- {
242
- id: "issues",
243
- title: "Issues",
244
- autoHeight: true,
245
- body: (
246
- <div className="space-y-4">
247
- {report.status === "fail" ? (
248
- <section
249
- className="caps-card caps-card-surface p-4 bonsai-issue-problems"
250
- aria-labelledby="issue-problems"
251
- >
252
- <header className="bonsai-section-head">
253
- <CardTitle level={2} id="issue-problems">
254
- Issue files need fixing
255
- </CardTitle>
256
- <Badge size="sm" tone="error" variant="quiet">
257
- {report.diagnostics.length}
258
- </Badge>
259
- </header>
260
- <ul>
261
- {report.diagnostics
262
- .slice(0, 12)
263
- .map((diagnostic, index) => (
264
- <li key={`${diagnostic.path}:${String(index)}`}>
265
- <code>{diagnostic.path}</code>{" "}
266
- <span className="text-sm text-[var(--stipe-fg-muted)] bonsai-muted">
267
- {diagnostic.detail}
268
- </span>
269
- </li>
270
- ))}
271
- </ul>
272
- </section>
273
- ) : null}
274
- {report.records.length === 0 ? (
275
- <DataList className="bonsai-change-list" density="compact">
276
- {Object.keys(files.data.files).map((path) => (
277
- <DataRow key={path}>
278
- <Link
279
- to={href({
280
- page: "repo",
281
- repo,
282
- tab: "issues",
283
- ref: refName,
284
- path: "",
285
- file: path,
286
- })}
287
- >
288
- {path}
289
- </Link>
290
- </DataRow>
291
- ))}
292
- </DataList>
293
- ) : null}
294
- {groups
295
- .filter((group) => group.records.length > 0)
296
- .map((group) => (
297
- <section key={group.title}>
298
- <DataListHeading level={3}>{group.title}</DataListHeading>
299
- <DataList>
300
- {group.records.map((issue) => (
301
- <IssueRow
302
- key={issue.id}
303
- repo={repo}
304
- refName={refName}
305
- issue={issue}
306
- records={report.records}
307
- />
308
- ))}
309
- </DataList>
310
+ <>
311
+ {pendingNotice}
312
+ <BonsaiBoard
313
+ rowHeight={0}
314
+ placements={[
315
+ { id: "issues", col: 0, row: 0, w: 3, h: 1 },
316
+ { id: "issue-help", col: 3, row: 0, w: 1, h: 1 },
317
+ ]}
318
+ phoneOrder={["issues", "issue-help"]}
319
+ tiles={[
320
+ {
321
+ id: "issues",
322
+ title: "Issues",
323
+ autoHeight: true,
324
+ body: (
325
+ <div className="space-y-4">
326
+ {report.status === "fail" ? (
327
+ <section
328
+ className="caps-card caps-card-surface p-4 bonsai-issue-problems"
329
+ aria-labelledby="issue-problems"
330
+ >
331
+ <header className="bonsai-section-head">
332
+ <CardTitle level={2} id="issue-problems">
333
+ Issue files need fixing
334
+ </CardTitle>
335
+ <Badge size="sm" tone="error" variant="quiet">
336
+ {report.diagnostics.length}
337
+ </Badge>
338
+ </header>
339
+ <ul>
340
+ {report.diagnostics
341
+ .slice(0, 12)
342
+ .map((diagnostic, index) => (
343
+ <li key={`${diagnostic.path}:${String(index)}`}>
344
+ <code>{diagnostic.path}</code>{" "}
345
+ <span className="text-sm text-[var(--stipe-fg-muted)] bonsai-muted">
346
+ {diagnostic.detail}
347
+ </span>
348
+ </li>
349
+ ))}
350
+ </ul>
310
351
  </section>
311
- ))}
312
- </div>
313
- ),
314
- },
315
- {
316
- id: "issue-help",
317
- title: "How issues work",
318
- autoHeight: true,
319
- body: (
320
- <p>
321
- Issues are Markdown files under <code>issues/</code>. Agents and
322
- people edit them with git. Dependencies link each issue to the
323
- work that must finish first.
324
- </p>
325
- ),
326
- },
327
- ]}
328
- />
352
+ ) : null}
353
+ {report.records.length === 0 ? (
354
+ <DataList className="bonsai-change-list" density="compact">
355
+ {Object.keys(visibleFiles).map((path) => (
356
+ <DataRow key={path}>
357
+ <Link
358
+ to={href({
359
+ page: "repo",
360
+ repo,
361
+ tab: "issues",
362
+ ref: refName,
363
+ path: "",
364
+ file: path,
365
+ })}
366
+ >
367
+ {path}
368
+ </Link>
369
+ </DataRow>
370
+ ))}
371
+ </DataList>
372
+ ) : null}
373
+ {groups
374
+ .filter((group) => group.records.length > 0)
375
+ .map((group) => (
376
+ <section key={group.title}>
377
+ <DataListHeading level={3}>{group.title}</DataListHeading>
378
+ <DataList>
379
+ {group.records.map((issue) => (
380
+ <IssueRow
381
+ key={issue.id}
382
+ repo={repo}
383
+ refName={refName}
384
+ issue={issue}
385
+ records={report.records}
386
+ />
387
+ ))}
388
+ </DataList>
389
+ </section>
390
+ ))}
391
+ </div>
392
+ ),
393
+ },
394
+ {
395
+ id: "issue-help",
396
+ title: "How issues work",
397
+ autoHeight: true,
398
+ body: (
399
+ <p>
400
+ Issues are Markdown files under <code>issues/</code>. Agents and
401
+ people edit them with git. Dependencies link each issue to the
402
+ work that must finish first.
403
+ </p>
404
+ ),
405
+ },
406
+ ]}
407
+ />
408
+ </>
329
409
  );
330
410
  }
@@ -424,6 +424,7 @@ export function NetworkGraph({
424
424
  <div className="bonsai-network">
425
425
  <div className="bonsai-network-tools" role="group" aria-label="Zoom">
426
426
  <IconButton
427
+ size="responsive"
427
428
  aria-label="Zoom out"
428
429
  icon={<ZoomOut />}
429
430
  disabled={step <= MIN_STEP}
@@ -432,6 +433,7 @@ export function NetworkGraph({
432
433
  }}
433
434
  />
434
435
  <IconButton
436
+ size="responsive"
435
437
  aria-label="Fit history"
436
438
  icon={<Maximize2 />}
437
439
  active={zoom === 1}
@@ -440,6 +442,7 @@ export function NetworkGraph({
440
442
  }}
441
443
  />
442
444
  <IconButton
445
+ size="responsive"
443
446
  aria-label="Zoom in"
444
447
  icon={<ZoomIn />}
445
448
  disabled={zoom >= 4}
@@ -464,7 +467,7 @@ export function NetworkGraph({
464
467
  <Button
465
468
  variant="ghost"
466
469
  size="xs"
467
- className="h-auto min-w-max py-1"
470
+ className="h-auto min-w-max py-1 max-sm:min-h-[var(--caps-touch-target)]"
468
471
  onClick={() => {
469
472
  onLaneSelect(lane);
470
473
  }}
package/web/overview.tsx CHANGED
@@ -153,8 +153,8 @@ export function Overview({
153
153
  }}
154
154
  />
155
155
  <p className="text-xs text-[var(--stipe-fg-muted)]">
156
- Branches and forks · hollow nodes are merges · select a lane for its
157
- change, or a commit to read it
156
+ Each line is a working copy; each dot is a saved change. Select one to
157
+ see its history.
158
158
  </p>
159
159
  </>
160
160
  ),
@@ -250,8 +250,14 @@ export function Overview({
250
250
  <EmptyState
251
251
  variant="quiet"
252
252
  headingLevel={3}
253
- title="Nothing next"
254
- description="No open issues are waiting on anyone."
253
+ title="Plan your next change"
254
+ description="Write an issue to describe what you want to do next."
255
+ primaryAction={{
256
+ label: "Open Issues",
257
+ onSelect: () => {
258
+ go(repoLink("issues"));
259
+ },
260
+ }}
255
261
  />,
256
262
  );
257
263
  if (files.isError)
@@ -328,7 +334,7 @@ export function Overview({
328
334
  repo={route.repo}
329
335
  definitions={tiles}
330
336
  controlsTarget={controlsTarget}
331
- compactHero={(graph.data?.nodes.length ?? Infinity) <= 3}
337
+ compactHero={(graph.data?.nodes.length ?? 0) <= 3}
332
338
  />
333
339
  );
334
340
  }
package/web/pages.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ import { EmptyState } from "@fungi.computer/caps/blocks/empty-state";
1
2
  import { CodeTab } from "./code-tab.js";
2
3
  import {
3
4
  Tabs,
@@ -27,7 +28,7 @@ import {
27
28
  type LiveState,
28
29
  } from "./api.js";
29
30
  import { DiffView } from "./views.js";
30
- import { relativeTime, shortHash } from "./format.js";
31
+ import { actorLabel, relativeTime, shortHash } from "./format.js";
31
32
  import { CommitTree } from "./commit-tree.js";
32
33
  import {
33
34
  AgentMark,
@@ -48,6 +49,7 @@ function useColors(): AgentColors {
48
49
  export type RepoRoute = Extract<Route, { page: "repo" }>;
49
50
 
50
51
  function ChangesTab({ repo, colors }: { repo: string; colors: AgentColors }) {
52
+ const { go } = useRouter();
51
53
  const changes = useChanges(repo);
52
54
  if (changes.isPending) return <Loading label="Loading changes" />;
53
55
  if (changes.isError)
@@ -59,7 +61,29 @@ function ChangesTab({ repo, colors }: { repo: string; colors: AgentColors }) {
59
61
  }}
60
62
  />
61
63
  );
62
- if (changes.data.changes.length === 0) return null;
64
+ if (changes.data.changes.length === 0)
65
+ return (
66
+ <EmptyState
67
+ variant="plain"
68
+ title="Review changes here"
69
+ description="Changes from separate working copies appear here, ready for you to review and combine."
70
+ primaryAction={{
71
+ label: "Open Code",
72
+ onSelect: () => {
73
+ go(
74
+ href({
75
+ page: "repo",
76
+ repo,
77
+ tab: "code",
78
+ ref: null,
79
+ path: "",
80
+ file: null,
81
+ }),
82
+ );
83
+ },
84
+ }}
85
+ />
86
+ );
63
87
  return (
64
88
  <Card variant="outline" density="compact" data-tile="changes">
65
89
  <div className="min-w-0 p-3">
@@ -203,9 +227,21 @@ function CommitsTab({
203
227
  <div className="min-w-0 p-3">
204
228
  <Tabs value={filter} onValueChange={setFilter}>
205
229
  <TabsList variant="segmented" aria-label="Commit authors">
206
- <TabsTrigger value="all">All</TabsTrigger>
207
- <TabsTrigger value="agent">Agents</TabsTrigger>
208
- <TabsTrigger value="human">People</TabsTrigger>
230
+ <TabsTrigger value="all">
231
+ <span className="inline-flex items-center max-sm:min-h-[var(--caps-touch-target)]">
232
+ All
233
+ </span>
234
+ </TabsTrigger>
235
+ <TabsTrigger value="agent">
236
+ <span className="inline-flex items-center max-sm:min-h-[var(--caps-touch-target)]">
237
+ Agents
238
+ </span>
239
+ </TabsTrigger>
240
+ <TabsTrigger value="human">
241
+ <span className="inline-flex items-center max-sm:min-h-[var(--caps-touch-target)]">
242
+ People
243
+ </span>
244
+ </TabsTrigger>
209
245
  </TabsList>
210
246
  <TabsContent value={filter}>
211
247
  <p
@@ -217,12 +253,26 @@ function CommitsTab({
217
253
  : `${route.repo}/${selectedRef}`}{" "}
218
254
  · newest first
219
255
  </p>
220
- <CommitTree
221
- graph={shown}
222
- colors={colors}
223
- selected={current?.hash}
224
- onSelect={open}
225
- />
256
+ {nodes.length === 0 ? (
257
+ <EmptyState
258
+ variant="quiet"
259
+ title="No matching changes"
260
+ description="This author filter has no saved changes yet."
261
+ primaryAction={{
262
+ label: "Show all history",
263
+ onSelect: () => {
264
+ setFilter("all");
265
+ },
266
+ }}
267
+ />
268
+ ) : (
269
+ <CommitTree
270
+ graph={shown}
271
+ colors={colors}
272
+ selected={current?.hash}
273
+ onSelect={open}
274
+ />
275
+ )}
226
276
  </TabsContent>
227
277
  </Tabs>
228
278
  </div>
@@ -410,7 +460,7 @@ export function CommitPage({ repo, hash }: { repo: string; hash: string }) {
410
460
  {agent ? (
411
461
  <AgentName name={agent} colors={colors} />
412
462
  ) : (
413
- commit.author.name
463
+ actorLabel(commit.author.name)
414
464
  )}
415
465
  <span className="text-sm text-[var(--stipe-fg-muted)] bonsai-muted">
416
466
  {" "}