@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.
- package/README.md +6 -5
- package/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/filters.ts +12 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/access/request.ts +0 -1
- package/apps/studio/acp/adapter-stderr.ts +43 -13
- package/apps/studio/acp/background-tasks.ts +155 -0
- package/apps/studio/acp/bridge.ts +44 -5
- package/apps/studio/acp/connected-fact.ts +15 -4
- package/apps/studio/acp/index.ts +14 -5
- package/apps/studio/actions/agents.ts +10 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/view.ts +12 -0
- package/apps/studio/actions.manifest.json +25 -1
- package/apps/studio/actions.parity.json +13 -1
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-layer.tsx +0 -12
- package/apps/studio/api.ts +73 -24
- package/apps/studio/artboard-live-gate.tsx +267 -0
- package/apps/studio/artboard-live.ts +336 -0
- package/apps/studio/artboard-webgl.ts +668 -0
- package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
- package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
- package/apps/studio/bin/_canvas-reasons.mjs +34 -0
- package/apps/studio/bin/_ds-check-live.mjs +37 -0
- package/apps/studio/bin/_ds-check.mjs +4 -1
- package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
- package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
- package/apps/studio/bin/_import-asset.mjs +2 -1
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_png-playwright.mjs +10 -1
- package/apps/studio/bin/_pw-launch.mjs +14 -0
- package/apps/studio/bin/_studio-verb.mjs +24 -3
- package/apps/studio/bin/_thumb-blank.mjs +70 -0
- package/apps/studio/bin/_thumb-cover.mjs +35 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +93 -13
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +11 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/boot-progress.ts +31 -0
- package/apps/studio/canvas-build-sandbox.ts +275 -42
- package/apps/studio/canvas-build-worker.ts +10 -0
- package/apps/studio/canvas-create.ts +24 -0
- package/apps/studio/canvas-lib.tsx +131 -12
- package/apps/studio/canvas-module-cache.ts +93 -0
- package/apps/studio/canvas-source/errors.ts +39 -0
- package/apps/studio/canvas-source/waiting.ts +290 -0
- package/apps/studio/client/actions/shell-key-handlers.js +5 -0
- package/apps/studio/client/app.jsx +19 -9
- package/apps/studio/client/canvas-url.js +13 -0
- package/apps/studio/client/github.js +23 -3
- package/apps/studio/client/home/HomeAccounts.jsx +262 -0
- package/apps/studio/client/home/Shelves.jsx +4 -3
- package/apps/studio/client/home/home-accounts-model.js +121 -0
- package/apps/studio/client/home/home-api.js +36 -19
- package/apps/studio/client/home/home-app.jsx +141 -40
- package/apps/studio/client/home/home-model.js +172 -6
- package/apps/studio/client/home/home.css +169 -5
- package/apps/studio/client/home/shell-mode.js +8 -1
- package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
- package/apps/studio/client/hooks/use-project-data.jsx +2 -0
- package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
- package/apps/studio/client/hooks/use-tabs.jsx +64 -35
- package/apps/studio/client/index-loader.ts +23 -3
- package/apps/studio/client/panels/ChatPanel.jsx +49 -57
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/DiffView.jsx +314 -248
- package/apps/studio/client/panels/TeamProjects.jsx +119 -69
- package/apps/studio/client/panels/acp-runtime.js +25 -0
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/panels/chat-finish.js +66 -0
- package/apps/studio/client/shell/frame-cap.js +53 -0
- package/apps/studio/client/shell/viewport.jsx +45 -8
- package/apps/studio/client/styles/_index.css +2 -0
- package/apps/studio/client/tree/tree.jsx +48 -21
- package/apps/studio/client/v2/access/access-client.js +2 -0
- package/apps/studio/client/v2/access/access-host.jsx +12 -1
- package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
- package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
- package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
- package/apps/studio/client/v2/ai/Composer.jsx +27 -10
- package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
- package/apps/studio/client/v2/ai/ai-run.css +87 -3
- package/apps/studio/client/v2/ai/background-model.js +113 -0
- package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
- package/apps/studio/client/v2/ai/run-api.js +7 -3
- package/apps/studio/client/v2/ai/runs-store.js +2 -1
- package/apps/studio/client/v2/annotations/vote-store.js +11 -5
- package/apps/studio/client/v2/assets/asset-state-lane.js +6 -3
- package/apps/studio/client/v2/assets/assets-bus.js +10 -8
- package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
- package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
- package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
- package/apps/studio/client/v2/assets/spotlight.css +153 -0
- package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
- package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
- package/apps/studio/client/v2/assets/tile.jsx +3 -0
- package/apps/studio/client/v2/assets/use-assets.js +2 -1
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
- package/apps/studio/client/v2/canvases/covers.js +11 -5
- package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
- package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
- package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
- package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
- package/apps/studio/client/v2/canvases/use-pins.js +2 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
- package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code.css +67 -0
- package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
- package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
- package/apps/studio/client/v2/create/name-dialog.css +10 -0
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -23
- package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
- package/apps/studio/client/v2/ds/library-host.jsx +45 -45
- package/apps/studio/client/v2/ds/make-host.jsx +13 -12
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -16
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -14
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- package/apps/studio/client/v2/empty/arriving.jsx +29 -12
- package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
- package/apps/studio/client/v2/empty/not-local.jsx +31 -1
- package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
- package/apps/studio/client/v2/export/last-finished.js +2 -1
- package/apps/studio/client/v2/history/branch-actions.js +13 -9
- package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
- package/apps/studio/client/v2/history/git-model.js +21 -5
- package/apps/studio/client/v2/history/git-parts.jsx +76 -43
- package/apps/studio/client/v2/history/history.css +6 -0
- package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
- package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
- package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
- package/apps/studio/client/v2/search/search-recent.js +3 -1
- package/apps/studio/client/v2/search/search-remote.js +6 -4
- package/apps/studio/client/v2/settings/connections-model.js +1 -1
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +12 -0
- package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
- package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
- package/apps/studio/client/v2/shell/project-account-model.js +182 -0
- package/apps/studio/client/v2/shell/recovery-store.js +2 -1
- package/apps/studio/client/v2/shell/served-routes.js +120 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +139 -11
- package/apps/studio/client/v2/shell/share-cluster.css +58 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
- package/apps/studio/client/v2/shell/shell-activity.js +19 -0
- package/apps/studio/client/v2/shell/team-switch.js +94 -0
- package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
- package/apps/studio/client/v2/shell/use-account.js +8 -1
- package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
- package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
- package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
- package/apps/studio/cloud/endpoints.ts +23 -1
- package/apps/studio/collab/persistence.ts +9 -1
- package/apps/studio/collab/registry.ts +32 -0
- package/apps/studio/collab/room.ts +8 -0
- package/apps/studio/config-reload-wire.ts +53 -0
- package/apps/studio/dist/client.bundle.js +1098 -1102
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/specimen.tsx +12 -1
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +7 -3
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/upgrade-apply.ts +27 -5
- package/apps/studio/ds/upgrade-cli.ts +22 -2
- package/apps/studio/ds/upgrade-prove.ts +198 -15
- package/apps/studio/ds/upgrade-stage.ts +4 -1
- package/apps/studio/editing/minimap-context.tsx +3 -3
- package/apps/studio/editing/page-activity.ts +251 -0
- package/apps/studio/editing/rotate-handle.tsx +9 -5
- package/apps/studio/editing/sticky-name.tsx +4 -4
- package/apps/studio/history/restore-artboard-action.ts +40 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/hub.ts +77 -175
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +66 -8
- package/apps/studio/http.ts +131 -68
- package/apps/studio/index-flight.ts +40 -0
- package/apps/studio/managed-projects.ts +52 -24
- package/apps/studio/migrate/hub.ts +7 -1
- package/apps/studio/routes/canvas-source.ts +44 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/history.ts +28 -5
- package/apps/studio/routes/hub-signin.ts +115 -0
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/table.ts +7 -0
- package/apps/studio/routes/trash.ts +19 -1
- package/apps/studio/server.ts +19 -10
- package/apps/studio/sync/accepted-cold-start.ts +54 -16
- package/apps/studio/sync/accepted-link.ts +9 -4
- package/apps/studio/sync/asset-push.ts +146 -23
- package/apps/studio/sync/asset-state.ts +3 -2
- package/apps/studio/sync/code-module-consent.ts +74 -0
- package/apps/studio/sync/file-ledger.ts +35 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +483 -86
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/hub-browser-signin.ts +377 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hub-text-undo.ts +30 -10
- package/apps/studio/sync/index.ts +381 -161
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +121 -14
- package/apps/studio/sync/pull-pacer.ts +160 -0
- package/apps/studio/sync/pull-priority.ts +119 -0
- package/apps/studio/sync/seed-progress.ts +58 -3
- package/apps/studio/sync/status.ts +3 -1
- package/apps/studio/sync/transaction-client.ts +71 -6
- package/apps/studio/sync/workspace-signin.ts +6 -256
- package/apps/studio/sync/writer-registry.ts +5 -1
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/video-comp.tsx +23 -0
- package/apps/studio/video-links-overlay.tsx +3 -2
- package/apps/studio/whats-new.json +126 -0
- package/cli/lib/bash-guard.mjs +13 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/cli/lib/workspace-plan.mjs +14 -0
- package/package.json +8 -8
|
@@ -15,7 +15,9 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
15
15
|
import {
|
|
16
16
|
createLocal,
|
|
17
17
|
createLocalFromPrompt,
|
|
18
|
+
getAccounts,
|
|
18
19
|
getCloud,
|
|
20
|
+
getConfig,
|
|
19
21
|
getIndex,
|
|
20
22
|
getFirstRunSeen,
|
|
21
23
|
getRecentSearches,
|
|
@@ -40,6 +42,7 @@ import {
|
|
|
40
42
|
takePendingDeepLink,
|
|
41
43
|
thumbObjectUrl,
|
|
42
44
|
} from './home-api.js';
|
|
45
|
+
import { homeBootConfig } from './shell-mode.js';
|
|
43
46
|
import { parseMaudeLink } from '../share-link.js';
|
|
44
47
|
import { browserDoorOf } from '../v2/cloud/browser-door.js';
|
|
45
48
|
import { AdvancedSheets } from '../v2/onboarding/AdvancedSheets.jsx';
|
|
@@ -56,6 +59,7 @@ import { HOME_MENU, homeMenuCtx, homeMenuState } from './home-menu.js';
|
|
|
56
59
|
import { InviteSheet } from './InviteSheet.jsx';
|
|
57
60
|
import { INVITE_WORDS, joinPendingAndOpen, useInviteFlow } from './invite-flow.js';
|
|
58
61
|
import { HIcon, HMark, HSpark, ProjectSquare } from './home-icons.jsx';
|
|
62
|
+
import { HomeAccounts } from './HomeAccounts.jsx';
|
|
59
63
|
import {
|
|
60
64
|
accountFace,
|
|
61
65
|
buildHomeModel,
|
|
@@ -117,6 +121,17 @@ function browserPids() {
|
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
|
|
124
|
+
/** `/_config.cloudOrigin` when it is an http(s) origin, else null. */
|
|
125
|
+
function cloudOriginOf(cfg) {
|
|
126
|
+
const o = cfg?.cloudOrigin;
|
|
127
|
+
return typeof o === 'string' && /^https?:\/\/[^/]+$/i.test(o) ? o : null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Who each profile is signed in as (id · e-mail · GitHub login): changes on a sign-in or sign-out. */
|
|
131
|
+
function profileSignature(s) {
|
|
132
|
+
return (s?.profiles ?? []).map((p) => [p?.id, p?.email, p?.github].join('|')).join(',');
|
|
133
|
+
}
|
|
134
|
+
|
|
120
135
|
// ── data ─────────────────────────────────────────────────────────────────────────────────────
|
|
121
136
|
function useHomeData() {
|
|
122
137
|
const [shell, setShell] = useState(null);
|
|
@@ -172,6 +187,11 @@ function useHomeData() {
|
|
|
172
187
|
}
|
|
173
188
|
}, [native]);
|
|
174
189
|
|
|
190
|
+
// 2.0.5 — counts the moments the team-server accounts may have changed (a reload after a sign-in or
|
|
191
|
+
// sign-out, an index change, a profile change); the rows read /_home/accounts again on every tick
|
|
192
|
+
const [accountsEpoch, setAccountsEpoch] = useState(0);
|
|
193
|
+
const bumpAccounts = useCallback(() => setAccountsEpoch((e) => e + 1), []);
|
|
194
|
+
|
|
175
195
|
const loadAll = useCallback(async () => {
|
|
176
196
|
const s = await readShell();
|
|
177
197
|
shellRef.current = s;
|
|
@@ -179,7 +199,8 @@ function useHomeData() {
|
|
|
179
199
|
const ok = await fetchIndexFor(s, null);
|
|
180
200
|
setStatus(ok ? 'ready' : 'offline');
|
|
181
201
|
fetchClouds(s);
|
|
182
|
-
|
|
202
|
+
bumpAccounts();
|
|
203
|
+
}, [readShell, fetchIndexFor, fetchClouds, bumpAccounts]);
|
|
183
204
|
|
|
184
205
|
// step 5 — re-run 1–2 for the pids whose place changed (or that are new)
|
|
185
206
|
const onShellState = useCallback(
|
|
@@ -199,8 +220,10 @@ function useHomeData() {
|
|
|
199
220
|
if (changed.length) fetchIndexFor(s, changed);
|
|
200
221
|
const profiles = (s.profiles ?? []).map((p) => p.id).join();
|
|
201
222
|
if (profiles !== (prev?.profiles ?? []).map((p) => p.id).join()) fetchClouds(s);
|
|
223
|
+
// a profile signed in or out keeps its id but changes its e-mail / GitHub login
|
|
224
|
+
if (profileSignature(s) !== profileSignature(prev)) bumpAccounts();
|
|
202
225
|
},
|
|
203
|
-
[readShell, fetchIndexFor, fetchClouds]
|
|
226
|
+
[readShell, fetchIndexFor, fetchClouds, bumpAccounts]
|
|
204
227
|
);
|
|
205
228
|
|
|
206
229
|
useEffect(() => {
|
|
@@ -213,6 +236,7 @@ function useHomeData() {
|
|
|
213
236
|
shellListen('index://changed', (p) => {
|
|
214
237
|
const pids = Array.isArray(p?.pids) ? p.pids : null;
|
|
215
238
|
fetchIndexFor(shellRef.current, pids);
|
|
239
|
+
bumpAccounts();
|
|
216
240
|
}).then((off) => (alive ? offs.push(off) : off()));
|
|
217
241
|
const onVisible = () => {
|
|
218
242
|
if (document.visibilityState === 'visible') loadAll();
|
|
@@ -223,7 +247,7 @@ function useHomeData() {
|
|
|
223
247
|
for (const off of offs) off();
|
|
224
248
|
document.removeEventListener('visibilitychange', onVisible);
|
|
225
249
|
};
|
|
226
|
-
}, [loadAll, onShellState, fetchIndexFor]);
|
|
250
|
+
}, [loadAll, onShellState, fetchIndexFor, bumpAccounts]);
|
|
227
251
|
|
|
228
252
|
const patchPin = useCallback((pid, rel, pinnedAt) => {
|
|
229
253
|
setIndex((prev) => {
|
|
@@ -238,7 +262,17 @@ function useHomeData() {
|
|
|
238
262
|
});
|
|
239
263
|
}, []);
|
|
240
264
|
|
|
241
|
-
return {
|
|
265
|
+
return {
|
|
266
|
+
native,
|
|
267
|
+
shell,
|
|
268
|
+
index,
|
|
269
|
+
clouds,
|
|
270
|
+
cloudsReady,
|
|
271
|
+
status,
|
|
272
|
+
accountsEpoch,
|
|
273
|
+
reload: loadAll,
|
|
274
|
+
patchPin,
|
|
275
|
+
};
|
|
242
276
|
}
|
|
243
277
|
|
|
244
278
|
// ── maude:// links (V2-3.5) ───────────────────────────────────────────────────────────────────
|
|
@@ -399,6 +433,48 @@ export function HomeApp() {
|
|
|
399
433
|
const askingRef = useRef(false);
|
|
400
434
|
const [seen, setSeen] = useState(readSeen);
|
|
401
435
|
|
|
436
|
+
// 2.0.5 — the control plane this Home server talks to (`/_config.cloudOrigin`, from
|
|
437
|
+
// MAUDE_CLOUD_URL): it tells a Maude Cloud project from a team server. The client never names
|
|
438
|
+
// the vendor's address itself (cloud-shell-surfaces pin); until it is known no row guesses.
|
|
439
|
+
const [cloudUrl, setCloudUrl] = useState(() => cloudOriginOf(homeBootConfig()));
|
|
440
|
+
useEffect(() => {
|
|
441
|
+
if (cloudUrl) return undefined;
|
|
442
|
+
let live = true;
|
|
443
|
+
getConfig().then((r) => {
|
|
444
|
+
const origin = r.ok ? cloudOriginOf(r.json) : null;
|
|
445
|
+
if (live && origin) setCloudUrl(origin);
|
|
446
|
+
});
|
|
447
|
+
return () => {
|
|
448
|
+
live = false;
|
|
449
|
+
};
|
|
450
|
+
}, [cloudUrl]);
|
|
451
|
+
|
|
452
|
+
// 2.0.5 W4b — the account each profile's team servers vouched for, so a row can say
|
|
453
|
+
// "Team server · <host> · <account>" (public handles from /_home/accounts, never a token)
|
|
454
|
+
const [hubAccounts, setHubAccounts] = useState(null);
|
|
455
|
+
const profileKey = (data.shell?.profiles ?? [])
|
|
456
|
+
.map((p) => p?.id)
|
|
457
|
+
.filter(Boolean)
|
|
458
|
+
.join(',');
|
|
459
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `accountsEpoch` is the trigger — it ticks on every sign-in / sign-out / index change
|
|
460
|
+
useEffect(() => {
|
|
461
|
+
if (!profileKey) return undefined;
|
|
462
|
+
let live = true;
|
|
463
|
+
getAccounts(profileKey.split(',')).then((r) => {
|
|
464
|
+
if (!live || !r.ok || !Array.isArray(r.json?.profiles)) return;
|
|
465
|
+
setHubAccounts(
|
|
466
|
+
Object.fromEntries(
|
|
467
|
+
r.json.profiles.map((p) => [
|
|
468
|
+
p.id,
|
|
469
|
+
Object.fromEntries((p.hubs ?? []).map((h) => [h.url, h.account])),
|
|
470
|
+
])
|
|
471
|
+
)
|
|
472
|
+
);
|
|
473
|
+
});
|
|
474
|
+
return () => {
|
|
475
|
+
live = false;
|
|
476
|
+
};
|
|
477
|
+
}, [profileKey, data.accountsEpoch]);
|
|
402
478
|
const model = useMemo(
|
|
403
479
|
() =>
|
|
404
480
|
buildHomeModel({
|
|
@@ -406,21 +482,12 @@ export function HomeApp() {
|
|
|
406
482
|
index: data.index ? { v: 1, projects: [...data.index.values()] } : null,
|
|
407
483
|
clouds: data.clouds,
|
|
408
484
|
filterPid: filterPid || null,
|
|
485
|
+
hubAccounts,
|
|
486
|
+
cloudUrl,
|
|
409
487
|
}),
|
|
410
|
-
[data.shell, data.index, data.clouds, filterPid]
|
|
488
|
+
[data.shell, data.index, data.clouds, filterPid, hubAccounts, cloudUrl]
|
|
411
489
|
);
|
|
412
|
-
//
|
|
413
|
-
const face = useMemo(() => {
|
|
414
|
-
const c = data.clouds.find((x) => x?.signedIn);
|
|
415
|
-
if (!c) return null;
|
|
416
|
-
const id = c.profile || 'default';
|
|
417
|
-
const label = (data.shell?.profiles ?? []).find((p) => p.id === id)?.label || '';
|
|
418
|
-
const email = c.account?.email || '';
|
|
419
|
-
return {
|
|
420
|
-
...accountFace({ id, label, email }),
|
|
421
|
-
title: [label, email].filter(Boolean).join(' · ') || 'Your account',
|
|
422
|
-
};
|
|
423
|
-
}, [data.clouds, data.shell]);
|
|
490
|
+
// 2.0.5 W4b — the face at the top right opens every account on this Mac (HomeAccounts.jsx)
|
|
424
491
|
const searchPids = useMemo(
|
|
425
492
|
() => (data.shell ? indexQuery(data.shell).pids : browserPids()),
|
|
426
493
|
[data.shell]
|
|
@@ -895,22 +962,14 @@ export function HomeApp() {
|
|
|
895
962
|
}}
|
|
896
963
|
canOpen={data.native}
|
|
897
964
|
/>
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
<span
|
|
907
|
-
className={`home-face home-face--md home-face--${face.tone}`}
|
|
908
|
-
aria-hidden="true"
|
|
909
|
-
>
|
|
910
|
-
{face.initial}
|
|
911
|
-
</span>
|
|
912
|
-
</span>
|
|
913
|
-
) : null}
|
|
965
|
+
<HomeAccounts
|
|
966
|
+
shell={data.shell}
|
|
967
|
+
clouds={data.clouds}
|
|
968
|
+
native={data.native}
|
|
969
|
+
onAddCloud={() => signin.begin()}
|
|
970
|
+
onAddTeam={() => openSheet('hub')}
|
|
971
|
+
onChanged={data.reload}
|
|
972
|
+
/>
|
|
914
973
|
</div>
|
|
915
974
|
</header>
|
|
916
975
|
|
|
@@ -1342,12 +1401,6 @@ const RECENT_CAP = 6;
|
|
|
1342
1401
|
|
|
1343
1402
|
const STATE_WORD = {
|
|
1344
1403
|
tab: 'in a tab',
|
|
1345
|
-
mac: (
|
|
1346
|
-
<>
|
|
1347
|
-
<HIcon name="laptop" size={12} />
|
|
1348
|
-
this Mac only
|
|
1349
|
-
</>
|
|
1350
|
-
),
|
|
1351
1404
|
cloud: (
|
|
1352
1405
|
<>
|
|
1353
1406
|
<HIcon name="cloud" size={12} />
|
|
@@ -1356,6 +1409,52 @@ const STATE_WORD = {
|
|
|
1356
1409
|
),
|
|
1357
1410
|
};
|
|
1358
1411
|
|
|
1412
|
+
// 2.0.5 W4b — how a local project is connected and as whom: "Local · this Mac only",
|
|
1413
|
+
// "Maude Cloud · <account>", "Team server · <host> · <account>" (home-model `connectionOf`).
|
|
1414
|
+
const CONNECTION_ICON = { local: 'laptop', cloud: 'cloud', team: 'server' };
|
|
1415
|
+
function ConnectionWords({ row }) {
|
|
1416
|
+
const c = row.connection;
|
|
1417
|
+
if (!c?.words) return null;
|
|
1418
|
+
return (
|
|
1419
|
+
<span
|
|
1420
|
+
className="home-prow-conn"
|
|
1421
|
+
data-testid={`home-project-conn-${row.pid}`}
|
|
1422
|
+
data-kind={c.kind}
|
|
1423
|
+
>
|
|
1424
|
+
<HIcon name={CONNECTION_ICON[c.kind] ?? 'laptop'} size={12} />
|
|
1425
|
+
{c.words}
|
|
1426
|
+
</span>
|
|
1427
|
+
);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// 2.0.5 W4b — the folders folded into this row (a managed cloud copy; another folder on the same
|
|
1431
|
+
// design root). Each still opens its own project.
|
|
1432
|
+
function RowCopies({ row, canOpen, onOpen }) {
|
|
1433
|
+
if (!row.copies?.length) return null;
|
|
1434
|
+
return (
|
|
1435
|
+
<span className="home-prow-copies">
|
|
1436
|
+
{row.copies.map((c) => (
|
|
1437
|
+
<button
|
|
1438
|
+
key={c.pid}
|
|
1439
|
+
type="button"
|
|
1440
|
+
className="chip home-prow-copy"
|
|
1441
|
+
data-testid={`home-project-copy-${c.pid}`}
|
|
1442
|
+
data-kind={c.kind}
|
|
1443
|
+
onClick={() => onOpen(c.pid)}
|
|
1444
|
+
disabled={!canOpen}
|
|
1445
|
+
{...reasonProps(!canOpen, 'homeBrowser')}
|
|
1446
|
+
title={c.root}
|
|
1447
|
+
aria-label={
|
|
1448
|
+
c.kind === 'folder' ? `Open ${c.label}` : `Open the ${c.label} of ${row.name}`
|
|
1449
|
+
}
|
|
1450
|
+
>
|
|
1451
|
+
{c.kind === 'folder' ? `also ${c.label}` : c.label}
|
|
1452
|
+
</button>
|
|
1453
|
+
))}
|
|
1454
|
+
</span>
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1359
1458
|
// A project tab's live state (shell_state `ai` + `place`), canvas 11's words: AI working (a spark
|
|
1360
1459
|
// while it runs) · Needs you (it is waiting on a decision — the one that asks for you wins) ·
|
|
1361
1460
|
// Resting (its server is stopped; the tab wakes it). A resting tab never has AI (rest policy).
|
|
@@ -1474,10 +1573,11 @@ function ProfileGroup({ group, showHeader, canOpen, onOpen, onRelink, onOpenClou
|
|
|
1474
1573
|
{[
|
|
1475
1574
|
r.canvasCount != null ? canvasCount(r.canvasCount) : null,
|
|
1476
1575
|
STATE_WORD[r.status] ?? null,
|
|
1576
|
+
r.connection ? <ConnectionWords key="conn" row={r} /> : null,
|
|
1477
1577
|
]
|
|
1478
1578
|
.filter(Boolean)
|
|
1479
1579
|
.map((part, i) => (
|
|
1480
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: a fixed
|
|
1580
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a fixed three-part line
|
|
1481
1581
|
<span key={i} className="home-prow-part">
|
|
1482
1582
|
{i ? ' · ' : ''}
|
|
1483
1583
|
{part}
|
|
@@ -1489,6 +1589,7 @@ function ProfileGroup({ group, showHeader, canOpen, onOpen, onRelink, onOpenClou
|
|
|
1489
1589
|
<ProjectSquare id={r.pid} name={r.name} />
|
|
1490
1590
|
</button>
|
|
1491
1591
|
)}
|
|
1592
|
+
<RowCopies row={r} canOpen={canOpen} onOpen={onOpen} />
|
|
1492
1593
|
</li>
|
|
1493
1594
|
)
|
|
1494
1595
|
)}
|
|
@@ -100,11 +100,94 @@ function canvasRow(pid, projectName, c) {
|
|
|
100
100
|
|
|
101
101
|
const DEFAULT_PROFILE = { id: 'default', label: 'This Mac' };
|
|
102
102
|
|
|
103
|
+
const hostOfUrl = (url) => {
|
|
104
|
+
try {
|
|
105
|
+
return new URL(String(url)).hostname.toLowerCase();
|
|
106
|
+
} catch {
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// What a row calls a hub: the host, plus the port when it is not the scheme's default (URL.host drops
|
|
112
|
+
// 443/80 itself) — the same words the account card and the project's account card use.
|
|
113
|
+
const hubLabelOf = (url) => {
|
|
114
|
+
try {
|
|
115
|
+
return new URL(String(url)).host.toLowerCase();
|
|
116
|
+
} catch {
|
|
117
|
+
return '';
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* A hub of Maude Cloud (the control plane's host or a cell under it) — connections-model's rule.
|
|
123
|
+
* `cloudUrl` is the control plane this Home server talks to (`/_config.cloudOrigin`, from
|
|
124
|
+
* `MAUDE_CLOUD_URL`); the client never names the vendor's address itself, so a self-hosted
|
|
125
|
+
* control plane is "Maude Cloud" here too. Not known yet ⇒ false (nothing is guessed).
|
|
126
|
+
*/
|
|
127
|
+
export function isCloudHubUrl(hubUrl, cloudUrl) {
|
|
128
|
+
const host = hostOfUrl(hubUrl);
|
|
129
|
+
const cloud = cloudUrl ? hostOfUrl(cloudUrl) : '';
|
|
130
|
+
return !!host && !!cloud && (host === cloud || host.endsWith(`.${cloud}`));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 2.0.5 W4b — the project id of a managed copy, read from its folder: `managed.rs`
|
|
135
|
+
* `managed_key_for` names it `[<profile>@]<host>--<id>` under the app's data folder. null = the
|
|
136
|
+
* folder is not the copy of `boundHub` (a folder the person opened is never a copy).
|
|
137
|
+
*/
|
|
138
|
+
export function copyProjectId(root, boundHub) {
|
|
139
|
+
if (!boundHub) return null;
|
|
140
|
+
const base =
|
|
141
|
+
String(root || '')
|
|
142
|
+
.split('/')
|
|
143
|
+
.filter(Boolean)
|
|
144
|
+
.pop() ?? '';
|
|
145
|
+
const key = base.includes('@') ? base.slice(base.indexOf('@') + 1) : base;
|
|
146
|
+
const prefix = managedKey(boundHub, '');
|
|
147
|
+
return key.length > prefix.length && key.startsWith(prefix) ? key.slice(prefix.length) : null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 2.0.5 W4b (3) — how a project is connected and as whom, in one line: "Local · this Mac only",
|
|
152
|
+
* "Maude Cloud · <account>", "Team server · <host> · <account>". An account nobody recorded is
|
|
153
|
+
* left out, never guessed.
|
|
154
|
+
*/
|
|
155
|
+
export function connectionOf({ hub, profileEmail = null, hubAccount = null, cloudUrl = null }) {
|
|
156
|
+
if (!hub) return { kind: 'local', host: null, account: null, words: 'Local · this Mac only' };
|
|
157
|
+
// the control plane is not known yet (Home's /_config has not answered): say nothing rather
|
|
158
|
+
// than call a Maude Cloud project a team server
|
|
159
|
+
if (!cloudUrl) return { kind: 'unknown', host: hubLabelOf(hub), account: null, words: null };
|
|
160
|
+
if (isCloudHubUrl(hub, cloudUrl)) {
|
|
161
|
+
const account = profileEmail || null;
|
|
162
|
+
return {
|
|
163
|
+
kind: 'cloud',
|
|
164
|
+
host: hubLabelOf(hub),
|
|
165
|
+
account,
|
|
166
|
+
words: ['Maude Cloud', account].filter(Boolean).join(' · '),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const host = hubLabelOf(hub);
|
|
170
|
+
const account = hubAccount || null;
|
|
171
|
+
return {
|
|
172
|
+
kind: 'team',
|
|
173
|
+
host,
|
|
174
|
+
account,
|
|
175
|
+
words: ['Team server', host, account].filter(Boolean).join(' · '),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
103
179
|
/**
|
|
104
180
|
* @param {{ shell?: object|null, index?: object|null, clouds?: object[]|null,
|
|
105
181
|
* filterPid?: string|null }} input
|
|
106
182
|
*/
|
|
107
|
-
export function buildHomeModel({
|
|
183
|
+
export function buildHomeModel({
|
|
184
|
+
shell = null,
|
|
185
|
+
index = null,
|
|
186
|
+
clouds = null,
|
|
187
|
+
filterPid = null,
|
|
188
|
+
hubAccounts = null,
|
|
189
|
+
cloudUrl = null,
|
|
190
|
+
}) {
|
|
108
191
|
const indexed = new Map();
|
|
109
192
|
for (const p of index?.projects ?? []) if (p && typeof p.pid === 'string') indexed.set(p.pid, p);
|
|
110
193
|
|
|
@@ -142,7 +225,18 @@ export function buildHomeModel({ shell = null, index = null, clouds = null, filt
|
|
|
142
225
|
|
|
143
226
|
// ── projects by profile ──────────────────────────────────────────────────────────────────
|
|
144
227
|
const mru = new Map((shell?.recent ?? []).map((pid, i) => [pid, i]));
|
|
145
|
-
const
|
|
228
|
+
const emailOf = (id) =>
|
|
229
|
+
(shell?.profiles ?? []).find((x) => x?.id === id)?.email ||
|
|
230
|
+
(clouds ?? []).find((c) => c?.profile === id)?.account?.email ||
|
|
231
|
+
null;
|
|
232
|
+
const accountsOn = new Map();
|
|
233
|
+
for (const [id, byHub] of Object.entries(hubAccounts ?? {})) {
|
|
234
|
+
const m = new Map();
|
|
235
|
+
for (const [url, who] of Object.entries(byHub ?? {}))
|
|
236
|
+
if (normHubUrl(url) && typeof who === 'string' && who) m.set(normHubUrl(url), who);
|
|
237
|
+
accountsOn.set(id, m);
|
|
238
|
+
}
|
|
239
|
+
const allLocal = registry.map((p) => {
|
|
146
240
|
const ix = indexed.get(p.pid);
|
|
147
241
|
const gone = ix?.state === 'gone';
|
|
148
242
|
// `hub` (display + the 'mac' word) is the project's own linkedHub — a HINT it wrote itself.
|
|
@@ -153,11 +247,15 @@ export function buildHomeModel({ shell = null, index = null, clouds = null, filt
|
|
|
153
247
|
// 'mac' = "this Mac only" — true only of a project with no hub; a linked one that is not in a
|
|
154
248
|
// tab is plain 'closed' (no state word)
|
|
155
249
|
const inTab = p.place === 'tab' || p.place === 'resting';
|
|
156
|
-
|
|
250
|
+
// W4b: a managed copy whose own config lost its claim is still the app's copy of a hub — never
|
|
251
|
+
// "this Mac only"
|
|
252
|
+
const status = gone ? 'gone' : inTab ? 'tab' : hub || boundHub ? 'closed' : 'mac';
|
|
253
|
+
const profile = p.profile || DEFAULT_PROFILE.id;
|
|
254
|
+
const shown = boundHub || hub;
|
|
157
255
|
return {
|
|
158
256
|
kind: 'local',
|
|
159
257
|
pid: p.pid,
|
|
160
|
-
profile
|
|
258
|
+
profile,
|
|
161
259
|
name: ix?.project?.name || p.name || 'Untitled project',
|
|
162
260
|
root: p.root || ix?.project?.root || '',
|
|
163
261
|
status,
|
|
@@ -170,19 +268,29 @@ export function buildHomeModel({ shell = null, index = null, clouds = null, filt
|
|
|
170
268
|
formatGate: p.formatGate ?? null,
|
|
171
269
|
hub,
|
|
172
270
|
boundHub,
|
|
271
|
+
copyOf: copyProjectId(p.root, boundHub),
|
|
272
|
+
designReal: !gone && typeof ix?.designReal === 'string' ? ix.designReal : null,
|
|
273
|
+
connection: connectionOf({
|
|
274
|
+
hub: shown,
|
|
275
|
+
profileEmail: emailOf(profile),
|
|
276
|
+
hubAccount: shown ? (accountsOn.get(profile)?.get(shown) ?? null) : null,
|
|
277
|
+
cloudUrl,
|
|
278
|
+
}),
|
|
279
|
+
copies: [],
|
|
173
280
|
folder: (p.root || '').split('/').filter(Boolean).pop() ?? '',
|
|
174
281
|
cover: firstCover(ix),
|
|
175
282
|
};
|
|
176
283
|
});
|
|
177
|
-
|
|
284
|
+
allLocal.sort((a, b) => {
|
|
178
285
|
const ia = mru.has(a.pid) ? mru.get(a.pid) : Number.POSITIVE_INFINITY;
|
|
179
286
|
const ib = mru.has(b.pid) ? mru.get(b.pid) : Number.POSITIVE_INFINITY;
|
|
180
287
|
return ia - ib || a.name.localeCompare(b.name);
|
|
181
288
|
});
|
|
289
|
+
const localRows = collapseDuplicates(allLocal, cloudUrl);
|
|
182
290
|
|
|
183
291
|
// one profile's copy never hides another profile's cloud row
|
|
184
292
|
const bound = new Set(
|
|
185
|
-
|
|
293
|
+
allLocal.filter((r) => r.boundHub).map((r) => `${r.profile} ${r.boundHub}`)
|
|
186
294
|
);
|
|
187
295
|
const cloudRows = [];
|
|
188
296
|
for (const listing of clouds ?? []) {
|
|
@@ -253,6 +361,64 @@ export function buildHomeModel({ shell = null, index = null, clouds = null, filt
|
|
|
253
361
|
};
|
|
254
362
|
}
|
|
255
363
|
|
|
364
|
+
/**
|
|
365
|
+
* 2.0.5 W4b (4) — one row per project. Identity, never the label:
|
|
366
|
+
* (a) a managed copy (profile + its bound hub + the project id in its folder name) folds into the
|
|
367
|
+
* ONE folder of the same profile that links that hub; the folder the person opened stays the
|
|
368
|
+
* row. Two copies on one hub, or two such folders, cannot be told apart: nothing folds.
|
|
369
|
+
* (b) rows whose design root is one realpath (a `.design` symlink) fold into the last opened.
|
|
370
|
+
* A folded row stays openable from its primary's `copies`. Rows arrive MRU-sorted; nothing is
|
|
371
|
+
* removed from the registry — this is only what Home draws.
|
|
372
|
+
*/
|
|
373
|
+
function collapseDuplicates(rows, cloudUrl) {
|
|
374
|
+
const out = rows.map((r) => ({ ...r, copies: [] }));
|
|
375
|
+
const drop = new Set();
|
|
376
|
+
const live = (r) => r.status !== 'gone';
|
|
377
|
+
const fold = (primary, r, kind, label) => {
|
|
378
|
+
primary.copies.push({ pid: r.pid, kind, label, place: r.place, root: r.root, name: r.name });
|
|
379
|
+
if (primary.canvasCount == null && r.canvasCount != null) {
|
|
380
|
+
primary.canvasCount = r.canvasCount;
|
|
381
|
+
primary.byKind = r.byKind;
|
|
382
|
+
}
|
|
383
|
+
if (!primary.cover && r.cover) primary.cover = r.cover;
|
|
384
|
+
if (primary.status === 'mac' && r.status !== 'mac') primary.status = 'closed';
|
|
385
|
+
if (primary.connection?.kind === 'local' && r.connection?.kind !== 'local')
|
|
386
|
+
primary.connection = r.connection;
|
|
387
|
+
drop.add(r.pid);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// (a) a managed copy into the folder that links the same hub
|
|
391
|
+
for (const c of out) {
|
|
392
|
+
if (!c.copyOf || !live(c)) continue;
|
|
393
|
+
const sameHub = out.filter(
|
|
394
|
+
(x) => x.copyOf && x.profile === c.profile && x.boundHub === c.boundHub
|
|
395
|
+
);
|
|
396
|
+
if (sameHub.length !== 1) continue;
|
|
397
|
+
const folders = out.filter(
|
|
398
|
+
(x) =>
|
|
399
|
+
!x.copyOf && live(x) && !drop.has(x.pid) && x.profile === c.profile && x.hub === c.boundHub
|
|
400
|
+
);
|
|
401
|
+
if (folders.length !== 1) continue;
|
|
402
|
+
fold(
|
|
403
|
+
folders[0],
|
|
404
|
+
c,
|
|
405
|
+
'cloud-copy',
|
|
406
|
+
!cloudUrl ? 'copy' : isCloudHubUrl(c.boundHub, cloudUrl) ? 'cloud copy' : 'server copy'
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// (b) one design root, many folders: the last opened leads (rows are MRU-sorted)
|
|
411
|
+
const byReal = new Map();
|
|
412
|
+
for (const r of out) {
|
|
413
|
+
if (drop.has(r.pid) || !r.designReal || !live(r)) continue;
|
|
414
|
+
const key = `${r.profile} ${r.designReal}`;
|
|
415
|
+
const primary = byReal.get(key);
|
|
416
|
+
if (!primary) byReal.set(key, r);
|
|
417
|
+
else fold(primary, r, 'folder', r.folder || r.name);
|
|
418
|
+
}
|
|
419
|
+
return out.filter((r) => !drop.has(r.pid));
|
|
420
|
+
}
|
|
421
|
+
|
|
256
422
|
// ── where the sentence lands (S6.4 — the chip under the question) ─────────────────────────────
|
|
257
423
|
|
|
258
424
|
/** `https://alligators.cloud.maude.sh` → `alligators.cloud.maude.sh` (a hint's words; '' when none). */
|