Feat/contextroom - #160
Merged
Merged
Conversation
排查"合并后 Room 无法让 Agent 创建文档"(409 no longer available)确认的 三个缺口: - executeMerge 失败不恢复 source 的 lifecycle:commit 未达时回滚 active (否则永久卡 merging——首页消失 + agent/文档引用全 409);commit 已达 时补完 merged 定稿(数据已搬迁,知识重建失败不阻断定稿) - initialize() 启动自愈:重启打断的合并遗留僵尸 merging Room,按 commitReached 回滚 active 或补完定稿 - 合并事务补迁 agent_sessions.room_id(runs/documents/links 均已迁移, 唯独会话表漏掉——source Room 的 agent 会话成为孤儿) - agent_room_not_available 的 409 响应附带你未解析的 roomId,便于定位 脏引用来源
…il view - Add GET /v1/context-rooms/:roomId/mails/:sourceId returning the full mail body (domain row bodyText with route-snapshot fallback, 60K cap), guarded by room membership - Wire the readMail API through the contract, gateway bridge, IPC and preload - Rework MailsPane: clicking a connector mail selects the row and opens a detail area in the lower half (identity header, sent-at, attachments, scrollable body rendered as markdown), replacing the summary popover; details are cached per session - Local snapshot mails keep the existing full-pane detail flow
…ttering - Classify "Agent invocation timed out" as transient so the worker retries with backoff instead of parking the source permanently in awaiting_review - Raise the knowledge agent chat timeout from 60s to 120s: reasoning models can spend over a minute thinking on longer emails
合并后新 Room 无法被 agent 使用(409 room_not_available)的完整链路: saveSnapshot 会把"快照未提及"的 active Room 物理删除(notInArray 硬删), 该假设在 Room 存在两个创建源(渲染端保存 + 网关侧实体晋升 auto Room) 的现行架构下不成立——合并完成后任何一次携带陈旧状态的渲染端回刷都会 把幸存 Room 从库里抹掉。 - saveSnapshot 移除"未提及即硬删"分支:删除只走显式 deletedRooms 软删 通道(可从回收站恢复);空快照同样不再清空全部 active Room - AgentPanel 仅在 Room 仍存在时提交 selectedRoomId:Room 已合并/删除/ 同步丢失时不再向网关提交死 id 触发 409,agent 转全局会话继续运行 - 回归测试:陈旧回刷不删除未提及 Room;显式 deletedRooms 软删不受影响
OverviewDashboard 存在半截可选链(overviewProjection?.nextSteps.length—— ?. 只保护到属性访问,字段本身为 undefined 时 .length 抛 TypeError)与 room 数组字段的裸 .length/.map 访问。合并完成到投影生成的过渡窗口内 这些字段可能缺失,首次点开 Room 即渲染崩溃并提示刷新;刷新后投影 生成完毕又能进入——与报障症状一致。 - 概览投影字段改为完整可选链(nextSteps/entities/timeline 等) - 组件入口对 room.materials/actionItems/timeline/people/fileItems 一次性 ?? [] 归一化,组件体统一使用归一化变量 - 宁可空面板不可白屏;投影生成后数据自然填充
按用户语义变更调整合并模型:不再并入两个 Room 之一,而是新建一个 Room 把两个旧 Room 都合并进去,旧的双双标记 merged 指向新 Room。 - 网关 previewMergeIntoNew/startMergeIntoNew:聚合双源影响预览; 建新 Room(最小合法 data 骨架 + 收养 A 的实体,B 的实体经第二段 mergeEntities 并入)→ 顺序执行两段既有 executeMerge(A→新、B→新), 全部资源搬移/失败恢复/收尾逻辑零改动复用;幂等以链尾段(:b)为准 - REST:POST /v1/context-rooms/merge-preview-new、merge-operations-new - 桌面端确认流程:方向选择器(保留哪个)替换为新 Room 名称输入 (预填 roomA 标题),确认按钮"合并到新 Room";IPC/bridge/类型全链接通 - 旧"并入现有"REST(merge-operations/preview)保留未动,仅 UI 不再使用
- RoomCard 菜单新增"合并到新 Room…"入口 - HomeView 手动合并对话框:选择合并对象 → 透传给 RoomDuplicateCenter 的手动模式(跳过候选列表,直接进入该对的聚合影响预览) - 复用新建式合并全流程:新 Room 命名、双源退役、等待终态 - 退出/关闭手动模式时完整清理配对状态
- 预览面板顶部新增合并流向示意卡:左侧两个源 Room(虚线边框 + "合并后退役"标记)汇入右侧新 Room(蓝色高亮 + 实时显示命名输入 的名称),方向一目了然 - "将迁移/不迁移/冲突"三个平铺区块收敛为单一备注条:冲突带警示 图标、排除项带信息图标,弱化次要信息 - 影响网格计数为零的项降透明度,扫一眼即可锁定有效迁移量 - 手动合并选择对话框补齐样式(与合并中心同视觉语言)
- 事件卡片的 ⋯ 菜单按钮移到卡片外、与日期标题同行,hover 卡片或日期行时显示;每张卡片上方固定预留一行专属空间 - 感知活跃度改为自带折叠标题条的面板,移除时间线工具栏里的跨区块开关 - 筛选区精简:搜索占位符缩短为「搜索」(完整提示移入 title),类型筛选改纯图标、「全部」保留文字 - 卡片展开时隐藏头部摘要行,避免与详情面板重复
- 确定性统计层:per-doc sketch 增量合并,支持度门槛防少样本过拟合 - LLM 定性层:隔离内部 Pi runtime 直调,采样与行为证据,失败仅降级 - 行为信号:划词改写指令、修改文档原话、手改 agent 输出的方向统计,只读回溯 - 单一画像文本:系统生成初稿 + 用户直接编辑,编辑即接管,可重新生成 - 生成注入经 runtimePrompt(服务端强制开关),划词改写 dispatch 注入 - 迁移 0044/0045 幂等;旧指令表迁移与补列修复(client.ts)
- WritingStylePane:画像直接编辑/接管/重新生成、双应用开关、语料列表与排除 - 补全注入:TTL 缓存 + <WRITING_STYLE> 动态段,固定指令段不动保前缀缓存 - shared DTO 与 IPC 通道(含白名单注册)、i18n zh/en
…ing turns The generation toggle used to inject the writing-style block into every main-agent run, including plain conversation. Injection is now gated by four signals: an active editor document, a selection, a writing-intent heuristic, or write/patch tool usage earlier in the session. Pure Q&A turns stay clean. requestsWorkspaceDocument moves to document-intent.ts as the shared heuristic. Toggle copy updated (zh/en); injection tests gain a real-schema regression case for the dispatch payload.
…e dispatch errors The selection-rewrite dispatch injects a writingStyle field that the agent input schema (additionalProperties: false) never declared, so the first rewrite with a non-empty style profile failed with subagent_input_schema_invalid. Also map dispatch failures in the selection-rewrite route to explicit error codes (503 for concurrency limits) instead of a generic internal error.
Operations accept an invocationId instead of trusting client-provided content: the resolver replays the selection replacement on the authoritative document body server-side, re-validates authorization at apply time, and keeps provenance consistent between route context and input. User-edited preview text is applied through the userEditedReplacementText override and attributed as agent proposal plus user modification. Legacy proposedContentJson inputs remain supported for in-flight operations.
room_analysis now assembles room materials gateway-side through the shared room-context digest (extracted from the room_context_get tool with its budget constants) and dispatches content-analyst, keeping the main-agent tool surface unchanged. content-analyst itself stays pure (caller-supplied material only). context-room drops the material-analysis task from its schema, system prompt, and dispatcher union, returning to four room-keeping tasks.
…ervability create-server assembles the selection-rewrite content resolver and the room-analysis digest injection. The orchestrator completion log gains task, status, errorCode, durationMs, and waitedMs, and dispatch rejections are logged as warnings, providing the T2/T3 evidence defined by the architecture plan's advance evaluation.
Records the interaction-modality boundary decision (conversation / editor-silent / background lanes), the M1 trust-binding and M2 analysis merge designs, and the M3 advance evaluation: the dispatch framework has no queue (concurrency limits reject outright), T2/T3 are not triggered under current load. Updates the dispatch-only agent inventory to the post-merge task layout.
Home and all-rooms views share a manual-merge entry hosted by PortedContextRoom (partner selection dialog plus the merge-center pairing flow), replacing the per-view dialog state. Duplicate-service and duplicate-center refinements with test updates.
# Conflicts: # apps/gateway/drizzle/meta/0044_snapshot.json # apps/gateway/drizzle/meta/_journal.json
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.
No description provided.