@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
|
@@ -360,6 +360,73 @@
|
|
|
360
360
|
user-select: none;
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
/* 2.0.4 — the waiting card (canvas-waiting-card.jsx): the same frame, a calm icon, the bar of 05 es-arriving */
|
|
364
|
+
.v2-err-ic--calm {
|
|
365
|
+
color: var(--fg-1);
|
|
366
|
+
}
|
|
367
|
+
.v2-err-prog {
|
|
368
|
+
display: flex;
|
|
369
|
+
flex-direction: column;
|
|
370
|
+
gap: var(--space-1);
|
|
371
|
+
padding-left: 48px;
|
|
372
|
+
}
|
|
373
|
+
.v2-err-bar {
|
|
374
|
+
display: block;
|
|
375
|
+
height: 4px;
|
|
376
|
+
border-radius: var(--radius-pill);
|
|
377
|
+
background: var(--bg-4);
|
|
378
|
+
overflow: hidden;
|
|
379
|
+
}
|
|
380
|
+
.v2-err-bar i {
|
|
381
|
+
display: block;
|
|
382
|
+
height: 100%;
|
|
383
|
+
border-radius: var(--radius-pill);
|
|
384
|
+
background: var(--accent);
|
|
385
|
+
}
|
|
386
|
+
.v2-err-prog-l {
|
|
387
|
+
font-size: var(--type-xs);
|
|
388
|
+
color: var(--fg-1);
|
|
389
|
+
font-variant-numeric: tabular-nums;
|
|
390
|
+
}
|
|
391
|
+
.v2-err-files {
|
|
392
|
+
display: flex;
|
|
393
|
+
flex-direction: column;
|
|
394
|
+
gap: var(--space-1);
|
|
395
|
+
padding-left: 48px;
|
|
396
|
+
}
|
|
397
|
+
.v2-err-files-h {
|
|
398
|
+
font-size: var(--type-xs);
|
|
399
|
+
color: var(--fg-2);
|
|
400
|
+
}
|
|
401
|
+
.v2-err-files-l {
|
|
402
|
+
margin: 0;
|
|
403
|
+
padding: 0;
|
|
404
|
+
list-style: none;
|
|
405
|
+
display: flex;
|
|
406
|
+
flex-direction: column;
|
|
407
|
+
gap: 2px;
|
|
408
|
+
}
|
|
409
|
+
.v2-err-file {
|
|
410
|
+
display: flex;
|
|
411
|
+
align-items: baseline;
|
|
412
|
+
gap: var(--space-2);
|
|
413
|
+
min-width: 0;
|
|
414
|
+
font-size: var(--type-xs);
|
|
415
|
+
color: var(--fg-0);
|
|
416
|
+
}
|
|
417
|
+
.v2-err-file-n {
|
|
418
|
+
min-width: 0;
|
|
419
|
+
overflow: hidden;
|
|
420
|
+
text-overflow: ellipsis;
|
|
421
|
+
white-space: nowrap;
|
|
422
|
+
font-family: var(--font-mono);
|
|
423
|
+
}
|
|
424
|
+
.v2-err-file-s,
|
|
425
|
+
.v2-err-file--more {
|
|
426
|
+
flex: none;
|
|
427
|
+
color: var(--fg-2);
|
|
428
|
+
}
|
|
429
|
+
|
|
363
430
|
/* The viewport slot the card sits in (client/shell/viewport.jsx keeps `.sh-canvas-error` and its testid). */
|
|
364
431
|
.sh-canvas-error--v2 {
|
|
365
432
|
overflow: auto;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { useEffect, useRef, useState } from 'react';
|
|
19
19
|
import { LAST_GOOD, restoreRequest } from '../../../history/surface-requests.ts';
|
|
20
|
+
import { normalizeBuildFailure, normalizeWaiting } from './canvas-waiting.js';
|
|
20
21
|
import { splitLines } from './highlight.js';
|
|
21
22
|
|
|
22
23
|
export const SOURCE_ROUTE = '/_api/canvas-source';
|
|
@@ -94,7 +95,7 @@ export async function fetchCanvasSource(canvas, { fetchImpl = (...a) => fetch(..
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
/** @returns {Promise<{status:'ok', error:object|null} |
|
|
98
|
+
/** @returns {Promise<{status:'ok', error:object|null, waiting:object|null, buildFailure:object|null, building:boolean} |{status:'view-only'|'refused'|'missing'|'error'}>} */
|
|
98
99
|
export async function fetchCanvasError(canvas, { fetchImpl = (...a) => fetch(...a) } = {}) {
|
|
99
100
|
try {
|
|
100
101
|
const res = await fetchImpl(`${ERRORS_ROUTE}?canvas=${encodeURIComponent(canvas)}`, {
|
|
@@ -102,7 +103,15 @@ export async function fetchCanvasError(canvas, { fetchImpl = (...a) => fetch(...
|
|
|
102
103
|
});
|
|
103
104
|
const body = await readJson(res);
|
|
104
105
|
if (!res.ok || !body || !Array.isArray(body.errors)) return failure(res, body);
|
|
105
|
-
return {
|
|
106
|
+
return {
|
|
107
|
+
status: 'ok',
|
|
108
|
+
error: normalizeError(body.errors[0]),
|
|
109
|
+
// 2.0.4 — files it is still waiting for; #189 — why its build stopped outside its code
|
|
110
|
+
waiting: normalizeWaiting(body.waiting),
|
|
111
|
+
buildFailure: normalizeBuildFailure(body.buildFailure),
|
|
112
|
+
// 2.0.4 task P — its build is still running on the server (not a failure)
|
|
113
|
+
building: body.building === true,
|
|
114
|
+
};
|
|
106
115
|
} catch {
|
|
107
116
|
return { status: 'error' };
|
|
108
117
|
}
|
|
@@ -246,9 +255,12 @@ export async function goBackToLastGood(canvas, { fetchImpl = (...a) => fetch(...
|
|
|
246
255
|
line: typeof body?.line === 'string' ? clip(body.line, 120) : 'Went back.',
|
|
247
256
|
};
|
|
248
257
|
}
|
|
258
|
+
// The server's own line first: a 409 is also "this canvas has a change on this Mac that isn't
|
|
259
|
+
// saved" / "still saving" (F14), not only "no earlier version".
|
|
249
260
|
return {
|
|
250
261
|
ok: false,
|
|
251
262
|
line:
|
|
263
|
+
(typeof body?.line === 'string' && body.line ? clip(body.line, 120) : null) ??
|
|
252
264
|
GO_BACK_WORDS[res.status] ??
|
|
253
265
|
"Couldn't go back just now. The canvas is as it was. Try again.",
|
|
254
266
|
};
|
|
@@ -280,15 +292,18 @@ export function useCanvasSource({ canvas, enabled = true, stamp, fetchImpl } = {
|
|
|
280
292
|
}
|
|
281
293
|
|
|
282
294
|
/** The canvas's current error (or null) while `enabled`. */
|
|
283
|
-
export function useCanvasError({ canvas, enabled = true, stamp, fetchImpl } = {}) {
|
|
295
|
+
export function useCanvasError({ canvas, enabled = true, stamp, quiet = false, fetchImpl } = {}) {
|
|
284
296
|
const [state, setState] = useState({ status: 'loading' });
|
|
285
297
|
const fetchRef = useRef(fetchImpl);
|
|
286
298
|
fetchRef.current = fetchImpl;
|
|
299
|
+
const quietRef = useRef(quiet);
|
|
300
|
+
quietRef.current = quiet;
|
|
287
301
|
// biome-ignore lint/correctness/useExhaustiveDependencies: `stamp` is the "try again" signal
|
|
288
302
|
useEffect(() => {
|
|
289
303
|
if (!enabled || !canvas) return undefined;
|
|
290
304
|
let cancelled = false;
|
|
291
|
-
|
|
305
|
+
// `quiet`: a re-ask keeps the answer on screen until the new one comes (the waiting card's watch)
|
|
306
|
+
setState((s) => (quietRef.current && s.status === 'ok' ? s : { status: 'loading' }));
|
|
292
307
|
fetchCanvasError(canvas, { fetchImpl: fetchRef.current }).then((r) => {
|
|
293
308
|
if (!cancelled) setState(r);
|
|
294
309
|
});
|
|
@@ -8,13 +8,15 @@ import { useModalFocus } from '../shell/modal-focus.js';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {{ title: string, label: string, initial: string, confirm?: string, busy?: boolean, error?: string,
|
|
11
|
-
* onSubmit: (name: string) => void, onCancel: () => void }} props
|
|
11
|
+
* busyLabel?: string, onSubmit: (name: string) => void, onCancel: () => void }} props
|
|
12
|
+
* #195 — the tree's folder asks reuse this dialog ("Rename folder", "Renaming…").
|
|
12
13
|
*/
|
|
13
14
|
export default function NameDialog({
|
|
14
15
|
title,
|
|
15
16
|
label,
|
|
16
17
|
initial,
|
|
17
18
|
confirm = 'Create',
|
|
19
|
+
busyLabel = 'Creating…',
|
|
18
20
|
busy = false,
|
|
19
21
|
error = '',
|
|
20
22
|
onSubmit,
|
|
@@ -86,7 +88,7 @@ export default function NameDialog({
|
|
|
86
88
|
disabled={busy || !name}
|
|
87
89
|
data-testid="name-dialog-create"
|
|
88
90
|
>
|
|
89
|
-
{busy ?
|
|
91
|
+
{busy ? busyLabel : confirm}
|
|
90
92
|
</button>
|
|
91
93
|
</div>
|
|
92
94
|
</form>
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
place-items: center;
|
|
11
11
|
background: var(--scrim, rgb(0 0 0 / 0.32));
|
|
12
12
|
}
|
|
13
|
+
/* a yes/no ask opened from inside another modal sheet (.sh-scrim is 9000; banners keep 9100) */
|
|
14
|
+
.nd-scrim--over {
|
|
15
|
+
z-index: 9050;
|
|
16
|
+
}
|
|
13
17
|
.nd-dialog {
|
|
14
18
|
width: min(380px, calc(100vw - 32px));
|
|
15
19
|
display: flex;
|
|
@@ -23,6 +27,12 @@
|
|
|
23
27
|
font-weight: var(--w-semibold);
|
|
24
28
|
color: var(--fg-0);
|
|
25
29
|
}
|
|
30
|
+
/* #195 — the tree's yes/no asks ("Move “2026” to the trash?") say one line under the title */
|
|
31
|
+
.nd-body {
|
|
32
|
+
margin: 0;
|
|
33
|
+
font-size: var(--type-sm);
|
|
34
|
+
color: var(--fg-1);
|
|
35
|
+
}
|
|
26
36
|
.nd-err {
|
|
27
37
|
margin: 0;
|
|
28
38
|
font-size: var(--type-sm);
|
|
@@ -24,10 +24,10 @@ import { nativeDoors } from '../shell/native-doors.js';
|
|
|
24
24
|
import { onDsAdvancedRequest } from './advanced-bus.js';
|
|
25
25
|
import { ADVANCED_WORDS, askAiText, checkToast, revealRel } from './advanced-model.js';
|
|
26
26
|
import { setAdvanced, setAdvancedActions } from './advanced-store.js';
|
|
27
|
+
import { dsRefresh } from './ds-refresh.js';
|
|
27
28
|
import { fetchBoard } from './token-write.js';
|
|
28
29
|
import { ownSystemOf } from './truth-model.js';
|
|
29
30
|
|
|
30
|
-
export const ADVANCED_POLL_MS = 8000;
|
|
31
31
|
const JSON_HEADERS = { 'content-type': 'application/json' };
|
|
32
32
|
const NO_FINDER = 'Open this project in the Mac app to work with its files.';
|
|
33
33
|
|
|
@@ -107,16 +107,9 @@ export async function revealSystem(cfg, ds, doors = nativeDoors()) {
|
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* @param {{ cfg: any, activePath: string | null, toast?: (m: string) => void,
|
|
110
|
-
* fetchImpl?: typeof fetch
|
|
110
|
+
* fetchImpl?: typeof fetch }} props
|
|
111
111
|
*/
|
|
112
|
-
export function DsAdvancedHost({
|
|
113
|
-
cfg,
|
|
114
|
-
activePath,
|
|
115
|
-
toast,
|
|
116
|
-
project = '',
|
|
117
|
-
fetchImpl,
|
|
118
|
-
pollMs = ADVANCED_POLL_MS,
|
|
119
|
-
}) {
|
|
112
|
+
export function DsAdvancedHost({ cfg, activePath, toast, project = '', fetchImpl }) {
|
|
120
113
|
const ds = ownSystemOf(activePath, cfg);
|
|
121
114
|
const live = useRef({ cfg, activePath, toast, fetchImpl, project });
|
|
122
115
|
live.current = { cfg, activePath, toast, fetchImpl, project };
|
|
@@ -145,7 +138,7 @@ export function DsAdvancedHost({
|
|
|
145
138
|
[ds]
|
|
146
139
|
);
|
|
147
140
|
|
|
148
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: `ds`
|
|
141
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `ds` is the trigger; the rest rides on `live`
|
|
149
142
|
useEffect(() => {
|
|
150
143
|
if (!ds) {
|
|
151
144
|
setAdvanced(null);
|
|
@@ -157,10 +150,10 @@ export function DsAdvancedHost({
|
|
|
157
150
|
let seq = 0;
|
|
158
151
|
const native = nativeDoors().available;
|
|
159
152
|
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
// the board's facts are read with the files: a write or a redraw can change its name, canvases or modes
|
|
154
|
+
const refresh = async (fetchImpl) => {
|
|
162
155
|
const n = ++seq;
|
|
163
|
-
const got = await loadAdvanced(ds,
|
|
156
|
+
const got = await loadAdvanced(ds, fetchImpl, null);
|
|
164
157
|
if (dead || n !== seq) return;
|
|
165
158
|
if (!got) {
|
|
166
159
|
setAdvanced(null);
|
|
@@ -209,20 +202,15 @@ export function DsAdvancedHost({
|
|
|
209
202
|
},
|
|
210
203
|
});
|
|
211
204
|
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
const onVisible = () => {
|
|
215
|
-
if (document.visibilityState === 'visible') refresh({ withBoard: true });
|
|
216
|
-
};
|
|
217
|
-
document.addEventListener('visibilitychange', onVisible);
|
|
205
|
+
// 2.0.5: once, then on a write or a return to the window — never on a clock
|
|
206
|
+
const reads = dsRefresh(refresh, { fetchImpl: f });
|
|
218
207
|
return () => {
|
|
219
208
|
dead = true;
|
|
220
|
-
|
|
221
|
-
document.removeEventListener('visibilitychange', onVisible);
|
|
209
|
+
reads.stop();
|
|
222
210
|
setAdvancedActions(null);
|
|
223
211
|
setAdvanced(null);
|
|
224
212
|
};
|
|
225
|
-
}, [ds
|
|
213
|
+
}, [ds]);
|
|
226
214
|
|
|
227
215
|
return null;
|
|
228
216
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// client/v2/ds/ds-refresh.js — 2.0.5 (#205): when the shell's design-system hosts read the server.
|
|
2
|
+
//
|
|
3
|
+
// Before, each host (make · truth · advanced · off-system) re-read on its own timer every 2.5–8 s while the
|
|
4
|
+
// window was looked at. On a cell that was ~50 requests a minute per open DS board, each one a closure walk
|
|
5
|
+
// and a system read, and the hub's studio child sat at 1.5 GB / 138 % CPU. Nothing those reads show changes
|
|
6
|
+
// on its own clock: it changes when someone writes, and every write the shell makes says so
|
|
7
|
+
// (DS_STATE_CHANGED, door-write.js), and a write the canvas sees redraws it (`dgn:'loaded'`).
|
|
8
|
+
//
|
|
9
|
+
// So a host reads:
|
|
10
|
+
// - once when it starts (per system),
|
|
11
|
+
// - when the window is looked at again (`visibilitychange` → visible),
|
|
12
|
+
// - when the shell wrote the system (DS_STATE_CHANGED),
|
|
13
|
+
// - when the open canvas has drawn again (`dgn:'loaded'` from its own frame, only with `frameFor`),
|
|
14
|
+
// - when one of `events` (window events the host names — e.g. `maude:ai-runs`, the AI run registry moved) fires,
|
|
15
|
+
// - after a failed read, again after 5 s, 10 s, 20 s … at most 5 min (one success resets it),
|
|
16
|
+
// - and, only with `slowMs`, on ONE slow clock — visible window only, held while the canvas is loading or
|
|
17
|
+
// broken. Only the "changed outside" card needs it (truth-host): a file edited outside Maude has no event; and
|
|
18
|
+
// the upgrade sheet while a check is running (a proof's progress has no push).
|
|
19
|
+
//
|
|
20
|
+
// `load(fetchImpl)` reads through the fetch it is given; a read that throws, or any answer that is not ok, is a
|
|
21
|
+
// failure. The host keeps its own sequence guard; this only decides WHEN.
|
|
22
|
+
|
|
23
|
+
import { errorCardShown } from '../code/code-bus.js';
|
|
24
|
+
import { DS_STATE_CHANGED } from './door-write.js';
|
|
25
|
+
|
|
26
|
+
export const DS_BACKOFF_FIRST_MS = 5_000;
|
|
27
|
+
export const DS_BACKOFF_CAP_MS = 5 * 60_000;
|
|
28
|
+
/** The one slow clock (truth-host's "changed outside" card). */
|
|
29
|
+
export const DS_SLOW_POLL_MS = 60_000;
|
|
30
|
+
|
|
31
|
+
/** The canvas pane is still opening, or shows a broken-canvas card: the slow clock waits. */
|
|
32
|
+
export function canvasPaused(doc = globalThis.document) {
|
|
33
|
+
if (errorCardShown()) return true;
|
|
34
|
+
const state = doc
|
|
35
|
+
?.querySelector?.('main.viewport[data-canvas-state]')
|
|
36
|
+
?.getAttribute?.('data-canvas-state');
|
|
37
|
+
return state === 'loading' || state === 'error';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The delay before the retry after `failures` failed reads in a row (1 → first). */
|
|
41
|
+
export function backoffMs(failures, first = DS_BACKOFF_FIRST_MS, cap = DS_BACKOFF_CAP_MS) {
|
|
42
|
+
if (failures <= 0) return 0;
|
|
43
|
+
return Math.min(cap, first * 2 ** (failures - 1));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {(fetchImpl: typeof fetch) => Promise<unknown>} load
|
|
48
|
+
* @param {{
|
|
49
|
+
* fetchImpl?: () => typeof fetch,
|
|
50
|
+
* slowMs?: number,
|
|
51
|
+
* events?: string[],
|
|
52
|
+
* skipFirst?: boolean,
|
|
53
|
+
* failed?: (res: Response) => boolean,
|
|
54
|
+
* paused?: () => boolean,
|
|
55
|
+
* frameFor?: () => ({ contentWindow?: unknown } | null),
|
|
56
|
+
* firstMs?: number,
|
|
57
|
+
* backoffFirstMs?: number,
|
|
58
|
+
* backoffCapMs?: number,
|
|
59
|
+
* win?: Window,
|
|
60
|
+
* doc?: Document,
|
|
61
|
+
* timers?: { set: typeof setTimeout, clear: typeof clearTimeout },
|
|
62
|
+
* }} [opts]
|
|
63
|
+
* @returns {{ now(): Promise<void>, stop(): void }}
|
|
64
|
+
*/
|
|
65
|
+
export function dsRefresh(load, opts = {}) {
|
|
66
|
+
const win = opts.win ?? globalThis.window;
|
|
67
|
+
const doc = opts.doc ?? globalThis.document;
|
|
68
|
+
const set = opts.timers?.set ?? ((fn, ms) => setTimeout(fn, ms));
|
|
69
|
+
const clear = opts.timers?.clear ?? ((t) => clearTimeout(t));
|
|
70
|
+
const paused = opts.paused ?? (() => canvasPaused(doc));
|
|
71
|
+
const getFetch = opts.fetchImpl ?? (() => globalThis.fetch);
|
|
72
|
+
const slowMs = opts.slowMs ?? 0;
|
|
73
|
+
const failedRes = opts.failed ?? ((res) => !res?.ok);
|
|
74
|
+
const hidden = () => doc?.visibilityState === 'hidden';
|
|
75
|
+
|
|
76
|
+
let dead = false;
|
|
77
|
+
let failures = 0;
|
|
78
|
+
let timer = null;
|
|
79
|
+
|
|
80
|
+
const schedule = (ms, fn) => {
|
|
81
|
+
if (timer !== null) clear(timer);
|
|
82
|
+
timer = ms > 0 ? set(fn, ms) : null;
|
|
83
|
+
};
|
|
84
|
+
const next = () => {
|
|
85
|
+
if (dead) return;
|
|
86
|
+
if (failures > 0)
|
|
87
|
+
return schedule(backoffMs(failures, opts.backoffFirstMs, opts.backoffCapMs), retry);
|
|
88
|
+
if (slowMs > 0) return schedule(slowMs, tick);
|
|
89
|
+
schedule(0);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const now = async () => {
|
|
93
|
+
if (dead || hidden()) return;
|
|
94
|
+
let failed = false;
|
|
95
|
+
const base = getFetch();
|
|
96
|
+
const tracked = async (...args) => {
|
|
97
|
+
try {
|
|
98
|
+
const res = await base(...args);
|
|
99
|
+
if (failedRes(res)) failed = true;
|
|
100
|
+
return res;
|
|
101
|
+
} catch (err) {
|
|
102
|
+
failed = true;
|
|
103
|
+
throw err;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
try {
|
|
107
|
+
await load(tracked);
|
|
108
|
+
} catch {
|
|
109
|
+
failed = true;
|
|
110
|
+
}
|
|
111
|
+
if (dead) return;
|
|
112
|
+
failures = failed ? failures + 1 : 0;
|
|
113
|
+
next();
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// a retry waits for a looked-at window: `visibilitychange` reads at once when it is looked at again
|
|
117
|
+
function retry() {
|
|
118
|
+
timer = null;
|
|
119
|
+
if (!hidden()) void now();
|
|
120
|
+
}
|
|
121
|
+
function tick() {
|
|
122
|
+
timer = null;
|
|
123
|
+
if (hidden() || paused()) return next();
|
|
124
|
+
void now();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const onVisible = () => {
|
|
128
|
+
if (doc?.visibilityState === 'visible') void now();
|
|
129
|
+
};
|
|
130
|
+
const onChanged = () => void now();
|
|
131
|
+
const onMessage = (e) => {
|
|
132
|
+
const frame = opts.frameFor?.() ?? null;
|
|
133
|
+
if (!frame || e?.source !== frame.contentWindow) return;
|
|
134
|
+
if (e.data && typeof e.data === 'object' && e.data.dgn === 'loaded') void now();
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
doc?.addEventListener?.('visibilitychange', onVisible);
|
|
138
|
+
win?.addEventListener?.(DS_STATE_CHANGED, onChanged);
|
|
139
|
+
if (opts.frameFor) win?.addEventListener?.('message', onMessage);
|
|
140
|
+
for (const name of opts.events ?? []) win?.addEventListener?.(name, onChanged);
|
|
141
|
+
|
|
142
|
+
let first = null;
|
|
143
|
+
if (opts.skipFirst)
|
|
144
|
+
next(); // the host just read: wait for an event (or the slow clock)
|
|
145
|
+
else if (opts.firstMs && opts.firstMs > 0) first = set(() => void now(), opts.firstMs);
|
|
146
|
+
else void now();
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
now,
|
|
150
|
+
stop() {
|
|
151
|
+
dead = true;
|
|
152
|
+
if (first !== null) clear(first);
|
|
153
|
+
if (timer !== null) clear(timer);
|
|
154
|
+
timer = null;
|
|
155
|
+
doc?.removeEventListener?.('visibilitychange', onVisible);
|
|
156
|
+
win?.removeEventListener?.(DS_STATE_CHANGED, onChanged);
|
|
157
|
+
if (opts.frameFor) win?.removeEventListener?.('message', onMessage);
|
|
158
|
+
for (const name of opts.events ?? []) win?.removeEventListener?.(name, onChanged);
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// ds-many-linked; V2-1.6 §5.14).
|
|
3
3
|
//
|
|
4
4
|
// Mounted once inside DsReviewHost. It
|
|
5
|
-
// - reads which systems are linked (`GET /_api/ds/state`) and asks the library whether it moved: on project open
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// - reads which systems are linked (`GET /_api/ds/state`) and asks the library whether it moved: on project open,
|
|
6
|
+
// when the window is looked at again and when the shell wrote a system (client/v2/ds/ds-refresh.js — no clock;
|
|
7
|
+
// `POST /_api/ds/library {action:'check'}` — the server bounds it to one hub request per system per
|
|
8
|
+
// 30 minutes anyway). A hub that does not answer (5xx / no answer) is retried after 5 s doubling to 5 min; a
|
|
9
|
+
// refusal (no grant, denied) is an answer, not a failure, and stays quiet until the card is looked at,
|
|
8
10
|
// - keeps the open linked system's card in a tiny store (library-store.js → the inspector's empty place),
|
|
9
11
|
// - answers the registry actions through library-bus.js: `ds.library-link`, `ds.library-update`, `ds.library-unlink`,
|
|
10
12
|
// - runs "Update from <system>? N changes" and then the existing DsReviewSheet, whose Update posts the ONE
|
|
@@ -24,7 +26,6 @@ import {
|
|
|
24
26
|
changeLines,
|
|
25
27
|
dialogTitle,
|
|
26
28
|
isWaiting,
|
|
27
|
-
LIBRARY_CHECK_MS,
|
|
28
29
|
LIBRARY_WORDS,
|
|
29
30
|
linkedRows,
|
|
30
31
|
refusalWords,
|
|
@@ -38,6 +39,7 @@ import {
|
|
|
38
39
|
DsLibraryLink,
|
|
39
40
|
DsLibraryUnlink,
|
|
40
41
|
} from './library-card.jsx';
|
|
42
|
+
import { dsRefresh } from './ds-refresh.js';
|
|
41
43
|
import { onDsLibraryRequest } from './library-bus.js';
|
|
42
44
|
import { setLibrary, setLibraryActions } from './library-store.js';
|
|
43
45
|
import { DsReviewSheet } from './review-sheet.jsx';
|
|
@@ -139,7 +141,7 @@ export async function linkLibrary(url, grant, fetchImpl = globalThis.fetch) {
|
|
|
139
141
|
|
|
140
142
|
/**
|
|
141
143
|
* @param {{ cfg: any, activePath: string | null, toast?: (m: string, ok?: boolean) => void, scope?: string,
|
|
142
|
-
* fetchImpl?: typeof fetch,
|
|
144
|
+
* fetchImpl?: typeof fetch, delayMs?: number, open?: (url: string) => any, canOpen?: (url: string) => boolean }} props
|
|
143
145
|
*/
|
|
144
146
|
export function DsLibraryHost({
|
|
145
147
|
cfg,
|
|
@@ -147,7 +149,6 @@ export function DsLibraryHost({
|
|
|
147
149
|
toast,
|
|
148
150
|
scope = '',
|
|
149
151
|
fetchImpl,
|
|
150
|
-
pollMs = LIBRARY_CHECK_MS,
|
|
151
152
|
delayMs = OPEN_DELAY_MS,
|
|
152
153
|
open = openExternal,
|
|
153
154
|
canOpen = (url) => isDisplayableUrl(url),
|
|
@@ -172,48 +173,47 @@ export function DsLibraryHost({
|
|
|
172
173
|
const openDs = ownSystemOf(activePath, cfg);
|
|
173
174
|
const openRow = rows.find((r) => r.ds === openDs) ?? null;
|
|
174
175
|
|
|
175
|
-
/** The state, then a check of each linked system, then the state again (a check can move `upstreamHead`).
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
176
|
+
/** The state, then a check of each linked system, then the state again (a check can move `upstreamHead`).
|
|
177
|
+
* `fx`: the fetch ds-refresh tracks, so a hub that does not answer backs the next read off. */
|
|
178
|
+
const refresh = useCallback(
|
|
179
|
+
async (fx) => {
|
|
180
|
+
const fetchFn = typeof fx === 'function' ? fx : f();
|
|
181
|
+
const first = await loadLinked(fetchFn);
|
|
182
|
+
setRows(first);
|
|
183
|
+
for (const r of first) {
|
|
184
|
+
const c = await checkLibrary(r.ds, fetchFn);
|
|
185
|
+
if (c.ok) {
|
|
186
|
+
setAccess((a) => ({ ...a, [r.ds]: 'yes' }));
|
|
187
|
+
setErrors((e) => ({ ...e, [r.ds]: null }));
|
|
188
|
+
setUsed((u) => ({ ...u, [r.ds]: c.usedBy }));
|
|
189
|
+
} else if (c.noGrant || c.relink) {
|
|
190
|
+
setAccess((a) => ({ ...a, [r.ds]: c.relink ? 'relink' : 'no' }));
|
|
191
|
+
setErrors((e) => ({ ...e, [r.ds]: null }));
|
|
192
|
+
} else if (c.code === 'ds-library-unreachable' || c.code === 'unreachable') {
|
|
193
|
+
setErrors((e) => ({ ...e, [r.ds]: LIBRARY_WORDS.offline }));
|
|
194
|
+
} else if (c.code === 'ds-library-denied') {
|
|
195
|
+
setErrors((e) => ({ ...e, [r.ds]: LIBRARY_WORDS.denied }));
|
|
196
|
+
}
|
|
192
197
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
setRows(await loadLinked(fetchFn));
|
|
199
|
+
},
|
|
200
|
+
[f]
|
|
201
|
+
);
|
|
196
202
|
|
|
197
|
-
// project open
|
|
198
|
-
//
|
|
203
|
+
// project open (after the first paint), then when the window is looked at again or the shell wrote a system —
|
|
204
|
+
// no clock. A refusal (no grant 409, denied 403) is the library's answer; only a 5xx is a failure to back off.
|
|
205
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `refresh` reads the live ref; the first read is the trigger
|
|
199
206
|
useEffect(() => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const timer = setInterval(go, pollMs);
|
|
211
|
-
return () => {
|
|
212
|
-
dead = true;
|
|
213
|
-
clearTimeout(first);
|
|
214
|
-
clearInterval(timer);
|
|
215
|
-
};
|
|
216
|
-
}, [pollMs, delayMs]);
|
|
207
|
+
const r = dsRefresh(
|
|
208
|
+
async (fx) => {
|
|
209
|
+
// a project with no converted system has no linked library: nothing to read, nothing to ask
|
|
210
|
+
if (!Object.values(live.current.cfg?.dsConverted ?? {}).some((v) => v === true)) return;
|
|
211
|
+
await refresh(fx);
|
|
212
|
+
},
|
|
213
|
+
{ fetchImpl: f, firstMs: delayMs, failed: (res) => res.status >= 500 }
|
|
214
|
+
);
|
|
215
|
+
return () => r.stop();
|
|
216
|
+
}, [delayMs]);
|
|
217
217
|
|
|
218
218
|
// the open linked system: how many updates wait (one read of the review per moved head; never for a Mac without a grant)
|
|
219
219
|
const openHead = openRow?.library?.upstreamHead ?? null;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// folder, the Design system canvas with `ds-dir-*` and seven outlines), then the brief goes to AI through the
|
|
8
8
|
// composer with origin `ds-make` (the person's gesture: every composer gate applies), and the new canvas opens;
|
|
9
9
|
// 3 while the open canvas is the Design system canvas of a system that is being made, reads `GET make-state`
|
|
10
|
-
//
|
|
10
|
+
// when it opens, when the canvas has drawn again and after a write (ds-refresh.js, 2.0.5) and tells the canvas which sections wait, are being drawn or are done
|
|
11
11
|
// (the dgn message `ds-make-states` — to the canvas origin, never `*`);
|
|
12
12
|
// 4 the ready card (13 · ds-make-done): "<name> system is ready." with one button that publishes the first
|
|
13
13
|
// revision and makes it the project's style (`POST … {action:'done'}`, then switch-bus `finishedMaking` so the
|
|
@@ -30,13 +30,12 @@ import {
|
|
|
30
30
|
systemLabelFor,
|
|
31
31
|
systemNameFor,
|
|
32
32
|
} from './make-model.js';
|
|
33
|
+
import { dsRefresh } from './ds-refresh.js';
|
|
33
34
|
import { DsMakeSheet } from './make-sheet.jsx';
|
|
34
35
|
import { finishMaking, makeSystem, readMakeState, uploadLogo } from './make-write.js';
|
|
35
36
|
import { finishedMaking } from './switch-bus.js';
|
|
36
37
|
import { ownSystemOf } from './truth-model.js';
|
|
37
38
|
|
|
38
|
-
export const MAKE_POLL_MS = 2500;
|
|
39
|
-
|
|
40
39
|
/** How many canvases the project has that a system could learn from (a system's own folder is not one). */
|
|
41
40
|
export function canvasCount(cfg) {
|
|
42
41
|
const root = (cfg?.designRel || '.design').replace(/^\/+|\/+$/g, '');
|
|
@@ -84,9 +83,9 @@ export function MakeReadyBanner({ label, complete, missing, busy = false, note =
|
|
|
84
83
|
|
|
85
84
|
/**
|
|
86
85
|
* @param {{ cfg: any, activePath: string | null, toast?: (m: string) => void, frameFor?: () => (HTMLIFrameElement | null),
|
|
87
|
-
* fetchImpl?: typeof fetch,
|
|
86
|
+
* fetchImpl?: typeof fetch, openSystem?: (ds: string) => void }} props
|
|
88
87
|
*/
|
|
89
|
-
export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl,
|
|
88
|
+
export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl, openSystem }) {
|
|
90
89
|
const [sheet, setSheet] = useState(null); // { project }
|
|
91
90
|
const [state, setState] = useState(null);
|
|
92
91
|
const [finishing, setFinishing] = useState(false);
|
|
@@ -170,9 +169,8 @@ export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl, pollMs
|
|
|
170
169
|
}
|
|
171
170
|
let off = false;
|
|
172
171
|
let was = false;
|
|
173
|
-
const look = async () => {
|
|
174
|
-
|
|
175
|
-
const s = await readMakeState(ds, f());
|
|
172
|
+
const look = async (fetchImpl) => {
|
|
173
|
+
const s = await readMakeState(ds, fetchImpl);
|
|
176
174
|
if (off || !s) return;
|
|
177
175
|
setState(s);
|
|
178
176
|
const sections = sectionsToPost(s);
|
|
@@ -188,13 +186,16 @@ export function DsMakeHost({ cfg, activePath, toast, frameFor, fetchImpl, pollMs
|
|
|
188
186
|
/* the frame went away */
|
|
189
187
|
}
|
|
190
188
|
};
|
|
191
|
-
|
|
192
|
-
const
|
|
189
|
+
// 2.0.5: once, then on a write, a redraw of the canvas or a return to the window — never on a clock
|
|
190
|
+
const reads = dsRefresh(look, {
|
|
191
|
+
fetchImpl: f,
|
|
192
|
+
frameFor: () => live.current.frameFor?.() ?? null,
|
|
193
|
+
});
|
|
193
194
|
return () => {
|
|
194
195
|
off = true;
|
|
195
|
-
|
|
196
|
+
reads.stop();
|
|
196
197
|
};
|
|
197
|
-
}, [ds
|
|
198
|
+
}, [ds]);
|
|
198
199
|
|
|
199
200
|
// 4 — "Use as <name>'s style"
|
|
200
201
|
const label =
|