Repository navigation
feat(nudge): persist nudge injections as display-only session entries + single-line acp.log (closes #326) - #329
ranxianglei wants to merge 1 commit into
Conversation
|
分诊(队列清理 #484): KEEP-VALID(#326 根因解)。 缺口仍在:master 无 rebase 风险:中等。 nudge 注入路径( |
9213fd4 to
5f4fe20
Compare
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-329Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr329.tgz
pi install ./packageThis comment is automatically updated on each push. |
Rebased onto current master ( Adaptation to post-9/8 master changes:
State-rebuild skip verification (the required check): Small fixes applied directly during the rebase:
Evidence (all run on the rebased head):
Ready for CI re-run and review. 中文摘要:已按分诊要求把 PR 变基到最新 master(v0.1.74),丢弃了依赖/pin 的 hunk(pi-tui 本就是 master devDep,acp-kernel 保持 0.0.81 不动),将 nudge 记录持久化适配到 per-sid Map 与 turn-boundary 之后的新注入点,并验证了 state-rebuild 日志回放会跳过 acp-nudge 条目(仅处理 type==="message",全部 10 个条目扫描模块同此);全量测试的失败集与干净 master 基线逐字节一致(82 个均为沙箱 /tmp 只读导致的既有失败,CI 中通过),零回归,typecheck/build/目标测试全绿,可以合并。 |
|
这个目的是啥?改了啥 有啥影响 另外冲突 |
5f4fe20 to
6d975de
Compare
目的(对应 #326): nudge 注入(上下文超阈值时的压缩提醒)目前只走 改了啥(8 个文件,+226/−7):
有啥影响:
冲突: 上次推完 rebase 后 master 又前进了 28 个提交(#466 fork-ref-stability、#487 enabled-config、#464 terminal-escape 日志等,动了 一句话:把 nudge 注入持久化为只读 session 条目并让 acp.log 单行可 grep(#326),因 master 前进导致的冲突已二次变基解决并全量验证零回归,可以合并。 |
|
冲突 |
… + single-line acp.log (closes #326)
6d975de to
f514d58
Compare
master 又前进了——上次推完( 已做第三次变基到
提醒:这个仓库最近 master 合入比较频繁,如果在你点合并前又有新 PR 落地,dirty 标记可能再次出现——再拍我一声即可秒级再变基,或者趁现在窗口期直接合并也行。 一句话:冲突是 master 又前进(#324 动了同一批热文件)所致,已第三次变基到最新 master 并解决唯一的并集型小冲突、全量验证零回归,可以合并。 |
|
Superseded by #515. Line-level comparison of the two PR diffs confirms #515 carries this exact change rebased onto current master (v0.1.76), plus:
Closing to avoid double-merge risk from a stale base. Reopen if anything was lost in the rebase. |
Closes #326.
Triage / verification
pi.sendMessage({customType})mid-turn is unsafe — while streaming, agent-session falls back tosteer()(injects as steering input). The/acpprecedent (commit 0ff701e, issue Show /acp-status as persistent output instead of a notification #255) only works because slash commands run idle; it cannot be reused from thecontexthandler.pi.appendEntry(customType, data)appends{type:"custom", ...}to the session JSONL — pure sync append, survives restarts, never sent to the model.entriesToCoreMessagesprojects onlytype:"custom_message"entries into the sent view ⇒type:"custom"records are display-only by construction. This satisfies the issue's "prefer a display-only entry type" constraint, so nodebuggating is needed (zero context cost).addCustomEntryToChat, and the restart-rebuild path (renderSessionEntries) includes them ⇒ registering an entry renderer makes records visible both live and afterpi --session <id>resume.Changes
src/index.ts): on nudge injection, append a compact one-line record (e.g.[ACP nudge] EMERGENCY 95% · T1 · top range m00120–m00168) viapi.appendEntry("acp-nudge", {text}). Deduped per user turn — emergency nudges re-inject on every LLM call until retry-capped and must not flood the session file.markNudgeRecordedruns only after a successful append (a failed append retries on the next fire). Recorded-state cleared at session start alongside nudge-shown tracking.src/index.ts):registerEntryRenderer("acp-nudge", ...)renders the record as a dim boxed line (pi-tuiBox/Text,customMessageBgbackground).@earendil-works/pi-tuiadded as devDependency pinned exactly0.83.0(matching the host) and bundled inline by tsup —diststays zero-runtime-deps (verified: no bare pi-tui import remains in the bundle).src/log.ts):\r/\nin string fields (includingError.stack) are escaped to literals, so every acp.log entry occupies exactly one physical line —grep nudge-injectednow returns the full nudge body instead of just the headline.Tests (4 new; full suite green)
formatNudgeRecordunit — exact-string assertions matching the issue example (emergency/non-emergency, tier, missing ranges).undefined(invisible but persisted).log.test.ts— multi-line field values (nudge text + stack trace) stay on one tagged physical line.Verification
npm run typecheck✅npm test✅ — 466 pass / 3 skipped / 0 fail (469 total)npm run build✅ — dist 627 KB, pi-tui fully inlineddist/index.jsin plain node ✅