@1agh/maude 2.0.2 → 2.0.4

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 (154) hide show
  1. package/README.md +6 -5
  2. package/apps/studio/access/request.ts +0 -1
  3. package/apps/studio/acp/adapter-stderr.ts +43 -13
  4. package/apps/studio/acp/background-tasks.ts +155 -0
  5. package/apps/studio/acp/bridge.ts +44 -5
  6. package/apps/studio/acp/connected-fact.ts +15 -4
  7. package/apps/studio/acp/index.ts +14 -5
  8. package/apps/studio/actions/agents.ts +5 -0
  9. package/apps/studio/actions/defs/view.ts +12 -0
  10. package/apps/studio/actions.manifest.json +13 -1
  11. package/apps/studio/actions.parity.json +7 -1
  12. package/apps/studio/api.ts +31 -24
  13. package/apps/studio/asset-placeholder.tsx +157 -62
  14. package/apps/studio/bin/_png-playwright.mjs +10 -1
  15. package/apps/studio/bin/_pw-launch.mjs +14 -0
  16. package/apps/studio/bin/_thumbs-playwright.mjs +4 -1
  17. package/apps/studio/boot-progress.ts +31 -0
  18. package/apps/studio/bridge/dgn-protocol.ts +34 -4
  19. package/apps/studio/canvas-build-sandbox.ts +275 -42
  20. package/apps/studio/canvas-build-worker.ts +10 -0
  21. package/apps/studio/canvas-create.ts +24 -0
  22. package/apps/studio/canvas-module-cache.ts +93 -0
  23. package/apps/studio/canvas-source/errors.ts +39 -0
  24. package/apps/studio/canvas-source/waiting.ts +290 -0
  25. package/apps/studio/client/actions/shell-key-handlers.js +5 -0
  26. package/apps/studio/client/app.jsx +22 -9
  27. package/apps/studio/client/github.js +23 -3
  28. package/apps/studio/client/home/home-api.js +30 -19
  29. package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
  30. package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
  31. package/apps/studio/client/hooks/use-tabs.jsx +64 -35
  32. package/apps/studio/client/index-loader.ts +23 -3
  33. package/apps/studio/client/panels/ChatPanel.jsx +22 -37
  34. package/apps/studio/client/panels/DiffView.jsx +314 -248
  35. package/apps/studio/client/panels/TeamProjects.jsx +119 -69
  36. package/apps/studio/client/panels/acp-runtime.js +25 -0
  37. package/apps/studio/client/panels/chat-finish.js +66 -0
  38. package/apps/studio/client/shell/frame-cap.js +53 -0
  39. package/apps/studio/client/shell/viewport.jsx +9 -0
  40. package/apps/studio/client/styles/_index.css +2 -0
  41. package/apps/studio/client/tree/tree.jsx +48 -21
  42. package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
  43. package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
  44. package/apps/studio/client/v2/ai/ai-run.css +87 -3
  45. package/apps/studio/client/v2/ai/background-model.js +113 -0
  46. package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
  47. package/apps/studio/client/v2/ai/run-api.js +7 -3
  48. package/apps/studio/client/v2/ai/runs-store.js +2 -1
  49. package/apps/studio/client/v2/annotations/vote-store.js +11 -5
  50. package/apps/studio/client/v2/assets/asset-state-lane.js +176 -8
  51. package/apps/studio/client/v2/assets/assets-bus.js +10 -8
  52. package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
  53. package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
  54. package/apps/studio/client/v2/assets/missing-frame.jsx +8 -4
  55. package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
  56. package/apps/studio/client/v2/assets/spotlight.css +153 -0
  57. package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
  58. package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
  59. package/apps/studio/client/v2/assets/tile.jsx +3 -0
  60. package/apps/studio/client/v2/assets/use-assets.js +2 -1
  61. package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
  62. package/apps/studio/client/v2/canvases/covers.js +11 -5
  63. package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
  64. package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
  65. package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
  66. package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
  67. package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
  68. package/apps/studio/client/v2/canvases/use-pins.js +2 -1
  69. package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
  70. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
  71. package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
  72. package/apps/studio/client/v2/code/code.css +67 -0
  73. package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
  74. package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
  75. package/apps/studio/client/v2/create/name-dialog.css +10 -0
  76. package/apps/studio/client/v2/ds/advanced-host.jsx +5 -2
  77. package/apps/studio/client/v2/ds/make-host.jsx +5 -2
  78. package/apps/studio/client/v2/ds/off-system-host.jsx +5 -2
  79. package/apps/studio/client/v2/ds/truth-host.jsx +5 -2
  80. package/apps/studio/client/v2/empty/arriving.jsx +29 -12
  81. package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
  82. package/apps/studio/client/v2/empty/not-local.jsx +31 -1
  83. package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
  84. package/apps/studio/client/v2/export/last-finished.js +2 -1
  85. package/apps/studio/client/v2/export/native-save.js +44 -0
  86. package/apps/studio/client/v2/history/git-model.js +18 -4
  87. package/apps/studio/client/v2/history/git-parts.jsx +60 -42
  88. package/apps/studio/client/v2/history/history.css +6 -0
  89. package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
  90. package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
  91. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
  92. package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
  93. package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
  94. package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
  95. package/apps/studio/client/v2/search/search-recent.js +3 -1
  96. package/apps/studio/client/v2/search/search-remote.js +6 -4
  97. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  98. package/apps/studio/client/v2/shell/menu-runner.js +1 -0
  99. package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
  100. package/apps/studio/client/v2/shell/recovery-store.js +2 -1
  101. package/apps/studio/client/v2/shell/served-routes.js +120 -0
  102. package/apps/studio/client/v2/shell/share-cluster-host.jsx +2 -1
  103. package/apps/studio/client/v2/shell/shell-activity.js +19 -0
  104. package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
  105. package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
  106. package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
  107. package/apps/studio/cloud/endpoints.ts +23 -1
  108. package/apps/studio/dist/client.bundle.js +798 -801
  109. package/apps/studio/dist/comment-mount.js +2 -2
  110. package/apps/studio/dist/styles.css +1 -1
  111. package/apps/studio/ds-assets.ts +138 -48
  112. package/apps/studio/editing/minimap-context.tsx +3 -3
  113. package/apps/studio/editing/page-activity.ts +251 -0
  114. package/apps/studio/editing/rotate-handle.tsx +9 -5
  115. package/apps/studio/editing/sticky-name.tsx +4 -4
  116. package/apps/studio/history/restore-artboard-action.ts +40 -0
  117. package/apps/studio/home/hub.ts +77 -175
  118. package/apps/studio/home/routes.ts +47 -8
  119. package/apps/studio/http.ts +117 -66
  120. package/apps/studio/index-flight.ts +40 -0
  121. package/apps/studio/managed-projects.ts +52 -24
  122. package/apps/studio/migrate/hub.ts +7 -1
  123. package/apps/studio/routes/asset-state.ts +12 -0
  124. package/apps/studio/routes/canvas-source.ts +44 -2
  125. package/apps/studio/routes/ds-assets.ts +8 -0
  126. package/apps/studio/routes/history.ts +28 -5
  127. package/apps/studio/routes/hub-signin.ts +115 -0
  128. package/apps/studio/routes/index.ts +4 -0
  129. package/apps/studio/routes/table.ts +7 -0
  130. package/apps/studio/routes/trash.ts +3 -0
  131. package/apps/studio/server.ts +11 -0
  132. package/apps/studio/sync/accepted-cold-start.ts +26 -3
  133. package/apps/studio/sync/accepted-link.ts +9 -4
  134. package/apps/studio/sync/asset-push.ts +8 -1
  135. package/apps/studio/sync/asset-state.ts +27 -2
  136. package/apps/studio/sync/code-module-consent.ts +74 -0
  137. package/apps/studio/sync/file-ledger.ts +35 -0
  138. package/apps/studio/sync/file-plane.ts +479 -84
  139. package/apps/studio/sync/hub-browser-signin.ts +377 -0
  140. package/apps/studio/sync/hub-text-undo.ts +30 -10
  141. package/apps/studio/sync/index.ts +73 -11
  142. package/apps/studio/sync/lfs-pointer.ts +137 -0
  143. package/apps/studio/sync/projection.ts +44 -2
  144. package/apps/studio/sync/pull-pacer.ts +160 -0
  145. package/apps/studio/sync/pull-priority.ts +119 -0
  146. package/apps/studio/sync/seed-progress.ts +47 -3
  147. package/apps/studio/sync/transaction-client.ts +71 -6
  148. package/apps/studio/sync/workspace-signin.ts +6 -256
  149. package/apps/studio/sync/writer-registry.ts +5 -1
  150. package/apps/studio/video-links-overlay.tsx +3 -2
  151. package/apps/studio/whats-new.json +63 -0
  152. package/cli/lib/design-help.gen.mjs +1 -1
  153. package/cli/lib/workspace-plan.mjs +14 -0
  154. package/package.json +8 -8
@@ -7,6 +7,10 @@
7
7
  // `save` returned in this run of the app
8
8
  // copyPng(blob) → navigator.clipboard, then `clipboard_write_png` (Q13: WKWebView
9
9
  // refuses ClipboardItem outside some gestures)
10
+ // copyText(text) → navigator.clipboard (≤ 800 ms), then `clipboard_write_text` (2.0.3:
11
+ // a click inside the canvas iframe leaves the
12
+ // shell without user activation; WKWebView
13
+ // refuses, or leaves the promise pending)
10
14
  //
11
15
  // The bytes of a save never pass through the page: Rust fetches the job from this project's own server by
12
16
  // id. `saveTo` is ExportSpecV2's (`ask` | `remembered` | `downloads`; absent = ask). Rust is the gate (the
@@ -25,8 +29,14 @@ export const SAVE_COMMANDS = Object.freeze({
25
29
  save: 'save_export',
26
30
  reveal: 'reveal_export',
27
31
  copyPng: 'clipboard_write_png',
32
+ copyText: 'clipboard_write_text',
28
33
  });
29
34
 
35
+ /** Mirrors export_save.rs `MAX_CLIPBOARD_TEXT` (UTF-8 bytes). */
36
+ export const MAX_CLIPBOARD_TEXT = 64 * 1024;
37
+ /** How long `navigator.clipboard.writeText` may stay pending before the shell writes it instead. */
38
+ export const BROWSER_COPY_TIMEOUT_MS = 800;
39
+
30
40
  export const SAVE_TO = Object.freeze(['ask', 'remembered', 'downloads']);
31
41
 
32
42
  /** Mirrors export_save.rs `MAX_CLIPBOARD_PNG`. */
@@ -79,6 +89,7 @@ export function nativeSave(win = typeof window !== 'undefined' ? window : null,
79
89
  const download = opts.download ?? ((jobId, filename) => browserDownload(win, jobId, filename));
80
90
  const clipboard = opts.clipboard ?? win?.navigator?.clipboard ?? null;
81
91
  const Item = opts.ClipboardItem ?? win?.ClipboardItem ?? null;
92
+ const copyTimeoutMs = opts.copyTimeoutMs ?? BROWSER_COPY_TIMEOUT_MS;
82
93
 
83
94
  return {
84
95
  available: !!invoke,
@@ -156,5 +167,38 @@ export function nativeSave(win = typeof window !== 'undefined' ? window : null,
156
167
  return { ok: false, reason: 'refused', error: words(e) };
157
168
  }
158
169
  },
170
+
171
+ /** Plain text. `navigator.clipboard` first, raced against a short timeout; then the shell. */
172
+ async copyText(text) {
173
+ const s = typeof text === 'string' ? text : '';
174
+ if (!s || s.includes('\0'))
175
+ return { ok: false, reason: 'refused', error: "There's nothing to copy." };
176
+ if (new TextEncoder().encode(s).length > MAX_CLIPBOARD_TEXT) {
177
+ return { ok: false, reason: 'refused', error: 'That text is too long to copy.' };
178
+ }
179
+ if (clipboard?.writeText) {
180
+ let timer = null;
181
+ try {
182
+ const done = await Promise.race([
183
+ Promise.resolve(clipboard.writeText(s)).then(() => true),
184
+ new Promise((res) => {
185
+ timer = setTimeout(() => res(false), copyTimeoutMs);
186
+ }),
187
+ ]);
188
+ if (done) return { ok: true, via: 'browser' };
189
+ } catch {
190
+ // refused outside a gesture it trusts — the shell writes it instead
191
+ } finally {
192
+ if (timer !== null) clearTimeout(timer);
193
+ }
194
+ }
195
+ if (!invoke) return { ok: false, reason: 'refused', error: "Couldn't copy the text." };
196
+ try {
197
+ await invoke(SAVE_COMMANDS.copyText, { text: s });
198
+ return { ok: true, via: 'shell' };
199
+ } catch (e) {
200
+ return { ok: false, reason: 'refused', error: words(e) };
201
+ }
202
+ },
159
203
  };
160
204
  }
@@ -318,11 +318,25 @@ export function unitCheck(unit, unchecked) {
318
318
  return on === 0 ? 'none' : on === unit.paths.length ? 'all' : 'some';
319
319
  }
320
320
 
321
- /** The words of the discard confirm. */
321
+ /**
322
+ * The words of the discard ask (the shell's own yes/no dialog — `window.confirm` always answers no in the
323
+ * desktop app): the question names the file, the line under it says it can't be undone.
324
+ */
325
+ export function discardAsk(unit) {
326
+ return {
327
+ title: unit.supporting.length
328
+ ? `Discard your changes to “${unit.name}” and its supporting files?`
329
+ : `Discard your changes to “${unit.name}”?`,
330
+ body: "This can't be undone.",
331
+ confirm: GIT_WORDS.discard,
332
+ busy: 'Discarding…',
333
+ };
334
+ }
335
+
336
+ /** The same ask as one sentence. */
322
337
  export function discardConfirm(unit) {
323
- return unit.supporting.length
324
- ? `Discard your changes to “${unit.name}” and its supporting files? This can't be undone.`
325
- : `Discard your changes to “${unit.name}”? This can't be undone.`;
338
+ const a = discardAsk(unit);
339
+ return `${a.title} ${a.body}`;
326
340
  }
327
341
 
328
342
  // ── "Changed in this version" ──────────────────────────────────────────────────────────────────────────────
@@ -5,11 +5,12 @@
5
5
 
6
6
  import { useEffect, useRef, useState } from 'react';
7
7
  import { StIcon } from '../../shell/icons.jsx';
8
+ import { ConfirmAskDialog } from '../canvases/folder-dialogs.jsx';
8
9
  import { useModalFocus } from '../shell/modal-focus.js';
9
10
  import {
10
11
  GIT_WORDS as W,
11
12
  chatGuardCopy,
12
- discardConfirm,
13
+ discardAsk,
13
14
  saveState,
14
15
  slugifyBranch,
15
16
  unitCheck,
@@ -123,6 +124,9 @@ export function Banner({ banner, busy, onGetLatest, onDismiss }) {
123
124
 
124
125
  /** "Not in a version yet": one row per canvas (its sidecars travel with it), Compare, Discard. */
125
126
  export function UnsavedList({ units, canWrite, busy, onOpen, onCompare, onDiscard }) {
127
+ // Discard asks in the shell's own dialog: `window.confirm` always answers no in the desktop app.
128
+ const [asking, setAsking] = useState(null);
129
+ const ask = asking ? discardAsk(asking) : null;
126
130
  if (!units.length)
127
131
  return (
128
132
  <p className="vh-git-none" data-testid="vh-git-notyet">
@@ -130,51 +134,65 @@ export function UnsavedList({ units, canWrite, busy, onOpen, onCompare, onDiscar
130
134
  </p>
131
135
  );
132
136
  return (
133
- <ul className="vh-git-ul" data-testid="vh-git-notyet" aria-label={W.notYet}>
134
- {units.map((u) => (
135
- <li className="vh-git-unit" key={u.key}>
136
- <Badge kind={u.badge} title={u.badgeTitle} />
137
- <button
138
- type="button"
139
- className="vh-git-file"
140
- title={u.path}
141
- onClick={() => onOpen?.(u.path)}
142
- >
143
- <span className="vh-git-fname">{u.name}</span>
144
- <span className="vh-git-fpath">
145
- {u.supporting.length ? `${u.path} · +${u.supporting.length} supporting` : u.path}
146
- </span>
147
- </button>
148
- {u.comparable && onCompare ? (
149
- <button
150
- type="button"
151
- className="icon-btn"
152
- data-testid="git-compare"
153
- title={W.compareFile}
154
- aria-label={`${W.compareFile}: ${u.name}`}
155
- onClick={() => onCompare(u.path)}
156
- >
157
- <StIcon name="eye" size={13} />
158
- </button>
159
- ) : null}
160
- {canWrite ? (
137
+ <>
138
+ <ul className="vh-git-ul" data-testid="vh-git-notyet" aria-label={W.notYet}>
139
+ {units.map((u) => (
140
+ <li className="vh-git-unit" key={u.key}>
141
+ <Badge kind={u.badge} title={u.badgeTitle} />
161
142
  <button
162
143
  type="button"
163
- className="btn btn--ghost btn--sm"
164
- data-testid="git-discard"
165
- disabled={!!busy}
166
- aria-label={`${W.discard} changes to ${u.name}`}
167
- onClick={() => {
168
- if (!window.confirm(discardConfirm(u))) return;
169
- onDiscard(u);
170
- }}
144
+ className="vh-git-file"
145
+ title={u.path}
146
+ onClick={() => onOpen?.(u.path)}
171
147
  >
172
- {W.discard}
148
+ <span className="vh-git-fname">{u.name}</span>
149
+ <span className="vh-git-fpath">
150
+ {u.supporting.length ? `${u.path} · +${u.supporting.length} supporting` : u.path}
151
+ </span>
173
152
  </button>
174
- ) : null}
175
- </li>
176
- ))}
177
- </ul>
153
+ {u.comparable && onCompare ? (
154
+ <button
155
+ type="button"
156
+ className="icon-btn"
157
+ data-testid="git-compare"
158
+ title={W.compareFile}
159
+ aria-label={`${W.compareFile}: ${u.name}`}
160
+ onClick={() => onCompare(u.path)}
161
+ >
162
+ <StIcon name="eye" size={13} />
163
+ </button>
164
+ ) : null}
165
+ {canWrite ? (
166
+ <button
167
+ type="button"
168
+ className="btn btn--ghost btn--sm"
169
+ data-testid="git-discard"
170
+ disabled={!!busy}
171
+ aria-label={`${W.discard} changes to ${u.name}`}
172
+ onClick={() => setAsking(u)}
173
+ >
174
+ {W.discard}
175
+ </button>
176
+ ) : null}
177
+ </li>
178
+ ))}
179
+ </ul>
180
+ {ask ? (
181
+ <ConfirmAskDialog
182
+ over
183
+ title={ask.title}
184
+ body={ask.body}
185
+ confirm={ask.confirm}
186
+ busyLabel={ask.busy}
187
+ onConfirm={() => {
188
+ const u = asking;
189
+ setAsking(null);
190
+ onDiscard(u);
191
+ }}
192
+ onCancel={() => setAsking(null)}
193
+ />
194
+ ) : null}
195
+ </>
178
196
  );
179
197
  }
180
198
 
@@ -509,6 +509,12 @@
509
509
  flex: none;
510
510
  }
511
511
 
512
+ /* a failed Restore or merge, said inside the sheet (replaces window.alert) */
513
+ .dv-err {
514
+ margin: 0 var(--space-5) var(--space-3);
515
+ flex: none;
516
+ }
517
+
512
518
  .dv-note {
513
519
  color: var(--fg-2);
514
520
  font-size: var(--type-xs);
@@ -43,13 +43,15 @@ import { AssetDetails } from '../assets/details.jsx';
43
43
  import { GenerateAsk } from '../assets/generate-ask.jsx';
44
44
  import { COPY_FAILED_LINE, copyAssetImage } from '../assets/copy-asset.js';
45
45
  import { KindsChip } from '../assets/kinds-chip.jsx';
46
- import { filterKind, GROUP_CAP, libraryFootWords } from '../assets/library-foot.js';
46
+ import { filterKind, libraryFootWords } from '../assets/library-foot.js';
47
47
  import { runMeta, runTitle, splitGenerated, useGenerated } from '../assets/generated.js';
48
48
  import { splitJustAdded } from '../assets/just-added.js';
49
49
  import { placeAsset, placedWords, SELECT_ARTBOARD_LINE } from '../assets/place-asset.js';
50
50
  import { ARRIVAL_LINES, addingLine, linkName } from '../assets/import-lines.js';
51
51
  import { toastArrivals } from '../assets/import-toast.js';
52
52
  import { SeenLine } from '../assets/search-marks.jsx';
53
+ import { AssetSpotlight } from '../assets/spotlight.jsx';
54
+ import { groupShown, narrowOrder, spotlightRows } from '../assets/spotlight-model.js';
53
55
  import { AssetTile } from '../assets/tile.jsx';
54
56
  import { AssetTileMenu, tileMenuItems } from '../assets/tile-menu.jsx';
55
57
  import { ConfirmTrash, NotCountedNote, TidyFoot, tidyModel } from '../assets/tidy.jsx';
@@ -183,6 +185,8 @@ export function AssetsPanel({
183
185
  const [picked, setPicked] = useState(null);
184
186
  const [menu, setMenu] = useState(null);
185
187
  const [details, setDetails] = useState(null);
188
+ // 2.0.4 (#191) — the tile opened large ({ path, order }): `order` is the tiles ← → walks, fixed when it opened
189
+ const [spot, setSpot] = useState(null);
186
190
  // S8.13 — the wide Browse view (null = the narrow tab), the Not used filter, the confirm sheet and the Undo line
187
191
  const [browse, setBrowse] = useState(null);
188
192
  const [notUsedOnly, setNotUsedOnly] = useState(false);
@@ -366,6 +370,17 @@ export function AssetsPanel({
366
370
  }, [query, describe.hits, shown, byPath, notUsedOnly, hasUsage]);
367
371
  useAssetAnswers(); // the bars on tiles follow what the studio last said about each open canvas
368
372
  const url = (p) => `/${designRel}/${p}`;
373
+ // 2.0.4 (#191) — a double-click (or Space on the picked tile, `assets.spotlight`) opens the tile large. ← → walk the tiles
374
+ // the tab draws now: the wide Browse view's order when it is open, else the groups as the narrow tab shows them.
375
+ const openSpotlight = (path) => {
376
+ if (!byPath.has(path)) return;
377
+ setMenu(null);
378
+ const order =
379
+ browse && assets
380
+ ? browseOrder(assets, browse)
381
+ : narrowOrder(groups, seen, { uncapped: notUsedOnly && hasUsage });
382
+ setSpot({ path, order: order.includes(path) ? order : [path] });
383
+ };
369
384
  const renderTile = (a, o = undefined) => (
370
385
  <AssetTile
371
386
  key={a.path}
@@ -376,6 +391,7 @@ export function AssetsPanel({
376
391
  canDrag={!readOnly}
377
392
  onPick={setPicked}
378
393
  onMenu={openMenu}
394
+ onOpen={openSpotlight}
379
395
  uploading={assetUploadOf(a.path)}
380
396
  />
381
397
  );
@@ -583,6 +599,7 @@ export function AssetsPanel({
583
599
  place,
584
600
  placeMany,
585
601
  showDetails,
602
+ openSpotlight,
586
603
  trashSelection,
587
604
  startRename,
588
605
  readOnly,
@@ -607,6 +624,15 @@ export function AssetsPanel({
607
624
  l.showDetails(one);
608
625
  } else if (l.picked) l.showDetails(l.picked);
609
626
  },
627
+ // 2.0.4 (#191) — Space on the picked tile: the same window a double-click opens
628
+ spotlight: () => {
629
+ const l = live.current;
630
+ if (l.sourceDs) dsApi.current?.spotlight();
631
+ else {
632
+ const one = l.browse ? l.browsePicked()[0] : l.picked;
633
+ if (one) l.openSpotlight(one);
634
+ }
635
+ },
610
636
  rename: () => {
611
637
  const l = live.current;
612
638
  const one = l.browse ? l.browsePicked()[0] : l.picked;
@@ -659,14 +685,14 @@ export function AssetsPanel({
659
685
  const menuItems = menu
660
686
  ? tileMenuItems(menu.asset, { readOnly, placeLabel, count: menuCount })
661
687
  : [];
662
- const onMenuSelect = (id) => {
663
- const path = menu?.asset.path;
664
- setMenu(null);
665
- if (!path) return;
688
+ // the tile menu's rows and the spotlight's: one function (`single`: the spotlight acts on the one picture it shows)
689
+ const runTileAction = (id, path, { single = false } = {}) => {
666
690
  if (id === 'place') {
667
- if (browse && browse.selected.has(path) && browse.selected.size > 1)
691
+ if (!single && browse && browse.selected.has(path) && browse.selected.size > 1)
668
692
  void placeMany(browsePicked());
669
693
  else void place(path);
694
+ } else if (id === 'spotlight') {
695
+ openSpotlight(path);
670
696
  } else if (id === 'details') {
671
697
  setBrowse(null);
672
698
  showDetails(path);
@@ -677,6 +703,48 @@ export function AssetsPanel({
677
703
  } else if (id === 'rename') startRename(path);
678
704
  else if (id === 'trash') trashSelection(path);
679
705
  };
706
+ const onMenuSelect = (id) => {
707
+ const path = menu?.asset.path;
708
+ setMenu(null);
709
+ if (path) runTileAction(id, path);
710
+ };
711
+
712
+ // ── 2.0.4 (#191): the spotlight ────────────────────────────────────────────────────────────────────────────────
713
+ const spotItems = spot ? spot.order.map((p) => byPath.get(p)).filter(Boolean) : [];
714
+ const spotIndex = spot ? spotItems.findIndex((a) => a.path === spot.path) : -1;
715
+ // the tile the window was showing takes focus back (esc, the button and a click outside all end here)
716
+ const focusTile = (path) => {
717
+ const tile = Array.from(document.querySelectorAll('[data-testid="assets-tile"]')).find(
718
+ (el) => el.dataset.asset === path && el.getClientRects().length > 0
719
+ );
720
+ tile?.focus?.({ preventScroll: true });
721
+ };
722
+ const closeSpotlight = () => {
723
+ const path = spot?.path;
724
+ if (path) focusTile(path);
725
+ setSpot(null);
726
+ };
727
+ // stepping moves the pick with it, so what ↵ places and ⌘I opens is the picture you were looking at
728
+ const stepSpotlight = (i) => {
729
+ const a = spotItems[i];
730
+ if (!a) return;
731
+ setSpot((cur) => (cur ? { ...cur, path: a.path } : cur));
732
+ if (browse) patchBrowse({ ...pickTile(spot.order, browse, a.path, {}) });
733
+ else setPicked(a.path);
734
+ };
735
+ const spotRows =
736
+ spotIndex >= 0
737
+ ? spotlightRows(
738
+ tileMenuItems(spotItems[spotIndex], { readOnly, placeLabel, count: 1 }).filter(
739
+ (r) => r.id !== 'spotlight'
740
+ )
741
+ )
742
+ : [];
743
+ const runSpotRow = (id) => {
744
+ const path = spotItems[spotIndex]?.path;
745
+ setSpot(null);
746
+ if (path) runTileAction(id, path, { single: true });
747
+ };
680
748
 
681
749
  const detailed = details ? byPath.get(details) : null;
682
750
  // Not used, narrowed by the search: the numbers on the foot are what is listed, so "Move N" moves what is shown
@@ -1154,10 +1222,7 @@ export function AssetsPanel({
1154
1222
  </div>
1155
1223
  ) : (
1156
1224
  <div className="lp-grid">
1157
- {(g.kind === 'added' || (notUsedOnly && hasUsage)
1158
- ? g.items
1159
- : g.items.slice(0, GROUP_CAP)
1160
- ).map(renderTile)}
1225
+ {groupShown(g, { uncapped: notUsedOnly && hasUsage }).map(renderTile)}
1161
1226
  </div>
1162
1227
  )}
1163
1228
  </section>
@@ -1238,6 +1303,7 @@ export function AssetsPanel({
1238
1303
  onChange={patchBrowse}
1239
1304
  onPick={onBrowsePick}
1240
1305
  onMenu={openMenu}
1306
+ onOpen={openSpotlight}
1241
1307
  onBack={() => setBrowse(null)}
1242
1308
  onClear={() => patchBrowse({ ...NOTHING_PICKED })}
1243
1309
  onPlace={(paths) => void placeMany(paths)}
@@ -1257,6 +1323,17 @@ export function AssetsPanel({
1257
1323
  />
1258
1324
  ) : null}
1259
1325
  <AssetTileMenu state={menu} items={menuItems} onSelect={onMenuSelect} onClose={closeMenu} />
1326
+ {spot && spotIndex >= 0 ? (
1327
+ <AssetSpotlight
1328
+ items={spotItems}
1329
+ index={spotIndex}
1330
+ urlOf={url}
1331
+ rows={spotRows}
1332
+ onIndex={stepSpotlight}
1333
+ onClose={closeSpotlight}
1334
+ onRow={runSpotRow}
1335
+ />
1336
+ ) : null}
1260
1337
  </div>
1261
1338
  );
1262
1339
  }
@@ -17,6 +17,7 @@
17
17
  import { useCallback, useEffect, useRef, useState } from 'react';
18
18
 
19
19
  import { trashClearRequest, trashRestoreRequest } from '../../../history/surface-requests.ts';
20
+ import { fetchIfServed } from '../shell/served-routes.js';
20
21
 
21
22
  /** The app shell relays the bus's `trash:changed { seq }` as this window event. */
22
23
  export const TRASH_CHANGED_EVENT = 'maude:trash-changed';
@@ -32,7 +33,7 @@ export function visibleTrash(j) {
32
33
  /** Today's per-Mac list (`/_api/sync/trash`): "Kept on this Mac". Null when the route refuses. */
33
34
  export async function fetchTrash(fetchImpl = fetch) {
34
35
  try {
35
- const r = await fetchImpl('/_api/sync/trash');
36
+ const r = await fetchIfServed('/_api/sync/trash', undefined, fetchImpl);
36
37
  if (!r.ok) return null;
37
38
  const j = await r.json();
38
39
  return j && Array.isArray(j.entries) ? visibleTrash(j) : null;
@@ -3,16 +3,18 @@
3
3
  // shell command a sheet's button runs. Each sheet is a view (exported from ./index.js for S11.14), so Settings ›
4
4
  // Connections mounts the same sheets with its own wiring.
5
5
  //
6
- // hub → /_home/hub/{test,prepare,join} then Home's own open of the managed copy (a tab);
7
- // `join` (S6.11b) redeems a hub invite ("Invite link or key")
6
+ // hub → /_home/hub/test; Sign in (#204 K2) → /_home/hub/signin/start, the shell opens the hub's
7
+ // own page (`open_team_server_signin`; with an invite, the hub's invite page), poll until
8
+ // the browser came back, then /_home/hub/prepare and Home's own open of the managed copy
8
9
  // folder-github → the shell's folder picker (`open_project_folder`); "From GitHub" (S6.10) → Rust's
9
10
  // github_repos / home_github_sign_in / github_clone / github_create, then `open_project({root})`
10
11
  // ai → /_home/ai/{status,connect} (install Claude Code, then the browser sign-in)
11
12
  // cli → /_home/cli/{status,install} (a link to the bundled maude; the plugin when claude is there)
12
13
  // figma → the target project opens with the `import-figma` intent (Q8)
13
14
  //
14
- // No credential reaches a log or comes back into the page: the hub password is posted once from the sheet's
15
- // own state and emptied; the AI sign-in is the person's browser; nothing here stores a token.
15
+ // No credential reaches a log or comes back into the page: the app owns no team-server password (the hub's
16
+ // own page in the browser takes it, issue #204); the AI sign-in is the person's browser; nothing here stores
17
+ // a token.
16
18
 
17
19
  import { useCallback, useEffect, useRef, useState } from 'react';
18
20
 
@@ -21,12 +23,15 @@ import {
21
23
  aiStatus,
22
24
  cliInstall,
23
25
  cliStatus,
24
- hubJoin,
25
26
  hubPrepare,
27
+ hubSignInCancel,
28
+ hubSignInPoll,
29
+ hubSignInStart,
26
30
  hubTest,
27
31
  inShell,
28
32
  openProject,
29
33
  openProjectFolder,
34
+ openTeamServerSignIn,
30
35
  shellListen,
31
36
  } from '../../home/home-api.js';
32
37
  import { useGithubSegment } from './GithubSegment.jsx';
@@ -180,6 +185,95 @@ function FigmaHost({ target, onClose, startFigma }) {
180
185
  return <FigmaSheet target={target} busy={busy} error={error} onImport={go} onCancel={onClose} />;
181
186
  }
182
187
 
188
+ /** How often Home asks whether the browser came back (the hub's code lives a minute). */
189
+ export const HUB_POLL_MS = 1500;
190
+
191
+ /**
192
+ * #204 K2 — the hub sheet's host: Sign in opens the hub's own page and waits for the browser to come back to
193
+ * Home's server; Cancel forgets the attempt (a late return then changes nothing). `pollMs` is a test seam.
194
+ */
195
+ function HubHost({ onClose, profile, openPrepared, pollMs = HUB_POLL_MS }) {
196
+ const attempt = useRef(null); // { id, stop: (r) => void }
197
+ useEffect(
198
+ () => () => {
199
+ const a = attempt.current;
200
+ attempt.current = null;
201
+ if (a) {
202
+ a.stop({ ok: false, cancelled: true });
203
+ void hubSignInCancel(a.id);
204
+ }
205
+ },
206
+ []
207
+ );
208
+
209
+ const waitForBrowser = (id) =>
210
+ new Promise((resolve) => {
211
+ let timer = null;
212
+ const stop = (r) => {
213
+ clearTimeout(timer);
214
+ resolve(r);
215
+ };
216
+ attempt.current = { id, stop };
217
+ const tick = async () => {
218
+ const p = await hubSignInPoll(id);
219
+ if (attempt.current?.id !== id) return; // cancelled meanwhile
220
+ if (p.json?.pending) {
221
+ timer = setTimeout(tick, pollMs);
222
+ return;
223
+ }
224
+ attempt.current = null;
225
+ stop(
226
+ p.ok && p.json?.ok && p.json.url
227
+ ? { ok: true, url: p.json.url }
228
+ : { ok: false, error: p.json?.error || HUB_WORDS.unreachable }
229
+ );
230
+ };
231
+ timer = setTimeout(tick, 0); // the first ask at once, then every pollMs
232
+ });
233
+
234
+ return (
235
+ <HubSheet
236
+ onCancel={onClose}
237
+ onTest={async (url) => {
238
+ const r = await hubTest(url);
239
+ return r.json?.ok
240
+ ? { ok: true, version: r.json.version ?? null }
241
+ : { ok: false, error: r.json?.error || HUB_WORDS.unreachable };
242
+ }}
243
+ onSignIn={async ({ url, invite, onWaiting }) => {
244
+ const s = await hubSignInStart(profile, url, invite);
245
+ if (!s.ok || !s.json?.ok)
246
+ return { ok: false, error: s.json?.error || HUB_WORDS.unreachable };
247
+ const id = s.json.id;
248
+ const opened = await openTeamServerSignIn(s.json.signInUrl);
249
+ if (opened !== 'ok') {
250
+ void hubSignInCancel(id);
251
+ return {
252
+ ok: false,
253
+ error: opened === 'refused' ? HUB_WORDS.refused : HUB_WORDS.noBrowser,
254
+ };
255
+ }
256
+ onWaiting();
257
+ const done = await waitForBrowser(id);
258
+ if (!done.ok) return done;
259
+ const r = await hubPrepare(profile, done.url);
260
+ if (!r.ok || !r.json?.ok)
261
+ return { ok: false, error: r.json?.error || HUB_WORDS.unreachable };
262
+ await openPrepared(r, r.json.name, profile);
263
+ onClose();
264
+ return { ok: true };
265
+ }}
266
+ onAbortSignIn={() => {
267
+ const a = attempt.current;
268
+ attempt.current = null;
269
+ if (!a) return;
270
+ void hubSignInCancel(a.id);
271
+ a.stop({ ok: false, cancelled: true });
272
+ }}
273
+ />
274
+ );
275
+ }
276
+
183
277
  /**
184
278
  * @param {{ open: string|null, onClose: () => void, profile: string, target?: object|null,
185
279
  * openPrepared: (prep: object, name: string, profile: string) => Promise<unknown>,
@@ -199,34 +293,7 @@ export function AdvancedSheets({
199
293
  github = null,
200
294
  }) {
201
295
  if (open === 'hub')
202
- return (
203
- <HubSheet
204
- onCancel={onClose}
205
- onTest={async (url) => {
206
- const r = await hubTest(url);
207
- return r.json?.ok
208
- ? { ok: true, version: r.json.version ?? null }
209
- : { ok: false, error: r.json?.error || HUB_WORDS.unreachable };
210
- }}
211
- onConnect={async ({ url, email, password }) => {
212
- const r = await hubPrepare(profile, url, email || password ? { email, password } : null);
213
- if (!r.ok || !r.json?.ok)
214
- return { ok: false, error: r.json?.error || HUB_WORDS.unreachable };
215
- await openPrepared(r, r.json.name, profile);
216
- onClose();
217
- return { ok: true };
218
- }}
219
- // S6.11b — "Invite link or key": the hub's own invite redeem, then the same open
220
- onJoin={async ({ url, token, email, password }) => {
221
- const r = await hubJoin(profile, url, { token, email, password });
222
- if (!r.ok || !r.json?.ok)
223
- return { ok: false, error: r.json?.error || HUB_WORDS.unreachable };
224
- await openPrepared(r, r.json.name, profile);
225
- onClose();
226
- return { ok: true };
227
- }}
228
- />
229
- );
296
+ return <HubHost onClose={onClose} profile={profile} openPrepared={openPrepared} />;
230
297
  if (open === 'folder-github')
231
298
  return (
232
299
  <FolderHost onClose={onClose} openFolder={openFolder} profile={profile} github={github} />