feat: ship lean runtime bundles and attributable update progress

This commit is contained in:
Agent Workbench Dev
2026-11-02 09:50:08 +08:00
parent 397099b284
commit befae3313d
40 changed files with 789 additions and 89 deletions
+7 -3
View File
@@ -1,6 +1,8 @@
import { EmbeddedBrowserPanel } from './EmbeddedBrowserPanel';
import { ProjectDirectoryPicker } from './ProjectDirectoryPicker';
import { HtmlFilePreview } from './HtmlFilePreview';
import { InstallationStatus } from './InstallationStatus';
import { approvalPresentation } from '../shared/approval-presentation.mjs';
import { useEffect, useMemo, useRef, useState } from 'react';
import { Activity, Brain, ClipboardCheck, RotateCw, ArrowDownToLine, ArrowRight, ArrowUp, BookOpenText, Check, ChevronDown, ChevronRight, Code2, Copy, File, FileCode2, Folder, FolderOpen, GitBranch, Link2, LoaderCircle, Maximize2, MessageSquare, Minimize2, PanelLeftClose, PanelLeftOpen, Pencil, Play, Plus, Puzzle, Search, Server as ModelServer, Settings2, ShieldCheck, Square, SquareTerminal, Trash2, X } from 'lucide-react';
import type { Bootstrap, Change, Config, ModelSelection, FileEntry, OpenFile, Project, ResearchDoc, Session, SessionBrief, ToolEvent, RuntimeDiagnostics, RuntimeFailure } from './types';
@@ -95,6 +97,7 @@ export default function App() {
const [workersOpen, setWorkersOpen] = useState(false);
const [evaluationsOpen, setEvaluationsOpen] = useState(false);
const [desktopOpen, setDesktopOpen] = useState(false);
const [installationOpen, setInstallationOpen] = useState(false);
const [companionOpen, setCompanionOpen] = useState(false);
const [pickingProject, setPickingProject] = useState(false);
const [researchDocs, setResearchDocs] = useState<ResearchDoc[]>([]);
@@ -570,7 +573,7 @@ export default function App() {
if (file.kind === 'directory') setCollapsed(previous => { const next = new Set(previous); if (next.has(file.path)) next.delete(file.path); else next.add(file.path); return next; }); else loadFile(file.path);
}}>{file.kind === 'directory' ? <><span className="tree-chevron">{collapsed.has(file.path) ? <ChevronRight size={11} /> : <ChevronDown size={11} />}</span><Folder size={14} /></> : <><span className="tree-chevron" /><File size={13} /></>}<span>{filter ? file.path : file.name}</span></button>)}{filter && !visibleFiles.length && <p className="sidebar-hint">没有匹配的文件。</p>}</div>
</div>
<div className="sidebar-footer"><button onClick={openResearch}><BookOpenText size={16} />机制研究与设计<ChevronRight size={13} /></button><button onClick={() => setMemoryOpen(true)} disabled={!selectedProject || restrictedWorker}><Brain size={16} />项目记忆<ChevronRight size={13} /></button><button onClick={() => openDiagnostics()}><Activity size={16} />运行诊断<ChevronRight size={13} /></button><button onClick={openSettings}><Settings2 size={16} />模型连接<ChevronRight size={13} /></button><div className={'connection ' + (ready ? 'connected' : '')}><span />{ready ? '本地服务已连接' : '正在连接本地服务'}<small>v{version}</small></div></div>
<div className="sidebar-footer"><button onClick={openResearch}><BookOpenText size={16} />机制研究与设计<ChevronRight size={13} /></button><button onClick={() => setMemoryOpen(true)} disabled={!selectedProject || restrictedWorker}><Brain size={16} />项目记忆<ChevronRight size={13} /></button><button onClick={() => openDiagnostics()}><Activity size={16} />运行诊断<ChevronRight size={13} /></button><button onClick={openSettings}><Settings2 size={16} />模型连接<ChevronRight size={13} /></button><div className={'connection ' + (ready ? 'connected' : '')}><span />{ready ? '本地服务已连接' : '正在连接本地服务'}<button className="version-entry" aria-label="版本与更新" onClick={() => setInstallationOpen(true)}>v{version}</button></div></div>
</aside>
<main className="task-pane">
<header className="work-header"><div className="work-title">{(!sidebarOpen || mobile) && <IconButton label="展开项目栏" onClick={() => setSidebarOpen(true)}><PanelLeftOpen size={18} /></IconButton>}<span className="header-symbol"><Code2 size={17} /></span><div><span className="header-breadcrumb">{selectedProject?.name || '工作空间'} <ChevronRight size={12} /> 任务</span><h1>{session?.title || '让任务走到完成'}</h1></div></div>
@@ -599,10 +602,10 @@ export default function App() {
{isRunning && !approval && <div className="working-note"><LoaderCircle size={14} className="spin" /><span>{session?.executionMode === 'demo' ? '正在执行演示流程' : '正在处理任务'}</span></div>}
</div>}
{session&&<BudgetPausePanel key={session.id+session.execution?.run?.id} session={session} config={config} onSession={acceptSession}/>}
{approval && <div className="approval-card"><div className="approval-heading"><span><ShieldCheck size={17} /></span><div><strong>{approval.environmentPlanId ? '确认依赖准备' : approval.browserPlanId ? '确认实际页面检查' : approval.checkPlanId ? '确认工程检查' : '确认这次终端执行'}</strong><p>{approval.reason}</p></div></div><pre>{approval.command}</pre>
{approval && <div className="approval-card"><div className="approval-heading"><span><ShieldCheck size={17} /></span><div><strong>{approvalPresentation(approval).title}</strong><p>{approval.reason}</p></div></div><pre>{approval.command}</pre>
{approval.environmentSummary&&<div className="approval-shell"><p>所属工作区:{approval.environmentSummary.root}</p><p>注册源:{approval.environmentSummary.registry} · {approval.environmentSummary.offline?'只使用缓存':'允许下载'} · {Math.round(approval.environmentSummary.timeoutMs/1000)} 秒</p><strong>{approval.environmentSummary.scripts==='skip'?'跳过全部安装脚本':'允许根工程及依赖安装脚本'}</strong><details><summary>安装脚本范围</summary>{approval.environmentSummary.lifecycle.map(row=><div key={row.name}><strong>{row.name}</strong><pre>{row.script}</pre></div>)}<p>锁文件标记 {approval.environmentSummary.installScriptPackages.length} 个包带安装脚本;下载前无法读取其正文。</p></details><p>准备完成后仍需实际工程检查。停止后保留部分依赖,原计划不会自动重放。</p></div>}
{approval.checkScripts?.filter(check => check.python).map(check => <p className="approval-shell" key={check.name}>Python {check.python!.runtime.version || '执行时核对版本'} · {check.python!.runtime.logicalExecutable || check.python!.runtime.executable || '解释器缺失'}</p>)}
<div className="approval-path"><Folder size={12} /><span>{approval.cwd}</span></div><p className="approval-shell">{approval.shell || '项目终端'} · UTF-8</p><p className="approval-scope">{approval.browserPlanId ? '按封存步骤操作当前构建,保存页面原结果。' : '确认后以你的系统权限执行。'}</p><div className="approval-actions"><button className="button secondary" onClick={() => decide(false)} disabled={deciding}>拒绝执行</button><button className="button primary" onClick={() => decide(true)} disabled={deciding}><Play size={14} />确认执行</button></div></div>}
<div className="approval-path"><Folder size={12} /><span>{approval.cwd}</span></div><p className="approval-shell">{approval.shell || '项目终端'} · UTF-8</p><p className="approval-scope">{approvalPresentation(approval).scope}</p><div className="approval-actions"><button className="button secondary" onClick={() => decide(false)} disabled={deciding}>拒绝执行</button><button className="button primary" onClick={() => decide(true)} disabled={deciding}><Play size={14} />确认执行</button></div></div>}
{pending.length > 0 && !isRunning && <button className="review-callout" onClick={() => { setChangeId(pending[0].id); showInspector('changes'); }}><FileCode2 size={17} /><span><strong>{pending.length} 项改动等待审查</strong><small>查看差异后,再应用到项目文件。</small></span><ArrowRight size={17} /></button>}
{canContinueReview && <button type="button" aria-label="继续原任务" className="review-callout" disabled={resuming} onClick={continueReviewed}><ClipboardCheck size={17} /><span><strong>继续原任务</strong><small>改动已应用,保留原目标、范围和检查约定继续处理。</small></span><ArrowRight size={17} /></button>}
<div ref={chatEnd} />
@@ -624,6 +627,7 @@ export default function App() {
{selectedProject && <CodeIndexPanel key={selectedProject.id} project={selectedProject} active={tab === 'index'} onOpen={(path, line, expectedSha256) => void loadFile(path, { line, expectedSha256 })} />}
<div className="inspector-footer"><ShieldCheck size={13} /><span>{tab === 'changes' ? '应用前会核对文件基线' : tab === 'trace' ? '中断调用保留待核实状态' : tab === 'task' ? '任务目标、检查与结果持久保存' : tab === 'index' ? '结果绑定当前项目及文件 SHA256' : '读取范围限定在当前项目'}</span></div>
</aside>
{installationOpen && <Modal title="版本与更新" description="核对本机版本、真实更新阶段与原始结果。" onClose={() => setInstallationOpen(false)}><InstallationStatus /></Modal>}
{projectOpen && <Modal title="打开项目" description="选择这台电脑上的项目文件夹,或输入完整路径。" onClose={() => { if (!projectBusy) { setProjectOpen(false); setDirectoryPickerOpen(false); setProjectError(''); } }}><form onSubmit={event => { event.preventDefault(); if (!directoryPickerOpen) void openProject(); }}><label className="form-field">项目文件夹<input autoFocus value={projectInput} disabled={projectBusy} onChange={event => { setProjectInput(event.target.value); setProjectError(''); }} placeholder="C:\Projects\my-app" aria-label="项目文件夹路径" /></label>{projectError && <p className="local-files-error" role="alert">{projectError}</p>}{directoryPickerOpen && <ProjectDirectoryPicker initialPath={projectInput.trim()} onChoose={value => { setProjectInput(value); setProjectError(''); setDirectoryPickerOpen(false); }} onCancel={() => setDirectoryPickerOpen(false)} />}<div className="modal-actions"><button type="button" className="button secondary" disabled={pickingProject || projectBusy} onClick={() => desktop ? void pickDesktopProject() : setDirectoryPickerOpen(value => !value)}><FolderOpen size={15} />选择文件夹</button>{exampleId && <button type="button" className="button secondary" disabled={projectBusy} onClick={() => { chooseProject(exampleId); setProjectOpen(false); setDirectoryPickerOpen(false); }}>打开示例项目</button>}<button type="submit" className="button primary" disabled={!projectInput.trim() || projectBusy || directoryPickerOpen}>{projectBusy ? <LoaderCircle className="spin" size={15} /> : <FolderOpen size={15} />}{projectBusy ? '正在打开…' : '打开项目'}</button></div></form></Modal>}
{companionOpen && <Modal title="手机连接" description="指定项目和权限,连接到同一个Windows执行宿主。" onClose={() => setCompanionOpen(false)} wide><CompanionPanel projects={projects} selectedProjectId={selectedProject?.id ?? ''} /></Modal>}
{desktopOpen && desktop && <Modal title="桌面与后台任务" description="当前窗口连接同一个本机执行宿主。" onClose={() => setDesktopOpen(false)}><DesktopPanel project={selectedProject} session={session} file={openFile} onProject={acceptDesktopProject} onReview={scope => { if (selectedProjectRef.current === scope.projectId && selectedSessionRef.current === scope.sessionId && selectedTaskRef.current === scope.taskId) { setDesktopOpen(false); showInspector('task'); } }} /></Modal>}
+23
View File
@@ -0,0 +1,23 @@
.installation-status { color: var(--text, #24383e); font-size: 13px; line-height: 1.6; }
.installation-status > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #dce3e7; }
.installation-status h3 { margin: 0 0 4px; font-size: 15px; }
.installation-status p { margin: 5px 0; }
.installation-status button { flex-shrink: 0; }
.installation-facts { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 9px 14px; margin: 18px 0; }
.installation-facts dt { color: #52636c; }
.installation-facts dd { margin: 0; overflow-wrap: anywhere; font: 12px/1.6 var(--font-mono, Consolas, monospace); }
.installation-operation { margin-top: 18px; padding: 18px 0 0; border-top: 1px solid #dce3e7; }
.installation-stage { display: flex; align-items: center; gap: 9px; }
.installation-stage > span:last-child { margin-left: auto; white-space: nowrap; color: #52636c; font-variant-numeric: tabular-nums; }
.installation-state-dot { flex: 0 0 7px; height: 7px; border-radius: 50%; background: #337858; }
.installation-failed .installation-state-dot, .installation-unknown .installation-state-dot { background: #a04832; }
.installation-counts { display: grid; gap: 6px; margin: 16px 0; font-variant-numeric: tabular-nums; }
.installation-counts progress { width: 100%; height: 6px; accent-color: #337858; }
.installation-counts code { overflow-wrap: anywhere; color: #52636c; font-size: 11px; }
.installation-note, .installation-empty { padding: 12px 0; color: #52636c; }
.installation-error { margin-top: 12px; padding: 12px; background: #fff2ed; color: #843620; overflow-wrap: anywhere; border-left: 3px solid #b86d4d; }
.installation-history { display: grid; gap: 6px; margin-top: 16px; color: #52636c; }
.installation-history select { width: 100%; min-width: 0; padding: 8px; border: 1px solid #c5d1d8; border-radius: 4px; color: #24383e; background: #fff; font: inherit; }
.connection .version-entry { color: inherit; padding: 0 3px; margin-left: auto; min-width: 0; width: auto; background: transparent; border: 0; font: inherit; font-size: 11px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.connection .version-entry:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media(max-width: 480px) { .installation-status > header { flex-wrap: wrap; } .installation-facts { grid-template-columns: 1fr; gap: 3px; } .installation-facts dd { margin-bottom: 9px; } .installation-stage { flex-wrap: wrap; } }
+49
View File
@@ -0,0 +1,49 @@
import { useEffect, useState } from 'react';
import { RotateCw } from 'lucide-react';
import { api } from './api';
import './InstallationStatus.css';
type Operation = {
id: string; sequence: number; state: string; stage: string; label: string; updatedAt: string; elapsedMs: number; scope?: string;
counts?: { completedFiles: number; totalFiles: number; completedBytes: number | null; totalBytes: number | null; currentPath?: string } | null;
candidate?: { version: string; manifestSha256: string } | null;
detail?: { error?: { code: string; message: string }; receiptFile?: string; originalError?: string };
progressFile: string; interrupted?: boolean;
};
type Status = { installed: boolean; runningVersion: string; activeVersion?: string; previousVersion?: string | null; installRoot?: string; operations: Operation[] };
const size = (bytes: number) => { const unit = bytes < 1024 ? 0 : bytes < 1024 ** 2 ? 1 : bytes < 1024 ** 3 ? 2 : 3; return new Intl.NumberFormat('zh-CN', { maximumFractionDigits: 1 }).format(bytes / 1024 ** unit) + ' ' + ['B', 'KB', 'MB', 'GB'][unit]; };
const scopeLabel = (scope?: string) => scope === 'full-manifest' ? '全部发行文件' : scope === 'directory-inventory' ? '实际目录范围' : scope === 'loaded-inputs' ? '宿主与客户端入口' : '';
export function InstallationStatus() {
const [status, setStatus] = useState<Status | null>(null), [error, setError] = useState(''), [busy, setBusy] = useState(false);
const [refresh, setRefresh] = useState(0);
const [selected, setSelected] = useState('');
useEffect(() => {
let alive = true, timer: ReturnType<typeof setTimeout>;
const load = async () => {
setBusy(true);
try {
const value = await api<Status>('/installation/status');
if (alive) { setStatus(value); setError(''); }
} catch (value) { if (alive) setError(value instanceof Error ? value.message : '无法读取原安装进度。'); }
finally { if (alive) { setBusy(false); timer = setTimeout(() => void load(), 2500); } }
};
void load(); return () => { alive = false; clearTimeout(timer); };
}, [refresh]);
const operation = status?.operations.find(value => value.id === selected) ?? status?.operations[0];
return <section className="installation-status" aria-label="版本与更新状态">
<header><div><h3>当前版本</h3><p>{status ? <>正在运行 <strong>v{status.runningVersion}</strong>{status.installed && <> · 已登记 v{status.activeVersion}</>}</> : '正在读取本机安装登记…'}</p></div><button className="button secondary" disabled={busy} onClick={() => setRefresh(value => value + 1)}><RotateCw size={14} />刷新状态</button></header>
{error && <p role="alert" className="installation-error">{error}{status && ' 以下保留上次读取结果,请刷新后再判断当前状态。'}</p>}
{status && !status.installed && <p>当前使用源码或便携目录。安装版会在这里显示所属更新阶段和原始失败记录。</p>}
{status?.installed && <dl className="installation-facts"><dt>程序目录</dt><dd>{status.installRoot}</dd><dt>前一版本</dt><dd>{status.previousVersion ? 'v' + status.previousVersion : '首次安装'}</dd></dl>}
{status?.installed && !operation && <p className="installation-empty">还没有新版安装进度记录。此前版本的原操作收据保存在程序目录的 .installation 中。</p>}
{status && status.operations.length > 1 && <label className="installation-history">安装操作<select aria-label="查看安装操作" value={selected} onChange={event => setSelected(event.target.value)}><option value="">最近一次操作</option>{status.operations.map(value => <option key={value.id} value={value.id}>{new Date(value.updatedAt).toLocaleString('zh-CN')} · {value.interrupted ? '结果待核对' : value.label}</option>)}</select></label>}
{operation && <article className={'installation-operation installation-' + operation.state}>
<div className="installation-stage" role="status"><span className="installation-state-dot" /><strong>{operation.interrupted ? '原安装进程已结束,结果待核对' : operation.label}</strong><span>{Math.round(operation.elapsedMs / 1000)} 秒</span></div>
{operation.counts && <div className="installation-counts"><span>{scopeLabel(operation.scope)}</span><strong>{operation.counts.completedFiles.toLocaleString()} / {operation.counts.totalFiles.toLocaleString()} 文件</strong>{operation.counts.completedBytes !== null && operation.counts.totalBytes !== null && <span>{size(operation.counts.completedBytes)} / {size(operation.counts.totalBytes)}</span>}<progress aria-label="当前核对范围" max={Math.max(1, operation.counts.totalFiles)} value={operation.counts.completedFiles} />{operation.counts.currentPath && <code>{operation.counts.currentPath}</code>}</div>}
{operation.detail?.error && <div className="installation-error" role="alert"><strong>{operation.detail.error.code}</strong><p>{operation.detail.error.message}</p></div>}
<dl className="installation-facts"><dt>目标版本</dt><dd>{operation.candidate ? 'v' + operation.candidate.version : '准备时尚未读取候选'}</dd><dt>操作编号</dt><dd>{operation.id} · 序号 {operation.sequence}</dd><dt>原始记录</dt><dd>{operation.progressFile}</dd>{operation.detail?.receiptFile && <><dt>结果收据</dt><dd>{operation.detail.receiptFile}</dd></>}</dl>
<p className="installation-note">{operation.state === 'ready-to-copy' ? '预检已通过,写入进度由安装器显示;新版本尚未激活。' : operation.interrupted ? '请保留原安装日志与收据,核对已登记版本。不要根据窗口关闭推断安装成功,也不要重复执行原任务。' : operation.state === 'failed' ? '原失败记录已保留。请按具体原因处理,核对已登记版本及回退收据后再开始新的安装。' : operation.state === 'staged' ? '文件已核对并暂存,当前活动版本保留。' : operation.state === 'running' ? '当前阶段核对实际文件。发布版本和回退期间需要保持安装器打开;各阶段单独计数。' : '原会话与工件保留。这里的安装结果不代表模型工程任务已经通过。'}</p>
</article>}
</section>;
}
+1 -1
View File
@@ -18,7 +18,7 @@ export interface MobileTask extends MobileBrief {
events: { id: string; label: string; phase: string; output: string; taskId?: string; runId?: string; createdAt: string; exitCode?: number;
stream?: { status: string; protocol?: string; textCharacters?: number; textPreview?: string; toolFragments?: number } }[];
messages: { id: string; role: string; content: string; createdAt: string }[];
approvals: { id: string; taskId: string; runId: string; projectId: string; command: string; reason: string; shell: string; fingerprint: string; actionable: boolean }[];
approvals: { id: string; taskId: string; runId: string; projectId: string; command: string; reason: string; shell: string; kind?: string; fingerprint: string; actionable: boolean }[];
changes: { id: string; path: string; reason: string; status: string; sha256: string; baseSha256: string; additions: number; deletions: number }[];
checks: { id: string; status: string; summary: string; requiresVerification?: boolean; results: { name: string; status: string; exitCode?: number; tests?: { total: number; passed: number; failed: number; skipped: number; cancelled: number } }[] }[];
reports: { id: string; kind: string; sha256: string; bytes: number }[];
+2 -1
View File
@@ -1,4 +1,5 @@
import { MobileBrowserObservation } from './MobileBrowserObservation';
import { approvalPresentation } from '../../shared/approval-presentation.mjs';
import { useCallback, useEffect, useRef, useState } from 'react';
import { ArrowLeft, ChevronRight, ClipboardCheck, FileDiff, Folder, Link2, RefreshCw, ShieldCheck, Square, Terminal, Wifi, WifiOff, X } from 'lucide-react';
import type { CompanionDevice, MobileBrief, MobileTask } from '../companion-types';
@@ -131,6 +132,6 @@ export function MobileApp({ initialToken }: { initialToken: string }) {
{['running', 'awaiting_approval', 'stopping'].includes(selectedTask.status) && <div className="mobile-stop"><span>{me.device.permissions.stop ? '停止仍由电脑等待所属工具退出' : '此设备没有停止权限'}</span><button disabled={!me.device.permissions.stop || !fresh || !!busy || selectedTask.status === 'stopping'} onClick={() => setDecision({ requestId: crypto.randomUUID(), kind: 'stop', task: selectedTask })}><Square size={14} />停止原任务</button></div>}
</>}</main>}
{document && <dialog ref={documentDialog} className="mobile-document" aria-label={document.title} onCancel={() => setDocument(null)}><header><button aria-label="关闭文档" onClick={() => setDocument(null)}><ArrowLeft size={20} /></button><strong>{document.title}</strong></header><p><ShieldCheck size={14} />SHA-256 已核对{document.redacted ? ' · 已脱敏' : ''}</p><code>{document.sha256}</code><pre>{document.text}</pre><button onClick={() => setDocument(null)}>返回任务</button></dialog>}
{decision && <dialog ref={dialog} className="mobile-confirm" onCancel={() => setDecision(null)}><button className="mobile-confirm-close" aria-label="关闭确认" onClick={() => setDecision(null)} disabled={!!busy}><X size={20} /></button><h2>{decision.kind === 'stop' ? '停止这个原任务' : decision.allow ? '批准原命令请求' : '拒绝原命令请求'}</h2><p>{projectName(decision.task.projectId)} · {decision.task.title}</p>{decision.approval && <pre>{decision.approval.command}</pre>}<code>Task {decision.task.taskId}<br />Run {decision.task.runId}<br />修订 {decision.task.revision}</code>{decision.task.revision !== task?.revision && <p role="alert">任务修订已变化,请关闭并重新核对。</p>}<p>{decision.kind === 'stop' ? '电脑将停止此运行,并保留已经完成的工具结果。' : decision.allow ? '批准后,电脑将在原项目中执行这条已登记命令。' : '拒绝后,这条原命令不会执行。'}</p><div className="mobile-action-pair"><button disabled={!!busy} onClick={() => setDecision(null)}>返回核对</button><button className={decision.kind === 'stop' ? 'mobile-danger' : 'mobile-primary'} disabled={!!busy || !fresh || decision.task.revision !== task?.revision} onClick={() => void submitDecision()}>{busy === 'operation' ? '等待原回执…' : '确认'}</button></div></dialog>}
{decision && <dialog ref={dialog} className="mobile-confirm" onCancel={() => setDecision(null)}><button className="mobile-confirm-close" aria-label="关闭确认" onClick={() => setDecision(null)} disabled={!!busy}><X size={20} /></button><h2>{decision.kind === 'stop' ? '停止这个原任务' : (decision.allow ? '批准原' : '拒绝原') + approvalPresentation(decision.approval).subject}</h2><p>{projectName(decision.task.projectId)} · {decision.task.title}</p>{decision.approval && <pre>{decision.approval.command}</pre>}<code>Task {decision.task.taskId}<br />Run {decision.task.runId}<br />修订 {decision.task.revision}</code>{decision.task.revision !== task?.revision && <p role="alert">任务修订已变化,请关闭并重新核对。</p>}<p>{decision.kind === 'stop' ? '电脑将停止此运行,并保留已经完成的工具结果。' : decision.allow ? approvalPresentation(decision.approval).scope : approvalPresentation(decision.approval).denied}</p><div className="mobile-action-pair"><button disabled={!!busy} onClick={() => setDecision(null)}>返回核对</button><button className={decision.kind === 'stop' ? 'mobile-danger' : 'mobile-primary'} disabled={!!busy || !fresh || decision.task.revision !== task?.revision} onClick={() => void submitDecision()}>{busy === 'operation' ? '等待原回执…' : '确认'}</button></div></dialog>}
</div>;
}
+1
View File
@@ -26,6 +26,7 @@ export interface ExecutionSnapshot {browsingTabs?:BrowsingTab[];browsingActions?
export interface CheckPlan {environment?:NodeEnvironmentBinding|null}
export interface CheckJob {environment?:NodeEnvironmentBinding|null}
export interface Approval {environmentPlanId?:string}
export interface Approval {browsingTabId?:string;mcpRegistrationId?:string}
export interface Approval {environmentSummary?:Pick<EnvironmentPlan,'root'|'registry'|'scripts'|'offline'|'timeoutMs'|'lifecycle'|'installScriptPackages'>}
export interface NodeEnvironmentBinding {preparation?:{jobId:string;planId:string;sessionId:string;logArtifactId:string;logSha256:string}|null}
export interface ModelSelection { type: 'legacy' | 'connection' | 'pool'; id: string; name: string }