@1agh/maude 2.0.0-rc.1 → 2.0.0

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 (108) hide show
  1. package/apps/studio/acp/index.ts +35 -2
  2. package/apps/studio/acp/login-state.ts +3 -2
  3. package/apps/studio/actions/defs/chat.ts +4 -1
  4. package/apps/studio/actions.manifest.json +1 -1
  5. package/apps/studio/agent-runs.ts +3 -0
  6. package/apps/studio/ai/lease-home.ts +11 -1
  7. package/apps/studio/ai/run-lifecycle.ts +17 -0
  8. package/apps/studio/ai/runs.ts +64 -12
  9. package/apps/studio/api.ts +31 -5
  10. package/apps/studio/bridge/dgn-protocol.ts +13 -0
  11. package/apps/studio/canvas-imports.ts +23 -4
  12. package/apps/studio/canvas-lib.tsx +7 -0
  13. package/apps/studio/client/app.jsx +4 -0
  14. package/apps/studio/client/export-lane.js +4 -2
  15. package/apps/studio/client/fonts/LICENSE-Inter-Tight.txt +93 -0
  16. package/apps/studio/client/fonts/LICENSE-Inter.txt +93 -0
  17. package/apps/studio/client/fonts/LICENSE-JetBrains-Mono.txt +93 -0
  18. package/apps/studio/client/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  19. package/apps/studio/client/fonts/inter-latin-wght-normal.woff2 +0 -0
  20. package/apps/studio/client/fonts/inter-tight-latin-ext-wght-normal.woff2 +0 -0
  21. package/apps/studio/client/fonts/inter-tight-latin-wght-normal.woff2 +0 -0
  22. package/apps/studio/client/fonts/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
  23. package/apps/studio/client/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
  24. package/apps/studio/client/hooks/use-canvas-bridge.jsx +6 -0
  25. package/apps/studio/client/index.html +0 -3
  26. package/apps/studio/client/panels/ChatPanel.jsx +10 -2
  27. package/apps/studio/client/panels/acp-runtime.js +14 -0
  28. package/apps/studio/client/styles/_index.css +2 -0
  29. package/apps/studio/client/styles/fonts.css +63 -0
  30. package/apps/studio/client/system/system-view.jsx +6 -2
  31. package/apps/studio/client/tree-row-menu.jsx +4 -0
  32. package/apps/studio/client/v2/ai/Advanced.jsx +23 -7
  33. package/apps/studio/client/v2/ai/AttachMenu.jsx +4 -0
  34. package/apps/studio/client/v2/ai/ChatList.jsx +7 -1
  35. package/apps/studio/client/v2/ai/ConnectSheet.jsx +75 -4
  36. package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +42 -8
  37. package/apps/studio/client/v2/ai/NotReady.jsx +24 -3
  38. package/apps/studio/client/v2/ai/RunList.jsx +4 -0
  39. package/apps/studio/client/v2/ai/RunSurface.jsx +14 -4
  40. package/apps/studio/client/v2/ai/ScopeChip.jsx +4 -0
  41. package/apps/studio/client/v2/ai/Working.jsx +13 -1
  42. package/apps/studio/client/v2/ai/activity-line.js +390 -0
  43. package/apps/studio/client/v2/ai/activity-store.js +45 -0
  44. package/apps/studio/client/v2/ai/advanced-model.js +62 -12
  45. package/apps/studio/client/v2/ai/ai-list-advanced.css +7 -0
  46. package/apps/studio/client/v2/ai/ai-run.css +19 -0
  47. package/apps/studio/client/v2/ai/ai-send.js +6 -2
  48. package/apps/studio/client/v2/ai/connect-flow.js +29 -8
  49. package/apps/studio/client/v2/ai/needs-you.css +18 -0
  50. package/apps/studio/client/v2/ai/needs-you.js +10 -0
  51. package/apps/studio/client/v2/ai/ring-relay.js +11 -1
  52. package/apps/studio/client/v2/ai/use-activity-line.js +81 -0
  53. package/apps/studio/client/v2/annotations/templates-panel.jsx +4 -0
  54. package/apps/studio/client/v2/assets/kinds-chip.jsx +1 -1
  55. package/apps/studio/client/v2/assets/place-asset.js +20 -1
  56. package/apps/studio/client/v2/assets/tile-menu.jsx +1 -1
  57. package/apps/studio/client/v2/canvases/canvases-panel.jsx +5 -1
  58. package/apps/studio/client/v2/canvases/row-menu.jsx +4 -2
  59. package/apps/studio/client/v2/ds/review.css +2 -0
  60. package/apps/studio/client/v2/empty/ai-drafting.jsx +78 -0
  61. package/apps/studio/client/v2/empty/empty-host.jsx +17 -0
  62. package/apps/studio/client/v2/empty/empty.css +98 -0
  63. package/apps/studio/client/v2/export/advanced/render.jsx +5 -2
  64. package/apps/studio/client/v2/export/export-copy.js +11 -4
  65. package/apps/studio/client/v2/export/export-sheet.jsx +6 -2
  66. package/apps/studio/client/v2/export/exports-model.js +13 -0
  67. package/apps/studio/client/v2/export/exports-panel.jsx +4 -2
  68. package/apps/studio/client/v2/export/job-row.jsx +4 -0
  69. package/apps/studio/client/v2/export/other-formats.jsx +7 -1
  70. package/apps/studio/client/v2/export/sections/batch-model.js +3 -2
  71. package/apps/studio/client/v2/export/sections/batch.jsx +20 -4
  72. package/apps/studio/client/v2/inspector/sections/colour-popover.jsx +4 -0
  73. package/apps/studio/client/v2/inspector/token-chip.jsx +4 -0
  74. package/apps/studio/client/v2/kinds/SizePicker.jsx +4 -0
  75. package/apps/studio/client/v2/presence/faces.jsx +4 -0
  76. package/apps/studio/client/v2/share/role-menu.jsx +7 -1
  77. package/apps/studio/client/v2/share/share-model.js +20 -1
  78. package/apps/studio/client/v2/share/share-sheet.jsx +6 -4
  79. package/apps/studio/client/v2/shell/account-card.jsx +7 -1
  80. package/apps/studio/client/v2/shell/canvas-pointer.js +21 -0
  81. package/apps/studio/client/v2/shell/mode-switch.jsx +4 -0
  82. package/apps/studio/client/v2/shell/project-pill.jsx +4 -0
  83. package/apps/studio/client/v2/shell/save-status.js +10 -1
  84. package/apps/studio/client/v2/shell/share-cluster-host.jsx +2 -0
  85. package/apps/studio/client/v2/shell/share-cluster.jsx +6 -1
  86. package/apps/studio/client/v2/shell/use-dismiss-outside.js +14 -6
  87. package/apps/studio/client/v2/timeline/joins/transition-picker.jsx +7 -1
  88. package/apps/studio/client/v2/undo/undo-history.jsx +7 -1
  89. package/apps/studio/cloud/endpoints.ts +31 -1
  90. package/apps/studio/dist/client.bundle.js +921 -921
  91. package/apps/studio/dist/comment-mount.js +1 -1
  92. package/apps/studio/dist/styles.css +1 -1
  93. package/apps/studio/editing/canvas-pointer.ts +29 -0
  94. package/apps/studio/routes/cloud-move.ts +7 -4
  95. package/apps/studio/sync/ctl-provider.ts +4 -1
  96. package/apps/studio/sync/file-ledger.ts +12 -0
  97. package/apps/studio/sync/file-membership.ts +28 -0
  98. package/apps/studio/sync/file-plane.ts +119 -5
  99. package/apps/studio/sync/index.ts +55 -1
  100. package/apps/studio/sync/journal-client.ts +12 -0
  101. package/apps/studio/sync/poke.ts +30 -0
  102. package/apps/studio/sync/presentation.ts +6 -1
  103. package/apps/studio/sync/projection.ts +7 -0
  104. package/apps/studio/sync/retry-after.ts +27 -0
  105. package/apps/studio/sync/status.ts +9 -1
  106. package/apps/studio/video-play-overlay.tsx +67 -12
  107. package/apps/studio/whats-new.json +78 -6
  108. package/package.json +8 -8
@@ -16,6 +16,7 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } fr
16
16
  import { Kbd, StIcon } from '../../shell/icons.jsx';
17
17
  import { SWITCHER_TRIGGER_TESTID } from '../../panels/RepoBranchSwitcher.jsx';
18
18
  import { reasonProps } from '../access/disabled-reason.js';
19
+ import { onCanvasPointer } from './canvas-pointer.js';
19
20
  import { buildProjectMenu } from './project-menu-model.js';
20
21
 
21
22
  const slug = (s) =>
@@ -264,9 +265,12 @@ export function ProjectPill({
264
265
  const onBlur = () => close(false);
265
266
  document.addEventListener('pointerdown', onDown, true);
266
267
  window.addEventListener('blur', onBlur);
268
+ // rc3 r4-12 — a press in the canvas, told over the dgn bridge (WebKit gives this window no blur for it)
269
+ const offCanvas = onCanvasPointer(onBlur);
267
270
  return () => {
268
271
  document.removeEventListener('pointerdown', onDown, true);
269
272
  window.removeEventListener('blur', onBlur);
273
+ offCanvas();
270
274
  };
271
275
  }, [open, close]);
272
276
 
@@ -48,6 +48,12 @@ export const WORDS = Object.freeze({
48
48
  'not-saved': 'Not saved',
49
49
  });
50
50
 
51
+ /**
52
+ * rc3-i — a cloud tab (a browser on a cell) keeps nothing on a Mac, so its offline word drops the place
53
+ * (the callouts' rule, p8-cell-copy: same words, minus the part that is false there).
54
+ */
55
+ export const OFFLINE_WORD_CLOUD = 'Offline';
56
+
51
57
  export const ACCESS_WORDS = Object.freeze({ view: 'Can view', comment: 'Can comment' });
52
58
 
53
59
  /** A held source conflict's one action (CONTRACT §6): the two versions side by side in Sync details. */
@@ -71,6 +77,7 @@ const count = (n) => (Number.isFinite(n) && n > 0 ? n : 0);
71
77
 
72
78
  /**
73
79
  * @param in.linked a hub / cloud link exists
80
+ * @param in.cloud this shell is a cloud tab (a browser on a cell): no word names a Mac
74
81
  * @param in.online false only when the browser says there is no network
75
82
  * @param in.phase SyncPhase from syncPresentation, or null
76
83
  * @param in.pending edits waiting to leave this Mac
@@ -82,6 +89,7 @@ const count = (n) => (Number.isFinite(n) && n > 0 ? n : 0);
82
89
  export function saveStatus(input) {
83
90
  const {
84
91
  linked = false,
92
+ cloud,
85
93
  online = true,
86
94
  phase = null,
87
95
  pending = 0,
@@ -117,7 +125,8 @@ export function saveStatus(input) {
117
125
  });
118
126
  }
119
127
  if (!linked) return make('local');
120
- if (online === false || OFFLINE_PHASES.has(phase)) return make('offline');
128
+ if (online === false || OFFLINE_PHASES.has(phase))
129
+ return make('offline', cloud ? { word: OFFLINE_WORD_CLOUD } : {});
121
130
  if (SYNCING_PHASES.has(phase) || count(pending) > 0) return make('syncing');
122
131
  return make('saved');
123
132
  }
@@ -162,6 +162,7 @@ export function ShellShareCluster() {
162
162
  useHeldConflictToast({ held, names: conflictNames, onCompare: compare, toast: notify });
163
163
  const status = saveStatus({
164
164
  linked,
165
+ cloud: !!cfg?.cloud,
165
166
  online,
166
167
  phase,
167
168
  pending,
@@ -306,6 +307,7 @@ export function ShellShareCluster() {
306
307
  return (
307
308
  <>
308
309
  <ShareCluster
310
+ cloud={!!cfg?.cloud}
309
311
  accountSlot={
310
312
  chip ? (
311
313
  <AccountChip
@@ -17,10 +17,13 @@ import { ACTIONS_BY_ID } from '../../../actions/index.ts';
17
17
  import { modeCell } from '../../../bridge/mode-shows.ts';
18
18
  import { StIcon } from '../../shell/icons.jsx';
19
19
  import { PresenceFaces } from '../presence/faces.jsx';
20
+ import { INVITES_WAIT_CLOUD } from '../share/share-model.js';
20
21
  import { keyHint } from './project-menu-model.js';
21
22
 
22
23
  /** The words under Share while this Mac is offline — the same sentence the sheet gives a queued invite. */
23
24
  export const OFFLINE_INVITE_TIP = 'Invites send when this Mac is online.';
25
+ /** rc3-i — the same line in a cloud tab, which has no Mac in it. */
26
+ export const OFFLINE_INVITE_TIP_CLOUD = INVITES_WAIT_CLOUD;
24
27
 
25
28
  function Ring({ value }) {
26
29
  return (
@@ -65,6 +68,7 @@ const withKey = (label, def, ctx) => {
65
68
  * (bridge/mode-shows.ts): Preview is `compact`, Viewing `full-access`; `data-cluster` carries it
66
69
  * @param present the Present spec while presenting (Artboards · Canvas are two columns of the table)
67
70
  * @param accountSlot the account chip + card (S1.22a, account-card.jsx) — first, desktop only
71
+ * @param cloud this shell is a cloud tab: no sentence names a Mac (rc3-i)
68
72
  */
69
73
  export function ShareCluster({
70
74
  faces,
@@ -89,6 +93,7 @@ export function ShareCluster({
89
93
  mode = null,
90
94
  present = null,
91
95
  accountSlot = null,
96
+ cloud,
92
97
  }) {
93
98
  const cluster = mode ? modeCell('share-cluster', mode, present) : 'full';
94
99
  const offline = !access && status?.kind === 'offline';
@@ -238,7 +243,7 @@ export function ShareCluster({
238
243
  className="sh-tip"
239
244
  data-testid="share-offline-tip"
240
245
  >
241
- {OFFLINE_INVITE_TIP}
246
+ {cloud ? OFFLINE_INVITE_TIP_CLOUD : OFFLINE_INVITE_TIP}
242
247
  </span>
243
248
  </span>
244
249
  ) : (
@@ -1,20 +1,26 @@
1
1
  // client/v2/shell/use-dismiss-outside.js — "a click anywhere else closes the popover", including the click that
2
2
  // never reaches the shell.
3
3
  //
4
- // Two doors, the pair the project pill already used (shell/project-pill.jsx):
4
+ // Three doors:
5
5
  // · a `pointerdown` in the capture phase anywhere in the shell outside `ref` (capture, so a handler that stops the
6
6
  // event cannot keep the popover open);
7
- // · the shell window's `blur`. Canvases render in an iframe on another origin (DDR-054): a click in one bubbles
8
- // nothing to the shell, but it moves focus into the iframe and so blurs this window. (Switching apps does the
9
- // same — closing then is what a menu does anyway.)
10
- // `onDismiss('outside' | 'blur')` runs; esc and what focus does after are the popover's own.
7
+ // · a press in the canvas (`canvas-pointer.js`). Canvases render in an iframe on another origin (DDR-054): a
8
+ // click in one bubbles nothing to the shell, so the canvas tells the shell over the dgn bridge. This is the
9
+ // door that holds in the packaged app: WebKit does not move focus into the iframe on a press that lands on
10
+ // nothing focusable, so the window blur below never arrives there (rc3 r4-12);
11
+ // · the shell window's `blur` — Chromium's way of saying the same, and switching apps (closing then is what a
12
+ // menu does anyway).
13
+ // `onDismiss('outside' | 'canvas' | 'blur')` runs. None of the doors stops the press: it still reaches what it was
14
+ // aimed at. Esc and what focus does after are the popover's own — an outside dismissal should leave the focus
15
+ // where the click put it.
11
16
 
12
17
  import { useEffect, useRef } from 'react';
18
+ import { onCanvasPointer } from './canvas-pointer.js';
13
19
 
14
20
  /**
15
21
  * @param {boolean} open
16
22
  * @param {{ current: Element | null }} ref the popover; a pointerdown inside it is not a dismissal
17
- * @param {(why: 'outside' | 'blur') => void} onDismiss
23
+ * @param {(why: 'outside' | 'canvas' | 'blur') => void} onDismiss
18
24
  */
19
25
  export function useDismissOutside(open, ref, onDismiss) {
20
26
  const latest = useRef(onDismiss);
@@ -27,9 +33,11 @@ export function useDismissOutside(open, ref, onDismiss) {
27
33
  const onBlur = () => latest.current('blur');
28
34
  document.addEventListener('pointerdown', onDown, true);
29
35
  window.addEventListener('blur', onBlur);
36
+ const offCanvas = onCanvasPointer(() => latest.current('canvas'));
30
37
  return () => {
31
38
  document.removeEventListener('pointerdown', onDown, true);
32
39
  window.removeEventListener('blur', onBlur);
40
+ offCanvas();
33
41
  };
34
42
  }, [open, ref]);
35
43
  }
@@ -22,6 +22,7 @@ import {
22
22
  tileOfPresentation,
23
23
  } from './join-model.js';
24
24
  import { reasonProps } from '../../access/disabled-reason.js';
25
+ import { onCanvasPointer } from '../../shell/canvas-pointer.js';
25
26
 
26
27
  const reducedMotion = () =>
27
28
  typeof window !== 'undefined' &&
@@ -125,7 +126,12 @@ export function TransitionPicker({
125
126
  if (!rootRef.current?.contains(e.target)) onClose?.();
126
127
  };
127
128
  window.addEventListener('pointerdown', onDown, true);
128
- return () => window.removeEventListener('pointerdown', onDown, true);
129
+ // rc3 r4-12 — a press in the canvas closes it too (told over the dgn bridge; it never reaches this document)
130
+ const offCanvas = onCanvasPointer(() => onClose?.());
131
+ return () => {
132
+ window.removeEventListener('pointerdown', onDown, true);
133
+ offCanvas();
134
+ };
129
135
  }, [onClose]);
130
136
 
131
137
  // the slider moves the number on screen; the write waits for the release (a drag would be a write per tick)
@@ -17,6 +17,7 @@ import { useShellStore } from '../../stores/shell-store.jsx';
17
17
  import { useUndoModeLane } from './use-undo-mode-lane.js';
18
18
  import { undoProjection, useUndoProjection } from './use-undo-projection.jsx';
19
19
  import { reasonProps } from '../access/disabled-reason.js';
20
+ import { onCanvasPointer } from '../shell/canvas-pointer.js';
20
21
 
21
22
  /** One open flag for the shell (the menu row opens it; Esc / outside / a click closes it). */
22
23
  function createOpenFlag() {
@@ -237,7 +238,12 @@ export function UndoHistoryHost(p) {
237
238
  if (!e.target?.closest?.('[data-testid="undo-history"]')) undoHistoryOpen.close();
238
239
  };
239
240
  document.addEventListener('pointerdown', onDown, true);
240
- return () => document.removeEventListener('pointerdown', onDown, true);
241
+ // rc3 r4-12 — a press in the canvas closes it too (told over the dgn bridge; it never reaches this document)
242
+ const offCanvas = onCanvasPointer(() => undoHistoryOpen.close());
243
+ return () => {
244
+ document.removeEventListener('pointerdown', onDown, true);
245
+ offCanvas();
246
+ };
241
247
  }, [open]);
242
248
  // biome-ignore lint/correctness/useExhaustiveDependencies: clear the highlight when the popover closes or the canvas changes
243
249
  useEffect(() => {
@@ -29,7 +29,7 @@ import { basename, dirname, join, relative, sep } from 'node:path';
29
29
  import { browserDoorOf } from '../client/v2/cloud/browser-door.js';
30
30
  import { asFormat, formatToKeep } from '../format.ts';
31
31
  import { deleteHubCredential, saveHubCredential } from '../sync/hub-link.ts';
32
- import { getHubToken, normalizeUrl } from '../sync/hubs-config.ts';
32
+ import { getHubRecord, getHubToken, normalizeUrl } from '../sync/hubs-config.ts';
33
33
  import { deleteProjectLink, linksPath, recordProjectLink } from '../sync/link-consent.ts';
34
34
  import { boundCloudToken, cloudConfigPath } from './config-path.ts';
35
35
 
@@ -476,6 +476,25 @@ export function createCloudEndpoints(ctx: Ctx) {
476
476
  });
477
477
  },
478
478
 
479
+ /**
480
+ * Link THIS folder to a cell whose hub credential this Mac already holds — the second half
481
+ * of Move to cloud, after `openManaged` signed in (rc3-j, #162). Same linkedHub + sync start
482
+ * as `attach`, without a second /projects/open + /auth/login (which minted a second hub
483
+ * session for the same person). No stored credential for that cell = signed out.
484
+ */
485
+ async attachStored(hubUrl: string): Promise<CloudEndpointResult> {
486
+ let norm: string;
487
+ try {
488
+ norm = normalizeUrl(String(hubUrl ?? ''));
489
+ } catch {
490
+ return { status: 400, json: { ok: false, error: 'unknown workspace' } };
491
+ }
492
+ if (!getHubRecord(norm, ctx.hubsConfigPath)) {
493
+ return { status: 401, json: { ok: false, error: 'Sign in to Maude Cloud first.' } };
494
+ }
495
+ return linkFolder(norm);
496
+ },
497
+
479
498
  /** The maude:// handoff lane, as a managed copy (see `attachCode`). */
480
499
  async openManagedCode(code: string, claimedProject?: string): Promise<CloudEndpointResult> {
481
500
  if (typeof code !== 'string' || !/^mhc_[0-9a-f]{16,128}$/.test(code)) {
@@ -1002,7 +1021,18 @@ export function createCloudEndpoints(ctx: Ctx) {
1002
1021
 
1003
1022
  const norm = normalizeUrl(workspaceUrl);
1004
1023
  saveHubCredential(norm, hubToken, vouchedRole, hubTokenExpiresAt, ctx.hubsConfigPath);
1024
+ return linkFolder(norm, role, project);
1025
+ }
1005
1026
 
1027
+ /**
1028
+ * The folder half of every attach: linkedHub in config.json, the link recorded on this Mac, the
1029
+ * live sync runtime cycled onto it. The caller has already stored the hub credential for `norm`.
1030
+ */
1031
+ async function linkFolder(
1032
+ norm: string,
1033
+ role?: string,
1034
+ project?: string
1035
+ ): Promise<CloudEndpointResult> {
1006
1036
  // Project side — linkedHub in .design/config.json (committed; no token).
1007
1037
  const cfgPath = join(ctx.paths.designRoot, 'config.json');
1008
1038
  let cfg: Record<string, unknown> = {};