feat(notebooks): manage and author notebooks in the web UI (#9)
Add atomic, versioned notebook mutations, a searchable folder tree, and editor insertion forms. Validate notebook paths and symlink roots and retain drafts after external changes. Add yaml as a direct web dependency, reusing the existing workspace library for comment-preserving frontmatter edits.
This commit is contained in:
@@ -30,6 +30,17 @@ async function json<T>(
|
||||
: (response.json() as Promise<T>);
|
||||
}
|
||||
export interface Api {
|
||||
create(
|
||||
path: string,
|
||||
source: string,
|
||||
): Promise<{ path: string; version: string }>;
|
||||
move(
|
||||
path: string,
|
||||
target: string,
|
||||
baseVersion: string,
|
||||
duplicate?: boolean,
|
||||
): Promise<{ path: string; version: string }>;
|
||||
deleteNotebook(path: string, baseVersion: string): Promise<unknown>;
|
||||
me(): Promise<unknown>;
|
||||
login(password: string): Promise<unknown>;
|
||||
list(): Promise<NotebookListResponse>;
|
||||
@@ -48,6 +59,15 @@ export interface Api {
|
||||
artifact(runId: string, name: string): string;
|
||||
}
|
||||
export const liveApi: Api = {
|
||||
create: (path, source) => json("/notebooks", "POST", { path, source }),
|
||||
move: (path, target, baseVersion, duplicate = false) =>
|
||||
json(
|
||||
`/notebooks/${encodeURIComponent(path)}/${duplicate ? "duplicate" : "rename"}`,
|
||||
"POST",
|
||||
{ path: target, baseVersion },
|
||||
),
|
||||
deleteNotebook: (path, baseVersion) =>
|
||||
json(`/notebooks/${encodeURIComponent(path)}`, "DELETE", { baseVersion }),
|
||||
me: () => json("/auth/me"),
|
||||
login: (password) => json("/auth/login", "POST", { password }),
|
||||
list: () => json("/notebooks"),
|
||||
|
||||
Reference in New Issue
Block a user