@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.
- package/apps/studio/acp/index.ts +35 -2
- 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/agent-runs.ts +3 -0
- package/apps/studio/ai/lease-home.ts +11 -1
- package/apps/studio/ai/run-lifecycle.ts +17 -0
- package/apps/studio/ai/runs.ts +64 -12
- package/apps/studio/api.ts +31 -5
- package/apps/studio/bridge/dgn-protocol.ts +13 -0
- package/apps/studio/canvas-imports.ts +23 -4
- package/apps/studio/canvas-lib.tsx +7 -0
- package/apps/studio/client/app.jsx +4 -0
- package/apps/studio/client/export-lane.js +4 -2
- package/apps/studio/client/fonts/LICENSE-Inter-Tight.txt +93 -0
- package/apps/studio/client/fonts/LICENSE-Inter.txt +93 -0
- package/apps/studio/client/fonts/LICENSE-JetBrains-Mono.txt +93 -0
- package/apps/studio/client/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/inter-tight-latin-ext-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/inter-tight-latin-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +6 -0
- package/apps/studio/client/index.html +0 -3
- package/apps/studio/client/panels/ChatPanel.jsx +10 -2
- package/apps/studio/client/panels/acp-runtime.js +14 -0
- package/apps/studio/client/styles/_index.css +2 -0
- package/apps/studio/client/styles/fonts.css +63 -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/needs-you.js +10 -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/sync/ctl-provider.ts +4 -1
- package/apps/studio/sync/file-ledger.ts +12 -0
- package/apps/studio/sync/file-membership.ts +28 -0
- package/apps/studio/sync/file-plane.ts +119 -5
- package/apps/studio/sync/index.ts +55 -1
- package/apps/studio/sync/journal-client.ts +12 -0
- package/apps/studio/sync/poke.ts +30 -0
- package/apps/studio/sync/presentation.ts +6 -1
- package/apps/studio/sync/projection.ts +7 -0
- package/apps/studio/sync/retry-after.ts +27 -0
- package/apps/studio/sync/status.ts +9 -1
- package/apps/studio/video-play-overlay.tsx +67 -12
- package/apps/studio/whats-new.json +78 -6
- package/package.json +8 -8
|
@@ -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
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { useThread, useThreadRuntime } from '@assistant-ui/react';
|
|
13
13
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
14
|
-
import {
|
|
14
|
+
import { isSubagentTool } from '../../panels/acp-runtime.js';
|
|
15
15
|
import { sendToAskAI } from '../search/search-env.js';
|
|
16
16
|
import { focusComposer } from './panel-focus.js';
|
|
17
17
|
import { ResultCard } from './Result.jsx';
|
|
@@ -43,7 +43,9 @@ import { useBoardLabels } from './RunList.jsx';
|
|
|
43
43
|
import { shortArtboardName } from './scope.js';
|
|
44
44
|
import { runCardFor } from './run-cards.js';
|
|
45
45
|
import './video/cards.jsx';
|
|
46
|
-
import { RunLiveRegion, useRunClock, WorkingLine } from './Working.jsx';
|
|
46
|
+
import { ActivityLiveRegion, RunLiveRegion, useRunClock, WorkingLine } from './Working.jsx';
|
|
47
|
+
import { workingLineParts } from './activity-line.js';
|
|
48
|
+
import { useActivityLine } from './use-activity-line.js';
|
|
47
49
|
import { useChatRuns } from './use-chat-runs.js';
|
|
48
50
|
import { setAnswered, setResultShown } from './result-shown.js';
|
|
49
51
|
|
|
@@ -92,6 +94,13 @@ export function RunSurface({ conn, chatId, tools = [], artboards = [], designRel
|
|
|
92
94
|
const elapsed = useRunClock(run?.startedAt, showWorking);
|
|
93
95
|
// S5.18 G2: a run that ran on a copy says so, with the artboard that was busy
|
|
94
96
|
const boardLabels = useBoardLabels(designRel, 0);
|
|
97
|
+
// rc3-h (#182) — the ONE line says what AI is doing now, from the live stream (activity-line.js)
|
|
98
|
+
const activity = useActivityLine(conn, live, { designRel, labels: boardLabels });
|
|
99
|
+
const line = workingLineParts({
|
|
100
|
+
headline: workingText(run),
|
|
101
|
+
activity,
|
|
102
|
+
subagents: tools.filter(isSubagentTool).length,
|
|
103
|
+
});
|
|
95
104
|
const copyLine = run?.copyOf
|
|
96
105
|
? copyDividerText(run, {
|
|
97
106
|
name: shortArtboardName(
|
|
@@ -211,6 +220,7 @@ export function RunSurface({ conn, chatId, tools = [], artboards = [], designRel
|
|
|
211
220
|
return (
|
|
212
221
|
<>
|
|
213
222
|
<RunLiveRegion message={message} />
|
|
223
|
+
{showWorking ? <ActivityLiveRegion announce={activity.announce} /> : null}
|
|
214
224
|
{copyLine && (showWorking || showResult) ? (
|
|
215
225
|
<p className="ai-copy-rule" data-testid="ai-copy-divider">
|
|
216
226
|
{copyLine}
|
|
@@ -219,8 +229,8 @@ export function RunSurface({ conn, chatId, tools = [], artboards = [], designRel
|
|
|
219
229
|
{kindCard('top')}
|
|
220
230
|
{showWorking ? (
|
|
221
231
|
<WorkingLine
|
|
222
|
-
text={
|
|
223
|
-
step={
|
|
232
|
+
text={line.text}
|
|
233
|
+
step={line.step}
|
|
224
234
|
elapsed={elapsed}
|
|
225
235
|
onStop={onStop}
|
|
226
236
|
stopping={stopping}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
11
11
|
import { StIcon } from '../../shell/icons.jsx';
|
|
12
12
|
import { scopeLabel, scopeMenu, scopeNames, scopeTitle, toggleArtboard } from './scope.js';
|
|
13
|
+
import { onCanvasPointer } from '../shell/canvas-pointer.js';
|
|
13
14
|
|
|
14
15
|
export function ScopeChip({
|
|
15
16
|
scope,
|
|
@@ -49,9 +50,12 @@ export function ScopeChip({
|
|
|
49
50
|
};
|
|
50
51
|
document.addEventListener('pointerdown', onDown);
|
|
51
52
|
document.addEventListener('keydown', onKey, true);
|
|
53
|
+
// rc3 r4-12 — a press in the canvas closes it too (told over the dgn bridge; it never reaches this document)
|
|
54
|
+
const offCanvas = onCanvasPointer(() => close(false));
|
|
52
55
|
return () => {
|
|
53
56
|
document.removeEventListener('pointerdown', onDown);
|
|
54
57
|
document.removeEventListener('keydown', onKey, true);
|
|
58
|
+
offCanvas();
|
|
55
59
|
};
|
|
56
60
|
}, [open, close]);
|
|
57
61
|
|
|
@@ -35,7 +35,7 @@ export function WorkingLine({ text, step, elapsed, onStop, stopping = false }) {
|
|
|
35
35
|
<Spark size={14} />
|
|
36
36
|
</span>
|
|
37
37
|
<span className="ai-working-txt">
|
|
38
|
-
<span className="ai-working-main" data-testid="ai-working-text">
|
|
38
|
+
<span className="ai-working-main" data-testid="ai-working-text" key={text}>
|
|
39
39
|
{text}
|
|
40
40
|
</span>
|
|
41
41
|
{step || elapsed ? (
|
|
@@ -72,3 +72,15 @@ export function RunLiveRegion({ message }) {
|
|
|
72
72
|
</div>
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* rc3-h (#182) — the working line changes with what AI does; this sibling region reads a changed line out at most
|
|
78
|
+
* once per 10 s (activity-line.js ANNOUNCE_GAP_MS), never the clock. `announce` is `{ id, text }`.
|
|
79
|
+
*/
|
|
80
|
+
export function ActivityLiveRegion({ announce }) {
|
|
81
|
+
return (
|
|
82
|
+
<div className="ai-sr-only" role="status" aria-live="polite" data-testid="ai-activity-live">
|
|
83
|
+
{announce?.text ? <span key={announce.id}>{announce.text}</span> : null}
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
// client/v2/ai/activity-line.js — rc3-h (issue #182): the AI chat's ONE line that says what AI is doing right now.
|
|
2
|
+
//
|
|
3
|
+
// The chat already receives the agent's real stream (`{t:'update', update}` — tool calls with kind / locations /
|
|
4
|
+
// rawInput, the plan, thought and reply chunks). This module turns each event into a short present-tense line in
|
|
5
|
+
// product voice ("AI is reading Kanban", "AI is drawing Sprint board", "AI is thinking") and keeps the line calm:
|
|
6
|
+
//
|
|
7
|
+
// · a new phrase waits until the last one has been up SWAP_MS (a burst shows only its newest, no flicker);
|
|
8
|
+
// · after IDLE_MS with no event and nothing in flight the line falls back (`text: null` — the caller shows the
|
|
9
|
+
// run's own headline, "AI is working");
|
|
10
|
+
// · the polite live region hears a changed phrase at most once per ANNOUNCE_GAP_MS.
|
|
11
|
+
//
|
|
12
|
+
// What it never shows: a path, a command line, the model's prose. Names come from a file name or an artboard's
|
|
13
|
+
// `label` (a name, capped) — the canvas is untrusted (DDR-054), so nothing longer than a name leaves it. A plan
|
|
14
|
+
// step is shown only when it opens with a verb the `doing` table knows (decision v2-p8-c6-doing-from-ask); any
|
|
15
|
+
// other plan text becomes "AI is on step 2 of 5".
|
|
16
|
+
//
|
|
17
|
+
// Pure: no React, no DOM. use-activity-line.js feeds it from the connection and renders `view(now)`.
|
|
18
|
+
|
|
19
|
+
import { doingOf } from '../../../ai/run-doing.ts';
|
|
20
|
+
|
|
21
|
+
export const SWAP_MS = 1000;
|
|
22
|
+
export const IDLE_MS = 8000;
|
|
23
|
+
export const ANNOUNCE_GAP_MS = 10_000;
|
|
24
|
+
const NAME_MAX = 48;
|
|
25
|
+
|
|
26
|
+
/** One line of a name: control characters out, whitespace collapsed, capped at a word with an ellipsis. */
|
|
27
|
+
export function cleanName(s, max = NAME_MAX) {
|
|
28
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: stripping control characters is the point
|
|
29
|
+
const t = String(s ?? '').replace(/[\u0000-\u001f\u007f-\u009f--]/g, ' ');
|
|
30
|
+
const one = t.replace(/\s+/g, ' ').trim();
|
|
31
|
+
if (one.length <= max) return one;
|
|
32
|
+
const cut = one.slice(0, max - 1);
|
|
33
|
+
const sp = cut.lastIndexOf(' ');
|
|
34
|
+
return `${(sp > max / 2 ? cut.slice(0, sp) : cut).trimEnd()}…`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The design-root-relative path of `p` (absolute or repo-relative), or null when it is not under the root. */
|
|
38
|
+
export function designPath(p, designRel = '.design') {
|
|
39
|
+
if (typeof p !== 'string' || !p) return null;
|
|
40
|
+
const norm = p.replace(/\\/g, '/');
|
|
41
|
+
const root = String(designRel || '.design').replace(/^\/+|\/+$/g, '');
|
|
42
|
+
let rel = null;
|
|
43
|
+
if (norm.startsWith(`${root}/`)) rel = norm.slice(root.length + 1);
|
|
44
|
+
else {
|
|
45
|
+
const at = norm.lastIndexOf(`/${root}/`);
|
|
46
|
+
if (at >= 0) rel = norm.slice(at + root.length + 2);
|
|
47
|
+
}
|
|
48
|
+
if (!rel || rel.split('/').some((seg) => seg === '..' || seg === '')) return null;
|
|
49
|
+
return rel;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** "ui/Kanban board.tsx" → "Kanban board". */
|
|
53
|
+
export function canvasName(rel) {
|
|
54
|
+
const base =
|
|
55
|
+
String(rel ?? '')
|
|
56
|
+
.split('/')
|
|
57
|
+
.pop() ?? '';
|
|
58
|
+
return cleanName(
|
|
59
|
+
base.replace(/\.(?:tsx|jsx|ts|js|html|svg|meta\.json|annotations\.json|css)$/i, '')
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The `<DCArtboard>` tags in a piece of canvas source: `{ id, label }` per tag, in order. */
|
|
64
|
+
export function artboardsIn(text) {
|
|
65
|
+
const out = [];
|
|
66
|
+
if (typeof text !== 'string' || !text) return out;
|
|
67
|
+
const re = /<DCArtboard\b([^>]*)>/g;
|
|
68
|
+
for (let m = re.exec(text); m && out.length < 50; m = re.exec(text)) {
|
|
69
|
+
const attrs = m[1];
|
|
70
|
+
const id = attrs.match(/\bid=(["'])([^"']{1,128})\1/)?.[2];
|
|
71
|
+
if (!id) continue;
|
|
72
|
+
const label = attrs.match(/\blabel=(["'])([^"']{0,200})\1/)?.[2] ?? '';
|
|
73
|
+
out.push({ id, label });
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const humanize = (id) =>
|
|
79
|
+
cleanName(
|
|
80
|
+
String(id)
|
|
81
|
+
.replace(/[-_]+/g, ' ')
|
|
82
|
+
.replace(/^\w/, (c) => c.toUpperCase())
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
/** `maude design <verb>` → the verb's plain words. Not a maude verb → null. */
|
|
86
|
+
const VERB_WORDS = {
|
|
87
|
+
screenshot: 'AI is checking how it looks',
|
|
88
|
+
'visual-sanity': 'AI is checking how it looks',
|
|
89
|
+
smoke: 'AI is checking the canvases',
|
|
90
|
+
'canvas-rects': 'AI is measuring the canvas',
|
|
91
|
+
'canvas-errors': 'AI is checking the canvas for errors',
|
|
92
|
+
'canvas-source': 'AI is reading the canvas',
|
|
93
|
+
'read-annotations': 'AI is reading the notes',
|
|
94
|
+
annotate: 'AI is adding notes',
|
|
95
|
+
'canvas-edit': 'AI is editing the canvas',
|
|
96
|
+
place: 'AI is placing it on the canvas',
|
|
97
|
+
'layout-check': 'AI is checking the layout',
|
|
98
|
+
'draw-build': 'AI is drawing a vector',
|
|
99
|
+
'draw-proof': 'AI is checking the drawing',
|
|
100
|
+
'svg-optimize': 'AI is tidying the drawing',
|
|
101
|
+
'ds-check': 'AI is checking the design system',
|
|
102
|
+
'import-tokens': 'AI is bringing in the design tokens',
|
|
103
|
+
'import-asset': 'AI is bringing in a file',
|
|
104
|
+
'import-figma': 'AI is bringing in the Figma file',
|
|
105
|
+
'import-brand': 'AI is bringing in the brand',
|
|
106
|
+
'fetch-asset': 'AI is fetching an image',
|
|
107
|
+
generate: 'AI is generating media',
|
|
108
|
+
export: 'AI is exporting',
|
|
109
|
+
handoff: 'AI is preparing the handoff',
|
|
110
|
+
'photo-adjust': 'AI is adjusting the photo',
|
|
111
|
+
'photo-bg-remove': 'AI is removing the background',
|
|
112
|
+
captions: 'AI is writing captions',
|
|
113
|
+
transcribe: 'AI is listening to the audio',
|
|
114
|
+
'transcribe-local': 'AI is listening to the audio',
|
|
115
|
+
beats: 'AI is finding the beats',
|
|
116
|
+
'cut-words': 'AI is cutting the video',
|
|
117
|
+
'cut-to-beat': 'AI is cutting the video',
|
|
118
|
+
'reel-place': 'AI is placing the clips',
|
|
119
|
+
'probe-footage': 'AI is looking at the footage',
|
|
120
|
+
'ingest-footage': 'AI is looking at the footage',
|
|
121
|
+
'smart-frames': 'AI is looking at the footage',
|
|
122
|
+
'audio-search': 'AI is looking for music',
|
|
123
|
+
'to-lottie': 'AI is exporting the animation',
|
|
124
|
+
prep: 'AI is getting ready',
|
|
125
|
+
'bootstrap-check': 'AI is getting ready',
|
|
126
|
+
'server-up': 'AI is getting ready',
|
|
127
|
+
'runtime-health': 'AI is getting ready',
|
|
128
|
+
'ensure-browser': 'AI is getting ready',
|
|
129
|
+
open: 'AI is opening a canvas',
|
|
130
|
+
index: 'AI is looking through the canvases',
|
|
131
|
+
status: 'AI is looking through the canvases',
|
|
132
|
+
assets: 'AI is looking through the assets',
|
|
133
|
+
logs: 'AI is reading the logs',
|
|
134
|
+
check: 'AI is checking the project',
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export function verbWords(command) {
|
|
138
|
+
if (typeof command !== 'string') return null;
|
|
139
|
+
const m = command.match(/(?:^|[\s;&|(])maude\s+design\s+([a-z][a-z-]{0,40})/);
|
|
140
|
+
if (!m) return null;
|
|
141
|
+
return VERB_WORDS[m[1]] ?? 'AI is working on the canvas';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const isSubagent = (u) => {
|
|
145
|
+
const n = u?._meta?.claudeCode?.toolName;
|
|
146
|
+
return n === 'Task' || n === 'Agent';
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
function pathOf(u) {
|
|
150
|
+
const raw = u?.rawInput && typeof u.rawInput === 'object' ? u.rawInput : null;
|
|
151
|
+
for (const c of [raw?.file_path, raw?.abs_path, raw?.path, raw?.notebook_path])
|
|
152
|
+
if (typeof c === 'string' && c) return c;
|
|
153
|
+
const loc = Array.isArray(u?.locations)
|
|
154
|
+
? u.locations.find((l) => typeof l?.path === 'string')
|
|
155
|
+
: null;
|
|
156
|
+
return loc?.path ?? null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const SOURCE_RE = /\.(?:tsx|jsx)$/i;
|
|
160
|
+
|
|
161
|
+
function readPhrase(u, ctx) {
|
|
162
|
+
const rel = designPath(pathOf(u), ctx.designRel);
|
|
163
|
+
if (!rel) return pathOf(u) ? 'AI is reading the project files' : 'AI is reading';
|
|
164
|
+
if (rel.startsWith('system/')) return 'AI is reading the design system';
|
|
165
|
+
if (SOURCE_RE.test(rel) || /\.(?:meta|annotations)\.json$/i.test(rel))
|
|
166
|
+
return `AI is reading ${canvasName(rel)}`;
|
|
167
|
+
return 'AI is reading the project';
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function editPhrase(u, ctx) {
|
|
171
|
+
const rel = designPath(pathOf(u), ctx.designRel);
|
|
172
|
+
if (!rel) return { text: pathOf(u) ? 'AI is editing a project file' : 'AI is editing' };
|
|
173
|
+
if (rel.startsWith('system/')) return { text: 'AI is updating the design system' };
|
|
174
|
+
const name = canvasName(rel);
|
|
175
|
+
if (/\.meta\.json$/i.test(rel)) return { text: `AI is arranging ${name}` };
|
|
176
|
+
if (/\.css$/i.test(rel)) return { text: `AI is styling ${name}` };
|
|
177
|
+
if (!SOURCE_RE.test(rel)) return { text: 'AI is editing the project' };
|
|
178
|
+
const file = `${String(ctx.designRel || '.design').replace(/\/+$/, '')}/${rel}`;
|
|
179
|
+
const raw = u?.rawInput && typeof u.rawInput === 'object' ? u.rawInput : {};
|
|
180
|
+
const next = typeof raw.content === 'string' ? raw.content : (raw.new_string ?? '');
|
|
181
|
+
const prev = typeof raw.old_string === 'string' ? raw.old_string : '';
|
|
182
|
+
const known = new Map(
|
|
183
|
+
(ctx.labelsFor?.(file) ?? []).filter((b) => b?.id).map((b) => [b.id, b.label])
|
|
184
|
+
);
|
|
185
|
+
const before = new Set(artboardsIn(prev).map((a) => a.id));
|
|
186
|
+
const inNext = artboardsIn(next);
|
|
187
|
+
const added = inNext.filter((a) => !before.has(a.id) && !known.has(a.id));
|
|
188
|
+
if (added.length === 1) {
|
|
189
|
+
const label = cleanName(added[0].label) || humanize(added[0].id);
|
|
190
|
+
return {
|
|
191
|
+
text: `AI is drawing ${label}`,
|
|
192
|
+
target: { file, artboard: added[0].id, label, adding: true },
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (added.length > 1) return { text: `AI is drawing ${added.length} artboards` };
|
|
196
|
+
const touched = [...artboardsIn(prev), ...inNext].find((a) => known.has(a.id));
|
|
197
|
+
if (touched) {
|
|
198
|
+
const label = cleanName(known.get(touched.id) || touched.label) || humanize(touched.id);
|
|
199
|
+
return { text: `AI is editing ${label}`, target: { file, artboard: touched.id, label } };
|
|
200
|
+
}
|
|
201
|
+
const ids = new Set(String(next).match(/data-cd-id=["'][^"']{1,128}["']/g) ?? []);
|
|
202
|
+
if (ids.size >= 2) return { text: `AI is editing ${ids.size} elements` };
|
|
203
|
+
return { text: `AI is editing ${name}` };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function planPhrase(u) {
|
|
207
|
+
const entries = Array.isArray(u?.entries)
|
|
208
|
+
? u.entries.filter((e) => e && typeof e === 'object')
|
|
209
|
+
: [];
|
|
210
|
+
if (!entries.length) return null;
|
|
211
|
+
let i = entries.findIndex((e) => e.status === 'in_progress');
|
|
212
|
+
if (i < 0) i = entries.findIndex((e) => e.status !== 'completed');
|
|
213
|
+
if (i < 0) return null;
|
|
214
|
+
const step = `Step ${i + 1} of ${entries.length}`;
|
|
215
|
+
const doing = doingOf(typeof entries[i].content === 'string' ? entries[i].content : '');
|
|
216
|
+
return { text: doing ? `AI is ${doing}` : `AI is on step ${i + 1} of ${entries.length}`, step };
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* One ACP `session/update` → `{ text, target?, step? }`, or null when it says nothing new (bookkeeping, a
|
|
221
|
+
* completion). `ctx = { designRel, labelsFor(repoRelFile) → [{id,label}] }`.
|
|
222
|
+
*/
|
|
223
|
+
export function phraseFor(u, ctx = {}) {
|
|
224
|
+
if (!u || typeof u !== 'object') return null;
|
|
225
|
+
switch (u.sessionUpdate) {
|
|
226
|
+
case 'agent_thought_chunk':
|
|
227
|
+
return { text: 'AI is thinking' };
|
|
228
|
+
case 'agent_message_chunk':
|
|
229
|
+
return u.content?.type === 'text' && u.content.text ? { text: 'AI is replying' } : null;
|
|
230
|
+
case 'plan':
|
|
231
|
+
return planPhrase(u);
|
|
232
|
+
case 'tool_call':
|
|
233
|
+
break;
|
|
234
|
+
case 'tool_call_update':
|
|
235
|
+
// a pending call's details can arrive on its first update; a completion says nothing new
|
|
236
|
+
if (u.status === 'completed' || u.status === 'failed' || !u.kind) return null;
|
|
237
|
+
break;
|
|
238
|
+
default:
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
if (isSubagent(u)) return { text: 'AI is asking a helper' };
|
|
242
|
+
switch (u.kind) {
|
|
243
|
+
case 'read':
|
|
244
|
+
return { text: readPhrase(u, ctx) };
|
|
245
|
+
case 'edit':
|
|
246
|
+
return editPhrase(u, ctx);
|
|
247
|
+
case 'search':
|
|
248
|
+
return { text: 'AI is searching the project' };
|
|
249
|
+
case 'execute':
|
|
250
|
+
return { text: verbWords(u.rawInput?.command) ?? 'AI is running a step' };
|
|
251
|
+
case 'fetch':
|
|
252
|
+
return { text: 'AI is reading the web' };
|
|
253
|
+
case 'think':
|
|
254
|
+
return { text: 'AI is thinking' };
|
|
255
|
+
case 'delete':
|
|
256
|
+
return { text: 'AI is removing a file' };
|
|
257
|
+
case 'move':
|
|
258
|
+
return { text: 'AI is moving a file' };
|
|
259
|
+
default:
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* The line over time. `feed(update, now, ctx)` takes each event; `view(now)` is what to draw:
|
|
266
|
+
* `{ text: string|null, step: string|null, target, announce: {id, text}|null }` (`text: null` = fall back to the
|
|
267
|
+
* run's headline). `nextAt(now)` is when the view next changes by itself (a waiting swap, the idle fallback, an
|
|
268
|
+
* announcement), or null.
|
|
269
|
+
*/
|
|
270
|
+
export function createActivityLine({
|
|
271
|
+
swapMs = SWAP_MS,
|
|
272
|
+
idleMs = IDLE_MS,
|
|
273
|
+
announceGapMs = ANNOUNCE_GAP_MS,
|
|
274
|
+
} = {}) {
|
|
275
|
+
let shown = null; // { text, step, target, at }
|
|
276
|
+
let pending = null; // { text, step, target }
|
|
277
|
+
let lastEventAt = null;
|
|
278
|
+
let step = null;
|
|
279
|
+
const open = new Map(); // toolCallId → target|null
|
|
280
|
+
let announced = null; // { id, text, at }
|
|
281
|
+
let seq = 0;
|
|
282
|
+
|
|
283
|
+
const reset = () => {
|
|
284
|
+
shown = null;
|
|
285
|
+
pending = null;
|
|
286
|
+
lastEventAt = null;
|
|
287
|
+
step = null;
|
|
288
|
+
open.clear();
|
|
289
|
+
announced = null;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
function feed(u, now, ctx = {}) {
|
|
293
|
+
if (!u || typeof u !== 'object') return;
|
|
294
|
+
lastEventAt = now;
|
|
295
|
+
if (
|
|
296
|
+
u.sessionUpdate === 'tool_call_update' &&
|
|
297
|
+
(u.status === 'completed' || u.status === 'failed')
|
|
298
|
+
) {
|
|
299
|
+
open.delete(u.toolCallId);
|
|
300
|
+
// its target lets go now: the write landed (or did not)
|
|
301
|
+
if (shown?.target && !hasTarget(shown.target)) shown = { ...shown, target: null };
|
|
302
|
+
if (pending?.target && !hasTarget(pending.target)) pending = { ...pending, target: null };
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const p = phraseFor(u, ctx);
|
|
306
|
+
if (u.sessionUpdate === 'tool_call' && u.toolCallId) open.set(u.toolCallId, p?.target ?? null);
|
|
307
|
+
if (!p) return;
|
|
308
|
+
if (p.step) step = p.step;
|
|
309
|
+
const next = { text: p.text, step: p.step ?? null, target: p.target ?? null };
|
|
310
|
+
if (!shown) shown = { ...next, at: now };
|
|
311
|
+
else if (shown.text === next.text && !pending) shown = { ...shown, target: next.target };
|
|
312
|
+
else pending = next;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function hasTarget(t) {
|
|
316
|
+
for (const v of open.values())
|
|
317
|
+
if (v && v.file === t.file && v.artboard === t.artboard) return true;
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function settle(now) {
|
|
322
|
+
if (pending && (!shown || now - shown.at >= swapMs)) {
|
|
323
|
+
shown = { ...pending, at: now };
|
|
324
|
+
pending = null;
|
|
325
|
+
}
|
|
326
|
+
const quiet = !open.size && !pending && lastEventAt !== null && now - lastEventAt >= idleMs;
|
|
327
|
+
if (quiet && shown && shown.text !== null)
|
|
328
|
+
shown = { text: null, step: null, target: null, at: now };
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function view(now) {
|
|
332
|
+
settle(now);
|
|
333
|
+
const text = shown?.text ?? null;
|
|
334
|
+
if (text && text !== announced?.text && (!announced || now - announced.at >= announceGapMs)) {
|
|
335
|
+
seq += 1;
|
|
336
|
+
announced = { id: seq, text, at: now };
|
|
337
|
+
}
|
|
338
|
+
return {
|
|
339
|
+
text,
|
|
340
|
+
step: text ? step : null,
|
|
341
|
+
target: shown?.target ?? null,
|
|
342
|
+
announce: announced ? { id: announced.id, text: announced.text } : null,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function nextAt(now) {
|
|
347
|
+
const at = [];
|
|
348
|
+
if (pending && shown) at.push(shown.at + swapMs);
|
|
349
|
+
if (!open.size && lastEventAt !== null && shown?.text) at.push(lastEventAt + idleMs);
|
|
350
|
+
if (shown?.text && announced && shown.text !== announced.text)
|
|
351
|
+
at.push(announced.at + announceGapMs);
|
|
352
|
+
const future = at.filter((t) => t >= now);
|
|
353
|
+
return future.length ? Math.min(...future) : null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return { feed, view, nextAt, reset };
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* What the working line draws: the live phrase (or the run's headline when there is none), and under it the
|
|
361
|
+
* plan step, else the person's own ask when the line has moved on from it ("Drawing a calm landing page"), and how
|
|
362
|
+
* many helpers run. `headline` is run-model's `workingText(run)`.
|
|
363
|
+
*/
|
|
364
|
+
export function workingLineParts({ headline, activity, subagents = 0 }) {
|
|
365
|
+
const head = headline || 'AI is working';
|
|
366
|
+
const text = activity?.text || head;
|
|
367
|
+
const ask =
|
|
368
|
+
activity?.text && head !== 'AI is working' && head !== text
|
|
369
|
+
? head.replace(/^AI is\s+/i, '').replace(/^\w/, (c) => c.toUpperCase())
|
|
370
|
+
: '';
|
|
371
|
+
const helpers =
|
|
372
|
+
subagents > 0 ? `${subagents} ${subagents === 1 ? 'helper' : 'helpers'} working` : '';
|
|
373
|
+
const step = [activity?.step || ask, helpers].filter(Boolean).join(' · ');
|
|
374
|
+
return { text, step };
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* The ring the canvas wears for an in-flight edit that names one of its artboards (`ai-runs` shape), before the
|
|
379
|
+
* write lands and the run's own lease ring arrives. An artboard still being ADDED has nothing to ring yet (the
|
|
380
|
+
* canvas marks it itself when it lands). `file` is the frame's repo-relative path.
|
|
381
|
+
*/
|
|
382
|
+
export function targetRings(target, file) {
|
|
383
|
+
if (!target || target.adding || !file || target.file !== file) return {};
|
|
384
|
+
const id = typeof target.artboard === 'string' ? target.artboard : '';
|
|
385
|
+
if (!id || id.length > 128) return {};
|
|
386
|
+
const label = cleanName(target.label || id);
|
|
387
|
+
return {
|
|
388
|
+
[id]: { state: 'running', who: 'you', tag: `AI is editing ${label}`.slice(0, 120), waiting: 0 },
|
|
389
|
+
};
|
|
390
|
+
}
|