Commit Graph
333 Commits
Author SHA1 Message Date
ework-agent 700722db9f feat!: remove image pre-compression and the image_full tool (#3266)
The opt-in compress.imageCompression pass and its image_full restore
channel are structurally broken where they matter most:

- hosts that reject bili-injected tools (codex) can never deliver the
  restore call — the downscale is permanent for them (#3270 disarmed
  the lane, which proved the tool was dead weight there);
- where the tool IS injectable, the model has no reliable way to learn
  the ref of the downscaled message (no ref annotations on the wire),
  producing the 38-round guess-reject-resend loop from #3266 (cache
  hit 75% -> 28%).

Remove the whole feature from host and kernel: arrival-time downscale
pass, image_full injection + sticky restore + fail-streak guardrail,
image stats, persistence keys, wire-contract tool variants, config
schema, docs, and the sharp optional dependency. Every image now passes
through byte-identical at original resolution.

Sessions persisted by older versions load unchanged; legacy
imageShrinks/imageFullRestored state keys and imageShrunk* stats are
ignored on load (storage corpus pins that as a fixture).

kernel 0.0.126.
2026-10-15 22:28:01 +08:00
ranxianglei 92fcd60424 Merge branch 'master' into 2026-10-14_test-suite-lock 2026-10-14 18:43:51 +08:00
github-actions[bot] a205acb0e0 release v0.1.197 2026-10-14 05:11:32 +00:00
ework-agent c9a204e358 feat(test): per-machine test-suite mutex + fail-fast (#3103)
Two concurrent full `npm test` runs on one machine corrupted each other:
cores-1 concurrency doubled the spawn/attach load so every 15s readiness
watchdog timed out (mass false-red), and daemons without a per-test
XDG_STATE_HOME shared ~/.local/state/billion-context (port-zone drift,
multi-instance alarms) — with ZERO detection of the sibling run.

Add scripts/test-suite-lock.mjs: an O_EXCL ("wx") lock at
$XDG_CACHE_HOME/billion-context/test-suite.lock holding {pid,ts,cmdline,cwd},
with liveness-only stale steal (kill(pid,0); never steal a live suite; no age
timeout — a local full run can exceed any fixed budget; a corrupt/truncated
file left by a SIGKILLed writer is reclaimable, not a permanent wedge).
`pretest` now prepends a non-owning `gate` so a second run refuses within
milliseconds BEFORE the build; `test` becomes an owning `run` wrapper that
holds the lock across the real suite and releases it on exit (plus a sync
backstop in the exit handler). BILI_TEST_FORCE=1 is the documented escape hatch.

Single-run behavior is unchanged: the wrapper reproduces the exact old
`node --import … --test tests/*.test.ts` invocation (same file set, no
concurrency cap added). Regression suite tests/test-suite-lock.test.ts pins
free / live-block / dead-steal / corrupt-reclaim, the <2s fail-fast acceptance,
force bypass, and release-on-exit.
2026-10-14 10:59:25 +08:00
ework-agent 81325c3635 fix: expose ./package.json in exports so dsh's client scanner loads the browser half (#3043)
Node's `exports` map is closed once declared, so require.resolve(
"billion-context/package.json") threw ERR_PACKAGE_PATH_NOT_EXPORTED. dsh's
client scanner uses that resolve to locate the package root before reading the
dsh.client declaration; its catch swallows the throw, the entry drops out of
the client module table, and the browser half (settings.section) never
registers — the settings page vanishes while the host half keeps working.

Add the "./package.json" self-mapping at BOTH writer locations of the same
mechanism (the published manifest and the `bili dsh` launcher shim) and pin
both with regression tests that reproduce the scanner's root-locate resolve.

Fixes #3043
2026-10-13 21:41:04 +08:00
ework-agent 69f0827903 test(gate): fail when a test imports a module absent from the production import graph (#2989)
A green suite over a retired module guarantees nothing about the wired
path: #2988 finding ① shipped while every persona-anchor pin stayed
green. New zero-dep gate scripts/check-test-import-graph.mjs BFS-walks
the tsup entry set and fails on any tests/** import of an unreachable
src module unless whitelisted (test-only registries marker/spec.ts,
exit-matrix.ts) or the importing file carries a 'retired-module pin'
label. Wired into ci.yml as the test-import-graph leg gating both
test and static-gates.
2026-10-13 14:17:13 +08:00
ranxianglei 5aced737a7 Merge remote-tracking branch 'origin/master' into 2026-10-11_marker-declarative 2026-10-13 13:00:23 +08:00
ranxianglei 3ef7553314 feat(storage): default the unified sidecar to shadow (#2671 rollout)
resolveStorageMode now lands on 'shadow' when neither storage.unified nor
BILI_STORAGE_UNIFIED is set: the JSON envelope stays the sole source of
truth (zero behavior change) while every session write is mirrored into
index.db with digest reconciliation — fleet-wide parity telemetry before
the full-mode default flip. Explicit legacy opts out; garbage still
degrades to legacy; engine-less lanes stay legacy-only (#2825 contract).

The test corpus runs on an explicit legacy baseline
(tests/preload-storage-baseline.mjs wired into npm test and
scripts/run-ci-tests.mjs) so the 600-suite wire/e2e corpus keeps its
legacy dir-shape assumptions; the storage family pins and overrides its
own modes, the resolveStorageMode matrices pin the new default, and the
web-sessions stamp test now asserts shadow for absent-everywhere.
2026-10-13 12:59:28 +08:00
ranxianglei bd930b44e4 add local real-model release gate (npm run gate:local)
Freezes the manual v0.1.196 review pass (PR #2962) into one command for
operator machines with live models — the regression lane GitHub CI can
never run. Executed before each release (reference/release.md step 5.5).

Lanes (hermetic scratch: own DSH_HOME/BILI_CONFIG_FILE/sessions/XDG/ports;
never touches ~/.dsh or running proxies; missing prerequisites skip with
a warning, GATE_* knobs in the script header):

- A compression: real dsh session reads a marker corpus at the real
  window, then the route window shrinks mid-session (the field-report
  "switched to a smaller-window model" lane) -> nudge INJECT -> preflight
  fold -> SAME session answers from folded context, cache recovers.
  A fresh oversized read tool-result is NOT expected to fold (protected
  recent zone, #2847 fail-fast) — asserted as such.
- B model switch: same session resumed on a different model/upstream;
  same lineage across switch + proxy restart (dsh resume-replay fork
  WITH fork-adoption of the parent's folded blocks passes; an orphaned
  pfa fails), cross-upstream usage-baseline demoted to untrusted when
  cited (#2283/#2867), cache cold -> hot on the new upstream.
- U --with-update: dsh-managed install detection (no in-place self
  update) + latest read from the configured update registry.

Green on 0.1.196: A 8/8, B 6/6, U 2/2 (~4 min, sglang + z.ai relay).
Windows-only update lanes (global installer, desktop-profile in-place
swap + spec converge, doctor) stay on the Win10 VM checklist appended
to reference/release.md.
2026-10-13 12:02:28 +08:00
github-actions[bot] 601c9b1b5c release v0.1.196 2026-10-13 01:50:07 +00:00
ework-agent 7c41abd29c release v0.1.195 2026-10-12 11:10:51 +08:00
ranxianglei 41217c318b Merge branch 'master' into 2026-10-12_release-v0.1.194 2026-10-12 01:45:38 +08:00
ework-agent 6ac08f8e8f release v0.1.194 2026-10-12 01:24:33 +08:00
ework-agent cb90ad40b2 fix(storage): drop better-sqlite3 optional dep; pin no-SQLite degrade contract (#2823)
pnpm >=10's strict build-script gate (strictDepBuilds) blocks any unlisted
install script as a hard error, so dsh plugin-market installs/updates on fresh
profiles failed with [ERR_PNPM_IGNORED_BUILDS] better-sqlite3. Unified storage
is OFF by default (legacy file persistence), so dropping the optional native
engine is low-impact: the driver already prefers built-in node:sqlite when the
native module is absent, and when no engine is available at all
UnifiedShadow.maybeOpen degrades to legacy-only (one warn, never bricks).

- package.json / package-lock.json: remove better-sqlite3 (sharp stays).
- src/storage/driver.ts: add setSqliteEnginesUnavailableForTests seam so tests
  force the "no engine" path deterministically; keep the opportunistic
  require("better-sqlite3") probe for hosts that still ship it.
- tests/storage-engine-proofs.test.ts: pin the contract -- maybeOpen -> null;
  SessionStore runs legacy-only, writes survive, no index.db.
- CHANGELOG.md: [Unreleased] entry.

Gates green on this head: typecheck + targeted storage tests + build.
Closes #2823
2026-10-12 01:13:37 +08:00
github-actions[bot] 085c6bf373 release v0.1.193 2026-10-11 11:01:38 +00:00
ranxianglei c4a5a93c45 Merge branch 'master' into 2026-10-10_storage-pins 2026-10-11 18:50:25 +08:00
dog 3e5a449f9b chore: sync master version metadata to v0.1.192
v0.1.192 was a carve-out release (78df4eaa, #2664 only) and its version
bump never flowed back to master, so master still declares 0.1.191 while
npm latest is 0.1.192. That trips the Release one-click Drift guard:

  ::error::master package.json (0.1.191) != npm latest (0.1.192)

#2664's changes themselves are already in master (f0b3f5d6), so this is
metadata-only: bump package.json + package-lock.json (root and
packages."" entries) to 0.1.192 so the next one-click release (0.1.193,
carrying the #2755 fold-summary head-stability fix) can proceed.
2026-10-11 18:49:01 +08:00
ranxianglei c68128d452 fix(deps): better-sqlite3 is optional — native builds must never fail install
A hard better-sqlite3 dependency made npm install fail on hosts without
a build toolchain (Windows runners: node-gyp cannot find VS; CI codex/
registry e2e legs went red). The driver already probes it lazily and
falls back to node:sqlite, so the package now sits in
optionalDependencies next to sharp. When absent, the unified store runs
on node:sqlite and the better-sqlite3 corpus leg skips loudly instead
of failing (createRequire-based availability probe in the test).
2026-10-11 14:02:14 +08:00
ranxianglei 8b79226207 chore(deps): better-sqlite3 ^13.0.3 for the unified storage primary engine 2026-10-11 14:01:44 +08:00
ework-agent 74ab4ef64f release v0.1.191 2026-10-10 16:14:49 +08:00
github-actions[bot] cfcf8dc295 release v0.1.190 2026-10-10 02:57:09 +00:00
李云周 bb6e054e05 fix: guard source installs with a dist readiness check 2026-10-09 15:38:03 +08:00
github-actions[bot] e8d4d8cef1 release v0.1.189 2026-10-09 01:55:44 +00:00
awork 557f49f0ea fix: ship CONFIGURATION.md (+zh) with the npm package — conflict docs pointer referenced a file absent from installed copies 2026-10-09 09:25:33 +08:00
awork d233af649b feat: vendor billion-context-pi-subagents in-repo under pi-subagents/ (#2384) 2026-10-08 13:09:51 +08:00
github-actions[bot] a889d9882d release v0.1.188 2026-10-08 01:35:57 +00:00
ranxianglei 84cae56810 Merge pull request #2357 from ranxianglei/2026-10-07_paper-in-npm-package
chore: ship the English paper (md + figures) in the npm package
2026-10-08 08:42:23 +08:00
ranxianglei 74b51eb135 chore: ship the English paper (md + figures) in the npm package
package.json "files" gains the English paper and its six figures
(~1.0 MB on top of the 26 MB tarball). The Chinese edition and
make-figures.py stay repo-only. Verified via npm pack --dry-run.
2026-10-07 23:29:39 +08:00
ranxianglei 3f1f473c06 feat: stamp the build's git commit into every version display (#local-build-identity)
The semver alone cannot distinguish a locally-installed test build from the
npm release with the same version number (exactly the situation while trialing
an unmerged fix). Add BUILD_COMMIT and render it wherever a human reads a
version:

- bili --version        → "0.1.187 (8f9faf9e)" (first token stays bare semver;
                          all in-repo consumers match by regex, none compare equality)
- /acp panel host line  → billion-context 0.1.187 (8f9faf9e)
- web UI header + overview row → v0.1.187 (8f9faf9e) / "0.1.187 (8f9faf9e)"
- /__bili/health and /__bili/overview → additive "commit" field

Resolution: bundled code reads dist/build-info.json stamped by
scripts/write-build-info.mjs at build time ("-dirty" suffix when the worktree
has uncommitted changes); dev (tsx) asks git directly; "unknown" otherwise.
The updater, advisory watcher and MCP serverInfo keep comparing/announcing
bare package.json semver — display-only, zero update-path impact.
2026-10-07 22:52:00 +08:00
github-actions[bot] f7d3e86267 release v0.1.187 2026-10-07 04:18:12 +00:00
ranxianglei 253bbfa1e1 ci: add unused-export gate (#1440)
Ports the gate from PR #1443 to current master: npm script check:unused-exports
plus a zero-dep CI job. Adapted since the original: scans exclude kernel/ (its
own package with its own suite and human-gated boundary) and the entry list
gains src/agent/dsh-native-client.ts to match the second tsup.config.ts entry.
2026-10-07 00:37:07 +08:00
github-actions[bot] c86eb5c8f3 release v0.1.186 2026-10-06 09:15:09 +00:00
ranxianglei 8e41ed91e0 feat: inline billion-context-pi-subagents into the pi lane (#2186)
Wire the acp_delegate sub-agent surface (tools + /acp-fleet command +
fleet shortcut + status widget + read tracking + prompt append) into the
native pi extension via the package's embedder contract: markEmbedded()
claim, manual building-block wiring, tsup noExternal inlining, and an
esbuild alias stub for @earendil-works/pi-coding-agent so the package's
only value import (CONFIG_DIR_NAME) falls back to the documented ".pi".

- agent-gated (pi only; omp lane untouched), single-writer vs a
  standalone billion-context-pi-subagents install
- devDeps pinned exact: billion-context-pi-subagents 0.1.1,
  @earendil-works/{pi-coding-agent,pi-tui} 0.83.0 (typecheck-only)
- dist/index.js + dist/mcp.js import graph unchanged (zero-dep contract)
2026-10-06 10:57:34 +08:00
github-actions[bot] 657dbc4d92 release v0.1.185 2026-10-05 08:46:25 +00:00
ranxianglei cd22cd2ccd Merge pull request #2098 from ranxianglei/2026-10-04_kernel-inrepo
Migrate acp-kernel in-repo (kernel/) + stability guardrails + standalone kernel releases
2026-10-04 22:38:46 +08:00
ework-agent bf16fdf36f feat: consume the in-repo kernel via file: dependency 2026-10-04 21:02:37 +08:00
ework-agent 0bec76c864 release v0.1.184 2026-10-04 20:49:05 +08:00
github-actions[bot] 3d63241a01 release v0.1.183 2026-10-04 08:33:02 +00:00
ework-agent 966f7e0b43 release v0.1.182 2026-10-04 16:14:05 +08:00
ework-agent 686d0dce29 fix(deps): declare esbuild as a direct devDependency
tests/dsh-settings-ui.test.ts dynamically imports esbuild (lines 241/387)
but it was never declared — resolution worked only because npm hoists
tsup's transitive esbuild@^0.27.0 to the top level. Under pnpm (strict
layout) or any non-hoisting install, tsc fails with TS2307 at both import
sites, red-lining local typecheck on a non-bug cause.

Declares "esbuild": "^0.27.0" (same range tsup 8.5.1 already declares);
npm dedupes to the same 0.27.7 instance, so the lockfile diff is one line
and no version moves. Pure declaration change — dist never references
esbuild at runtime (build-time tool consumed by tsup only).

Closes #2009
2026-10-04 00:03:52 +08:00
ranxianglei 0491ca5a26 Merge pull request #1990 from ranxianglei/wt-1970-ework-daemon
Gate tests/ under CI typecheck — clear all pre-existing test type errors (#1970)
2026-10-03 22:36:32 +08:00
ework-agent 2e6e508aa8 test: gate tests/ under root-tsconfig typecheck; clear all pre-existing test type errors
Closes #1970

- package.json: npm run typecheck now targets the root tsconfig.json
  (include: src + tests) instead of tsconfig.build.json (src only);
  all four CI workflows inherit the widened gate via the script.
- tsconfig.json: lib ES2022 -> ES2024 (type-only; tests use
  Promise.withResolvers & co.; src stays clean under it; no effect on
  tsup/esbuild output).
- 276 test files: type-level-only fixes (import sources, missing
  fixture fields filled with src-default values, narrowing, explicit
  annotations, single-expression casts). No assertion changes, no
  runtime behavior changes.
- src/agent/dsh-acp.ts: export CommandOutcome / CommandsService types
  (type-only; erased at build).
2026-10-03 20:07:48 +08:00
ework-agent e80aef7306 fix(#1844): restore master's version, kernel pin and image-e2e script lost in rebase
The rebase onto dfca5a9f resolved package.json from the PR side for three
lines that must come from master: version 0.1.180 (content commits never
touch version; merging 0.1.179 would downgrade master), acp-kernel 0.0.100
(exact pin follows master), and the test:e2e:image script (#1843/#1857).
Lockfile re-synced from master plus the ws dev-deps.
2026-10-03 19:46:13 +08:00
Darkness 1105275e86 feat: proxy OpenCode V2 Responses over WebSocket (#1844) 2026-10-03 19:45:41 +08:00
ranxianglei ed3f1f7778 Merge pull request #1980 from ranxianglei/2026-10-03_1960-redacted-thinking
fix(loop+wire): preserve redacted_thinking blocks on the Anthropic wire (#1960)
2026-10-03 19:10:50 +08:00
ework-agent 29f60d3c7a fix(wire): keep redacted_thinking blocks verbatim on the Anthropic steady path (#1960)
The steady request path (client echoes the round back) silently dropped
redacted_thinking blocks because anthropicToCore had no case for them, so
every later request rebuilt the latest assistant message without the block
and Anthropic answered 400 "cannot be modified" forever — the half of #1960
that kept the session stuck after the compress turn.

- acp-kernel pin 0.0.99 → 0.0.101 (exact), which carries kernel PR #500
  (redacted_thinking sidecar round-trip). Also rides along from v0.0.100+:
  #483 ref capacity widened to 9,999,999, #484 case-insensitive protected
  tool matching, #478 nudge cadence re-anchor, #493 language-preservation
  behind an opt-in flag (default off), and #499 prune/recommend shared
  per-turn index (hundreds of ms saved on ordinary requests in large
  sessions — release-note material).
- tests/issue1960-steady-redacted.test.ts: client-echoed
  [thinking(sig), redacted(data), tool_use] must survive prepare→outbound
  byte-identical in order. Verified failing on 0.0.99, passing on 0.0.101.

Preflight: typecheck clean; targeted loop/thinking/reasoning suites 186/186
green incl. both new #1960 files; build OK.
2026-10-03 16:23:34 +08:00
github-actions[bot] 30b787a187 release v0.1.181 2026-10-03 08:01:56 +00:00
agent 1f1a291f47 ci: hermetic real-image billing e2e lane (#1843 follow-up, pins the #1857 verification)
tests/e2e/e2e-image-billing.test.ts synthesizes a corpus of structurally
real images in pure Node (valid PNG/JPEG/WebP/GIF containers, real dims,
4.7MB 4032x3024 photo, EXIF orientation, truncated + garbage blobs) and
drives it through the real billing pipeline against a mock upstream billing
the Qwen2-VL formula. Pins the three #1857 failure classes: parser truth,
the >=700x bytes-prior poison ratio, and the learned-cost rescue (12.6MB
arbitrated forward -> usage teaches per-image cost -> stale-high usage
baseline no longer bricks the session -> baseline regresses to real
billing) plus the default auto->pixels route riding a malformed blob.

Runs ungated (~1s, zero network, zero tokens): npm run test:e2e:image.
CI: .github/workflows/ci-image.yml auto-runs on PRs touching image/window
-gate surfaces (src/image-*.ts, preflight, server, cache-ledger, kernel pin).
2026-10-02 21:37:32 +08:00
github-actions[bot] dd7631c177 release v0.1.180 2026-10-02 07:25:00 +00:00
ework-agent 1a0c3b0aeb chore: pin acp-kernel 0.0.100 — case-insensitive tool protection (#1725)
- acp-kernel 0.0.99 → 0.0.100. Brings four kernel changes:
  * ak#484: matchToolPattern is case-insensitive — fixes #1725
    (opencode "read" vs Claude-style "Read" protectedTools entries
    silently never matched, so their history could be folded).
  * ak#496: ref capacity widened to 9,999,999, hybrid widths (#483) —
    long side-request sessions no longer burn out at m99999.
  * ak#495: language preservation prompt rule, kernel-side opt-in only
    (exposing a bc config knob is a follow-up decision).
  * ak#479: nudge cadence re-anchors when the live count drops below the
    shown reference (#478) — the kernel-side fix for the class bc#1595
    patched around.
- tests/protected-tools.test.ts: new regression — "Read" pattern protects
  opencode's lowercase "read" pair end-to-end (BLOCKED refs, fold carve-out,
  survival). Verified it FAILS on 0.0.99 and PASSES on 0.0.100.
- tests/issue1595-nudge-reanchor.test.ts: with ak#479 the kernel retires
  the phantom reference inside the nudge node before bc's usage-settle
  hook runs, so the bc log line legitimately disappears; the invariant
  under test is now the end state (phantom never survives a real usage
  report), log asserted only when bc is the retiring side.

Local: typecheck ✓ build ✓ full suite 3591/3571/1/19 pre-adaptation (the 1
failure was this test's outdated log expectation), 16/16 after.
2026-10-02 15:13:40 +08:00