fix(agent): make referenced sessions readable via Proma CLI#1293
Open
ErlichLiu wants to merge 1 commit into
Open
fix(agent): make referenced sessions readable via Proma CLI#1293ErlichLiu wants to merge 1 commit into
ErlichLiu wants to merge 1 commit into
Conversation
显式 &session: 引用此前只注入会话元数据,读取历史完全交给模型自行判断,Pi runtime 又不会展开 session-cleaner,导致 Agent 可能只依据标题作答。 - 引用块改为注入由 @proma/session-core 生成的受限 turn 地图(最多 16 个 turn),并给出可直接执行的 info/outline/export 命令 - 明确要求回答依赖被引用会话正文时必须先用 CLI 读取,不得仅凭元数据或地图回答 - JSONL 超过 2 MiB 时跳过宿主侧扫描,只注入渐进读取指引,避免主进程同步读超大历史 - 地图预览做 XML 转义,避免历史文本破坏 prompt 标签结构 - Pi runtime 在存在会话引用时自动合并 session-cleaner 到 skillMentions(首轮与流式追加消息两条路径) - 开发模式改用 bun 运行源码 CLI 并带 --dev,避免误读 ~/.proma 而非 ~/.proma-dev Made-with: Proma
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.
问题
显式
&session:引用此前只把会话元数据(id / title / updatedAt / History path)注入 prompt,是否读取历史完全交给模型自行判断,指令也是条件式的「需要时再读」。Pi runtime 又设置了noSkills: true,只对显式skillMentions或/skill:展开 Skill,因此提示词里提到的session-cleaner从未真正展开。结果是 Agent 可能只依据标题和元数据作答,而不读取被引用会话的正文。开发模式还有一个额外缺口:未打包时 CLI 判定为不可用,提示退回裸
proma或直接读原始 JSONL,而 CLI 默认读~/.proma而非~/.proma-dev。方案
保持「CLI 是 Agent 读取会话历史的唯一入口」,但由宿主保障引用可发现:
@proma/session-core生成的受限 turn 地图(最多 16 个 turn),并给出可直接执行的info/outline/export命令session-cleaner合并进skillMentions,首轮与流式追加消息两条路径都覆盖bun <repo>/apps/cli/src/index.ts --dev运行源码 CLI,避免误读正式版会话库解析逻辑仍然只有一份真源:宿主地图和 CLI 都走
@proma/session-core,主进程不新增 JSONL 解析。测试
新增
agent-session-context-prompt.test.ts,覆盖同工作区引用的地图与 CLI 指令、跨工作区排除、超大会话不被宿主扫描、Pi 合并session-cleaner;并在agent-runtime-env.test.ts补充打包版PROMA_CLI与PATH注入断言。tsc --noEmit --project apps/electron/tsconfig.json)未验证:未启动 Electron 开发环境做人工端到端点检,也未在 Windows / WSL 上实测开发模式 CLI 前缀。
Made with Proma · GitHub