@spzxg/cli-ui 0.6.18 → 0.6.20
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 +8 -2
- package/README.md +3 -3
- package/dist/{cli-ui-embed-Dsw7A8BQ.js → cli-ui-embed-BIeQkXIU.js} +16955 -16434
- package/dist/{cli-ui-index-CHFgaDHY.js → cli-ui-index-BOCFJA87.js} +2 -2
- package/dist/{cli-ui-jszip.min-Dw9DMuD5.js → cli-ui-jszip.min-DeMMXc2T.js} +2 -2
- package/dist/{cli-ui-jszip.min-DDRprLiN.js → cli-ui-jszip.min-cpxytNM4.js} +1 -1
- package/dist/{cli-ui-xlsx-BUG2_Azh.js → cli-ui-xlsx-BLe37Dql.js} +1 -1
- package/dist/cli-ui.js +1 -1
- package/package.json +1 -1
- package/src/board/CliBoard.tsx +11 -2
- package/src/board/FileViewer.tsx +131 -20
- package/src/board/frameQuote.ts +42 -8
- package/src/board/htmlWorkspace.ts +499 -0
- package/src/board/previewCache.ts +137 -0
- package/src/chat/CliChat.tsx +14 -4
- package/src/chat/Composer.tsx +1 -1
- package/src/core/config.ts +1 -1
- package/src/index.ts +1 -0
- package/src/operator/node/Chat.tsx +6 -1
- package/src/operator/node/Composer.tsx +2 -2
- package/src/operator/node/SessionRail.tsx +11 -7
package/src/index.ts
CHANGED
|
@@ -54,3 +54,4 @@ export type { WorkspaceHandlers } from "./core/provider";
|
|
|
54
54
|
export type { BoardFile } from "./board/workspace";
|
|
55
55
|
|
|
56
56
|
export { syncFile, clearFileSyncNamespace, FILE_SYNC_MAX, type FileSyncTransport, type FileSyncManifest, type FileSyncProgress } from "./board/fileSync";
|
|
57
|
+
export { prepareWorkspaceHtml, readWorkspaceAsset, resolveWorkspaceAssetPath, assetMimeOf } from "./board/htmlWorkspace";
|
|
@@ -298,7 +298,12 @@ function ChatSession({ project, task, tasks, agents, messages, running, transcri
|
|
|
298
298
|
)}
|
|
299
299
|
</div>
|
|
300
300
|
</div>
|
|
301
|
-
{!readOnly && composer?.show !== false ? <Composer tasks={tasks} onFork={onFork} task={task} agentLabel={agentLabel(agents, task.agent)} disabled={task.started!==1} configBusy={configBusy} running={running} onSend={async text => {
|
|
301
|
+
{!readOnly && composer?.show !== false ? <Composer tasks={tasks} onFork={onFork} task={task} agentLabel={agentLabel(agents, task.agent)} disabled={task.started!==1} configBusy={configBusy} running={running} onSend={async text => {
|
|
302
|
+
if (running) await stopTurn().catch(() => false);
|
|
303
|
+
const sent = await onSend(text);
|
|
304
|
+
if (sent) scrollToBottom("auto");
|
|
305
|
+
return sent;
|
|
306
|
+
}} onStop={onStop} onClear={onClear} quoteRequest={quoteRequest} onQuoteHandled={()=>setQuoteRequest(null)} controls={controls}
|
|
302
307
|
fileUpload={composer?.fileUpload} queued={queued} /> : queued}
|
|
303
308
|
</SubagentChatScope></FileLinkContext.Provider>
|
|
304
309
|
);
|
|
@@ -273,7 +273,7 @@ export function Composer({ task, agentLabel, disabled, running, onSend, onStop,
|
|
|
273
273
|
<button className="attach-x" disabled={locked} aria-label={`移除 ${a.name}`} onClick={() => removeAtt(a.key)}>×</button>
|
|
274
274
|
</div>)}</div>}
|
|
275
275
|
<div className="comp-area"><textarea ref={ref} rows={2} value={draft.text} disabled={locked} aria-label="消息输入框" aria-expanded={mentionOpen} aria-controls={mentionOpen ? `mentions-${task.id}` : undefined} aria-activedescendant={mentionOpen && candidates.length ? `mention-${candidates[Math.min(mentionIndex, candidates.length - 1)].id}` : undefined}
|
|
276
|
-
placeholder={configBusy ? "正在保存设置…" : disabled ? "启动会话后即可回复…" : sources.length ? "描述这些新分支要继续完成的工作…" : running ? "
|
|
276
|
+
placeholder={configBusy ? "正在保存设置…" : disabled ? "启动会话后即可回复…" : sources.length ? "描述这些新分支要继续完成的工作…" : running ? "输入新消息,发送将停止当前轮次并立即执行…" : `和 ${agentLabel} 一起工作`}
|
|
277
277
|
onCompositionStart={() => { composing.current = true; }} onCompositionEnd={() => { composing.current = false; }}
|
|
278
278
|
onChange={(e) => { const text = e.target.value; update((d) => ({ ...d, text })); setSlash(text.trim().startsWith("/")); setCaret(e.target.selectionStart); setMentionClosed(false); setMentionIndex(0); }}
|
|
279
279
|
onSelect={(e) => setCaret(e.currentTarget.selectionStart)}
|
|
@@ -312,7 +312,7 @@ export function Composer({ task, agentLabel, disabled, running, onSend, onStop,
|
|
|
312
312
|
<RunControls {...controls} disabled={controls.disabled || sending} />
|
|
313
313
|
<div className="send-group">
|
|
314
314
|
{showStop ? <button type="button" className="send stop" disabled={stopping} aria-busy={stopping} aria-label={stopping ? "正在停止" : "停止当前轮次"} title={stopping ? "正在停止…" : "停止当前轮次"} onClick={() => void stop()}>{stopping ? <span className="spinner" /> : Icon.stop()}</button>
|
|
315
|
-
: <button type="button" className={`send${running ? " queue" : ""}`} disabled={!canSend} aria-busy={sending} aria-label={sending ? "正在发送" : sources.length ? `派生 ${sources.length} 个分支` : running ? "排队发送" : "发送消息"} title={sending ? "发送中…" : running ? "
|
|
315
|
+
: <button type="button" className={`send${running ? " queue" : ""}`} disabled={!canSend} aria-busy={sending} aria-label={sending ? "正在发送" : sources.length ? `派生 ${sources.length} 个分支` : running ? "排队发送" : "发送消息"} title={sending ? "发送中…" : running ? "停止当前轮次并立即发送" : "发送消息(Enter)"} onClick={() => void submit()}>{sending ? <span className="spinner" /> : Icon.send()}</button>}
|
|
316
316
|
</div>
|
|
317
317
|
</div>
|
|
318
318
|
</div>
|
|
@@ -239,7 +239,10 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
239
239
|
// A relative path the agent wrote against a subfolder → the existing file it was
|
|
240
240
|
// completed to (board/pathResolve). Clicking the same link again opens that one.
|
|
241
241
|
const aliases=useRef(new Map<string,string>());
|
|
242
|
-
const
|
|
242
|
+
const closedVersions=useRef(new Map<string,number>());
|
|
243
|
+
useEffect(()=>{closedVersions.current.clear();},[task.id]);
|
|
244
|
+
const rememberClosed=(closed:OpenFile)=>{const k=fileKey(closed);closedVersions.current.set(k,Math.max(closedVersions.current.get(k)??-1,closed.version));};
|
|
245
|
+
const openFile=(taskId:string,path:string,entry?:{name?:string;size?:number;mtime?:number})=>{
|
|
243
246
|
if(!available.includes('files'))return;
|
|
244
247
|
const requested=path.replace(/^\.\//,'').replace(/\/+$/,'');if(!requested)return;
|
|
245
248
|
const clean=aliases.current.get(fileKey({taskId,path:requested}))??requested;
|
|
@@ -248,9 +251,10 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
248
251
|
visitBoardFile(task.id,{sourceId:taskId,path:clean});
|
|
249
252
|
setFiles(previous=>{
|
|
250
253
|
const found=previous.find(f=>fileKey(f)===id);
|
|
251
|
-
if(found)return previous.map(f=>fileKey(f)===id?{...f,version:f.version+1}:f);
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
+
if(found)return previous.map(f=>fileKey(f)===id?{...f,name:entry?.name??f.name,size:entry?.size??f.size,mtime:entry?.mtime??f.mtime,version:f.version+1}:f);
|
|
255
|
+
const priorClosed=closedVersions.current.get(id);
|
|
256
|
+
const next=[...previous,{taskId,path:clean,name:entry?.name,size:entry?.size,mtime:entry?.mtime,version:priorClosed!==undefined?priorClosed+1:0}];
|
|
257
|
+
if(next.length>8){const index=next.findIndex(f=>fileKey(f)!==current.current&&fileKey(f)!==id);const [evicted]=next.splice(index<0?0:index,1);if(evicted)rememberClosed(evicted);}
|
|
254
258
|
return next;
|
|
255
259
|
});setTab(id);inlineRef.current?.onActivate();
|
|
256
260
|
};
|
|
@@ -294,7 +298,7 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
294
298
|
useEffect(()=>()=>releaseBoardState(task.id,owner),[task.id,owner]);
|
|
295
299
|
const label=(id:string)=>LABEL[id]??files.find(f=>fileKey(f)===id)?.name??files.find(f=>fileKey(f)===id)?.path.split('/').pop()??id;
|
|
296
300
|
const close=(id:string)=>{
|
|
297
|
-
if(id.startsWith('file:'))setFiles(previous=>previous.filter(f=>fileKey(f)!==id));else panels.close(id);
|
|
301
|
+
if(id.startsWith('file:'))setFiles(previous=>{const closed=previous.find(f=>fileKey(f)===id);if(closed)rememberClosed(closed);return previous.filter(f=>fileKey(f)!==id);});else panels.close(id);
|
|
298
302
|
if(active===id){const next=shown.find(item=>item!==id)??'';setTab(next);if(!next)inlineLayout?.onChat();}
|
|
299
303
|
};
|
|
300
304
|
const railTabs=<div className="rail-tabs">
|
|
@@ -316,11 +320,11 @@ export function SessionRail({ project, task, sessions, running, onResolveWithAI,
|
|
|
316
320
|
</>}
|
|
317
321
|
{contentVisible&&active==='files'&&<>
|
|
318
322
|
{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>}
|
|
319
|
-
<FilesPane toolbarHost={toolbarHost} backend={backend} jobId={folderTask} dir={dir} onDir={setDir} onOpen={entry=>openFile(folderTask,entry.path)} refreshKey={tick}/>
|
|
323
|
+
<FilesPane toolbarHost={toolbarHost} backend={backend} jobId={folderTask} dir={dir} onDir={setDir} onOpen={entry=>openFile(folderTask,entry.path,entry)} refreshKey={tick}/>
|
|
320
324
|
</>}
|
|
321
325
|
{contentVisible&&file&&<>
|
|
322
326
|
{file.taskId!==task.id&&<div className="fork-merge-note">正在查看来源任务的文件,不会切换当前执行分支。</div>}
|
|
323
|
-
<FileViewer toolbarHost={toolbarHost} key={fileKey(file)} backend={backend} jobId={file.taskId} path={file.path} displayName={file.name} size={file.size} mtime={file.mtime} version={file.version} reloadKey={file.reloadKey}
|
|
327
|
+
<FileViewer toolbarHost={toolbarHost} key={fileKey(file)} backend={backend} jobId={file.taskId} path={file.path} displayName={file.name} size={file.size} mtime={file.mtime} workspaceRoot={workspaceRoots[file.taskId]} version={file.version} reloadKey={file.reloadKey}
|
|
324
328
|
onOpenPath={path=>openFile(file.taskId,path)}
|
|
325
329
|
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}`})}]:[]}
|
|
326
330
|
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}
|