@1agh/maude 2.0.2 → 2.0.4
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/README.md +6 -5
- package/apps/studio/access/request.ts +0 -1
- package/apps/studio/acp/adapter-stderr.ts +43 -13
- package/apps/studio/acp/background-tasks.ts +155 -0
- package/apps/studio/acp/bridge.ts +44 -5
- package/apps/studio/acp/connected-fact.ts +15 -4
- package/apps/studio/acp/index.ts +14 -5
- package/apps/studio/actions/agents.ts +5 -0
- package/apps/studio/actions/defs/view.ts +12 -0
- package/apps/studio/actions.manifest.json +13 -1
- package/apps/studio/actions.parity.json +7 -1
- package/apps/studio/api.ts +31 -24
- package/apps/studio/asset-placeholder.tsx +157 -62
- package/apps/studio/bin/_png-playwright.mjs +10 -1
- package/apps/studio/bin/_pw-launch.mjs +14 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +4 -1
- package/apps/studio/boot-progress.ts +31 -0
- package/apps/studio/bridge/dgn-protocol.ts +34 -4
- package/apps/studio/canvas-build-sandbox.ts +275 -42
- package/apps/studio/canvas-build-worker.ts +10 -0
- package/apps/studio/canvas-create.ts +24 -0
- package/apps/studio/canvas-module-cache.ts +93 -0
- package/apps/studio/canvas-source/errors.ts +39 -0
- package/apps/studio/canvas-source/waiting.ts +290 -0
- package/apps/studio/client/actions/shell-key-handlers.js +5 -0
- package/apps/studio/client/app.jsx +22 -9
- package/apps/studio/client/github.js +23 -3
- package/apps/studio/client/home/home-api.js +30 -19
- package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
- package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
- package/apps/studio/client/hooks/use-tabs.jsx +64 -35
- package/apps/studio/client/index-loader.ts +23 -3
- package/apps/studio/client/panels/ChatPanel.jsx +22 -37
- package/apps/studio/client/panels/DiffView.jsx +314 -248
- package/apps/studio/client/panels/TeamProjects.jsx +119 -69
- package/apps/studio/client/panels/acp-runtime.js +25 -0
- package/apps/studio/client/panels/chat-finish.js +66 -0
- package/apps/studio/client/shell/frame-cap.js +53 -0
- package/apps/studio/client/shell/viewport.jsx +9 -0
- package/apps/studio/client/styles/_index.css +2 -0
- package/apps/studio/client/tree/tree.jsx +48 -21
- package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
- package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
- package/apps/studio/client/v2/ai/ai-run.css +87 -3
- package/apps/studio/client/v2/ai/background-model.js +113 -0
- package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
- package/apps/studio/client/v2/ai/run-api.js +7 -3
- package/apps/studio/client/v2/ai/runs-store.js +2 -1
- package/apps/studio/client/v2/annotations/vote-store.js +11 -5
- package/apps/studio/client/v2/assets/asset-state-lane.js +176 -8
- package/apps/studio/client/v2/assets/assets-bus.js +10 -8
- package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
- package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
- package/apps/studio/client/v2/assets/missing-frame.jsx +8 -4
- package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
- package/apps/studio/client/v2/assets/spotlight.css +153 -0
- package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
- package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
- package/apps/studio/client/v2/assets/tile.jsx +3 -0
- package/apps/studio/client/v2/assets/use-assets.js +2 -1
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
- package/apps/studio/client/v2/canvases/covers.js +11 -5
- package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
- package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
- package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
- package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
- package/apps/studio/client/v2/canvases/use-pins.js +2 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
- package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
- package/apps/studio/client/v2/code/code.css +67 -0
- package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
- package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
- package/apps/studio/client/v2/create/name-dialog.css +10 -0
- package/apps/studio/client/v2/ds/advanced-host.jsx +5 -2
- package/apps/studio/client/v2/ds/make-host.jsx +5 -2
- package/apps/studio/client/v2/ds/off-system-host.jsx +5 -2
- package/apps/studio/client/v2/ds/truth-host.jsx +5 -2
- package/apps/studio/client/v2/empty/arriving.jsx +29 -12
- package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
- package/apps/studio/client/v2/empty/not-local.jsx +31 -1
- package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
- package/apps/studio/client/v2/export/last-finished.js +2 -1
- package/apps/studio/client/v2/export/native-save.js +44 -0
- package/apps/studio/client/v2/history/git-model.js +18 -4
- package/apps/studio/client/v2/history/git-parts.jsx +60 -42
- package/apps/studio/client/v2/history/history.css +6 -0
- package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
- package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
- package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
- package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
- package/apps/studio/client/v2/search/search-recent.js +3 -1
- package/apps/studio/client/v2/search/search-remote.js +6 -4
- package/apps/studio/client/v2/settings/connections-model.js +1 -1
- package/apps/studio/client/v2/shell/menu-runner.js +1 -0
- package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
- package/apps/studio/client/v2/shell/recovery-store.js +2 -1
- package/apps/studio/client/v2/shell/served-routes.js +120 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +2 -1
- package/apps/studio/client/v2/shell/shell-activity.js +19 -0
- package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
- package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
- package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
- package/apps/studio/cloud/endpoints.ts +23 -1
- package/apps/studio/dist/client.bundle.js +798 -801
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds-assets.ts +138 -48
- package/apps/studio/editing/minimap-context.tsx +3 -3
- package/apps/studio/editing/page-activity.ts +251 -0
- package/apps/studio/editing/rotate-handle.tsx +9 -5
- package/apps/studio/editing/sticky-name.tsx +4 -4
- package/apps/studio/history/restore-artboard-action.ts +40 -0
- package/apps/studio/home/hub.ts +77 -175
- package/apps/studio/home/routes.ts +47 -8
- package/apps/studio/http.ts +117 -66
- package/apps/studio/index-flight.ts +40 -0
- package/apps/studio/managed-projects.ts +52 -24
- package/apps/studio/migrate/hub.ts +7 -1
- package/apps/studio/routes/asset-state.ts +12 -0
- package/apps/studio/routes/canvas-source.ts +44 -2
- package/apps/studio/routes/ds-assets.ts +8 -0
- package/apps/studio/routes/history.ts +28 -5
- package/apps/studio/routes/hub-signin.ts +115 -0
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/table.ts +7 -0
- package/apps/studio/routes/trash.ts +3 -0
- package/apps/studio/server.ts +11 -0
- package/apps/studio/sync/accepted-cold-start.ts +26 -3
- package/apps/studio/sync/accepted-link.ts +9 -4
- package/apps/studio/sync/asset-push.ts +8 -1
- package/apps/studio/sync/asset-state.ts +27 -2
- package/apps/studio/sync/code-module-consent.ts +74 -0
- package/apps/studio/sync/file-ledger.ts +35 -0
- package/apps/studio/sync/file-plane.ts +479 -84
- package/apps/studio/sync/hub-browser-signin.ts +377 -0
- package/apps/studio/sync/hub-text-undo.ts +30 -10
- package/apps/studio/sync/index.ts +73 -11
- package/apps/studio/sync/lfs-pointer.ts +137 -0
- package/apps/studio/sync/projection.ts +44 -2
- package/apps/studio/sync/pull-pacer.ts +160 -0
- package/apps/studio/sync/pull-priority.ts +119 -0
- package/apps/studio/sync/seed-progress.ts +47 -3
- package/apps/studio/sync/transaction-client.ts +71 -6
- package/apps/studio/sync/workspace-signin.ts +6 -256
- package/apps/studio/sync/writer-registry.ts +5 -1
- package/apps/studio/video-links-overlay.tsx +3 -2
- package/apps/studio/whats-new.json +63 -0
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/workspace-plan.mjs +14 -0
- package/package.json +8 -8
|
@@ -8,10 +8,17 @@ import { basename, displayName, previewKind, shellToast } from '../shell/util.js
|
|
|
8
8
|
import { assembleVideoFlow } from '../v2/timeline/assemble-video.js';
|
|
9
9
|
import { notify } from '../../notifications.tsx';
|
|
10
10
|
import { lastOpenedPath } from '../v2/canvases/last-canvas.js';
|
|
11
|
-
import {
|
|
11
|
+
import { queueTrashCanvas } from '../v2/canvases/trash-queue.js';
|
|
12
12
|
import { invoke, isNativeApp, listenHere } from '../github.js';
|
|
13
13
|
import { applyShellNavigate, startShellEvents } from '../shell-events.js';
|
|
14
14
|
import { threadAuthor } from '../v2/comments/use-comments-shell.jsx';
|
|
15
|
+
import { fetchIfServed } from '../v2/shell/served-routes.js';
|
|
16
|
+
|
|
17
|
+
/** `.design/ui/x.tsx` → `ui/x.tsx` (the designRoot-relative form the Canvases panel's row slots use). */
|
|
18
|
+
function relToDesignRoot(repoPath, cfg) {
|
|
19
|
+
const designRel = (cfg?.designRel || cfg?.designRoot || '.design').replace(/^\/+|\/+$/g, '');
|
|
20
|
+
return repoPath.startsWith(`${designRel}/`) ? repoPath.slice(designRel.length + 1) : repoPath;
|
|
21
|
+
}
|
|
15
22
|
|
|
16
23
|
export function useTabs({
|
|
17
24
|
groups,
|
|
@@ -135,7 +142,7 @@ export function useTabs({
|
|
|
135
142
|
// 11 pn-deeplink: the artboard's name as the canvas shows it (the project index), not its id
|
|
136
143
|
artboardLabel: async (file, id) => {
|
|
137
144
|
try {
|
|
138
|
-
const r = await
|
|
145
|
+
const r = await fetchIfServed('/_api/index', { cache: 'no-store' });
|
|
139
146
|
const j = r.ok ? await r.json() : null;
|
|
140
147
|
const root = j?.project?.designRel || cfg.designRel;
|
|
141
148
|
const c = (j?.canvases ?? []).find((x) => (root ? `${root}/${x.rel}` : x.rel) === file);
|
|
@@ -280,7 +287,7 @@ export function useTabs({
|
|
|
280
287
|
lastOpened.current = true;
|
|
281
288
|
(async () => {
|
|
282
289
|
try {
|
|
283
|
-
const r = await
|
|
290
|
+
const r = await fetchIfServed('/_api/pins', { cache: 'no-store' });
|
|
284
291
|
if (!r.ok) return;
|
|
285
292
|
const body = await r.json();
|
|
286
293
|
const path = lastOpenedPath(body?.opened, groups, cfg.designRel || '.design');
|
|
@@ -578,10 +585,13 @@ export function useTabs({
|
|
|
578
585
|
// moves the whole sidecar set to .design/_trash/), refresh the tree, and close the tab if that canvas was
|
|
579
586
|
// open. S1.2 — it asks nothing: "“name” moved to the trash." with Undo, which brings it back (and reopens
|
|
580
587
|
// it if it was the open one). CONTRACT §4: moved to the trash, never "deleted".
|
|
588
|
+
// #194 (2.0.4) — through the one trash queue (v2/canvases/trash-queue.js): the row says "Moving to trash…"
|
|
589
|
+
// at once, quick moves wait their turn instead of racing, and the server's yes takes the row out.
|
|
581
590
|
const deleteBoard = useCallback(
|
|
582
591
|
(filePath, label) =>
|
|
583
|
-
|
|
592
|
+
queueTrashCanvas({
|
|
584
593
|
path: filePath,
|
|
594
|
+
rel: relToDesignRoot(filePath, cfg),
|
|
585
595
|
label,
|
|
586
596
|
toast: shellToast,
|
|
587
597
|
reload: loadTree,
|
|
@@ -595,7 +605,7 @@ export function useTabs({
|
|
|
595
605
|
if (activePath === p) openTab(p);
|
|
596
606
|
},
|
|
597
607
|
}),
|
|
598
|
-
[loadTree, activePath, openTab]
|
|
608
|
+
[loadTree, activePath, openTab, cfg]
|
|
599
609
|
);
|
|
600
610
|
|
|
601
611
|
// feature-file-tree-drag-drop-folders (Task 8/10) — drag-drop AND the
|
|
@@ -647,12 +657,13 @@ export function useTabs({
|
|
|
647
657
|
);
|
|
648
658
|
|
|
649
659
|
// feature-file-tree-drag-drop-folders (Task 4/9/12) — create a folder under
|
|
650
|
-
// `parentDir`. Two callers: the
|
|
651
|
-
//
|
|
652
|
-
// `window.prompt`
|
|
653
|
-
//
|
|
660
|
+
// `parentDir`. Two callers: the "+ New canvas" row's in-place folder field and
|
|
661
|
+
// the folder row menu's "New folder here" (#195: the shell's own dialog,
|
|
662
|
+
// v2/canvases/folder-dialogs.jsx — `window.prompt` is a no-op in WKWebView, so
|
|
663
|
+
// on the desktop this did nothing). Answers `{ ok, status?, error?, network? }`;
|
|
664
|
+
// `{ quiet: true }` leaves the words to the dialog that asked.
|
|
654
665
|
const newFolderReq = useCallback(
|
|
655
|
-
async (parentDir, name) => {
|
|
666
|
+
async (parentDir, name, opts = {}) => {
|
|
656
667
|
try {
|
|
657
668
|
const r = await fetch('/_api/fs-mkdir', {
|
|
658
669
|
method: 'POST',
|
|
@@ -662,8 +673,8 @@ export function useTabs({
|
|
|
662
673
|
const j = await r.json().catch(() => ({}));
|
|
663
674
|
if (!r.ok || !j.ok) {
|
|
664
675
|
const error = j.error || `error ${r.status}`;
|
|
665
|
-
shellToast(`Could not create folder: ${error}`);
|
|
666
|
-
return { ok: false, error };
|
|
676
|
+
if (!opts.quiet) shellToast(`Could not create folder: ${error}`);
|
|
677
|
+
return { ok: false, status: r.status, error };
|
|
667
678
|
}
|
|
668
679
|
// #124 — open the parent so the new folder is visible (it starts closed).
|
|
669
680
|
updateTreeExp((st) => revealPath(st, groups, parentDir, { includeSelf: true }));
|
|
@@ -671,8 +682,8 @@ export function useTabs({
|
|
|
671
682
|
return { ok: true, dir: j.dir };
|
|
672
683
|
} catch (e) {
|
|
673
684
|
const error = e instanceof Error ? e.message : 'network error';
|
|
674
|
-
shellToast(`Create folder failed: ${error}`);
|
|
675
|
-
return { ok: false, error };
|
|
685
|
+
if (!opts.quiet) shellToast(`Create folder failed: ${error}`);
|
|
686
|
+
return { ok: false, error, network: true };
|
|
676
687
|
}
|
|
677
688
|
},
|
|
678
689
|
[loadTree, groups, updateTreeExp]
|
|
@@ -683,25 +694,27 @@ export function useTabs({
|
|
|
683
694
|
// route now auto-detects a non-.tsx target as a folder delete); every
|
|
684
695
|
// canvas inside is trashed the same recoverable way as a single-canvas
|
|
685
696
|
// delete (`.design/_trash/<stamp>__<slug>/`).
|
|
697
|
+
// #195 — the tree asks first in its own dialog ("Move “x” to the trash?"); `window.confirm` answered "no"
|
|
698
|
+
// at once in WKWebView, so on the desktop this never ran. Answers `{ ok, status?, error?, network? }`.
|
|
686
699
|
const deleteFolderReq = useCallback(
|
|
687
|
-
async (dirPath, label) => {
|
|
688
|
-
const ok = window.confirm(
|
|
689
|
-
`Delete folder "${label}"?\n\nEvery canvas inside moves to trash (recoverable from .design/_trash/); ` +
|
|
690
|
-
`any empty subfolders are removed.`
|
|
691
|
-
);
|
|
692
|
-
if (!ok) return;
|
|
700
|
+
async (dirPath, label, opts = {}) => {
|
|
693
701
|
try {
|
|
694
702
|
const r = await fetch(`/_api/canvas?file=${encodeURIComponent(dirPath)}`, {
|
|
695
703
|
method: 'DELETE',
|
|
696
704
|
});
|
|
697
705
|
const j = await r.json().catch(() => ({}));
|
|
698
706
|
if (!r.ok || !j.ok) {
|
|
699
|
-
|
|
700
|
-
|
|
707
|
+
const error = j.error || `error ${r.status}`;
|
|
708
|
+
if (!opts.quiet) shellToast(`Could not move “${label}” to the trash. ${error}`);
|
|
709
|
+
return { ok: false, status: r.status, error };
|
|
701
710
|
}
|
|
702
711
|
await loadTree();
|
|
712
|
+
shellToast(`“${label}” moved to the trash.`, true);
|
|
713
|
+
return { ok: true };
|
|
703
714
|
} catch (e) {
|
|
704
|
-
|
|
715
|
+
const error = e instanceof Error ? e.message : 'network error';
|
|
716
|
+
if (!opts.quiet) shellToast(`Could not move “${label}” to the trash.`);
|
|
717
|
+
return { ok: false, error, network: true };
|
|
705
718
|
}
|
|
706
719
|
},
|
|
707
720
|
[loadTree]
|
|
@@ -710,7 +723,7 @@ export function useTabs({
|
|
|
710
723
|
// Plan T17 — rename a folder: a move to a new name in the same parent (one
|
|
711
724
|
// dir.move action in accepted mode, carrying every canvas inside).
|
|
712
725
|
const renameFolderReq = useCallback(
|
|
713
|
-
async (dirPath, name) => {
|
|
726
|
+
async (dirPath, name, opts = {}) => {
|
|
714
727
|
const parent = dirPath.split('/').slice(0, -1).join('/');
|
|
715
728
|
try {
|
|
716
729
|
const r = await fetch('/_api/fs-move', {
|
|
@@ -720,8 +733,9 @@ export function useTabs({
|
|
|
720
733
|
});
|
|
721
734
|
const j = await r.json().catch(() => ({}));
|
|
722
735
|
if (!r.ok || !j.ok) {
|
|
723
|
-
|
|
724
|
-
|
|
736
|
+
const error = j.error || `error ${r.status}`;
|
|
737
|
+
if (!opts.quiet) shellToast(`Could not rename folder: ${error}`);
|
|
738
|
+
return { ok: false, status: r.status, error };
|
|
725
739
|
}
|
|
726
740
|
// #124 — the renamed folder keeps its open state (and its subfolders').
|
|
727
741
|
const designRel = (cfg?.designRel || cfg?.designRoot || '.design').replace(
|
|
@@ -731,8 +745,19 @@ export function useTabs({
|
|
|
731
745
|
const toDir = typeof j.toRel === 'string' ? `${designRel}/${j.toRel}` : `${parent}/${name}`;
|
|
732
746
|
updateTreeExp((st) => remapDirPrefix(st, dirPath, toDir));
|
|
733
747
|
await loadTree();
|
|
748
|
+
// an open canvas inside the folder follows it (its tab would otherwise point at the old path)
|
|
749
|
+
const from = `${dirPath}/`;
|
|
750
|
+
const follow = (p) =>
|
|
751
|
+
typeof p === 'string' && p.startsWith(from) ? `${toDir}/${p.slice(from.length)}` : p;
|
|
752
|
+
setTabs((prev) =>
|
|
753
|
+
prev.map((t) => (t.path?.startsWith(from) ? { ...t, path: follow(t.path) } : t))
|
|
754
|
+
);
|
|
755
|
+
setActivePath((prev) => follow(prev));
|
|
756
|
+
return { ok: true };
|
|
734
757
|
} catch (e) {
|
|
735
|
-
|
|
758
|
+
const error = e instanceof Error ? e.message : 'network error';
|
|
759
|
+
if (!opts.quiet) shellToast(`Rename failed: ${error}`);
|
|
760
|
+
return { ok: false, error, network: true };
|
|
736
761
|
}
|
|
737
762
|
},
|
|
738
763
|
[loadTree, cfg, updateTreeExp]
|
|
@@ -754,7 +779,7 @@ export function useTabs({
|
|
|
754
779
|
if (!r.ok || !j.ok) {
|
|
755
780
|
const error = j.error || `error ${r.status}`;
|
|
756
781
|
if (!opts.quiet) shellToast(`Could not rename: ${error}`);
|
|
757
|
-
return { ok: false, error };
|
|
782
|
+
return { ok: false, status: r.status, error };
|
|
758
783
|
}
|
|
759
784
|
const designRel = (cfg?.designRel || cfg?.designRoot || '.design').replace(
|
|
760
785
|
/^\/+|\/+$/g,
|
|
@@ -769,7 +794,7 @@ export function useTabs({
|
|
|
769
794
|
} catch (e) {
|
|
770
795
|
const error = e instanceof Error ? e.message : 'network error';
|
|
771
796
|
if (!opts.quiet) shellToast(`Rename failed: ${error}`);
|
|
772
|
-
return { ok: false, error };
|
|
797
|
+
return { ok: false, error, network: true };
|
|
773
798
|
}
|
|
774
799
|
},
|
|
775
800
|
[loadTree, cfg]
|
|
@@ -802,22 +827,26 @@ export function useTabs({
|
|
|
802
827
|
[loadTree]
|
|
803
828
|
);
|
|
804
829
|
|
|
830
|
+
// #195 — asked first in the tree's own dialog (never `window.confirm`, a no-op in WKWebView).
|
|
805
831
|
const deleteFileReq = useCallback(
|
|
806
|
-
async (filePath, name) => {
|
|
807
|
-
if (!window.confirm(`Move “${name}” to trash?\n\nYou can restore it from .design/_trash/.`))
|
|
808
|
-
return;
|
|
832
|
+
async (filePath, name, opts = {}) => {
|
|
809
833
|
try {
|
|
810
834
|
const r = await fetch(`/_api/canvas?file=${encodeURIComponent(filePath)}`, {
|
|
811
835
|
method: 'DELETE',
|
|
812
836
|
});
|
|
813
837
|
const j = await r.json().catch(() => ({}));
|
|
814
838
|
if (!r.ok || !j.ok) {
|
|
815
|
-
|
|
816
|
-
|
|
839
|
+
const error = j.error || `error ${r.status}`;
|
|
840
|
+
if (!opts.quiet) shellToast(`Could not move “${name}” to the trash. ${error}`);
|
|
841
|
+
return { ok: false, status: r.status, error };
|
|
817
842
|
}
|
|
818
843
|
await loadTree();
|
|
844
|
+
shellToast(`“${name}” moved to the trash.`, true);
|
|
845
|
+
return { ok: true };
|
|
819
846
|
} catch (e) {
|
|
820
|
-
|
|
847
|
+
const error = e instanceof Error ? e.message : 'network error';
|
|
848
|
+
if (!opts.quiet) shellToast(`Could not move “${name}” to the trash.`);
|
|
849
|
+
return { ok: false, error, network: true };
|
|
821
850
|
}
|
|
822
851
|
},
|
|
823
852
|
[loadTree]
|
|
@@ -6,6 +6,7 @@ export function createIndexLoader<T>({
|
|
|
6
6
|
retryDelayMs = 500,
|
|
7
7
|
maxRetryDelayMs = 5000,
|
|
8
8
|
timeoutMs = 10000,
|
|
9
|
+
maxTimeoutMs = 120000,
|
|
9
10
|
}: {
|
|
10
11
|
read: (signal: AbortSignal) => Promise<T>;
|
|
11
12
|
apply: (value: T) => void;
|
|
@@ -13,10 +14,18 @@ export function createIndexLoader<T>({
|
|
|
13
14
|
retryDelayMs?: number;
|
|
14
15
|
maxRetryDelayMs?: number;
|
|
15
16
|
timeoutMs?: number;
|
|
17
|
+
maxTimeoutMs?: number;
|
|
16
18
|
}) {
|
|
17
19
|
let disposed = false;
|
|
18
20
|
let dirty = false;
|
|
19
21
|
let failures = 0;
|
|
22
|
+
// #204 — a large index on a small cell answered after the fixed timeout, so it was aborted and
|
|
23
|
+
// asked again forever (each retry another full build on the server). Each timeout in a row
|
|
24
|
+
// doubles the next one's patience, up to `maxTimeoutMs`; any answer resets it.
|
|
25
|
+
let timeoutsInARow = 0;
|
|
26
|
+
// #204 — nothing drawn yet: the first answer is drawn even if a refresh is already queued behind
|
|
27
|
+
// it (a materialising project asks for one per arriving file, so "only the freshest" was never).
|
|
28
|
+
let appliedOnce = false;
|
|
20
29
|
let pending: Promise<void> | null = null;
|
|
21
30
|
let retryTimer: ReturnType<typeof setTimeout> | undefined;
|
|
22
31
|
let controller: AbortController | undefined;
|
|
@@ -30,15 +39,26 @@ export function createIndexLoader<T>({
|
|
|
30
39
|
cancelRetry();
|
|
31
40
|
const current = new AbortController();
|
|
32
41
|
controller = current;
|
|
33
|
-
|
|
42
|
+
let timedOut = false;
|
|
43
|
+
const patience = Math.min(maxTimeoutMs, timeoutMs * 2 ** Math.min(timeoutsInARow, 10));
|
|
44
|
+
const timeout = setTimeout(() => {
|
|
45
|
+
timedOut = true;
|
|
46
|
+
current.abort();
|
|
47
|
+
}, patience);
|
|
34
48
|
try {
|
|
35
49
|
const value = await read(current.signal);
|
|
50
|
+
timeoutsInARow = 0;
|
|
36
51
|
// A mutation/refresh requested a newer index during this read. Do not
|
|
37
|
-
// briefly restore the older tree; the next request serves all waiters
|
|
38
|
-
|
|
52
|
+
// briefly restore the older tree; the next request serves all waiters —
|
|
53
|
+
// unless there is no tree at all yet (#204): then this one is drawn.
|
|
54
|
+
if (!disposed && (!dirty || !appliedOnce)) {
|
|
55
|
+
apply(value);
|
|
56
|
+
appliedOnce = true;
|
|
57
|
+
}
|
|
39
58
|
failures = 0;
|
|
40
59
|
} catch (error) {
|
|
41
60
|
if (disposed) return;
|
|
61
|
+
if (timedOut) timeoutsInARow++;
|
|
42
62
|
onError(error);
|
|
43
63
|
const status = (error as { status?: number } | null)?.status;
|
|
44
64
|
if (status == null || status === 408 || status === 429 || status >= 500) {
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
UserMessage,
|
|
45
45
|
} from '../v2/ai/Feed.jsx';
|
|
46
46
|
import { RunSurface } from '../v2/ai/RunSurface.jsx';
|
|
47
|
+
import { BackgroundStrip } from '../v2/ai/BackgroundStrip.jsx';
|
|
47
48
|
import { useChatRuns } from '../v2/ai/use-chat-runs.js';
|
|
48
49
|
import { cleanChatTitle, runTitleFor, shownChatTitle } from '../v2/ai/chat-list-model.js';
|
|
49
50
|
import { useAiRuns } from '../v2/ai/runs-store.js';
|
|
@@ -60,6 +61,7 @@ import { WaitingCards } from '../v2/ai/WaitingCard.jsx';
|
|
|
60
61
|
import { useAttachments } from '../v2/ai/use-attachments.js';
|
|
61
62
|
import { notify } from '../../notifications.tsx';
|
|
62
63
|
import { DEFAULT_TRANSCRIPT_VIEW, TRANSCRIPT_VIEWS } from './transcript-view.js';
|
|
64
|
+
import { createFinishTracker } from './chat-finish.js';
|
|
63
65
|
|
|
64
66
|
// DDR-185 — shared "did a genuinely new item arrive" check for the
|
|
65
67
|
// permission/elicitation effects below: both need the identical shape (diff
|
|
@@ -472,6 +474,8 @@ function ChatThread({
|
|
|
472
474
|
<StoppedDivider chatId={chatId} hidden={hidden} />
|
|
473
475
|
<JumpToLatest hidden={hidden} />
|
|
474
476
|
</ThreadPrimitive.Viewport>
|
|
477
|
+
{/* Issue #177 — subagents and commands AI left running after its reply, with their time. */}
|
|
478
|
+
<BackgroundStrip conn={conn} />
|
|
475
479
|
<WaitingCards chatId={chatId} designRel={designRel} />
|
|
476
480
|
{/* S5.13 — the open question, a failure, or the kept prompt's line (client/v2/ai/NeedsYouSlot.jsx):
|
|
477
481
|
a permission waits here, inline, never modal. */}
|
|
@@ -703,44 +707,25 @@ export default function ChatPanel({
|
|
|
703
707
|
// (claude-agent-acp #773). Track live tool activity so the menubar
|
|
704
708
|
// badge/dot + the "finished" ping reflect TRUE quiescence, not the
|
|
705
709
|
// premature turn-end. (RCA issue-acp-subagent-activity-invisible.)
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
cbRef.current.onFinished?.();
|
|
722
|
-
refreshChats();
|
|
723
|
-
}
|
|
724
|
-
});
|
|
725
|
-
conn.onBusy((busy) => {
|
|
726
|
-
busyNow = busy;
|
|
727
|
-
syncAggregate();
|
|
728
|
-
if (busy) {
|
|
729
|
-
deferredFinish = false; // a new turn supersedes any pending drain ping
|
|
730
|
-
setBusyChats((prev) => ({ ...prev, [chatId]: true })); // reactive dot
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
// Turn ended. If background work is still draining, keep the dot lit and
|
|
734
|
-
// hold the "finished" ping until the activity list empties (onActivity).
|
|
735
|
-
if (bgActive) {
|
|
736
|
-
deferredFinish = true;
|
|
737
|
-
refreshChats();
|
|
738
|
-
} else {
|
|
739
|
-
setBusyChats((prev) => ({ ...prev, [chatId]: false }));
|
|
740
|
-
cbRef.current.onFinished?.();
|
|
741
|
-
refreshChats();
|
|
742
|
-
}
|
|
710
|
+
// Issue #177 — and the background tasks Claude Code reports (a subagent, a command left
|
|
711
|
+
// running), which outlive even their own tool call: they keep the dot lit and hold the ping too.
|
|
712
|
+
// When the chat counts as finished lives in chat-finish.js: only a busy → not-busy change is
|
|
713
|
+
// the end of a turn (the subscribe-time replay of an idle chat is not), and background work
|
|
714
|
+
// holds the ping until it drains.
|
|
715
|
+
const finish = createFinishTracker({
|
|
716
|
+
aggregate: (busy) => {
|
|
717
|
+
const wasAny = [...busyRef.current.values()].some(Boolean);
|
|
718
|
+
busyRef.current.set(chatId, busy);
|
|
719
|
+
const nowAny = [...busyRef.current.values()].some(Boolean);
|
|
720
|
+
if (wasAny !== nowAny) cbRef.current.onBusyChange?.(nowAny);
|
|
721
|
+
},
|
|
722
|
+
dot: (on) => setBusyChats((prev) => ({ ...prev, [chatId]: on })),
|
|
723
|
+
finished: () => cbRef.current.onFinished?.(),
|
|
724
|
+
refresh: () => refreshChats(),
|
|
743
725
|
});
|
|
726
|
+
conn.onActivity((activeTools) => finish.activity(activeTools));
|
|
727
|
+
conn.onBackgroundTasks((tasks) => finish.tasks(tasks));
|
|
728
|
+
conn.onBusy((busy) => finish.busy(busy));
|
|
744
729
|
return conn;
|
|
745
730
|
},
|
|
746
731
|
[refreshChats]
|