@1agh/maude 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  2. package/apps/studio/access/filters.ts +12 -5
  3. package/apps/studio/access/known-canvases.ts +24 -1
  4. package/apps/studio/access/refused-inputs.ts +89 -0
  5. package/apps/studio/actions/agents.ts +5 -0
  6. package/apps/studio/actions/defs/app.ts +12 -0
  7. package/apps/studio/actions.manifest.json +13 -1
  8. package/apps/studio/actions.parity.json +7 -1
  9. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  10. package/apps/studio/annotations/ui/lod.tsx +1 -1
  11. package/apps/studio/annotations/ui/text-style.ts +1 -1
  12. package/apps/studio/annotations-layer.tsx +0 -12
  13. package/apps/studio/api.ts +42 -0
  14. package/apps/studio/artboard-live-gate.tsx +267 -0
  15. package/apps/studio/artboard-live.ts +336 -0
  16. package/apps/studio/artboard-webgl.ts +668 -0
  17. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  18. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  19. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  20. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  21. package/apps/studio/bin/_ds-check.mjs +4 -1
  22. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  23. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  24. package/apps/studio/bin/_import-asset.mjs +2 -1
  25. package/apps/studio/bin/_perf-probe.mjs +2 -1
  26. package/apps/studio/bin/_studio-verb.mjs +24 -3
  27. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  28. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  29. package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
  30. package/apps/studio/bin/ds-check.sh +5 -1
  31. package/apps/studio/bin/perf.sh +11 -1
  32. package/apps/studio/bin/server-up.sh +7 -2
  33. package/apps/studio/bin/smoke.sh +19 -0
  34. package/apps/studio/canvas-lib.tsx +131 -12
  35. package/apps/studio/client/canvas-url.js +13 -0
  36. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  37. package/apps/studio/client/home/Shelves.jsx +4 -3
  38. package/apps/studio/client/home/home-accounts-model.js +121 -0
  39. package/apps/studio/client/home/home-api.js +6 -0
  40. package/apps/studio/client/home/home-app.jsx +141 -40
  41. package/apps/studio/client/home/home-model.js +172 -6
  42. package/apps/studio/client/home/home.css +169 -5
  43. package/apps/studio/client/home/shell-mode.js +8 -1
  44. package/apps/studio/client/hooks/use-project-data.jsx +2 -0
  45. package/apps/studio/client/panels/ChatPanel.jsx +27 -20
  46. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  47. package/apps/studio/client/panels/caps-cache.js +46 -0
  48. package/apps/studio/client/shell/viewport.jsx +36 -8
  49. package/apps/studio/client/v2/access/access-client.js +2 -0
  50. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  51. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  52. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  53. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  54. package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
  55. package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
  56. package/apps/studio/client/v2/code/code-bus.js +5 -0
  57. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
  58. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  59. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  60. package/apps/studio/client/v2/ds/make-host.jsx +13 -15
  61. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
  62. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  63. package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
  64. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  65. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  66. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  67. package/apps/studio/client/v2/history/git-model.js +3 -1
  68. package/apps/studio/client/v2/history/git-parts.jsx +16 -1
  69. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  70. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  71. package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
  72. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  73. package/apps/studio/client/v2/shell/menu-runner.js +11 -0
  74. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  75. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  76. package/apps/studio/client/v2/shell/share-cluster-host.jsx +137 -10
  77. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  78. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  79. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  80. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  81. package/apps/studio/client/v2/shell/use-account.js +8 -1
  82. package/apps/studio/collab/persistence.ts +9 -1
  83. package/apps/studio/collab/registry.ts +32 -0
  84. package/apps/studio/collab/room.ts +8 -0
  85. package/apps/studio/config-reload-wire.ts +53 -0
  86. package/apps/studio/dist/client.bundle.js +1232 -1232
  87. package/apps/studio/dist/styles.css +1 -1
  88. package/apps/studio/ds/board/specimen.tsx +12 -1
  89. package/apps/studio/ds/canvas-cli.ts +58 -2
  90. package/apps/studio/ds/check.ts +26 -1
  91. package/apps/studio/ds/cli.ts +7 -3
  92. package/apps/studio/ds/convert.ts +34 -6
  93. package/apps/studio/ds/ds-verb.ts +13 -0
  94. package/apps/studio/ds/post-build.ts +38 -0
  95. package/apps/studio/ds/upgrade-apply.ts +27 -5
  96. package/apps/studio/ds/upgrade-cli.ts +22 -2
  97. package/apps/studio/ds/upgrade-prove.ts +198 -15
  98. package/apps/studio/ds/upgrade-stage.ts +4 -1
  99. package/apps/studio/history/trash.ts +6 -0
  100. package/apps/studio/home/accounts.ts +87 -0
  101. package/apps/studio/home/index-reader.ts +24 -2
  102. package/apps/studio/home/routes.ts +19 -0
  103. package/apps/studio/http.ts +14 -2
  104. package/apps/studio/routes/ds-convert.ts +18 -0
  105. package/apps/studio/routes/trash.ts +16 -1
  106. package/apps/studio/server.ts +8 -10
  107. package/apps/studio/sync/accepted-cold-start.ts +28 -13
  108. package/apps/studio/sync/asset-push.ts +146 -23
  109. package/apps/studio/sync/asset-state.ts +3 -2
  110. package/apps/studio/sync/file-membership.ts +28 -3
  111. package/apps/studio/sync/file-plane.ts +40 -9
  112. package/apps/studio/sync/file-pull.ts +304 -33
  113. package/apps/studio/sync/hub-link.ts +1 -2
  114. package/apps/studio/sync/index.ts +308 -150
  115. package/apps/studio/sync/journal-client.ts +94 -5
  116. package/apps/studio/sync/pending-deletes.ts +100 -0
  117. package/apps/studio/sync/projection.ts +77 -12
  118. package/apps/studio/sync/seed-progress.ts +12 -1
  119. package/apps/studio/sync/status.ts +3 -1
  120. package/apps/studio/thumbs/service.ts +12 -2
  121. package/apps/studio/thumbs/validate.ts +7 -0
  122. package/apps/studio/ui-prefs-migrate.ts +4 -0
  123. package/apps/studio/video-comp.tsx +23 -0
  124. package/apps/studio/whats-new.json +72 -0
  125. package/cli/lib/bash-guard.mjs +13 -1
  126. package/cli/lib/design-help.gen.mjs +1 -1
  127. package/cli/lib/design-hook.mjs +20 -0
  128. package/cli/lib/studio-locate.mjs +35 -10
  129. package/package.json +8 -8
@@ -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
- for (const lane of c.lanes) lanes[lane] = await work.laneContent(st, lane);
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,
@@ -597,7 +597,8 @@ const sources = new WeakMap<object, ProjectVisibility>();
597
597
  * write gate (http.ts) and the read filters (api.ts) compute the same closure once.
598
598
  *
599
599
  * gate-b-c4j — judged with the studio's EFFECTIVE config (`ctx.cfg`, read per call: a config
600
- * reload swaps it), not `<designRoot>/config.json`, which a custom designRoot does not have.
600
+ * reload swaps it) when `<designRoot>/config.json` does not exist (a custom designRoot); 2.0.5 —
601
+ * otherwise with that file, the one the board build reads (`config` below).
601
602
  */
602
603
  export function projectVisibility(
603
604
  ctx: Pick<Context, 'paths' | 'bus'> & { cfg?: Context['cfg'] }
@@ -625,6 +626,8 @@ export function projectVisibility(
625
626
  await listMaterializable();
626
627
  };
627
628
  // p8-c4b — plus the canvases the authority knows of (a stored grant), re-read per call.
629
+ // 2.0.5 — `closureConfigFor` reads the design systems from `<designRoot>/config.json` when it exists
630
+ // (the file the board build reads), so the closure and the build cannot disagree.
628
631
  const config = () =>
629
632
  closureConfigFor(ctx) ?? projectClosureConfig(reader, knownCanvasesFor(undefined));
630
633
  const closureOf = (access: Access): Closure | null =>
@@ -677,6 +680,8 @@ interface IndexDataShape {
677
680
  dsRevGaps?: Record<string, string | null>;
678
681
  // gate-b-c4j — a canvas → the other canvases it imports (its frame is refused; api.ts buildIndexData)
679
682
  canvasImportsCanvases?: Record<string, string[]>;
683
+ // 2.0.5 (#205) — a canvas → the design-root files its built module was refused for (access/refused-inputs.ts)
684
+ canvasRefusedInputs?: Record<string, string[]>;
680
685
  }
681
686
 
682
687
  /** Repo-relative `.design/ui/x/y.tsx` → every ancestor dir (`.design/ui`, `.design/ui/x`). */
@@ -733,14 +738,16 @@ export function filterIndexData<T extends IndexDataShape>(
733
738
  // sees. gate-b-c4k — an entry whose every name is hidden is dropped: it would tell the reader that
734
739
  // A imports SOME canvas it cannot see (a probe oracle: plant an import, watch the card). Its frame
735
740
  // is still refused; the shell shows the generic card there.
736
- if (data.canvasImportsCanvases) {
737
- out.canvasImportsCanvases = Object.fromEntries(
738
- Object.entries(data.canvasImportsCanvases)
741
+ const namesSeen = (m: Record<string, string[]>) =>
742
+ Object.fromEntries(
743
+ Object.entries(m)
739
744
  .filter(([k]) => seen(k))
740
745
  .map(([k, v]) => [k, v.filter((c) => vis.sees(c))] as const)
741
746
  .filter(([, v]) => v.length > 0)
742
747
  );
743
- }
748
+ if (data.canvasImportsCanvases) out.canvasImportsCanvases = namesSeen(data.canvasImportsCanvases);
749
+ // 2.0.5 (#205) — the refused files by the same rule: only names this reader sees, no all-hidden entry
750
+ if (data.canvasRefusedInputs) out.canvasRefusedInputs = namesSeen(data.canvasRefusedInputs);
744
751
  // S10.4 — the revision fields name systems and revisions: a session sees the ones it renders with.
745
752
  if (data.dsConverted) {
746
753
  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
- return ctx.cfg ? closureConfigOf(ctx.cfg, knownCanvasesFor(ctx.cfg)) : undefined;
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
+ }
@@ -1700,6 +1700,11 @@ export const AGENT_PATHS: Readonly<Record<ActionId, ActionDefAI>> = {
1700
1700
  effect: 'none',
1701
1701
  agent: human('native-window', 'the desktop app’s profiles; an agent never picks an account'),
1702
1702
  },
1703
+ // 2.0.5 W4: GitHub's device flow — a person types the code in their own browser.
1704
+ 'account.github-signin': {
1705
+ effect: 'none',
1706
+ agent: human('native-window', 'GitHub’s device flow; an agent never signs anyone in'),
1707
+ },
1703
1708
  // V2-3.9: the shell's tab bar — a person's window, never an agent's.
1704
1709
  'tab.close': { effect: 'none', agent: human('native-window') },
1705
1710
  'tab.next': { effect: 'none', agent: human('native-window') },
@@ -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',
@@ -2,7 +2,7 @@
2
2
  "generated": "scripts/gen-actions.mjs — do not edit by hand",
3
3
  "format": "maude.actions-manifest",
4
4
  "v": 1,
5
- "manifestVersion": "4ae7b6bdb900",
5
+ "manifestVersion": "3b10dc94b530",
6
6
  "actions": [
7
7
  {
8
8
  "id": "search.open",
@@ -4386,6 +4386,18 @@
4386
4386
  "note": "the desktop app’s profiles; an agent never picks an account"
4387
4387
  }
4388
4388
  },
4389
+ {
4390
+ "id": "account.github-signin",
4391
+ "label": "Sign in with GitHub…",
4392
+ "kind": "command",
4393
+ "exec": "shell",
4394
+ "effect": "none",
4395
+ "agent": {
4396
+ "path": "human",
4397
+ "because": "native-window",
4398
+ "note": "GitHub’s device flow; an agent never signs anyone in"
4399
+ }
4400
+ },
4389
4401
  {
4390
4402
  "id": "ai.chat",
4391
4403
  "label": "AI chat",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$comment": "Lead-owned (contract V2-1.11 §5.7). humanMax/pendingMax may only be lowered; raising either, or adding a humanDecisions reason, is a lead change citing a decision id.",
3
- "humanMax": 176,
3
+ "humanMax": 177,
4
4
  "pendingMax": 0,
5
5
  "pending": [],
6
6
  "humanDecisions": {
@@ -268,6 +268,12 @@
268
268
  "from": 175,
269
269
  "by": "decision:maude/v2-204-asset-spotlight-registry-action",
270
270
  "why": "2.0.4 (#191) registers assets.spotlight (View larger: the large preview of an Assets tile, dblclick / Space / tile menu). Human 'view-pref': it only changes what the person is looking at; an agent reads the file itself. One human row."
271
+ },
272
+ {
273
+ "to": 177,
274
+ "from": 176,
275
+ "by": "decision:maude/v2-205-w4-github-signin-action",
276
+ "why": "2.0.5 W4 registers account.github-signin (Sign in to GitHub from the account card: GitHub's device flow, the person types the code in their own browser). Human 'native-window': an agent never signs anyone in. One human row."
271
277
  }
272
278
  ],
273
279
  "humanMaxRaisedNote": "V2-5 A1 integration: the three slice raises stack on 86 (84 -> 86 by decision:maude/v2-4-gate-github-doors, human 'accounts'). S4.1/S4.3/S4.4 and S2.2-S2.4 add no human row. 86 + 4 + 6 + 4 = 100 human actions in the merged registry. V2-5 A2 integration: S5.4 builds `maude design runs list|stop`, so ai.runs.list and ai.stop turn cli (decision:maude/v2-S5.3-run-actions-human-until-s5.4 resolved by decision:maude/v2-S5.4-runs-fallback-prompts) and the cap lowers 100 -> 98; S3.1, S4.2, S4.5, S9.4, S2.5 and S1.4 add no human row. V2-5 A4 integration: measured 107 human actions in the merged registry (98 on feat + tool.pointer from S3.2b + 7 chat.advanced.* from S5.12 + object.select-matching from S2.6); every other A4 slice adds no human row. V2-5 A5 integration: measured 113 human actions in the merged registry (107 on feat + trash.clear from S1.7b + four ai.attach-* from S5.10 + present.presenter-view from S3.6b); every other A5 slice adds no human row. V2-5 A6a integration: measured 118 human actions in the merged registry (113 on feat + artboard.ask-ai S2.10 + element.set-id S2.2b/lead + edit.undo-history S2.20 + history.filter S1.12b − view.trash S1.17 (cli) + tab.overview + tab.rename S1.22b); every other A6a slice adds no human row."
@@ -41,7 +41,12 @@ import {
41
41
  type WorldPoint,
42
42
  } from '../../annotations-model.ts';
43
43
  import { arrowPrimitives, type SvgPrimitive } from '../../canvas-arrowheads.ts';
44
- import { countRender, useLiveViewport } from '../../canvas-lib.tsx';
44
+ import {
45
+ countRender,
46
+ cssCounterScaledChrome,
47
+ screenSizedRef,
48
+ useLiveViewport,
49
+ } from '../../canvas-lib.tsx';
45
50
  import { SECTION_FOLDED_H } from '../constants.ts';
46
51
  import { authorLine, provenanceLine, relativeTime, tiltOf } from '../elements/sticky.model.ts';
47
52
  import type { AnnotationElement } from '../types.ts';
@@ -283,6 +288,14 @@ export function stickyBoxPath(x: number, y: number, w: number, h: number, r: num
283
288
  ].join(' ');
284
289
  }
285
290
 
291
+ /**
292
+ * The "lifted paper" shadow: feDropShadow dx 0 · dy 4 · stdDeviation 8 · #000 @ 0.28, as a CSS box-shadow (blur radius
293
+ * = 2 × stdDeviation). It is the same in both themes - the filter never read one. It is a box-shadow on the NODE, not
294
+ * an SVG filter on the shape: WebKit re-rasters the world layer at every zoom frame, and 221 software filters made each
295
+ * frame ~230 ms on the retention-ladder board (v2.0.5 annot-zoom).
296
+ */
297
+ const PAPER_SHADOW = '0 4px 16px rgba(0, 0, 0, 0.28)';
298
+
286
299
  function StickyView({ el, interactive, edit, quiet, selected, mine, typist }: ElementNodeProps) {
287
300
  const x = num(el.x);
288
301
  const y = num(el.y);
@@ -331,7 +344,17 @@ function StickyView({ el, interactive, edit, quiet, selected, mine, typist }: El
331
344
  const shown = [line, origin, doneLine].filter(Boolean).join(' · ');
332
345
  const pin = useTimePin(el); // S4.16 — the time chip, the fade off range, "Not printed"
333
346
  return (
334
- <Node el={el} x={x} y={y} w={w} h={h} rot={rot} raised={!!edit} extraAttrs={pin.attrs}>
347
+ <Node
348
+ el={el}
349
+ x={x}
350
+ y={y}
351
+ w={w}
352
+ h={h}
353
+ rot={rot}
354
+ raised={!!edit}
355
+ extraAttrs={pin.attrs}
356
+ extraStyle={{ borderRadius: r, boxShadow: PAPER_SHADOW }}
357
+ >
335
358
  <PinTags pin={pin} />
336
359
  <Geo x={x} y={y} w={w} h={h}>
337
360
  <path
@@ -340,7 +363,6 @@ function StickyView({ el, interactive, edit, quiet, selected, mine, typist }: El
340
363
  stroke={aiMade ? AI_SPARK : 'rgba(0,0,0,0.05)'}
341
364
  strokeWidth={aiMade ? 2 : 1}
342
365
  vectorEffect="non-scaling-stroke"
343
- filter="url(#dc-sticky-shadow)"
344
366
  pointerEvents={hit(interactive)}
345
367
  />
346
368
  {typist ? (
@@ -791,6 +813,9 @@ function ImageView({ el, interactive, resolveAsset }: ElementNodeProps) {
791
813
  );
792
814
  }
793
815
 
816
+ /** A link / media card is a rounded rect (rx 8) with the same lifted-paper shadow, on its node. */
817
+ const CARD_SHADOW_STYLE: CSSProperties = { borderRadius: 8, boxShadow: PAPER_SHADOW };
818
+
794
819
  function LinkView({ el, interactive }: ElementNodeProps) {
795
820
  const x = num(el.x);
796
821
  const y = num(el.y);
@@ -799,7 +824,7 @@ function LinkView({ el, interactive }: ElementNodeProps) {
799
824
  const lay = linkCardLayout(x, y, w, h);
800
825
  const font = { fontFamily: TEXT_FONT } as const;
801
826
  return (
802
- <Node el={el} x={x} y={y} w={w} h={h} rot={num(el.rot)}>
827
+ <Node el={el} x={x} y={y} w={w} h={h} rot={num(el.rot)} extraStyle={CARD_SHADOW_STYLE}>
803
828
  <Geo x={x} y={y} w={w} h={h}>
804
829
  <g
805
830
  data-url={str(el.url)}
@@ -818,7 +843,6 @@ function LinkView({ el, interactive }: ElementNodeProps) {
818
843
  stroke={LINK_CARD_STROKE}
819
844
  strokeWidth={1}
820
845
  vectorEffect="non-scaling-stroke"
821
- filter="url(#dc-sticky-shadow)"
822
846
  />
823
847
  <svg
824
848
  x={lay.glyph.x}
@@ -873,7 +897,7 @@ function MediaRefView({ el, interactive }: ElementNodeProps) {
873
897
  const src = str(el.src);
874
898
  const font = { fontFamily: TEXT_FONT } as const;
875
899
  return (
876
- <Node el={el} x={x} y={y} w={w} h={h} rot={num(el.rot)}>
900
+ <Node el={el} x={x} y={y} w={w} h={h} rot={num(el.rot)} extraStyle={CARD_SHADOW_STYLE}>
877
901
  <Geo x={x} y={y} w={w} h={h}>
878
902
  <g
879
903
  data-src={src}
@@ -892,7 +916,6 @@ function MediaRefView({ el, interactive }: ElementNodeProps) {
892
916
  stroke={LINK_CARD_STROKE}
893
917
  strokeWidth={1}
894
918
  vectorEffect="non-scaling-stroke"
895
- filter="url(#dc-sticky-shadow)"
896
919
  />
897
920
  <svg
898
921
  x={x + 8}
@@ -945,22 +968,123 @@ export function sectionChip(label: string, zoom: number) {
945
968
  return { fontSize, chipH, gap, padX, chipW };
946
969
  }
947
970
 
948
- function SectionChip({
949
- el,
950
- interactive,
951
- edit,
952
- note,
953
- count,
954
- }: {
971
+ type SectionChipProps = {
955
972
  el: AnnotationElement;
956
973
  interactive: boolean;
957
974
  edit: EditRequest | null;
958
975
  note?: string;
959
976
  /** S4.13 - how many an open section holds, drawn as a small number after its name. */
960
977
  count?: string;
978
+ };
979
+
980
+ /**
981
+ * 2.0.5 W2 — on Blink the chip is drawn once at its SCREEN size and counter-scaled by CSS: the viewport
982
+ * controller writes `--dc-zoom` straight onto it (`screenSizedRef`, past the scene's `--dc-zoom` reset), so a
983
+ * pan/zoom gesture renders no chip — it re-rendered every chip at ~20 Hz from `useLiveViewport()`. It scales
984
+ * about the section's top-left corner, where it hangs from. WebKit (the desktop app) keeps the live-zoom chip:
985
+ * the per-frame transform was not shown to be free there (`cssCounterScaledChrome`).
986
+ */
987
+ function SectionChip({ el, interactive, edit, note, count }: SectionChipProps) {
988
+ if (edit) return <SectionChipEditor el={el} interactive={interactive} edit={edit} />;
989
+ if (!cssCounterScaledChrome())
990
+ return <SectionChipLive el={el} interactive={interactive} note={note} count={count} />;
991
+ countRender('sectionChipRenders');
992
+ const { label, g, style, box } = sectionChipStyles(el, interactive, 1);
993
+ const lift = g.chipH + g.gap;
994
+ return (
995
+ <div
996
+ ref={screenSizedRef}
997
+ className="dc-annot-chip"
998
+ data-section-chip="1"
999
+ style={{
1000
+ ...box,
1001
+ width: note || count ? undefined : g.chipW,
1002
+ whiteSpace: 'nowrap',
1003
+ transform: 'scale(calc(1 / var(--dc-zoom, 1)))',
1004
+ transformOrigin: `0 ${lift}px`,
1005
+ }}
1006
+ >
1007
+ <SectionChipTitle label={label} style={style} note={note} count={count} />
1008
+ </div>
1009
+ );
1010
+ }
1011
+
1012
+ /** WebKit: the chip sized from the live zoom (re-renders with it), exactly as before 2.0.5. */
1013
+ function SectionChipLive({ el, interactive, note, count }: Omit<SectionChipProps, 'edit'>) {
1014
+ countRender('sectionChipRenders');
1015
+ // Counter-scaled chrome needs the live zoom, not the settle-cadence one.
1016
+ const zoom = useLiveViewport().zoom || 1;
1017
+ const { label, g, style, box } = sectionChipStyles(el, interactive, zoom);
1018
+ return (
1019
+ <div
1020
+ className="dc-annot-chip"
1021
+ data-section-chip="1"
1022
+ style={{ ...box, width: note || count ? undefined : g.chipW, whiteSpace: 'nowrap' }}
1023
+ >
1024
+ <SectionChipTitle label={label} style={style} note={note} count={count} />
1025
+ </div>
1026
+ );
1027
+ }
1028
+
1029
+ function SectionChipTitle({
1030
+ label,
1031
+ style,
1032
+ note,
1033
+ count,
1034
+ }: {
1035
+ label: string;
1036
+ style: CSSProperties;
1037
+ note?: string;
1038
+ count?: string;
961
1039
  }) {
1040
+ return (
1041
+ <div className="dc-annot-text dc-annot-text--nowrap" style={style}>
1042
+ {label}
1043
+ {count ? (
1044
+ <span data-section-count="1" style={{ opacity: 0.65, marginLeft: 6, fontWeight: 500 }}>
1045
+ {count}
1046
+ </span>
1047
+ ) : null}
1048
+ {note ? (
1049
+ <span data-fold-note="1" style={{ opacity: 0.75, marginLeft: 8, fontWeight: 500 }}>
1050
+ {note}
1051
+ </span>
1052
+ ) : null}
1053
+ </div>
1054
+ );
1055
+ }
1056
+
1057
+ /** Renaming a section: the editor sizes its text in world px, so it keeps the live-zoom sizing. */
1058
+ function SectionChipEditor({
1059
+ el,
1060
+ interactive,
1061
+ edit,
1062
+ }: Pick<SectionChipProps, 'el' | 'interactive'> & { edit: EditRequest }) {
1063
+ countRender('sectionChipRenders');
962
1064
  // Counter-scaled chrome needs the live zoom, not the settle-cadence one.
963
1065
  const zoom = useLiveViewport().zoom || 1;
1066
+ const { label, g, style, box } = sectionChipStyles(el, interactive, zoom);
1067
+ return (
1068
+ <div className="dc-annot-chip" style={{ ...box, zIndex: 1 }}>
1069
+ <TextEditor
1070
+ initialText={label}
1071
+ singleLine
1072
+ className="dc-annot-text dc-annot-text--nowrap"
1073
+ style={style}
1074
+ size={{ kind: 'fit-both', minWidth: g.chipW }}
1075
+ fmt={{ fontSize: g.fontSize }}
1076
+ caretPoint={edit.caretPoint}
1077
+ ariaLabel="Rename section"
1078
+ onCommit={edit.onCommit}
1079
+ onCancel={edit.onCancel}
1080
+ onDraft={edit.onDraft}
1081
+ />
1082
+ </div>
1083
+ );
1084
+ }
1085
+
1086
+ /** The chip's box + title styles at `zoom` (1 = screen px, for the CSS-scaled chip). */
1087
+ function sectionChipStyles(el: AnnotationElement, interactive: boolean, zoom: number) {
964
1088
  const label = str(el.label, 'Section');
965
1089
  const color = str(el.color, '#8a8a8a');
966
1090
  const g = sectionChip(label, zoom);
@@ -982,46 +1106,7 @@ function SectionChip({
982
1106
  backgroundColor: color,
983
1107
  pointerEvents: interactive ? 'auto' : 'none',
984
1108
  };
985
- if (edit) {
986
- return (
987
- <div className="dc-annot-chip" style={{ ...box, zIndex: 1 }}>
988
- <TextEditor
989
- initialText={label}
990
- singleLine
991
- className="dc-annot-text dc-annot-text--nowrap"
992
- style={style}
993
- size={{ kind: 'fit-both', minWidth: g.chipW }}
994
- fmt={{ fontSize: g.fontSize }}
995
- caretPoint={edit.caretPoint}
996
- ariaLabel="Rename section"
997
- onCommit={edit.onCommit}
998
- onCancel={edit.onCancel}
999
- onDraft={edit.onDraft}
1000
- />
1001
- </div>
1002
- );
1003
- }
1004
- return (
1005
- <div
1006
- className="dc-annot-chip"
1007
- data-section-chip="1"
1008
- style={{ ...box, width: note || count ? undefined : g.chipW, whiteSpace: 'nowrap' }}
1009
- >
1010
- <div className="dc-annot-text dc-annot-text--nowrap" style={style}>
1011
- {label}
1012
- {count ? (
1013
- <span data-section-count="1" style={{ opacity: 0.65, marginLeft: 6, fontWeight: 500 }}>
1014
- {count}
1015
- </span>
1016
- ) : null}
1017
- {note ? (
1018
- <span data-fold-note="1" style={{ opacity: 0.75, marginLeft: 8, fontWeight: 500 }}>
1019
- {note}
1020
- </span>
1021
- ) : null}
1022
- </div>
1023
- </div>
1024
- );
1109
+ return { label, g, style, box };
1025
1110
  }
1026
1111
 
1027
1112
  function SectionView({ el, interactive, edit, foldNote }: ElementNodeProps) {
@@ -118,7 +118,7 @@ function personLabel(key: string): string {
118
118
  }
119
119
 
120
120
  export const LOD_CSS = `
121
- .dc-annot-lod { position: absolute; left: 0; top: 0; width: 0; height: 0; }
121
+ .dc-annot-lod { position: absolute; left: 0; top: 0; width: 0; height: 0; --dc-zoom: initial; }
122
122
  .dc-annot-lod[data-quiet] { opacity: 0.45; }
123
123
  .dc-annot-lod [data-lod] { position: absolute; box-sizing: border-box; pointer-events: none; }
124
124
  .dc-annot-lod[data-live] [data-lod="section"] { pointer-events: auto; cursor: zoom-in; }
@@ -100,7 +100,7 @@ export function stripListMarkers(text: string, list?: ListStyle): string {
100
100
  * like plain text (no border, no resize grip, inherited font).
101
101
  */
102
102
  export const TEXT_LAYER_CSS = `
103
- .dc-annot-scene { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; pointer-events: none; }
103
+ .dc-annot-scene { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; pointer-events: none; --dc-zoom: initial; }
104
104
  .dc-annot-el { position: absolute; pointer-events: none; }
105
105
  .dc-annot-el > svg.dc-annot-geo { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
106
106
  .dc-annot-text { box-sizing: border-box; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
@@ -5502,18 +5502,6 @@ function AnnotationsSvg({
5502
5502
  data-selection={annotSel?.selectedIds.join(' ') ?? ''}
5503
5503
  data-annot-state={gestureState}
5504
5504
  >
5505
- <defs>
5506
- {/* Phase 21 — soft "lifted paper" drop shadow for sticky notes. */}
5507
- <filter id="dc-sticky-shadow" x="-25%" y="-25%" width="150%" height="170%">
5508
- <feDropShadow
5509
- dx="0"
5510
- dy="4"
5511
- stdDeviation="8"
5512
- floodColor="#000000"
5513
- floodOpacity="0.28"
5514
- />
5515
- </filter>
5516
- </defs>
5517
5505
  {selectedStrokes.map((s) => (
5518
5506
  <SelectionHalo
5519
5507
  key={`halo-${s.id}`}
@@ -21,6 +21,7 @@ import {
21
21
  projectVisibility,
22
22
  } from './access/filters.ts';
23
23
  import { currentFrameKey } from './access/frame.ts';
24
+ import { refusedInputsFor } from './access/refused-inputs.ts';
24
25
  import { currentAccess, toDesignRel } from './access/request.ts';
25
26
  import { asPersonSave, saveHold } from './ai/save-hold.ts';
26
27
  import { canonicalAnnotations } from './annotations/board-text.ts';
@@ -62,6 +63,8 @@ import {
62
63
  type OpActor,
63
64
  type OpResult,
64
65
  } from './comments/ops.ts';
66
+ import { trashFolderDsCanvas } from './ds/convert.ts';
67
+ import { DS_CANVAS } from './ds/engine.ts';
65
68
  import { readHead } from './ds/head.ts';
66
69
  import { dsRenderIndex } from './ds/render-rev.ts';
67
70
  import { dropPin, rekeyUserState } from './home/user-state.ts';
@@ -4584,6 +4587,38 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
4584
4587
  return { ok: false, status: 400, error: 'path escapes the design root' };
4585
4588
  }
4586
4589
 
4590
+ // fix/ds-convert-hooks-cli #8 — a Design system canvas (`<system>/design-system.tsx`) whose
4591
+ // system is a folder (no head.json — a Restore that sync brought back) goes to the Trash the
4592
+ // way Restore puts one there; a converted system's canvas IS the system: Restore is the way.
4593
+ if (path.posix.basename(rel) === DS_CANVAS && path.posix.dirname(rel) !== '.') {
4594
+ const dsRel = path.posix.dirname(rel);
4595
+ const inSystems = cfg.canvasGroups.some(
4596
+ (g) =>
4597
+ (g.label === 'Design system' || /^system(\/|$)/.test(g.path)) &&
4598
+ (dsRel === g.path || dsRel.startsWith(`${g.path.replace(/\/+$/, '')}/`))
4599
+ );
4600
+ if (inSystems && (await Bun.file(fileAbs).exists())) {
4601
+ const t = trashFolderDsCanvas(paths.designRoot, dsRel);
4602
+ if (!t) {
4603
+ return {
4604
+ ok: false,
4605
+ status: 409,
4606
+ error: `this is the Design system canvas of ${path.posix.basename(dsRel)} — to turn it back into a folder, run \`maude design ds convert ${path.posix.basename(dsRel)} --restore\``,
4607
+ };
4608
+ }
4609
+ const slug = fileSlug(rel);
4610
+ ctx.bus.emit('canvas-list-update', { action: 'removed', rel, slug });
4611
+ ctx.bus.emit('canvas-deleted', { slug });
4612
+ return {
4613
+ ok: true,
4614
+ rel,
4615
+ slug,
4616
+ trashed: t.moved.map((f) => path.posix.join(dsRel, f)),
4617
+ trashDir: path.relative(paths.repoRoot, path.join(paths.designRoot, t.trash)),
4618
+ };
4619
+ }
4620
+ }
4621
+
4587
4622
  // Must live under a NON-DS canvas group — never the design system (`system`),
4588
4623
  // never a loose root file (config.json, README). Deleting DS sources is not a
4589
4624
  // canvas operation.
@@ -8092,6 +8127,12 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
8092
8127
  const imports = projectVisibility(ctx).canvasImports(canvasRels);
8093
8128
  const canvasImportsCanvases: Record<string, string[]> = {};
8094
8129
  for (const [rel, list] of imports) canvasImportsCanvases[`${prefix}${rel}`] = list;
8130
+ // 2.0.5 (#205) — a canvas whose BUILT module the inputs gate refused (it inlined a file another canvas
8131
+ // owns): the files, kept per canvas by the http layer (access/refused-inputs.ts). Main origin only — the
8132
+ // canvas origin's 403 stays the bare not-in-scope body.
8133
+ const refused = refusedInputsFor(ctx).report();
8134
+ const canvasRefusedInputs: Record<string, string[]> = {};
8135
+ for (const [rel, list] of refused) canvasRefusedInputs[`${prefix}${rel}`] = list;
8095
8136
 
8096
8137
  // S9.10 (V2-1.16 L8) — a canvas-only session's tree: what it sees, nothing else.
8097
8138
  return filterIndexData(
@@ -8103,6 +8144,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
8103
8144
  canvasDesignSystems,
8104
8145
  canvasKinds,
8105
8146
  ...(imports.size ? { canvasImportsCanvases } : {}),
8147
+ ...(refused.size ? { canvasRefusedInputs } : {}),
8106
8148
  ...(dsRender
8107
8149
  ? {
8108
8150
  canvasDsRevs: Object.fromEntries(