Merge branch 't3/notebook-management-authoring'

# Conflicts:
#	.agents/mind/architecture.md
#	packages/core/src/protocol.ts
This commit is contained in:
Florian Schmidt
2026-11-16 10:19:57 +01:00
22 changed files with 1339 additions and 22 deletions
+31 -15
View File
@@ -28,6 +28,7 @@ import type {
StartRunRequest,
Step,
} from "@shellbook/core";
import { NotebookList } from "./NotebookList";
import { HttpError } from "./api";
import type { Api } from "./api";
import { emptySession, eventReducer, stepKey } from "./events";
@@ -129,6 +130,14 @@ export function App({ api }: { api: Api }) {
.catch((e) => setError(String(e)));
const close = api.events((event: ServerEvent) => {
const open = current.current;
if (event.type === "file.changed" || event.type === "file.deleted") {
void api
.list()
.then((result) => {
if (active) setList(result.notebooks);
})
.catch((e) => setError(String(e)));
}
if (event.type === "file.changed" && event.path === open.doc?.path) {
if (open.dirty) setConflict(true);
else void load(event.path);
@@ -334,21 +343,28 @@ export function App({ api }: { api: Api }) {
<h1>
ShellBook<span>RUNBOOKS</span>
</h1>
<nav aria-label="Notebooks">
{list.map((item) => (
<button
className={path === item.path ? "selected" : ""}
key={item.path}
onClick={() => {
if (!dirty || window.confirm("Discard unsaved edits?"))
void load(item.path);
}}
>
{item.title}
<small>{item.path}</small>
</button>
))}
</nav>
<NotebookList
api={api}
list={list}
path={path}
version={doc?.version}
canLeave={() => !dirty || window.confirm("Discard unsaved edits?")}
onSelect={(next) => {
if (!dirty || window.confirm("Discard unsaved edits?"))
void load(next);
}}
onChanged={async (next) => {
const result = await api.list();
setList(result.notebooks);
if (next) await load(next);
else {
++loadSequence.current;
setDoc(undefined);
setSource("");
setConflict(false);
}
}}
/>
<small className="connection">
{import.meta.env.VITE_MOCK === "1" ? "DEMO · " : ""}
{connected