@spzxg/cli-ui 0.6.13 → 0.6.17
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 +100 -2
- package/README.md +131 -7
- package/dist/{cli-ui-embed-CXaGT9e4.js → cli-ui-embed-REq-GvM7.js} +20350 -19892
- package/dist/{cli-ui-index-bMQJjEBW.js → cli-ui-index-p_XTnmsN.js} +2 -2
- package/dist/{cli-ui-jszip.min-D_w3a6AF.js → cli-ui-jszip.min-0mqaiYeK.js} +1 -1
- package/dist/{cli-ui-jszip.min-AMeWMDT5.js → cli-ui-jszip.min-CJa9yrKW.js} +2 -2
- package/dist/{cli-ui-xlsx-DMzew4IO.js → cli-ui-xlsx-BPL7P3mE.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 +62 -27
- 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 +36 -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,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect, useRef } from "react";
|
|
4
|
-
import { Icon } from "
|
|
4
|
+
import { Icon } from "../../ui/icons";
|
|
5
5
|
import { TerminalView, type TermApi } from "./Terminal";
|
|
6
6
|
import { PROJ_W, TASK_W, DEFAULT_LAYOUT } from "./types";
|
|
7
7
|
import { useOrchestrator } from "./useOrchestrator";
|
|
@@ -174,14 +174,24 @@ export default function Orchestrator({ board }: { board?: import("./boardInterac
|
|
|
174
174
|
return () => window.removeEventListener("keydown", onKey);
|
|
175
175
|
});
|
|
176
176
|
|
|
177
|
-
// Server-side time-in-app + retention pulse
|
|
178
|
-
//
|
|
179
|
-
//
|
|
177
|
+
// Server-side time-in-app + retention pulse, driven by the user rather than a
|
|
178
|
+
// timer: ping on load and whenever the user is here — the tab visible again,
|
|
179
|
+
// the window focused, a click or key press — at most once per 2 min. A tab
|
|
180
|
+
// nobody touches stops pinging; the route turns the first ping (or one after
|
|
181
|
+
// a 30 min gap) into app_opened and the rest into heartbeat (app/api/heartbeat).
|
|
180
182
|
useEffect(() => {
|
|
181
|
-
|
|
183
|
+
let last = 0;
|
|
184
|
+
const beat = () => {
|
|
185
|
+
if (document.hidden || Date.now() - last < 120_000) return;
|
|
186
|
+
last = Date.now();
|
|
187
|
+
void fetch("/api/heartbeat", { method: "POST", keepalive: true }).catch(() => {});
|
|
188
|
+
};
|
|
182
189
|
beat();
|
|
183
|
-
const
|
|
184
|
-
|
|
190
|
+
const onVisible = () => { if (document.visibilityState === "visible") beat(); };
|
|
191
|
+
const activity = ["focus", "pointerdown", "keydown"] as const;
|
|
192
|
+
for (const name of activity) window.addEventListener(name, beat, { passive: true });
|
|
193
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
194
|
+
return () => { for (const name of activity) window.removeEventListener(name, beat); document.removeEventListener("visibilitychange", onVisible); };
|
|
185
195
|
}, []);
|
|
186
196
|
|
|
187
197
|
// On a phone only one of these is mounted at a time; on desktop the same
|
|
@@ -566,7 +576,7 @@ export default function Orchestrator({ board }: { board?: import("./boardInterac
|
|
|
566
576
|
{o.editId && o.tasks.find((t) => t.id === o.editId) && (
|
|
567
577
|
<EditTaskModal task={o.tasks.find((t) => t.id === o.editId)!} tasks={o.realTasks} agents={o.agents} onClose={() => o.setEditId(null)} onSave={o.saveTask} onDelete={o.removeTask} onOpenSetup={o.rerunOnboarding} />
|
|
568
578
|
)}
|
|
569
|
-
{o.modal === "context" && project && <ContextModal project={project} agents={o.agents} onSetDefaultAgent={o.setProjectDefaultAgent} onClose={() => o.setModal(null)} onSave={o.saveContext} onDelete={() => o.removeProject(project.id)} onDeprecate={() => o.setDeprecated(project.id, true)} />}
|
|
579
|
+
{o.modal === "context" && project && <ContextModal project={project} agents={o.agents} onSetDefaultAgent={o.setProjectDefaultAgent} onClose={() => o.setModal(null)} onSave={o.saveContext} onDelete={(confirm) => o.removeProject(project.id, confirm)} onDeprecate={() => o.setDeprecated(project.id, true)} />}
|
|
570
580
|
{o.modal === "project" && <NewProjectModal onClose={() => o.setModal(null)} onCreate={o.createProject} />}
|
|
571
581
|
{o.modal === "sessions" && project && (
|
|
572
582
|
<SessionsModal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { Icon } from "
|
|
4
|
+
import { Icon } from "../../ui/icons";
|
|
5
5
|
import { fmtCost, relTime } from "./format";
|
|
6
6
|
import { SEARCH_MIN, type AgentInfo, type ProjectRow } from "./types";
|
|
7
7
|
import { SearchBar } from "./shared";
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
// routes; rendered by AgentConnect when capabilities.supportsProviderAuth.
|
|
8
8
|
|
|
9
9
|
import { useCallback, useEffect, useMemo, useRef, useState, type CSSProperties } from "react";
|
|
10
|
-
import { Icon } from "
|
|
10
|
+
import { Icon } from "../../ui/icons";
|
|
11
11
|
import { jget, jsend } from "./api";
|
|
12
12
|
import type { AgentInfoT, ClaudeVerifyT } from "./types";
|
|
13
13
|
import type { AgentLoginEvent, AgentLoginPrompt, AgentProviderInfo, AgentProviderLogin } from "./protocol/agents/types";
|
|
14
|
+
import { useRecheckOnReturn } from "./recheckOnReturn";
|
|
14
15
|
|
|
15
16
|
// The global .field rules style text/number inputs only; selects and password
|
|
16
17
|
// inputs here get the same look inline instead of widening those shared rules.
|
|
@@ -91,17 +92,16 @@ export function ProviderAuthPanel({ agent, onConnected }: { agent: AgentInfoT; o
|
|
|
91
92
|
}
|
|
92
93
|
}, [agent.connected, agent.id, agent.label, load, onConnected]);
|
|
93
94
|
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}, [login?.status, base]);
|
|
95
|
+
// Re-check while the flow runs — when the user comes back to this tab or presses
|
|
96
|
+
// 检查状态 (useRecheckOnReturn; no polling); finish once it settles. Answers to the
|
|
97
|
+
// flow's prompts return the next state directly.
|
|
98
|
+
const checkLogin = useCallback(() => {
|
|
99
|
+
jget<AgentProviderLogin | null>(`${base}/login`).then((l) => {
|
|
100
|
+
if (!l) { setLogin(null); return; }
|
|
101
|
+
setLogin(l);
|
|
102
|
+
}).catch(() => {});
|
|
103
|
+
}, [base]);
|
|
104
|
+
useRecheckOnReturn(login?.status === "running", checkLogin);
|
|
105
105
|
|
|
106
106
|
useEffect(() => {
|
|
107
107
|
if (login?.status === "success") { setNote({ ok: true, text: `已登录 ${nameOf(login.provider)}。` }); void afterChange(); }
|
|
@@ -292,7 +292,7 @@ export function ProviderAuthPanel({ agent, onConnected }: { agent: AgentInfoT; o
|
|
|
292
292
|
<KeyForm provider={picked} onSave={(input) => saveKey(picked, input)} onCancel={() => setKeyFor(null)} />
|
|
293
293
|
</div>
|
|
294
294
|
)}
|
|
295
|
-
{login && <LoginFlow login={login} name={nameOf(login.provider)} busy={busy === "answer"} onAnswer={answer} onCancel={cancel} onDismiss={() => setLogin(null)} />}
|
|
295
|
+
{login && <LoginFlow login={login} name={nameOf(login.provider)} busy={busy === "answer"} onAnswer={answer} onCancel={cancel} onDismiss={() => setLogin(null)} onCheck={checkLogin} />}
|
|
296
296
|
</div>
|
|
297
297
|
|
|
298
298
|
{/* ---- user-defined endpoints ---- */}
|
|
@@ -393,9 +393,9 @@ function PromptInput({ prompt, busy, onAnswer }: { prompt: AgentLoginPrompt; bus
|
|
|
393
393
|
);
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
function LoginFlow({ login, name, busy, onAnswer, onCancel, onDismiss }: {
|
|
396
|
+
function LoginFlow({ login, name, busy, onAnswer, onCancel, onDismiss, onCheck }: {
|
|
397
397
|
login: AgentProviderLogin; name: string; busy: boolean;
|
|
398
|
-
onAnswer: (p: AgentLoginPrompt, v: string) => void; onCancel: () => void; onDismiss: () => void;
|
|
398
|
+
onAnswer: (p: AgentLoginPrompt, v: string) => void; onCancel: () => void; onDismiss: () => void; onCheck: () => void;
|
|
399
399
|
}) {
|
|
400
400
|
if (login.status === "success") {
|
|
401
401
|
return <div className="wiz-connected" style={{ marginTop: 10 }}><span className="wiz-ok">{Icon.check()}</span><div className="wiz-ok-t">已登录 {name}</div></div>;
|
|
@@ -418,7 +418,7 @@ function LoginFlow({ login, name, busy, onAnswer, onCancel, onDismiss }: {
|
|
|
418
418
|
{login.prompt ? (
|
|
419
419
|
<PromptInput prompt={login.prompt} busy={busy} onAnswer={onAnswer} />
|
|
420
420
|
) : (
|
|
421
|
-
<div className="wiz-verify" style={{ marginTop: 6 }}><span className="wiz-spin" /> <span
|
|
421
|
+
<div className="wiz-verify" style={{ marginTop: 6 }}><span className="wiz-spin" /> <span>等待授权完成…回到这个页面时会自动检查。</span> <button className="linkbtn" onClick={onCheck}>检查状态</button></div>
|
|
422
422
|
)}
|
|
423
423
|
<button className="linkbtn" style={{ marginTop: 10 }} onClick={onCancel}>取消</button>
|
|
424
424
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { Fragment, useState } from "react";
|
|
4
|
-
import { Icon } from "
|
|
4
|
+
import { Icon } from "../../ui/icons";
|
|
5
5
|
import { Popover } from "./shared";
|
|
6
6
|
import { agentLabel, agentStateHint, capsFor } from "./agents";
|
|
7
7
|
import { modelLabel } from "./format";
|
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { subscribeWorkspaceFiles } from "../../board/fileWatch";
|
|
2
|
+
import { notifyWorkspaceFileCreated, subscribeWorkspaceFiles } from "../../board/fileWatch";
|
|
3
3
|
import { retainFileScope } from "../../board/fileScope";
|
|
4
4
|
|
|
5
|
-
import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
|
-
import { Icon } from "
|
|
7
|
+
import { Icon } from "../../ui/icons";
|
|
8
8
|
import TaskChanges, { type ResolveResult } from "./TaskChanges";
|
|
9
9
|
import { BrowserPane } from "./BrowserPane";
|
|
10
10
|
import { fmtTokens } from "./format";
|
|
11
11
|
import { clientFeatures } from "./protocol/features";
|
|
12
12
|
import type { ServiceInfo } from "./protocol/types";
|
|
13
|
-
import type { ProjectRow, TaskRow } from "./types";
|
|
13
|
+
import type { Msg, ProjectRow, TaskRow } from "./types";
|
|
14
14
|
|
|
15
15
|
import { clientId } from "../../core/id";
|
|
16
16
|
import { useBoardState, readBoardState, visitBoardFile, reportBoardState, releaseBoardState, activateBoardState } from "./boardState";
|
|
17
17
|
import type { BoardView } from "../../board/workspace";
|
|
18
|
+
import { withBoardPaths } from "../../board/context";
|
|
19
|
+
import { workspaceFileDirectory } from "../../core/documentUpload";
|
|
18
20
|
import { useBoardPanels } from "../../board/panels";
|
|
19
21
|
import { PanelControls, PanelTab, type InlineBoardLayout } from "../../board/PanelControls";
|
|
20
22
|
import { FilesPane } from "../../board/FilesPane";
|
|
21
23
|
import { FileViewer } from "../../board/FileViewer";
|
|
24
|
+
import { pathHints, resolveMissingPath } from "../../board/pathResolve";
|
|
22
25
|
import { useBoardUpload } from "../../board/useBoardUpload";
|
|
23
26
|
import { getOperatorBoardBackend } from "./boardBackend";
|
|
24
27
|
import { useOperatorContextEvents, useOperatorFileWatch } from "./boardEvents";
|
|
25
28
|
import { OperatorBoardContext, registerOperatorBoard, OperatorBoardQuoteContext } from "./boardInteraction";
|
|
26
29
|
import type { Quote } from "./composerDraft";
|
|
27
30
|
import type { OperatorBoardOptions, OperatorBoardRequest } from "./boardInteraction";
|
|
28
|
-
type OpenFile = { name?: string; reloadKey?:number; taskId: string; path: string; version: number; mtime?: number; size?: number };
|
|
31
|
+
type OpenFile = { name?: string; reloadKey?:number; taskId: string; path: string; version: number; mtime?: number; size?: number; /** Completed from this relative path the agent wrote. */ resolvedFrom?: string };
|
|
29
32
|
const fileKey = (file: Pick<OpenFile,"taskId"|"path">) => `file:${file.taskId}:${file.path}`;
|
|
30
33
|
const LABEL:Record<string,string>={files:"工作区",changes:"改动",context:"上下文",preview:"预览",browser:"浏览器"};
|
|
31
|
-
type Session = { n: number; summaryBefore: string | null };
|
|
34
|
+
type Session = { n: number; summaryBefore: string | null; /** SessionView passes buildSessions(messages): path hints for file completion. */ messages?: Msg[] };
|
|
32
35
|
|
|
33
36
|
// The live URL a project's dev server is reachable at when no registered
|
|
34
37
|
// service reports one — local dev hits the project's stable port directly.
|
|
@@ -89,7 +92,7 @@ function PreviewPane({ project }: { project: ProjectRow }) {
|
|
|
89
92
|
);
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
function ContextPane({ task, sessions, running, onClear }: { task: TaskRow; sessions: Session[]; running: boolean; onClear: () => void }) {
|
|
95
|
+
function ContextPane({ task, sessions, running, onClear, readOnly }: { readOnly?: boolean; task: TaskRow; sessions: Session[]; running: boolean; onClear: () => void }) {
|
|
93
96
|
const pct = Math.min(100, Math.max(0, Math.round(task.context_pct)));
|
|
94
97
|
return (
|
|
95
98
|
<div className="rail-pad">
|
|
@@ -116,14 +119,14 @@ function ContextPane({ task, sessions, running, onClear }: { task: TaskRow; sess
|
|
|
116
119
|
})}
|
|
117
120
|
</div>
|
|
118
121
|
|
|
119
|
-
<button className="btn btn-line ctxw-clear" onClick={onClear} disabled={running || task.started !== 1}>{Icon.clear()} 立即清空上下文</button>
|
|
122
|
+
<button className="btn btn-line ctxw-clear" onClick={onClear} disabled={readOnly || running || task.started !== 1}>{Icon.clear()} 立即清空上下文</button>
|
|
120
123
|
<div className="ctxw-foot">清空会把对话压缩成摘要,并以此开启新的上下文窗口。</div>
|
|
121
124
|
</div>
|
|
122
125
|
);
|
|
123
126
|
}
|
|
124
127
|
|
|
125
128
|
export function SessionRail({ project, task, sessions, running, onResolveWithAI, onMerged, onPrCreated, onClear, onSwitchToChat,
|
|
126
|
-
tabs, availableTabs, defaultTab, autoContext, watchFiles = true, fileWatchIntervalMs, onFilesChange, onFilesWatch, onBoardContextChange, onEvent, openRequest, onRequestHandled, onQuote, inlineLayout, onExpand, visible = true }: OperatorBoardOptions & {
|
|
129
|
+
tabs, availableTabs, defaultTab, autoContext, readOnly = false, watchFiles = true, fileWatchIntervalMs, onFilesChange, onFilesWatch, onBoardContextChange, onEvent, openRequest, onRequestHandled, onQuote, inlineLayout, onExpand, visible = true }: OperatorBoardOptions & {
|
|
127
130
|
project: ProjectRow; task: TaskRow; sessions: Session[]; running: boolean;
|
|
128
131
|
onResolveWithAI: (taskId: string) => Promise<ResolveResult>; onMerged?: () => void;
|
|
129
132
|
onPrCreated?: (url: string) => void; onClear: () => void; onCollapse: () => void; onSwitchToChat: () => void;
|
|
@@ -149,12 +152,26 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
149
152
|
const [files,setFiles]=useState<OpenFile[]>([]);
|
|
150
153
|
const [dir,setDir]=useState('');
|
|
151
154
|
const [folderTask,setFolderTask]=useState(task.id);
|
|
155
|
+
const [workspaceRoots,setWorkspaceRoots]=useState<Record<string,string|undefined>>({});
|
|
152
156
|
const [tick,setTick]=useState(0);
|
|
153
157
|
const callbacks={onFilesChange,onFilesWatch,onBoardContextChange,onEvent};
|
|
154
158
|
useOperatorFileWatch(task.id,watchFiles,parentBoard?{}:callbacks,event=>{setTick(value=>value+1);const paths=new Set(event.changes.map(change=>change.path));setFiles(previous=>previous.map(file=>file.taskId===task.id&&paths.has(file.path)?{...file,version:file.version+1,reloadKey:(file.reloadKey??0)+1}:file));},fileWatchIntervalMs);
|
|
155
159
|
useOperatorContextEvents(task.id,!parentBoard,callbacks);
|
|
156
160
|
|
|
157
161
|
const backend=useMemo(()=>getOperatorBoardBackend(),[]);
|
|
162
|
+
const sessionsRef=useRef(sessions);sessionsRef.current=sessions;
|
|
163
|
+
// Same completion as the center board: hints from this task's own conversation and visited files.
|
|
164
|
+
const resolveMissing=useCallback((path:string,signal:AbortSignal)=>{
|
|
165
|
+
const seen=(readBoardState(task.id)?.history??[]).filter(f=>(f.sourceId??task.id)===task.id).map(f=>f.path);
|
|
166
|
+
return resolveMissingPath(backend,task.id,path,pathHints(sessionsRef.current.flatMap(s=>s.messages??[]),seen),signal);
|
|
167
|
+
},[backend,task.id]);
|
|
168
|
+
const replaceFile=(file:OpenFile,to:string)=>{
|
|
169
|
+
aliases.current.set(fileKey(file),to);
|
|
170
|
+
const id=fileKey({taskId:file.taskId,path:to}),resolvedFrom=file.resolvedFrom??file.path;
|
|
171
|
+
setFiles(previous=>previous.some(f=>fileKey(f)===id)?previous.filter(f=>fileKey(f)!==fileKey(file)):previous.map(f=>fileKey(f)===fileKey(file)?{taskId:file.taskId,path:to,version:0,resolvedFrom}:f));
|
|
172
|
+
visitBoardFile(task.id,{sourceId:file.taskId,path:to});
|
|
173
|
+
setTab(id);
|
|
174
|
+
};
|
|
158
175
|
const [restored,setRestored]=useState(false);
|
|
159
176
|
const storageKey=`cli-ui:operator-files:${task.id}`;
|
|
160
177
|
useEffect(()=>{
|
|
@@ -185,6 +202,16 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
185
202
|
reveal();if(typeof ResizeObserver==='undefined')return;const observer=new ResizeObserver(reveal);if(tabsRef.current)observer.observe(tabsRef.current);return()=>observer.disconnect();
|
|
186
203
|
},[active,shown.length,inlineLayout?.active,inlineLayout?.tabsHost]);
|
|
187
204
|
const file=files.find(f=>fileKey(f)===active);
|
|
205
|
+
const rootSources=JSON.stringify([...new Set([task.id,...files.map(file=>file.taskId),...(boardState?.history??[]).map(file=>file.sourceId??task.id)])].sort());
|
|
206
|
+
useEffect(()=>{
|
|
207
|
+
let alive=true;
|
|
208
|
+
void Promise.all((JSON.parse(rootSources) as string[]).map(async id=>{
|
|
209
|
+
if(id!==task.id&&Object.hasOwn(workspaceRoots,id))return [id,workspaceRoots[id]] as const;
|
|
210
|
+
try{return [id,(await backend.info(id)).workspaceRoot] as const;}catch{return [id,undefined] as const;}
|
|
211
|
+
})).then(entries=>{if(alive)setWorkspaceRoots(previous=>{const next={...previous,...Object.fromEntries(entries)};return JSON.stringify(next)===JSON.stringify(previous)?previous:next;});});
|
|
212
|
+
return()=>{alive=false;};
|
|
213
|
+
},[backend,rootSources,task.started,task.worktree_path]);
|
|
214
|
+
useEffect(()=>{if(file){setFolderTask(file.taskId);setDir(previous=>workspaceFileDirectory(file.path,workspaceRoots[file.taskId])??previous);}},[file?.path,file?.taskId,workspaceRoots[file?.taskId??'']]);
|
|
188
215
|
// Every opened tab participates, including a file from a source task. Only
|
|
189
216
|
// already-read preview ranges are synchronized; closed files are not prefetched.
|
|
190
217
|
const openedScope = JSON.stringify(available.includes('files') ? files.map(({ taskId, path }) => ({ taskId, path })) : []);
|
|
@@ -209,9 +236,13 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
209
236
|
return () => stops.forEach(stop => stop());
|
|
210
237
|
}, [backend, task.id, watchFiles, contentVisible, openedScope, directorySource]);
|
|
211
238
|
const current=useRef(active);current.current=active;
|
|
239
|
+
// A relative path the agent wrote against a subfolder → the existing file it was
|
|
240
|
+
// completed to (board/pathResolve). Clicking the same link again opens that one.
|
|
241
|
+
const aliases=useRef(new Map<string,string>());
|
|
212
242
|
const openFile=(taskId:string,path:string)=>{
|
|
213
243
|
if(!available.includes('files'))return;
|
|
214
|
-
const
|
|
244
|
+
const requested=path.replace(/^\.\//,'').replace(/\/+$/,'');if(!requested)return;
|
|
245
|
+
const clean=aliases.current.get(fileKey({taskId,path:requested}))??requested;
|
|
215
246
|
const id=fileKey({taskId,path:clean});
|
|
216
247
|
activateBoardState(task.id,owner);
|
|
217
248
|
visitBoardFile(task.id,{sourceId:taskId,path:clean});
|
|
@@ -223,9 +254,13 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
223
254
|
return next;
|
|
224
255
|
});setTab(id);inlineRef.current?.onActivate();
|
|
225
256
|
};
|
|
226
|
-
const canUpload
|
|
257
|
+
const canUpload=!readOnly&&available.includes('files')&&!!(task.started||task.worktree_path);
|
|
227
258
|
const uploader=useMemo(()=>canUpload&&backend.uploadFile ? (file:File,options:Parameters<NonNullable<typeof backend.uploadFile>>[2])=>backend.uploadFile!(task.id,file,options) : undefined,[backend,task.id,canUpload]);
|
|
228
|
-
const upload=useBoardUpload(task.id,uploader,receipt=>{
|
|
259
|
+
const upload=useBoardUpload(task.id,uploader,receipt=>{
|
|
260
|
+
if(receipt.path)openFile(task.id,receipt.path);
|
|
261
|
+
if(receipt.path)notifyWorkspaceFileCreated(backend,task.id,receipt.path);
|
|
262
|
+
void backend.info(task.id).then(info=>{if(info.workspaceRoot)setWorkspaceRoots(previous=>({...previous,[task.id]:info.workspaceRoot}));},()=>{});
|
|
263
|
+
},folderTask===task.id?dir||'.':'.');
|
|
229
264
|
useEffect(()=>{
|
|
230
265
|
if(parentBoard)return;
|
|
231
266
|
return registerOperatorBoard(target=>{
|
|
@@ -251,9 +286,9 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
251
286
|
},()=>{if(alive)setFiles(previous=>previous.map(f=>fileKey(f)===fileKey(file)&&f.mtime!==-1?{...f,mtime:-1,version:f.version+1}:f));});
|
|
252
287
|
return()=>{alive=false;};
|
|
253
288
|
},[backend,active,tick]);
|
|
254
|
-
const boardView:BoardView={tab:active,dir,file:file?.path??null,files:files.map(file=>file.path),
|
|
289
|
+
const boardView:BoardView=withBoardPaths({tab:active,dir,directorySourceId:folderTask,workspaceRoot:workspaceRoots[task.id],remoteTaskId:task.id,file:file?.path??null,files:files.map(file=>file.path),
|
|
255
290
|
current:file?{path:file.path,sourceId:file.taskId}:null,opened:files.map(file=>({path:file.path,sourceId:file.taskId})),
|
|
256
|
-
history:boardState?.history??[],browser:active==='browser'?browserPage:null,visible:contentVisible,autoContext:autoContext!==false};
|
|
291
|
+
history:boardState?.history??[],browser:active==='browser'?browserPage:null,visible:contentVisible,autoContext:autoContext!==false},task.id,workspaceRoots);
|
|
257
292
|
const viewSignature=JSON.stringify(boardView);
|
|
258
293
|
useEffect(()=>{if(restored)reportBoardState(task.id,owner,boardView,directorySource);},[task.id,owner,restored,viewSignature,directorySource]); // Metadata changes only; file refresh counters do not claim a new view.
|
|
259
294
|
useEffect(()=>()=>releaseBoardState(task.id,owner),[task.id,owner]);
|
|
@@ -267,7 +302,7 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
267
302
|
{shown.map(id=><PanelTab key={id} id={id} label={label(id)} title={files.find(file=>fileKey(file)===id)?.path} active={active===id&&(!inlineLayout||inlineLayout.active)} onSelect={()=>{const opened=files.find(file=>fileKey(file)===id);if(opened)visitBoardFile(task.id,{path:opened.path,sourceId:opened.taskId});setTab(id);inlineLayout?.onActivate();}} onClose={()=>close(id)}/>)}
|
|
268
303
|
</div>
|
|
269
304
|
<PanelControls toolbarRef={setToolbarHost} available={available} open={panels.open} label={label} onShow={id=>{panels.show(id);setTab(id);inlineLayout?.onActivate();}} onClose={close}
|
|
270
|
-
upload={available.includes('files')?{onChoose:upload.choose,disabled:upload.busy||!uploader,hint:canUpload?undefined:'启动会话并创建工作区后可上传文件'}:undefined}/>
|
|
305
|
+
upload={!readOnly&&available.includes('files')?{onChoose:upload.choose,disabled:upload.busy||!uploader,hint:canUpload?undefined:'启动会话并创建工作区后可上传文件'}:undefined}/>
|
|
271
306
|
{inlineLayout && onExpand && <button className="rail-collapse" onClick={onExpand} title="展开右侧看板" aria-label="展开看板">{Icon.chevRight()}</button>}
|
|
272
307
|
</div>;
|
|
273
308
|
return <aside className={`sess-rail${inlineLayout?' sess-rail-inline':''}`} aria-label="任务看板" hidden={!contentVisible} style={!contentVisible?{display:'none'}:undefined} onPointerDown={()=>activateBoardState(task.id,owner)} onClickCapture={()=>activateBoardState(task.id,owner)} onFocusCapture={()=>activateBoardState(task.id,owner)}>
|
|
@@ -277,7 +312,7 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
277
312
|
{!active&&<div className="cli-board-empty">看板模块已全部关闭。通过右上角“管理看板模块”重新打开。</div>}
|
|
278
313
|
{active==='changes'&&<>
|
|
279
314
|
{task.fork_commit&&<div className="fork-merge-note">基于「{task.fork_source_title}」派生。合并到 {project.branch} 时,也会包含来源分支尚未合并的改动。</div>}
|
|
280
|
-
<TaskChanges taskId={task.id} running={running} prUrl={task.pr_url} onMerged={onMerged} onPrCreated={onPrCreated} onResolveWithAI={async id=>{const result=await onResolveWithAI(id);if(result.ok&&!result.merged)onSwitchToChat();return result;}}/>
|
|
315
|
+
<TaskChanges readOnly={readOnly} taskId={task.id} running={running} refreshKey={tick} prUrl={task.pr_url} onMerged={onMerged} onPrCreated={onPrCreated} onResolveWithAI={async id=>{const result=await onResolveWithAI(id);if(result.ok&&!result.merged)onSwitchToChat();return result;}}/>
|
|
281
316
|
</>}
|
|
282
317
|
{contentVisible&&active==='files'&&<>
|
|
283
318
|
{folderTask!==task.id&&<div className="fork-merge-note cli-source-workspace"><span>正在浏览来源任务的工作区。</span><button className="btn btn-ghost btn-sm" onClick={()=>{setFolderTask(task.id);setDir('');}}>返回当前工作区</button></div>}
|
|
@@ -289,11 +324,12 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
289
324
|
onOpenPath={path=>openFile(file.taskId,path)}
|
|
290
325
|
actions={quote?[{label:'引用到对话',onClick:()=>quote({id:`file:${file.taskId}:${file.path}`,sourceTaskId:file.taskId,author:`文件 ${file.path}`,text:`${file.taskId===task.id?'当前工作区':`来源任务 ${file.taskId} 的工作区`}文件 ${file.path}`})}]:[]}
|
|
291
326
|
onQuoteText={quote?(text, context)=>quote({id:`selection:${file.taskId}:${file.path}`,sourceTaskId:file.taskId,author:`${file.taskId===task.id?"当前工作区":`来源任务 ${file.taskId} 的工作区`}文件 ${file.path}`,text:context?`文件修订:${context.revision}\n${text}`:text}):undefined}
|
|
292
|
-
onBack={()=>{setFolderTask(file.taskId);setDir(
|
|
327
|
+
onBack={()=>{setFolderTask(file.taskId);setDir(previous=>workspaceFileDirectory(file.path,workspaceRoots[file.taskId])??previous);panels.show('files');setTab('files');}}
|
|
328
|
+
resolveMissing={file.taskId===task.id?resolveMissing:undefined} onResolved={to=>replaceFile(file,to)} resolvedFrom={file.resolvedFrom}/>
|
|
293
329
|
</>}
|
|
294
330
|
{active==='preview'&&features.livePreview&&<PreviewPane project={project}/>}
|
|
295
|
-
{active==='context'&&<ContextPane task={task} sessions={sessions} running={running} onClear={onClear}/>}
|
|
296
|
-
{active==='browser'&&features.browser&&contentVisible&&<BrowserPane key={task.id} taskId={task.id} onPage={setBrowserPage} onQuote={quote?page=>quote({id:`browser:${task.id}`,sourceTaskId:task.id,author:"浏览器页面",text:`${page.title?`${page.title} — `:""}${page.url}`}):undefined} onQuoteText={quote?(text,page)=>quote({id:`browser-selection:${task.id}`,sourceTaskId:task.id,author:`网页 ${page.title||page.url}`,text}):undefined}/>}
|
|
331
|
+
{active==='context'&&<ContextPane readOnly={readOnly} task={task} sessions={sessions} running={running} onClear={onClear}/>}
|
|
332
|
+
{active==='browser'&&features.browser&&contentVisible&&<BrowserPane readOnly={readOnly} key={task.id} taskId={task.id} onPage={setBrowserPage} onQuote={quote?page=>quote({id:`browser:${task.id}`,sourceTaskId:task.id,author:"浏览器页面",text:`${page.title?`${page.title} — `:""}${page.url}`}):undefined} onQuoteText={quote?(text,page)=>quote({id:`browser-selection:${task.id}`,sourceTaskId:task.id,author:`网页 ${page.title||page.url}`,text}):undefined}/>}
|
|
297
333
|
</div>
|
|
298
334
|
</aside>;
|
|
299
335
|
}
|
|
@@ -5,7 +5,7 @@ import type { Status, Priority, AskQuestion, AskAnswers } from "./protocol/types
|
|
|
5
5
|
import { OperatorBoardContext, OperatorBoardQuoteContext, type OperatorBoardOptions, type OperatorBoardRequest, type OperatorBoardTarget } from "./boardInteraction";
|
|
6
6
|
import { readDraft, writeDraft, type Quote } from "./composerDraft";
|
|
7
7
|
import { clientFeatures } from "./protocol/features";
|
|
8
|
-
import { Icon } from "
|
|
8
|
+
import { Icon } from "../../ui/icons";
|
|
9
9
|
import { type ResolveResult } from "./TaskChanges";
|
|
10
10
|
import { fmtTokens, fmtCost, fmtJobCost, isAwaiting, buildSessions, usageSplit, costDisplay } from "./format";
|
|
11
11
|
import {
|
|
@@ -93,7 +93,8 @@ function SyncBanner({ taskId, running, pinned, onResolveWithAI, onSwitchToChat }
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export function SessionView(props: Parameters<typeof SessionViewInner>[0]) { return <SessionViewInner key={props.task.id} {...props}/>; }
|
|
96
|
-
function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents, messages, running, blockedBy, transcriptLoading, older=0, onLoadOlder, onSend, onStart, onStop, onClear, clearConfirming, onConfirmClear, onCancelClear, onEdit, onReconnect, onSetStatus, onSetPriority, onSetModel, onSetAgent, onSetReasoning, onSetPermission, onSetSendContext, onResolveWithAI, onMerged, onPrCreated, onAnswer, onCancelQueued, onBack, mobile, railW, onRailWidth, onRailReset, railCollapsed, onRailCollapse, onRailExpand, board, composer }: {
|
|
96
|
+
function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents, messages, running, blockedBy, transcriptLoading, older=0, onLoadOlder, onSend, onStart, onStop, onClear, clearConfirming, onConfirmClear, onCancelClear, onEdit, onReconnect, onSetStatus, onSetPriority, onSetModel, onSetAgent, onSetReasoning, onSetPermission, onSetSendContext, onResolveWithAI, onMerged, onPrCreated, onAnswer, onCancelQueued, onBack, mobile, railW, onRailWidth, onRailReset, railCollapsed, onRailCollapse, onRailExpand, board, composer, readOnly = false }: {
|
|
97
|
+
readOnly?: boolean;
|
|
97
98
|
board?: OperatorBoardOptions;
|
|
98
99
|
composer?: CliChatConfig["composer"];
|
|
99
100
|
tasks: TaskRow[]; onSelectTask: (id: string) => void; onFork: (text: string, sourceIds: string[], requestId: string) => Promise<boolean>;
|
|
@@ -111,7 +112,8 @@ function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents,
|
|
|
111
112
|
onMerged?: () => void;
|
|
112
113
|
onPrCreated?: (url: string) => void;
|
|
113
114
|
onAnswer: (askId: string, questions: AskQuestion[], answers: AskAnswers) => void;
|
|
114
|
-
|
|
115
|
+
/** 撤回排队消息。返回 false = 它已经开始执行(没撤回),排队消息的「编辑」据此决定是否放回输入框。 */
|
|
116
|
+
onCancelQueued: (pendingId: string) => void | boolean | Promise<void | boolean>;
|
|
115
117
|
onBack?: () => void; mobile?: boolean;
|
|
116
118
|
railW: number; onRailWidth: (w: number) => void; onRailReset: () => void;
|
|
117
119
|
railCollapsed: boolean; onRailCollapse: () => void; onRailExpand: () => void;
|
|
@@ -183,8 +185,8 @@ function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents,
|
|
|
183
185
|
// Run-control pickers + feature gates come from this task's agent capabilities,
|
|
184
186
|
// never a hardcoded list — so the options always match the agent it runs under.
|
|
185
187
|
const caps = capsFor(agents, task.agent);
|
|
186
|
-
const composerConfig = resolveChatConfig({ composer }).composer;
|
|
187
|
-
const controls = { task, caps, agents:agents.agents.map(a=>({id:a.id,label:a.label,disabled:!a.authenticated||a.installed===false})), onSetAgent, defaults: findAgent(agents, task.agent)?.defaults, disabled: running, onSetModel, onSetReasoning, onSetPermission, showAgent: composerConfig.agentSelector, showPermission: composerConfig.executionMode };
|
|
188
|
+
const composerConfig = resolveChatConfig({ composer: readOnly ? false : composer }).composer;
|
|
189
|
+
const controls = { task, caps, agents:agents.agents.map(a=>({id:a.id,label:a.label,disabled:!a.authenticated||a.installed===false})), onSetAgent, defaults: findAgent(agents, task.agent)?.defaults, disabled: running || readOnly, onSetModel, onSetReasoning, onSetPermission, showAgent: composerConfig.agentSelector, showPermission: composerConfig.executionMode };
|
|
188
190
|
// Usage chip: tokens split into fresh work vs re-read cache (the raw total is
|
|
189
191
|
// mostly cache reads and wildly overstates what ran), and a dollar figure whose
|
|
190
192
|
// presentation follows how this agent is signed in — a subscription login's
|
|
@@ -207,18 +209,18 @@ function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents,
|
|
|
207
209
|
</div>
|
|
208
210
|
<div className="sh-title">
|
|
209
211
|
<span className="sht-text" title={task.title}>{task.title}</span>
|
|
210
|
-
<button className="icon-btn sh-edit" title="查看并编辑任务详情" aria-label="查看并编辑任务详情" onClick={onEdit}>{Icon.edit()}</button>
|
|
212
|
+
<button className="icon-btn sh-edit" title="查看并编辑任务详情" aria-label="查看并编辑任务详情" onClick={onEdit} disabled={readOnly}>{Icon.edit()}</button>
|
|
211
213
|
</div>
|
|
212
214
|
</div>}
|
|
213
215
|
<div className="sh-tools">
|
|
214
216
|
{hasSession&&drawerMode&&<button className="icon-btn workspace-open" title="打开工作区" aria-label="打开工作区" aria-haspopup="dialog" aria-expanded={view==='changes'} onClick={()=>setView('changes')}>{Icon.folder()}</button>}
|
|
215
217
|
<div style={{ position: "relative" }}>
|
|
216
|
-
<button className={`status-ctl ${awaiting ? "awaiting" : ""}`} onClick={(e) => { e.stopPropagation(); setStatusOpen((o) => !o); setMoreOpen(false); }}>
|
|
218
|
+
<button className={`status-ctl ${awaiting ? "awaiting" : ""}`} disabled={readOnly} onClick={(e) => { e.stopPropagation(); setStatusOpen((o) => !o); setMoreOpen(false); }}>
|
|
217
219
|
<StatusDot status={task.status} running={running} awaiting={awaiting} />
|
|
218
220
|
<span className="cv">{awaiting ? AWAIT_LABEL : SLABEL[task.status]}</span>
|
|
219
221
|
{Icon.chevDown()}
|
|
220
222
|
</button>
|
|
221
|
-
{statusOpen && (
|
|
223
|
+
{statusOpen && !readOnly && (
|
|
222
224
|
<Popover onClose={() => setStatusOpen(false)}>
|
|
223
225
|
{STATUSES.map((s) => (
|
|
224
226
|
<button key={s} className="pop-item" onClick={() => { onSetStatus(s); setStatusOpen(false); }}>
|
|
@@ -235,23 +237,23 @@ function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents,
|
|
|
235
237
|
{moreOpen && <Popover onClose={() => setMoreOpen(false)}>
|
|
236
238
|
<div className="pop-sec">{agentLabel(agents, task.agent)} · {fmtTokens(usage.fresh)} tokens{cost.show && task.cost_usd > 0 ? ` · ${cost.approx ? "~" : ""}${fmtCost(task.cost_usd)}` : ""}</div>
|
|
237
239
|
<div className="pop-note session-origin" title={task.work_branch || ""}>{Icon.git()}<span>{task.parent_task_id ? `来自 ${task.fork_source_title || "来源任务"}` : "独立任务分支"}</span></div>
|
|
238
|
-
<button className="pop-item" onClick={() => { setMoreOpen(false); onEdit(); }}>{Icon.edit()} 编辑任务详情</button>
|
|
240
|
+
<button className="pop-item" disabled={readOnly} onClick={() => { setMoreOpen(false); onEdit(); }}>{Icon.edit()} 编辑任务详情</button>
|
|
239
241
|
<button className="pop-item" onClick={() => { setMoreOpen(false); downloadExport(`/api/tasks/${task.id}/export`); }}>{Icon.download()} 导出执行过程</button>
|
|
240
242
|
{task.pr_url && <a className="pop-item" href={task.pr_url} target="_blank" rel="noreferrer">{Icon.github()} 打开 PR{prNum ? ` #${prNum}` : ""}</a>}
|
|
241
243
|
<div className="divider" /><div className="pop-sec">优先级</div>
|
|
242
|
-
{PRIORITIES.map((p) => <button className="pop-item" key={p} aria-pressed={task.priority === p} onClick={() => { onSetPriority(p); setMoreOpen(false); }}><span className={`pri ${p}`}>{PLABEL[p]}</span>{task.priority === p && Icon.check()}</button>)}
|
|
244
|
+
{PRIORITIES.map((p) => <button className="pop-item" key={p} disabled={readOnly} aria-pressed={task.priority === p} onClick={() => { onSetPriority(p); setMoreOpen(false); }}><span className={`pri ${p}`}>{PLABEL[p]}</span>{task.priority === p && Icon.check()}</button>)}
|
|
243
245
|
<div className="divider" />
|
|
244
|
-
<button className="pop-item" onClick={() => { setMoreOpen(false); onClear(); }} disabled={running || task.started !== 1}>{Icon.clear()} 保存摘要,开启新上下文</button>
|
|
246
|
+
<button className="pop-item" onClick={() => { setMoreOpen(false); onClear(); }} disabled={readOnly || running || task.started !== 1}>{Icon.clear()} 保存摘要,开启新上下文</button>
|
|
245
247
|
</Popover>}
|
|
246
248
|
</div>
|
|
247
249
|
</div>
|
|
248
250
|
</div>
|
|
249
251
|
|
|
250
|
-
{hasSession && (
|
|
252
|
+
{hasSession && !readOnly && (
|
|
251
253
|
<SyncBanner taskId={task.id} running={running} pinned={!!task.fork_commit} onResolveWithAI={onResolveWithAI} onSwitchToChat={() => setView("chat")} />
|
|
252
254
|
)}
|
|
253
255
|
|
|
254
|
-
{clearConfirming && (
|
|
256
|
+
{clearConfirming && !readOnly && (
|
|
255
257
|
<div className="clear-confirm">
|
|
256
258
|
<span>保存摘要并开启新的上下文?</span>
|
|
257
259
|
{clearEstimate && <span className="job-cost-hint">预计消耗 {fmtJobCost(clearEstimate)}</span>}
|
|
@@ -262,13 +264,13 @@ function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents,
|
|
|
262
264
|
)}
|
|
263
265
|
|
|
264
266
|
{!hasSession ? (
|
|
265
|
-
<>{composerConfig.show && <div className="hero-controls"><RunControls {...controls} /></div>}<TaskHero task={task} project={project} onStart={onStart} onEdit={onEdit} onSetSendContext={onSetSendContext} running={running || configBusy} blockedBy={blockedBy} /></>
|
|
267
|
+
<>{composerConfig.show && <div className="hero-controls"><RunControls {...controls} /></div>}<TaskHero readOnly={readOnly} task={task} project={project} onStart={onStart} onEdit={onEdit} onSetSendContext={onSetSendContext} running={running || configBusy} blockedBy={blockedBy} /></>
|
|
266
268
|
) : (
|
|
267
269
|
// Keep the chat at the same React position across all widths. Moving
|
|
268
270
|
// it between different parents remounted the composer during resize
|
|
269
271
|
// and could drop a keystroke, an upload, or an in-flight setting save.
|
|
270
272
|
<div className={tabMode||drawerMode ? "sess-responsive" : "sess-split"} style={tabMode||drawerMode ? undefined : { gridTemplateColumns: `minmax(0,1fr) 0px ${railW}px` }}>
|
|
271
|
-
<div className={`sess-main${tabMode||drawerMode ? " compact-chat" : ""}`} data-chat-layout={tabMode||drawerMode?"centered":"wide"} hidden={tabMode && view !== "chat"}><Chat project={project} task={task} tasks={tasks} agents={agents} messages={messages}
|
|
273
|
+
<div className={`sess-main${tabMode||drawerMode ? " compact-chat" : ""}`} data-chat-layout={tabMode||drawerMode?"centered":"wide"} hidden={tabMode && view !== "chat"}><Chat readOnly={readOnly} project={project} task={task} tasks={tasks} agents={agents} messages={messages}
|
|
272
274
|
running={running} blockedBy={blockedBy} transcriptLoading={transcriptLoading} older={older} onLoadOlder={onLoadOlder}
|
|
273
275
|
controls={controls} configBusy={configBusy} composer={composerConfig} active={!tabMode&&!drawerMode || view === "chat"}
|
|
274
276
|
onSelectTask={onSelectTask} onFork={onFork} onSend={onSend} onStop={onStop}
|
|
@@ -276,7 +278,7 @@ function SessionViewInner({ project, task, tasks, onSelectTask, onFork, agents,
|
|
|
276
278
|
onReconnect={onReconnect} onAnswer={onAnswer} onCancelQueued={onCancelQueued} /></div>
|
|
277
279
|
{!tabMode&&!drawerMode && <ColResize side="right" min={RAIL_W.min} max={RAIL_W.max} onWidth={onRailWidth} onReset={onRailReset} />}
|
|
278
280
|
<WorkspaceDrawer enabled={drawerMode} open={view==='changes'} onClose={()=>setView('chat')}>
|
|
279
|
-
<SessionRail {...board} openRequest={boardRequest} onRequestHandled={acknowledgeBoardRequest} project={project} task={task} sessions={sessions} running={running}
|
|
281
|
+
<SessionRail {...board} readOnly={readOnly || board?.readOnly} openRequest={boardRequest} onRequestHandled={acknowledgeBoardRequest} project={project} task={task} sessions={sessions} running={running}
|
|
280
282
|
onResolveWithAI={onResolveWithAI} onMerged={onMerged} onPrCreated={onPrCreated} onClear={onClear}
|
|
281
283
|
inlineLayout={tabMode?{tabsHost,active:view==='changes',onActivate:()=>setView('changes'),onChat:()=>setView('chat')}:undefined}
|
|
282
284
|
visible={!drawerMode||view==='changes'}
|
|
@@ -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 { DEFAULT_SETTINGS, modelOptions, reasoningOptions, permissionOptions, type Settings, type AgentsBundle } from "./types";
|
|
6
6
|
import { savedCustomModels, validModelId, withCustomModels } from "./protocol/customModels";
|
|
7
7
|
import { capsFor, agentLabel, agentStateHint } from "./agents";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, type ReactNode } from "react";
|
|
4
4
|
import type { Status } from "./protocol/types";
|
|
5
|
-
import { Icon } from "
|
|
5
|
+
import { Icon } from "../../ui/icons";
|
|
6
6
|
import { isAwaiting, relTime } from "./format";
|
|
7
7
|
import { SEARCH_MIN, type ProjectRow, type TaskRow, type AgentsBundle, type TaskView } from "./types";
|
|
8
8
|
import { agentLabel } from "./agents";
|