@spzxg/cli-ui 0.6.13 → 0.6.18
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/CHANGELOG.md +108 -2
- package/README.md +140 -7
- package/dist/{cli-ui-embed-CXaGT9e4.js → cli-ui-embed-Dsw7A8BQ.js} +20333 -19872
- package/dist/{cli-ui-index-bMQJjEBW.js → cli-ui-index-CHFgaDHY.js} +2 -2
- package/dist/{cli-ui-jszip.min-D_w3a6AF.js → cli-ui-jszip.min-DDRprLiN.js} +1 -1
- package/dist/{cli-ui-jszip.min-AMeWMDT5.js → cli-ui-jszip.min-Dw9DMuD5.js} +2 -2
- package/dist/{cli-ui-xlsx-DMzew4IO.js → cli-ui-xlsx-BUG2_Azh.js} +1 -1
- package/dist/cli-ui.css +1 -1
- package/dist/cli-ui.js +1 -1
- package/package.json +1 -1
- package/src/board/BrowserPane.tsx +93 -30
- package/src/board/ChangesPane.tsx +86 -62
- package/src/board/CliBoard.tsx +65 -30
- package/src/board/FileViewer.tsx +49 -13
- package/src/board/context.ts +38 -7
- package/src/board/diffLines.ts +46 -0
- package/src/board/diffRefresh.ts +63 -0
- package/src/board/fileDiff.tsx +117 -0
- package/src/board/fileKind.ts +5 -3
- package/src/board/fileScope.ts +4 -2
- package/src/board/fileWatch.ts +59 -9
- package/src/board/linkage.ts +68 -0
- package/src/board/pathResolve.ts +108 -0
- package/src/board/useBoardUpload.tsx +7 -7
- package/src/board/workspace.ts +7 -1
- package/src/chat/CliChat.tsx +197 -216
- package/src/chat/Composer.tsx +10 -9
- package/src/chat/queueEdit.ts +27 -0
- package/src/components.tsx +2 -2
- package/src/core/blocks.ts +4 -1
- package/src/core/client.ts +86 -9
- package/src/core/config.ts +1 -1
- package/src/core/conversation.ts +23 -5
- package/src/core/documentUpload.ts +22 -5
- package/src/core/provider.tsx +14 -8
- package/src/core/store.ts +307 -63
- package/src/core/types.ts +49 -0
- package/src/elements.tsx +8 -5
- package/src/msglist/CliMsgList.tsx +30 -9
- package/src/operator/node/AgentConnect.tsx +28 -29
- package/src/operator/node/AppearancePanel.tsx +1 -1
- package/src/operator/node/BranchHistory.tsx +11 -7
- package/src/operator/node/BranchNavigator.tsx +1 -1
- package/src/operator/node/BrowserPane.tsx +7 -7
- package/src/operator/node/Chat.tsx +53 -272
- package/src/operator/node/CommandPalette.tsx +1 -1
- package/src/operator/node/Composer.tsx +13 -6
- package/src/operator/node/Layout.tsx +1 -1
- package/src/operator/node/Markdown.tsx +6 -36
- package/src/operator/node/Modal.tsx +1 -1
- package/src/operator/node/OnboardingWizard.tsx +11 -9
- package/src/operator/node/Orchestrator.tsx +18 -8
- package/src/operator/node/ProjectLanding.tsx +1 -1
- package/src/operator/node/ProjectsColumn.tsx +1 -1
- package/src/operator/node/ProviderAuth.tsx +16 -16
- package/src/operator/node/RunSwitch.tsx +1 -1
- package/src/operator/node/Services.tsx +1 -1
- package/src/operator/node/SessionRail.tsx +55 -19
- package/src/operator/node/SessionView.tsx +18 -16
- package/src/operator/node/SettingsView.tsx +1 -1
- package/src/operator/node/TaskBoard.tsx +1 -1
- package/src/operator/node/TaskChanges.tsx +83 -108
- package/src/operator/node/TaskHero.tsx +5 -5
- package/src/operator/node/TasksColumn.tsx +1 -1
- package/src/operator/node/Transcript.tsx +15 -250
- package/src/operator/node/Welcome.tsx +1 -1
- package/src/operator/node/WorktreePrune.tsx +1 -1
- package/src/operator/node/api.ts +17 -0
- package/src/operator/node/boardBackend.ts +4 -1
- package/src/operator/node/boardEvents.ts +17 -3
- package/src/operator/node/boardInteraction.ts +7 -4
- package/src/operator/node/boardState.ts +23 -14
- package/src/operator/node/composerDraft.ts +22 -0
- package/src/operator/node/fileLinks.ts +4 -38
- package/src/operator/node/format.ts +13 -104
- package/src/operator/node/github.tsx +14 -14
- package/src/operator/node/liveStream.ts +47 -6
- package/src/operator/node/modals.tsx +59 -22
- package/src/operator/node/recheckOnReturn.ts +28 -0
- package/src/operator/node/shared.tsx +10 -50
- package/src/operator/node/types.ts +9 -0
- package/src/operator/node/useOrchestrator.ts +9 -8
- package/src/operator/node/useRecaps.ts +15 -4
- package/src/operator/node/useTaskStream.ts +2 -2
- package/src/operator.base.css +9 -4
- package/src/operator.css +9 -4
- package/src/styles.css +22 -8
- package/src/ui/Markdown.tsx +42 -21
- package/src/ui/Popover.tsx +1 -1
- package/src/ui/QueuedMessages.tsx +58 -15
- package/src/ui/SubagentChat.tsx +42 -6
- package/src/ui/Transcript.tsx +19 -14
- package/src/ui/fileLinks.ts +6 -3
- package/src/ui/format.ts +27 -9
- package/src/ui/icons.tsx +2 -0
- package/src/ui/shared.tsx +11 -7
- package/src/ui/transcriptModel.ts +40 -9
- package/src/ui/useTranscriptWindow.ts +253 -0
- package/src/operator/node/icons.tsx +0 -88
- package/src/operator/node/transcriptModel.ts +0 -129
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Skel, ErrNote } from "./shared";
|
|
5
|
+
import { FileDiff, useLazyPatches } from "../../board/fileDiff";
|
|
6
|
+
import type { DiffFile } from "../../core/types";
|
|
7
|
+
import { useDiffRefreshSignal } from "../../board/diffRefresh";
|
|
8
|
+
import { observeLiveMessages } from "./liveStream";
|
|
9
|
+
import { getOperatorBoardBackend } from "./boardBackend";
|
|
5
10
|
|
|
6
|
-
interface DiffFile {
|
|
7
|
-
path: string;
|
|
8
|
-
status: string;
|
|
9
|
-
additions: number;
|
|
10
|
-
deletions: number;
|
|
11
|
-
binary: boolean;
|
|
12
|
-
patch: string;
|
|
13
|
-
truncated?: boolean;
|
|
14
|
-
}
|
|
15
11
|
interface DiffResp {
|
|
16
12
|
isolated: boolean;
|
|
13
|
+
summary?: boolean;
|
|
17
14
|
reason?: string;
|
|
18
15
|
branch?: string;
|
|
19
16
|
baseLabel?: string;
|
|
@@ -59,91 +56,14 @@ const mergeJson = (r: Response): Promise<MergeResp> =>
|
|
|
59
56
|
// previous diff instantly and revalidates in the background.
|
|
60
57
|
const diffCache = new Map<string, DiffResp>();
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function hunkLines(patch: string): string[] {
|
|
65
|
-
const lines = patch.split("\n");
|
|
66
|
-
const i = lines.findIndex((l) => l.startsWith("@@"));
|
|
67
|
-
return i >= 0 ? lines.slice(i) : [];
|
|
68
|
-
}
|
|
69
|
-
function lineClass(line: string): string {
|
|
70
|
-
if (line.startsWith("@@")) return "hunk";
|
|
71
|
-
if (line.startsWith("+") && !line.startsWith("+++")) return "add";
|
|
72
|
-
if (line.startsWith("-") && !line.startsWith("---")) return "del";
|
|
73
|
-
return "";
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Files past this many hunk lines start collapsed: a diff with many files near
|
|
77
|
-
// the per-file patch cap would otherwise mount tens of thousands of line divs
|
|
78
|
-
// in one commit and jank the main thread when the rail opens.
|
|
79
|
-
const COLLAPSE_LINES = 400;
|
|
80
|
-
|
|
81
|
-
// One file section. Memoized so the scroll tracker's setActive (which fires on
|
|
82
|
-
// every scroll frame) re-renders only the overview list, not every hunk line
|
|
83
|
-
// of every file.
|
|
84
|
-
const FileDiff = memo(function FileDiff({
|
|
85
|
-
file: f,
|
|
86
|
-
userToggled,
|
|
87
|
-
onToggle,
|
|
88
|
-
refs,
|
|
89
|
-
}: {
|
|
90
|
-
file: DiffFile;
|
|
91
|
-
userToggled: boolean; // user flipped this file away from its default state
|
|
92
|
-
onToggle: (path: string) => void;
|
|
93
|
-
refs: { current: Record<string, HTMLDivElement | null> };
|
|
94
|
-
}) {
|
|
95
|
-
const lines = useMemo(() => (f.binary ? [] : hunkLines(f.patch)), [f]);
|
|
96
|
-
const big = lines.length > COLLAPSE_LINES;
|
|
97
|
-
const isCollapsed = userToggled ? !big : big;
|
|
98
|
-
// Accurate placeholder height for content-visibility while the section is
|
|
99
|
-
// offscreen-unrendered (header ≈34px, hunk lines 12px × 1.55 line-height),
|
|
100
|
-
// so offsetTop-based jump/scroll-spy stay truthful. `auto` pins the real
|
|
101
|
-
// size once rendered.
|
|
102
|
-
const est = Math.round(34 + (isCollapsed ? 38 : Math.max(1, lines.length) * 18.6));
|
|
103
|
-
return (
|
|
104
|
-
<div
|
|
105
|
-
className="tc-file"
|
|
106
|
-
style={{ containIntrinsicSize: `auto ${est}px` }}
|
|
107
|
-
ref={(el) => { refs.current[f.path] = el; }}
|
|
108
|
-
>
|
|
109
|
-
<button className="tc-fhead" onClick={() => onToggle(f.path)}>
|
|
110
|
-
<span className={`tc-chev ${isCollapsed ? "" : "open"}`}>▸</span>
|
|
111
|
-
<span className={`tc-st s-${f.status === "?" ? "new" : f.status}`}>{f.status}</span>
|
|
112
|
-
<span className="tc-fpath">{f.path}</span>
|
|
113
|
-
<span className="tc-cnt">
|
|
114
|
-
<b className="add">+{f.additions}</b> <b className="del">−{f.deletions}</b>
|
|
115
|
-
</span>
|
|
116
|
-
</button>
|
|
117
|
-
{isCollapsed ? (
|
|
118
|
-
// A big file collapsed by default still needs to say why it's empty.
|
|
119
|
-
big && (
|
|
120
|
-
<button className="tc-bigdiff" onClick={() => onToggle(f.path)}>
|
|
121
|
-
大型 diff({lines.length.toLocaleString()} 行)—— 点击展开
|
|
122
|
-
</button>
|
|
123
|
-
)
|
|
124
|
-
) : (
|
|
125
|
-
<div className="tc-hunks">
|
|
126
|
-
{f.binary ? (
|
|
127
|
-
<div className="tc-empty">二进制文件 —— 不予显示</div>
|
|
128
|
-
) : lines.length === 0 ? (
|
|
129
|
-
<div className="tc-empty">没有文本改动(仅权限或重命名)。</div>
|
|
130
|
-
) : (
|
|
131
|
-
lines.map((ln, i) => (
|
|
132
|
-
<div key={i} className={`dl ${lineClass(ln)}`}>
|
|
133
|
-
{ln || " "}
|
|
134
|
-
</div>
|
|
135
|
-
))
|
|
136
|
-
)}
|
|
137
|
-
{f.truncated && <div className="tc-empty">… 文件 diff 已截断</div>}
|
|
138
|
-
</div>
|
|
139
|
-
)}
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
});
|
|
59
|
+
/** 几个刷新信号挤在一起时(节点 turn_end + 运行状态变成空闲)合成一次读:diff 在节点上要跑一组 git 命令。 */
|
|
60
|
+
const REFRESH_COALESCE_MS = 250;
|
|
143
61
|
|
|
144
62
|
export default function TaskChanges({
|
|
145
63
|
taskId,
|
|
146
64
|
running,
|
|
65
|
+
readOnly = false,
|
|
66
|
+
refreshKey = 0,
|
|
147
67
|
prUrl,
|
|
148
68
|
onMerged,
|
|
149
69
|
onPrCreated,
|
|
@@ -151,6 +71,9 @@ export default function TaskChanges({
|
|
|
151
71
|
}: {
|
|
152
72
|
taskId: string;
|
|
153
73
|
running?: boolean;
|
|
74
|
+
readOnly?: boolean;
|
|
75
|
+
/** 工作区文件有变化(看板的文件事件):节流重读。 */
|
|
76
|
+
refreshKey?: number;
|
|
154
77
|
prUrl?: string; // GitHub PR already opened from this branch ("" / undefined = none)
|
|
155
78
|
onMerged?: () => void;
|
|
156
79
|
onPrCreated?: (url: string) => void;
|
|
@@ -173,19 +96,41 @@ export default function TaskChanges({
|
|
|
173
96
|
const scrollRef = useRef<HTMLDivElement>(null);
|
|
174
97
|
const secRefs = useRef<Record<string, HTMLDivElement | null>>({});
|
|
175
98
|
|
|
99
|
+
const etag = useRef<{ taskId: string; value: string } | null>(null);
|
|
100
|
+
const requestId = useRef(0);
|
|
101
|
+
const request = useRef<AbortController | null>(null);
|
|
176
102
|
const load = useCallback(async () => {
|
|
103
|
+
const id = ++requestId.current;
|
|
104
|
+
request.current?.abort();
|
|
105
|
+
const controller = new AbortController(); request.current = controller;
|
|
177
106
|
setLoading(true);
|
|
178
107
|
try {
|
|
179
|
-
const
|
|
180
|
-
const
|
|
108
|
+
const tag = etag.current?.taskId === taskId ? etag.current.value : undefined;
|
|
109
|
+
const r = await fetch(`/api/tasks/${taskId}/diff?summary=1`, {
|
|
110
|
+
cache: "no-store", signal: controller.signal, headers: tag ? { "If-None-Match": tag } : {},
|
|
111
|
+
});
|
|
112
|
+
if (controller.signal.aborted || id !== requestId.current) return;
|
|
113
|
+
if (r.status === 304) return;
|
|
114
|
+
// Old nodes ignore summary and return a full diff; keep rendering it as before.
|
|
115
|
+
const j = (await r.json().catch(() => null)) as DiffResp | null;
|
|
116
|
+
if (controller.signal.aborted || id !== requestId.current) return;
|
|
117
|
+
if (!j || typeof j !== "object") throw new Error(`读取改动失败:节点返回的不是数据(HTTP ${r.status}),可能是登录页或代理错误页,请刷新页面后重试`);
|
|
118
|
+
const nextTag = r.headers.get("etag");
|
|
119
|
+
etag.current = !j.error && nextTag ? { taskId, value: nextTag } : null;
|
|
181
120
|
if (!j.error) diffCache.set(taskId, j); // errors are worth retrying, not replaying
|
|
182
121
|
setData(j);
|
|
183
122
|
} catch (e) {
|
|
123
|
+
if (controller.signal.aborted || id !== requestId.current) return;
|
|
124
|
+
etag.current = null; // The error replaces data: a retry must obtain a body, not 304.
|
|
184
125
|
setData({ isolated: false, files: [], isDirty: false, ahead: 0, error: e instanceof Error ? e.message : String(e) });
|
|
185
126
|
} finally {
|
|
186
|
-
setLoading(false);
|
|
127
|
+
if (!controller.signal.aborted && id === requestId.current) setLoading(false);
|
|
187
128
|
}
|
|
188
129
|
}, [taskId]);
|
|
130
|
+
const fetchFile = useCallback((path: string, signal: AbortSignal) =>
|
|
131
|
+
getOperatorBoardBackend().diffFile!(taskId, path, { signal }), [taskId]);
|
|
132
|
+
const lazy = !!data?.summary;
|
|
133
|
+
const { patches, retry } = useLazyPatches({ files: data?.files, lazy, toggled, fetchFile });
|
|
189
134
|
|
|
190
135
|
useEffect(() => {
|
|
191
136
|
setMergeRes(null);
|
|
@@ -196,17 +141,39 @@ export default function TaskChanges({
|
|
|
196
141
|
// Task switched without a remount: show the new task's cached diff (or the
|
|
197
142
|
// skeleton), never the previous task's stale files, while we revalidate.
|
|
198
143
|
setData(diffCache.get(taskId) ?? null);
|
|
199
|
-
load();
|
|
144
|
+
void load();
|
|
145
|
+
return () => { requestId.current++; request.current?.abort(); };
|
|
200
146
|
}, [taskId, load]);
|
|
201
147
|
|
|
202
|
-
// The diff moves while the agent works
|
|
203
|
-
//
|
|
204
|
-
//
|
|
148
|
+
// The diff moves while the agent works. Refresh from events only (no polling), with the
|
|
149
|
+
// same rules as the center board (useDiffRefreshSignal):
|
|
150
|
+
// · every node round end (turn_end on the task's live stream — queued messages can keep
|
|
151
|
+
// `running` true across rounds, so running→idle alone misses them) and running→idle;
|
|
152
|
+
// · a finished tool (tool_result: it may have written files) or a workspace file event —
|
|
153
|
+
// throttled to one read per DIFF_LIVE_GAP_MS, always one more after the last change;
|
|
154
|
+
// · signals that arrive while the page is hidden are replayed once when it is shown again.
|
|
155
|
+
// Mount already loads. The live observer rides the existing task stream; it opens nothing.
|
|
156
|
+
const [settle, setSettle] = useState(0);
|
|
157
|
+
const [toolRuns, setToolRuns] = useState(0);
|
|
158
|
+
useEffect(() => observeLiveMessages(`/api/tasks/${taskId}/messages`, (raw) => {
|
|
159
|
+
let type: unknown;
|
|
160
|
+
try { type = (JSON.parse(raw) as { type?: unknown } | null)?.type; } catch { return; }
|
|
161
|
+
if (type === "turn_end") setSettle((n) => n + 1);
|
|
162
|
+
else if (type === "tool_result") setToolRuns((n) => n + 1);
|
|
163
|
+
}), [taskId]);
|
|
205
164
|
const wasRunning = useRef(running);
|
|
206
165
|
useEffect(() => {
|
|
207
|
-
if (wasRunning.current && !running)
|
|
166
|
+
if (wasRunning.current && !running) setSettle((n) => n + 1);
|
|
208
167
|
wasRunning.current = running;
|
|
209
|
-
}, [running
|
|
168
|
+
}, [running]);
|
|
169
|
+
const signal = useDiffRefreshSignal(settle, toolRuns + refreshKey);
|
|
170
|
+
const lastSignal = useRef(signal);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if (lastSignal.current === signal) return;
|
|
173
|
+
lastSignal.current = signal;
|
|
174
|
+
const timer = setTimeout(() => { void load(); }, REFRESH_COALESCE_MS);
|
|
175
|
+
return () => clearTimeout(timer);
|
|
176
|
+
}, [signal, load]);
|
|
210
177
|
|
|
211
178
|
// Track which file is at the top of the scroll area to highlight it in the list.
|
|
212
179
|
useEffect(() => {
|
|
@@ -234,6 +201,7 @@ export default function TaskChanges({
|
|
|
234
201
|
}, [data]);
|
|
235
202
|
|
|
236
203
|
const jump = (path: string) => {
|
|
204
|
+
if (lazy) setToggled((current) => new Set(current).add(path));
|
|
237
205
|
const el = secRefs.current[path];
|
|
238
206
|
const sc = scrollRef.current;
|
|
239
207
|
if (!el || !sc) return;
|
|
@@ -262,6 +230,7 @@ export default function TaskChanges({
|
|
|
262
230
|
);
|
|
263
231
|
|
|
264
232
|
const doMerge = async () => {
|
|
233
|
+
if (readOnly) return;
|
|
265
234
|
setMerging(true);
|
|
266
235
|
setMergeRes(null);
|
|
267
236
|
try {
|
|
@@ -283,6 +252,7 @@ export default function TaskChanges({
|
|
|
283
252
|
// commits any dirty work first and is idempotent, so a second click on an
|
|
284
253
|
// already-open PR just pushes the new commits to it.
|
|
285
254
|
const doCreatePr = async () => {
|
|
255
|
+
if (readOnly) return;
|
|
286
256
|
setPrBusy(true);
|
|
287
257
|
setPrErr(null);
|
|
288
258
|
try {
|
|
@@ -301,6 +271,7 @@ export default function TaskChanges({
|
|
|
301
271
|
// Fix with AI: prepare the trial merge + stream a resolution turn (handled by
|
|
302
272
|
// the parent so it shows in the transcript), then reload into review state.
|
|
303
273
|
const doResolveWithAI = async () => {
|
|
274
|
+
if (readOnly) return;
|
|
304
275
|
if (!onResolveWithAI) return;
|
|
305
276
|
setResolving(true);
|
|
306
277
|
setManualOpen(false);
|
|
@@ -319,6 +290,7 @@ export default function TaskChanges({
|
|
|
319
290
|
|
|
320
291
|
// Accept a resolution: commit + land the (now clean) branch into the base.
|
|
321
292
|
const doComplete = async () => {
|
|
293
|
+
if (readOnly) return;
|
|
322
294
|
setMerging(true);
|
|
323
295
|
try {
|
|
324
296
|
const r = await fetch(`/api/tasks/${taskId}/merge/complete`, { method: "POST" });
|
|
@@ -335,6 +307,7 @@ export default function TaskChanges({
|
|
|
335
307
|
|
|
336
308
|
// Discard a resolution: abort the trial merge, back to a clean worktree.
|
|
337
309
|
const doAbort = async () => {
|
|
310
|
+
if (readOnly) return;
|
|
338
311
|
setMerging(true);
|
|
339
312
|
try {
|
|
340
313
|
await fetch(`/api/tasks/${taskId}/merge/abort`, { method: "POST" });
|
|
@@ -380,10 +353,12 @@ export default function TaskChanges({
|
|
|
380
353
|
const totalAdd = data.files.reduce((n, f) => n + f.additions, 0);
|
|
381
354
|
const totalDel = data.files.reduce((n, f) => n + f.deletions, 0);
|
|
382
355
|
const nothing = data.files.length === 0;
|
|
383
|
-
// Something to merge if the branch
|
|
356
|
+
// Something to merge if the branch has commits not yet in the base branch, or
|
|
384
357
|
// there are uncommitted edits in the worktree. `alreadyMerged` also catches
|
|
385
358
|
// merges done outside the app, so an already-landed branch won't re-offer.
|
|
386
|
-
|
|
359
|
+
// A fresh task (no commits of its own, nothing uncommitted) has nothing to
|
|
360
|
+
// merge — older nodes reported it as alreadyMerged, newer ones don't.
|
|
361
|
+
const pending = (!data.alreadyMerged && data.ahead > 0) || data.isDirty;
|
|
387
362
|
// A conflict resolution is staged in the worktree, awaiting accept/discard.
|
|
388
363
|
const reviewing = !!data.mergeInProgress;
|
|
389
364
|
|
|
@@ -405,10 +380,10 @@ export default function TaskChanges({
|
|
|
405
380
|
</button>
|
|
406
381
|
{reviewing ? (
|
|
407
382
|
<>
|
|
408
|
-
<button className="tc-btn" onClick={doAbort} disabled={merging || resolving}>
|
|
383
|
+
<button className="tc-btn" onClick={doAbort} disabled={readOnly || merging || resolving}>
|
|
409
384
|
丢弃
|
|
410
385
|
</button>
|
|
411
|
-
<button className="tc-btn primary" onClick={doComplete} disabled={merging || resolving}>
|
|
386
|
+
<button className="tc-btn primary" onClick={doComplete} disabled={readOnly || merging || resolving}>
|
|
412
387
|
{merging ? "合并中…" : "接受并合并"}
|
|
413
388
|
</button>
|
|
414
389
|
</>
|
|
@@ -426,14 +401,14 @@ export default function TaskChanges({
|
|
|
426
401
|
<button
|
|
427
402
|
className="tc-btn"
|
|
428
403
|
onClick={doCreatePr}
|
|
429
|
-
disabled={prBusy || merging}
|
|
404
|
+
disabled={readOnly || prBusy || merging}
|
|
430
405
|
title={prUrl ? "把分支的新提交推送到已打开的 PR" : "把分支推送到 origin 并创建 GitHub PR"}
|
|
431
406
|
>
|
|
432
407
|
{prBusy ? (prUrl ? "推送中…" : "创建 PR 中…") : prUrl ? "更新 PR" : "创建 PR"}
|
|
433
408
|
</button>
|
|
434
409
|
)}
|
|
435
410
|
{pending && (
|
|
436
|
-
<button className="tc-btn primary" onClick={doMerge} disabled={merging || prBusy}>
|
|
411
|
+
<button className="tc-btn primary" onClick={doMerge} disabled={readOnly || merging || prBusy}>
|
|
437
412
|
{merging ? "合并中…" : merged ? "合并新改动" : `合并到 ${data.baseLabel}`}
|
|
438
413
|
</button>
|
|
439
414
|
)}
|
|
@@ -477,7 +452,7 @@ export default function TaskChanges({
|
|
|
477
452
|
手动解决
|
|
478
453
|
</button>
|
|
479
454
|
{onResolveWithAI && (
|
|
480
|
-
<button className="tc-btn primary" onClick={doResolveWithAI} disabled={resolving || merging}>
|
|
455
|
+
<button className="tc-btn primary" onClick={doResolveWithAI} disabled={readOnly || resolving || merging}>
|
|
481
456
|
{resolving ? "解决中…" : "用 AI 解决"}
|
|
482
457
|
</button>
|
|
483
458
|
)}
|
|
@@ -521,7 +496,7 @@ export default function TaskChanges({
|
|
|
521
496
|
|
|
522
497
|
{/* per-file diffs with sticky headers */}
|
|
523
498
|
{data.files.map((f) => (
|
|
524
|
-
<FileDiff key={f.path} file={f} userToggled={toggled.has(f.path)} onToggle={toggle} refs={secRefs} />
|
|
499
|
+
<FileDiff key={f.path} file={f} userToggled={toggled.has(f.path)} onToggle={toggle} refs={secRefs} lazy={lazy} patch={patches[f.path]} onRetry={retry} />
|
|
525
500
|
))}
|
|
526
501
|
</div>
|
|
527
502
|
)}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { Icon } from "
|
|
3
|
+
import { Icon } from "../../ui/icons";
|
|
4
4
|
import { SLABEL, type TaskRow, type ProjectRow } from "./types";
|
|
5
5
|
import { StatusDot } from "./shared";
|
|
6
6
|
|
|
7
|
-
export function TaskHero({ task, project, onStart, onEdit, onSetSendContext, running, blockedBy }: { task: TaskRow; project: ProjectRow; onStart: () => void; onEdit: () => void; onSetSendContext: (v: boolean) => void; running: boolean; blockedBy?: string[] }) {
|
|
7
|
+
export function TaskHero({ task, project, onStart, onEdit, onSetSendContext, running, blockedBy, readOnly = false }: { readOnly?: boolean; task: TaskRow; project: ProjectRow; onStart: () => void; onEdit: () => void; onSetSendContext: (v: boolean) => void; running: boolean; blockedBy?: string[] }) {
|
|
8
8
|
const carried = task.generation > 1;
|
|
9
9
|
const blocked = !!blockedBy?.length && !task.started;
|
|
10
10
|
const sendContext = task.send_context !== 0;
|
|
@@ -24,7 +24,7 @@ export function TaskHero({ task, project, onStart, onEdit, onSetSendContext, run
|
|
|
24
24
|
</div>
|
|
25
25
|
<label style={{ display: "flex", alignItems: "center", gap: 8, fontSize: 12.5, color: "var(--ink-2)", cursor: running ? "not-allowed" : "pointer" }}
|
|
26
26
|
title="取消勾选则不发送已保存的项目上下文。任务详情与编排工具始终会包含在内。">
|
|
27
|
-
<input type="checkbox" checked={sendContext} disabled={running} onChange={(e) => onSetSendContext(e.target.checked)} />
|
|
27
|
+
<input type="checkbox" checked={sendContext} disabled={readOnly || running} onChange={(e) => onSetSendContext(e.target.checked)} />
|
|
28
28
|
向智能体发送已保存的项目上下文
|
|
29
29
|
</label>
|
|
30
30
|
{blocked && (task.auto_start ? (
|
|
@@ -37,10 +37,10 @@ export function TaskHero({ task, project, onStart, onEdit, onSetSendContext, run
|
|
|
37
37
|
</div>
|
|
38
38
|
))}
|
|
39
39
|
<div style={{ display: "flex", gap: 10 }}>
|
|
40
|
-
<button className="btn btn-accent" style={{ height: 38, padding: "0 20px", fontSize: 14 }} onClick={onStart} disabled={running || blocked} title={blocked ? `以下任务完成前受阻:${blockedBy!.join("、")}` : undefined}>
|
|
40
|
+
<button className="btn btn-accent" style={{ height: 38, padding: "0 20px", fontSize: 14 }} onClick={onStart} disabled={readOnly || running || blocked} title={blocked ? `以下任务完成前受阻:${blockedBy!.join("、")}` : undefined}>
|
|
41
41
|
{Icon.play()} {running ? "启动中…" : blocked ? (task.auto_start ? "已排队" : "受阻") : "开始会话"}
|
|
42
42
|
</button>
|
|
43
|
-
<button className="btn btn-line" style={{ height: 38, padding: "0 16px", fontSize: 14 }} onClick={onEdit} disabled={running} title="开始前编辑标题与描述">
|
|
43
|
+
<button className="btn btn-line" style={{ height: 38, padding: "0 16px", fontSize: 14 }} onClick={onEdit} disabled={readOnly || running} title="开始前编辑标题与描述">
|
|
44
44
|
{Icon.edit()} 编辑
|
|
45
45
|
</button>
|
|
46
46
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
-
import { Icon } from "
|
|
4
|
+
import { Icon } from "../../ui/icons";
|
|
5
5
|
import { isAwaiting, relTime } from "./format";
|
|
6
6
|
import { SLABEL, AWAIT_LABEL, SEARCH_MIN, type ProjectRow, type TaskRow, type AgentsBundle, type TaskView } from "./types";
|
|
7
7
|
import { agentLabel } from "./agents";
|