@dexhq/canvas 0.15.0 → 0.16.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 (307) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/app/canvas/activity-parts.tsx +50 -6
  3. package/app/canvas/activity.tsx +2 -3
  4. package/app/canvas/agent-changes.ts +18 -8
  5. package/app/canvas/anchoring.ts +13 -3
  6. package/app/canvas/canvas-context.tsx +6 -2
  7. package/app/canvas/canvas-input.ts +35 -0
  8. package/app/canvas/canvas-model.ts +2 -2
  9. package/app/canvas/canvas-scene.ts +243 -24
  10. package/app/canvas/canvas-ui.ts +11 -2
  11. package/app/canvas/canvas.css +86 -3
  12. package/app/canvas/comments.tsx +66 -29
  13. package/app/canvas/element-link.ts +135 -0
  14. package/app/canvas/element-picker.ts +23 -0
  15. package/app/canvas/export-dialog.tsx +265 -0
  16. package/app/canvas/flow-canvas.tsx +65 -14
  17. package/app/canvas/frame-context-menu.tsx +61 -7
  18. package/app/canvas/frame-node.tsx +10 -11
  19. package/app/canvas/layout.ts +41 -22
  20. package/app/canvas/linked-element.tsx +196 -0
  21. package/app/canvas/live-page.ts +14 -0
  22. package/app/canvas/mentions.tsx +209 -0
  23. package/app/canvas/picked-box.tsx +21 -0
  24. package/app/canvas/removed-views-panel.tsx +4 -4
  25. package/app/canvas/request-node.tsx +151 -0
  26. package/app/canvas/review-panel.tsx +8 -3
  27. package/app/canvas/section-node.tsx +4 -133
  28. package/app/canvas/spec-margin.tsx +4 -1
  29. package/app/canvas/teammates-layer.tsx +205 -0
  30. package/app/canvas/text-layer.tsx +103 -17
  31. package/app/canvas/tool-cursors.ts +7 -6
  32. package/app/canvas/tool-icons.tsx +24 -56
  33. package/app/canvas/typing.ts +12 -0
  34. package/app/canvas/use-agent-changes.tsx +6 -2
  35. package/app/canvas/use-canvas-editor.ts +4 -2
  36. package/app/export/player-model.ts +159 -0
  37. package/app/export/player.tsx +198 -0
  38. package/app/export.html +31 -0
  39. package/app/export.tsx +9 -0
  40. package/app/frame/announce-refreshes.ts +21 -0
  41. package/app/frame/start-frame.tsx +50 -0
  42. package/app/frame/view-loads.ts +161 -0
  43. package/app/frame/views.ts +13 -49
  44. package/app/frame.tsx +2 -38
  45. package/app/i18n/locales/en/messages.po +145 -6
  46. package/app/i18n/locales/en/messages.ts +1 -1
  47. package/app/i18n/locales/pseudo/messages.po +144 -5
  48. package/app/i18n/locales/pseudo/messages.ts +1 -1
  49. package/app/icons/dex-glyphs.tsx +219 -0
  50. package/app/icons/glyphs.tsx +76 -80
  51. package/app/kit/use-flow.ts +2 -1
  52. package/app/live/canvas-teammates.ts +90 -0
  53. package/app/live/studio-api.ts +30 -20
  54. package/app/pages/canvas.tsx +18 -6
  55. package/app/pages/commands-settings.tsx +1 -1
  56. package/app/pages/render.tsx +39 -11
  57. package/app/shell/bell.tsx +15 -5
  58. package/app/shell/presence.tsx +123 -26
  59. package/app/shell/thread-list.tsx +25 -8
  60. package/app/shell/working-on.tsx +35 -3
  61. package/app/ui/prompt-editor.tsx +39 -11
  62. package/app/ui/reference.tsx +21 -8
  63. package/bin/sudio.mjs +1 -1
  64. package/dist/cli/commands/create.d.mts +5 -5
  65. package/dist/cli/commands/create.mjs +4 -4
  66. package/dist/cli/commands/export.d.mts +40 -0
  67. package/dist/cli/commands/export.mjs +66 -0
  68. package/dist/cli/commands/init.d.mts +2 -2
  69. package/dist/cli/commands/upgrade.mjs +1 -1
  70. package/dist/cli/help.d.mts +1 -1
  71. package/dist/cli/help.mjs +13 -7
  72. package/dist/cli/main.d.mts +42 -5
  73. package/dist/cli/main.mjs +1 -0
  74. package/dist/config/load.mjs +14 -2
  75. package/dist/config/project-files.d.mts +5 -0
  76. package/dist/config/project-files.mjs +10 -1
  77. package/dist/config/renamed.d.mts +7 -0
  78. package/dist/config/renamed.mjs +13 -1
  79. package/dist/content/commands.d.mts +11 -9
  80. package/dist/content/commands.mjs +22 -16
  81. package/dist/content/comments-log.mjs +2 -1
  82. package/dist/content/content.d.mts +11 -3
  83. package/dist/content/content.mjs +49 -15
  84. package/dist/content/element-words.d.mts +42 -0
  85. package/dist/content/element-words.mjs +112 -0
  86. package/dist/content/hosted-person.d.mts +31 -0
  87. package/dist/content/hosted-person.mjs +68 -0
  88. package/dist/content/merge-rules.d.mts +5 -0
  89. package/dist/content/merge-rules.mjs +17 -1
  90. package/dist/content/screenshot.mjs +9 -0
  91. package/dist/content/text-edit.d.mts +24 -14
  92. package/dist/content/text-edit.mjs +92 -81
  93. package/dist/content/text-replace.mjs +2 -26
  94. package/dist/content/thread-module.d.mts +2 -4
  95. package/dist/content/thread-module.mjs +4 -5
  96. package/dist/server/agents.d.mts +10 -0
  97. package/dist/server/agents.mjs +21 -6
  98. package/dist/server/canvas-presence.d.mts +22 -0
  99. package/dist/server/canvas-presence.mjs +160 -0
  100. package/dist/server/command-settings.mjs +1 -1
  101. package/dist/server/comments/actions.d.mts +0 -8
  102. package/dist/server/comments/actions.mjs +1 -9
  103. package/dist/server/comments/routes.mjs +10 -31
  104. package/dist/server/dev-server.mjs +35 -13
  105. package/dist/server/export/build.d.mts +15 -0
  106. package/dist/server/export/build.mjs +220 -0
  107. package/dist/server/export/page.d.mts +25 -0
  108. package/dist/server/export/page.mjs +40 -0
  109. package/dist/server/export/plugin.d.mts +31 -0
  110. package/dist/server/export/plugin.mjs +69 -0
  111. package/dist/server/export/run.d.mts +9 -0
  112. package/dist/server/export/run.mjs +61 -0
  113. package/dist/server/export/save.d.mts +7 -0
  114. package/dist/server/export/save.mjs +29 -0
  115. package/dist/server/hosted.d.mts +8 -0
  116. package/dist/server/hosted.mjs +78 -0
  117. package/dist/server/live-mirror.mjs +66 -10
  118. package/dist/server/live.mjs +28 -1
  119. package/dist/server/mcp.mjs +2 -0
  120. package/dist/server/me.d.mts +2 -0
  121. package/dist/server/me.mjs +8 -2
  122. package/dist/server/notices.d.mts +1 -1
  123. package/dist/server/notices.mjs +1 -1
  124. package/dist/server/own-copies.mjs +1 -1
  125. package/dist/server/people.d.mts +7 -2
  126. package/dist/server/people.mjs +6 -2
  127. package/dist/server/pictures.d.mts +1 -1
  128. package/dist/server/pictures.mjs +2 -2
  129. package/dist/server/prebundle.d.mts +32 -0
  130. package/dist/server/prebundle.mjs +115 -0
  131. package/dist/server/problems.d.mts +8 -0
  132. package/dist/server/problems.mjs +13 -0
  133. package/dist/server/requests.mjs +43 -30
  134. package/dist/server/source-stamp.d.mts +4 -3
  135. package/dist/server/source-stamp.mjs +60 -31
  136. package/dist/server/state.d.mts +19 -10
  137. package/dist/server/state.mjs +27 -18
  138. package/dist/server/thread-source.d.mts +8 -0
  139. package/dist/server/thread-source.mjs +24 -5
  140. package/dist/server/tools/export.d.mts +5 -0
  141. package/dist/server/tools/export.mjs +35 -0
  142. package/dist/server/tools/place-frame.mjs +16 -16
  143. package/dist/server/tools/thread-list.mjs +1 -1
  144. package/dist/server/vite.d.mts +9 -4
  145. package/dist/server/vite.mjs +63 -61
  146. package/dist/server/welcome.mjs +2 -1
  147. package/dist/setup/apply.d.mts +4 -0
  148. package/dist/setup/apply.mjs +5 -4
  149. package/dist/setup/create.mjs +5 -5
  150. package/dist/setup/design-system-checks.mjs +1 -6
  151. package/dist/setup/detect/workspace.d.mts +10 -10
  152. package/dist/setup/detect/workspace.mjs +10 -12
  153. package/dist/setup/doctor.d.mts +4 -1
  154. package/dist/setup/doctor.mjs +7 -5
  155. package/dist/setup/migrate/dex-folder.d.mts +61 -0
  156. package/dist/setup/migrate/dex-folder.mjs +544 -0
  157. package/dist/setup/migrate/files-folder.mjs +1 -1
  158. package/dist/setup/migrate/guides.mjs +1 -1
  159. package/dist/setup/migrate/migrations.mjs +4 -0
  160. package/dist/setup/migrate/setup-files.d.mts +5 -0
  161. package/dist/setup/migrate/setup-files.mjs +115 -0
  162. package/dist/setup/migrate/studio-state.d.mts +2 -2
  163. package/dist/setup/migrate/studio-state.mjs +4 -4
  164. package/dist/setup/placement.d.mts +1 -1
  165. package/dist/setup/placement.mjs +5 -4
  166. package/dist/setup/plan.d.mts +5 -5
  167. package/dist/setup/plan.mjs +8 -12
  168. package/dist/setup/project.mjs +1 -1
  169. package/dist/setup/prompts.d.mts +2 -1
  170. package/dist/setup/prompts.mjs +4 -3
  171. package/dist/setup/questions.mjs +3 -2
  172. package/dist/setup/starters.d.mts +1 -1
  173. package/dist/setup/starters.mjs +2 -2
  174. package/dist/setup/write.d.mts +15 -3
  175. package/dist/setup/write.mjs +23 -3
  176. package/dist/shared/canvas-core.d.mts +22 -7
  177. package/dist/shared/canvas-core.mjs +38 -10
  178. package/dist/shared/comments/routes.d.mts +3 -1
  179. package/dist/shared/comments/routes.mjs +4 -2
  180. package/dist/shared/export-core.d.mts +62 -0
  181. package/dist/shared/export-core.mjs +101 -0
  182. package/dist/shared/live-core.d.mts +2 -0
  183. package/dist/shared/live-core.mjs +6 -1
  184. package/dist/shared/live-presence.d.mts +57 -2
  185. package/dist/shared/live-presence.mjs +90 -4
  186. package/dist/shared/page-messages.d.mts +14 -1
  187. package/dist/shared/page-messages.mjs +30 -3
  188. package/dist/shared/people-core.d.mts +28 -0
  189. package/dist/shared/people-core.mjs +27 -1
  190. package/dist/shared/presence-core.d.mts +2 -0
  191. package/dist/shared/references-core.d.mts +4 -0
  192. package/dist/shared/references-core.mjs +12 -4
  193. package/dist/shared/studio-files.d.mts +9 -0
  194. package/dist/shared/studio-files.mjs +11 -2
  195. package/dist/shared/studio-routes.d.mts +13 -1
  196. package/dist/shared/threads-core.d.mts +27 -4
  197. package/dist/shared/threads-core.mjs +67 -12
  198. package/extension/dist/feedback.js +104 -294
  199. package/extension/dist/manifest.json +1 -1
  200. package/extension/dist/picker.js +104 -294
  201. package/package.json +2 -2
  202. package/src/cli/commands/create.ts +4 -4
  203. package/src/cli/commands/export.ts +78 -0
  204. package/src/cli/commands/upgrade.ts +1 -1
  205. package/src/cli/help.ts +13 -7
  206. package/src/cli/main.ts +1 -0
  207. package/src/config/load.ts +26 -2
  208. package/src/config/project-files.ts +15 -0
  209. package/src/config/renamed.ts +19 -1
  210. package/src/content/commands.ts +30 -18
  211. package/src/content/comments-log.ts +4 -1
  212. package/src/content/content.ts +64 -16
  213. package/src/content/element-words.ts +175 -0
  214. package/src/content/hosted-person.ts +107 -0
  215. package/src/content/merge-rules.ts +29 -0
  216. package/src/content/screenshot.ts +14 -0
  217. package/src/content/text-edit.ts +172 -105
  218. package/src/content/text-replace.ts +3 -32
  219. package/src/content/thread-module.ts +2 -4
  220. package/src/content/trash.ts +1 -1
  221. package/src/server/agents.ts +48 -17
  222. package/src/server/canvas-presence.ts +237 -0
  223. package/src/server/channel.ts +1 -1
  224. package/src/server/command-settings.ts +1 -1
  225. package/src/server/comments/actions.ts +0 -19
  226. package/src/server/comments/routes.ts +9 -54
  227. package/src/server/dev-server.ts +66 -26
  228. package/src/server/export/build.ts +310 -0
  229. package/src/server/export/page.ts +85 -0
  230. package/src/server/export/plugin.ts +138 -0
  231. package/src/server/export/run.ts +79 -0
  232. package/src/server/export/save.ts +38 -0
  233. package/src/server/hosted.ts +113 -0
  234. package/src/server/live-mirror.ts +93 -8
  235. package/src/server/live.ts +46 -1
  236. package/src/server/machine-update.ts +3 -3
  237. package/src/server/mcp.ts +2 -0
  238. package/src/server/me.ts +10 -1
  239. package/src/server/notices.ts +2 -2
  240. package/src/server/people.ts +11 -2
  241. package/src/server/pictures.ts +2 -2
  242. package/src/server/prebundle.ts +230 -0
  243. package/src/server/presence.ts +1 -1
  244. package/src/server/problems.ts +11 -0
  245. package/src/server/requests.ts +55 -40
  246. package/src/server/roster.ts +1 -1
  247. package/src/server/saved.ts +1 -1
  248. package/src/server/source-stamp.ts +118 -37
  249. package/src/server/state.ts +53 -31
  250. package/src/server/thread-source.ts +35 -3
  251. package/src/server/tools/export.ts +56 -0
  252. package/src/server/tools/place-frame.ts +23 -15
  253. package/src/server/tools/thread-list.ts +1 -1
  254. package/src/server/updates.ts +2 -2
  255. package/src/server/vite.ts +106 -110
  256. package/src/server/welcome.ts +3 -1
  257. package/src/setup/apply.ts +8 -5
  258. package/src/setup/create.ts +10 -10
  259. package/src/setup/design-system-checks.ts +1 -6
  260. package/src/setup/detect/workspace.ts +20 -21
  261. package/src/setup/doctor.ts +13 -6
  262. package/src/setup/migrate/dex-folder.ts +842 -0
  263. package/src/setup/migrate/files-folder.ts +1 -1
  264. package/src/setup/migrate/guides.ts +3 -1
  265. package/src/setup/migrate/migrations.ts +8 -2
  266. package/src/setup/migrate/setup-files.ts +198 -0
  267. package/src/setup/migrate/studio-state.ts +12 -10
  268. package/src/setup/own-app.ts +1 -1
  269. package/src/setup/placement.ts +7 -6
  270. package/src/setup/plan.ts +13 -18
  271. package/src/setup/project.ts +2 -2
  272. package/src/setup/prompts.ts +5 -4
  273. package/src/setup/questions.ts +6 -3
  274. package/src/setup/starters.ts +3 -3
  275. package/src/setup/write.ts +34 -3
  276. package/src/shared/canvas-core.ts +48 -9
  277. package/src/shared/comments/routes.ts +3 -1
  278. package/src/shared/export-core.ts +198 -0
  279. package/src/shared/live-core.ts +8 -0
  280. package/src/shared/live-presence.ts +171 -2
  281. package/src/shared/page-messages.ts +38 -2
  282. package/src/shared/people-core.ts +44 -0
  283. package/src/shared/presence-core.ts +2 -0
  284. package/src/shared/references-core.ts +22 -3
  285. package/src/shared/studio-files.ts +15 -1
  286. package/src/shared/studio-routes.ts +11 -1
  287. package/src/shared/threads-core.ts +132 -10
  288. package/templates/methods/explore.md +1 -1
  289. package/templates/methods/handoff.md +1 -1
  290. package/templates/methods/review.md +2 -1
  291. package/templates/rules/canvas-frames.md +6 -3
  292. package/templates/rules/commands.md +1 -0
  293. package/templates/rules/prototypes.md +1 -1
  294. package/templates/rules/studio.md +17 -11
  295. package/templates/skills/comprehend/SKILL.md +56 -0
  296. package/templates/skills/distill/SKILL.md +172 -0
  297. package/templates/skills/export-prototype/SKILL.md +35 -0
  298. package/templates/skills/riff/SKILL.md +21 -0
  299. package/templates/skills/riff-deep/SKILL.md +40 -0
  300. package/templates/skills/riff-max/SKILL.md +46 -0
  301. package/templates/skills/riff-state/SKILL.md +45 -0
  302. package/templates/skills/riff-up/SKILL.md +38 -0
  303. package/templates/skills/riff-wide/SKILL.md +40 -0
  304. package/templates/starters/standalone/README.md +1 -1
  305. package/templates/starters/turborepo/README.md +2 -2
  306. package/templates/starters/turborepo/apps/web/src/app.tsx +2 -2
  307. package/templates/starters/vite/README.md +1 -1
@@ -0,0 +1,35 @@
1
+ import { EXPORT_KINDS } from "../../shared/export-core.mjs";
2
+ import { Problems } from "../problems.mjs";
3
+ import { exportInChild } from "../export/run.mjs";
4
+ import { PROTOTYPE, prototypeFor } from "./prototype-name.mjs";
5
+ import { saveExport } from "../export/save.mjs";
6
+ import { z } from "zod";
7
+ //#region src/server/tools/export.ts
8
+ function registerExportTool(server, { ok, refuse, root }) {
9
+ server.registerTool("export", {
10
+ title: "Export a prototype",
11
+ description: "Export frames as a prototype that opens by double-click, offline: a zip of index.html, app.js and app.css in the person's Downloads, its path in the answer. kind: clickable (the frames, stepped through as Play does), pages (a page more per frame), content (the words the views read from content.json in content.js, to edit; prepare the views first, as the export-prototype skill says) or source (the prototype's files the bundle took). Give frames (section/row/frame keys) or sections, or neither for every section; flows lets people switch between them.",
12
+ inputSchema: {
13
+ prototype: PROTOTYPE.optional(),
14
+ kind: z.enum(EXPORT_KINDS).default("clickable"),
15
+ frames: z.array(z.string().min(1)).optional().describe("Frame keys, section/row/frame."),
16
+ sections: z.array(z.string().min(1)).optional(),
17
+ flows: z.boolean().default(false).describe("Let people switch between the exported flows.")
18
+ }
19
+ }, async ({ prototype, ...choice }) => {
20
+ const found = await prototypeFor(root, prototype);
21
+ if ("problem" in found) return refuse(found.problem);
22
+ try {
23
+ const path = await saveExport(await exportInChild(root, found.slug, choice));
24
+ return ok({
25
+ prototype: found.slug,
26
+ path
27
+ });
28
+ } catch (error) {
29
+ if (error instanceof Problems) return refuse(error.message);
30
+ throw error;
31
+ }
32
+ });
33
+ }
34
+ //#endregion
35
+ export { registerExportTool };
@@ -1,4 +1,5 @@
1
1
  import { NOT_RECOGNISED } from "../../shared/studio-routes.mjs";
2
+ import { requestCell } from "../../shared/canvas-core.mjs";
2
3
  import { resolvePrototype } from "../../content/prototypes.mjs";
3
4
  import { joinCurrentPerson, placeViewFrame } from "../../content/content.mjs";
4
5
  import { json } from "./result.mjs";
@@ -8,28 +9,26 @@ import { z } from "zod";
8
9
  /** Said after a save that leaves the person's canvas.json near live sync's limit. */
9
10
  const LARGE_CANVAS_NOTE = "The person's canvas.json is now over 400 KB. Live sync skips files over 512 KB, so their teammates may stop seeing their changes. Tell them, and suggest moving some sections to another file.";
10
11
  /**
11
- * The cell `place_frame` puts a frame in: a view request's, by its
12
- * thread, or the one given.
12
+ * Where `place_frame` puts a frame: a view request's cell, by its thread,
13
+ * at the size the person gave it; or the cell given.
13
14
  */
14
- async function cellFor(threads, input) {
15
+ async function placeFor(threads, input) {
15
16
  if (input.thread) {
16
17
  const thread = await threads.find(input.thread);
17
18
  if (!thread) return { problem: `No thread ${input.thread}. List them with \`threads\`.` };
18
19
  if (thread.slug !== input.prototype) return { problem: `Thread ${input.thread} is on ${thread.slug}, not ${input.prototype}.` };
19
20
  if (thread.target.kind !== "view") return { problem: `Thread ${input.thread} is not a request for a new view. Give the cell: section, step, and row for an existing row.` };
20
- const { section, row, step } = thread.target;
21
21
  return {
22
- section,
23
- step,
24
- ...row ? { row } : {}
22
+ cell: requestCell(thread.target),
23
+ size: thread.target.size
25
24
  };
26
25
  }
27
26
  if (!(input.section && input.step)) return { problem: "Say where the frame goes: the thread of a request for a new view, or a section and step (and a row, for an existing row)." };
28
- return {
27
+ return { cell: requestCell({
28
+ ...input,
29
29
  section: input.section,
30
- step: input.step,
31
- ...input.row ? { row: input.row } : {}
32
- };
30
+ step: input.step
31
+ }) };
33
32
  }
34
33
  /** Register `place_frame` on `server`. */
35
34
  function registerPlaceFrameTool(server, { refuse, root, threads, withNotice }) {
@@ -40,7 +39,7 @@ function registerPlaceFrameTool(server, { refuse, root, threads, withNotice }) {
40
39
  idempotentHint: true
41
40
  },
42
41
  title: "Put views on the canvas",
43
- description: "Add frames showing views you built to a file's canvas, several at once, each in a cell: give the thread of a request for a new view (its target names the cell), or the cell itself (section, step, and row for an existing row; leave row out for a new row at the end of the section). canvas.json is changed for you, safely while other agents change it too: do not edit it by hand for this. If a cell already shows the view, its frame is returned as it is. Returns each frame's key (\"section/row/frame\") and its uid, which picks follow.",
42
+ description: "Add frames showing views you built to a file's canvas, several at once, each in a cell: give the thread of a request for a new view (its target names the cell, and the size when the person set one), or the cell itself (section, step, and row for an existing row; leave row out for a new row at the end of the section, or give `above` for one right above that row). canvas.json is changed for you, safely while other agents change it too: do not edit it by hand for this. If a cell already shows the view, its frame is returned as it is. Returns each frame's key (\"section/row/frame\") and its uid, which picks follow.",
44
43
  inputSchema: {
45
44
  prototype: PROTOTYPE,
46
45
  frames: z.array(z.object({
@@ -48,6 +47,7 @@ function registerPlaceFrameTool(server, { refuse, root, threads, withNotice }) {
48
47
  thread: z.string().optional().describe("A request for a new view: its cell is used."),
49
48
  section: z.string().optional().describe("The section's id."),
50
49
  row: z.string().optional().describe("An existing row's id; leave out for a new row."),
50
+ above: z.string().optional().describe("With no row: the row the new row goes right above; leave out for the end of the section."),
51
51
  step: z.number().int().min(1).optional().describe("The column, from 1.")
52
52
  })).min(1)
53
53
  }
@@ -60,20 +60,20 @@ function registerPlaceFrameTool(server, { refuse, root, threads, withNotice }) {
60
60
  const frames = [];
61
61
  let large = false;
62
62
  for (const frame of input.frames) {
63
- const cell = await cellFor(threads, {
63
+ const place = await placeFor(threads, {
64
64
  ...frame,
65
65
  prototype: input.prototype
66
66
  });
67
- if ("problem" in cell) {
67
+ if ("problem" in place) {
68
68
  frames.push({
69
69
  view: frame.view,
70
- problem: cell.problem
70
+ problem: place.problem
71
71
  });
72
72
  continue;
73
73
  }
74
74
  const placed = await placeViewFrame({
75
75
  slug,
76
- cell,
76
+ ...place,
77
77
  view: frame.view,
78
78
  person
79
79
  }, root);
@@ -66,7 +66,7 @@ function registerThreadsTool(server, context) {
66
66
  _meta: ALWAYS_LOADED,
67
67
  annotations: { readOnlyHint: true },
68
68
  title: "Studio comments and requests",
69
- description: "Comments people left in Dex and their requests for new views: by default the ones that still need an agent, waiting or acknowledged (👀, with `held`: by whom, since when, and `yours`). Those on the page the person has open come first (`onOpenPage`), then the open file's, then other files'. Each names its file and element. `flowSpec` is a spec to read before answering; `commands` are skills the comment runs: follow each one's SKILL.md (`follow`), the comment's words its arguments; a target of kind \"view\" asks for a new view in that cell; a \"wireframe\" is boxes people drew, to build from the design system. `status` lists others: \"waiting\", \"open\" (discussions among people too), \"acknowledged\", \"resolved\", \"dismissed\" or \"all\". A long list comes shortened and says how to get the rest: `offset`, `limit`, or `id` for one thread with more of it.",
69
+ description: "Comments people left in Dex and their requests for new views: by default the ones that still need an agent, waiting or acknowledged (👀, with `held`: by whom, since when, and `yours`). Those on the page the person has open come first (`onOpenPage`), then the open file's, then other files'. Each names its file and element. `flowSpec` is a spec to read before answering; `commands` are skills the comment runs: follow each one's SKILL.md (`follow`), the comment's words its arguments; `views` are frames the comment names with @ (\"move this to @checkout\"), each with its file; a target of kind \"view\" asks for a new view in that cell; a \"wireframe\" is boxes people drew, to build from the design system. `status` lists others: \"waiting\", \"open\" (discussions among people too), \"acknowledged\", \"resolved\", \"dismissed\" or \"all\". A long list comes shortened and says how to get the rest: `offset`, `limit`, or `id` for one thread with more of it.",
70
70
  inputSchema: {
71
71
  prototype: PROTOTYPE.optional(),
72
72
  status: z.enum([
@@ -39,10 +39,15 @@ export interface StudioEntries {
39
39
  interface: string;
40
40
  }
41
41
  /**
42
- * Two stylesheets per project, one for each page. The frame page's is what
43
- * the real product would have: the design system's CSS (it brings Tailwind
44
- * and the tokens) and Tailwind told where the prototypes and the design
45
- * system's components are, and none of Dex's. The interface's is Dex's
42
+ * The frame page's stylesheet, written in `dir`: what the real product would
43
+ * have, the design system's CSS (it brings Tailwind and the tokens) and
44
+ * Tailwind told where the views are (`views`, folders) and where the design
45
+ * system's components are, and none of Dex's.
46
+ */
47
+ export declare function frameStylesheet(project: StudioProject, dir: string, views: string[]): string;
48
+ /**
49
+ * Two stylesheets per project, one for each page. The frame page's
50
+ * (frameStylesheet) reads every prototype's views. The interface's is Dex's
46
51
  * own, with the design system's first only when the interface takes it.
47
52
  */
48
53
  export declare function writeEntries(project: StudioProject): Promise<StudioEntries>;
@@ -1,4 +1,4 @@
1
- import { APP_DIR, PACKAGE_ROOT } from "../paths.mjs";
1
+ import { APP_DIR, PACKAGE_ROOT, posix as posix$1 } from "../paths.mjs";
2
2
  import { ME_META } from "../shared/studio-routes.mjs";
3
3
  import { publicThreads } from "../shared/threads-core.mjs";
4
4
  import { legacyState, prepareOutput, prepareState, studioOutput, studioState } from "./state.mjs";
@@ -16,16 +16,19 @@ import { componentFileProps, withConfiguredProps } from "../content/component-pr
16
16
  import { prepareContent } from "../content/first-run.mjs";
17
17
  import { lacksNext, next } from "./next.mjs";
18
18
  import { readBuildSettings } from "./build-settings.mjs";
19
+ import { canvasPresence } from "./canvas-presence.mjs";
19
20
  import { findWorkspaceIcon, readWorkspace, workspaceIconBytes } from "./workspace-settings.mjs";
20
21
  import { studioDev } from "./dev-server.mjs";
21
22
  import { fileErrors } from "./file-errors.mjs";
23
+ import { hostedPeople } from "./hosted.mjs";
24
+ import { interfaceDependencies, prebundleViews } from "./prebundle.mjs";
22
25
  import { projectPublic } from "./project-public.mjs";
23
26
  import { sourceStamp } from "./source-stamp.mjs";
24
27
  import { studioWebApp } from "./web-app.mjs";
25
28
  import { createRequire } from "node:module";
26
29
  import { existsSync, readFileSync } from "node:fs";
27
30
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
28
- import { readFile, readdir, rm, writeFile } from "node:fs/promises";
31
+ import { readFile, rm, writeFile } from "node:fs/promises";
29
32
  import { normalizePath, searchForWorkspaceRoot } from "vite";
30
33
  import { makeConfig } from "@lingui/conf";
31
34
  import tailwindcss from "@tailwindcss/vite";
@@ -33,12 +36,6 @@ import react from "@vitejs/plugin-react";
33
36
  //#region src/server/vite.ts
34
37
  const ENTRY_CSS_RE = /^@studio-entry\.css$/;
35
38
  const FRAME_CSS_RE = /^@studio-frame\.css$/;
36
- const SOURCE_FILE_RE = /\.(?:ts|tsx)$/;
37
- const TEST_FILE_RE = /\.(?:test|bench)\./;
38
- const TEST_SUPPORT_DIR = "testing";
39
- const BARE_IMPORT_RE = /^\s*import\s+(?!type\s)[^"';]*?from\s+["']([^"'./][^"']*)["']|import\(\s*["']([^"'./][^"']*)["']\s*\)/gm;
40
- const SIDE_EFFECT_IMPORT_RE = /^\s*import\s+["']([^"'./][^"']*)["']/gm;
41
- const OWN_ALIASES = ["@studio"];
42
39
  const INTERFACE_COMPONENT_RE = /^@studio\/ui\/shadcn\/([a-z-]+)$/;
43
40
  const INTERFACE_COMPONENT = "studio-interface-component:";
44
41
  const PACKAGED_COMPONENTS = join(APP_DIR, "ui", "shadcn");
@@ -146,76 +143,79 @@ function componentsRoot(project) {
146
143
  if (!path || path.startsWith("..") || isAbsolute(path) || folder.split(sep).includes("node_modules")) return folder;
147
144
  return join(home, path.split(sep)[0] ?? "");
148
145
  }
146
+ /** A stylesheet's imports, as `@import` lines relative to `dir`. */
147
+ const importLines = (dir, entries) => entries.map(({ entry, layer }) => {
148
+ return `@import "${isAbsolute(entry) ? posixFrom(dir, entry) : entry}"${layer ? ` layer(${layer})` : ""};`;
149
+ });
150
+ const posixFrom = (dir, path) => posix$1(relative(dir, path));
151
+ /**
152
+ * `@source` lines for folders given as paths, or aliases like
153
+ * "@/components/ui" the project's tsconfig maps, relative to `dir`.
154
+ */
155
+ const sourceLines = (project, dir, values) => [...new Set(values.map((value) => value && folderOf(value, project.root)).filter((folder) => Boolean(folder)).map((folder) => `@source "${posixFrom(dir, folder)}";`))];
156
+ /**
157
+ * Tailwind 3's config, for Tailwind 4 wherever the design system's theme is
158
+ * used: the one beside the components views render (Dub's packages/ui, for
159
+ * its semantic classes), else the project's own.
160
+ */
161
+ const tailwind3Lines = (project, dir) => {
162
+ const config = tailwind3Config([project.designSystem?.componentPackage, project.root])?.config;
163
+ return config ? [`@config "${posixFrom(dir, config)}";`] : [];
164
+ };
165
+ /**
166
+ * The frame page's stylesheet, written in `dir`: what the real product would
167
+ * have, the design system's CSS (it brings Tailwind and the tokens) and
168
+ * Tailwind told where the views are (`views`, folders) and where the design
169
+ * system's components are, and none of Dex's.
170
+ */
171
+ function frameStylesheet(project, dir, views) {
172
+ const tailwind = tailwindSetup(project.root);
173
+ return [
174
+ GENERATED,
175
+ LAYER_ORDER,
176
+ ...importLines(dir, designSystemStyles(project, tailwind, resetsViews(project))),
177
+ `@import "${posixFrom(dir, join(APP_DIR, "frame.css"))}";`,
178
+ ...tailwind3Lines(project, dir),
179
+ ...views.map((folder) => `@source "${posixFrom(dir, folder)}";`),
180
+ ...sourceLines(project, dir, [componentsRoot(project)]),
181
+ ""
182
+ ].join("\n");
183
+ }
149
184
  /**
150
- * Two stylesheets per project, one for each page. The frame page's is what
151
- * the real product would have: the design system's CSS (it brings Tailwind
152
- * and the tokens) and Tailwind told where the prototypes and the design
153
- * system's components are, and none of Dex's. The interface's is Dex's
185
+ * Write a generated file only when it changes: the development server
186
+ * watches these, and a rewrite of the same text reloads every open page's
187
+ * styles.
188
+ */
189
+ async function writeChanged(file, text) {
190
+ if (await readFile(file, "utf8").catch(() => void 0) !== text) await writeFile(file, text);
191
+ }
192
+ /**
193
+ * Two stylesheets per project, one for each page. The frame page's
194
+ * (frameStylesheet) reads every prototype's views. The interface's is Dex's
154
195
  * own, with the design system's first only when the interface takes it.
155
196
  */
156
197
  async function writeEntries(project) {
157
198
  const { dir, entryCss, frameCss } = studioState(project.content);
158
199
  await prepareState(project.content);
159
- const from = (path) => relative(dir, path).split(sep).join("/");
160
- const imports = (entries) => entries.map(({ entry, layer }) => {
161
- return `@import "${isAbsolute(entry) ? from(entry) : entry}"${layer ? ` layer(${layer})` : ""};`;
162
- });
163
- const sources = (values) => [...new Set(values.map((value) => value && folderOf(value, project.root)).filter((folder) => Boolean(folder)).map((folder) => `@source "${from(folder)}";`))];
164
200
  const tailwind = tailwindSetup(project.root);
165
- const tailwind3 = tailwind3Config([project.designSystem?.componentPackage, project.root])?.config;
166
- const config = tailwind3 ? [`@config "${from(tailwind3)}";`] : [];
167
201
  const takesDesignSystem = interfaceTakesDesignSystem(project);
168
- const frame = [
169
- GENERATED,
170
- LAYER_ORDER,
171
- ...imports(designSystemStyles(project, tailwind, resetsViews(project))),
172
- `@import "${from(join(APP_DIR, "frame.css"))}";`,
173
- ...config,
174
- `@source "${from(prototypesDir(project.content))}";`,
175
- ...sources([componentsRoot(project)]),
176
- ""
177
- ].join("\n");
178
202
  const own = [
179
203
  GENERATED,
180
204
  LAYER_ORDER,
181
- ...imports(takesDesignSystem ? designSystemStyles(project, tailwind, true) : [{ entry: tailwindModule(tailwind) }]),
182
- `@import "${from(join(APP_DIR, "styles.css"))}";`,
183
- ...takesDesignSystem ? config : [],
184
- ...sources([project.ui?.components, primitivesFrom(project)]),
205
+ ...importLines(dir, takesDesignSystem ? designSystemStyles(project, tailwind, true) : [{ entry: tailwindModule(tailwind) }]),
206
+ `@import "${posixFrom(dir, join(APP_DIR, "styles.css"))}";`,
207
+ ...takesDesignSystem ? tailwind3Lines(project, dir) : [],
208
+ ...sourceLines(project, dir, [project.ui?.components, primitivesFrom(project)]),
185
209
  ...project.ui?.accent ? [`:root, .dark { --studio-accent: ${project.ui.accent}; }`] : [],
186
210
  ""
187
211
  ].join("\n");
188
- await writeFile(frameCss, frame);
189
- await writeFile(entryCss, own);
212
+ await writeChanged(frameCss, frameStylesheet(project, dir, [prototypesDir(project.content)]));
213
+ await writeChanged(entryCss, own);
190
214
  return {
191
215
  frame: frameCss,
192
216
  interface: entryCss
193
217
  };
194
218
  }
195
- const isOwn = (specifier) => OWN_ALIASES.some((alias) => specifier === alias || specifier.startsWith(`${alias}/`)) || specifier.startsWith("@studio-") || specifier.startsWith("virtual:");
196
- /** The libraries one source file imports, not counting the studio's own. */
197
- const importsIn = (source) => [BARE_IMPORT_RE, SIDE_EFFECT_IMPORT_RE].flatMap((re) => [...source.matchAll(re)]).map((match) => match[1] ?? match[2]).filter((specifier) => Boolean(specifier) && !specifier.endsWith(".css") && !isOwn(specifier));
198
- /** Every source file under a folder, tests and what they share aside. */
199
- async function sourceFiles(dir) {
200
- const files = [];
201
- for (const entry of await readdir(dir, { withFileTypes: true })) {
202
- const path = join(dir, entry.name);
203
- if (entry.isDirectory()) {
204
- if (entry.name !== TEST_SUPPORT_DIR) files.push(...await sourceFiles(path));
205
- } else if (SOURCE_FILE_RE.test(entry.name) && !TEST_FILE_RE.test(entry.name)) files.push(path);
206
- }
207
- return files;
208
- }
209
- /**
210
- * Every library the studio's own interface imports. Installed from npm, the
211
- * interface lives in node_modules, where Vite neither crawls imports nor
212
- * converts CommonJS for the browser, so they are listed for it to prepare.
213
- */
214
- async function interfaceDependencies() {
215
- const found = /* @__PURE__ */ new Set();
216
- for (const file of await sourceFiles(APP_DIR)) for (const specifier of importsIn(await readFile(file, "utf8"))) if (!MACRO_IMPORT_RE.test(specifier)) found.add(specifier);
217
- return [...found].sort();
218
- }
219
219
  const LINGUI_MACRO = "@lingui/babel-plugin-lingui-macro";
220
220
  /**
221
221
  * What Lingui's macro needs to compile the interface's messages, made here
@@ -228,7 +228,6 @@ const lingui = () => makeConfig({
228
228
  locales: ["en"],
229
229
  sourceLocale: "en"
230
230
  }, { skipValidation: true });
231
- const MACRO_IMPORT_RE = /\/macro$/;
232
231
  const SCRIPT_RE = /\.[cm]?[jt]sx?$/;
233
232
  /**
234
233
  * Compile Lingui's macros in the studio's own interface. React's plugin
@@ -676,6 +675,7 @@ async function viteConfig(project, mode) {
676
675
  envDir: project.root,
677
676
  define: { "process.env.NODE_ENV": JSON.stringify(mode) },
678
677
  plugins: [
678
+ hostedPeople(),
679
679
  studioMacros(),
680
680
  oneInterfaceCopy(),
681
681
  sourceStamp(project.content, project.designSystem?.imports ?? [], { places: stampsSources(features()) }),
@@ -692,6 +692,8 @@ async function viteConfig(project, mode) {
692
692
  ...project.plugins,
693
693
  ...await lacksNext(project) ? [next()] : [],
694
694
  studioDev(project),
695
+ canvasPresence(),
696
+ prebundleViews(project),
695
697
  fileErrors(project.content, componentsRoot(project)),
696
698
  studioWebApp(project),
697
699
  projectPublic(project.root)
@@ -748,4 +750,4 @@ async function viteConfig(project, mode) {
748
750
  return project.vite ? await project.vite(config, { mode }) : config;
749
751
  }
750
752
  //#endregion
751
- export { SAVE_TEMPORARY, hostTag, importsTailwind, meTag, oneInterfaceCopy, primitivesFrom, projectBaseUrlResolver, studioComponents, studioProvider, studioThreads, viteConfig, workspaceTag, writeEntries };
753
+ export { SAVE_TEMPORARY, frameStylesheet, hostTag, importsTailwind, meTag, oneInterfaceCopy, primitivesFrom, projectBaseUrlResolver, studioComponents, studioProvider, studioThreads, viteConfig, workspaceTag, writeEntries };
@@ -1,5 +1,6 @@
1
1
  import { nameOfMe } from "../shared/studio-routes.mjs";
2
2
  import { personalFolder } from "./personal-folder.mjs";
3
+ import { isHosted } from "../content/hosted-person.mjs";
3
4
  import { readMe } from "./me.mjs";
4
5
  import { join } from "node:path";
5
6
  import { execFile } from "node:child_process";
@@ -19,7 +20,7 @@ const welcomed = async () => {
19
20
  const gitEmail = (content) => new Promise((done) => execFile("git", ["config", "user.email"], { cwd: content }, (_, out) => done(String(out ?? "").trim())));
20
21
  /** Whether to welcome the person, and who Dex takes them to be. */
21
22
  const readWelcome = async (content) => {
22
- if (await welcomed()) return {
23
+ if (isHosted() || await welcomed()) return {
23
24
  due: false,
24
25
  name: "",
25
26
  email: ""
@@ -59,6 +59,10 @@ export declare function studioDesignSystem(findings: ProjectFindings, decisions:
59
59
  * yet, but its folder was chosen.
60
60
  */
61
61
  export declare function nextFolders(packageDir: string, decisions: SetupDecisions, componentPackage: string | undefined): (string | undefined)[];
62
+ /** A package.json, changed by `change`, written back. */
63
+ export declare function editManifest(file: string, change: (manifest: Record<string, unknown>) => void): Promise<void>;
64
+ /** It extends the tsconfig the dev server resolves views' imports through. */
65
+ export declare function studioTsconfig(folders: Folders): string;
62
66
  /** The project's tsconfig as the studio's extends it: "../tsconfig.json". */
63
67
  export declare function projectTsconfig({ content, packageDir }: Folders): string | undefined;
64
68
  /** How the studio's DESIGN.md started: drafted, imported, or left as it was. */
@@ -12,7 +12,7 @@ import { agentName, componentsChoice, connectInStudio } from "./project.mjs";
12
12
  import { nextPackage } from "../server/next.mjs";
13
13
  import { choicesOnly } from "./config-choices.mjs";
14
14
  import { formatAsProject, keepLockfilesFormatted, readLockfiles } from "./host-format.mjs";
15
- import { STUDIO_TYPES, configSource, designSystemConfig, fromStudio, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, tsconfigJson, withEsbuildBuilds, withIgnoreLines, withPointer } from "./write.mjs";
15
+ import { STUDIO_TYPES, configSource, designSystemConfig, fromStudio, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, renamedScripts, tsconfigJson, withEsbuildBuilds, withIgnoreLines, withPointer } from "./write.mjs";
16
16
  import { appPackageJson, appTsconfigJson, turboJson } from "./own-app.mjs";
17
17
  import { PROVIDER_FILE } from "./questions.mjs";
18
18
  import { commandLine, planCounts } from "./plan.mjs";
@@ -198,9 +198,10 @@ async function writeStep(step, context) {
198
198
  const own = plan.target.kind === "own-app";
199
199
  await editManifest(file, (manifest) => {
200
200
  const scripts = recordAt(manifest, "scripts");
201
- if (!own) manifest.scripts = {
201
+ manifest.scripts = {
202
202
  ...scripts,
203
- ...missingScripts(scripts)
203
+ ...renamedScripts(scripts),
204
+ ...own ? {} : missingScripts(scripts)
204
205
  };
205
206
  if (spec) manifest.devDependencies = {
206
207
  ...recordAt(manifest, "devDependencies"),
@@ -455,4 +456,4 @@ async function applyPlan(plan, context) {
455
456
  };
456
457
  }
457
458
  //#endregion
458
- export { applyPlan, foldersOf, nextFolders, projectTsconfig, runCommand, studioDesignSystem };
459
+ export { applyPlan, editManifest, foldersOf, nextFolders, projectTsconfig, runCommand, studioDesignSystem, studioTsconfig };
@@ -242,7 +242,7 @@ function nextLines(decisions, result, { blockers = [], cwd, root, placement }) {
242
242
  })}`, `Check the setup any time: ${inPackage}${dex} doctor`);
243
243
  return lines;
244
244
  }
245
- /** Where the studio's commands find its config: "cd apps/studio && ", or "". */
245
+ /** Where the studio's commands find its config: "cd apps/dex && ", or "". */
246
246
  function cdInto(placement) {
247
247
  if (!placement) return "";
248
248
  const folder = placement.kind === "own-app" ? placement.folder : placement.packageFolder;
@@ -330,9 +330,9 @@ function ending(installed, flags, blocked) {
330
330
  }
331
331
  /** --app and --in choose a place in a workspace: a single project has none. */
332
332
  function refuseWorkspaceFlags(flags) {
333
- if (flags.app !== void 0 || flags.in !== void 0) throw new Error(`${flags.app === void 0 ? "--in" : "--app"} is for a workspace, and this is a single project: the studio goes in its studio/ folder (--dir).`);
333
+ if (flags.app !== void 0 || flags.in !== void 0) throw new Error(`${flags.app === void 0 ? "--in" : "--app"} is for a workspace, and this is a single project: the studio goes in its Dex folder, dex/ (--dir).`);
334
334
  }
335
- /** A single project (or a package set up by itself): the studio in studio/. */
335
+ /** A single project (or a package set up by itself): the studio in dex/. */
336
336
  async function prepareProject(root, flags, ui, { ask, deps }) {
337
337
  const findings = await findProject(root, { userAgent: deps.userAgent });
338
338
  reportFindings(ui, findings);
@@ -801,7 +801,7 @@ function agentsInPlan(agents) {
801
801
  return agents.ids.length > 0 ? agents.ids.join(",") : "no agents";
802
802
  }
803
803
  /** Where the studio goes in a new project, as the plan says it. */
804
- const studioPlace = ({ starter, dir }) => starter.workspace ? "its own app, apps/studio" : `${dir}/`;
804
+ const studioPlace = ({ starter, dir }) => starter.workspace ? "its own app, apps/dex" : `${dir}/`;
805
805
  /** `create --dry-run` in an empty folder: what it would do, writing nothing. */
806
806
  function newProjectPlan(ui, project, flags) {
807
807
  const agents = agentsInPlan(project.agents);
@@ -885,7 +885,7 @@ function checkNewProjectFlags(flags) {
885
885
  studioDir(flags.dir);
886
886
  if (flags.pm !== void 0) packageManagerName(flags.pm);
887
887
  const named = flags.template === void 0 ? void 0 : starterNamed(flags.template);
888
- if (named?.workspace && flags.dir !== void 0) throw new Error(`--dir is for a studio inside an app; in a ${named.label} the studio is an app of its own, apps/studio.`);
888
+ if (named?.workspace && flags.dir !== void 0) throw new Error(`--dir is for a studio inside an app; in a ${named.label} the studio is an app of its own, apps/dex.`);
889
889
  return named;
890
890
  }
891
891
  /** How a new project's output ends: where it is, and how to start. */
@@ -1,5 +1,5 @@
1
1
  import { posix as posix$1 } from "../paths.mjs";
2
- import { componentsJsonError, installedPackageDir, projectPaths } from "../config/project-files.mjs";
2
+ import { componentsJsonError, installedPackageDir, packageOf, projectPaths } from "../config/project-files.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { existsSync, readFileSync, readdirSync } from "node:fs";
5
5
  import { dirname, isAbsolute, join, relative } from "node:path";
@@ -15,11 +15,6 @@ const canResolve = (from, specifier) => {
15
15
  };
16
16
  /** A path as doctor prints it: from the config's folder. */
17
17
  const shown = (file, root) => posix$1(relative(root, file)) || ".";
18
- /** A package name from an import pattern: "@acme/ui/*" → "@acme/ui". */
19
- const packageOf = (pattern) => {
20
- const parts = pattern.replace(WILDCARD_RE, "").split("/");
21
- return pattern.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
22
- };
23
18
  const SCOPE_WILDCARD_RE = /^(@[^/]+)\/\*$/;
24
19
  /** The scope a whole-scope pattern allows: "@mantine/*" → "@mantine". */
25
20
  const scopeOf = (pattern) => SCOPE_WILDCARD_RE.exec(pattern)?.[1];
@@ -117,25 +117,25 @@ export declare const componentFolders: (workspace: Workspace) => ComponentsFolde
117
117
  export interface OwnAppPlacement {
118
118
  /** Absolute. */
119
119
  dir: string;
120
- /** The flag that chooses it without a prompt: "--app studio". */
120
+ /** The flag that chooses it without a prompt: "--app dex". */
121
121
  flag: string;
122
- /** Relative to the workspace root: "apps/studio". */
122
+ /** Relative to the workspace root: "apps/dex". */
123
123
  folder: string;
124
124
  kind: "own-app";
125
- /** The folder's last part and the package name's: "studio". */
125
+ /** The folder's last part and the package name's: "dex". */
126
126
  name: string;
127
- /** "@acme/studio", or the bare name without a scope. */
127
+ /** "@acme/dex", or the bare name without a scope. */
128
128
  packageName: string;
129
129
  /** Why this choice would not work well, when it is offered anyway. */
130
130
  warning?: string;
131
131
  }
132
- /** The studio in a studio/ folder of an existing package. */
132
+ /** The studio in a Dex folder, dex/, of an existing package. */
133
133
  export interface InsideAppPlacement {
134
134
  /** The studio's folder, absolute. */
135
135
  dir: string;
136
136
  /** The flag that chooses it without a prompt: "--in apps/web". */
137
137
  flag: string;
138
- /** The studio's folder, relative to the workspace root: "apps/web/studio". */
138
+ /** The studio's folder, relative to the workspace root: "apps/web/dex". */
139
139
  folder: string;
140
140
  kind: "inside-app";
141
141
  /** The package it goes in, absolute. */
@@ -176,21 +176,21 @@ export interface ComponentsLocation {
176
176
  /** Whether the globs take in `folder`: one matches it and no "!negation" does. */
177
177
  export declare function globsInclude(globs: readonly string[], folder: string): boolean;
178
178
  /**
179
- * The studio's own app, named "studio" unless that folder or name is taken,
179
+ * The studio's own app, named "dex" unless that folder or name is taken,
180
180
  * in a folder the workspace's globs take in, so it is installed as a package.
181
181
  * When none does ("apps/site-*"), apps/<name>, with a warning to add it.
182
182
  */
183
183
  export declare function ownAppPlacement(workspace: Workspace): OwnAppPlacement;
184
184
  /** Why a new app in `folder` would not be installed: no glob takes it in. */
185
185
  export declare function outsideGlobs(workspace: Workspace, folder: string): string | undefined;
186
- /** The studio in a studio/ folder of `app`. */
186
+ /** The studio in a Dex folder, dex/, of `app`. */
187
187
  export declare function insideAppPlacement(app: WorkspacePackage): InsideAppPlacement;
188
188
  /**
189
189
  * Where the studio should go in `workspace`, given where its components are
190
190
  * (detected with componentFolders, or given by the person) and the folder
191
191
  * the command runs from:
192
192
  *
193
- * 1. components in a shared package (packages/ui): its own app, apps/studio,
193
+ * 1. components in a shared package (packages/ui): its own app, apps/dex,
194
194
  * even when run from inside an app;
195
195
  * 2. run from inside an app that holds components, or when no package holds
196
196
  * any: inside that app first;
@@ -200,7 +200,7 @@ export declare function insideAppPlacement(app: WorkspacePackage): InsideAppPlac
200
200
  * 4. components in several apps and no shared package: no safe default;
201
201
  * 5. no components anywhere: its own app.
202
202
  *
203
- * Outside a workspace the studio goes in studio/ of the project.
203
+ * Outside a workspace the studio goes in the project's Dex folder, dex/.
204
204
  */
205
205
  export declare function recommendPlacement(workspace: Workspace, components: readonly ComponentsLocation[], cwd: string): PlacementAdvice;
206
206
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { isDirectory, posix as posix$1 } from "../../paths.mjs";
2
2
  import { isRecord } from "../../shared/checks.mjs";
3
+ import "../../shared/studio-files.mjs";
3
4
  import { listing } from "../../shared/listing.mjs";
4
5
  import { found } from "../findings.mjs";
5
6
  import { existsSync, readFileSync, readdirSync } from "node:fs";
@@ -517,11 +518,8 @@ function findWorkspace(startDir) {
517
518
  }
518
519
  /** Every package's components folder, for recommendPlacement. */
519
520
  const componentFolders = (workspace) => workspace.packages.flatMap(({ components }) => components ? [components.value] : []);
520
- const STUDIO_FOLDER = "studio";
521
- const APP_NAMES = ["studio", "design-studio"];
522
- const NUMBERED_NAMES = 20;
523
- /** studio, design-studio, then studio-2, studio-3 and so on. */
524
- const CANDIDATE_NAMES = [...APP_NAMES, ...Array.from({ length: NUMBERED_NAMES }, (_, index) => `studio-${index + 2}`)];
521
+ /** dex, then dex-2, dex-3 and so on. */
522
+ const CANDIDATE_NAMES = ["dex", ...Array.from({ length: 20 }, (_, index) => `dex-${index + 2}`)];
525
523
  /** Whether the globs take in `folder`: one matches it and no "!negation" does. */
526
524
  function globsInclude(globs, folder) {
527
525
  const path = folder.split("/");
@@ -545,7 +543,7 @@ function appsFolders(globs) {
545
543
  }
546
544
  const inFolder = (parent, name) => parent ? `${parent}/${name}` : name;
547
545
  /**
548
- * The studio's own app, named "studio" unless that folder or name is taken,
546
+ * The studio's own app, named "dex" unless that folder or name is taken,
549
547
  * in a folder the workspace's globs take in, so it is installed as a package.
550
548
  * When none does ("apps/site-*"), apps/<name>, with a warning to add it.
551
549
  */
@@ -568,7 +566,7 @@ function ownAppPlacement(workspace) {
568
566
  if (name) return placement(parent, name);
569
567
  }
570
568
  let name = CANDIDATE_NAMES.find((candidate) => free("apps", candidate));
571
- for (let number = 22; !name; number += 1) name = free("apps", `studio-${number}`) ? `studio-${number}` : void 0;
569
+ for (let number = 22; !name; number += 1) name = free("apps", `dex-${number}`) ? `dex-${number}` : void 0;
572
570
  const fallback = placement("apps", name);
573
571
  const warning = outsideGlobs(workspace, fallback.folder);
574
572
  return warning ? {
@@ -582,15 +580,15 @@ function outsideGlobs(workspace, folder) {
582
580
  if (globs.length === 0 || globsInclude(globs, folder)) return;
583
581
  return `${folder} is not in the workspace's globs (${workspace.globs.evidence}: ${globs.join(", ")}), so it would not be installed: add it there`;
584
582
  }
585
- /** The studio in a studio/ folder of `app`. */
583
+ /** The studio in a Dex folder, dex/, of `app`. */
586
584
  function insideAppPlacement(app) {
587
585
  return {
588
586
  kind: "inside-app",
589
587
  packageDir: app.dir,
590
588
  packageFolder: app.folder,
591
589
  packageName: app.name,
592
- dir: join(app.dir, STUDIO_FOLDER),
593
- folder: app.folder === "." ? STUDIO_FOLDER : `${app.folder}/${STUDIO_FOLDER}`,
590
+ dir: join(app.dir, "dex"),
591
+ folder: app.folder === "." ? "dex" : `${app.folder}/dex`,
594
592
  flag: `--in ${app.folder}`
595
593
  };
596
594
  }
@@ -683,7 +681,7 @@ function hereWithWarning(here, holders) {
683
681
  * (detected with componentFolders, or given by the person) and the folder
684
682
  * the command runs from:
685
683
  *
686
- * 1. components in a shared package (packages/ui): its own app, apps/studio,
684
+ * 1. components in a shared package (packages/ui): its own app, apps/dex,
687
685
  * even when run from inside an app;
688
686
  * 2. run from inside an app that holds components, or when no package holds
689
687
  * any: inside that app first;
@@ -693,7 +691,7 @@ function hereWithWarning(here, holders) {
693
691
  * 4. components in several apps and no shared package: no safe default;
694
692
  * 5. no components anywhere: its own app.
695
693
  *
696
- * Outside a workspace the studio goes in studio/ of the project.
694
+ * Outside a workspace the studio goes in the project's Dex folder, dex/.
697
695
  */
698
696
  function recommendPlacement(workspace, components, cwd) {
699
697
  const [project] = workspace.packages;
@@ -1,6 +1,7 @@
1
1
  import { Update } from "../shared/update-core.mjs";
2
2
  import { StudioProject } from "../config/load.mjs";
3
3
  import { Check, Reporter } from "../cli/ui.mjs";
4
+ import { AgentSetup } from "../server/agents.mjs";
4
5
  import { DoctorLog } from "./design-system-checks.mjs";
5
6
  import { GitProbes } from "./git-checks.mjs";
6
7
  //#region src/setup/doctor.d.ts
@@ -24,8 +25,10 @@ export declare const startProblems: (root: string) => StartProblem[];
24
25
  * Each agent's setup, as the studio's "Connect your agent" dialog shows it:
25
26
  * agent setup decides what counts, so the two always agree. Agents the
26
27
  * studio cannot add itself to have no config it can read, so are left out.
28
+ * One that lacks only Dex's names is upgrade's (migrate/setup-files.ts),
29
+ * which says so. Returns the setups it checked.
27
30
  */
28
- export declare function checkAgentSetups(root: string, content: string, { ok, note, warn }: Pick<DoctorLog, "note" | "ok" | "warn">, agentRoot?: string): Promise<void>;
31
+ export declare function checkAgentSetups(root: string, content: string, { ok, note, warn }: Pick<DoctorLog, "note" | "ok" | "warn">, agentRoot?: string): Promise<AgentSetup[]>;
29
32
  /**
30
33
  * What `dex upgrade` would change, from the same plan it makes: a line
31
34
  * naming it for each migration with something to do (a failure when the