Repository navigation
feat(rules): acp_rule tool gains delete/clear; document /acp-rule command - #557
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-557Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr557.tgz
pi install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Review complete — all checks pass, ready for human merge. (Note: this PR is my own earlier work per #555 floor 4; reviewed it with fresh eyes as an external reviewer would.) ① Issue direction (#555) — correct. The issue was a human decision to give models full CRUD over ② Regression review — existing behaviors touched by the diff, each audited:
No high-risk patterns found: error handling stays verbatim-return (no fail-fast→swallow drift); no default/threshold/timing drift beyond the three disclosed changes. ③ Code review — Byte-identical claim — independently verified: cloned billion-context master and compared programmatically. Tool description: identical, 614/614 chars. All three parameter descriptions: byte-identical (pi uses single-quotes for the Pi dedupe claim — verified against installed pi 0.83.0 (the pinned devDependency): ④ Test validity — real tests with teeth: exact string assertions on every echo and kernel error, sidecar persistence via ⑤ Diff cleanliness — clean. Every one of the 6 files serves the PR purpose; no unrelated files, no mass reformatting, no lockfile churn. Behavior changes (re-flagged per policy):
CI: all green on head Auto-merge gate (§7.4): does NOT auto-merge — this is Conclusion: mergeable. 中文摘要:审查了 acp_rule 增删改查补全 PR——逐项核对了既有行为(列表/记录/侧边文件/命令侧均无回归,三处行为变更均已披露旧值→新值+原因)、字节级接口对齐和 pi 同名去重说法均实测为真、测试有牙且本地复现与 PR 声称数字一致、CI 全绿;因属新功能按规范留给人工合并。 |
Fixes #555
What changed
Model tool — full rule rights (
src/rule-tool.ts)acp_rulenow acceptsdelete: "ruleN"(remove one) andclear: true(remove all), alongside existingrule(record) and no-arg list.executeRule(src/rules-feature.ts): one operation per call — mixed operations are rejected withUse one operation per call: record (rule), remove one (delete), remove all (clear: true), or list (no arguments).without mutating anything; kernel validation errors are returned verbatim (no throw, no FAILED marker), same as record today.acp_ruleserved by the billion-context proxy (its src/compress-tool.ts RULE_TOOL/RULE_PARAM_SCHEMA), per the cross-host hard requirement — a model trained under one host sees the same parameter shape under the other, no relearning.removeRule/clearRules.Docs (诉求 2, en+zh synced)
/acp-rulecommand section (list /<text>/remove <id>/clear, one-op-per-call, sidecar persistence, dual-registration caveat) + tool-table row updated.### rulesdescription rewritten for full CRUD incl. delete/clear echo texts, mutual exclusivity, unknown-id verbatim error, byte-identical-shape note, dual-registration blockquote.Check items from the issue
@earendil-works/pi-coding-agentdist/core/extensions/loader.js + runner.jsgetAllRegisteredTools) — pi dedupes tools by name across extensions; first registration per name wins, later registrations silently ignored, no warning. Since the two implementations back different stores (this adapter: pi session sidecar; proxy: its own session state), which one answers depends on load order. Documented in both READMEs' new section + both CONFIGURATION files: enable rules on only one side. Note the collision can only arise from an undetectable transparent-proxy setup — when the proxy is detectable (BILLION_CONTEXT_PROXYexported or/bili/baseURL) this adapter stands down entirely, so the two plugins never co-register there.no rule with id "rule99" — list current rules first…); clear empty store →No rules to clear.; plus delete-removes-one with sidecar assertion, clear-count, and a schema-shape test pinning the cross-host parameter contract (keys[clear, delete, rule], types, description invariants).⚠ Behavior changes (old → new)
{rule: ""}/ whitespace-only input: previously returned the validation errorrule text is empty — provide the reminder to record.; now falls through to list (matches executeRule semantics: empty-after-trim = list request). WHY: cross-host consistency — the bili proxy has always behaved this way, and the issue requires identical behavior under both hosts.Verification
npm run typecheckcleannpm test: 998 tests, 992 pass, 0 fail, 6 skipped (full suite, not just rule tests)npm run buildsuccess (dist self-contained, acp-kernel still bundled inline)No version bump (release-branch territory). No changes to load-bearing surfaces: ref-tag rendering, token calibration, host detection/stand-down,
.acp.jsonsidecar format, update.ts, kernel pin.