Commit Graph
49 Commits
Author SHA1 Message Date
ranxianglei a2a6db3e1b Merge pull request #2492 from ranxianglei/wt-2489-ework-daemon
feat(web): zoom-to-selection (brush) for the session context-trajectory chart
2026-10-15 23:35:41 +08:00
awork 9c0efb9995 test(#3295): make the #3266 back-compat corpus pin real
The first commit regenerated the corpus after stripping the legacy
image keys, so tests/storage-corpus.test.ts asserted 'keys must NOT
materialize' against a fixture that never carried them — a vacuous pin
while the PR body claimed the corpus pinned back-compat.

The generator now re-injects the pre-#3266 keys into the on-disk record
after the normal write (writeAndPin mutateFiles hook), so the fixture
carries exactly what an older version persisted. Verified load behavior
pins honestly: whitelisted readers DROP stats.imageShrunk*/imageFull*
and state.imageShrinks/imageFullRestored; metadata is an opaque host
bag and passes THROUGH (legacy imageShrinks survives as inert data —
the digest covers the loaded view, so it pins that split). All case
digests shift because the kernel state.stats blob lost its three image
fields; folded/zstd pair stays byte-identical.
2026-10-15 23:10:30 +08:00
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 356729fdd2 chore(gates): unused-export scan sees untracked files; drop two INTERNAL_ONLY exports
- scripts/check-unused-exports.mjs: git ls-files --cached --others
  --exclude-standard — a brand-new module is exactly where INTERNAL_ONLY
  leaks happen, and a tracked-only scan passed locally right before CI
  failed on the same tree (the fresh src/agent/incremental-client.ts was
  untracked at the local gate run on #3273).
- src/agent/incremental-client.ts: IncrementalPlan / PlanArgs keep their
  leading export off (module-internal shapes; callers infer).
2026-10-15 17:24:37 +08:00
ranxianglei 1a320fb4f8 ci: per-file zone-port bands for live suites + deterministic teardown/dist hygiene (#3182/#3184/#3188)
Root cause of the 7-red test matrix: #3145 sharding concentrated the port
families into shards 2/3 while #2816 concurrency let them bind
simultaneously on one runner — cross-file 18787 collisions and shared
ephemeral-port TOCTOU.

Fixes:
- scripts/live-files.mjs: shared LIVE_FILES table + zonePortForSlot bands
  (18787+(slot+1)*32; first band above the default base so bare 18787 is
  never a CI target)
- tests/preload-zone-slot.mjs: CI-only preload assigns each live file its
  band via BILI_ZONE_PORT (product support already in src/config.ts)
- run-ci-tests.mjs: preload injected for live suites
- port-zone-live: band-aware base + waitForBandFree at sandbox entry
  (teardown SIGKILL returns before kernel release) + full XDG isolation
  (a dev box's real config/index.db makes children queue on real locks —
  the #3044 fail-fast then never fires) + squatter leak closes on failure
- claude-native: band-aware helpers (ZONE_BAND_BASE from process.env;
  planClaudeNativeBootstrap({}) stays on the exported default), squatter
  test flipped to the #2877 own-lane refusal contract (was in the original
  red set — #2877 superseded #1660's attach-by-default), foreign-listener
  squatter kills connections (unhandled ECONNRESET crashed the runner),
  freePort TOCTOU bounded retry
- auto-restart: stubs exit 91 on EADDRINUSE with bounded scenario retries;
  SIGTERM-survivor escalation test is POSIX-only (Windows terminates
  uncatchably — was a w24 red)
- ensureDistBuilt (claude-native/port-zone-live/index-entry-guard): rebuild
  when src is newer than dist — a stale dist exercises last week's product
  code (the #3044 'hang' was exactly this)
2026-10-15 00:58:45 +08:00
ranxianglei 92fcd60424 Merge branch 'master' into 2026-10-14_test-suite-lock 2026-10-14 18:43:51 +08:00
awork 61e15a09d5 feat(web): add zoom-to-selection (brush) to session context-trajectory chart (#2489) 2026-10-14 18:17:50 +08:00
ework-agent b8cad881be ci: shard the test suite across the matrix to cut wall time ~3x (#3143)
The suite outgrew one runner: ~656 top-level files (~190k LOC) serialized
through --test-concurrency=4 on a single 4-core leg took ~17-20 min (windows
slowest; measured 1225s on the last full green run). Add a `shard` matrix
dimension to the test job so each leg runs a balanced slice; run-ci-tests.mjs
now partitions deterministically + totally (LPT bin-packing over file size)
so the union of all shards == allFiles and no test is skipped. Same tests,
assertions, env, OS and node versions — zero coverage loss. Wall drops ~3x
(~20 -> ~7 min).
2026-10-14 14:57:38 +08:00
ework-agent 2724ffd4ab fix(test): register test-suite-lock.test.ts in LIVE_FILES (CI tripwire #1248, #3103) 2026-10-14 11:30:28 +08:00
ework-agent dfeedd83bc fix(test): drop unused type exports in test-suite-lock.d.mts (check-unused-exports gate, #3103) 2026-10-14 11:15:12 +08: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 3933641939 chore(gate): narrow the R3 waiver to the two payload interfaces (#3051 review fix)
memoryReport and residentBreakdown have cross-file references (admin.ts
imports memoryReport; tests import both), so the gate does not flag them.
Only the structurally-consumed interfaces need waiving.
2026-10-14 09:49:35 +08:00
ranxianglei 8ece0d8607 feat(diag): /__bili/memory resident-pool breakdown (#R3 step 1)
- session.ts: extract deepSizeOf; add residentBreakdown(session) and
  memoryReport() — per-session resident bytes split across lastMessages,
  pluginSnapshot, blockContents, contentStore, state, other (columns sum
  to the revision-cached sessionWeight total).
- server/admin.ts: GET /__bili/memory (loopback-gated like all /__bili)
  returns process memoryUsage + VmHWM peak plus the pool report, top 25
  sessions by bytes.
- tests/memory-diagnostics.test.ts: field attribution, monotone scaling,
  pool sorting/budget context.
- unused-export gate: reasoned waiver for the three test-consumed symbols.

This is the measurement half of the R3 memory plane: the numbers decide
which residents (blockContents originals, CCR store, lastMessages,
pluginSnapshot) become lazy DB-backed views.
2026-10-13 21:40:46 +08:00
ework-agent 158f34e188 fix: attribute + one-shot flake recovery for swallowed file-level CI test failures (#3029)
When a test child dies silently (non-zero exit, no stderr — e.g. OOM kill, tsx/esbuild worker death, race exit under concurrency), node --test collapses it to one file-level 'not ok <file>' whose only payload is error:'test failed' and zero subtests; no reporter can surface an error the child never emitted. CI was left unable to attribute the failure (#3029).

run-ci-tests.mjs now, on failure:
- captures exit code + signal (previously discarded by an empty catch);
- logs a resource snapshot (free/total mem, loadavg, node version, platform);
- surfaces child stderr when present (may carry a V8/native fatal such as OOM 'Reached heap limit');
- detects the swallowed shape (top-level 'not ok … *.test.ts' + error:'test failed') and re-runs each such file in isolation for attribution;
- retries the whole phase ONCE and exits 0 only if that retry is green (a confirmed transient). Concrete assertion failures are NOT the swallowed shape and still fail hard immediately with no retry, so real regressions are never masked.

Behavior changes (flagged):
- The test step now forces --test-reporter=tap (Windows log format spec->tap; Linux was already tap). No test-semantics change.
- Swallowed-shape failures get one bounded recovery (isolated re-run + full retry -> exit 0 if green) instead of failing immediately. Concrete assertion failures are unchanged (fail immediately).
- No new config/env added; concurrency stays 4.
2026-10-13 20:03:08 +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 2cc37e2924 scrub private infra details from gate docs
- verdaccio LAN IP -> <verdaccio-LAN-IP> placeholder (release.md checklist)
- private VM runbook path -> generic wording
- relay knob docs: drop provider identity + auth notes, keep semantics
2026-10-13 12:10:47 +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
ranxianglei c55059c45a Merge pull request #2803 from mariopasquali/2026-10-11_bounded-session-loading
Bound startup session loading and preserve historical recovery
2026-10-13 08:40:21 +08:00
ranxianglei 978524787d Merge pull request #2946 from ranxianglei/2026-10-13_hook-win-libuv-exit
fix(zcode,kimi): SessionStart hooks stop force-calling process.exit (Windows libuv abort)
2026-10-13 08:28:21 +08:00
ranxianglei 7167ab7b33 fix: register text-safe spawn test in CI LIVE_FILES tripwire (#1248) 2026-10-13 06:50:53 +08:00
ework-agent 7dd61a9afb test: register hook-graceful-exit suite in LIVE_FILES (#1248 tripwire)
tests/hook-graceful-exit.test.ts spawns the real hook entry (node --import
tsx) for its integration subtest, so scripts/run-ci-tests.mjs' #1248
self-check would fail the test job once unused-exports unblocks it.
Concurrency review: the spawned child runs with BILI_NATIVE_ZCODE=0
(plan mode off -> earliest return), opens no port, touches no config or
proxy state, and is SIGKILL-bounded at 8s — no shared-resource contention
under c=4.
2026-10-13 01:06:09 +08:00
overFloweee 3823e827e7 fix: 将派生缓存纳入会话生命周期并释放请求底层字符串 2026-10-12 19:07:00 +08:00
ework-agent 88b1e507e3 test: register issue2752 spawner suite in LIVE_FILES (#2816 tripwire gap on master)
Pre-existing master gap, fixed in passing: c81be81ee (#2752, 2026-10-11) added a process-spawning suite before the #2816 LIVE_FILES tripwire landed (e6ba45cd8, 2026-10-12), so every test job has died at the tripwire since then and the full suite never ran in them. Concurrency assumptions reviewed: listen(0) ephemeral ports, BILI_MCP_PROXY env save/restore, stdio transport to the spawned src/mcp.ts child.
2026-10-12 17:46:20 +08:00
ework-agent 6f6a0e0387 test: register bounded-storage-scale suite in LIVE_FILES (#2803)
The #2816 tripwire requires every process-spawning suite to be listed in scripts/run-ci-tests.mjs before it may ride the c=4 pool (#1248 review). Concurrency assumptions reviewed: isolated mkdtemp dir, child-only env (BILI_PERSIST_ZSTD/BILI_SESSIONS_DIR), no port binding, one blocking spawnSync under a 128 MiB heap cap.
2026-10-12 17:45:45 +08:00
李云周 7c76d28645 fix: register issue2752 forward-partial-outcome suite in LIVE_FILES (#2896) 2026-10-12 16:49:32 +08:00
ework-agent e6ba45cd85 fix(ci): single-phase c=4 + parallel static-gates — serial live phase cost more than it saved (#2816)
Baseline-log arithmetic (sum of per-test durations vs step wall) proves the
old runner default was already concurrent, so the two-phase split's serial
live phase only idled 3+ cores for 3-4 min without buying stability. Run the
whole suite at explicit concurrency=4 (keeps the LIVE_FILES tripwire), and
move typecheck/kernel/pi-subagents/build into a parallel static-gates job off
the test critical path.
2026-10-12 11:15:35 +08:00
ework-agent f0c9c9d47a fix(ci): spawn npm through cmd.exe on Windows — .cmd cannot be exec'd directly (#2816)
execFileSync('npm.cmd', ...) fails with EINVAL on Windows: CreateProcess
cannot exec batch files without a shell. The first CI run showed both
windows legs dying at the pretest step before any test ran. shell:true
routes it through cmd.exe; args are fixed literals, no quoting surface.
2026-10-12 10:31:17 +08:00
ework-agent c2914c34ab test(ci): two-phase schedule for the main CI test job (#2816)
The node built-in runner defaults file concurrency to availableParallelism()-1 == 1 on 2-vCPU runners, so the flat tests/*.test.ts glob ran all 600+ suites strictly serially, each paying a node+tsx spawn in turn. scripts/run-ci-tests.mjs splits the same suites into: live (process-spawning, concurrency=1 — #1248 requires quiet-machine conditions) and pool (everything else, concurrency=4 — no spawners by construction, listen(0) ports, XDG-isolated homes), with a self-check that fails the job when a new spawning suite lands unregistered. Same tests/assertions/env; local npm test untouched. Plus two targeted suite speedups: image-request-budget hoists the shared ~100MB body (5 builds -> 3) and claude-native pre-warms the Windows CA (existing #1807 pattern) in the three remaining fresh-home hook e2e tests.
2026-10-12 10:14:26 +08:00
ranxianglei 45f308db50 test: storage-refactor pins — render goldens (4 wires) + legacy-format corpus (9 cases)
Pre-refactor stakes for the unified storage layer (#2671):

- tests/golden-storage-render.test.ts + scripts/update-storage-render-goldens.ts:
  byte-exact golden of per-turn outbound bodies AND the persisted end state
  for chat/anthropic/responses/google — 15 turns each, one T1 fold at turn 9,
  a mid-history client edit, and post-edit growth. The end-state digest goes
  through the REAL shutdown path (flushAllSessions); the corpus pins the
  renderer + fold semantics, not debounce timing.
- tests/storage-corpus.test.ts + scripts/update-storage-corpus.ts +
  tests/golden/storage-corpus/: committed legacy-format sessions covering
  every persisted-record branch (folded, tier-2 supersede with #401
  normalization, deadRefs tombstones, fork receipt/retained asymmetry
  (#2675 ②), images, CCR sibling store, twin-namespace files (#2671 ①),
  zstd framing). The manifest pins write→loadSync round-trip digests; the
  unified store must reproduce them bit-for-bit after migration.
- tests/pins-storage-refactor.test.ts / tests/pins-wire-id-mints.test.ts:
  kernel invariants (I1–I7), scripted + seeded-random scenarios, wire id
  minting contracts.

Regeneration is a migration-relevant event — commit the diff with a reason.
2026-10-11 14:01:44 +08:00
ework-daemon 2d7f809768 fix(release-ci-gate): tolerate transient API errors on read-only gate polling
Review fix for #2693: a single transient GitHub Actions API error (network blip, 5xx, secondary rate limit) during --wait polling threw immediately and killed an otherwise-green release. Read-only (GET) calls now retry up to 3 times with backoff; POST dispatches are never retried (a double dispatch would burn CI on duplicate runs). Exhausted retries still exit 1 — the fail-safe direction is unchanged.
2026-10-11 00:11:41 +08:00
ework-agent 67e6c29c26 ci: every release channel runs the full CI lane set before publish
Follow-up to the v0.1.192 carve-out (#2664): the bugfix channel shipped
with only its embedded pre-flight (typecheck+test+build) — no e2e lane
ever ran on the publish sha, because no PR existed and no e2e workflow
triggers on bugfix-release/** pushes.

Policy (2026-10-10): no matter the release channel, the COMPLETE CI lane
set must be green at the exact publish sha before npm publish.

- new scripts/release-ci-gate.mjs:
  --dispatch: idempotently workflow_dispatch every required lane that has
    no run at the publish sha (or a green run at an EXTRA_MATCH_SHAS,
    e.g. the PR head — same semantics as branch-protection required
    checks, so routine PR-based releases pay zero extra CI);
  --wait: block until every lane's latest run at the publish sha is
    success; any red lane / timeout / un-dispatchable lane ⇒ exit 1,
    publish step never runs (fail-safe).
- release.yml / release-kernel.yml: dispatch early + gate before Create
  tag, gated on is_release; EXTRA_MATCH_SHAS=HEAD^2 reuses PR-head runs.
- release-bugfix.yml: dispatch before the pre-flight (lanes run in
  parallel with it) + gate after it; +actions:write.
- release-manual.yml: direct path (GITHUB_TOKEN push fires no events,
  nothing runs CI on the release commit) gets dispatch+gate before
  Create tag; fallback path is already gated via release.yml after merge.
- required set (override with REQUIRED_CI_WORKFLOWS): ci.yml, ci-e2e.yml,
  ci-e2e-fake.yml, ci-e2e-dsh.yml, ci-e2e-dsh-native.yml,
  ci-e2e-codex-persona.yml, ci-e2e-native.yml, ci-e2e-native-opencode.yml,
  ci-e2e-pi-ws.yml
- tests/release-ci-gate.test.ts: 8 regression tests against an inline
  mock of the GitHub Actions API (no network, no token).
2026-10-10 23:48:55 +08:00
ework-agent 8cd7cb68c4 fix(#2651): drop unused export tripping the unused-exports gate
Review of #2651 found the existing scripts/check-unused-exports.mjs gate red on this PR's own new file: ConfigSurfaceReport in config-surface-guard.d.mts is exported but every reference sits inside the declaring file (INTERNAL_ONLY). It only serves as runChecks()'s return-type annotation, so dropping the leading export is sufficient and legal in a declaration file. Verified locally: unused-export gate clean, config-surface-guard check green (125 leaves / 24 flags), its test 5/5, full typecheck clean.
2026-10-10 18:48:14 +08:00
ework-agent 4a5c061f5b feat: config-surface guard CI blocking undocumented config additions (#2643)
Closes #2643

The existing docs-coverage gate (#2107) only enforced BILI_*/ACP_* env vars
and FileConfig TOP-LEVEL keys. Two surfaces slipped through: nested
config-file leaf fields (a new network.newKnob passed silently because a
sibling network.* entry satisfied the top-level key) and CLI --flags
(never checked at all).

scripts/config-surface-guard.mjs closes both: it walks the FileConfig type
to enumerate every leaf path (resolving local named types; expanding
compress via the maintained COMPRESS_SETTING_FIELDS mirror; treating
open/Record/scheme-keyed maps as documented at their parent) and every
parseArgs --flag, then requires each to have a seed entry / be documented
in README.md or CONFIGURATION.md. Missing = red with names listed. A report
mode dumps the full inventory (the 盘查 ask). Zero-dep plain node, no install
step in CI. Not gated to pull_request so master pushes are held to the same
surface.

Baseline gaps found & fixed on current master:
- compress.search had no seed entry (only compress.search.planAware did) --
  added the container entry + regenerated docs.
- --bin was documented nowhere -- added to README.md.
(--auto-restart-on-update was already in README; the guard checks the
README+CONFIGURATION union so it passes.)

tests/config-surface-guard.test.ts pins the extractors against golden
anchors and proves the red path fires (planted undocumented field + flag),
so the gate cannot silently go vacuous.
2026-10-10 18:37:13 +08:00
李云周 6dbac0224e fix: catch npm git-source installs via the consuming install prefix (review F2) 2026-10-10 08:57:34 +08:00
李云周 bb6e054e05 fix: guard source installs with a dist readiness check 2026-10-09 15:38:03 +08:00
awork 4cac902fcc fix: exempt pi-subagents/ from unused-export gate (same boundary treatment as kernel/)
The #1440-P6 gate scans all tracked .ts via the *.ts pathspec but only
excludes kernel/. Vendoring pi-subagents/ (#2384) put the component's own
public API surface (a separately published npm package with its own test
suite and version discipline) under the root-package gate, which flagged
20 of its exports. Exclude it wholesale exactly as kernel/ is excluded;
the component imports nothing from the root src/, so no root symbol loses
its only references.
2026-10-08 13:31:04 +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
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
ework-agent 070e475115 fix: sibling .d.mts so tests can statically import the dist annotation checker (#1991 item 11) 2026-10-03 20:14:33 +08:00
ework-agent 44f1bf55e7 feat: wire models.dev pricing as the default cache-economics price profile (#1279 follow-up)
When no level sets compress.priceProfile, the session stamp now falls back to the request model's models.dev price row (absolute $\/Mtok: w = cost.input, r = cost.cache_read ?? 0.1*input, q = cost.output ?? 1.5*input). Known-provider hosts get their own listing; unknown relays take the first matching listing with a one-time conflict warning. Live catalog.json wins when reachable, bundled snapshot is the offline floor (snapshot rebuilt to carry 7126 cost rows). User config at any level still wins wholesale; unresolvable models keep the kernel relative defaults.
2026-09-26 21:51:57 +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
ework-agent af65c57362 fix: make dist-import-annotations gate immune to symlinked invocation (review of #1256)
Node resolves entry-point symlinks, so when the gate script is invoked through a symlink (pnpm-style symlinked trees, /tmp -> /private/tmp), process.argv[1] no longer string-matches import.meta.url and the main-module guard silently skipped the whole check (exit 0, no output) — a silent gate death of exactly the class this gate exists to prevent. Compare realpathSync(fileURLToPath(import.meta.url)) against realpathSync(argv[1]) instead. Verified: direct/symlink/copy invocations all run the check; negative case still fails loudly; unit tests pass.
2026-09-24 12:54:00 +08:00
ework-agent 4fc1de2470 fix: strip JSDoc import() annotations from dist bundles — dead opencode plugin lane (#1255)
Non-minified esbuild output keeps class-member JSDoc comments; undici's
{import('./client.js')}-style type annotations therefore survive into every
dist entry. Node's ESM loader ignores them, but opencode's plugin loader
resolves them as real files -> ENOENT -> 'failed to load plugin' -> silent
dead lane for all modern versions under opencode 1.x.

Set minifyWhitespace via tsup's esbuildOptions hook (drops non-legal
comments, keeps structure + license footers) and add a build gate that
fails if relative import()/require() text ever reappears in dist.
2026-09-24 12:27:23 +08:00
ework-agent 927b98cd73 test: add Windows codex overlay MCP-registration check
Headless, key-free verification for the real-machine gap in #686:
confirm that codex accepts the <CODEX_HOME>-bili overlay produced by
`bili codex` and registers the bili MCP server, on a hosted Windows
runner. Uses `codex mcp list` (reads config.toml only, never calls a
model) so no E2E_UPSTREAM_* secrets are needed.

Refs #686
2026-09-10 22:36:01 +08:00
ework-agent c6d1f2c88f feat: clamp effective window to codex's model perception for codex clients (#321 PR-E1) 2026-08-29 01:21:59 +08:00
Sisyphus 82c0d8793c feat(registry): bundle the ENTIRE models.dev registry (282KB, 355 models, all fields) 2026-08-24 18:41:36 +08:00
Sisyphus 605a917754 feat(registry): bundle a slim models.dev snapshot as the offline floor (351 models, 12KB) 2026-08-24 18:35:26 +08:00