@1agh/maude 2.0.0-rc.2 → 2.0.1
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/studio/acp/login-state.ts +3 -2
- package/apps/studio/actions/defs/chat.ts +4 -1
- package/apps/studio/actions.manifest.json +1 -1
- package/apps/studio/bridge/dgn-protocol.ts +13 -0
- package/apps/studio/canvas-lib.tsx +7 -0
- package/apps/studio/client/export-lane.js +4 -2
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +6 -0
- package/apps/studio/client/panels/ChatPanel.jsx +10 -2
- package/apps/studio/client/panels/acp-runtime.js +14 -0
- package/apps/studio/client/system/system-view.jsx +6 -2
- package/apps/studio/client/tree-row-menu.jsx +4 -0
- package/apps/studio/client/v2/ai/Advanced.jsx +23 -7
- package/apps/studio/client/v2/ai/AttachMenu.jsx +4 -0
- package/apps/studio/client/v2/ai/ChatList.jsx +7 -1
- package/apps/studio/client/v2/ai/ConnectSheet.jsx +75 -4
- package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +42 -8
- package/apps/studio/client/v2/ai/NotReady.jsx +24 -3
- package/apps/studio/client/v2/ai/RunList.jsx +4 -0
- package/apps/studio/client/v2/ai/RunSurface.jsx +14 -4
- package/apps/studio/client/v2/ai/ScopeChip.jsx +4 -0
- package/apps/studio/client/v2/ai/Working.jsx +13 -1
- package/apps/studio/client/v2/ai/activity-line.js +390 -0
- package/apps/studio/client/v2/ai/activity-store.js +45 -0
- package/apps/studio/client/v2/ai/advanced-model.js +62 -12
- package/apps/studio/client/v2/ai/ai-list-advanced.css +7 -0
- package/apps/studio/client/v2/ai/ai-run.css +19 -0
- package/apps/studio/client/v2/ai/ai-send.js +6 -2
- package/apps/studio/client/v2/ai/connect-flow.js +29 -8
- package/apps/studio/client/v2/ai/needs-you.css +18 -0
- package/apps/studio/client/v2/ai/ring-relay.js +11 -1
- package/apps/studio/client/v2/ai/use-activity-line.js +81 -0
- package/apps/studio/client/v2/annotations/templates-panel.jsx +4 -0
- package/apps/studio/client/v2/assets/kinds-chip.jsx +1 -1
- package/apps/studio/client/v2/assets/place-asset.js +20 -1
- package/apps/studio/client/v2/assets/tile-menu.jsx +1 -1
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +5 -1
- package/apps/studio/client/v2/canvases/row-menu.jsx +4 -2
- package/apps/studio/client/v2/ds/review.css +2 -0
- package/apps/studio/client/v2/empty/ai-drafting.jsx +78 -0
- package/apps/studio/client/v2/empty/empty-host.jsx +17 -0
- package/apps/studio/client/v2/empty/empty.css +98 -0
- package/apps/studio/client/v2/export/advanced/render.jsx +5 -2
- package/apps/studio/client/v2/export/export-copy.js +11 -4
- package/apps/studio/client/v2/export/export-sheet.jsx +6 -2
- package/apps/studio/client/v2/export/exports-model.js +13 -0
- package/apps/studio/client/v2/export/exports-panel.jsx +4 -2
- package/apps/studio/client/v2/export/job-row.jsx +4 -0
- package/apps/studio/client/v2/export/other-formats.jsx +7 -1
- package/apps/studio/client/v2/export/sections/batch-model.js +3 -2
- package/apps/studio/client/v2/export/sections/batch.jsx +20 -4
- package/apps/studio/client/v2/inspector/sections/colour-popover.jsx +4 -0
- package/apps/studio/client/v2/inspector/token-chip.jsx +4 -0
- package/apps/studio/client/v2/kinds/SizePicker.jsx +4 -0
- package/apps/studio/client/v2/presence/faces.jsx +4 -0
- package/apps/studio/client/v2/share/role-menu.jsx +7 -1
- package/apps/studio/client/v2/share/share-model.js +20 -1
- package/apps/studio/client/v2/share/share-sheet.jsx +6 -4
- package/apps/studio/client/v2/shell/account-card.jsx +7 -1
- package/apps/studio/client/v2/shell/canvas-pointer.js +21 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +4 -0
- package/apps/studio/client/v2/shell/project-pill.jsx +4 -0
- package/apps/studio/client/v2/shell/save-status.js +10 -1
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +2 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +6 -1
- package/apps/studio/client/v2/shell/use-dismiss-outside.js +14 -6
- package/apps/studio/client/v2/timeline/joins/transition-picker.jsx +7 -1
- package/apps/studio/client/v2/undo/undo-history.jsx +7 -1
- package/apps/studio/cloud/endpoints.ts +31 -1
- package/apps/studio/dist/client.bundle.js +921 -921
- package/apps/studio/dist/comment-mount.js +1 -1
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/editing/canvas-pointer.ts +29 -0
- package/apps/studio/routes/cloud-move.ts +7 -4
- package/apps/studio/video-play-overlay.tsx +67 -12
- package/apps/studio/whats-new.json +43 -16
- package/package.json +8 -8
|
@@ -122,7 +122,8 @@ exit 1
|
|
|
122
122
|
|
|
123
123
|
type InstallState =
|
|
124
124
|
| { phase: 'idle' }
|
|
125
|
-
|
|
125
|
+
// `startedAt` (ms): the sheet shows the elapsed time from it, also when it joins a running install (rc3-f)
|
|
126
|
+
| { phase: 'running'; startedAt: number }
|
|
126
127
|
| { phase: 'done'; ok: boolean; reason?: string };
|
|
127
128
|
|
|
128
129
|
let installState: InstallState = { phase: 'idle' };
|
|
@@ -189,8 +190,8 @@ export function startInstall(): { ok: boolean; reason?: string } {
|
|
|
189
190
|
if (refused) return { ok: false, reason: refused };
|
|
190
191
|
if (installState.phase === 'running')
|
|
191
192
|
return { ok: false, reason: 'An install is already in progress.' };
|
|
192
|
-
installState = { phase: 'running' };
|
|
193
193
|
const startedAt = Date.now();
|
|
194
|
+
installState = { phase: 'running', startedAt };
|
|
194
195
|
(async () => {
|
|
195
196
|
try {
|
|
196
197
|
let code: number;
|
|
@@ -101,7 +101,10 @@ export const CHAT_ACTIONS: ActionDef[] = [
|
|
|
101
101
|
// S5.12 — the rows of the AI chat panel's Advanced fold, findable by name in ⌘K ("AI chat panel ›
|
|
102
102
|
// Advanced"). Picking one opens the panel and the fold and takes that row (client/v2/ai/advanced-handlers.js).
|
|
103
103
|
// They change nothing by themselves — each is "go to that setting" — so none has a key or a menu home.
|
|
104
|
-
|
|
104
|
+
// rc3-g (issue #181 C): the row is called Permissions — "Ask before: Suggest only" read backwards. "Ask before"
|
|
105
|
+
// stays a search word so the old name still finds it.
|
|
106
|
+
advanced('ask-before', 'Permissions', [
|
|
107
|
+
'ask before',
|
|
105
108
|
'mode',
|
|
106
109
|
'permission',
|
|
107
110
|
'plan',
|
|
@@ -337,6 +337,12 @@ export interface CanvasToShell {
|
|
|
337
337
|
* the video the timeline follows (07 · ve-play). Carries nothing; a hold or a pan sends nothing at all.
|
|
338
338
|
*/
|
|
339
339
|
'space-tap': Empty;
|
|
340
|
+
/**
|
|
341
|
+
* rc3 r4-12 — a press landed in this canvas (editing/canvas-pointer.ts). The shell's open menus close on it: a
|
|
342
|
+
* press in the iframe never reaches the shell document, and WebKit does not blur the shell window for it. Carries
|
|
343
|
+
* nothing; the press itself goes on to do what it does in the canvas.
|
|
344
|
+
*/
|
|
345
|
+
'canvas-pointerdown': Empty;
|
|
340
346
|
/**
|
|
341
347
|
* S7.17 (07 · ve-together) — the teammates whose timeline is open, from this canvas's awareness (already through
|
|
342
348
|
* `sanitizeForeignState`): where each playhead is (`artboardId`, `frame`) and the caption word each is fixing
|
|
@@ -1759,6 +1765,13 @@ const c2s: C2S = {
|
|
|
1759
1765
|
owner: 'v2/timeline (S7.8)',
|
|
1760
1766
|
parse: none,
|
|
1761
1767
|
},
|
|
1768
|
+
// rc3 r4-12 — a press in the canvas closes the shell's open menus (client/v2/shell/canvas-pointer.js).
|
|
1769
|
+
'canvas-pointerdown': {
|
|
1770
|
+
gate: 'active',
|
|
1771
|
+
status: 'live',
|
|
1772
|
+
owner: 'v2/shell dismiss-outside (rc3 r4-12)',
|
|
1773
|
+
parse: none,
|
|
1774
|
+
},
|
|
1762
1775
|
// S7.17 — teammates' playheads + caption words for the timeline island (collab/timeline-presence → v2/timeline/peers).
|
|
1763
1776
|
'timeline-peers': {
|
|
1764
1777
|
gate: 'active',
|
|
@@ -169,6 +169,7 @@ import {
|
|
|
169
169
|
type DragFrame,
|
|
170
170
|
type LayoutRect,
|
|
171
171
|
} from './drag-bus.ts';
|
|
172
|
+
import { installCanvasPointerNotice } from './editing/canvas-pointer.ts';
|
|
172
173
|
import { routeDrop } from './editing/duplicate-rhythm.ts';
|
|
173
174
|
import { growCh, nextRenameId, RENAME_EVENT, requestRename } from './editing/rename-order.ts';
|
|
174
175
|
import { createSpaceTap, sendSpaceTap } from './editing/space-tap.ts';
|
|
@@ -2370,6 +2371,12 @@ function DesignCanvasInner({ children, controls }: DesignCanvasProps) {
|
|
|
2370
2371
|
setArtboards(initialArtboards());
|
|
2371
2372
|
}, [initialArtboards]);
|
|
2372
2373
|
|
|
2374
|
+
// rc3 r4-12 — every press here tells the shell, so its open menus close (WebKit gives the shell no blur for it)
|
|
2375
|
+
useEffect(
|
|
2376
|
+
() => (typeof window === 'undefined' ? undefined : installCanvasPointerNotice(window)),
|
|
2377
|
+
[]
|
|
2378
|
+
);
|
|
2379
|
+
|
|
2373
2380
|
// Phase 8 — foreign canvas-meta change. The shell-level HMR client
|
|
2374
2381
|
// re-fetches `<canvas>.meta.json` and dispatches `maude:meta-refreshed`
|
|
2375
2382
|
// when *another* tab PATCHed the layout (drag, distribute, align). We
|
|
@@ -75,7 +75,7 @@ function thisMacSub(online, seconds) {
|
|
|
75
75
|
/**
|
|
76
76
|
* The Render row for one sheet.
|
|
77
77
|
* @param {{ pref?: string, render?: { cloud: boolean, suggest: string, why: string|null } | null,
|
|
78
|
-
* online?: boolean, picked?: string|null, seconds?: number|null }} o
|
|
78
|
+
* online?: boolean, picked?: string|null, seconds?: number|null, workspace?: boolean }} o
|
|
79
79
|
* `render` = the estimate's block; `picked` = what the person clicked in this sheet (wins);
|
|
80
80
|
* `seconds` = the estimate's this-Mac time (the option says it when known).
|
|
81
81
|
* @returns {{ show: boolean, lane: 'cloud'|'this-mac', suggested: boolean, why: string|null,
|
|
@@ -87,8 +87,10 @@ export function renderChoice({
|
|
|
87
87
|
online = true,
|
|
88
88
|
picked = null,
|
|
89
89
|
seconds = null,
|
|
90
|
+
workspace = false,
|
|
90
91
|
} = {}) {
|
|
91
|
-
|
|
92
|
+
// rc3-i — "cloud or this Mac" is the desktop's question; a cloud tab (a cell) has no Mac to pick
|
|
93
|
+
const show = !!render?.cloud && !workspace;
|
|
92
94
|
if (!show) return { show: false, lane: 'this-mac', suggested: false, why: null, options: [] };
|
|
93
95
|
let lane;
|
|
94
96
|
let suggested = false;
|
|
@@ -18,6 +18,7 @@ import { layersTreeSig, shellToast } from '../shell/util.js';
|
|
|
18
18
|
// S7.21 — the toast after the inspector's "Add a width" (08 ak-web-widths) and the video artboard's length
|
|
19
19
|
import { settleDuplicateAtWidth } from '../v2/create/duplicate-done.js';
|
|
20
20
|
import { menuRunner } from '../v2/shell/menu-runner.js';
|
|
21
|
+
import { announceCanvasPointer } from '../v2/shell/canvas-pointer.js';
|
|
21
22
|
import { panelLayout } from '../v2/shell/use-panel-layout.js';
|
|
22
23
|
|
|
23
24
|
// 01 cf-duplicate-done / 08 ak-web-widths: a copy made is told with the copy glyph, not a success tick
|
|
@@ -234,6 +235,11 @@ export function useCanvasBridge({
|
|
|
234
235
|
: null;
|
|
235
236
|
if (!activeWin || e.source !== activeWin) return;
|
|
236
237
|
}
|
|
238
|
+
// rc3 r4-12 — a press in the active canvas: the shell's open menus close on it (use-dismiss-outside.js)
|
|
239
|
+
if (m.dgn === 'canvas-pointerdown') {
|
|
240
|
+
announceCanvasPointer();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
237
243
|
// S9.22b — the overlay's comment door + mention people (comment-bridge.js). Accepted only from the
|
|
238
244
|
// active canvas's own window and only once the dgn table's parser has cleaned it; the answer goes
|
|
239
245
|
// back to that window alone. An `add` is pinned to `activePath` inside the handler.
|
|
@@ -602,8 +602,16 @@ export default function ChatPanel({
|
|
|
602
602
|
() =>
|
|
603
603
|
fetch('/_api/acp/status')
|
|
604
604
|
.then((r) => r.json())
|
|
605
|
-
.then((d) =>
|
|
606
|
-
|
|
605
|
+
.then((d) => {
|
|
606
|
+
const next = { available: d.available, reason: d.reason };
|
|
607
|
+
setStatus(next);
|
|
608
|
+
return next; // rc3-f: the Connect sheet reads it — a setup that leaves AI unable to start says so
|
|
609
|
+
})
|
|
610
|
+
.catch(() => {
|
|
611
|
+
const next = { available: false, reason: 'Could not reach the Claude bridge.' };
|
|
612
|
+
setStatus(next);
|
|
613
|
+
return next;
|
|
614
|
+
}),
|
|
607
615
|
[]
|
|
608
616
|
);
|
|
609
617
|
useEffect(() => {
|
|
@@ -224,6 +224,13 @@ export function createAcpConnection() {
|
|
|
224
224
|
if (reduceActivity(activeTools, frame)) emitActivity();
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
// rc3-h (#182) — every turn frame (`update` / `turn-end` / `error`), for the one activity line that says what
|
|
228
|
+
// AI is doing now (v2/ai/activity-line.js). Not turn content: the line reads the stream, it renders none of it.
|
|
229
|
+
const turnFrameListeners = new Set();
|
|
230
|
+
function emitTurnFrame(frame) {
|
|
231
|
+
for (const fn of turnFrameListeners) fn(frame);
|
|
232
|
+
}
|
|
233
|
+
|
|
227
234
|
// Post-turn-end continuation — the ACP adapter settles the prompt at the main
|
|
228
235
|
// agent's `result` (claude-agent-acp #773) but KEEPS streaming background work
|
|
229
236
|
// (subagent results, the consolidation) afterward. Those frames arrive with no
|
|
@@ -406,6 +413,7 @@ export function createAcpConnection() {
|
|
|
406
413
|
}
|
|
407
414
|
// Everything else belongs to the active prompt turn.
|
|
408
415
|
trackActivity(frame);
|
|
416
|
+
emitTurnFrame(frame);
|
|
409
417
|
if (turnHandler) turnHandler(frame);
|
|
410
418
|
else if (frame.t === 'update') {
|
|
411
419
|
// No active turn, but the adapter is still streaming (the post-settle
|
|
@@ -473,6 +481,12 @@ export function createAcpConnection() {
|
|
|
473
481
|
return () => activityListeners.delete(fn);
|
|
474
482
|
},
|
|
475
483
|
|
|
484
|
+
/** rc3-h — each turn frame as it comes (no replay: a line that joins late starts from the next event). */
|
|
485
|
+
onTurnFrame(fn) {
|
|
486
|
+
turnFrameListeners.add(fn);
|
|
487
|
+
return () => turnFrameListeners.delete(fn);
|
|
488
|
+
},
|
|
489
|
+
|
|
476
490
|
/** Subscribe to the post-turn-end continuation parts; replays the current tail. */
|
|
477
491
|
onBackground(fn) {
|
|
478
492
|
backgroundListeners.add(fn);
|
|
@@ -183,9 +183,13 @@ export function SystemView({ data, onOpen, cfg, onSelectDs }) {
|
|
|
183
183
|
if (noSystem) {
|
|
184
184
|
return (
|
|
185
185
|
<div className="sv">
|
|
186
|
+
{/* rc3 r4-7 walk — the product's own word for the view (CONTRACT §7 "called 'Design system' in UI copy"); the
|
|
187
|
+
MAUDE-DSN/01 code and "design system view" were the specimen board's labels and read as a leak here.
|
|
188
|
+
The code stays where 06 · ad-ds keeps it: the Advanced view of a system that exists. */}
|
|
186
189
|
<header className="sv-header">
|
|
187
|
-
<
|
|
188
|
-
|
|
190
|
+
<h1 className="sv-title" data-testid="sv-no-system-heading">
|
|
191
|
+
Design system
|
|
192
|
+
</h1>
|
|
189
193
|
</header>
|
|
190
194
|
<div className="sv-empty sv-no-system" data-testid="sv-no-system">
|
|
191
195
|
<div>
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// arbitrary row, not the menubar's fixed offset.
|
|
11
11
|
|
|
12
12
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
13
|
+
import { onCanvasPointer } from './v2/shell/canvas-pointer.js';
|
|
13
14
|
|
|
14
15
|
const EDGE = 8;
|
|
15
16
|
|
|
@@ -117,9 +118,12 @@ export function TreeRowMenu({ state, onClose, rootItems, destinations, onPickDes
|
|
|
117
118
|
};
|
|
118
119
|
document.addEventListener('pointerdown', onDocPointer, true);
|
|
119
120
|
document.addEventListener('keydown', onKey, true);
|
|
121
|
+
// rc3 r4-12 — a press in the canvas closes it too (told over the dgn bridge; it never reaches this document)
|
|
122
|
+
const offCanvas = onCanvasPointer(() => onClose());
|
|
120
123
|
return () => {
|
|
121
124
|
document.removeEventListener('pointerdown', onDocPointer, true);
|
|
122
125
|
document.removeEventListener('keydown', onKey, true);
|
|
126
|
+
offCanvas();
|
|
123
127
|
};
|
|
124
128
|
}, [state, onClose]);
|
|
125
129
|
|
|
@@ -40,14 +40,23 @@ import { canOpenInTerminal, openChatInTerminal } from './chat-store-api.js';
|
|
|
40
40
|
import { ChatFootInfo } from './Composer.jsx';
|
|
41
41
|
import { ConnectedRawLog } from './RawLog.jsx';
|
|
42
42
|
|
|
43
|
-
function Row({ row, label, children, hint }) {
|
|
43
|
+
function Row({ row, label, children, hint, hintRisky, hintTestId }) {
|
|
44
44
|
return (
|
|
45
45
|
<div className="ai-adv-row" data-adv-row={row}>
|
|
46
46
|
<label className="ai-adv-k" htmlFor={rowDomId(row)}>
|
|
47
47
|
{label}
|
|
48
48
|
</label>
|
|
49
49
|
{children}
|
|
50
|
-
{hint ?
|
|
50
|
+
{hint ? (
|
|
51
|
+
<span
|
|
52
|
+
className="ai-adv-hint"
|
|
53
|
+
id={`${rowDomId(row)}-hint`}
|
|
54
|
+
data-testid={hintTestId}
|
|
55
|
+
data-risky={hintRisky ? '' : undefined}
|
|
56
|
+
>
|
|
57
|
+
{hint}
|
|
58
|
+
</span>
|
|
59
|
+
) : null}
|
|
51
60
|
</div>
|
|
52
61
|
);
|
|
53
62
|
}
|
|
@@ -253,6 +262,7 @@ export function ChatAdvanced({
|
|
|
253
262
|
const parsed = caps?.parsedOptions ?? { model: null, effort: null, fast: null, others: [] };
|
|
254
263
|
const modes = caps?.modes ?? null;
|
|
255
264
|
const modeList = modeOptions(modes);
|
|
265
|
+
const currentMode = modeList.find((m) => m.id === modes?.currentModeId);
|
|
256
266
|
// "Change canvases" is the ask-before mode seen as a switch: the "AI changes nothing" modes are off.
|
|
257
267
|
const changesNothing = modeList.find((m) => m.id === modes?.currentModeId)?.group === 'nochange';
|
|
258
268
|
const askingMode = modeList.find((m) => m.group === 'asks')?.id ?? modes?.currentModeId;
|
|
@@ -406,23 +416,29 @@ export function ChatAdvanced({
|
|
|
406
416
|
<OptionSwitch row="fast" label="Fast mode" opt={parsed.fast} onChange={onSetConfig} />
|
|
407
417
|
) : null}
|
|
408
418
|
{modeList.length ? (
|
|
409
|
-
<Row
|
|
419
|
+
<Row
|
|
420
|
+
row="ask-before"
|
|
421
|
+
label="Permissions"
|
|
422
|
+
hint={currentMode?.hint}
|
|
423
|
+
hintRisky={currentMode?.risky}
|
|
424
|
+
hintTestId="chat-mode-hint"
|
|
425
|
+
>
|
|
410
426
|
<select
|
|
411
427
|
id={rowDomId('ask-before')}
|
|
412
428
|
className="ai-adv-select"
|
|
413
429
|
data-adv-control
|
|
414
430
|
data-testid="chat-mode-picker"
|
|
431
|
+
data-risky={currentMode?.risky ? '' : undefined}
|
|
415
432
|
value={modes?.currentModeId ?? ''}
|
|
416
|
-
title={
|
|
417
|
-
|
|
418
|
-
}
|
|
433
|
+
title={currentMode?.hint || currentMode?.description || 'Permissions'}
|
|
434
|
+
aria-describedby={currentMode?.hint ? `${rowDomId('ask-before')}-hint` : undefined}
|
|
419
435
|
onChange={(e) => onSetMode(e.target.value)}
|
|
420
436
|
>
|
|
421
437
|
{['asks', 'nochange', 'free'].map((g) => {
|
|
422
438
|
const list = modeList.filter((m) => m.group === g);
|
|
423
439
|
if (!list.length) return null;
|
|
424
440
|
const options = list.map((m) => (
|
|
425
|
-
<option key={m.id} value={m.id}>
|
|
441
|
+
<option key={m.id} value={m.id} title={m.hint || undefined}>
|
|
426
442
|
{m.label}
|
|
427
443
|
</option>
|
|
428
444
|
));
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
10
10
|
import { Clip, FileGlyph, FolderGlyph, ImageGlyph } from './AChip.jsx';
|
|
11
|
+
import { onCanvasPointer } from '../shell/canvas-pointer.js';
|
|
11
12
|
|
|
12
13
|
/** Asks the shell to open the Assets tab (app.jsx listens; lead patch). */
|
|
13
14
|
export const OPEN_ASSETS_EVENT = 'maude:ai-attach-assets';
|
|
@@ -85,12 +86,15 @@ export function AttachMenu({ attach, disabled = false }) {
|
|
|
85
86
|
};
|
|
86
87
|
document.addEventListener('pointerdown', onDown);
|
|
87
88
|
document.addEventListener('keydown', onKey, true);
|
|
89
|
+
// rc3 r4-12 — a press in the canvas closes it too (told over the dgn bridge; it never reaches this document)
|
|
90
|
+
const offCanvas = onCanvasPointer(() => close(false));
|
|
88
91
|
rootRef.current
|
|
89
92
|
?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')
|
|
90
93
|
?.focus({ preventScroll: true });
|
|
91
94
|
return () => {
|
|
92
95
|
document.removeEventListener('pointerdown', onDown);
|
|
93
96
|
document.removeEventListener('keydown', onKey, true);
|
|
97
|
+
offCanvas();
|
|
94
98
|
};
|
|
95
99
|
}, [open, close]);
|
|
96
100
|
|
|
@@ -29,6 +29,7 @@ import { useChatUndoReady, useUndoChat } from './ChatUndo.jsx';
|
|
|
29
29
|
import { fetchChats, searchChats, trashChat } from './chat-store-api.js';
|
|
30
30
|
import { Spark } from './icons.jsx';
|
|
31
31
|
import { RunIcon } from './RunList.jsx';
|
|
32
|
+
import { onCanvasPointer } from '../shell/canvas-pointer.js';
|
|
32
33
|
|
|
33
34
|
const SEARCH_DEBOUNCE_MS = 150;
|
|
34
35
|
|
|
@@ -69,7 +70,12 @@ function RowMenu({ items, anchorRef, onPick, onClose }) {
|
|
|
69
70
|
if (!ref.current?.contains(e.target) && !anchorRef.current?.contains(e.target)) onClose();
|
|
70
71
|
};
|
|
71
72
|
document.addEventListener('pointerdown', onDown);
|
|
72
|
-
|
|
73
|
+
// rc3 r4-12 — a press in the canvas closes it too (told over the dgn bridge; it never reaches this document)
|
|
74
|
+
const offCanvas = onCanvasPointer(() => onClose());
|
|
75
|
+
return () => {
|
|
76
|
+
document.removeEventListener('pointerdown', onDown);
|
|
77
|
+
offCanvas();
|
|
78
|
+
};
|
|
73
79
|
}, [anchorRef, onClose]);
|
|
74
80
|
const onKeyDown = (e) => {
|
|
75
81
|
if (e.key === 'Escape') {
|
|
@@ -3,22 +3,77 @@
|
|
|
3
3
|
// is connected. Exported for S6 (the first-canvas drafting flow) and for 02 `ob-ai-connect`: it is a controlled
|
|
4
4
|
// view — the caller owns what Connect does (the panel runs `connectClaude`; onboarding may do the same).
|
|
5
5
|
//
|
|
6
|
-
// <ConnectSheet inline width phase="idle|installing|waiting" error onConnect onCancel>{advanced}</ConnectSheet>
|
|
6
|
+
// <ConnectSheet inline width phase="idle|checking|installing|waiting" startedAt error onConnect onCancel>{advanced}</ConnectSheet>
|
|
7
|
+
//
|
|
8
|
+
// rc3-f (issue #181): while it works the sheet SAYS what runs — a live status line with the step, the elapsed time
|
|
9
|
+
// of the install and how long it usually takes, and what comes next — never just a disabled button. After a
|
|
10
|
+
// failure the button is "Try again" and runs the whole setup again.
|
|
7
11
|
//
|
|
8
12
|
// `inline` draws it in flow (inside the panel); otherwise it is a window sheet (the caller puts a Veil under
|
|
9
13
|
// it). Words are CONTRACT §7: "Connect your Claude account to let AI draft this." → Connect · Cancel.
|
|
10
14
|
|
|
11
|
-
import { useId, useRef } from 'react';
|
|
15
|
+
import { useEffect, useId, useRef, useState } from 'react';
|
|
12
16
|
import { portalToBody } from '../portal-scope.jsx';
|
|
13
17
|
import { useModalFocus } from '../shell/modal-focus.js';
|
|
14
18
|
import { Spark } from './icons.jsx';
|
|
15
19
|
|
|
16
20
|
const CONNECT_LABEL = {
|
|
17
21
|
idle: 'Connect',
|
|
18
|
-
|
|
22
|
+
checking: 'Checking Claude Code…',
|
|
23
|
+
installing: 'Installing Claude Code…',
|
|
19
24
|
waiting: 'Waiting for your browser…',
|
|
20
25
|
};
|
|
21
26
|
|
|
27
|
+
/** The button after a failure: the same whole setup, again. */
|
|
28
|
+
export const TRY_AGAIN = 'Try again';
|
|
29
|
+
|
|
30
|
+
/** 42_000 → "0:42", 125_000 → "2:05". */
|
|
31
|
+
export function elapsedClock(ms) {
|
|
32
|
+
const s = Math.max(0, Math.floor((Number.isFinite(ms) ? ms : 0) / 1000));
|
|
33
|
+
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* What the setup is doing now, in the sheet's status line: the lead, the rest, the step.
|
|
38
|
+
* @param {string} phase
|
|
39
|
+
* @param {number} elapsedMs the install's time so far (only 'installing' shows it)
|
|
40
|
+
*/
|
|
41
|
+
export function setupProgressWords(phase, elapsedMs = 0) {
|
|
42
|
+
if (phase === 'checking')
|
|
43
|
+
return { lead: 'Checking Claude Code on this Mac…', rest: 'This takes a few seconds.' };
|
|
44
|
+
if (phase === 'installing')
|
|
45
|
+
return {
|
|
46
|
+
lead: `Installing Claude Code… ${elapsedClock(elapsedMs)}`,
|
|
47
|
+
rest: 'Usually 1–2 minutes. Then your browser opens to sign in.',
|
|
48
|
+
step: 'Step 1 of 2',
|
|
49
|
+
};
|
|
50
|
+
if (phase === 'waiting')
|
|
51
|
+
return {
|
|
52
|
+
lead: 'Sign in through your browser.',
|
|
53
|
+
rest: "AI is ready as soon as you're signed in.",
|
|
54
|
+
step: 'Step 2 of 2',
|
|
55
|
+
};
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The elapsed time of an install, ticking once a second while it runs. Without a start from the caller the
|
|
60
|
+
* sheet's own clock starts when the install phase begins. */
|
|
61
|
+
function useElapsed(phase, startedAt, now) {
|
|
62
|
+
const own = useRef(null);
|
|
63
|
+
const [, tick] = useState(0);
|
|
64
|
+
const installing = phase === 'installing';
|
|
65
|
+
if (!installing) own.current = null;
|
|
66
|
+
else if (own.current === null) own.current = now();
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!installing) return undefined;
|
|
69
|
+
const timer = setInterval(() => tick((n) => n + 1), 1000);
|
|
70
|
+
return () => clearInterval(timer);
|
|
71
|
+
}, [installing]);
|
|
72
|
+
if (!installing) return 0;
|
|
73
|
+
const from = Number.isFinite(startedAt) ? startedAt : own.current;
|
|
74
|
+
return now() - from;
|
|
75
|
+
}
|
|
76
|
+
|
|
22
77
|
export function ConnectSheet({
|
|
23
78
|
width = 440,
|
|
24
79
|
inline = false,
|
|
@@ -27,6 +82,9 @@ export function ConnectSheet({
|
|
|
27
82
|
onConnect,
|
|
28
83
|
onCancel,
|
|
29
84
|
connectRef,
|
|
85
|
+
// rc3-f: when the install began (ms, the server's clock) — a sheet that joins a running install shows its real time
|
|
86
|
+
startedAt = null,
|
|
87
|
+
now = Date.now,
|
|
30
88
|
// S6.9 (02 ob-adv-sheets): Home's "Connect AI" reads "Connect AI" and carries no "your prompt waits"
|
|
31
89
|
// line (there is no prompt yet). The defaults are CONTRACT §7's words, unchanged for every other caller.
|
|
32
90
|
title = 'Connect your Claude account?',
|
|
@@ -38,6 +96,7 @@ export function ConnectSheet({
|
|
|
38
96
|
}) {
|
|
39
97
|
const titleId = useId();
|
|
40
98
|
const busy = phase !== 'idle';
|
|
99
|
+
const progress = setupProgressWords(phase, useElapsed(phase, startedAt, now));
|
|
41
100
|
return (
|
|
42
101
|
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-modal is set only while role is "dialog" (inline, the sheet is a group and carries none)
|
|
43
102
|
<div
|
|
@@ -66,6 +125,18 @@ export function ConnectSheet({
|
|
|
66
125
|
</span>
|
|
67
126
|
) : null}
|
|
68
127
|
{children}
|
|
128
|
+
{progress ? (
|
|
129
|
+
<p
|
|
130
|
+
className="ai-conn-prog"
|
|
131
|
+
role="status"
|
|
132
|
+
aria-live="polite"
|
|
133
|
+
data-testid="ai-connect-progress"
|
|
134
|
+
data-phase={phase}
|
|
135
|
+
>
|
|
136
|
+
{progress.step ? <span className="ai-conn-step">{progress.step}</span> : null}
|
|
137
|
+
<strong>{progress.lead}</strong> {progress.rest}
|
|
138
|
+
</p>
|
|
139
|
+
) : null}
|
|
69
140
|
{error ? (
|
|
70
141
|
<p className="ai-conn-err" role="alert" data-testid="ai-connect-error">
|
|
71
142
|
{error}
|
|
@@ -90,7 +161,7 @@ export function ConnectSheet({
|
|
|
90
161
|
data-testid="ai-connect-go"
|
|
91
162
|
onClick={onConnect}
|
|
92
163
|
>
|
|
93
|
-
{CONNECT_LABEL[phase] ?? CONNECT_LABEL.idle}
|
|
164
|
+
{!busy && error ? TRY_AGAIN : (CONNECT_LABEL[phase] ?? CONNECT_LABEL.idle)}
|
|
94
165
|
</button>
|
|
95
166
|
</div>
|
|
96
167
|
</div>
|
|
@@ -15,7 +15,7 @@ import ChoiceCard from './ChoiceCard.jsx';
|
|
|
15
15
|
import { ConnectModal } from './ConnectSheet.jsx';
|
|
16
16
|
import { connectClaude } from './connect-flow.js';
|
|
17
17
|
import { ErrorCard } from './Feed.jsx';
|
|
18
|
-
import { queuedForChat } from './gate-lines.js';
|
|
18
|
+
import { notReadyModel, queuedForChat } from './gate-lines.js';
|
|
19
19
|
import { choiceModel, needsYouLine, permissionModel, willChangeFor } from './needs-you.js';
|
|
20
20
|
import { setLocalNeedsYou } from './needs-you-store.js';
|
|
21
21
|
import { needsYouNotice, openAiChat } from './needs-you-toast.js';
|
|
@@ -110,6 +110,8 @@ export default function NeedsYouSlot({
|
|
|
110
110
|
onRetry,
|
|
111
111
|
onConnected,
|
|
112
112
|
designRel = '',
|
|
113
|
+
// test seam: `connectClaude`'s sleep / now / fetchImpl
|
|
114
|
+
connectDeps = null,
|
|
113
115
|
}) {
|
|
114
116
|
const { queued, refresh } = useQueuedPrompts(conn, chatId);
|
|
115
117
|
// S5.17b G7 — the failure card says "Nothing changed" only when this chat's run touched nothing; no run seen = not claimed
|
|
@@ -147,24 +149,55 @@ export default function NeedsYouSlot({
|
|
|
147
149
|
useWaitingQuestions({ conn, chatId, away, requests });
|
|
148
150
|
|
|
149
151
|
// ── Connect (the one sheet, only for the `ai-connected` gate) ──
|
|
152
|
+
// rc3-f (issue #181): the sheet and the chat line say what the setup is doing ('checking' · 'installing' with
|
|
153
|
+
// its start time · 'waiting' for the browser); a click during an install joins it (connect-flow.js); an install
|
|
154
|
+
// already running when this chat opens is shown at once and goes on to the sign-in by itself; a failure says
|
|
155
|
+
// why and the button is Try again; a setup that ends but leaves AI unable to start says so too.
|
|
150
156
|
const [phase, setPhase] = useState('idle');
|
|
157
|
+
const [startedAt, setStartedAt] = useState(null);
|
|
151
158
|
const [connectError, setConnectError] = useState(null);
|
|
152
159
|
const abortRef = useRef(null);
|
|
153
160
|
useEffect(() => () => abortRef.current?.abort(), []);
|
|
154
161
|
const connect = useCallback(async () => {
|
|
162
|
+
if (abortRef.current) return; // one setup at a time: the running one is already on screen
|
|
155
163
|
const ctl = new AbortController();
|
|
156
164
|
abortRef.current = ctl;
|
|
157
165
|
setConnectError(null);
|
|
158
|
-
setPhase('
|
|
159
|
-
const r = await connectClaude({
|
|
160
|
-
|
|
166
|
+
setPhase('checking');
|
|
167
|
+
const r = await connectClaude({
|
|
168
|
+
...(connectDeps ?? {}),
|
|
169
|
+
signal: ctl.signal,
|
|
170
|
+
onPhase: (p, info) => {
|
|
171
|
+
if (p === 'installing') setStartedAt(info?.startedAt ?? null);
|
|
172
|
+
setPhase(p);
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
if (abortRef.current === ctl) abortRef.current = null;
|
|
161
176
|
setPhase('idle');
|
|
162
177
|
if (r.ok) {
|
|
163
|
-
|
|
164
|
-
|
|
178
|
+
// Look again so the panel unlocks in place; the drain sends the kept prompt by itself once the gate opens.
|
|
179
|
+
const now = await Promise.resolve(onConnected?.()).catch(() => null);
|
|
180
|
+
if (now && now.available === false)
|
|
181
|
+
setConnectError(now.reason || 'Claude is connected, but AI could not start. Try again.');
|
|
165
182
|
setTimeout(refresh, 1500);
|
|
166
183
|
} else if (r.reason !== 'cancelled') setConnectError(r.reason);
|
|
167
|
-
}, [onConnected, refresh]);
|
|
184
|
+
}, [onConnected, refresh, connectDeps]);
|
|
185
|
+
|
|
186
|
+
// An install that is already running (an earlier click, a closed sheet, another window) is shown, not hidden
|
|
187
|
+
// behind an idle Connect: look once when a prompt starts waiting for Claude, and join it.
|
|
188
|
+
const waitsForClaude = queued.length > 0 && notReadyModel(queued[0]).kind === 'connect';
|
|
189
|
+
const looked = useRef(false);
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
if (!waitsForClaude || looked.current) return;
|
|
192
|
+
looked.current = true;
|
|
193
|
+
const f = connectDeps?.fetchImpl ?? ((...a) => fetch(...a));
|
|
194
|
+
f('/_api/claude/install-status')
|
|
195
|
+
.then((res) => res.json())
|
|
196
|
+
.then((state) => {
|
|
197
|
+
if (state?.phase === 'running') connect();
|
|
198
|
+
})
|
|
199
|
+
.catch(() => {});
|
|
200
|
+
}, [waitsForClaude, connect, connectDeps]);
|
|
168
201
|
const cancelConnect = useCallback(async () => {
|
|
169
202
|
if (abortRef.current) {
|
|
170
203
|
abortRef.current.abort();
|
|
@@ -236,9 +269,10 @@ export default function NeedsYouSlot({
|
|
|
236
269
|
<ErrorCard error={turnError} onRetry={onRetry} changed={changed} />
|
|
237
270
|
)}
|
|
238
271
|
{queued.length > 0 ? (
|
|
239
|
-
<QueuedState queued={queued[0]} count={queued.length}>
|
|
272
|
+
<QueuedState queued={queued[0]} count={queued.length} connectPhase={phase}>
|
|
240
273
|
<ConnectModal
|
|
241
274
|
phase={phase}
|
|
275
|
+
startedAt={startedAt}
|
|
242
276
|
error={connectError}
|
|
243
277
|
onConnect={connect}
|
|
244
278
|
onCancel={cancelConnect}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// the line for it and nothing else. The rest of the app keeps working.
|
|
4
4
|
//
|
|
5
5
|
// offline "Queued — sends when this Mac is online." + "AI is back when this Mac is online."
|
|
6
|
-
// connect the ConnectSheet (ask once; the
|
|
6
|
+
// connect "Waiting for Claude to be connected. …" + the ConnectSheet (ask once; the prompt runs when connected)
|
|
7
7
|
// setting-up "Setting up AI on this Mac. About a minute — keep drawing meanwhile."
|
|
8
8
|
// used-up "AI's allowance is used up until 18:40. Your prompt is kept and sends then."
|
|
9
9
|
// quota "90% of this 5-hour allowance used · resets 18:40" (above the field, while it still works)
|
|
@@ -29,14 +29,35 @@ const Clock = ({ size = 12 }) => (
|
|
|
29
29
|
</svg>
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
32
|
+
/** rc3-f (issue #181): the kept prompt's line in the chat while Claude is not connected — under the prompt the
|
|
33
|
+
* person sent, so the chat says it waits and what for, step by step with the sheet. */
|
|
34
|
+
export const CONNECT_WAITING = {
|
|
35
|
+
idle: 'Waiting for Claude to be connected. Your prompt sends by itself then.',
|
|
36
|
+
checking: 'Waiting for Claude to be connected. Your prompt sends by itself then.',
|
|
37
|
+
installing: "Installing Claude Code. Your prompt sends as soon as you're signed in.",
|
|
38
|
+
waiting: 'Waiting for you to sign in through your browser. Your prompt sends then.',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** One kept prompt's state line(s). `children` = the ConnectSheet when the gate is `ai-connected`;
|
|
42
|
+
* `connectPhase` = what that sheet is doing now. */
|
|
43
|
+
export function QueuedState({ queued, count = 1, connectPhase = 'idle', children }) {
|
|
34
44
|
const m = notReadyModel(queued);
|
|
35
45
|
if (!m.kind) return null;
|
|
36
46
|
const more = count > 1 ? ` · ${count} prompts kept` : '';
|
|
37
47
|
if (m.kind === 'connect') {
|
|
38
48
|
return (
|
|
39
49
|
<div className="ai-nr" data-testid="ai-not-ready" data-kind="connect">
|
|
50
|
+
<p
|
|
51
|
+
className="ai-nr-queued"
|
|
52
|
+
data-testid="ai-connect-waiting"
|
|
53
|
+
data-phase={connectPhase}
|
|
54
|
+
role="status"
|
|
55
|
+
aria-live="polite"
|
|
56
|
+
>
|
|
57
|
+
<Clock />
|
|
58
|
+
{CONNECT_WAITING[connectPhase] ?? CONNECT_WAITING.idle}
|
|
59
|
+
{more}
|
|
60
|
+
</p>
|
|
40
61
|
{children}
|
|
41
62
|
</div>
|
|
42
63
|
);
|
|
@@ -17,6 +17,7 @@ import { canvasRows, fitRunListWidth, RUN_WORD, yoursCount, yoursRows } from './
|
|
|
17
17
|
import { fetchChats } from './chat-store-api.js';
|
|
18
18
|
import { useAiRuns } from './runs-store.js';
|
|
19
19
|
import { StIcon } from '../../shell/icons.jsx';
|
|
20
|
+
import { onCanvasPointer } from '../shell/canvas-pointer.js';
|
|
20
21
|
|
|
21
22
|
export const Clock = ({ size = 12 }) => (
|
|
22
23
|
<svg width={size} height={size} viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
@@ -215,9 +216,12 @@ export function RunsCount({
|
|
|
215
216
|
};
|
|
216
217
|
document.addEventListener('pointerdown', onDown);
|
|
217
218
|
document.addEventListener('keydown', onKey, true);
|
|
219
|
+
// rc3 r4-12 — a press in the canvas closes it too (told over the dgn bridge; it never reaches this document)
|
|
220
|
+
const offCanvas = onCanvasPointer(() => close(false));
|
|
218
221
|
return () => {
|
|
219
222
|
document.removeEventListener('pointerdown', onDown);
|
|
220
223
|
document.removeEventListener('keydown', onKey, true);
|
|
224
|
+
offCanvas();
|
|
221
225
|
};
|
|
222
226
|
}, [open, close]);
|
|
223
227
|
|