feat(agent): 支持安全批量删除委派子会话【已审核 PR】 - #2031
Open
Andreaseszhang wants to merge 9 commits into
Open
Andreaseszhang wants to merge 9 commits into
Andreaseszhang wants to merge 9 commits into
Conversation
Made-with: Proma
Made-with: Proma
Made-with: Proma
Made-with: Proma
Made-with: Proma
Made-with: Proma
Made-with: Proma
Made-with: Proma
Andreaseszhang
marked this pull request as draft
September 9, 2026 04:15
Made-with: Proma
Andreaseszhang
marked this pull request as ready for review
September 9, 2026 07:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为 Proma 的直接委派子会话增加父会话作用域内的安全批量删除能力。用户可从父会话或直接子会话的菜单进入显式多选模式,在当前 active/archived 视图中选择可删除的直接子会话;主进程在提交前复核归属、委派关系、后代与 busy 状态,避免误删运行中或非目标会话。
改动
packages/shared/src/types/agent.ts、apps/electron/src/preload/index.ts、apps/electron/src/main/ipc.ts— 新增并贯通deleteDelegatedSessionsIPC 契约与逐项结果类型。apps/electron/src/main/lib/agent-session-delete-service.ts— 提供批量删除协调器:参数去重/上限、父子关系与委派身份验证、teardown 后 TOCTOU 重检、单次 metadata 提交和逐项错误反馈。apps/electron/src/main/lib/agent-session-manager.ts、apps/electron/src/main/lib/fs-retry.ts— 支持批量 metadata 原子删除;将 JSONL 与会话工作目录清理改为异步且最多四路并发,并保留 Windows 文件占用重试策略。apps/electron/src/renderer/components/app-shell/LeftSidebar.tsx、apps/electron/src/renderer/lib/delegated-session-bulk-delete.ts— 增加父会话范围的多选、全选、Busy 禁用、确认删除、部分失败重试和 Esc 退出;操作浮层锚定父会话右侧,按钮等宽并收紧尺寸;选择行采用单一role="checkbox"语义。apps/electron/src/main/lib/*test.ts、apps/electron/src/renderer/lib/delegated-session-bulk-delete.test.ts— 覆盖父子归属、Busy、后代、teardown 后状态变化、部分失败、原子 metadata 删除和选择状态协同。测试方法
bun test apps/electron/src/main/lib/agent-session-manager.test.ts apps/electron/src/main/lib/agent-session-delete-service.test.ts apps/electron/src/renderer/lib/delegated-session-bulk-delete.test.ts,38 项通过。bun run --filter='@proma/electron' typecheck。bun run --filter='@proma/electron' build:renderer。git diff --check。备注
main。Made with Proma · GitHub