makersclaw 0.6.0 → 0.7.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 (141) hide show
  1. package/README.md +48 -8
  2. package/package.json +1 -1
  3. package/r/annotate.json +4 -4
  4. package/r/approval-request.json +3 -3
  5. package/r/audio-player.json +3 -3
  6. package/r/auth-form.json +2 -2
  7. package/r/board.json +4 -4
  8. package/r/calendar-view.json +4 -4
  9. package/r/cart.json +3 -3
  10. package/r/chart.json +3 -3
  11. package/r/chat.json +3 -3
  12. package/r/code-editor.json +4 -4
  13. package/r/comment-box.json +4 -4
  14. package/r/contact-section.json +3 -3
  15. package/r/core.json +3 -3
  16. package/r/csv-import.json +4 -4
  17. package/r/data-table.json +3 -3
  18. package/r/diagram.json +3 -3
  19. package/r/doc-editor.json +4 -4
  20. package/r/doc-page.json +4 -4
  21. package/r/email-render.json +2 -2
  22. package/r/faq.json +2 -2
  23. package/r/file-upload.json +3 -3
  24. package/r/flow-canvas.json +4 -4
  25. package/r/footer.json +3 -3
  26. package/r/gantt.json +4 -4
  27. package/r/job-panel.json +3 -3
  28. package/r/json-editor.json +4 -4
  29. package/r/map.json +5 -5
  30. package/r/menubar.json +2 -2
  31. package/r/mind-map.json +4 -4
  32. package/r/navigation-menu.json +2 -2
  33. package/r/order-detail.json +2 -2
  34. package/r/org-chart.json +4 -4
  35. package/r/page-builder.json +6 -6
  36. package/r/payment-methods.json +2 -2
  37. package/r/pdf-document.json +2 -2
  38. package/r/pdf-viewer.json +6 -6
  39. package/r/product-detail.json +3 -3
  40. package/r/product-grid.json +4 -4
  41. package/r/record-form.json +3 -3
  42. package/r/record-notes.json +5 -5
  43. package/r/registry.json +121 -121
  44. package/r/search-dialog.json +3 -3
  45. package/r/settings-list.json +3 -3
  46. package/r/setup-checklist.json +3 -3
  47. package/r/share-dialog.json +3 -3
  48. package/r/sidebar.json +2 -2
  49. package/r/signature-pad.json +3 -3
  50. package/r/sketch-canvas.json +5 -5
  51. package/r/spreadsheet.json +3 -3
  52. package/r/stat-cards.json +4 -4
  53. package/r/task-list.json +4 -4
  54. package/r/task-model.json +3 -3
  55. package/r/testimonials.json +2 -2
  56. package/r/transaction-list.json +3 -3
  57. package/r/whiteboard.json +4 -4
  58. package/registry/blocks/annotate/README.md +14 -5
  59. package/registry/blocks/approval-request/README.md +15 -8
  60. package/registry/blocks/audio-player/README.md +17 -10
  61. package/registry/blocks/board/README.md +13 -9
  62. package/registry/blocks/board/board.jsx +1 -1
  63. package/registry/blocks/calendar-view/README.md +28 -4
  64. package/registry/blocks/cart/README.md +14 -10
  65. package/registry/blocks/chart/README.md +14 -7
  66. package/registry/blocks/chat/README.md +43 -13
  67. package/registry/blocks/code-editor/README.md +4 -0
  68. package/registry/blocks/code-editor/code-editor.jsx +1 -1
  69. package/registry/blocks/comment-box/README.md +20 -13
  70. package/registry/blocks/contact-section/README.md +7 -6
  71. package/registry/blocks/csv-import/README.md +34 -12
  72. package/registry/blocks/data-table/README.md +41 -8
  73. package/registry/blocks/diagram/diagram.jsx +1 -1
  74. package/registry/blocks/doc-editor/README.md +18 -6
  75. package/registry/blocks/doc-editor/doc-editor.jsx +1 -1
  76. package/registry/blocks/doc-page/README.md +16 -6
  77. package/registry/blocks/file-upload/README.md +7 -1
  78. package/registry/blocks/flow-canvas/README.md +16 -5
  79. package/registry/blocks/flow-canvas/flow-canvas.jsx +1 -1
  80. package/registry/blocks/footer/README.md +4 -2
  81. package/registry/blocks/gantt/README.md +18 -12
  82. package/registry/blocks/job-panel/README.md +1 -1
  83. package/registry/blocks/json-editor/README.md +16 -4
  84. package/registry/blocks/map/README.md +19 -3
  85. package/registry/blocks/map/map-view.jsx +1 -1
  86. package/registry/blocks/map/maplibre.js +1 -1
  87. package/registry/blocks/mind-map/README.md +16 -5
  88. package/registry/blocks/org-chart/README.md +10 -7
  89. package/registry/blocks/page-builder/README.md +13 -6
  90. package/registry/blocks/page-builder/page-builder.jsx +1 -1
  91. package/registry/blocks/page-builder/page-view.jsx +1 -1
  92. package/registry/blocks/page-builder/page.js +1 -1
  93. package/registry/blocks/pdf-viewer/README.md +22 -20
  94. package/registry/blocks/pdf-viewer/pdf-viewer.jsx +1 -1
  95. package/registry/blocks/pdf-viewer/pdfjs.js +1 -1
  96. package/registry/blocks/pdf-viewer/ssr-shim.js +1 -1
  97. package/registry/blocks/product-detail/README.md +13 -7
  98. package/registry/blocks/product-detail/demo.jsx +1 -1
  99. package/registry/blocks/product-grid/README.md +12 -10
  100. package/registry/blocks/record-form/README.md +26 -9
  101. package/registry/blocks/record-notes/README.md +42 -30
  102. package/registry/blocks/search-dialog/README.md +38 -7
  103. package/registry/blocks/settings-list/README.md +29 -17
  104. package/registry/blocks/setup-checklist/README.md +12 -14
  105. package/registry/blocks/share-dialog/README.md +1 -1
  106. package/registry/blocks/signature-pad/README.md +15 -4
  107. package/registry/blocks/sketch-canvas/README.md +13 -4
  108. package/registry/blocks/sketch-canvas/sketch-canvas.jsx +1 -1
  109. package/registry/blocks/sketch-canvas/ssr-shim.js +3 -3
  110. package/registry/blocks/spreadsheet/README.md +17 -8
  111. package/registry/blocks/stat-cards/README.md +17 -8
  112. package/registry/blocks/task-list/README.md +14 -11
  113. package/registry/blocks/task-model/README.md +3 -3
  114. package/registry/blocks/transaction-list/README.md +15 -7
  115. package/registry/blocks/whiteboard/README.md +19 -13
  116. package/src/cli.mjs +31 -4
  117. package/src/install.mjs +263 -21
  118. package/src/registry.mjs +78 -1
  119. package/templates/next/browser/app/auto-refresh.jsx +67 -0
  120. package/templates/next/browser/app/layout.jsx +94 -0
  121. package/templates/next/browser/app/page.jsx +60 -0
  122. package/templates/next/browser/app/s/[key]/page.jsx +95 -0
  123. package/templates/next/browser/lib/actions.js +16 -0
  124. package/templates/next/browser/lib/data.js +43 -0
  125. package/templates/next/files/README.md +810 -79
  126. package/templates/next/files/app/frame.js +128 -4
  127. package/templates/next/files/check/run.mjs +1438 -41
  128. package/templates/next/files/components/ui/item.jsx +2 -2
  129. package/templates/next/files/components/ui/notice.jsx +1 -1
  130. package/templates/next/files/components/ui/separator.jsx +1 -1
  131. package/templates/next/files/lib/actions.js +170 -51
  132. package/templates/next/files/lib/brain-server.js +96 -0
  133. package/templates/next/files/lib/brain.js +413 -0
  134. package/templates/next/files/lib/claw.js +11 -0
  135. package/templates/next/files/lib/data.js +119 -29
  136. package/templates/next/files/lib/db.js +97 -17
  137. package/templates/next/files/lib/door.js +680 -0
  138. package/templates/next/files/next.config.mjs +36 -2
  139. package/templates/next/files/surfaces.js +3 -2
  140. package/templates/next/template.json +9 -3
  141. package/templates/next/files/schema.sql +0 -22
@@ -1,3 +1,22 @@
1
+ import { readFileSync } from "node:fs";
2
+
3
+ // The app's mode, from its manifest (makersclaw.json, beside this file).
4
+ // A browser app builds to files (output: "export"): the platform serves
5
+ // them, and its data door answers their reads and writes. A server app
6
+ // runs `next start`. Absent or unreadable is a server app, as every app
7
+ // before 0.7.0 is (none has a `mode`); only the exact word "browser"
8
+ // makes an export. `makersclaw mode` is what changes the key, never an
9
+ // edit here.
10
+ function mode() {
11
+ try {
12
+ const m = JSON.parse(readFileSync(new URL("./makersclaw.json", import.meta.url), "utf8"));
13
+ return m && m.mode === "browser" ? "browser" : "server";
14
+ } catch {
15
+ return "server";
16
+ }
17
+ }
18
+ const BROWSER = mode() === "browser";
19
+
1
20
  // The dashboard reaches this app at /p/<label>/ through the workspace proxy,
2
21
  // so every link and asset must carry that prefix. product_run sets
3
22
  // CLAW_BASE_PATH at build AND start time; leave it unset to run at /.
@@ -17,7 +36,8 @@
17
36
  // (src/lib/products.ts productAllowedOrigins): the product's own FQDN in
18
37
  // production, the dashboard's dev origin under a path prefix. Hardcoding a
19
38
  // localhost origin here ships an app that works in dev and refuses every
20
- // write in production.
39
+ // write in production. A browser app has no Server Actions, so it takes
40
+ // none: its writes go to the platform's data door (lib/door.js).
21
41
  const allowedOrigins = (process.env.CLAW_ALLOWED_ORIGINS || "")
22
42
  .split(",")
23
43
  .map((o) => o.trim())
@@ -28,6 +48,8 @@ const allowedOrigins = (process.env.CLAW_ALLOWED_ORIGINS || "")
28
48
  // lookups) whose Origin host is not localhost or listed here; Next 15 only
29
49
  // warned. The preview's browser is on the product host, so without this
30
50
  // every such request answers 403. Hostnames only: Next compares no port.
51
+ // Both modes: a browser app still previews on `next dev` while it is
52
+ // built, so CLAW_ALLOWED_ORIGINS stays its preview's rule.
31
53
  const allowedDevOrigins = [
32
54
  ...new Set(
33
55
  allowedOrigins
@@ -42,6 +64,12 @@ const allowedDevOrigins = [
42
64
  // the production build the platform made, serves and reads as its proof
43
65
  // (.next/BUILD_ID). check/run.mjs says more.
44
66
  //
67
+ // Under output: "export" a custom distDir is where the export goes, and
68
+ // the build then works in .next anyway (Next 16, build/index.js). So a
69
+ // browser app is built with the default: the build in .next, the files
70
+ // in out/, which is what the platform publishes. Its check builds in a
71
+ // copy of the app, never in the tree.
72
+ //
45
73
  // CLAW_TURBOPACK_ROOT is set by `npm run check` alone, when it builds a
46
74
  // copy of an app folder it cannot write (check/run.mjs buildSite). The
47
75
  // copy's node_modules is a symlink back to the app's, and Turbopack (Next
@@ -65,6 +93,11 @@ const turbopackRoot = process.env.CLAW_TURBOPACK_ROOT || "";
65
93
  // turns off, the dev overlay's /__nextjs_attach-nodejs-inspector (it
66
94
  // opens a Node debugger on loopback); only the platform can wall that
67
95
  // (CHANGELOG, 0.6.0).
96
+ //
97
+ // Browser mode adds three: output "export" (every page a file); images
98
+ // unoptimized, a guard, since the export has no image server (nothing in
99
+ // the template uses next/image); and trailingSlash false, so a page is
100
+ // s/<key>.html, the file the platform's router looks for.
68
101
  const nextConfig = {
69
102
  basePath: process.env.CLAW_BASE_PATH || "",
70
103
  distDir: process.env.CLAW_DIST_DIR || ".next",
@@ -72,11 +105,12 @@ const nextConfig = {
72
105
  CLAW_BASE_PATH: process.env.CLAW_BASE_PATH || "",
73
106
  },
74
107
  agentRules: false,
108
+ ...(BROWSER ? { output: "export", images: { unoptimized: true }, trailingSlash: false } : {}),
75
109
  ...(allowedDevOrigins.length > 0 ? { allowedDevOrigins } : {}),
76
110
  ...(turbopackRoot ? { turbopack: { root: turbopackRoot }, outputFileTracingRoot: turbopackRoot } : {}),
77
111
  experimental: {
78
112
  mcpServer: false,
79
- ...(allowedOrigins.length > 0 ? { serverActions: { allowedOrigins } } : {}),
113
+ ...(!BROWSER && allowedOrigins.length > 0 ? { serverActions: { allowedOrigins } } : {}),
80
114
  },
81
115
  };
82
116
 
@@ -7,7 +7,8 @@
7
7
  * label what the nav shows
8
8
  * kind optional, free text, one or two words for the checklist
9
9
  * ("board", "inbox", "report") — not an enum, nothing keys on it
10
- * source the table the surface reads, when it reads one
10
+ * source the table the surface reads, when it reads one: its bare name
11
+ * ("investors"), which the app's own schema answers
11
12
  * home true on the one surface / opens; otherwise the first entry
12
13
  * component the surface's component. LEAVE IT OUT while the surface is
13
14
  * still planned: the nav shows it as planned and its page says
@@ -27,7 +28,7 @@
27
28
  // A domain surface, once built, looks like this:
28
29
  //
29
30
  // import Investors from "./surfaces/investors";
30
- // { key: "investors", label: "Investors", kind: "board", source: "public.investors", home: true, component: Investors },
31
+ // { key: "investors", label: "Investors", kind: "board", source: "investors", home: true, component: Investors },
31
32
 
32
33
  const surfaces = [];
33
34
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "next",
3
3
  "title": "Makersclaw app (Next.js 16)",
4
- "description": "The behaviour every app shares, the parts every app is assembled from, and none of the app's own look — the colours are the workspace's. It carries the data layer (lib/data.js, lib/db.js), the write actions that log activity (lib/actions.js), the _claw platform client with its identity wrapper, the ask bridge (a screen's ask becomes a request, answered in the desk's agent column) and the hooks that follow requests (lib/claw.js, lib/platform.js, lib/hooks.js), routing (/s/<key>), the request proxy (proxy.js), error boundaries, Tailwind v4 mapped to the workspace theme (app/globals.css + _claw/theme.css), the kit (components/ui), the parts bound to the data layer and to the live requests (components/parts) and `npm run check`. The app designs the inside of the App tab on top: app/shell.jsx and every domain surface, assembled from the kit and the blocks with tokens only.",
4
+ "description": "The behaviour every app shares, the parts every app is assembled from, and none of the app's own look — the colours are the workspace's. It carries the data layer (lib/data.js, lib/db.js), the write actions that log activity (lib/actions.js), the company brain through the platform's data door (lib/brain.js from the browser, lib/brain-server.js for server reads), the app's own tables through the same door from the browser (lib/door.js and its hooks; a browser app's lib/data.js and lib/actions.js re-export it), the _claw platform client with its identity wrapper, the ask bridge (a screen's ask becomes a request, answered in the desk's agent column) and the hooks that follow requests (lib/claw.js, lib/platform.js, lib/hooks.js), routing (/s/<key>), the request proxy (proxy.js), error boundaries, Tailwind v4 mapped to the workspace theme (app/globals.css + _claw/theme.css), the kit (components/ui), the parts bound to the data layer and to the live requests (components/parts) and `npm run check`. The app designs the inside of the App tab on top: app/shell.jsx and every domain surface, assembled from the kit and the blocks with tokens only.",
5
5
  "files": {
6
6
  "fixed": [
7
7
  "app/globals.css",
@@ -24,11 +24,17 @@
24
24
  "next.config.mjs",
25
25
  "postcss.config.mjs"
26
26
  ],
27
- "docs": ["README.md", "surfaces/README.md", "schema.sql"],
27
+ "docs": ["README.md", "surfaces/README.md"],
28
28
  "starter": ["app/shell.jsx", "surfaces.js"],
29
29
  "merged": ["package.json"],
30
30
  "retired": ["middleware.js"]
31
31
  },
32
+ "modes": {
33
+ "browser": {
34
+ "overlay": "browser",
35
+ "drop": ["proxy.js", "app/claw-alive/route.js", "lib/db.js", "lib/brain-server.js"]
36
+ }
37
+ },
32
38
  "components": [
33
39
  {
34
40
  "name": "button",
@@ -194,7 +200,7 @@
194
200
  "name": "item",
195
201
  "type": "component",
196
202
  "title": "Item, ItemGroup",
197
- "description": "The list row: media (an avatar, an image) or an icon, title, description, meta on the right, actions; href makes the whole row a link, onClick a button, neither static — actions still click on their own. aria-current, onClick, target and rel go on the row's link or button (aria-current fills the row); other props on the row. size default (56px) · sm (44px) · lg (64px); variant plain · outline · muted; layout row · stacked (a card for a grid: icon or media on top, title, description, meta at the foot, actions top-right, full cell height). ItemGroup stacks them with a rule between each (variant plain · outline).",
203
+ "description": "The list row: media (an avatar, an image) or an icon, title, description, meta on the right, actions; href makes the whole row a link, onClick a button, neither a plain row — actions still click on their own. aria-current, onClick, target and rel go on the row's link or button (aria-current fills the row); other props on the row. size default (56px) · sm (44px) · lg (64px); variant plain · outline · muted; layout row · stacked (a card for a grid: icon or media on top, title, description, meta at the foot, actions top-right, full cell height). ItemGroup stacks them with a rule between each (variant plain · outline).",
198
204
  "tags": ["item", "list", "row", "list item", "contact", "file", "settings row"],
199
205
  "files": ["components/ui/item.jsx"]
200
206
  },
@@ -1,22 +0,0 @@
1
- -- Reference only. artifact_scaffold creates this table in the workspace
2
- -- database when it copies the template; nothing in the app runs this file.
3
- -- (docs/ARTIFACT-CONTRACTS.md §4)
4
- --
5
- -- Every write the app makes (lib/actions.js → lib/db.js logActivity) and
6
- -- every action the artifact's agent takes (its brief tells it to insert
7
- -- here with the sql verb) lands in this table, keyed by the artifact id
8
- -- product_run passes as CLAW_ARTIFACT_ID. The Activity tab the OS draws on
9
- -- the app window reads it (§9b), and so can any surface via loadActivity.
10
-
11
- create table if not exists public.artifact_activity (
12
- id bigserial primary key,
13
- artifact_id uuid not null,
14
- at timestamptz not null default now(),
15
- action text not null, -- found, drafted, sent, replied, skipped, edited…
16
- surface text, -- surface key
17
- row_ref text, -- id in the surface's source table
18
- detail text, -- one sentence
19
- data jsonb not null default '{}'::jsonb,
20
- by text not null default 'agent' -- 'agent' | 'user:<email>' | 'run:<id>'
21
- );
22
- create index if not exists artifact_activity_artifact_at on public.artifact_activity (artifact_id, at desc);