Repository navigation
feat(output-steering): turn classification + verbosity L0-L4 + clamp-only effort routing (#355) - #356
Conversation
…lassification, verbosity L0-L4, clamp-only effort routing (#355)
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-356Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr356.tgz
npm install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Review of PR #356 complete — findings below. Diff cleanliness (first gate): PASS
Pre-flight at PR head: all green
Spec conformance (#355) — verified against the spec AND the bili reference (PR#1096)
Disclosed deltas vs the bili reference — all three verified accurate
Regression review — existing behaviors touched by this diff
Verdict: no regressions; this is a purely additive feature. Minor find (non-blocking, reported in-thread per policy)README's Status line still says "23 source modules" while master already carried 38 root-level Merge gatingThis is a 中文摘要:审查了 PR #356(输出侧 steering 决策逻辑入内核)——diff 纯增量、本地与 CI 全绿、对 bili 参考实现的三处行为差异均属实且更严格(clamp-only 无升档风险)、文案字节级一致、不触碰任何既有行为与内核契约,可以合并(feat 类按规则需人工合并)。 |
[bot] 🏷 Addendum (second minor find, non-blocking): running |
Implements the kernel-owned output-side steering decision logic specified in #355 (owner-decided scope from billion-context#1093). The kernel decides; adapters land decisions onto wire fields — no protocol knowledge enters the kernel.
What's in it
New root module
src/output-steering.ts(+ barrel exports, README/DESIGN docs):classifyTurn(messages): TurnKindPure structural read of the last user message's block composition (
new_user_ask/mechanical_continuation/error_continuation/unknown); no content regex. The wire→structure normalization contract is documented in the module JSDoc; each adapter maps its protocol's tool-result shapes intoStructuralBlock(bili keeps its per-wire classifiers as thin normalizers).VERBOSITY_LEVELS,verbosityDirective(level),renderSteeringBlock,applySteeringToPromptByte-stable directive texts (frozen baseline; tests assert the exact literals). L0 = no injection, default L2. Placement is replace-in-place or append-at-tail — never prepend (prefix-cache invariant); same-level re-application is a no-op (idempotence tested, incl. the compress-retry double-pass path).
EFFORT_LADDER,clampEffortToFloor(current, floor = "low"): EffortValue | nullNever raises; returns
nullwhen the value is absent / unrecognized / at-or-below the floor, so adapters inject nothing (client-absent fields are never injected; the kernel does not know protocol field names by design).decideOutputSteering(messages, config?): { turnKind, verbosityLevel, lowerEffort }Config
{ enabled, verbosityLevel, effortRouting }, default OFF;resolveOutputSteeringConfigtolerates malformed input with warnings. Per-provider route overrides remain an adapter concern.Behavior deltas vs the bili reference (ranxianglei/billion-context#1096)
"low". The reference forced any non-low string down to low, which can raise unknown sub-floor values — a latent clamp-only violation. Known-ladder behavior is identical;xhighwas added to the ladder (the reference hit it via the force path — same outcome).thinking.budget_tokens → 1024, GooglethinkingBudget → 128, dynamic-1untouched): they are wire-field properties, not decision properties.<acp_output_steering>differs from bili's<bili_output_steering>. When migrating, bili must pass its own sentinel torenderSteeringBlock/applySteeringToPrompt, otherwise sessions pinned under bili's block would accumulate two steering blocks (cache bust). Documented in the module JSDoc.Verification (rebased onto current origin/master, v0.0.82 base
b30723f)npm run typecheck— cleannpm test— 904 pass / 0 fail, including the new 429-line regression suite that ports all applicable cases from the bili reference (byte-exact L1–L4 text anchors, idempotence/retry paths, clamp matrix, config resolution)npm run build— greenFollow-up after merge + release
Per #355: confirm
npm view acp-kernel versionshows the new release → billion-context bumps the exact pin → release → replace the duplicated decision logic in PR#1096 with kernel calls (wire-side landing + its own sentinel stay in bili).Closes #355