@1agh/maude 2.0.4 → 2.0.8
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/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +39 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/actions/agents.ts +59 -0
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +13 -0
- package/apps/studio/actions/defs/view.ts +59 -3
- package/apps/studio/actions/keymap.gen.ts +35 -0
- package/apps/studio/actions/menu.ts +2 -0
- package/apps/studio/actions/types.ts +3 -1
- package/apps/studio/actions.manifest.json +148 -1
- package/apps/studio/actions.parity.json +31 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -15
- package/apps/studio/api.ts +425 -128
- package/apps/studio/artboard-activity-overlay.tsx +4 -4
- package/apps/studio/artboard-ai-copies.tsx +4 -4
- package/apps/studio/artboard-freeze.ts +108 -0
- package/apps/studio/artboard-live-gate.tsx +636 -0
- package/apps/studio/artboard-live.ts +831 -0
- package/apps/studio/artboard-placeholder.ts +197 -0
- package/apps/studio/artboard-still-raster.ts +485 -0
- package/apps/studio/artboard-still-warmup.ts +221 -0
- package/apps/studio/artboard-still.ts +1188 -0
- package/apps/studio/artboard-webgl.ts +669 -0
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- 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-open.mjs +364 -0
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- 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 +89 -12
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +30 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/bridge/dgn-protocol.ts +35 -0
- package/apps/studio/canvas-build-sandbox.ts +69 -13
- package/apps/studio/canvas-camera.ts +90 -0
- package/apps/studio/canvas-comment-mount.tsx +9 -9
- package/apps/studio/canvas-lib.tsx +289 -44
- package/apps/studio/canvas-pages-view.tsx +465 -0
- package/apps/studio/canvas-pages.ts +305 -0
- package/apps/studio/canvas-rows.ts +62 -0
- package/apps/studio/canvas-shell.tsx +62 -16
- package/apps/studio/canvas-theme-icons.tsx +41 -0
- package/apps/studio/canvas-theme-pill.tsx +15 -6
- package/apps/studio/canvas-theme.ts +12 -11
- package/apps/studio/client/app.jsx +7 -0
- package/apps/studio/client/canvas-url.js +36 -1
- 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 +6 -0
- 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/canvas-origin-probe.js +34 -0
- package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
- package/apps/studio/client/hooks/use-project-data.jsx +13 -2
- package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
- package/apps/studio/client/index-loader.ts +41 -21
- package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
- package/apps/studio/client/panels/ChatPanel.jsx +27 -20
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/shell/viewport.jsx +66 -22
- package/apps/studio/client/tree/tree.jsx +17 -0
- 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/Composer.jsx +27 -10
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
- package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
- package/apps/studio/client/v2/code/code-consent.js +67 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
- 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 -15
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- 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 +3 -1
- package/apps/studio/client/v2/history/git-parts.jsx +16 -1
- package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
- package/apps/studio/client/v2/layers/layers-request.js +49 -0
- package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
- package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
- package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
- package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
- package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
- package/apps/studio/client/v2/shell/floating-panels.css +37 -1
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +11 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
- package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
- package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
- package/apps/studio/client/v2/shell/pages-pick.js +49 -0
- 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/project-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -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-parity.json +8 -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-canvas-mode-lane.js +30 -0
- 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/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +56 -0
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +1198 -1198
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/board.css +6 -0
- package/apps/studio/ds/board/ds-bar.tsx +21 -3
- package/apps/studio/ds/board/specimen.tsx +16 -2
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +14 -4
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/engine.ts +3 -1
- package/apps/studio/ds/folder-systems.ts +199 -0
- package/apps/studio/ds/pairing-css.ts +2 -1
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- 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 +10 -3
- package/apps/studio/editing/ai-point-ring.tsx +4 -4
- package/apps/studio/editing/ai-scope-outline.tsx +4 -4
- package/apps/studio/editing/align-bar.tsx +4 -4
- package/apps/studio/editing/anchor-report.ts +3 -2
- package/apps/studio/editing/artboard-handles.tsx +4 -4
- package/apps/studio/editing/corner-dots.tsx +4 -4
- package/apps/studio/editing/crop-mode.tsx +4 -4
- package/apps/studio/editing/drop-chip.tsx +4 -4
- package/apps/studio/editing/empty-report.ts +3 -2
- package/apps/studio/editing/focus-model.tsx +4 -4
- package/apps/studio/editing/gap-bands.tsx +3 -3
- package/apps/studio/editing/hold-rings.tsx +4 -4
- package/apps/studio/editing/lock-badge.tsx +3 -3
- package/apps/studio/editing/long-page.ts +23 -1
- package/apps/studio/editing/nudge.tsx +2 -2
- package/apps/studio/editing/page-activity.ts +4 -3
- package/apps/studio/editing/paste-bar.tsx +4 -4
- package/apps/studio/editing/pen/overlay.tsx +4 -3
- package/apps/studio/editing/place-freely.tsx +3 -3
- package/apps/studio/editing/reorder-slot.tsx +3 -3
- package/apps/studio/editing/selection.tsx +4 -4
- package/apps/studio/editing/size-ghost.tsx +4 -4
- package/apps/studio/editing/tab-order.tsx +4 -4
- package/apps/studio/editing/text-in-place.tsx +4 -4
- package/apps/studio/editing/undo-preview.tsx +3 -3
- package/apps/studio/equal-spacing-handles.tsx +3 -3
- package/apps/studio/frame-clock.ts +89 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +19 -0
- package/apps/studio/http.ts +80 -34
- package/apps/studio/index/ds-usage.ts +4 -1
- package/apps/studio/index-cache.ts +272 -0
- package/apps/studio/inspect-overlay.tsx +4 -3
- package/apps/studio/inspect.ts +7 -2
- package/apps/studio/link-chip-overlay.tsx +4 -3
- package/apps/studio/measure-overlay.tsx +4 -3
- package/apps/studio/present/pointer-dot.tsx +3 -2
- package/apps/studio/present/present-media.ts +6 -2
- package/apps/studio/present/present-stage.tsx +3 -2
- package/apps/studio/preview/preview-camera.tsx +3 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/sync.ts +176 -0
- package/apps/studio/routes/trash.ts +16 -1
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/server.ts +8 -10
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/accepted-cold-start.ts +28 -13
- 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 +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +497 -61
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +405 -163
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +77 -12
- package/apps/studio/sync/seed-progress.ts +104 -3
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +17 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/use-annotation-resize.tsx +4 -3
- package/apps/studio/use-artboard-drag.tsx +3 -2
- package/apps/studio/use-element-resize.tsx +7 -6
- package/apps/studio/use-grid-track-handles.tsx +5 -4
- package/apps/studio/use-selection-set.tsx +64 -4
- package/apps/studio/use-spacing-handles.tsx +7 -6
- package/apps/studio/video-comp.tsx +75 -39
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +99 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +27 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -1650,7 +1650,16 @@ export function createKernel({
|
|
|
1650
1650
|
const st = work.docs.get(doc);
|
|
1651
1651
|
if (!st) continue;
|
|
1652
1652
|
const lanes = {};
|
|
1653
|
-
|
|
1653
|
+
// A REVIVED document (an undone delete, a Trash restore) publishes every
|
|
1654
|
+
// lane it holds, not only the ones this action touched: the delete
|
|
1655
|
+
// dropped the live document (`deleteDocument`), so the replica it comes
|
|
1656
|
+
// back into is empty. Publishing nothing left the hub's copy empty, and
|
|
1657
|
+
// it only looked restored on a peer that still held the deleted doc —
|
|
1658
|
+
// the stale lineage that doubles a re-created canvas (fix/205).
|
|
1659
|
+
const names = new Set(c.lanes);
|
|
1660
|
+
if (c.revived)
|
|
1661
|
+
for (const [lane, h] of Object.entries(st.lanes ?? {})) if (h?.hash) names.add(lane);
|
|
1662
|
+
for (const lane of names) lanes[lane] = await work.laneContent(st, lane);
|
|
1654
1663
|
changes.push({
|
|
1655
1664
|
doc,
|
|
1656
1665
|
path: st.path,
|
|
@@ -22,6 +22,7 @@ import { canvasArtifacts } from '../canvas-artifacts.ts';
|
|
|
22
22
|
import { canvasSlugFromRel } from '../canvas-slug.ts';
|
|
23
23
|
import type { Paths } from '../context.ts';
|
|
24
24
|
import { dsDepsFor, importsDs, importsDsBoard, specimenRels } from '../ds/ds-resolver.ts';
|
|
25
|
+
import { folderSystemOf, pinnedFolderSystem } from '../ds/folder-systems.ts';
|
|
25
26
|
import {
|
|
26
27
|
CANVAS_LIB_SPEC,
|
|
27
28
|
CARRIES_ALL,
|
|
@@ -431,20 +432,49 @@ function readJsonObject(project: ProjectReader, rel: string): Record<string, unk
|
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
/** The system a canvas renders under — the same chain as `ds-resolver.ts` `canvasSystemFor`
|
|
434
|
-
* (owner by path →
|
|
435
|
-
*
|
|
436
|
-
|
|
435
|
+
* (owner by path → 2.0.7 owner by its own folder → meta `designSystem` (configured, else a folder
|
|
436
|
+
* system of exactly that name) → `defaultDesignSystem` → the first of the merged list), read
|
|
437
|
+
* through the ProjectReader instead of the disk. */
|
|
438
|
+
function canvasSystem(
|
|
439
|
+
project: ProjectReader,
|
|
440
|
+
canvas: string,
|
|
441
|
+
cfg: ClosureConfig,
|
|
442
|
+
files?: ReadonlySet<string>
|
|
443
|
+
): DsSystem | null {
|
|
437
444
|
const systems = cfg.designSystems;
|
|
438
|
-
if (!systems.length) return null;
|
|
439
445
|
const owner = systems.find((s) => canvas.startsWith(`${s.path}/`));
|
|
440
446
|
if (owner) return owner;
|
|
447
|
+
// 2.0.7 — a system folder the config does not list (a cell's config.json never syncs) still owns
|
|
448
|
+
// its own canvases: its board draws its own specimens, never the default system's.
|
|
449
|
+
const hasFile = (r: string) => (files ? files.has(r) : project.text(r) !== null);
|
|
450
|
+
const folder = folderSystemOf(canvas, systems, hasFile);
|
|
451
|
+
if (folder) return folder;
|
|
452
|
+
// …and a canvas that pins it by name renders with it; a name with no such folder stays at the default
|
|
453
|
+
const named = (name: unknown): DsSystem | null =>
|
|
454
|
+
typeof name === 'string' && name
|
|
455
|
+
? (systems.find((s) => s.name === name) ?? pinnedFolderSystem(name, systems, hasFile))
|
|
456
|
+
: null;
|
|
441
457
|
const declared = readJsonObject(
|
|
442
458
|
project,
|
|
443
459
|
canvas.replace(/\.(tsx|html)$/i, '.meta.json')
|
|
444
460
|
)?.designSystem;
|
|
445
|
-
const byMeta =
|
|
461
|
+
const byMeta = named(declared);
|
|
446
462
|
if (byMeta) return byMeta;
|
|
447
|
-
|
|
463
|
+
const byDefault = named(cfg.defaultDesignSystem);
|
|
464
|
+
if (byDefault) return byDefault;
|
|
465
|
+
if (systems.length) return systems[0] ?? null;
|
|
466
|
+
// no configured system: the first folder system by name, as the merged list orders them
|
|
467
|
+
const listed = files ?? new Set(project.list());
|
|
468
|
+
const segs = new Set<string>();
|
|
469
|
+
for (const r of listed) {
|
|
470
|
+
const m = /^system\/([^/]+)\/design-system\.tsx$/.exec(r);
|
|
471
|
+
if (m) segs.add(m[1] as string);
|
|
472
|
+
}
|
|
473
|
+
for (const seg of [...segs].sort()) {
|
|
474
|
+
const f = folderSystemOf(`system/${seg}/design-system.tsx`, systems, (r) => listed.has(r));
|
|
475
|
+
if (f) return f;
|
|
476
|
+
}
|
|
477
|
+
return null;
|
|
448
478
|
}
|
|
449
479
|
|
|
450
480
|
/** A design-system file a canvas-only session reads: not a specimen, not a UI kit. */
|
|
@@ -592,6 +622,9 @@ interface WalkEnv {
|
|
|
592
622
|
listTruncated: boolean;
|
|
593
623
|
/** p8-closure-lows — canvas-shaped entries the listing saw but did not yield (`unlisted`). */
|
|
594
624
|
unlisted: readonly string[];
|
|
625
|
+
/** 2.0.7 (#207) — `files`' openable canvas files (`.tsx`/`.html`, not `_`-prefixed) by NFC slug,
|
|
626
|
+
* and `unlisted` by NFC slug: what `grantedBySlug` scanned the whole listing for, per owner. */
|
|
627
|
+
slugIndex: () => { files: ReadonlyMap<string, string[]>; unlisted: ReadonlySet<string> };
|
|
595
628
|
}
|
|
596
629
|
|
|
597
630
|
function walkEnv(project: ProjectReader, files: ReadonlySet<string>, cfg: ClosureConfig): WalkEnv {
|
|
@@ -727,7 +760,21 @@ function walkEnv(project: ProjectReader, files: ReadonlySet<string>, cfg: Closur
|
|
|
727
760
|
typeof project.present === 'function';
|
|
728
761
|
const listTruncated = !reports || project.listTruncated?.() === true;
|
|
729
762
|
const unlisted = reports ? [...(project.unlisted?.() ?? [])] : [];
|
|
730
|
-
|
|
763
|
+
let slugs: { files: Map<string, string[]>; unlisted: Set<string> } | null = null;
|
|
764
|
+
const slugIndex = () => {
|
|
765
|
+
if (slugs) return slugs;
|
|
766
|
+
const bySlug = new Map<string, string[]>();
|
|
767
|
+
for (const f of files) {
|
|
768
|
+
if (!/\.(tsx|html)$/i.test(f) || f.startsWith('_')) continue;
|
|
769
|
+
const slug = slugNfc(f);
|
|
770
|
+
const list = bySlug.get(slug);
|
|
771
|
+
if (list) list.push(f);
|
|
772
|
+
else bySlug.set(slug, [f]);
|
|
773
|
+
}
|
|
774
|
+
slugs = { files: bySlug, unlisted: new Set(unlisted.map(slugNfc)) };
|
|
775
|
+
return slugs;
|
|
776
|
+
};
|
|
777
|
+
return { files, textOf, isCanvas, cfg, project, known, listTruncated, unlisted, slugIndex };
|
|
731
778
|
}
|
|
732
779
|
|
|
733
780
|
const SAME_NAME_RE =
|
|
@@ -764,6 +811,58 @@ function isUiKitRel(rel: string): boolean {
|
|
|
764
811
|
return segs[2] === 'ui_kits' || (segs[2] === 'preview' && /^ui_kits-/i.test(segs[3] ?? ''));
|
|
765
812
|
}
|
|
766
813
|
|
|
814
|
+
/**
|
|
815
|
+
* 2.0.7 (#207) — a file's import groups, remembered by its path AND its full text. Every canvas's
|
|
816
|
+
* walk reads the shared design-system and helper modules again, and every file event starts a new
|
|
817
|
+
* generation (a new walk env), so one `/_index-data` scanned the same few hundred files once per
|
|
818
|
+
* canvas that reaches them — and again after any write anywhere in the tree. The answer is a pure
|
|
819
|
+
* function of (text, path), and a hit needs the stored text to be EQUAL to the text read now (never
|
|
820
|
+
* a hash or an mtime: a planted file cannot borrow a benign twin's import list), so a cached answer
|
|
821
|
+
* is exactly the answer a fresh scan would give. Bounded by entries and by the text it holds.
|
|
822
|
+
*/
|
|
823
|
+
const GROUPS_MEMO_MAX_ENTRIES = 8192;
|
|
824
|
+
const GROUPS_MEMO_MAX_CHARS = 64 * 1024 * 1024;
|
|
825
|
+
const groupsMemo = new Map<string, { text: string; groups: string[][] }>();
|
|
826
|
+
let groupsMemoChars = 0;
|
|
827
|
+
function walkImportGroups(text: string, rel: string): readonly (readonly string[])[] {
|
|
828
|
+
const hit = groupsMemo.get(rel);
|
|
829
|
+
if (hit && hit.text === text) {
|
|
830
|
+
groupsMemo.delete(rel);
|
|
831
|
+
groupsMemo.set(rel, hit);
|
|
832
|
+
return hit.groups;
|
|
833
|
+
}
|
|
834
|
+
const groups = relativeImportGroups(text, `${VROOT}/${rel}`, VROOT);
|
|
835
|
+
if (hit) {
|
|
836
|
+
groupsMemo.delete(rel);
|
|
837
|
+
groupsMemoChars -= hit.text.length;
|
|
838
|
+
}
|
|
839
|
+
if (text.length <= GROUPS_MEMO_MAX_CHARS / 4) {
|
|
840
|
+
groupsMemo.set(rel, { text, groups });
|
|
841
|
+
groupsMemoChars += text.length;
|
|
842
|
+
while (
|
|
843
|
+
groupsMemo.size > GROUPS_MEMO_MAX_ENTRIES ||
|
|
844
|
+
(groupsMemoChars > GROUPS_MEMO_MAX_CHARS && groupsMemo.size > 1)
|
|
845
|
+
) {
|
|
846
|
+
const [oldest, entry] = groupsMemo.entries().next().value as [
|
|
847
|
+
string,
|
|
848
|
+
{ text: string; groups: string[][] },
|
|
849
|
+
];
|
|
850
|
+
groupsMemo.delete(oldest);
|
|
851
|
+
groupsMemoChars -= entry.text.length;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return groups;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/** Test seam (#207): the import-groups memo's size, and a reset. */
|
|
858
|
+
export const importGroupsMemo = {
|
|
859
|
+
size: () => groupsMemo.size,
|
|
860
|
+
clear: () => {
|
|
861
|
+
groupsMemo.clear();
|
|
862
|
+
groupsMemoChars = 0;
|
|
863
|
+
},
|
|
864
|
+
};
|
|
865
|
+
|
|
767
866
|
/** A canvas slug in Unicode NFC — how the same-name owner rule compares names (p8-closure-lows-2). */
|
|
768
867
|
const slugNfc = (rel: string): string => canvasSlugFromRel(rel, '').normalize('NFC');
|
|
769
868
|
|
|
@@ -774,7 +873,12 @@ function walkImports(
|
|
|
774
873
|
env: WalkEnv,
|
|
775
874
|
canvas: string,
|
|
776
875
|
granted: ReadonlySet<string>
|
|
777
|
-
): {
|
|
876
|
+
): {
|
|
877
|
+
visited: Array<{ rel: string; text: string }>;
|
|
878
|
+
refused: Set<string>;
|
|
879
|
+
missing: Set<string>;
|
|
880
|
+
blocked: boolean;
|
|
881
|
+
} {
|
|
778
882
|
// gate-b-c4e — what an import may pull into the closure. A file of the design root's runtime
|
|
779
883
|
// state never (the build refuses it too); a canvas's board / meta / EDL never (they are that
|
|
780
884
|
// canvas's, not a module). Helpers, components and the design system stay reachable.
|
|
@@ -785,6 +889,9 @@ function walkImports(
|
|
|
785
889
|
const refused = new Set<string>();
|
|
786
890
|
// gate-b-c4l — anything the walk does not follow, or cannot resolve, blocks the canvas.
|
|
787
891
|
let blocked = false;
|
|
892
|
+
// 2.0.7 — the design-root paths of the imports that resolved to no file (a file deleted, renamed or not
|
|
893
|
+
// here yet): they block the canvas like any unresolved import, and the shell names them on its card.
|
|
894
|
+
const missing = new Set<string>();
|
|
788
895
|
// p8-perf-814 (V2-8.14) — a same-name stylesheet's owner that is NO file and has no meta of its
|
|
789
896
|
// own, and that folds to the slug of granted canvases only, IS the granted canvas: its only
|
|
790
897
|
// canvas-ness is the granted canvas's own slug-keyed board. (`Combine-admin.tsx` importing
|
|
@@ -809,13 +916,13 @@ function walkImports(
|
|
|
809
916
|
if (hit !== undefined) return hit;
|
|
810
917
|
let any = false;
|
|
811
918
|
let foreign = false;
|
|
812
|
-
|
|
813
|
-
|
|
919
|
+
const index = env.slugIndex();
|
|
920
|
+
for (const f of index.files.get(slug) ?? []) {
|
|
814
921
|
if (granted.has(f)) any = true;
|
|
815
922
|
else foreign = true;
|
|
816
923
|
}
|
|
817
924
|
// An entry the listing saw but left out is foreign, granted or not: it cannot be read.
|
|
818
|
-
|
|
925
|
+
if (index.unlisted.has(slug)) foreign = true;
|
|
819
926
|
slugOwned.set(slug, any && !foreign);
|
|
820
927
|
return any && !foreign;
|
|
821
928
|
};
|
|
@@ -836,7 +943,7 @@ function walkImports(
|
|
|
836
943
|
};
|
|
837
944
|
// The transitive relative import graph, from the canvas (and the DS override it pulls in).
|
|
838
945
|
const queue: string[] = [canvas];
|
|
839
|
-
const sys = canvasSystem(env.project, canvas, env.cfg);
|
|
946
|
+
const sys = canvasSystem(env.project, canvas, env.cfg, env.files);
|
|
840
947
|
const canvasText = env.textOf(canvas);
|
|
841
948
|
if (sys && canvasText !== null && importsDs(canvasText))
|
|
842
949
|
queue.push(`${sys.path}/preview/_ds.tsx`);
|
|
@@ -880,7 +987,7 @@ function walkImports(
|
|
|
880
987
|
else blocked = true;
|
|
881
988
|
}
|
|
882
989
|
if (!MODULE_EXT_RE.test(rel) && !/\.css$/i.test(rel)) continue;
|
|
883
|
-
for (const group of
|
|
990
|
+
for (const group of walkImportGroups(text, rel)) {
|
|
884
991
|
let resolved = false;
|
|
885
992
|
for (const abs of group) {
|
|
886
993
|
const dep = abs
|
|
@@ -893,10 +1000,20 @@ function walkImports(
|
|
|
893
1000
|
if (ownSurfaceStyle(dep) || importable(dep)) queue.push(dep);
|
|
894
1001
|
else blocked = true;
|
|
895
1002
|
}
|
|
896
|
-
if (!resolved)
|
|
1003
|
+
if (!resolved) {
|
|
1004
|
+
blocked = true;
|
|
1005
|
+
const first = group[0];
|
|
1006
|
+
if (first?.startsWith(`${VROOT}/`))
|
|
1007
|
+
missing.add(
|
|
1008
|
+
first
|
|
1009
|
+
.slice(VROOT.length + 1)
|
|
1010
|
+
.split(sep)
|
|
1011
|
+
.join('/')
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
897
1014
|
}
|
|
898
1015
|
}
|
|
899
|
-
return { visited, refused, blocked: blocked || refused.size > 0 };
|
|
1016
|
+
return { visited, refused, missing, blocked: blocked || refused.size > 0 };
|
|
900
1017
|
}
|
|
901
1018
|
|
|
902
1019
|
/**
|
|
@@ -922,6 +1039,29 @@ export function canvasImportsReport(
|
|
|
922
1039
|
return out;
|
|
923
1040
|
}
|
|
924
1041
|
|
|
1042
|
+
/**
|
|
1043
|
+
* 2.0.7 — per canvas, the imports that resolve to no file in the design root (sorted; a canvas with none is
|
|
1044
|
+
* absent). Such a canvas is blocked (c4l), so its frame is refused before the build and no build error
|
|
1045
|
+
* could name the file: the shell reads this (`/_index-data` `canvasMissingImports`) to say which file is
|
|
1046
|
+
* missing instead of "It didn't finish loading". Reader-free: the names come from the canvas's own source.
|
|
1047
|
+
*/
|
|
1048
|
+
export function canvasMissingImportsReport(
|
|
1049
|
+
project: ProjectReader,
|
|
1050
|
+
canvases: readonly string[],
|
|
1051
|
+
config?: ClosureConfig
|
|
1052
|
+
): Map<string, string[]> {
|
|
1053
|
+
const files = new Set<string>(project.list());
|
|
1054
|
+
const cfg = config ?? closureConfigOf(readJsonObject(project, 'config.json'));
|
|
1055
|
+
const env = walkEnv(project, files, cfg);
|
|
1056
|
+
const out = new Map<string, string[]>();
|
|
1057
|
+
for (const canvas of canvases) {
|
|
1058
|
+
if (!files.has(canvas)) continue;
|
|
1059
|
+
const { missing } = walkImports(env, canvas, new Set([canvas]));
|
|
1060
|
+
if (missing.size) out.set(canvas, [...missing].sort());
|
|
1061
|
+
}
|
|
1062
|
+
return out;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
925
1065
|
function compute(
|
|
926
1066
|
canvases: string[],
|
|
927
1067
|
project: ProjectReader,
|
|
@@ -980,7 +1120,7 @@ function compute(
|
|
|
980
1120
|
if (DYNAMIC_RES.some((re) => re.test(text))) dynamic.add(canvas);
|
|
981
1121
|
for (const a of existingAssetRefs(text)) closureAssets.add(a);
|
|
982
1122
|
}
|
|
983
|
-
const sys = canvasSystem(project, canvas, cfg);
|
|
1123
|
+
const sys = canvasSystem(project, canvas, cfg, files);
|
|
984
1124
|
// Static asset references in the canvas's own sidecars (meta, board).
|
|
985
1125
|
for (const rel of ownedOf(canvas, twins)) {
|
|
986
1126
|
if (rel === canvas || !TEXT_SCAN_RE.test(rel)) continue;
|
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
type Closure,
|
|
58
58
|
type ClosureCache,
|
|
59
59
|
canvasImportsReport,
|
|
60
|
+
canvasMissingImportsReport,
|
|
60
61
|
closureFor,
|
|
61
62
|
createClosureCache,
|
|
62
63
|
projectClosureConfig,
|
|
@@ -581,6 +582,11 @@ export interface ProjectVisibility {
|
|
|
581
582
|
* the names to what its reader sees (`filterIndexData`). Memoized per tree generation.
|
|
582
583
|
*/
|
|
583
584
|
canvasImports(canvases: readonly string[]): ReadonlyMap<string, string[]>;
|
|
585
|
+
/**
|
|
586
|
+
* 2.0.7 — of `canvases`, the ones with an import that resolves to no file → those imports
|
|
587
|
+
* (closure.ts `canvasMissingImportsReport`). Memoized per tree generation like `canvasImports`.
|
|
588
|
+
*/
|
|
589
|
+
canvasMissingImports?(canvases: readonly string[]): ReadonlyMap<string, string[]>;
|
|
584
590
|
/**
|
|
585
591
|
* 2.0.2 — resolves once the closure's listing holds a materializing cell's journal media (the
|
|
586
592
|
* first `listMaterializable` answer; later ones refresh in the background). Immediate off a
|
|
@@ -597,7 +603,8 @@ const sources = new WeakMap<object, ProjectVisibility>();
|
|
|
597
603
|
* write gate (http.ts) and the read filters (api.ts) compute the same closure once.
|
|
598
604
|
*
|
|
599
605
|
* gate-b-c4j — judged with the studio's EFFECTIVE config (`ctx.cfg`, read per call: a config
|
|
600
|
-
* reload swaps it)
|
|
606
|
+
* reload swaps it) when `<designRoot>/config.json` does not exist (a custom designRoot); 2.0.5 —
|
|
607
|
+
* otherwise with that file, the one the board build reads (`config` below).
|
|
601
608
|
*/
|
|
602
609
|
export function projectVisibility(
|
|
603
610
|
ctx: Pick<Context, 'paths' | 'bus'> & { cfg?: Context['cfg'] }
|
|
@@ -625,6 +632,8 @@ export function projectVisibility(
|
|
|
625
632
|
await listMaterializable();
|
|
626
633
|
};
|
|
627
634
|
// p8-c4b — plus the canvases the authority knows of (a stored grant), re-read per call.
|
|
635
|
+
// 2.0.5 — `closureConfigFor` reads the design systems from `<designRoot>/config.json` when it exists
|
|
636
|
+
// (the file the board build reads), so the closure and the build cannot disagree.
|
|
628
637
|
const config = () =>
|
|
629
638
|
closureConfigFor(ctx) ?? projectClosureConfig(reader, knownCanvasesFor(undefined));
|
|
630
639
|
const closureOf = (access: Access): Closure | null =>
|
|
@@ -641,11 +650,24 @@ export function projectVisibility(
|
|
|
641
650
|
while (reports.size > 16) reports.delete(reports.keys().next().value as string);
|
|
642
651
|
return report;
|
|
643
652
|
};
|
|
653
|
+
const missingReports = new Map<string, ReadonlyMap<string, string[]>>();
|
|
654
|
+
const canvasMissingImports = (canvases: readonly string[]) => {
|
|
655
|
+
const cfg = config();
|
|
656
|
+
const key = `${generation}\u0002${JSON.stringify(cfg)}\u0003${canvases.join('\u0001')}`;
|
|
657
|
+
const hit = missingReports.get(key);
|
|
658
|
+
if (hit) return hit;
|
|
659
|
+
const report = canvasMissingImportsReport(reader, canvases, cfg);
|
|
660
|
+
missingReports.set(key, report);
|
|
661
|
+
while (missingReports.size > 16)
|
|
662
|
+
missingReports.delete(missingReports.keys().next().value as string);
|
|
663
|
+
return report;
|
|
664
|
+
};
|
|
644
665
|
const src: ProjectVisibility = Object.freeze({
|
|
645
666
|
closureOf,
|
|
646
667
|
visibilityFor,
|
|
647
668
|
current: () => visibilityFor(currentAccess()),
|
|
648
669
|
canvasImports,
|
|
670
|
+
canvasMissingImports,
|
|
649
671
|
ready,
|
|
650
672
|
});
|
|
651
673
|
sources.set(ctx, src);
|
|
@@ -677,6 +699,10 @@ interface IndexDataShape {
|
|
|
677
699
|
dsRevGaps?: Record<string, string | null>;
|
|
678
700
|
// gate-b-c4j — a canvas → the other canvases it imports (its frame is refused; api.ts buildIndexData)
|
|
679
701
|
canvasImportsCanvases?: Record<string, string[]>;
|
|
702
|
+
// 2.0.5 (#205) — a canvas → the design-root files its built module was refused for (access/refused-inputs.ts)
|
|
703
|
+
canvasRefusedInputs?: Record<string, string[]>;
|
|
704
|
+
// 2.0.7 — a canvas → its imports that resolve to no file (its frame is refused; closure.ts)
|
|
705
|
+
canvasMissingImports?: Record<string, string[]>;
|
|
680
706
|
}
|
|
681
707
|
|
|
682
708
|
/** Repo-relative `.design/ui/x/y.tsx` → every ancestor dir (`.design/ui`, `.design/ui/x`). */
|
|
@@ -733,14 +759,22 @@ export function filterIndexData<T extends IndexDataShape>(
|
|
|
733
759
|
// sees. gate-b-c4k — an entry whose every name is hidden is dropped: it would tell the reader that
|
|
734
760
|
// A imports SOME canvas it cannot see (a probe oracle: plant an import, watch the card). Its frame
|
|
735
761
|
// is still refused; the shell shows the generic card there.
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
Object.entries(
|
|
762
|
+
const namesSeen = (m: Record<string, string[]>) =>
|
|
763
|
+
Object.fromEntries(
|
|
764
|
+
Object.entries(m)
|
|
739
765
|
.filter(([k]) => seen(k))
|
|
740
766
|
.map(([k, v]) => [k, v.filter((c) => vis.sees(c))] as const)
|
|
741
767
|
.filter(([, v]) => v.length > 0)
|
|
742
768
|
);
|
|
743
|
-
|
|
769
|
+
if (data.canvasImportsCanvases) out.canvasImportsCanvases = namesSeen(data.canvasImportsCanvases);
|
|
770
|
+
// 2.0.5 (#205) — the refused files by the same rule: only names this reader sees, no all-hidden entry
|
|
771
|
+
if (data.canvasRefusedInputs) out.canvasRefusedInputs = namesSeen(data.canvasRefusedInputs);
|
|
772
|
+
// 2.0.7 — a missing import is a path that is NOT on disk, read from the canvas's own source, which the
|
|
773
|
+
// reader sees: kept for the canvases it sees (a name `vis.sees` would always drop, there is no such file)
|
|
774
|
+
if (data.canvasMissingImports)
|
|
775
|
+
out.canvasMissingImports = Object.fromEntries(
|
|
776
|
+
Object.entries(data.canvasMissingImports).filter(([k]) => seen(k))
|
|
777
|
+
);
|
|
744
778
|
// S10.4 — the revision fields name systems and revisions: a session sees the ones it renders with.
|
|
745
779
|
if (data.dsConverted) {
|
|
746
780
|
const byName = <V>(m: Record<string, V> | undefined) =>
|
|
@@ -77,6 +77,29 @@ export function knownCanvasesFor(
|
|
|
77
77
|
*/
|
|
78
78
|
export function closureConfigFor(ctx: {
|
|
79
79
|
cfg?: { linkedHub?: { url?: string } | null } | null;
|
|
80
|
+
paths?: { designRoot?: string };
|
|
80
81
|
}): ClosureConfig | undefined {
|
|
81
|
-
|
|
82
|
+
// 2.0.5 (decision maude/v2-205-closure-config-is-the-build-config) — the design systems come from
|
|
83
|
+
// `<designRoot>/config.json` whenever it parses: the file the board build itself reads
|
|
84
|
+
// (ds-resolver `canvasSystemFor`) and the hub's file plane judges with. `ctx.cfg` reloads only on a
|
|
85
|
+
// watcher `fs:json`, which a cell child never gets (the journal heal emits `fs:any`), so after a
|
|
86
|
+
// synced config change the closure judged a DS board with another system list than its build
|
|
87
|
+
// used and the board failed closed (design.studyfi.com, 2.0.4). `ctx.cfg` stays the answer for a
|
|
88
|
+
// custom designRoot, which has no `<designRoot>/config.json` (gate-b-c4j). The linked hub (for the
|
|
89
|
+
// known canvases) is boot-pinned in `ctx.cfg` either way.
|
|
90
|
+
const own = designRootConfig(ctx.paths?.designRoot);
|
|
91
|
+
const known = () => knownCanvasesFor(ctx.cfg ?? undefined);
|
|
92
|
+
if (own) return closureConfigOf(own, known());
|
|
93
|
+
return ctx.cfg ? closureConfigOf(ctx.cfg, known()) : undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** `<designRoot>/config.json` as an object, or null (absent, unreadable, not an object). */
|
|
97
|
+
function designRootConfig(designRoot: string | undefined): Record<string, unknown> | null {
|
|
98
|
+
if (!designRoot) return null;
|
|
99
|
+
try {
|
|
100
|
+
const v = JSON.parse(readFileSync(`${designRoot}/config.json`, 'utf8'));
|
|
101
|
+
return v && typeof v === 'object' && !Array.isArray(v) ? (v as Record<string, unknown>) : null;
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
82
105
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// access/refused-inputs.ts — 2.0.5 (#205): why a canvas's built module was refused, for the person who can fix it.
|
|
2
|
+
//
|
|
3
|
+
// The inputs gate (access/frame.ts `inputsRefusal`, http.ts `canvasInputsGate`) refuses a built canvas module
|
|
4
|
+
// when it inlined a design-root file the frame's closure does not admit — typically a file that belongs to
|
|
5
|
+
// another canvas. The canvas origin answers the bare not-in-scope 403 and must keep doing so: canvas code reads
|
|
6
|
+
// that body. So the refusal's reason is kept HERE, on the server, per canvas, and reported only on the main
|
|
7
|
+
// origin (`/_index-data` `canvasRefusedInputs`, filtered per reader like `canvasImportsCanvases` — a name the
|
|
8
|
+
// reader cannot see is left out, and an entry with no visible name is dropped).
|
|
9
|
+
//
|
|
10
|
+
// Bounded: at most MAX_CANVASES canvases (oldest dropped first) × MAX_NAMES names each. A later build of the
|
|
11
|
+
// same canvas that passes the gate forgets its entry.
|
|
12
|
+
|
|
13
|
+
import { relative, resolve, sep } from 'node:path';
|
|
14
|
+
import { isUnderOrEqualPath } from './frame.ts';
|
|
15
|
+
|
|
16
|
+
export const MAX_CANVASES = 200;
|
|
17
|
+
export const MAX_NAMES = 20;
|
|
18
|
+
|
|
19
|
+
/** The design-root files (design-root-relative, `/`-separated) among `inputs` that `sees` does not admit. */
|
|
20
|
+
export function refusedDesignInputs(
|
|
21
|
+
inputs: readonly string[],
|
|
22
|
+
roots: readonly string[],
|
|
23
|
+
sees: (rel: string) => boolean
|
|
24
|
+
): string[] {
|
|
25
|
+
const out = new Set<string>();
|
|
26
|
+
for (const abs of inputs) {
|
|
27
|
+
for (const root of roots) {
|
|
28
|
+
if (!isUnderOrEqualPath(abs, root)) continue;
|
|
29
|
+
const rel = relative(root, abs).split(sep).join('/');
|
|
30
|
+
if (rel && !sees(rel)) out.add(rel);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [...out].sort().slice(0, MAX_NAMES);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** `entry` (absolute) → its design-root-relative name, or null outside every root. */
|
|
38
|
+
export function entryRel(entry: string, roots: readonly string[]): string | null {
|
|
39
|
+
for (const root of roots) {
|
|
40
|
+
const rel = relative(root, resolve(entry)).split(sep).join('/');
|
|
41
|
+
if (rel && !rel.startsWith('..')) return rel;
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface RefusedInputs {
|
|
47
|
+
/** Keep `names` as the reason `canvas` was refused. @returns whether the entry changed */
|
|
48
|
+
record(canvas: string, names: readonly string[]): boolean;
|
|
49
|
+
/** The gate passed for `canvas`: forget its reason. @returns whether there was one */
|
|
50
|
+
clear(canvas: string): boolean;
|
|
51
|
+
/** canvas (design-root-relative) → the files it was refused for. */
|
|
52
|
+
report(): Map<string, string[]>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function createRefusedInputs(max = MAX_CANVASES): RefusedInputs {
|
|
56
|
+
const byCanvas = new Map<string, string[]>();
|
|
57
|
+
return {
|
|
58
|
+
record(canvas, names) {
|
|
59
|
+
const list = [...new Set(names)].sort().slice(0, MAX_NAMES);
|
|
60
|
+
const was = byCanvas.get(canvas);
|
|
61
|
+
if (was && was.length === list.length && was.every((n, i) => n === list[i])) return false;
|
|
62
|
+
byCanvas.delete(canvas); // re-insert: the newest is last
|
|
63
|
+
byCanvas.set(canvas, list);
|
|
64
|
+
while (byCanvas.size > max) {
|
|
65
|
+
const oldest = byCanvas.keys().next().value;
|
|
66
|
+
if (oldest === undefined) break;
|
|
67
|
+
byCanvas.delete(oldest);
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
},
|
|
71
|
+
clear(canvas) {
|
|
72
|
+
return byCanvas.delete(canvas);
|
|
73
|
+
},
|
|
74
|
+
report() {
|
|
75
|
+
return new Map([...byCanvas].map(([k, v]) => [k, [...v]]));
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// One store per server context (the http layer records, the index reports).
|
|
81
|
+
const stores = new WeakMap<object, RefusedInputs>();
|
|
82
|
+
export function refusedInputsFor(ctx: object): RefusedInputs {
|
|
83
|
+
let s = stores.get(ctx);
|
|
84
|
+
if (!s) {
|
|
85
|
+
s = createRefusedInputs();
|
|
86
|
+
stores.set(ctx, s);
|
|
87
|
+
}
|
|
88
|
+
return s;
|
|
89
|
+
}
|
|
@@ -181,6 +181,38 @@ export const AGENT_PATHS: Readonly<Record<ActionId, ActionDefAI>> = {
|
|
|
181
181
|
server: { route: '/_api/sync/cancel-assets', method: 'POST' },
|
|
182
182
|
agent: cli('maude design curl-local -X POST http://127.0.0.1:<port>/_api/sync/cancel-assets'),
|
|
183
183
|
},
|
|
184
|
+
// Issue #207 — which folders a project syncs is the person's choice (a versioned config write
|
|
185
|
+
// that changes what reaches the team), so the AI is never taught it.
|
|
186
|
+
'sync.ignore-folder': {
|
|
187
|
+
effect: 'none',
|
|
188
|
+
minRole: 'edit',
|
|
189
|
+
server: { route: '/_api/sync/settings', method: 'POST' },
|
|
190
|
+
agent: human('hub-link', 'which folders the project syncs is the person’s choice'),
|
|
191
|
+
},
|
|
192
|
+
'sync.sync-folder-again': {
|
|
193
|
+
effect: 'none',
|
|
194
|
+
minRole: 'edit',
|
|
195
|
+
server: { route: '/_api/sync/settings', method: 'POST' },
|
|
196
|
+
agent: human('hub-link', 'which folders the project syncs is the person’s choice'),
|
|
197
|
+
},
|
|
198
|
+
// Issue #207 (7b) — the answer to a batch of local deletes held by the delete breaker. Deleting on the
|
|
199
|
+
// hub removes the files for every teammate (each held on their Mac for their own confirm), so it is
|
|
200
|
+
// the person's decision, never the AI's; keeping them on the hub is only about this Mac's copy.
|
|
201
|
+
'sync.delete-held-on-hub': {
|
|
202
|
+
effect: 'shared',
|
|
203
|
+
minRole: 'edit',
|
|
204
|
+
server: { route: '/_api/sync/held-deletes', method: 'POST' },
|
|
205
|
+
agent: human(
|
|
206
|
+
'hub-link',
|
|
207
|
+
'deleting a batch of files on the project’s hub is the person’s choice'
|
|
208
|
+
),
|
|
209
|
+
},
|
|
210
|
+
'sync.keep-held-on-hub': {
|
|
211
|
+
effect: 'none',
|
|
212
|
+
minRole: 'edit',
|
|
213
|
+
server: { route: '/_api/sync/held-deletes', method: 'POST' },
|
|
214
|
+
agent: human('hub-link', 'which deleted files stay on the hub is the person’s choice'),
|
|
215
|
+
},
|
|
184
216
|
// p8-held-conflict-status — the two versions of a held source conflict (read only): this Mac's file and
|
|
185
217
|
// the project's, kept in `_history/<slug>/sync-recovery/`. `maude design sync status` lists the slugs.
|
|
186
218
|
// No `server`: the action itself only opens a sheet; the read under it is Sync details' own GET.
|
|
@@ -191,6 +223,24 @@ export const AGENT_PATHS: Readonly<Record<ActionId, ActionDefAI>> = {
|
|
|
191
223
|
),
|
|
192
224
|
},
|
|
193
225
|
'sync.get-latest': GIT('/_api/git/pull', 'git pull'),
|
|
226
|
+
// fix/207 — the person's yes / no to shared code (.ts/.js) from the project's hub: it runs on this
|
|
227
|
+
// Mac outside the canvas sandbox (DDR-054), so an agent can never say yes for them (human
|
|
228
|
+
// 'consent'). The route answers only the window's own fetch (routes/sync.ts) and bash-guard names it.
|
|
229
|
+
'sync.allow-code': {
|
|
230
|
+
effect: 'external',
|
|
231
|
+
minRole: 'edit',
|
|
232
|
+
server: { route: '/_api/sync/code-consent/set', method: 'POST' },
|
|
233
|
+
agent: human(
|
|
234
|
+
'consent',
|
|
235
|
+
'the person’s yes to shared code from this project’s hub running on their Mac'
|
|
236
|
+
),
|
|
237
|
+
},
|
|
238
|
+
'sync.stop-code': {
|
|
239
|
+
effect: 'none',
|
|
240
|
+
minRole: 'edit',
|
|
241
|
+
server: { route: '/_api/sync/code-consent/set', method: 'POST' },
|
|
242
|
+
agent: human('consent', 'takes back the person’s yes to shared code'),
|
|
243
|
+
},
|
|
194
244
|
'sync.sign-in-again': {
|
|
195
245
|
effect: 'none',
|
|
196
246
|
agent: human('hub-link', 'signing in to the cloud is the person’s own credential'),
|
|
@@ -1073,6 +1123,10 @@ export const AGENT_PATHS: Readonly<Record<ActionId, ActionDefAI>> = {
|
|
|
1073
1123
|
'view.layers': { effect: 'none', agent: cli('maude design open --panel layers') },
|
|
1074
1124
|
'view.inspector-on-select': PREF(),
|
|
1075
1125
|
'view.minimap': PREF(),
|
|
1126
|
+
// 2.0.7 B2 — Canvas | Pages and its paging are the person's own view of the canvas (the view file, per Mac)
|
|
1127
|
+
'view.pages': PREF(),
|
|
1128
|
+
'pages.next': PREF(),
|
|
1129
|
+
'pages.prev': PREF(),
|
|
1076
1130
|
'view.zoom-controls': PREF(),
|
|
1077
1131
|
'view.print-guides': PREF(),
|
|
1078
1132
|
'present.canvas': NAV('<canvas> --mode present'),
|
|
@@ -1700,6 +1754,11 @@ export const AGENT_PATHS: Readonly<Record<ActionId, ActionDefAI>> = {
|
|
|
1700
1754
|
effect: 'none',
|
|
1701
1755
|
agent: human('native-window', 'the desktop app’s profiles; an agent never picks an account'),
|
|
1702
1756
|
},
|
|
1757
|
+
// 2.0.5 W4: GitHub's device flow — a person types the code in their own browser.
|
|
1758
|
+
'account.github-signin': {
|
|
1759
|
+
effect: 'none',
|
|
1760
|
+
agent: human('native-window', 'GitHub’s device flow; an agent never signs anyone in'),
|
|
1761
|
+
},
|
|
1703
1762
|
// V2-3.9: the shell's tab bar — a person's window, never an agent's.
|
|
1704
1763
|
'tab.close': { effect: 'none', agent: human('native-window') },
|
|
1705
1764
|
'tab.next': { effect: 'none', agent: human('native-window') },
|
|
@@ -38,6 +38,8 @@ export interface ShellKeyState {
|
|
|
38
38
|
assetTileSelected?: boolean;
|
|
39
39
|
/** S8.16 — the one selected picture has other takes (client/v2/assets/takes.js): ← → step between them. */
|
|
40
40
|
selectionHasTakes?: boolean;
|
|
41
|
+
/** 2.0.7 B2 — the active canvas shows Pages (canvas-mode.js `pages`): ⌥⌘P and the Present keys are off. */
|
|
42
|
+
pagesView?: boolean;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/** <input> types that take no typing: they act like buttons (a checkbox switch, a radio, a colour well). */
|
|
@@ -73,6 +75,7 @@ export function shellKeyCtx(probe: FocusProbe, s: ShellKeyState): KeyCtx {
|
|
|
73
75
|
if (range) facts.add('rangeFocused');
|
|
74
76
|
if (s.assetTileSelected) facts.add('assetTileSelected');
|
|
75
77
|
if (s.selectionHasTakes) facts.add('selectionHasTakes');
|
|
78
|
+
if (s.pagesView) facts.add('pagesView');
|
|
76
79
|
const selection: SelKind = s.clipSelected ? 'clip' : s.artboardSelected ? 'artboard' : 'none';
|
|
77
80
|
return {
|
|
78
81
|
role: s.readOnly ? 'comment' : 'owner',
|
|
@@ -115,6 +115,18 @@ export const APP_ACTIONS: ActionDef[] = [
|
|
|
115
115
|
exec: 'shell',
|
|
116
116
|
visible: { shell: ['desktop', 'cloud'] },
|
|
117
117
|
},
|
|
118
|
+
{
|
|
119
|
+
// 2.0.5 W4: GitHub sign-in from anywhere — the avatar's card, ⌘K and every "Sign in with GitHub to
|
|
120
|
+
// publish" line. The shell's own device flow (`github_sign_in`, oauth.rs): it stores on THIS project's
|
|
121
|
+
// profile and, for another account on a shared profile, binds a new one (v2-3.8-bind-on-sign-in). The
|
|
122
|
+
// mounted host (github-signin-host.jsx) runs it and shows the code; a browser tab has no keychain.
|
|
123
|
+
id: 'account.github-signin',
|
|
124
|
+
label: 'Sign in with GitHub…',
|
|
125
|
+
kind: 'command',
|
|
126
|
+
exec: 'shell',
|
|
127
|
+
visible: { shell: ['desktop'] },
|
|
128
|
+
search: { keywords: ['github', 'sign in', 'login', 'publish', 'connect'] },
|
|
129
|
+
},
|
|
118
130
|
{
|
|
119
131
|
id: 'ai.chat',
|
|
120
132
|
label: 'AI chat',
|
|
@@ -41,6 +41,19 @@ export const SYNC_ACTIONS: ActionDef[] = [
|
|
|
41
41
|
pick('sync.discard-ai-edit', 'Discard'),
|
|
42
42
|
// Moving now's ✕: `POST /_api/sync/cancel-assets` (the sweep stops; uploads are idempotent)
|
|
43
43
|
pick('sync.cancel-transfer', 'Cancel the transfer'),
|
|
44
|
+
// fix/207 — shared code from the project's hub: Sync details' held row and the canvas-waiting card
|
|
45
|
+
// open the consent sheet; `POST /_api/sync/code-consent/set { allow }` records the answer on this
|
|
46
|
+
// Mac (the window's own fetch only, Can edit).
|
|
47
|
+
pick('sync.allow-code', 'Allow shared code…'),
|
|
48
|
+
pick('sync.stop-code', 'Stop allowing shared code…'),
|
|
49
|
+
// Issue #207 — Sync details › a long run of pictures going up: leave its folder out, or bring a
|
|
50
|
+
// left-out folder back (`POST /_api/sync/settings { addIgnoreFolder | removeIgnoreFolder }`).
|
|
51
|
+
pick('sync.ignore-folder', 'Don’t sync this folder'),
|
|
52
|
+
pick('sync.sync-folder-again', 'Sync it again'),
|
|
53
|
+
// Issue #207 (7b) — Sync details › Deleted on this Mac, held: send the held deletes to the hub as
|
|
54
|
+
// one confirmed batch, or keep the files on the hub (`POST /_api/sync/held-deletes { answer }`).
|
|
55
|
+
pick('sync.delete-held-on-hub', 'Move to the hub’s trash too…'),
|
|
56
|
+
pick('sync.keep-held-on-hub', 'Keep on the hub'),
|
|
44
57
|
// Get latest (moved here from Version history) and Sign in again: every role keeps them
|
|
45
58
|
{ id: 'sync.get-latest', label: 'Get latest', kind: 'command', exec: 'shell', search: ROW },
|
|
46
59
|
{ id: 'sync.sign-in-again', label: 'Sign in again', kind: 'command', exec: 'shell', search: ROW },
|