@copilotz/work 0.0.0-stage → 1.0.0-rc.34

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 (147) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -2
  3. package/boards/actions/create-board.d.ts +1 -0
  4. package/boards/actions/create-board.js +47 -0
  5. package/boards/actions/create-card.d.ts +1 -0
  6. package/boards/actions/create-card.js +83 -0
  7. package/boards/actions/delete-board.d.ts +1 -0
  8. package/boards/actions/delete-board.js +30 -0
  9. package/boards/actions/delete-card.d.ts +1 -0
  10. package/boards/actions/delete-card.js +24 -0
  11. package/boards/actions/move-card.d.ts +1 -0
  12. package/boards/actions/move-card.js +85 -0
  13. package/boards/actions/update-board.d.ts +1 -0
  14. package/boards/actions/update-board.js +110 -0
  15. package/boards/actions/update-card.d.ts +1 -0
  16. package/boards/actions/update-card.js +67 -0
  17. package/boards/collections/board.d.ts +71 -0
  18. package/boards/collections/board.js +32 -0
  19. package/boards/collections/card.d.ts +74 -0
  20. package/boards/collections/card.js +29 -0
  21. package/boards/contract.d.ts +67 -0
  22. package/boards/contract.js +20 -0
  23. package/boards/mod.d.ts +34 -0
  24. package/boards/mod.js +72 -0
  25. package/boards/resources/tools.d.ts +2 -0
  26. package/boards/resources/tools.js +414 -0
  27. package/boards/shared/columns.d.ts +39 -0
  28. package/boards/shared/columns.js +88 -0
  29. package/boards/shared/dates.d.ts +11 -0
  30. package/boards/shared/dates.js +22 -0
  31. package/boards/shared/errors.d.ts +24 -0
  32. package/boards/shared/errors.js +20 -0
  33. package/boards/shared/fields.d.ts +65 -0
  34. package/boards/shared/fields.js +44 -0
  35. package/boards/shared/load.d.ts +22 -0
  36. package/boards/shared/load.js +32 -0
  37. package/boards/shared/order.d.ts +30 -0
  38. package/boards/shared/order.js +47 -0
  39. package/boards/shared/people.d.ts +30 -0
  40. package/boards/shared/people.js +87 -0
  41. package/boards/shared/said.d.ts +28 -0
  42. package/boards/shared/said.js +30 -0
  43. package/boards/views/web/board-head.d.ts +62 -0
  44. package/boards/views/web/board-head.js +170 -0
  45. package/boards/views/web/board-page.d.ts +17 -0
  46. package/boards/views/web/board-page.js +97 -0
  47. package/boards/views/web/board-view.d.ts +40 -0
  48. package/boards/views/web/board-view.js +341 -0
  49. package/boards/views/web/boards-tab.d.ts +13 -0
  50. package/boards/views/web/boards-tab.js +109 -0
  51. package/boards/views/web/card-sheet.d.ts +47 -0
  52. package/boards/views/web/card-sheet.js +314 -0
  53. package/boards/views/web/card-tile.d.ts +29 -0
  54. package/boards/views/web/card-tile.js +20 -0
  55. package/boards/views/web/column.d.ts +38 -0
  56. package/boards/views/web/column.js +171 -0
  57. package/boards/views/web/drag.d.ts +36 -0
  58. package/boards/views/web/drag.js +276 -0
  59. package/boards/views/web/glyphs.d.ts +29 -0
  60. package/boards/views/web/glyphs.js +25 -0
  61. package/boards/views/web/load.d.ts +32 -0
  62. package/boards/views/web/load.js +33 -0
  63. package/boards/views/web/palette.d.ts +15 -0
  64. package/boards/views/web/palette.js +180 -0
  65. package/boards/views/web/pickers.d.ts +45 -0
  66. package/boards/views/web/pickers.js +83 -0
  67. package/boards/views/web/shown.d.ts +77 -0
  68. package/boards/views/web/shown.js +136 -0
  69. package/boards/views/web/step.d.ts +13 -0
  70. package/boards/views/web/step.js +41 -0
  71. package/boards/views/web/style.d.ts +10 -0
  72. package/boards/views/web/style.js +380 -0
  73. package/boards/views/web/toolbar.d.ts +21 -0
  74. package/boards/views/web/toolbar.js +39 -0
  75. package/boards/web.d.ts +26 -0
  76. package/boards/web.js +52 -0
  77. package/contract.d.ts +7 -0
  78. package/contract.js +7 -0
  79. package/documents/actions/create.d.ts +1 -0
  80. package/documents/actions/create.js +28 -0
  81. package/documents/actions/delete.d.ts +1 -0
  82. package/documents/actions/delete.js +32 -0
  83. package/documents/actions/presence.d.ts +1 -0
  84. package/documents/actions/presence.js +45 -0
  85. package/documents/actions/rename.d.ts +1 -0
  86. package/documents/actions/rename.js +33 -0
  87. package/documents/actions/restore.d.ts +1 -0
  88. package/documents/actions/restore.js +39 -0
  89. package/documents/actions/save.d.ts +1 -0
  90. package/documents/actions/save.js +78 -0
  91. package/documents/collections/document-presence.d.ts +79 -0
  92. package/documents/collections/document-presence.js +25 -0
  93. package/documents/collections/document-version.d.ts +166 -0
  94. package/documents/collections/document-version.js +60 -0
  95. package/documents/collections/document.d.ts +131 -0
  96. package/documents/collections/document.js +72 -0
  97. package/documents/contract.d.ts +17 -0
  98. package/documents/contract.js +1 -0
  99. package/documents/mod.d.ts +38 -0
  100. package/documents/mod.js +75 -0
  101. package/documents/resources/tools.d.ts +2 -0
  102. package/documents/resources/tools.js +253 -0
  103. package/documents/shared/diff.d.ts +37 -0
  104. package/documents/shared/diff.js +148 -0
  105. package/documents/shared/merge.d.ts +29 -0
  106. package/documents/shared/merge.js +120 -0
  107. package/documents/shared/presence.d.ts +7 -0
  108. package/documents/shared/presence.js +7 -0
  109. package/documents/shared/text.d.ts +36 -0
  110. package/documents/shared/text.js +67 -0
  111. package/documents/shared/who.d.ts +23 -0
  112. package/documents/shared/who.js +39 -0
  113. package/documents/shared/write.d.ts +54 -0
  114. package/documents/shared/write.js +123 -0
  115. package/documents/views/web/changes.d.ts +22 -0
  116. package/documents/views/web/changes.js +57 -0
  117. package/documents/views/web/conflict.d.ts +38 -0
  118. package/documents/views/web/conflict.js +96 -0
  119. package/documents/views/web/draft.d.ts +18 -0
  120. package/documents/views/web/draft.js +32 -0
  121. package/documents/views/web/editor.d.ts +57 -0
  122. package/documents/views/web/editor.js +268 -0
  123. package/documents/views/web/format.d.ts +56 -0
  124. package/documents/views/web/format.js +245 -0
  125. package/documents/views/web/history.d.ts +23 -0
  126. package/documents/views/web/history.js +118 -0
  127. package/documents/views/web/list.d.ts +37 -0
  128. package/documents/views/web/list.js +211 -0
  129. package/documents/views/web/page.d.ts +35 -0
  130. package/documents/views/web/page.js +416 -0
  131. package/documents/views/web/palette.d.ts +16 -0
  132. package/documents/views/web/palette.js +168 -0
  133. package/documents/views/web/people.d.ts +60 -0
  134. package/documents/views/web/people.js +63 -0
  135. package/documents/views/web/presence.d.ts +30 -0
  136. package/documents/views/web/presence.js +75 -0
  137. package/documents/views/web/step.d.ts +25 -0
  138. package/documents/views/web/step.js +81 -0
  139. package/documents/views/web/style.d.ts +7 -0
  140. package/documents/views/web/style.js +266 -0
  141. package/documents/web.d.ts +18 -0
  142. package/documents/web.js +46 -0
  143. package/mod.d.ts +18 -0
  144. package/mod.js +18 -0
  145. package/package.json +61 -4
  146. package/web.d.ts +13 -0
  147. package/web.js +13 -0
@@ -0,0 +1,74 @@
1
+ export declare const card: {
2
+ schema: {
3
+ readonly type: "object";
4
+ readonly properties: {
5
+ readonly in: {
6
+ readonly type: "string";
7
+ };
8
+ readonly board: {
9
+ readonly type: "string";
10
+ };
11
+ readonly column: {
12
+ readonly type: "string";
13
+ };
14
+ readonly order: {
15
+ readonly type: "number";
16
+ };
17
+ readonly title: {
18
+ readonly type: "string";
19
+ };
20
+ readonly description: {
21
+ readonly type: "string";
22
+ };
23
+ readonly assignee: {
24
+ readonly type: "string";
25
+ };
26
+ readonly labels: {
27
+ readonly type: "array";
28
+ readonly items: {
29
+ readonly type: "string";
30
+ };
31
+ };
32
+ readonly due: {
33
+ readonly type: "string";
34
+ };
35
+ readonly by: {
36
+ readonly type: "string";
37
+ };
38
+ readonly at: {
39
+ readonly type: "string";
40
+ };
41
+ readonly updatedBy: {
42
+ readonly type: "string";
43
+ };
44
+ readonly updated: {
45
+ readonly type: "string";
46
+ };
47
+ };
48
+ readonly required: readonly ["in", "board", "column", "order", "title", "at"];
49
+ };
50
+ events?: boolean;
51
+ records?: boolean;
52
+ durable?: false;
53
+ indexes?: string[][];
54
+ private?: string[];
55
+ queries?: Record<string, import("copilotz").QueryDef<{
56
+ [x: string]: unknown;
57
+ description?: string | undefined;
58
+ by?: string | undefined;
59
+ assignee?: string | undefined;
60
+ labels?: string[] | undefined;
61
+ due?: string | undefined;
62
+ updatedBy?: string | undefined;
63
+ updated?: string | undefined;
64
+ at: string;
65
+ column: string;
66
+ title: string;
67
+ in: string;
68
+ board: string;
69
+ order: number;
70
+ } & {
71
+ _id: string;
72
+ }>> | undefined;
73
+ vectors?: string[];
74
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Cards: one real outcome each, on a board (`board`), in one of its columns
3
+ * (`column`), at an `order` there (lowest first). A card lives in its
4
+ * board's space (`in`), so the spaces plugin's rules keep it to those who
5
+ * reach that space, as they do the board (`shared: { card: {} }`).
6
+ */
7
+ import { defineCollection } from "copilotz";
8
+ export const card = defineCollection({
9
+ schema: {
10
+ type: "object",
11
+ properties: {
12
+ in: { type: "string" },
13
+ board: { type: "string" },
14
+ column: { type: "string" },
15
+ order: { type: "number" },
16
+ title: { type: "string" },
17
+ description: { type: "string" },
18
+ assignee: { type: "string" },
19
+ labels: { type: "array", items: { type: "string" } },
20
+ due: { type: "string" },
21
+ by: { type: "string" },
22
+ at: { type: "string" },
23
+ updatedBy: { type: "string" },
24
+ updated: { type: "string" },
25
+ },
26
+ required: ["in", "board", "column", "order", "title", "at"],
27
+ },
28
+ indexes: [["board", "column"], ["in"]],
29
+ });
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The boards plugin's contract: what other code may import from it. The
3
+ * shapes of its documents (a `board` and its `card`s, both living `in` a
4
+ * space) and where a board is on the web. The rest is reached by name: its
5
+ * collections (`board`, `card`), its Actions (`board.create`,
6
+ * `board.update`, `board.delete`, `card.create`, `card.update`,
7
+ * `card.move`, `card.delete`) and the tools agents use them with
8
+ * (`list_boards`, `read_board`, `create_board`, `create_card`,
9
+ * `update_card`, `move_card`).
10
+ */
11
+ /** A column of a board: its id (kept when it's renamed) and its name. */
12
+ export type Column = {
13
+ id: string;
14
+ name: string;
15
+ };
16
+ /** A board in a space: its columns in order, left to right. */
17
+ export type Board = {
18
+ _id: string;
19
+ /** The space it's in. */
20
+ in: string;
21
+ name: string;
22
+ description?: string;
23
+ columns: Column[];
24
+ /** When it was archived: listed apart until it's brought back. */
25
+ archived?: string;
26
+ /** Who made it (`person:ana`, `agent:north`), and when. */
27
+ by?: string;
28
+ at: string;
29
+ /** Who changed it last, and when. */
30
+ updatedBy?: string;
31
+ updated?: string;
32
+ };
33
+ /** One real outcome on a board: in a column, at an order within it (lowest first). */
34
+ export type Card = {
35
+ _id: string;
36
+ /** Its board's space. */
37
+ in: string;
38
+ board: string;
39
+ /** Its column's id. */
40
+ column: string;
41
+ /** Where it sits in its column: lowest first; new places take midpoints between neighbours. */
42
+ order: number;
43
+ title: string;
44
+ /** Markdown: what it is, how we'll know it's done, what blocks it. */
45
+ description?: string;
46
+ /** Who owns it: `person:<id>` or `agent:<name>`. */
47
+ assignee?: string;
48
+ labels?: string[];
49
+ /** When it's due: `YYYY-MM-DD`. */
50
+ due?: string;
51
+ by?: string;
52
+ at: string;
53
+ updatedBy?: string;
54
+ updated?: string;
55
+ };
56
+ /** Where a card goes in its column: before or after another card, or at the top or bottom. */
57
+ export type Place = {
58
+ before: string;
59
+ } | {
60
+ after: string;
61
+ } | {
62
+ at: "top" | "bottom";
63
+ };
64
+ /** A board's page; `space`, where the person is working (the sidebar marks it). */
65
+ export declare const boardPath: (board: string, space?: string, card?: string) => string;
66
+ /** A space's Board tab. */
67
+ export declare const boardsTab: (space: string) => string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The boards plugin's contract: what other code may import from it. The
3
+ * shapes of its documents (a `board` and its `card`s, both living `in` a
4
+ * space) and where a board is on the web. The rest is reached by name: its
5
+ * collections (`board`, `card`), its Actions (`board.create`,
6
+ * `board.update`, `board.delete`, `card.create`, `card.update`,
7
+ * `card.move`, `card.delete`) and the tools agents use them with
8
+ * (`list_boards`, `read_board`, `create_board`, `create_card`,
9
+ * `update_card`, `move_card`).
10
+ */
11
+ /** A board's page; `space`, where the person is working (the sidebar marks it). */
12
+ export const boardPath = (board, space, card) => {
13
+ const query = [
14
+ ...(space ? [`in=${encodeURIComponent(space)}`] : []),
15
+ ...(card ? [`card=${encodeURIComponent(card)}`] : []),
16
+ ];
17
+ return `/board/${encodeURIComponent(board)}${query.length ? `?${query.join("&")}` : ""}`;
18
+ };
19
+ /** A space's Board tab. */
20
+ export const boardsTab = (space) => `/space/${encodeURIComponent(space)}?tab=board`;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Boards: kanban boards in a space, for people and agents, the team's
3
+ * operational source of truth: one real outcome per card, with its owner,
4
+ * what done looks like, an honest column, and any blocker.
5
+ *
6
+ * - **Boards** (`board`) live in a space, with their columns in order (a new
7
+ * one starts with Backlog, To do, Doing, Blocked, In review and Done);
8
+ * **cards** (`card`) are on a board, in a column, at an order there. Both
9
+ * are shared in spaces, so the spaces plugin's rules keep every read and
10
+ * write to what the actor reaches: everyone there reads them, its editors
11
+ * change them.
12
+ * - **People** use the Actions: `board.create`, `board.update` (its name,
13
+ * description and columns: added, renamed, reordered, removed when empty
14
+ * or with their cards moved elsewhere), `board.delete` (with its cards),
15
+ * `card.create`, `card.update` (`null` clears a field), `card.move` (to a
16
+ * column, before or after a card, or at its top or bottom) and
17
+ * `card.delete`. What several documents must agree on commits together.
18
+ * Nothing outside writes either directly (the REST API, a browser's
19
+ * socket): only these Actions keep a board's columns and its cards' order
20
+ * agreeing.
21
+ * - **Agents** get tools wherever their conversation is in a space:
22
+ * `list_boards`, `read_board`, `create_board`, `create_card`,
23
+ * `update_card`, `move_card`, naming people and agents as people do.
24
+ *
25
+ * Its front end is `boardsWeb` (web.tsx).
26
+ *
27
+ * ```ts
28
+ * plugins: [models, chat, ...access, boards]
29
+ * ```
30
+ */
31
+ import { type Plugin } from "copilotz";
32
+ export * from "./contract.js";
33
+ export declare const boards: Plugin;
34
+ export default boards;
package/boards/mod.js ADDED
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Boards: kanban boards in a space, for people and agents, the team's
3
+ * operational source of truth: one real outcome per card, with its owner,
4
+ * what done looks like, an honest column, and any blocker.
5
+ *
6
+ * - **Boards** (`board`) live in a space, with their columns in order (a new
7
+ * one starts with Backlog, To do, Doing, Blocked, In review and Done);
8
+ * **cards** (`card`) are on a board, in a column, at an order there. Both
9
+ * are shared in spaces, so the spaces plugin's rules keep every read and
10
+ * write to what the actor reaches: everyone there reads them, its editors
11
+ * change them.
12
+ * - **People** use the Actions: `board.create`, `board.update` (its name,
13
+ * description and columns: added, renamed, reordered, removed when empty
14
+ * or with their cards moved elsewhere), `board.delete` (with its cards),
15
+ * `card.create`, `card.update` (`null` clears a field), `card.move` (to a
16
+ * column, before or after a card, or at its top or bottom) and
17
+ * `card.delete`. What several documents must agree on commits together.
18
+ * Nothing outside writes either directly (the REST API, a browser's
19
+ * socket): only these Actions keep a board's columns and its cards' order
20
+ * agreeing.
21
+ * - **Agents** get tools wherever their conversation is in a space:
22
+ * `list_boards`, `read_board`, `create_board`, `create_card`,
23
+ * `update_card`, `move_card`, naming people and agents as people do.
24
+ *
25
+ * Its front end is `boardsWeb` (web.tsx).
26
+ *
27
+ * ```ts
28
+ * plugins: [models, chat, ...access, boards]
29
+ * ```
30
+ */
31
+ import { definePlugin, failure } from "copilotz";
32
+ import { createBoardAction } from "./actions/create-board.js";
33
+ import { createCardAction } from "./actions/create-card.js";
34
+ import { deleteBoardAction } from "./actions/delete-board.js";
35
+ import { deleteCardAction } from "./actions/delete-card.js";
36
+ import { moveCardAction } from "./actions/move-card.js";
37
+ import { updateBoardAction } from "./actions/update-board.js";
38
+ import { updateCardAction } from "./actions/update-card.js";
39
+ import { board } from "./collections/board.js";
40
+ import { card } from "./collections/card.js";
41
+ import { tools } from "./resources/tools.js";
42
+ export * from "./contract.js";
43
+ export const boards = definePlugin({
44
+ name: "boards",
45
+ requires: ["chat", "spaces"],
46
+ collections: { board, card },
47
+ actions: {
48
+ "board.create": createBoardAction,
49
+ "board.update": updateBoardAction,
50
+ "board.delete": deleteBoardAction,
51
+ "card.create": createCardAction,
52
+ "card.update": updateCardAction,
53
+ "card.move": moveCardAction,
54
+ "card.delete": deleteCardAction,
55
+ },
56
+ resources: {
57
+ // Boards and their cards live in spaces: each reaches only those who reach the space.
58
+ shared: { board: {}, card: {} },
59
+ tools,
60
+ },
61
+ // Only the Actions change them: a write from outside (`direct`) could leave a card in a column
62
+ // its board doesn't have, or two at one place.
63
+ guard: (_actor, { collection, access, direct }) => {
64
+ if ((collection === "board" || collection === "card") && direct && access === "write") {
65
+ throw failure("forbidden", "Boards and cards change through their Actions.", {
66
+ public: true,
67
+ });
68
+ }
69
+ return undefined;
70
+ },
71
+ });
72
+ export default boards;
@@ -0,0 +1,2 @@
1
+ import { type Tool } from "copilotz/plugins/agents/contract";
2
+ export declare const tools: Record<string, Tool>;