@1agh/maude 2.0.3 → 2.0.6

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 (242) hide show
  1. package/README.md +6 -5
  2. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  3. package/apps/studio/access/filters.ts +12 -5
  4. package/apps/studio/access/known-canvases.ts +24 -1
  5. package/apps/studio/access/refused-inputs.ts +89 -0
  6. package/apps/studio/access/request.ts +0 -1
  7. package/apps/studio/acp/adapter-stderr.ts +43 -13
  8. package/apps/studio/acp/background-tasks.ts +155 -0
  9. package/apps/studio/acp/bridge.ts +44 -5
  10. package/apps/studio/acp/connected-fact.ts +15 -4
  11. package/apps/studio/acp/index.ts +14 -5
  12. package/apps/studio/actions/agents.ts +10 -0
  13. package/apps/studio/actions/defs/app.ts +12 -0
  14. package/apps/studio/actions/defs/view.ts +12 -0
  15. package/apps/studio/actions.manifest.json +25 -1
  16. package/apps/studio/actions.parity.json +13 -1
  17. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  18. package/apps/studio/annotations/ui/lod.tsx +1 -1
  19. package/apps/studio/annotations/ui/text-style.ts +1 -1
  20. package/apps/studio/annotations-layer.tsx +0 -12
  21. package/apps/studio/api.ts +73 -24
  22. package/apps/studio/artboard-live-gate.tsx +267 -0
  23. package/apps/studio/artboard-live.ts +336 -0
  24. package/apps/studio/artboard-webgl.ts +668 -0
  25. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  26. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  27. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  28. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  29. package/apps/studio/bin/_ds-check.mjs +4 -1
  30. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  31. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  32. package/apps/studio/bin/_import-asset.mjs +2 -1
  33. package/apps/studio/bin/_perf-probe.mjs +2 -1
  34. package/apps/studio/bin/_png-playwright.mjs +10 -1
  35. package/apps/studio/bin/_pw-launch.mjs +14 -0
  36. package/apps/studio/bin/_studio-verb.mjs +24 -3
  37. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  38. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  39. package/apps/studio/bin/_thumbs-playwright.mjs +93 -13
  40. package/apps/studio/bin/ds-check.sh +5 -1
  41. package/apps/studio/bin/perf.sh +11 -1
  42. package/apps/studio/bin/server-up.sh +7 -2
  43. package/apps/studio/bin/smoke.sh +19 -0
  44. package/apps/studio/boot-progress.ts +31 -0
  45. package/apps/studio/canvas-build-sandbox.ts +275 -42
  46. package/apps/studio/canvas-build-worker.ts +10 -0
  47. package/apps/studio/canvas-create.ts +24 -0
  48. package/apps/studio/canvas-lib.tsx +131 -12
  49. package/apps/studio/canvas-module-cache.ts +93 -0
  50. package/apps/studio/canvas-source/errors.ts +39 -0
  51. package/apps/studio/canvas-source/waiting.ts +290 -0
  52. package/apps/studio/client/actions/shell-key-handlers.js +5 -0
  53. package/apps/studio/client/app.jsx +19 -9
  54. package/apps/studio/client/canvas-url.js +13 -0
  55. package/apps/studio/client/github.js +23 -3
  56. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  57. package/apps/studio/client/home/Shelves.jsx +4 -3
  58. package/apps/studio/client/home/home-accounts-model.js +121 -0
  59. package/apps/studio/client/home/home-api.js +36 -19
  60. package/apps/studio/client/home/home-app.jsx +141 -40
  61. package/apps/studio/client/home/home-model.js +172 -6
  62. package/apps/studio/client/home/home.css +169 -5
  63. package/apps/studio/client/home/shell-mode.js +8 -1
  64. package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
  65. package/apps/studio/client/hooks/use-project-data.jsx +2 -0
  66. package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
  67. package/apps/studio/client/hooks/use-tabs.jsx +64 -35
  68. package/apps/studio/client/index-loader.ts +23 -3
  69. package/apps/studio/client/panels/ChatPanel.jsx +49 -57
  70. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  71. package/apps/studio/client/panels/DiffView.jsx +314 -248
  72. package/apps/studio/client/panels/TeamProjects.jsx +119 -69
  73. package/apps/studio/client/panels/acp-runtime.js +25 -0
  74. package/apps/studio/client/panels/caps-cache.js +46 -0
  75. package/apps/studio/client/panels/chat-finish.js +66 -0
  76. package/apps/studio/client/shell/frame-cap.js +53 -0
  77. package/apps/studio/client/shell/viewport.jsx +45 -8
  78. package/apps/studio/client/styles/_index.css +2 -0
  79. package/apps/studio/client/tree/tree.jsx +48 -21
  80. package/apps/studio/client/v2/access/access-client.js +2 -0
  81. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  82. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  83. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  84. package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
  85. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  86. package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
  87. package/apps/studio/client/v2/ai/ai-run.css +87 -3
  88. package/apps/studio/client/v2/ai/background-model.js +113 -0
  89. package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
  90. package/apps/studio/client/v2/ai/run-api.js +7 -3
  91. package/apps/studio/client/v2/ai/runs-store.js +2 -1
  92. package/apps/studio/client/v2/annotations/vote-store.js +11 -5
  93. package/apps/studio/client/v2/assets/asset-state-lane.js +6 -3
  94. package/apps/studio/client/v2/assets/assets-bus.js +10 -8
  95. package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
  96. package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
  97. package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
  98. package/apps/studio/client/v2/assets/spotlight.css +153 -0
  99. package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
  100. package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
  101. package/apps/studio/client/v2/assets/tile.jsx +3 -0
  102. package/apps/studio/client/v2/assets/use-assets.js +2 -1
  103. package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
  104. package/apps/studio/client/v2/canvases/covers.js +11 -5
  105. package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
  106. package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
  107. package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
  108. package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
  109. package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
  110. package/apps/studio/client/v2/canvases/use-pins.js +2 -1
  111. package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
  112. package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
  113. package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
  114. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
  115. package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
  116. package/apps/studio/client/v2/code/code-bus.js +5 -0
  117. package/apps/studio/client/v2/code/code.css +67 -0
  118. package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
  119. package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
  120. package/apps/studio/client/v2/create/name-dialog.css +10 -0
  121. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -23
  122. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  123. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  124. package/apps/studio/client/v2/ds/make-host.jsx +13 -12
  125. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -16
  126. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  127. package/apps/studio/client/v2/ds/truth-host.jsx +15 -14
  128. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  129. package/apps/studio/client/v2/empty/arriving.jsx +29 -12
  130. package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
  131. package/apps/studio/client/v2/empty/not-local.jsx +31 -1
  132. package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
  133. package/apps/studio/client/v2/export/last-finished.js +2 -1
  134. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  135. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  136. package/apps/studio/client/v2/history/git-model.js +21 -5
  137. package/apps/studio/client/v2/history/git-parts.jsx +76 -43
  138. package/apps/studio/client/v2/history/history.css +6 -0
  139. package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
  140. package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
  141. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
  142. package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
  143. package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
  144. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  145. package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
  146. package/apps/studio/client/v2/search/search-recent.js +3 -1
  147. package/apps/studio/client/v2/search/search-remote.js +6 -4
  148. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  149. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  150. package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
  151. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  152. package/apps/studio/client/v2/shell/menu-runner.js +12 -0
  153. package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
  154. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  155. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  156. package/apps/studio/client/v2/shell/recovery-store.js +2 -1
  157. package/apps/studio/client/v2/shell/served-routes.js +120 -0
  158. package/apps/studio/client/v2/shell/share-cluster-host.jsx +139 -11
  159. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  160. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  161. package/apps/studio/client/v2/shell/shell-activity.js +19 -0
  162. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  163. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  164. package/apps/studio/client/v2/shell/use-account.js +8 -1
  165. package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
  166. package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
  167. package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
  168. package/apps/studio/cloud/endpoints.ts +23 -1
  169. package/apps/studio/collab/persistence.ts +9 -1
  170. package/apps/studio/collab/registry.ts +32 -0
  171. package/apps/studio/collab/room.ts +8 -0
  172. package/apps/studio/config-reload-wire.ts +53 -0
  173. package/apps/studio/dist/client.bundle.js +1098 -1102
  174. package/apps/studio/dist/styles.css +1 -1
  175. package/apps/studio/ds/board/specimen.tsx +12 -1
  176. package/apps/studio/ds/canvas-cli.ts +58 -2
  177. package/apps/studio/ds/check.ts +26 -1
  178. package/apps/studio/ds/cli.ts +7 -3
  179. package/apps/studio/ds/convert.ts +34 -6
  180. package/apps/studio/ds/ds-verb.ts +13 -0
  181. package/apps/studio/ds/post-build.ts +38 -0
  182. package/apps/studio/ds/upgrade-apply.ts +27 -5
  183. package/apps/studio/ds/upgrade-cli.ts +22 -2
  184. package/apps/studio/ds/upgrade-prove.ts +198 -15
  185. package/apps/studio/ds/upgrade-stage.ts +4 -1
  186. package/apps/studio/editing/minimap-context.tsx +3 -3
  187. package/apps/studio/editing/page-activity.ts +251 -0
  188. package/apps/studio/editing/rotate-handle.tsx +9 -5
  189. package/apps/studio/editing/sticky-name.tsx +4 -4
  190. package/apps/studio/history/restore-artboard-action.ts +40 -0
  191. package/apps/studio/history/trash.ts +6 -0
  192. package/apps/studio/home/accounts.ts +87 -0
  193. package/apps/studio/home/hub.ts +77 -175
  194. package/apps/studio/home/index-reader.ts +24 -2
  195. package/apps/studio/home/routes.ts +66 -8
  196. package/apps/studio/http.ts +131 -68
  197. package/apps/studio/index-flight.ts +40 -0
  198. package/apps/studio/managed-projects.ts +52 -24
  199. package/apps/studio/migrate/hub.ts +7 -1
  200. package/apps/studio/routes/canvas-source.ts +44 -2
  201. package/apps/studio/routes/ds-convert.ts +18 -0
  202. package/apps/studio/routes/history.ts +28 -5
  203. package/apps/studio/routes/hub-signin.ts +115 -0
  204. package/apps/studio/routes/index.ts +4 -0
  205. package/apps/studio/routes/table.ts +7 -0
  206. package/apps/studio/routes/trash.ts +19 -1
  207. package/apps/studio/server.ts +19 -10
  208. package/apps/studio/sync/accepted-cold-start.ts +54 -16
  209. package/apps/studio/sync/accepted-link.ts +9 -4
  210. package/apps/studio/sync/asset-push.ts +146 -23
  211. package/apps/studio/sync/asset-state.ts +3 -2
  212. package/apps/studio/sync/code-module-consent.ts +74 -0
  213. package/apps/studio/sync/file-ledger.ts +35 -0
  214. package/apps/studio/sync/file-membership.ts +28 -3
  215. package/apps/studio/sync/file-plane.ts +483 -86
  216. package/apps/studio/sync/file-pull.ts +304 -33
  217. package/apps/studio/sync/hub-browser-signin.ts +377 -0
  218. package/apps/studio/sync/hub-link.ts +1 -2
  219. package/apps/studio/sync/hub-text-undo.ts +30 -10
  220. package/apps/studio/sync/index.ts +381 -161
  221. package/apps/studio/sync/journal-client.ts +94 -5
  222. package/apps/studio/sync/pending-deletes.ts +100 -0
  223. package/apps/studio/sync/projection.ts +121 -14
  224. package/apps/studio/sync/pull-pacer.ts +160 -0
  225. package/apps/studio/sync/pull-priority.ts +119 -0
  226. package/apps/studio/sync/seed-progress.ts +58 -3
  227. package/apps/studio/sync/status.ts +3 -1
  228. package/apps/studio/sync/transaction-client.ts +71 -6
  229. package/apps/studio/sync/workspace-signin.ts +6 -256
  230. package/apps/studio/sync/writer-registry.ts +5 -1
  231. package/apps/studio/thumbs/service.ts +12 -2
  232. package/apps/studio/thumbs/validate.ts +7 -0
  233. package/apps/studio/ui-prefs-migrate.ts +4 -0
  234. package/apps/studio/video-comp.tsx +23 -0
  235. package/apps/studio/video-links-overlay.tsx +3 -2
  236. package/apps/studio/whats-new.json +126 -0
  237. package/cli/lib/bash-guard.mjs +13 -1
  238. package/cli/lib/design-help.gen.mjs +1 -1
  239. package/cli/lib/design-hook.mjs +20 -0
  240. package/cli/lib/studio-locate.mjs +35 -10
  241. package/cli/lib/workspace-plan.mjs +14 -0
  242. package/package.json +8 -8
@@ -17,6 +17,8 @@ import { prefetchPreviewImage } from '../panels/file-preview.jsx';
17
17
  import { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
18
18
  import { useTreeDrag } from '../use-tree-drag.js';
19
19
  import { TreeRowMenu, useRowMenu } from '../tree-row-menu.jsx';
20
+ import { TreeAsk } from '../v2/canvases/folder-dialogs.jsx';
21
+ import { askFailure, checkAskName, FOLDER_ASK_WORDS } from '../v2/canvases/folder-ask.js';
20
22
  import CloudBar from '../panels/CloudBar.jsx';
21
23
  import IdentityBar from '../panels/IdentityBar.jsx';
22
24
  import { CanvasesPanel } from '../v2/canvases/canvases-panel.jsx';
@@ -941,6 +943,23 @@ export function Sidebar({
941
943
  // non-DS canvas group folder (incl. each group's own root) is a valid
942
944
  // "Move to…" destination.
943
945
  const rowMenu = useRowMenu();
946
+ // #195 — the folder and file rows' asks (New folder here, Rename folder, Delete folder, a file's Rename… and
947
+ // Delete): one centered dialog at a time (v2/canvases/folder-dialogs.jsx), never `window.prompt`/`confirm`.
948
+ const [treeAsk, setTreeAsk] = useState(null);
949
+ const closeTreeAsk = useCallback(() => setTreeAsk(null), []);
950
+ const runTreeAsk = useCallback(
951
+ (ask, name) => {
952
+ const label = ask.name ?? ask.path.split('/').pop();
953
+ if (ask.kind === 'new-folder') return onNewFolder(ask.path, name, { quiet: true });
954
+ if (ask.kind === 'rename-folder') return onRenameFolder(ask.path, name, { quiet: true });
955
+ if (ask.kind === 'rename-canvas' || ask.kind === 'rename-file')
956
+ return onRenameCanvas(ask.path, name, { quiet: true });
957
+ if (ask.kind === 'trash-folder') return onDeleteFolder(ask.path, label, { quiet: true });
958
+ if (ask.kind === 'trash-file') return onDeleteFile(ask.path, label, { quiet: true });
959
+ return { ok: false };
960
+ },
961
+ [onNewFolder, onRenameFolder, onRenameCanvas, onDeleteFolder, onDeleteFile]
962
+ );
944
963
  // P8 round 7 — the pinned system row whose name is a field (Rename…, 13 · ds-multi-menu)
945
964
  const [renamingDs, setRenamingDs] = useState(null);
946
965
  const destinations = useMemo(() => {
@@ -997,10 +1016,11 @@ export function Sidebar({
997
1016
  label: 'Rename…',
998
1017
  onSelect: () => {
999
1018
  rowMenu.close();
1000
- const current = displayName(menuExtra.path.split('/').pop());
1001
- const name = window.prompt('Rename canvas to:', current);
1002
- if (name?.trim() && name.trim() !== current)
1003
- onRenameCanvas(menuExtra.path, name.trim());
1019
+ setTreeAsk({
1020
+ kind: 'rename-canvas',
1021
+ path: menuExtra.path,
1022
+ name: displayName(menuExtra.path.split('/').pop()),
1023
+ });
1004
1024
  },
1005
1025
  },
1006
1026
  ]
@@ -1026,12 +1046,11 @@ export function Sidebar({
1026
1046
  label: 'Rename…',
1027
1047
  onSelect: () => {
1028
1048
  rowMenu.close();
1029
- const n = menuExtra.name ?? menuExtra.path.split('/').pop();
1030
- const ext = n.includes('.') ? n.slice(n.lastIndexOf('.')) : '';
1031
- const current = ext ? n.slice(0, -ext.length) : n;
1032
- const name = window.prompt(`Rename ${n} to:`, current);
1033
- if (name?.trim() && name.trim() !== current)
1034
- onRenameCanvas(menuExtra.path, name.trim());
1049
+ setTreeAsk({
1050
+ kind: 'rename-file',
1051
+ path: menuExtra.path,
1052
+ name: menuExtra.name ?? menuExtra.path.split('/').pop(),
1053
+ });
1035
1054
  },
1036
1055
  },
1037
1056
  ]
@@ -1047,7 +1066,11 @@ export function Sidebar({
1047
1066
  destructive: true,
1048
1067
  onSelect: () => {
1049
1068
  rowMenu.close();
1050
- onDeleteFile(menuExtra.path, menuExtra.name ?? menuExtra.path.split('/').pop());
1069
+ setTreeAsk({
1070
+ kind: 'trash-file',
1071
+ path: menuExtra.path,
1072
+ name: menuExtra.name ?? menuExtra.path.split('/').pop(),
1073
+ });
1051
1074
  },
1052
1075
  },
1053
1076
  ]
@@ -1058,10 +1081,10 @@ export function Sidebar({
1058
1081
  {
1059
1082
  id: 'new-folder-here',
1060
1083
  label: 'New folder here',
1084
+ // #195 — asked in the shell's own dialog: `window.prompt` is a no-op in the desktop app
1061
1085
  onSelect: () => {
1062
1086
  rowMenu.close();
1063
- const name = window.prompt('New folder name:');
1064
- if (name?.trim()) onNewFolder(menuExtra.dirPath, name.trim());
1087
+ setTreeAsk({ kind: 'new-folder', path: menuExtra.dirPath });
1065
1088
  },
1066
1089
  },
1067
1090
  {
@@ -1069,10 +1092,7 @@ export function Sidebar({
1069
1092
  label: 'Rename folder',
1070
1093
  onSelect: () => {
1071
1094
  rowMenu.close();
1072
- const current = menuExtra.dirPath.split('/').pop();
1073
- const name = window.prompt('Rename folder to:', current);
1074
- if (name?.trim() && name.trim() !== current)
1075
- onRenameFolder(menuExtra.dirPath, name.trim());
1095
+ setTreeAsk({ kind: 'rename-folder', path: menuExtra.dirPath });
1076
1096
  },
1077
1097
  },
1078
1098
  {
@@ -1081,7 +1101,7 @@ export function Sidebar({
1081
1101
  destructive: true,
1082
1102
  onSelect: () => {
1083
1103
  rowMenu.close();
1084
- onDeleteFolder(menuExtra.dirPath, menuExtra.dirPath.split('/').pop());
1104
+ setTreeAsk({ kind: 'trash-folder', path: menuExtra.dirPath });
1085
1105
  },
1086
1106
  },
1087
1107
  ]
@@ -1118,14 +1138,20 @@ export function Sidebar({
1118
1138
  setNamingErr('');
1119
1139
  if (!defaultFolderParent) {
1120
1140
  setNaming({ ...naming, busy: false });
1121
- setNamingErr('no canvas group to create a folder in');
1141
+ setNamingErr(FOLDER_ASK_WORDS.noGroup);
1142
+ return;
1143
+ }
1144
+ const v = checkAskName({ kind: 'new-folder', path: defaultFolderParent }, name);
1145
+ if (v.kind === 'error') {
1146
+ setNaming({ ...naming, busy: false });
1147
+ setNamingErr(v.error);
1122
1148
  return;
1123
1149
  }
1124
- const res = await onNewFolder(defaultFolderParent, name);
1150
+ const res = await onNewFolder(defaultFolderParent, name, { quiet: true });
1125
1151
  if (res?.ok) cancelNaming();
1126
1152
  else {
1127
1153
  setNaming({ ...naming, busy: false });
1128
- setNamingErr(res?.error || 'Could not make the folder. Nothing was changed.');
1154
+ setNamingErr(askFailure('new-folder', res));
1129
1155
  }
1130
1156
  }, [naming, defaultFolderParent, onNewFolder, cancelNaming]);
1131
1157
 
@@ -1464,6 +1490,7 @@ export function Sidebar({
1464
1490
  destinations={rowMenuDestinations}
1465
1491
  onPickDestination={(dest) => onMoveCanvas(menuExtra.path, dest)}
1466
1492
  />
1493
+ <TreeAsk ask={treeAsk} run={runTreeAsk} onClose={closeTreeAsk} />
1467
1494
  {/* P8 C4: no project switcher here — the project pill is the switcher (RepoBranchSwitcher.jsx). */}
1468
1495
  {/* Cloud Phase 23 C3 — Maude Cloud sign-in + remote-project attach, docked
1469
1496
  above the GitHub identity. Dev-server-backed, so it works in the desktop
@@ -182,6 +182,8 @@ export const WORDS = Object.freeze({
182
182
  // decision v2-lead-trashed-while-open-stops-writes: writes stop; what was not sent yet is parked with it
183
183
  trashedLine: 'You can keep looking. Your unsent changes stay with it.',
184
184
  restore: 'Restore',
185
+ // the restore never writes over a canvas made at the old place meanwhile: it comes back beside it
186
+ restoredAs: (canvas) => `Restored as ${canvas}. A canvas with the old name already exists.`,
185
187
  sharedWithYou: (role) => `Shared with you · ${accessWord(role)}`,
186
188
  onlyOne: (canvas) => `Only ${canvas} was shared with you.`,
187
189
  onlyMany: (n) => `Only these ${n} canvases were shared with you.`,
@@ -306,7 +306,18 @@ export function AccessHost({
306
306
  const open = (tabs || []).map((t) => canvasRel(t?.path, designRel)).filter(Boolean);
307
307
  useTrashGhosts(items, open, onOpenTab, rel);
308
308
 
309
- const onRestored = useCallback(() => void reload(), [reload]);
309
+ const onRestored = useCallback(
310
+ (path, o) => {
311
+ void reload();
312
+ // A canvas was made at that place meanwhile: the restore never overwrites it, it comes back beside it.
313
+ if (o?.renamed)
314
+ toast?.({
315
+ title: WORDS.restoredAs(canvasName(path)),
316
+ kind: 'info',
317
+ });
318
+ },
319
+ [reload, toast]
320
+ );
310
321
  const onError = useCallback((m) => toast?.({ title: m, kind: 'error' }), [toast]);
311
322
 
312
323
  return (
@@ -16,10 +16,13 @@ import { commentTime } from '../comments/comments-model.js';
16
16
  import { restoreItem } from '../left-panel/use-trash.js';
17
17
  import { canvasName, WORDS } from './access-client.js';
18
18
 
19
- /** The shared Trash's canvas item for the open canvas (designRoot-relative `rel`), or null. */
19
+ /**
20
+ * The shared Trash's canvas item for the open canvas (designRoot-relative `rel`), or null. An item a live
21
+ * canvas holds the path of (`liveAtPath`, GET /_api/trash) is an OLDER copy: the open canvas was not trashed.
22
+ */
20
23
  export function trashedWhileOpen(items, rel) {
21
24
  if (!rel || !Array.isArray(items)) return null;
22
- return items.find((i) => i?.kind === 'canvas' && i.path === rel) ?? null;
25
+ return items.find((i) => i?.kind === 'canvas' && i.path === rel && i.liveAtPath !== true) ?? null;
23
26
  }
24
27
 
25
28
  /** Every open tab whose canvas is in the trash → the panel's ghost rows. `open` = designRoot-relative paths. */
@@ -73,7 +76,7 @@ export function TrashedBanner({ item, canRestore = true, now, fetchImpl, onResto
73
76
  try {
74
77
  const r = await restoreItem(item.id, fetchImpl);
75
78
  if (r.status >= 200 && r.status < 300 && r.body?.ok !== false)
76
- onRestored?.(r.body?.path ?? item.path);
79
+ onRestored?.(r.body?.path ?? item.path, { renamed: r.body?.renamed === true });
77
80
  else
78
81
  onError?.(
79
82
  typeof r.body?.error === 'string' ? r.body.error : 'Could not restore it. Try again.'
@@ -401,6 +401,18 @@ export function ChatAdvanced({
401
401
  Connecting…
402
402
  </p>
403
403
  ) : null}
404
+ {/* 2.0.5 - AI starts when you do, so a first run has no roster yet: the rows sit in their resting
405
+ state (same labels) instead of leaving the fold empty; they fill in once AI answers. */}
406
+ {noCaps && !connecting ? (
407
+ <div data-testid="chat-caps-placeholder">
408
+ {['Model', 'Effort', 'Permissions'].map((label) => (
409
+ <div className="ai-adv-row" key={label} data-adv-row={`placeholder-${label}`}>
410
+ <span className="ai-adv-k">{label}</span>
411
+ <span className="ai-adv-hint">Set when AI starts</span>
412
+ </div>
413
+ ))}
414
+ </div>
415
+ ) : null}
404
416
  {parsed.model ? (
405
417
  <OptionSelect row="model" label="Model" opt={parsed.model} onChange={onSetConfig} />
406
418
  ) : null}
@@ -0,0 +1,120 @@
1
+ // client/v2/ai/BackgroundStrip.jsx — issue #177: "Running in the background".
2
+ //
3
+ // AI can leave work running after its reply ends: subagents it launched, a command left running. The
4
+ // strip sits between the conversation and the composer and says what is still running, one line per
5
+ // task with its time, so a quiet stretch never reads as "nothing is happening":
6
+ //
7
+ // one task ● Review the Pricing canvas · Agent 0:42
8
+ // several ● 3 agents working 1:12 ▸ (expands to one row each)
9
+ //
10
+ // A task that ends shows "Finished" for a few seconds (background-model.js KEEP_FINISHED_MS), then goes;
11
+ // the strip goes with the last one. The counts are announced politely; the ticking clock never is.
12
+
13
+ import { useEffect, useState } from 'react';
14
+ import { StIcon } from '../../shell/icons.jsx';
15
+ import {
16
+ kindWord,
17
+ pruneFinished,
18
+ rowElapsed,
19
+ rowLabel,
20
+ runningCount,
21
+ stripElapsed,
22
+ summaryText,
23
+ trackBackground,
24
+ } from './background-model.js';
25
+
26
+ /** The strip's items for a connection: folded from its task snapshots, ticking while there are any. */
27
+ export function useBackgroundItems(conn) {
28
+ const [items, setItems] = useState([]);
29
+ const [now, setNow] = useState(() => Date.now());
30
+ useEffect(() => {
31
+ if (!conn?.onBackgroundTasks) return undefined;
32
+ return conn.onBackgroundTasks((tasks) => {
33
+ const at = Date.now();
34
+ setNow(at);
35
+ setItems((prev) => trackBackground(prev, tasks, at));
36
+ });
37
+ }, [conn]);
38
+ const any = items.length > 0;
39
+ useEffect(() => {
40
+ if (!any) return undefined;
41
+ const id = setInterval(() => {
42
+ const at = Date.now();
43
+ setNow(at);
44
+ setItems((prev) => pruneFinished(prev, at));
45
+ }, 1000);
46
+ return () => clearInterval(id);
47
+ }, [any]);
48
+ return { items, now };
49
+ }
50
+
51
+ function Row({ item, now }) {
52
+ const done = item.state === 'finished';
53
+ const time = rowElapsed(item, now);
54
+ return (
55
+ <li
56
+ className={`ai-bg-row${done ? ' is-done' : ''}`}
57
+ data-testid={`ai-background-row-${item.id}`}
58
+ data-state={item.state}
59
+ >
60
+ <span className="ai-bg-dot" aria-hidden="true" />
61
+ <span className="ai-bg-name">{rowLabel(item)}</span>
62
+ <span className="ai-bg-kind">{done ? 'Finished' : kindWord(item.kind)}</span>
63
+ {time ? <span className="ai-bg-time">{time}</span> : null}
64
+ </li>
65
+ );
66
+ }
67
+
68
+ export function BackgroundStrip({ conn }) {
69
+ const { items, now } = useBackgroundItems(conn);
70
+ const [open, setOpen] = useState(false);
71
+ if (!items.length) return null;
72
+ const working = runningCount(items) > 0;
73
+ const many = items.length > 1;
74
+ const summary = summaryText(items);
75
+ return (
76
+ <section
77
+ className={`ai-bg${working ? ' is-working' : ''}`}
78
+ data-testid="ai-background"
79
+ data-working={working ? 'true' : 'false'}
80
+ aria-label="Running in the background"
81
+ >
82
+ <div className="ai-sr-only" role="status" aria-live="polite">
83
+ {summary}
84
+ </div>
85
+ {many ? (
86
+ <>
87
+ <button
88
+ type="button"
89
+ className="ai-bg-head"
90
+ data-testid="ai-background-toggle"
91
+ aria-expanded={open}
92
+ onClick={() => setOpen((v) => !v)}
93
+ >
94
+ <span className="ai-bg-dot" aria-hidden="true" />
95
+ <span className="ai-bg-name" data-testid="ai-background-summary">
96
+ {summary}
97
+ </span>
98
+ {stripElapsed(items, now) ? (
99
+ <span className="ai-bg-time">{stripElapsed(items, now)}</span>
100
+ ) : null}
101
+ <span className={`ai-bg-chev${open ? ' is-open' : ''}`} aria-hidden="true">
102
+ <StIcon name="chevron-right" size={12} />
103
+ </span>
104
+ </button>
105
+ {open ? (
106
+ <ul className="ai-bg-list" data-testid="ai-background-list">
107
+ {items.map((item) => (
108
+ <Row key={item.id} item={item} now={now} />
109
+ ))}
110
+ </ul>
111
+ ) : null}
112
+ </>
113
+ ) : (
114
+ <ul className="ai-bg-list ai-bg-list--one" data-testid="ai-background-list">
115
+ <Row item={items[0]} now={now} />
116
+ </ul>
117
+ )}
118
+ </section>
119
+ );
120
+ }
@@ -308,7 +308,15 @@ export function CommandPopover({ items, activeIndex, onPick, onHover }) {
308
308
  // but ONLY when that token is a command that exists (the badge gate). The mirror
309
309
  // MUST match the textarea's box model exactly (see .chat-input / .chat-input-mirror
310
310
  // in v2/ai/chat.css) or the pill drifts off the text.
311
- function HighlightedInput({ existsSet, attachmentsRef, onAttachChange, attach, multi, onMulti }) {
311
+ function HighlightedInput({
312
+ existsSet,
313
+ attachmentsRef,
314
+ onAttachChange,
315
+ attach,
316
+ multi,
317
+ onMulti,
318
+ onEngage,
319
+ }) {
312
320
  const text = useComposer((c) => c.text);
313
321
  const mirrorRef = useRef(null);
314
322
  const wrapRef = useRef(null);
@@ -420,6 +428,9 @@ function HighlightedInput({ existsSet, attachmentsRef, onAttachChange, attach, m
420
428
  placeholder="Ask AI…"
421
429
  aria-label="Message to AI"
422
430
  onPaste={onPaste}
431
+ // 2.0.5 - the person is here: the first focus or keystroke wakes the adapter (once, in Composer)
432
+ onFocus={onEngage}
433
+ onInput={onEngage}
423
434
  onScroll={(e) => {
424
435
  if (mirrorRef.current) mirrorRef.current.scrollTop = e.currentTarget.scrollTop;
425
436
  }}
@@ -498,19 +509,24 @@ export function Composer({
498
509
  setMoreOpen(false);
499
510
  }, [match?.token]);
500
511
 
501
- // Warm the adapter the first time the user starts a slash command, so the live
502
- // catalogue arrives without a full prompt. Guarded to fire once per mount.
512
+ // Warm the adapter the first time the person ENGAGES: focuses the field, starts typing (a slash command included),
513
+ // or sends (a prompt spawns it itself). Never on mount or reload - a panel that only re-opened used to send `warm`
514
+ // from ChatPanel, and every webview reload started another `claude` (2.0.5). Focus is early enough that the
515
+ // capability row and the slash catalogue are usually there before the first word. Once per mount; not while Claude
516
+ // Code is not ready (S5.13) or for a viewer (the field is read-only).
503
517
  // model/effort/mode are the user's PERSISTED picks (read live off the ref so
504
- // this effect doesn't need to re-run when they change) — applied once, live,
518
+ // this callback doesn't need to change when they change) - applied once, live,
505
519
  // by the bridge right after the session establishes.
506
520
  const warmedRef = useRef(false);
521
+ const warmOnce = useCallback(() => {
522
+ if (warmedRef.current || unavailable || viewer) return;
523
+ warmedRef.current = true;
524
+ const p = picksRef.current;
525
+ conn.warm(chatId, p.model, p.effort, p.mode);
526
+ }, [conn, chatId, picksRef, unavailable, viewer]);
507
527
  useEffect(() => {
508
- if (menuOpen && !warmedRef.current) {
509
- warmedRef.current = true;
510
- const p = picksRef.current;
511
- conn.warm(chatId, p.model, p.effort, p.mode);
512
- }
513
- }, [menuOpen, conn, chatId, picksRef]);
528
+ if (menuOpen) warmOnce();
529
+ }, [menuOpen, warmOnce]);
514
530
 
515
531
  // V2-4.6 — ⌘K "Ask AI": the query lands in the composer; the person still sends it. S10.16c: the DS hosts'
516
532
  // `askAI(text, { send: true, origin: 'ds-…' })` is the one ask that also sends (use-ask-ai.js; this file never does).
@@ -612,6 +628,7 @@ export function Composer({
612
628
  attach={attach}
613
629
  multi={multi}
614
630
  onMulti={setMulti}
631
+ onEngage={warmOnce}
615
632
  />
616
633
  {/* S5.12 — the model / effort / mode pickers and the info button moved to the panel's
617
634
  Advanced fold (Advanced.jsx); the field keeps only what 03 draws: the text and send
@@ -9,10 +9,11 @@
9
9
  import { useCallback, useEffect, useState } from 'react';
10
10
 
11
11
  import { stoppedLine, stoppedRunFor } from './stopped.js';
12
+ import { servedFetch } from '../shell/served-routes.js';
12
13
 
13
14
  async function fetchMine() {
14
15
  try {
15
- const r = await fetch('/_api/ai/runs', { cache: 'no-store' });
16
+ const r = await servedFetch('/_api/ai/runs', { cache: 'no-store' });
16
17
  if (!r.ok) return null;
17
18
  const j = await r.json();
18
19
  return Array.isArray(j?.mine) ? j.mine : null;
@@ -288,12 +288,96 @@
288
288
  color: var(--fg-0);
289
289
  }
290
290
 
291
+ /* ── Issue #177: "Running in the background" — work AI left running after its reply ── */
292
+ .ai-bg {
293
+ flex: none;
294
+ margin: 0 var(--space-3) var(--space-2);
295
+ border-radius: var(--radius-md);
296
+ background: var(--bg-2);
297
+ font-size: var(--type-xs);
298
+ color: var(--fg-1);
299
+ }
300
+ .ai-bg-head,
301
+ .ai-bg-row {
302
+ display: flex;
303
+ align-items: center;
304
+ gap: var(--space-2);
305
+ min-width: 0;
306
+ padding: var(--space-1) var(--space-2);
307
+ }
308
+ .ai-bg-head {
309
+ width: 100%;
310
+ border: 0;
311
+ border-radius: var(--radius-md);
312
+ background: none;
313
+ color: inherit;
314
+ font: inherit;
315
+ text-align: start;
316
+ cursor: pointer;
317
+ }
318
+ .ai-bg-head:hover {
319
+ background: var(--bg-3);
320
+ }
321
+ .ai-bg-list {
322
+ margin: 0;
323
+ padding: 0 0 var(--space-1);
324
+ list-style: none;
325
+ }
326
+ .ai-bg-list--one {
327
+ padding: 0;
328
+ }
329
+ .ai-bg-dot {
330
+ flex: none;
331
+ width: 6px;
332
+ height: 6px;
333
+ border-radius: 50%;
334
+ background: var(--fg-2);
335
+ }
336
+ .ai-bg.is-working .ai-bg-head .ai-bg-dot,
337
+ .ai-bg-row:not(.is-done) .ai-bg-dot {
338
+ background: var(--spark);
339
+ animation: ai-working-pulse 1600ms var(--ease-out, ease-out) infinite;
340
+ }
341
+ .ai-bg-name {
342
+ flex: 1;
343
+ min-width: 0;
344
+ overflow: hidden;
345
+ color: var(--fg-0);
346
+ font-weight: var(--w-medium);
347
+ text-overflow: ellipsis;
348
+ white-space: nowrap;
349
+ }
350
+ .ai-bg-row.is-done .ai-bg-name {
351
+ color: var(--fg-1);
352
+ font-weight: var(--w-regular);
353
+ }
354
+ .ai-bg-kind {
355
+ flex: none;
356
+ color: var(--fg-2);
357
+ }
358
+ .ai-bg-time {
359
+ flex: none;
360
+ color: var(--fg-2);
361
+ font-variant-numeric: tabular-nums;
362
+ }
363
+ .ai-bg-chev {
364
+ display: grid;
365
+ flex: none;
366
+ color: var(--fg-2);
367
+ transition: transform var(--dur-flip, 120ms) var(--ease-out, ease-out);
368
+ }
369
+ .ai-bg-chev.is-open {
370
+ transform: rotate(90deg);
371
+ }
372
+
291
373
  @media (prefers-reduced-motion: reduce) {
292
- .ai-working-spark {
293
- animation: none;
374
+ .ai-working-spark,
375
+ .ai-bg-dot {
376
+ animation: none !important;
294
377
  }
295
378
  .ai-act,
296
- .ai-fold-ch {
379
+ .ai-fold-ch,
380
+ .ai-bg-chev {
297
381
  transition-duration: 1ms;
298
382
  }
299
383
  }
@@ -0,0 +1,113 @@
1
+ // client/v2/ai/background-model.js — issue #177: the "Running in the background" strip's model.
2
+ //
3
+ // The server sends this chat's live background tasks as `{t:'background', tasks}` (acp/background-tasks.ts):
4
+ // the WHOLE set, every time it changes — a subagent the AI launched, a command it left running. A task
5
+ // that drops out of the set has ended; the snapshot does not say how, so the row says "Finished", never
6
+ // "Done" or "Failed". A finished row stays a few seconds so the end is seen, then goes.
7
+ //
8
+ // Pure: no React, no DOM. BackgroundStrip.jsx renders it.
9
+
10
+ /** How long a finished row stays on the strip. */
11
+ export const KEEP_FINISHED_MS = 8000;
12
+ const MAX_ITEMS = 50;
13
+ const KINDS = new Set(['agent', 'command', 'other']);
14
+
15
+ /** The server's list, checked: unknown shapes dropped, strings bounded (the frame is data, not trusted shape). */
16
+ export function cleanTasks(raw) {
17
+ if (!Array.isArray(raw)) return [];
18
+ const out = [];
19
+ for (const t of raw) {
20
+ if (out.length >= MAX_ITEMS) break;
21
+ if (!t || typeof t.id !== 'string' || !t.id) continue;
22
+ out.push({
23
+ id: t.id.slice(0, 128),
24
+ kind: KINDS.has(t.kind) ? t.kind : 'other',
25
+ label: typeof t.label === 'string' ? t.label.slice(0, 120) : '',
26
+ since: Number.isFinite(t.since) ? t.since : null,
27
+ });
28
+ }
29
+ return out;
30
+ }
31
+
32
+ /**
33
+ * Fold a new task list into the strip's items. Running tasks keep their start; a running item missing
34
+ * from `tasks` becomes finished at `now`; finished items older than KEEP_FINISHED_MS are dropped.
35
+ * Running rows first (oldest first), then finished ones.
36
+ */
37
+ export function trackBackground(prev, tasks, now = Date.now()) {
38
+ const live = new Map(tasks.map((t) => [t.id, t]));
39
+ const before = new Map(prev.map((i) => [i.id, i]));
40
+ const running = tasks.map((t) => ({
41
+ id: t.id,
42
+ kind: t.kind,
43
+ label: t.label,
44
+ since: t.since ?? before.get(t.id)?.since ?? now,
45
+ state: 'running',
46
+ }));
47
+ const finished = [];
48
+ for (const i of prev) {
49
+ if (live.has(i.id)) continue;
50
+ if (i.state === 'running') finished.push({ ...i, state: 'finished', endedAt: now });
51
+ else if (now - i.endedAt < KEEP_FINISHED_MS) finished.push(i);
52
+ }
53
+ running.sort((a, b) => a.since - b.since);
54
+ return [...running, ...finished];
55
+ }
56
+
57
+ /** Drop finished rows past their time; the same array when nothing changed. */
58
+ export function pruneFinished(items, now = Date.now()) {
59
+ const next = items.filter((i) => i.state !== 'finished' || now - i.endedAt < KEEP_FINISHED_MS);
60
+ return next.length === items.length ? items : next;
61
+ }
62
+
63
+ export function runningCount(items) {
64
+ return items.filter((i) => i.state === 'running').length;
65
+ }
66
+
67
+ const count = (n, one, many) => `${n} ${n === 1 ? one : many}`;
68
+
69
+ /** "3 agents working" · "1 agent working · 1 command running" · "Finished" when nothing runs. */
70
+ export function summaryText(items) {
71
+ const run = items.filter((i) => i.state === 'running');
72
+ if (!run.length) return 'Finished';
73
+ const agents = run.filter((i) => i.kind === 'agent').length;
74
+ const commands = run.filter((i) => i.kind === 'command').length;
75
+ const other = run.length - agents - commands;
76
+ const parts = [];
77
+ if (agents) parts.push(`${count(agents, 'agent', 'agents')} working`);
78
+ if (commands) parts.push(`${count(commands, 'command', 'commands')} running`);
79
+ if (other) parts.push(`${count(other, 'task', 'tasks')} running`);
80
+ return parts.join(' · ');
81
+ }
82
+
83
+ /** What a row is: "Agent" · "Command" · "Task". */
84
+ export function kindWord(kind) {
85
+ return kind === 'agent' ? 'Agent' : kind === 'command' ? 'Command' : 'Task';
86
+ }
87
+
88
+ /** A row's name; an empty label reads as its kind. */
89
+ export function rowLabel(item) {
90
+ return item.label || kindWord(item.kind);
91
+ }
92
+
93
+ /** m:ss (h:mm:ss past an hour); null under a second. */
94
+ export function elapsedText(ms) {
95
+ if (!Number.isFinite(ms) || ms < 1000) return null;
96
+ const s = Math.floor(ms / 1000);
97
+ const h = Math.floor(s / 3600);
98
+ const m = Math.floor((s % 3600) / 60);
99
+ const ss = String(s % 60).padStart(2, '0');
100
+ return h ? `${h}:${String(m).padStart(2, '0')}:${ss}` : `${m}:${ss}`;
101
+ }
102
+
103
+ /** A row's time: how long it has run, or how long it ran. */
104
+ export function rowElapsed(item, now = Date.now()) {
105
+ return elapsedText((item.state === 'finished' ? item.endedAt : now) - item.since);
106
+ }
107
+
108
+ /** The strip's time: since the oldest running task started. */
109
+ export function stripElapsed(items, now = Date.now()) {
110
+ const run = items.filter((i) => i.state === 'running');
111
+ if (!run.length) return null;
112
+ return elapsedText(now - Math.min(...run.map((i) => i.since)));
113
+ }
@@ -10,6 +10,7 @@
10
10
  // reload. It only ever counts YOUR chats on THIS Mac (`needsYou` is mine-only by construction).
11
11
 
12
12
  import { useEffect, useSyncExternalStore } from 'react';
13
+ import { servedFetch } from '../shell/served-routes.js';
13
14
 
14
15
  let local = new Map(); // chatId -> number of open questions
15
16
  let server = 0;
@@ -83,7 +84,7 @@ export function startNeedsYouFeed({
83
84
  if (stopped || inflight) return;
84
85
  inflight = true;
85
86
  try {
86
- const res = await fetchImpl('/_api/ai/runs');
87
+ const res = await servedFetch('/_api/ai/runs', undefined, fetchImpl);
87
88
  if (!res.ok) return;
88
89
  const body = await res.json();
89
90
  if (!stopped && typeof body?.needsYou === 'number') setServerNeedsYou(body.needsYou);