Commit Graph
2083 Commits
Author SHA1 Message Date
ework-agent 4df94de689 fix(tests): normalize golden snapshots to LF before compare (Windows autocrlf)
CI run 36102348905: all 4 golden tests failed on windows-latest because GitHub Actions checkouts materialize committed-LF files as CRLF in the worktree; runtime-generated canonical text uses LF. Normalize disk content to LF so the gate is platform-deterministic while still catching any real content drift.
2026-09-25 14:31:56 +08:00
ework-agent be943ca023 docs: normalize §7.3 list indentation (restore pre-existing bullets, align new ledger bullet) 2026-09-25 14:28:55 +08:00
ework-agent 81befc6dc6 test: wire-contract anti-regression system — parity fakes, goldens, unified ledger (#1304)
Consolidates the #1301 served-surface gate and the #1302 kernel-export gate
into one wire-contract suite and extends it per owner decision on #1304
(items 1+2+3, plus the 4-protocol scripted-client matrix phase):

- tests/wire-contract-fakes.ts: WIRE_RULES ledger (WC-001..WC-006, each with
  production/doc provenance) + strictest-known validation for all four wires
  (anthropic /v1/messages, openai chat, responses, google v1beta) + four
  validation-parity fake upstreams on listen(0) with canned per-wire replies.
- tests/wire-contract.test.ts: four layers — ledger self-check (every rule id
  has a live enforcement clause), A kernel exports, B bili-built surfaces,
  C plugin manifest (default + opt-in), D live proxy-mode forward of one
  client-shaped turn per protocol through the matching fake (asserts the
  forwarded tool set is exactly bili's intended surface and the fake's
  strictest validation accepts it). The anthropic lane reproduces #1299
  end-to-end. Supersedes tests/kernel-pin-wire-schema.test.ts and
  tests/issue1299-anthropic-top-level.test.ts (all their assertions kept).
- tests/wire-contract-golden.test.ts + tests/golden/wire-contract/*.json:
  byte-equal golden snapshots of every advertised tool schema at both layers
  (kernel exports, bili surfaces, plugin manifest default+opt-in); manifest
  version normalized to <VERSION> so release commits don't churn it.
- scripts/update-wire-contract-goldens.ts: explicit regeneration path.
- AGENTS.md §7.3: institutional rule — every upstream rejection/validation
  constraint becomes a permanent wire-contract rule inside the fixing PR;
  the ledger only grows.
2026-09-25 14:18:36 +08:00
ranxianglei dc8bdea5d0 Merge pull request #1303 from ranxianglei/2026-09-25_release-v0.1.149
release v0.1.149
v0.1.149
2026-09-25 13:45:19 +08:00
ranxianglei 130751b96e Merge branch 'master' into 2026-09-25_release-v0.1.149 2026-09-25 13:41:14 +08:00
ranxianglei fab7dcff31 Merge pull request #1301 from ranxianglei/2026-09-25_kernel-0.0.89
fix: pin acp-kernel 0.0.89 — plain-top compress input_schema restores Claude requests (#1299)
2026-09-25 13:40:50 +08:00
github-actions[bot] 415ca7f959 release v0.1.149 2026-09-25 05:40:18 +00:00
ranxianglei 69988547c2 Merge pull request #1302 from ranxianglei/2026-09-25_pin-0.0.89
fix: pin acp-kernel 0.0.89 — Claude-lane hotfix (top-level anyOf removed from compress schema)
2026-09-25 13:37:23 +08:00
ework-agent cd56fe1e19 fix: pin acp-kernel 0.0.89 — top-level anyOf removed from compress schema (Anthropic 400, #1299) 2026-09-25 13:36:11 +08:00
ework-agent 14658a411f fix: pin acp-kernel 0.0.89 — plain-top compress input_schema restores Claude requests (#1299) 2026-09-25 13:35:12 +08:00
ranxianglei 570a2ea75e Merge pull request #1161 from ranxianglei/wt-1153-ework-daemon
feat: hermetic local npm registry e2e infra — real self-update chain coverage (#1153)
2026-09-25 13:03:15 +08:00
ework-agent 92dce5e7e6 merge: resolve #1161 conflicts vs master — README section union (registry + native-lane + #1297 CI wording), lock regen (verdaccio subtree only) 2026-09-25 12:56:20 +08:00
ranxianglei db50552d8d Merge pull request #1178 from ranxianglei/2026-09-23_rule-delete
feat: acp_rule delete/clear — wire kernel removeRule/clearRules (#1177)
2026-09-25 12:52:08 +08:00
ework-agent fd2a2daa09 merge: resolve #1178 docs conflicts with master (#1251 /acp-rule + #1192 manifest wording) — union of both 2026-09-25 12:51:04 +08:00
ranxianglei 22460c610b Merge pull request #1297 from ranxianglei/2026-09-25_e2e-auto-trigger
ci: auto-trigger codex e2e on request-pipeline PRs (#1296 note-4 hardening)
2026-09-25 12:33:46 +08:00
ework-agent 95a866bde1 ci: auto-trigger codex e2e on request-pipeline PRs (#1296 note-4 hardening) 2026-09-25 12:31:45 +08:00
ranxianglei bc880b55f8 Merge pull request #1296 from ranxianglei/2026-09-25_release-v0.1.148
release v0.1.148
v0.1.148
2026-09-25 12:30:13 +08:00
ranxianglei bfbe7b6241 Merge branch 'master' into 2026-09-25_release-v0.1.148 2026-09-25 11:57:47 +08:00
ranxianglei 6b9c41a70a Merge pull request #1289 from ranxianglei/2026-09-25_fix-cache-ledger-k-cap
fix: count all post-fold requests in cache ledger turnsToNextFold (#1286)
2026-09-25 11:56:24 +08:00
github-actions[bot] 8b8bdae782 release v0.1.148 2026-09-25 03:55:25 +00:00
ranxianglei 897c9d7779 Merge pull request #1291 from ranxianglei/2026-09-25_surface-unrouted-endpoints
fix: surface unrouted / unrecognized-path requests instead of going silent (#1290)
2026-09-25 11:51:46 +08:00
ranxianglei e3086d3a5f Merge branch 'master' into 2026-09-25_surface-unrouted-endpoints 2026-09-25 11:51:33 +08:00
ranxianglei 28a37960f3 Merge pull request #1281 from ranxianglei/2026-09-24_pi-manifest-absorb
fix: advertise absorb/acp_rule in plugin manifest when globally enabled (#1278)
2026-09-25 11:50:48 +08:00
ework-agent 41ebbdb753 docs: mirror the #1290 unrecognized-endpoint section into README.zh-CN.md 2026-09-25 11:48:13 +08:00
ework-agent 2dab17196f fix: keep bili's own control-plane URLs out of the unrouted-endpoint hook (#1290) 2026-09-25 11:48:13 +08:00
ework-agent 98a65421ca fix: surface unrouted / unrecognized-path requests instead of going silent (#1290)
A request whose path matches no known wire protocol (e.g. a third-party
plugin's custom wire such as commandcode's Go plan POST /alpha/generate) was
relayed byte-for-byte with ZERO signal — neither compression nor any
explanation. That contradicts the #1158 "tell me why it didn't compress"
promise and the #897 loud-not-silent principle. Make both ends loud.

Client (native-intercept + dsh-native):
- New optional NativeInterceptState.onUnroutedModelUrl hook, fired for every
  request the fetch patch lets through WITHOUT routing because its URL misses
  isModelApiUrl. Undefined hosts stay silent (no behavior change for others).
- dsh wires it to log each distinct unrouted endpoint once per process via
  console.error + persistClientEvent (the durable channel GUI hosts need),
  bounded at 256 distinct endpoints like gateRefusals.

Proxy (server/observability + server + acp-status):
- getUnrecognizedPathStats() aggregates the existing per-path warn map.
- /__bili/stats gains an `unrecognizedPaths` field (count + per-path counts).
- acp_status gains an "UNRECOGNIZED PATHS (instance-level)" section while such
  requests exist, mirroring the UNDECRYPTED TRAFFIC section.

Docs: README troubleshooting section explaining the limitation + the new
signals + the workaround (use the provider's standard protocol endpoint).

Behavior change (intended): non-model-API URLs previously went direct silently;
each such endpoint now logs once per process. /__bili/stats and acp_status gain
additive fields/sections. No existing threshold/default/timing/output-format
changed. This does NOT make custom wires compressible — that is a separate
feature (custom request/response codec + config seam) pending owner decision.

Regression tests: native-intercept (hook fires for a custom wire, not for a
routed model endpoint) + dump-observability (per-path counts exposed).
2026-09-25 11:48:13 +08:00
ework-agent 081f05d9c4 fix: advertise absorb/acp_rule in plugin manifest when globally enabled (#1278)
The /__bili/plugin/manifest route read absorbEnabled(config)/rulesEnabled(config) off the raw kernel-default config (opts.kernelConfig), while the per-request path resolves opts.compress onto it via applyCompressSettings. A user enabling compress.absorb.enabled in their config file therefore got [ACP absorb] prompts on the wire but no callable absorb tool registered by hosts that register only manifest tools (Pi native plugin) — the prompts could never be executed.

Resolve the global compress settings at the manifest route so both paths agree; per-session/provider enablement stays execution-time-gated. Adds enabled + disabled regression tests exercising the real file-config path.

Fixes #1278
2026-09-25 11:47:42 +08:00
ranxianglei 929b9456f4 Merge pull request #1287 from ranxianglei/2026-09-24_misrouted-messages-relay
fix: relay non-conversation bodies verbatim instead of 400ing them (#1284)
2026-09-25 11:45:17 +08:00
ranxianglei 2b85407a68 Merge pull request #1293 from ranxianglei/2026-09-25_claude-settings-win32-file
fix: deliver claude --settings via temp file on Windows (#1292)
2026-09-25 11:35:34 +08:00
ework-agent e62fc5bd39 fix: deliver claude --settings via temp file on Windows (#1292)
On Windows every claude launch rides a .cmd shim through cmd.exe /d /s /c,
whose quote-toggle parsing strips embedded quotes (#679). The native-install
override injected the ANTHROPIC_BASE_URL override as an inline --settings JSON
string, so claude received a quoteless {env:{...}} and died with
"Invalid JSON provided to --settings" before any session could start.

Deliver the same object via a temp settings file on win32 (path carries no
quotes; cleaned up in the existing tmpFiles finally-block). Claude accepts a
file path for --settings with identical precedence to the inline string, so
the delivered settings are unchanged. POSIX keeps the byte-identical inline
form — no shell re-parses argv there. Same fix class as codex's #681
overlay-file gating. Adds LauncherDeps.platform so tests drive the win32
paths from a POSIX host; regression suite asserts the comspec line carries a
parseable-JSON file path and the child env carrier stays consistent.
2026-09-25 11:27:59 +08:00
ranxianglei c64c136868 Merge pull request #1207 from ranxianglei/wt-1179-ework-daemon
feat: CCR v2 — covered-ref spans, range-level decompress, ID-returning search_context; CCR default-on (#1179)
2026-09-25 11:20:04 +08:00
ework-agent b3e37626af fix: CCR opt-in on every lane — drop the proxy-mode default-on (#1207 owner decision)
Unset compress.ccr no longer arms anything: the server stamp keeps the raw
three-level merge (resolvedCcrCfg = compressCfg.ccr), applyCompressSettings
loses the default-on else-branch, and resolveRequestConfig returns base
unchanged when nothing is configured. Flip CCR on only via an explicit
compress.ccr.enabled=true at some level, after local verification. Tests,
READMEs (en/zh) and CONFIGURATION (en/zh) updated to the opt-in contract;
preflight e2e pins dropped — the default-off boundary is now a tripwire
against accidental default flips.
2026-09-25 11:16:09 +08:00
ework-agent 936a702a1b fix: pin CCR off in preflight e2e tests — default-on acp_retrieve schema legitimately shifts the recent-window boundary (#1207 rebase onto #1189/#1273/#1270) 2026-09-25 11:05:01 +08:00
ework-agent 417c95db10 fix: CCR v2 range decompress — per-ref store-first source selection (#1283)
resolveDecompressRange consulted the fold-time content store only when zero
refs were found in the exec-time view, assuming view/store mutual exclusion
per ref that nothing enforces: a covered ref left visible in the view
contributed its view text, which for arrival-stored refs (oversized tool
results — the primary CCR case) is the 📦 placeholder, not the original,
while the ack still claimed a full restore; a partially visible span
silently dropped the missing refs.

Per-ref selection supersedes the all-or-nothing fallback: each picked ref
prefers retrieveByRef(store) when present (store entries are immutable
originals — append-only, first write wins, refs never reissued), else falls
back to the view text (pre-CCR folds have no entries). Span order stays
deterministic (coverage num order). Regression test: an arrival-stored ref
whose view copy is the placeholder inside a restored span yields the stored
full original (verified to fail against the pre-fix code).
2026-09-25 10:59:48 +08:00
dog dfa94ab9fb fix: review round — default-on arms at the server gate; range restore falls back to the content store
- server.ts: resolvedCcrCfg now re-applies the #1179 default-on
  (resolveCompress returns the raw merge; applyCompressSettings owns the
  unset-means-enabled default this arming path bypassed) — with no ccr key
  at any level the session previously NEVER armed: 'on by default in
  proxy mode' was dead at its only enforcement point (reviewer-caught
  wiring gap, confirmed against the real server path).
- decompress-shared.ts: range restore falls back to the fold-time
  content store when covered originals left the client's re-sent view
  (native-compaction archive adoption, client-side trimming, restart
  with a compacted client) — keyed by the coverage's own ref numbers;
  honest failure text when neither view nor store has them.
- decompress-shared.ts: plugin-mode error names the real constraint
  (proxy-mode only) instead of unsatisfiable 'enable compress.ccr.enabled'.
- decompress-shared.ts: client retries dedupe on the deterministic
  injection id — no duplicate full-text message, no rangeRestores
  inflation; temp files 0600 with the span in the filename.
- tests: store-fallback + retry-dedupe + no-config default-on e2e
  (real server path); codex-official tool list gains acp_retrieve
  (intended default-on ripple in proxy mode).

Follow-up: unbounded store growth tracked in #1282.
2026-09-25 10:59:48 +08:00
ework-agent 97b93a840d fix: address PR review nits — gate BLOCK SPANS on CCR arming; clarify default-on comment (#1207) 2026-09-25 10:59:48 +08:00
ework-agent cc0331240b feat: CCR on by default in proxy mode; explicit ccr.enabled:false opts out (#1179) 2026-09-25 10:59:48 +08:00
ework-agent 6e51f375b0 feat: CCR v2 — covered-ref spans, range-level decompress, ID-returning search_context (#1179) 2026-09-25 10:57:03 +08:00
ranxianglei a37e0182c6 Merge pull request #1273 from ranxianglei/2026-09-24_ccr-plugin-lanes
feat: enable CCR (acp_retrieve) on host/plugin lanes (#1271)
2026-09-25 10:55:16 +08:00
ranxianglei c8e6ffd68f Merge pull request #1189 from ranxianglei/2026-09-23_gc-content-store-companions
fix: GC the CCR content-store companions (#1180)
2026-09-25 10:52:22 +08:00
ranxianglei c49b7790be Merge pull request #1270 from ranxianglei/2026-09-24_kernel-0.0.88-pin
fix: pin acp-kernel 0.0.88 (gentle nudge tip + honest cache-report labels)
2026-09-25 10:50:59 +08:00
ework-agent 99ef653f66 fix: count all post-fold requests in cache ledger turnsToNextFold
The consumedFoldSeq gate served two roles in recordCacheSample: gating the
decomposeSample pending list (compRepay attribution — must fire once per
fold) AND driving the per-fold requestsAfter counter. Because each fold left
pendRefs after its first post-fold sample, requestsAfter froze at 1 and
pushFold's k = requestsAfter freeze capped turnsToNextFold at 1 for every
fold regardless of actual cadence. The kernel batch reference path
(buildCacheReport) counts ALL samples after a fold into requestsAfter and
the inter-fold window into turnsToNextFold, so the incremental ledger diverged
from batch for any fold followed by >= 2 requests: paidBack was systematically
false (breakeven is usually >= 2) and savedSoFar/grossSaved/netTokens were
understated by ~(N-1)x for every provider.

Decouple the concerns: the counting loop now iterates every elapsed fold
(f.at <= s.at); the consumedFoldSeq gate remains on the pending list only,
so compRepay/T attribution semantics are unchanged. With counting fixed, the
existing pushFold freeze of k = requestsAfter becomes exactly the batch-path
turnsToNextFold window under chronological sample arrival — no new persistent
field, no ledger format change.

Adds a regression fixture with three full-hit samples between folds
(S=12140/sigma=1000 -> breakevenTurns ~2.5): asserts field-for-field parity
between incremental and kernel batch reports (turnsToNextFold, paidBack,
requestsAfter, savedSoFar, economics summary), plus hand-computed values.
Before the fix this fixture failed with k=1/paidBack=false vs batch
k=3/paidBack=true; the existing single-sample fixture could not catch the
bug because k=1 coincides on both paths there.

Behavior change (disclosed): turnsToNextFold in /acp_cache fold economics
goes from min(1, actual cadence) to the true inter-fold request count;
paidBack flips false->true where measured cadence actually reaches
breakevenTurns; savedSoFar/grossSaved/netTokens scale up accordingly.

Fixes #1286
2026-09-25 00:38:30 +08:00
ework-agent b594090b3a fix: relay non-conversation bodies verbatim instead of 400ing them (#1284) 2026-09-25 00:20:51 +08:00
ework-agent eb3a95c903 fix: gate plugin-lane CCR arming on base-config enablement; clear pending retrievals on disarm
Review follow-ups for #1273:

- The plugin arm now also requires opts.compress.ccr.enabled === true — the
  exact source the plugin manifest reads (server.ts:969). Route/model-scoped
  enablement with the base flag off previously armed the store and emitted
  placeholders while the manifest never advertised acp_retrieve: silent loss.
  Route-scoped-only enablement stays proxy-mode-only (the proxy injects the
  tool itself, per-request).
- storeEffectiveCcr(undefined) now clears pendingRetrievals: a retrieve queued
  on a lane that later switches to a non-CCR wire would otherwise flush as a
  stale trailing full-text message when the lane re-arms. Not persisted either
  way; this only tightens the in-memory window.
- e2e: acp_retrieve now driven through the real POST /__bili/plugin/tool
  endpoint (covers the conversation gate + ack round-trip), and a new
  regression test pins both halves of the route-scoped behavior (plugin lane
  verbatim, proxy lane armed).

Fixes #1273 (review)
2026-09-24 22:39:12 +08:00
ework-agent 7321d7de67 docs: sync store-footprint estimator wording after defaultCountTokens switch (#1180)
a3ec90f9 changed contentStoreTokens from chars÷4 to the kernel's CJK-aware defaultCountTokens but left five 'chars ÷ 4' descriptions behind (README en/zh, CONFIGURATION en/zh, session-gc module header). No behavior change.
2026-09-24 22:23:32 +08:00
ranxianglei a3ec90f96d review follow-up — CJK-aware store footprint, shape-probe twin guard, foreign-companion audit log (#1180) 2026-09-24 22:12:10 +08:00
ework-daemon 0a24e75386 docs: reflect plugin-lane CCR scope in README + CONFIGURATION (en/zh) (#1271)
Reviewer fix: the behavior change disclosed in the PR body (plugin mode arms
CCR on anthropic/openai wires while acp_retrieve is manifest-advertised) was
not mirrored in the docs, which still stated 'proxy mode only / native-tools
wires only' as the v1 scope gate.
2026-09-24 20:07:41 +08:00
ework-agent 9a8698116a feat: enable CCR (acp_retrieve) on host/plugin lanes (#1271)
CCR v1 shipped proxy-mode-only with a hard !pluginMode gate, so no real lane
could turn it on. This wires the bili side of the three-repo contract:

- plugin manifest advertises acp_retrieve only while ccr.enabled (#1192 rule),
  on anthropic/openai wires only — never responses, which the proxy disarms.
- arming gate now allows plugin mode on exactly those round-trippable wires
  (ccrPluginWireOk); responses/google stay out so a placeholder is never
  emitted where it cannot be retrieved (silent loss, #1097).
- prepare* drains pending retrievals in plugin mode so the full original rides
  back request-only (ephemeral, never persisted).
- global ccr config threaded into the manifest so advertising reflects operator
  config, not just the kernel default.

Adds tests/ccr-plugin.test.ts: manifest scoping + wire-scope unit tests + a
plugin-lane e2e (fake upstream, zero tokens) proving store->placeholder->
retrieve->full-text round-trip.
2026-09-24 19:34:15 +08:00
ranxianglei 8e5eb582f4 Merge pull request #1257 from ranxianglei/2026-09-24_output-side-compression
feat: output-side compression (verbosity steering + effort routing)
2026-09-24 17:50:22 +08:00
ework-agent 3f1075c312 fix: review follow-up — restore reasoningGuard indent, honest verbosity-option doc, CONFIGURATION.md (+zh-CN) for outputSteering 2026-09-24 17:46:24 +08:00