Repository navigation
feat: add /acp-rule human command to list and record session rules - #528
Merged
Merged
Conversation
Mirrors the /acp-cache human-command pattern for the acp_rule feature (#490): bare /acp-rule lists all rules recorded in the current session, /acp-rule <text> records one via the same kernel API the model path uses (persisted in the session sidecar, injected next round). Output is transcript-only and stripped from model context via the same custom-type exclusion in entriesToCoreMessages; falls back to ui.notify on hosts without sendMessage. Ported from billion-context #1259 (issue #1251). Fixes #527
Contributor
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-528Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr528.tgz
pi install ./packageThis comment is automatically updated on each push. |
Owner
Author
[bot] 🏷 收到,正在按 PR Review 规范审查本 PR(方向关 → 回归 → 代码 → 测试有效性 → diff 整洁度)。分支已拉取( |
Closed
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.
Fixes #527
What
Ports the
/acp-rulehuman command from billion-context #1259 (issue #1251) to this pi-native repo, mirroring the/acp-cachehuman-command pattern:/acp-rule(bare) — lists every rule recorded in the current session (id+ text) via kernellistRules/formatRulesList, sent to the transcript as anacp-rulecustom message. FriendlyNo rules recorded.when the list is empty./acp-rule <text>— records a rule directly through the same kernel API the model-facingacp_ruletool uses (addRule+resolveRuleLimits, feat(#433): wire acp_rule record tool behind opt-in rules config #490): persisted in the session sidecar, injected via system prompt on the next round, and echoed with the sameRecorded ruleN: <text>confirmation as the model path.rulesis not enabled, both paths show a warning pointing at"rules": trueinacp.jsoninstead of an empty list or a silent record.entriesToCoreMessages(same exclusion set asacp-status/acp-export); rules reach the model once per round via system-prompt injection, never duplicated. Falls back to raw-textui.notifyon hosts withoutsendMessage(issue Show /acp-status as persistent output instead of a notification #255).delete/clearsubcommands are intentionally out of scope, matching bili #1259 (upstream kernel wiring PR not merged).Files
src/messages.ts—ACP_RULE_CUSTOM_TYPEconst + added to the UI-only exclusion set inentriesToCoreMessagessrc/commands.ts—/acp-ruleregistration next to/acp-cachesrc/config.ts,src/user-config.ts— exposerules(andcoreOverrides.rules) onAdapterConfig/ConfigOverridesviaasRules()guardtests/rule-command.test.ts— list / record / restart-persistence / validation-error-verbatim / feature-off hint / notify-fallbacktests/messages.test.ts— strip-path:acp-rulecustom messages never project to the modeltests/integration.test.ts— command registry updated (9 flat commands)Differences vs bili PR #1259
addRule/listRulesdirectly (same APIs its forward resolves to) and persists viaruntime.save.runtime.adapter.rulesinstead of a proxy reply; validation errors are surfaced as an error toast (repo command convention) rather than a transcript message.Gates
Rebased on current master (post-#525):
No
package.jsonversion bump; no auto-merge — leaving review/merge to humans.