@netnodeag/kraftwerk 0.81.0 → 0.83.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.
Files changed (104) hide show
  1. package/README.md +227 -0
  2. package/dist/cli/boards.d.ts +2 -0
  3. package/dist/cli/boards.js +486 -0
  4. package/dist/cli/init.js +2 -0
  5. package/dist/cli/kraftwerk.js +6 -0
  6. package/dist/cli/presentations.d.ts +2 -0
  7. package/dist/cli/presentations.js +261 -0
  8. package/dist/client/routes.d.ts +32 -0
  9. package/dist/client/routes.js +32 -0
  10. package/dist/config.d.ts +35 -0
  11. package/dist/config.js +33 -2
  12. package/dist/core/attention.d.ts +2 -2
  13. package/dist/core/attention.js +22 -2
  14. package/dist/core/board-wake.d.ts +21 -0
  15. package/dist/core/board-wake.js +221 -0
  16. package/dist/core/boards.d.ts +269 -0
  17. package/dist/core/boards.js +969 -0
  18. package/dist/core/chat/acp.d.ts +1 -1
  19. package/dist/core/chat/acp.js +2 -1
  20. package/dist/core/chat/backend.d.ts +11 -0
  21. package/dist/core/chat/backend.js +9 -1
  22. package/dist/core/chat/context.js +25 -4
  23. package/dist/core/chat/pi.d.ts +1 -1
  24. package/dist/core/chat/pi.js +2 -1
  25. package/dist/core/chat/seats.js +3 -2
  26. package/dist/core/chat/sessions.d.ts +2 -0
  27. package/dist/core/chat/sessions.js +1 -0
  28. package/dist/core/chat/state.js +1 -1
  29. package/dist/core/chat/types.d.ts +11 -1
  30. package/dist/core/files.d.ts +1 -1
  31. package/dist/core/files.js +19 -1
  32. package/dist/core/git.js +5 -1
  33. package/dist/core/notifications.d.ts +1 -1
  34. package/dist/core/presentations/browser.d.ts +43 -0
  35. package/dist/core/presentations/browser.js +53 -0
  36. package/dist/core/presentations/builtin.d.ts +3 -0
  37. package/dist/core/presentations/builtin.js +142 -0
  38. package/dist/core/presentations/chart.d.ts +34 -0
  39. package/dist/core/presentations/chart.js +159 -0
  40. package/dist/core/presentations/deck.d.ts +63 -0
  41. package/dist/core/presentations/deck.js +198 -0
  42. package/dist/core/presentations/export.d.ts +21 -0
  43. package/dist/core/presentations/export.js +75 -0
  44. package/dist/core/presentations/html.d.ts +135 -0
  45. package/dist/core/presentations/html.js +389 -0
  46. package/dist/core/presentations/index.d.ts +252 -0
  47. package/dist/core/presentations/index.js +753 -0
  48. package/dist/core/presentations/layout.d.ts +47 -0
  49. package/dist/core/presentations/layout.js +147 -0
  50. package/dist/core/presentations/markdown.d.ts +49 -0
  51. package/dist/core/presentations/markdown.js +158 -0
  52. package/dist/core/presentations/merge.d.ts +26 -0
  53. package/dist/core/presentations/merge.js +28 -0
  54. package/dist/core/presentations/presence.d.ts +31 -0
  55. package/dist/core/presentations/presence.js +131 -0
  56. package/dist/core/presentations/render.d.ts +33 -0
  57. package/dist/core/presentations/render.js +318 -0
  58. package/dist/core/presentations/slots.d.ts +33 -0
  59. package/dist/core/presentations/slots.js +114 -0
  60. package/dist/core/presentations/template.d.ts +253 -0
  61. package/dist/core/presentations/template.js +141 -0
  62. package/dist/core/presentations/versions.d.ts +30 -0
  63. package/dist/core/presentations/versions.js +75 -0
  64. package/dist/core/refs.d.ts +1 -1
  65. package/dist/core/refs.js +33 -1
  66. package/dist/core/search.d.ts +22 -0
  67. package/dist/core/search.js +25 -0
  68. package/dist/core/settings.d.ts +4 -0
  69. package/dist/core/settings.js +24 -1
  70. package/dist/core/trash.d.ts +1 -1
  71. package/dist/server/api/boards.d.ts +105 -0
  72. package/dist/server/api/boards.js +160 -0
  73. package/dist/server/api/chats.d.ts +2 -0
  74. package/dist/server/api/chats.js +9 -3
  75. package/dist/server/api/index.d.ts +167 -3
  76. package/dist/server/api/index.js +4 -0
  77. package/dist/server/api/presentations.d.ts +66 -0
  78. package/dist/server/api/presentations.js +185 -0
  79. package/dist/server/api/socket.js +24 -1
  80. package/dist/server/api/workspace.d.ts +10 -0
  81. package/dist/server/api/workspace.js +4 -0
  82. package/dist/server/push.js +1 -1
  83. package/dist/server/server.js +3 -0
  84. package/package.json +6 -2
  85. package/schema/kraftwerk.schema.json +57 -0
  86. package/web/dist/assets/{dist-Ba6WSVOB.js → dist-5-ibIscm.js} +1 -1
  87. package/web/dist/assets/{dist-ENZYo2jZ.js → dist-5lgY5B-M.js} +1 -1
  88. package/web/dist/assets/{dist-BiU4F98O.js → dist-BJaPgnhj.js} +1 -1
  89. package/web/dist/assets/{dist-Dy1SvhKC.js → dist-Bar1_NBq.js} +1 -1
  90. package/web/dist/assets/{dist-AhnSw4hy.js → dist-BxCxboU8.js} +1 -1
  91. package/web/dist/assets/dist-CDitSY16.js +1 -0
  92. package/web/dist/assets/{dist-FfKYtQxT.js → dist-CRXT8IL6.js} +1 -1
  93. package/web/dist/assets/{dist-BK0VhAPQ.js → dist-CXRjiHpl.js} +1 -1
  94. package/web/dist/assets/{dist-Dx3aajX1.js → dist-CpnB7MfK.js} +1 -1
  95. package/web/dist/assets/{dist-8IOFzZx-.js → dist-D1VK1YdB.js} +1 -1
  96. package/web/dist/assets/{dist-cewmjxFi.js → dist-D52LvyO8.js} +1 -1
  97. package/web/dist/assets/{editor-CZMrhTTL.css → editor-C0_Snnzk.css} +1 -1
  98. package/web/dist/assets/{editor-CaRa1NMC.js → editor-HCNTXWWs.js} +3 -3
  99. package/web/dist/assets/index-Dnlu16AL.css +2 -0
  100. package/web/dist/assets/index-kwWnQOhD.js +473 -0
  101. package/web/dist/index.html +2 -2
  102. package/web/dist/assets/dist-lgUK2Fjt.js +0 -1
  103. package/web/dist/assets/index-Dpzux3OC.js +0 -231
  104. package/web/dist/assets/index-Dvt-vE1h.css +0 -2
@@ -1,7 +1,9 @@
1
1
  import { promises as fs } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { parseDocument } from "yaml";
4
- import { ENTITY_KINDS, entityDefaultRoot, ignoreEntryFor, PROJECTS_DEFAULT_ROOT, REPOS_DEFAULT_ROOT, resolveWorkspace, VIBEABLES_DEFAULT_ROOT, isSafeGitName } from "../config.js";
4
+ import { BOARDS_DEFAULT_ROOT, PRESENTATIONS_DEFAULT_ROOT, ENTITY_KINDS, entityDefaultRoot, ignoreEntryFor, PROJECTS_DEFAULT_ROOT, REPOS_DEFAULT_ROOT, resolveWorkspace, VIBEABLES_DEFAULT_ROOT, isSafeGitName } from "../config.js";
5
+ import { ensureBoardsRoot } from "./boards.js";
6
+ import { ensurePresentationsRoot } from "./presentations/index.js";
5
7
  import { ensureEntitiesRoot } from "./entities.js";
6
8
  import { ensureProjectsRoot } from "./projects.js";
7
9
  import { disposeAllDevs, ensureVibeablesRoot } from "./vibeables.js";
@@ -84,6 +86,8 @@ const ROOT_DEFAULTS = {
84
86
  contacts: entityDefaultRoot("contacts"),
85
87
  places: entityDefaultRoot("places"),
86
88
  events: entityDefaultRoot("events"),
89
+ boards: BOARDS_DEFAULT_ROOT,
90
+ presentations: PRESENTATIONS_DEFAULT_ROOT,
87
91
  };
88
92
  /** The repos, vibeables, projects, contacts, places or events block to write; null when the feature is off and nothing else is set. */
89
93
  function cleanRootBlock(block, value, projectRoot) {
@@ -181,6 +185,21 @@ export async function saveSettings(input) {
181
185
  else
182
186
  doc.set(kind, block);
183
187
  }
188
+ if (input.boards !== undefined) {
189
+ const block = cleanRootBlock("boards", input.boards, project.root);
190
+ const columns = project.config.boards?.columns;
191
+ if (block === null && !columns)
192
+ doc.delete("boards");
193
+ else
194
+ doc.set("boards", { ...(block ?? { enabled: false }), ...(columns ? { columns } : {}) });
195
+ }
196
+ if (input.presentations !== undefined) {
197
+ const block = cleanRootBlock("presentations", input.presentations, project.root);
198
+ if (block === null)
199
+ doc.delete("presentations");
200
+ else
201
+ doc.set("presentations", block);
202
+ }
184
203
  await fs.writeFile(configPath, doc.toString());
185
204
  // Turning repositories on prepares the folder so the first clone and the
186
205
  // workspace git both find it in the right state.
@@ -193,5 +212,9 @@ export async function saveSettings(input) {
193
212
  for (const kind of ENTITY_KINDS)
194
213
  if (input[kind]?.enabled)
195
214
  await ensureEntitiesRoot(kind).catch(() => { });
215
+ if (input.boards?.enabled)
216
+ await ensureBoardsRoot().catch(() => { });
217
+ if (input.presentations?.enabled)
218
+ await ensurePresentationsRoot().catch(() => { });
196
219
  return getSettings();
197
220
  }
@@ -8,7 +8,7 @@
8
8
  */
9
9
  export declare const TRASH_DIR = "kraftwerk-data/trash";
10
10
  /** What can be in the trash; also the folder under trash/ it lands in. */
11
- export type TrashKind = "agents" | "agent-skills" | "projects" | "contacts" | "places" | "events" | "workflows" | "knowledge" | "vibeables" | "channels" | "repos" | "chats" | "runs" | "files";
11
+ export type TrashKind = "agents" | "agent-skills" | "projects" | "boards" | "tasks" | "presentations" | "contacts" | "places" | "events" | "workflows" | "knowledge" | "vibeables" | "channels" | "repos" | "chats" | "runs" | "files";
12
12
  export interface TrashEntry {
13
13
  /** Path inside the trash, forward slashes — the entry's handle. */
14
14
  id: string;
@@ -0,0 +1,105 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Boards and tasks over the API. A board is addressed by its slug and, for
4
+ * a project's board, `?project=<slug>`; a task by its folder name or its
5
+ * bare number. Writes that change a task's column or assignee are logged
6
+ * on the task and may wake the assignee (core/board-wake.ts).
7
+ */
8
+ export declare const boardErrors: (message: string) => number;
9
+ export declare const boardRoutes: (import("./router.js").Route<"boards.create", import("./router.js").Reply<import("../../core/boards.js").BoardDetail>, "/api/boards", z.ZodObject<{
10
+ title: z.ZodString;
11
+ slug: z.ZodOptional<z.ZodString>;
12
+ project: z.ZodOptional<z.ZodString>;
13
+ columns: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
14
+ slug: z.ZodString;
15
+ label: z.ZodOptional<z.ZodString>;
16
+ limit: z.ZodOptional<z.ZodNumber>;
17
+ done: z.ZodOptional<z.ZodBoolean>;
18
+ review: z.ZodOptional<z.ZodBoolean>;
19
+ }, z.core.$strip>]>>>;
20
+ agent: z.ZodOptional<z.ZodString>;
21
+ notes: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strip>> | import("./router.js").Route<"boards.delete", {
23
+ ok: boolean;
24
+ }, "/api/boards/:board", undefined> | import("./router.js").Route<"boards.ensure", import("../../core/boards.js").BoardDetail, "/api/boards/default", z.ZodObject<{
25
+ project: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>> | import("./router.js").Route<"boards.get", import("../../core/boards.js").BoardDetail, "/api/boards/:board", undefined> | import("./router.js").Route<"boards.list", import("../../core/boards.js").BoardsView, "/api/boards", undefined> | import("./router.js").Route<"boards.save", import("../../core/boards.js").BoardDetail, "/api/boards/:board", z.ZodObject<{
27
+ title: z.ZodOptional<z.ZodString>;
28
+ columns: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
29
+ slug: z.ZodString;
30
+ label: z.ZodOptional<z.ZodString>;
31
+ limit: z.ZodOptional<z.ZodNumber>;
32
+ done: z.ZodOptional<z.ZodBoolean>;
33
+ review: z.ZodOptional<z.ZodBoolean>;
34
+ }, z.core.$strip>]>>>;
35
+ agent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ staleAfter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ notes: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>> | import("./router.js").Route<"tasks.assign", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task/assign", z.ZodObject<{
39
+ to: z.ZodNullable<z.ZodString>;
40
+ message: z.ZodOptional<z.ZodString>;
41
+ actor: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strip>> | import("./router.js").Route<"tasks.create", import("./router.js").Reply<import("../../core/boards.js").TaskDetail>, "/api/boards/:board/tasks", z.ZodObject<{
43
+ status: z.ZodOptional<z.ZodString>;
44
+ order: z.ZodOptional<z.ZodNumber>;
45
+ assignee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ refs: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
+ notes: z.ZodOptional<z.ZodString>;
50
+ actor: z.ZodOptional<z.ZodString>;
51
+ message: z.ZodOptional<z.ZodString>;
52
+ title: z.ZodString;
53
+ }, z.core.$strip>> | import("./router.js").Route<"tasks.delete", {
54
+ ok: boolean;
55
+ }, "/api/boards/:board/tasks/:task", undefined> | import("./router.js").Route<"tasks.get", {
56
+ slug: string;
57
+ number: number;
58
+ title: string;
59
+ status: string;
60
+ order: number;
61
+ assignee?: string;
62
+ due?: string;
63
+ created: string;
64
+ tags: string[];
65
+ refs: string[];
66
+ extra?: Record<string, unknown>;
67
+ ref: string;
68
+ path: string;
69
+ updatedAt?: string;
70
+ configError?: string;
71
+ files: number;
72
+ lastLog?: string;
73
+ stale?: boolean;
74
+ notes: string;
75
+ log: string;
76
+ fileList: string[];
77
+ board: string;
78
+ project?: string;
79
+ sessions: import("../../core/board-wake.js").TaskSession[];
80
+ }, "/api/boards/:board/tasks/:task", undefined> | import("./router.js").Route<"tasks.log", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task/log", z.ZodObject<{
81
+ entry: z.ZodString;
82
+ actor: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strip>> | import("./router.js").Route<"tasks.move", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task/move", z.ZodObject<{
84
+ status: z.ZodString;
85
+ before: z.ZodOptional<z.ZodString>;
86
+ order: z.ZodOptional<z.ZodNumber>;
87
+ message: z.ZodOptional<z.ZodString>;
88
+ actor: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strip>> | import("./router.js").Route<"tasks.pick", {
90
+ task: import("../../core/boards.js").TaskDetail | null;
91
+ }, "/api/boards/:board/pick", z.ZodObject<{
92
+ agent: z.ZodString;
93
+ column: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$strip>> | import("./router.js").Route<"tasks.save", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task", z.ZodObject<{
95
+ title: z.ZodOptional<z.ZodString>;
96
+ status: z.ZodOptional<z.ZodString>;
97
+ order: z.ZodOptional<z.ZodNumber>;
98
+ assignee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
101
+ refs: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
+ notes: z.ZodOptional<z.ZodString>;
103
+ actor: z.ZodOptional<z.ZodString>;
104
+ message: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>>)[];
@@ -0,0 +1,160 @@
1
+ import * as z from "zod";
2
+ import { appendTaskLog, assignTask, createBoard, createTask, deleteBoard, deleteTask, ensureDefaultBoard, getBoard, getTask, listAllBoards, listBoards, moveTask, openBoards, pickTask, saveBoard, saveTask, } from "../../core/boards.js";
3
+ import { taskSessions } from "../../core/board-wake.js";
4
+ import { fail, reply, route, statusByMessage } from "./router.js";
5
+ /**
6
+ * Boards and tasks over the API. A board is addressed by its slug and, for
7
+ * a project's board, `?project=<slug>`; a task by its folder name or its
8
+ * bare number. Writes that change a task's column or assignee are logged
9
+ * on the task and may wake the assignee (core/board-wake.ts).
10
+ */
11
+ export const boardErrors = statusByMessage(/^no (board|task|project)/);
12
+ const Columns = z.array(z.union([z.string(), z.object({ slug: z.string(), label: z.string().optional(), limit: z.number().optional(), done: z.boolean().optional(), review: z.boolean().optional() })]));
13
+ const BoardFields = z.object({
14
+ title: z.string().optional(),
15
+ columns: Columns.optional(),
16
+ agent: z.string().nullable().optional(),
17
+ staleAfter: z.string().nullable().optional(),
18
+ notes: z.string().optional(),
19
+ });
20
+ const TaskFields = z.object({
21
+ title: z.string().optional(),
22
+ status: z.string().optional(),
23
+ order: z.number().optional(),
24
+ assignee: z.string().nullable().optional(),
25
+ due: z.string().nullable().optional(),
26
+ tags: z.array(z.string()).optional(),
27
+ refs: z.array(z.string()).optional(),
28
+ notes: z.string().optional(),
29
+ /** Who writes (human:user by default) and a line for the log. */
30
+ actor: z.string().optional(),
31
+ message: z.string().optional(),
32
+ });
33
+ const refOf = (c) => {
34
+ const project = c.query.get("project");
35
+ return { ...(project ? { project } : {}), board: c.params.board };
36
+ };
37
+ const requireOn = async () => {
38
+ if ((await openBoards()).off)
39
+ fail(409, "boards are off");
40
+ };
41
+ export const boardRoutes = [
42
+ route({ name: "boards.list", method: "GET", path: "/api/boards", summary: "the boards: a project's with ?project=, every board with ?all=1, else the workspace's" }, async (c) => {
43
+ if (c.query.get("all") === "1") {
44
+ const opened = await openBoards();
45
+ return { enabled: !opened.off && !!opened.root, ...(opened.root ? { root: opened.root } : {}), boards: await listAllBoards(), ...(opened.error ? { error: opened.error } : {}) };
46
+ }
47
+ return listBoards(c.query.get("project") ?? undefined);
48
+ }),
49
+ route({
50
+ name: "boards.create",
51
+ method: "POST",
52
+ path: "/api/boards",
53
+ summary: "create a board {title, slug?, project?, columns?, agent?, notes?}",
54
+ errors: boardErrors,
55
+ body: z.object({ title: z.string(), slug: z.string().optional(), project: z.string().optional(), columns: Columns.optional(), agent: z.string().optional(), notes: z.string().optional() }),
56
+ }, async (c) => {
57
+ await requireOn();
58
+ return reply(201, await createBoard(await c.body()));
59
+ }),
60
+ route({ name: "boards.get", method: "GET", path: "/api/boards/:board", summary: "columns, rules, counts and every task (?project=)", errors: boardErrors }, async (c) => {
61
+ await requireOn();
62
+ const ref = refOf(c);
63
+ return (await getBoard(ref)) ?? fail(404, `no board "${ref.board}"`);
64
+ }),
65
+ route({ name: "boards.save", method: "PUT", path: "/api/boards/:board", summary: "save title, columns, default agent, stale_after, rules", errors: boardErrors, body: BoardFields }, async (c) => {
66
+ await requireOn();
67
+ return saveBoard(refOf(c), (await c.body()));
68
+ }),
69
+ route({ name: "boards.delete", method: "DELETE", path: "/api/boards/:board", summary: "move the board, tasks and all, to the trash", errors: boardErrors }, async (c) => {
70
+ await requireOn();
71
+ await deleteBoard(refOf(c));
72
+ return { ok: true };
73
+ }),
74
+ route({
75
+ name: "boards.ensure",
76
+ method: "POST",
77
+ path: "/api/boards/default",
78
+ summary: "the project's (or workspace's) default board `tasks`, created on first use {project?}",
79
+ errors: boardErrors,
80
+ body: z.object({ project: z.string().optional() }),
81
+ }, async (c) => {
82
+ await requireOn();
83
+ const ref = await ensureDefaultBoard((await c.body()).project);
84
+ return (await getBoard(ref));
85
+ }),
86
+ route({
87
+ name: "tasks.create",
88
+ method: "POST",
89
+ path: "/api/boards/:board/tasks",
90
+ summary: "create a task {title, status?, assignee?, due?, tags?, refs?, notes?, actor?, message?} (an assigned agent in a work column is woken)",
91
+ errors: boardErrors,
92
+ body: TaskFields.extend({ title: z.string() }),
93
+ }, async (c) => {
94
+ await requireOn();
95
+ return reply(201, await createTask(refOf(c), (await c.body())));
96
+ }),
97
+ route({ name: "tasks.get", method: "GET", path: "/api/boards/:board/tasks/:task", summary: "the task: fields, markdown, files, log and the sessions that worked on it (:task = folder name or number)", errors: boardErrors }, async (c) => {
98
+ await requireOn();
99
+ const task = (await getTask(refOf(c), c.params.task)) ?? fail(404, `no task "${c.params.task}"`);
100
+ return { ...task, sessions: await taskSessions(task.ref) };
101
+ }),
102
+ route({ name: "tasks.save", method: "PUT", path: "/api/boards/:board/tasks/:task", summary: "save fields and markdown; a status or assignee change is logged (message?)", errors: boardErrors, body: TaskFields }, async (c) => {
103
+ await requireOn();
104
+ const { actor, message, ...fields } = await c.body();
105
+ return saveTask(refOf(c), c.params.task, fields, { actor, message });
106
+ }),
107
+ route({
108
+ name: "tasks.move",
109
+ method: "POST",
110
+ path: "/api/boards/:board/tasks/:task/move",
111
+ summary: "put the task into a column {status, before?, order?, message?, actor?}",
112
+ errors: boardErrors,
113
+ body: z.object({ status: z.string(), before: z.string().optional(), order: z.number().optional(), message: z.string().optional(), actor: z.string().optional() }),
114
+ }, async (c) => {
115
+ await requireOn();
116
+ const { status, ...opts } = await c.body();
117
+ return moveTask(refOf(c), c.params.task, status, opts);
118
+ }),
119
+ route({
120
+ name: "tasks.assign",
121
+ method: "POST",
122
+ path: "/api/boards/:board/tasks/:task/assign",
123
+ summary: 'give the task to an agent {to, message?, actor?}; to = null or "human" hands it back to the review column',
124
+ errors: boardErrors,
125
+ body: z.object({ to: z.string().nullable(), message: z.string().optional(), actor: z.string().optional() }),
126
+ }, async (c) => {
127
+ await requireOn();
128
+ const { to, ...opts } = await c.body();
129
+ return assignTask(refOf(c), c.params.task, to, opts);
130
+ }),
131
+ route({
132
+ name: "tasks.log",
133
+ method: "POST",
134
+ path: "/api/boards/:board/tasks/:task/log",
135
+ summary: "append a stamped line {entry, actor?} to the task's log",
136
+ errors: boardErrors,
137
+ body: z.object({ entry: z.string(), actor: z.string().optional() }),
138
+ }, async (c) => {
139
+ await requireOn();
140
+ const { entry, actor } = await c.body();
141
+ return appendTaskLog(refOf(c), c.params.task, entry, actor);
142
+ }),
143
+ route({
144
+ name: "tasks.pick",
145
+ method: "POST",
146
+ path: "/api/boards/:board/pick",
147
+ summary: "an agent takes the next task of the pick column {agent, column?}; null when there is none",
148
+ errors: boardErrors,
149
+ body: z.object({ agent: z.string(), column: z.string().optional() }),
150
+ }, async (c) => {
151
+ await requireOn();
152
+ const { agent, column } = await c.body();
153
+ return { task: await pickTask(refOf(c), agent, { column }) };
154
+ }),
155
+ route({ name: "tasks.delete", method: "DELETE", path: "/api/boards/:board/tasks/:task", summary: "move the task folder to the trash", errors: boardErrors }, async (c) => {
156
+ await requireOn();
157
+ await deleteTask(refOf(c), c.params.task);
158
+ return { ok: true };
159
+ }),
160
+ ];
@@ -31,9 +31,11 @@ export declare const chatRoutes: (import("./router.js").Route<"agents.sessions",
31
31
  runId: z.ZodOptional<z.ZodString>;
32
32
  bundle: z.ZodOptional<z.ZodString>;
33
33
  slug: z.ZodOptional<z.ZodString>;
34
+ task: z.ZodOptional<z.ZodString>;
34
35
  }, z.core.$strip>>;
35
36
  resume: z.ZodOptional<z.ZodString>;
36
37
  project: z.ZodOptional<z.ZodString>;
38
+ task: z.ZodOptional<z.ZodString>;
37
39
  }, z.core.$strip>> | import("./router.js").Route<"chats.delete", import("./router.js").Reply<{
38
40
  error?: string;
39
41
  }>, "/api/chats/:id", undefined> | import("./router.js").Route<"chats.elicitation", import("./router.js").Reply<{
@@ -5,6 +5,7 @@ import { getAgent } from "../../core/agents.js";
5
5
  import { answerElicitation, cancelChat, createChat, deleteChat, forkChat, getChat, listAgentSessionsFor, listChats, localPerson, postMessage, renameChat, resetSession, resolvePermission, setChatConfig, setChatProject, setChatVibeable, steerChat, stopChatTask, subscribeChat, } from "../../core/chat/sessions.js";
6
6
  import { attachmentPath, readMeta, saveAttachment } from "../../core/chat/store.js";
7
7
  import { remoteCaller } from "../trust.js";
8
+ import { findTask } from "../../core/boards.js";
8
9
  import { getProject } from "../../core/projects.js";
9
10
  import { MIME } from "./mime.js";
10
11
  import { projectErrors } from "./projects.js";
@@ -24,10 +25,12 @@ const Said = z.object({
24
25
  /** Where a new chat runs; unknown kinds fall back to a general chat. */
25
26
  const NewChat = z.object({
26
27
  agent: z.string().optional(),
27
- scope: z.object({ kind: z.string(), runId: z.string().optional(), bundle: z.string().optional(), slug: z.string().optional() }).optional(),
28
+ scope: z.object({ kind: z.string(), runId: z.string().optional(), bundle: z.string().optional(), slug: z.string().optional(), task: z.string().optional() }).optional(),
28
29
  resume: z.string().optional(),
29
30
  /** An agent's chat started in a project: listed with the project (meta.project). */
30
31
  project: z.string().optional(),
32
+ /** The board task the chat works on (<project>/<board>/<task> or <board>/<task>): listed on the task's page (meta.task). */
33
+ task: z.string().optional(),
31
34
  });
32
35
  /** An action on a running chat: `{ok}` when it went through, 409 with the reason when the chat refused. */
33
36
  const act = (name, path, summary, body, run) => route({ name, method: "POST", path, summary, errors: 400, body }, async (c) => {
@@ -47,7 +50,8 @@ async function scopeOf(body) {
47
50
  const def = await getAgent(s.slug).catch(() => null);
48
51
  if (!def)
49
52
  fail(404, "agent not found");
50
- return { agent: def.harness, scope: { kind: "agent", slug: def.slug } };
53
+ // `task`: the session is opened for a board task (<project>/<board>/<task>): its context carries the task, and it runs unattended like a routine's.
54
+ return { agent: def.harness, scope: { kind: "agent", slug: def.slug, ...(s.task ? { task: s.task } : {}) } };
51
55
  }
52
56
  if (s?.kind === "project" && s.slug) {
53
57
  // A project chat needs its folder; a missing one is a 404 here, not a chat that apologizes.
@@ -109,7 +113,7 @@ export const chatRoutes = [
109
113
  const chats = await listChats();
110
114
  return { chats: remoteCaller(c.trust) ? chats.filter((x) => !x.private) : chats };
111
115
  }),
112
- route({ name: "chats.create", method: "POST", path: "/api/chats", summary: "start a chat {agent, scope, resume?, project?}", body: NewChat }, async (c) => {
116
+ route({ name: "chats.create", method: "POST", path: "/api/chats", summary: "start a chat {agent, scope, resume?, project?, task?}", errors: 404, body: NewChat }, async (c) => {
113
117
  // `resume` continues one of the agent's own sessions (see agents.sessions).
114
118
  const body = await c.body();
115
119
  const { agent, scope } = await scopeOf(body);
@@ -118,12 +122,14 @@ export const chatRoutes = [
118
122
  if (body.project && scope.kind !== "agent")
119
123
  fail(400, "only an agent's chat takes a project");
120
124
  const project = body.project ? await projectSlug(body.project) : undefined;
125
+ const task = body.task ? ((await findTask(body.task).catch(() => null)) ?? fail(404, `no task "${body.task}"`)).ref : undefined;
121
126
  try {
122
127
  return await createChat({
123
128
  agent: agent,
124
129
  scope,
125
130
  author: await personOf(c.trust),
126
131
  ...(project ? { project } : {}),
132
+ ...(task ? { task } : {}),
127
133
  ...(body.resume ? { resume: body.resume } : {}),
128
134
  });
129
135
  }
@@ -104,7 +104,36 @@ export declare const routes: (Route<"agents.addJournal", {
104
104
  content: string;
105
105
  }, "/api/agents/:slug/skills/:name", undefined> | Route<"agents.skills", {
106
106
  skills: import("../../core/skills.js").SkillInfo[];
107
- }, "/api/agents/:slug/skills", undefined> | Route<"agents.status", Record<string, import("../../core/agent-status.js").AgentStatus>, "/api/agent-status", undefined> | Route<"attention.list", import("../../core/attention.js").AttentionView, "/api/attention", undefined> | Route<"channels.create", {
107
+ }, "/api/agents/:slug/skills", undefined> | Route<"agents.status", Record<string, import("../../core/agent-status.js").AgentStatus>, "/api/agent-status", undefined> | Route<"attention.list", import("../../core/attention.js").AttentionView, "/api/attention", undefined> | Route<"boards.create", import("./router.js").Reply<import("../../core/boards.js").BoardDetail>, "/api/boards", z.ZodObject<{
108
+ title: z.ZodString;
109
+ slug: z.ZodOptional<z.ZodString>;
110
+ project: z.ZodOptional<z.ZodString>;
111
+ columns: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
112
+ slug: z.ZodString;
113
+ label: z.ZodOptional<z.ZodString>;
114
+ limit: z.ZodOptional<z.ZodNumber>;
115
+ done: z.ZodOptional<z.ZodBoolean>;
116
+ review: z.ZodOptional<z.ZodBoolean>;
117
+ }, z.core.$strip>]>>>;
118
+ agent: z.ZodOptional<z.ZodString>;
119
+ notes: z.ZodOptional<z.ZodString>;
120
+ }, z.core.$strip>> | Route<"boards.delete", {
121
+ ok: boolean;
122
+ }, "/api/boards/:board", undefined> | Route<"boards.ensure", import("../../core/boards.js").BoardDetail, "/api/boards/default", z.ZodObject<{
123
+ project: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>> | Route<"boards.get", import("../../core/boards.js").BoardDetail, "/api/boards/:board", undefined> | Route<"boards.list", import("../../core/boards.js").BoardsView, "/api/boards", undefined> | Route<"boards.save", import("../../core/boards.js").BoardDetail, "/api/boards/:board", z.ZodObject<{
125
+ title: z.ZodOptional<z.ZodString>;
126
+ columns: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
127
+ slug: z.ZodString;
128
+ label: z.ZodOptional<z.ZodString>;
129
+ limit: z.ZodOptional<z.ZodNumber>;
130
+ done: z.ZodOptional<z.ZodBoolean>;
131
+ review: z.ZodOptional<z.ZodBoolean>;
132
+ }, z.core.$strip>]>>>;
133
+ agent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ staleAfter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ notes: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$strip>> | Route<"channels.create", {
108
137
  slug: string;
109
138
  name: string;
110
139
  purpose?: string;
@@ -220,9 +249,11 @@ export declare const routes: (Route<"agents.addJournal", {
220
249
  runId: z.ZodOptional<z.ZodString>;
221
250
  bundle: z.ZodOptional<z.ZodString>;
222
251
  slug: z.ZodOptional<z.ZodString>;
252
+ task: z.ZodOptional<z.ZodString>;
223
253
  }, z.core.$strip>>;
224
254
  resume: z.ZodOptional<z.ZodString>;
225
255
  project: z.ZodOptional<z.ZodString>;
256
+ task: z.ZodOptional<z.ZodString>;
226
257
  }, z.core.$strip>> | Route<"chats.delete", import("./router.js").Reply<{
227
258
  error?: string;
228
259
  }>, "/api/chats/:id", undefined> | Route<"chats.elicitation", import("./router.js").Reply<{
@@ -549,6 +580,8 @@ export declare const routes: (Route<"agents.addJournal", {
549
580
  contacts: boolean;
550
581
  places: boolean;
551
582
  events: boolean;
583
+ boards: boolean;
584
+ presentations: boolean;
552
585
  publicUrl: string;
553
586
  cloud: {
554
587
  included: boolean;
@@ -587,7 +620,63 @@ export declare const routes: (Route<"agents.addJournal", {
587
620
  notes: z.ZodOptional<z.ZodString>;
588
621
  tags: z.ZodOptional<z.ZodUnknown>;
589
622
  records: z.ZodOptional<z.ZodUnknown>;
590
- }, z.core.$loose>> | Route<"projects.create", import("./router.js").Reply<import("../../core/projects.js").ProjectDetail>, "/api/projects", z.ZodObject<{
623
+ }, z.core.$loose>> | Route<"presentations.comment", import("./router.js").Reply<import("../../core/presentations/index.js").DeckComment>, "/api/presentations/:name/comments", z.ZodObject<{
624
+ slide: z.ZodNumber;
625
+ slot: z.ZodOptional<z.ZodString>;
626
+ text: z.ZodString;
627
+ }, z.core.$strip>> | Route<"presentations.commentDelete", {
628
+ ok: true;
629
+ }, "/api/presentations/:name/comments/:id", undefined> | Route<"presentations.commentSave", import("../../core/presentations/index.js").DeckComment, "/api/presentations/:name/comments/:id", z.ZodObject<{
630
+ resolved: z.ZodOptional<z.ZodBoolean>;
631
+ reply: z.ZodOptional<z.ZodString>;
632
+ }, z.core.$strip>> | Route<"presentations.create", import("./router.js").Reply<import("../../core/presentations/index.js").PresentationDetail>, "/api/presentations", z.ZodObject<{
633
+ project: z.ZodOptional<z.ZodString>;
634
+ title: z.ZodString;
635
+ slug: z.ZodOptional<z.ZodString>;
636
+ template: z.ZodOptional<z.ZodString>;
637
+ source: z.ZodOptional<z.ZodString>;
638
+ }, z.core.$strip>> | Route<"presentations.delete", {
639
+ ok: true;
640
+ }, "/api/presentations/:name", undefined> | Route<"presentations.export", void, "/api/presentations/:name/export", undefined> | Route<"presentations.file", void, "/api/presentations/:name/file", undefined> | Route<"presentations.get", import("../../core/presentations/index.js").PresentationDetail, "/api/presentations/:name", undefined> | Route<"presentations.history", {
641
+ versions: import("../../core/presentations/versions.js").DeckVersion[];
642
+ }, "/api/presentations/:name/history", undefined> | Route<"presentations.links", {
643
+ tasks: import("../../core/boards.js").LinkingTask[];
644
+ }, "/api/presentations/:name/links", undefined> | Route<"presentations.list", import("../../core/presentations/index.js").PresentationsView, "/api/presentations", undefined> | Route<"presentations.presence", {
645
+ viewers: import("../../core/presentations/presence.js").Viewer[];
646
+ }, "/api/presentations/:name/presence", z.ZodObject<{
647
+ client: z.ZodString;
648
+ slide: z.ZodNumber;
649
+ slot: z.ZodOptional<z.ZodString>;
650
+ leave: z.ZodOptional<z.ZodBoolean>;
651
+ }, z.core.$strip>> | Route<"presentations.save", import("../../core/presentations/index.js").PresentationDetail, "/api/presentations/:name", z.ZodObject<{
652
+ base: z.ZodOptional<z.ZodString>;
653
+ source: z.ZodOptional<z.ZodString>;
654
+ title: z.ZodOptional<z.ZodString>;
655
+ template: z.ZodOptional<z.ZodString>;
656
+ size: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
657
+ "16:9": "16:9";
658
+ "4:3": "4:3";
659
+ }>>>;
660
+ numbers: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
661
+ slides: z.ZodOptional<z.ZodArray<z.ZodObject<{
662
+ layout: z.ZodOptional<z.ZodString>;
663
+ notes: z.ZodOptional<z.ZodString>;
664
+ background: z.ZodOptional<z.ZodString>;
665
+ transition: z.ZodOptional<z.ZodString>;
666
+ extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
667
+ content: z.ZodString;
668
+ }, z.core.$strip>>>;
669
+ }, z.core.$strip>> | Route<"presentations.slide", void, "/api/presentations/:name/slides/:n", undefined> | Route<"presentations.templateFile", void, "/api/presentations/templates/:slug/file", undefined> | Route<"presentations.templates", {
670
+ templates: import("../../core/presentations/template.js").TemplateSummary[];
671
+ }, "/api/presentations/templates", undefined> | Route<"presentations.upload", import("./router.js").Reply<{
672
+ path: string;
673
+ size: number;
674
+ }>, "/api/presentations/:name/assets", undefined> | Route<"presentations.version", {
675
+ id: string;
676
+ at: string;
677
+ source: string;
678
+ deck: import("../../core/presentations/deck.js").DeckDoc;
679
+ }, "/api/presentations/:name/history/:id", undefined> | Route<"projects.create", import("./router.js").Reply<import("../../core/projects.js").ProjectDetail>, "/api/projects", z.ZodObject<{
591
680
  title: z.ZodString;
592
681
  goal: z.ZodOptional<z.ZodString>;
593
682
  slug: z.ZodOptional<z.ZodString>;
@@ -725,10 +814,85 @@ export declare const routes: (Route<"agents.addJournal", {
725
814
  enabled: z.ZodBoolean;
726
815
  root: z.ZodOptional<z.ZodString>;
727
816
  }, z.core.$strip>>;
817
+ boards: z.ZodOptional<z.ZodObject<{
818
+ enabled: z.ZodBoolean;
819
+ root: z.ZodOptional<z.ZodString>;
820
+ }, z.core.$strip>>;
821
+ presentations: z.ZodOptional<z.ZodObject<{
822
+ enabled: z.ZodBoolean;
823
+ root: z.ZodOptional<z.ZodString>;
824
+ }, z.core.$strip>>;
728
825
  }, z.core.$loose>> | Route<"skills.get", import("../../core/skills.js").SkillDetail, "/api/skills/:name", undefined> | Route<"skills.list", {
729
826
  root: string;
730
827
  skills: import("../../core/skills.js").SkillInfo[];
731
- }, "/api/skills", undefined> | Route<"temp.clean", {
828
+ }, "/api/skills", undefined> | Route<"tasks.assign", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task/assign", z.ZodObject<{
829
+ to: z.ZodNullable<z.ZodString>;
830
+ message: z.ZodOptional<z.ZodString>;
831
+ actor: z.ZodOptional<z.ZodString>;
832
+ }, z.core.$strip>> | Route<"tasks.create", import("./router.js").Reply<import("../../core/boards.js").TaskDetail>, "/api/boards/:board/tasks", z.ZodObject<{
833
+ status: z.ZodOptional<z.ZodString>;
834
+ order: z.ZodOptional<z.ZodNumber>;
835
+ assignee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
836
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
837
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
838
+ refs: z.ZodOptional<z.ZodArray<z.ZodString>>;
839
+ notes: z.ZodOptional<z.ZodString>;
840
+ actor: z.ZodOptional<z.ZodString>;
841
+ message: z.ZodOptional<z.ZodString>;
842
+ title: z.ZodString;
843
+ }, z.core.$strip>> | Route<"tasks.delete", {
844
+ ok: boolean;
845
+ }, "/api/boards/:board/tasks/:task", undefined> | Route<"tasks.get", {
846
+ slug: string;
847
+ number: number;
848
+ title: string;
849
+ status: string;
850
+ order: number;
851
+ assignee?: string;
852
+ due?: string;
853
+ created: string;
854
+ tags: string[];
855
+ refs: string[];
856
+ extra?: Record<string, unknown>;
857
+ ref: string;
858
+ path: string;
859
+ updatedAt?: string;
860
+ configError?: string;
861
+ files: number;
862
+ lastLog?: string;
863
+ stale?: boolean;
864
+ notes: string;
865
+ log: string;
866
+ fileList: string[];
867
+ board: string;
868
+ project?: string;
869
+ sessions: import("../../core/board-wake.js").TaskSession[];
870
+ }, "/api/boards/:board/tasks/:task", undefined> | Route<"tasks.log", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task/log", z.ZodObject<{
871
+ entry: z.ZodString;
872
+ actor: z.ZodOptional<z.ZodString>;
873
+ }, z.core.$strip>> | Route<"tasks.move", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task/move", z.ZodObject<{
874
+ status: z.ZodString;
875
+ before: z.ZodOptional<z.ZodString>;
876
+ order: z.ZodOptional<z.ZodNumber>;
877
+ message: z.ZodOptional<z.ZodString>;
878
+ actor: z.ZodOptional<z.ZodString>;
879
+ }, z.core.$strip>> | Route<"tasks.pick", {
880
+ task: import("../../core/boards.js").TaskDetail | null;
881
+ }, "/api/boards/:board/pick", z.ZodObject<{
882
+ agent: z.ZodString;
883
+ column: z.ZodOptional<z.ZodString>;
884
+ }, z.core.$strip>> | Route<"tasks.save", import("../../core/boards.js").TaskDetail, "/api/boards/:board/tasks/:task", z.ZodObject<{
885
+ title: z.ZodOptional<z.ZodString>;
886
+ status: z.ZodOptional<z.ZodString>;
887
+ order: z.ZodOptional<z.ZodNumber>;
888
+ assignee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
889
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
890
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
891
+ refs: z.ZodOptional<z.ZodArray<z.ZodString>>;
892
+ notes: z.ZodOptional<z.ZodString>;
893
+ actor: z.ZodOptional<z.ZodString>;
894
+ message: z.ZodOptional<z.ZodString>;
895
+ }, z.core.$strip>> | Route<"temp.clean", {
732
896
  ok: boolean;
733
897
  removed: string[];
734
898
  bytes: number;
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod";
2
2
  import { agentRoutes } from "./agents.js";
3
3
  import { attentionRoutes } from "./attention.js";
4
+ import { boardRoutes } from "./boards.js";
4
5
  import { channelRoutes } from "./channels.js";
5
6
  import { chatRoutes } from "./chats.js";
6
7
  import { cloudRoutes } from "./cloud.js";
@@ -10,6 +11,7 @@ import { hubRoutes } from "./hub.js";
10
11
  import { fileRoutes } from "./files.js";
11
12
  import { gitRoutes } from "./git.js";
12
13
  import { knowledgeRoutes } from "./knowledge.js";
14
+ import { presentationRoutes } from "./presentations.js";
13
15
  import { projectRoutes } from "./projects.js";
14
16
  import { createRouter, route } from "./router.js";
15
17
  import { runRoutes } from "./runs.js";
@@ -31,6 +33,8 @@ const domainRoutes = [
31
33
  ...chatRoutes,
32
34
  ...channelRoutes,
33
35
  ...projectRoutes,
36
+ ...boardRoutes,
37
+ ...presentationRoutes,
34
38
  ...contactRoutes,
35
39
  ...placeRoutes,
36
40
  ...eventRoutes,