chore: v0.8.0 — 任务管理页(子代理拓扑 + 后台命令底部输出 Dock、两击确认终止)
- tab 更名为任务管理:同页显示当前树全部后台命令(bash/pwsh 徽标、状态、时长、属主、退出码) - 点击任务行在侧边栏底部共享 Dock 显示输出(sticky 终端式、自动跟随、单一轮询实例) - 运行中任务两击确认强制终止;大量任务时列表保持紧凑、排序变动不跳动 - 新增 /sidebar/api tasks.output(非消费 peek,不偷模型 task_output 字节)与 tasks.kill 路由 - 修复任务镜像清空时的 React #300 hook 顺序崩溃(useCallback 移到提前 return 之前)+ 回归测试
This commit is contained in:
1 parent
27bc49830e
commit
8c521be26e
18 files changed
+1568
-72
No files matched your search
@@ -36,6 +36,7 @@ import { SettingsConflictError, settingsNamespace, type SettingsNamespace } from
|
||||
import { defaultShell, ensureSpawnHelper, PtyManager } from './pty-manager.ts'
|
||||
import { AgentPtyRegistry, clampDims, type AgentTerminalHandle } from './agent-pty.ts'
|
||||
import { registerTools } from './tools.ts'
|
||||
import { buildTasksApi, type SidebarTasksRoutes } from './tasks-routes.ts'
|
||||
import { readJsonBody, requireString, SidebarError, writeError, writeJson, writeOk } from './wire.ts'
|
||||
|
||||
export { Config }
|
||||
@@ -198,6 +199,11 @@ function buildApi(
|
||||
const clientCwd = typeof record?.cwd === 'string' && record.cwd !== '' ? record.cwd : undefined
|
||||
return { sessionId, cwd: sessionCwdOf(ctx, sessionId, clientCwd) }
|
||||
}
|
||||
// Background tasks: the LIST rides the harness's `session/tasks` push
|
||||
// mirror, so these routes only read output (a non-consuming peek — the
|
||||
// model's task_output cursor is never touched) and kill. A deployment
|
||||
// without the tasks registry downgrades to a 503, like the settings routes.
|
||||
const tasksApi: SidebarTasksRoutes | undefined = buildTasksApi(ctx, resolved.readLimit)
|
||||
return {
|
||||
'session.cwd': (payload) => {
|
||||
const { sessionId, cwd } = cwdOf(payload)
|
||||
@@ -327,6 +333,24 @@ function buildApi(
|
||||
agentPtyRegistry.close(uuid)
|
||||
return { ok: true }
|
||||
},
|
||||
// Background tasks: read one task's FULL output (a non-consuming peek —
|
||||
// the model's task_output cursor and report bit are untouched, so a
|
||||
// human watching a stream never steals the agent's bytes), and kill one
|
||||
// task. The task LIST itself arrives through the harness's session/tasks
|
||||
// push mirror, so no list route exists. Access is fenced to the owning
|
||||
// session by the tasks registry (the caller resolves from sessionId).
|
||||
'tasks.output': (payload) => {
|
||||
if (tasksApi === undefined) {
|
||||
throw new SidebarError('task-error', 'the background-task registry is not mounted in this deployment', 503)
|
||||
}
|
||||
return tasksApi.output(payload)
|
||||
},
|
||||
'tasks.kill': (payload) => {
|
||||
if (tasksApi === undefined) {
|
||||
throw new SidebarError('task-error', 'the background-task registry is not mounted in this deployment', 503)
|
||||
}
|
||||
return tasksApi.kill(payload)
|
||||
},
|
||||
// The side card preferences. The settings service is optional in the
|
||||
// composition; while absent the routes report undefined and the client
|
||||
// keeps the schema defaults. Writes are revision-guarded: a stale editor
|
||||
|
||||
Reference in new issue
Block a user