81 Commits
Author SHA1 Message Date
Devil-muhan 0947160433 fix(google): treat a namespaced model id as a model-API path
The Google wire carries the model in the path, and both parsers assumed that id
contains no "/": the native interceptor's MODEL_API_SUFFIX and the proxy's
googleModelFromPath. A provider prefix relayed verbatim (omp's
`google-generative-ai` provider: /v1beta/models/antigravity/gemini-3.8-flash:
streamGenerateContent) or a gateway route (models/group/hard:generateContent)
therefore fell through to `if (!isModelApiUrl(url)) return send(input, init)` --
the request went straight to the upstream, so the session never reached the
proxy: no window resolution, no compression, no conversation registration
(acp_status answered 404 "unknown plugin conversation") and the proxy-side
model-keyed decisions had no model at all.

Widen the id's character class to [^:?] in both parsers. The method set, the
v1internal control plane and the non-model Google paths (discovery list,
:predict) keep their existing behaviour, so nothing else starts routing.
2026-11-03 14:31:14 +08:00
ranxianglei 9d2ac52c7f Merge pull request #4984 from ranxianglei/2026-10-28_issue4862-judge-egress-pairing
[PR] Outbound invariant judge: add I3 pairing invariant — folded/split tool_use/tool_result no longer marked clean (#4862) | 出站不变量判官补 I3 配对不变量:折叠拆断的 tool_use/tool_result 不再判 clean(#4862)
2026-10-28 09:21:33 +08:00
ework-agent 3fc164c914 fix(invariant-judge): I3 egress pairing invariant — exit-side tool_use/tool_result half-pairs no longer judge clean (#4862)
The judge's I1/I2 only reconcile entry↔exit continuity; the folded region was
a free zone, so a fold that ate ONE half of a tool pair earned a clean fold
verdict right before the upstream answered 400 (tool_use ids without tool_result
blocks). I3 checks the exit body's own protocol structure: every tool-call
answered by a later same-id tool-result, every tool-result preceded by a
same-id tool-call — kernel-parity directional walk (prune.ts #3046),
fold-split agnostic, all four modes (legacy/render-lane/main/loop).

Attribution stays 'whose fault': host-sent half-pairs skipped per-id, a
volume guard arbitrates id re-mints (#2821), compress calls stay exempt
(hideConsumedCompressCalls parity). Pure detection — zero outbound bytes
changed, never blocks, diagnostics.invariantJudge knob as before.

Tests: 12 rows (NEG half-pair folds/render prefix/re-mint laundering;
POS host-broken echo/compress in-flight/whole-pair fold/same-id precedence;
wired main+loop lanes). Existing judge suites (46) stay green.
2026-10-27 23:08:19 +08:00
ework-agent 7009565fcd Task 子代理的 bili 调用不再压缩错会话 (#4580)
Claude Code 的 Task 子代理和主线程共用一个 MCP shim 进程:shim 启动时
抓的绑定只认主会话,而子代理的模型流量走的是代理里另一条 lane,于是子代
理的 compress 全部压到父会话上(refs 全 unknown/误折),或撞 witness 409
永久失败。

Claude Code ≥2.1.308 在每次 tools/call 盖 _meta["claudecode/toolUseId"]。
本改动三层:

- tool-ring 新增 tool_use id → 会话 映射(TTL 10 分钟,容量 1024);
- plugin 的每条响应管道在 witness settle 时同时记 id;工具路由阶梯最前
  插入:id 命中且 lane 存活 → 直接路由(host-stamped 权威,同 #2024),
  未命中回退旧阶梯,fail-closed 不变;
- mcp shim 把 _meta id 转发为 body toolCallId(复用 agent/shared.ts 既有
  字段),不动 routeOverride、不动全局绑定。

tests: issue4580-claudecode-tooluseid-routing.test.ts (12 例,记录/路由/shim)
2026-10-27 22:37:50 +08:00
ework-agent b1f2bd215f feat(#4906): dsh bili settings face gains a blog tab after versions
The embedded bili settings UI drives its iframe by hash route; PAGE_IDS
never listed "blog", so the master-pulled post feed had no entry point
in dsh's own panel even though the framed page (#/blog) already exists.
Owner follow-up: expose it as a sixth tab right after 版本/Versions.

- src/agent/dsh-native-client.ts: append "blog" to PAGE_IDS (after
  "updates") + PAGE_KEYS/i18n entries (博客 / Blog). Clicking only flips
  the iframe hash — no new data channel. Older embedded frames without
  the #/blog route fall back to their default page inside the frame.
- tests/dsh-settings-ui.test.ts: button counts 6→7, zh label list gains
  博客, action-button indices shift by one.
2026-10-27 14:39:09 +08:00
ework-agent 5d140d7c37 feat(#4906): hourly self-scheduling blog refresh chain (owner follow-up)
Owner review flagged the access-driven-only cadence: with no traffic a
served process would show stale content indefinitely. Every process now
runs a lazy hourly chain — the first touch of the module (the /__bili/blog
route, the status-path warm, or any round) arms a repeating force-kick at
ROUND_TTL_MS intervals:

- content served by any long-lived process ages out to ~1h even with zero
  further visits;
- the handle is unref'd so short-lived CLIs exit normally and tests never
  inherit a live timer (_resetBlogRefreshForTest clears it);
- force lets a failed round retry on the hour instead of slipping a full
  window (a failing round costs ~1 anonymous contents-API request);
- disabled modules never arm.

tests: 2 new cases under mocked clock (~1h/~2h forced rounds without
traffic) + disabled-no-arm; devlog REQ/DESIGN updated.
2026-10-27 14:39:09 +08:00
ework-agent 24f4563551 feat(#4906): web panel blog pulls fresh posts from GitHub master
Access-driven overlay refresh for the /__bili/blog feed (#4587 serves
content frozen at release time): a background round downloads the live
master tree (website/blog/posts/*.md + articles.json entries + referenced
images) from the public GitHub APIs and registers it as the overlay the
feed/asset routes prefer over the bundled bytes; on failure the last good
overlay (or bundled floor) stays up with an "offline" marker.

- src/web/blog-refresh.ts (new): fail-soft round engine — anonymous public
  API only, no credentials/config/env surface; single-flight coalescing,
  1h TTL between rounds (anonymous rate limit ~60 req/h/IP), per-file
  timeouts, size/file-count budgets, atomic registration.
- src/web/blogfeed.ts: remote-overlay seams — pure resolveRepoRel /
  collectImageTargets helpers, buildRemoteBlogPosts, registerRemoteBlogFeed,
  getRemoteBlogAsset; getBlogFeed merges remote-wins per id over the
  bundled floor, asset route checks the in-memory map before disk.
- src/server/admin.ts: GET /__bili/blog fires a fire-and-forget kick after
  answering (response always instant).
- src/plugin.ts: /acp status path warms once while COLD (no master snapshot
  in-process yet) — same cadence class as warmChangelogOnce; warm processes
  keep the status path network-free.

tests: web-blog-refresh.test.ts (12 cases: merge priority, asset split,
image-404 churn, offline degradation, TTL/single-flight, warmer cold/warm
semantics); devlog REQ+DESIGN under devlog/2026-10-27_web-blog-github-refresh.
2026-10-27 14:39:09 +08:00
ework-agent 0be2a7a016 docs: align typecheck script references with the src+tests gate (#1970) 2026-10-03 20:20:44 +08:00
ework-agent 5dc12ade4b fix: scope Responses ingress id healing to Bili's msg-proxy namespace (#1474)
sanitizeResponsesInputIds rewrote ANY over-64-char input item id to
msg-fix-<hashId> regardless of item type, renaming provider-issued opaque
ids (reasoning rs_*, function_call fc_*, custom_tool_call, item_reference,
compaction) that upstreams with id-shape validation reject with HTTP 400 on
every turn. The length rewrite now applies only to msg-proxy-* ids — the
exact namespace the #242 healing was written for; everything else crosses
ingress byte-identical.
2026-09-27 14:49:16 +08:00
ework-agent b36c49610b docs(devlog): record L2 gate three-state follow-up (#1158) 2026-09-23 22:56:20 +08:00
ework-agent a5e61db20a fix(dsh-native): persist bootstrap failures to bili.log — GUI stderr is invisible (#1158) 2026-09-23 09:58:25 +08:00
ework-agent 9715fed882 fix: make #1158 diagnostics hypothesis-neutral; log takeover-gate refusals once per endpoint
Owner review refuted the injected-private-fetch root cause with unpacked evidence across all published versions (options?.fetch is undefined end-to-end; the OpenAI SDK falls back to the patched globalThis fetch). The one-shot NO MODEL REQUESTS detection stands regardless of the true cause, so its wording no longer names any single confirmed cause. The dsh takeover gate now logs each distinct refused endpoint once per process with the attribution state at refusal time, making the pending runtime repro one-pass diagnosable.
2026-09-23 09:50:31 +08:00
ework-agent 72a7e44f86 fix: make no-model-request plugin 404 loud and actionable (#1158) 2026-09-23 09:50:31 +08:00
ranxianglei d28ae9e70c Merge pull request #789 from ranxianglei/2026-09-15_788-plugin-removal-notice
fix: name entries dropped by plugin install/remove; neutral /acp no-proxy warning (#788)
2026-09-15 08:55:39 +08:00
ework-agent f12bc0772a fix: name entries dropped by plugin install/remove; neutral /acp no-proxy warning (#788) 2026-09-15 02:22:26 +08:00
ework-agent bd20f519c8 fix(launcher): wrap the bundled opencode plugin in an index.js shim dir for OpenCode 2.x
OC 2.0.x (@opencode/cli) rejects bare file paths in the config plugin array (WARN 'configured plugin path must be a directory'; a directory entry loads its index.js), so bili opencode silently degraded every 2.x launch to proxy mode. New opencodeMajorVersion --version probe (cached, failure -> 1) selects pluginDirMode in prepareOpencodeHttpRewrite, which injects a temp wrapper dir re-exporting dist/agent/opencode.js; 1.x keeps the bare file path. Verified end-to-end on @opencode/cli 2.0.3: [plugin] tool acp_status executed via plugin, zero [acp-loop]. Docs: README + agent comment block + devlog now carry the confirmed 2.0.x facts (both hooks fire, ctx.tool.reload exists, editor.add works with Tab+Enter TUI invocation, run mode dispatches no slash commands).
2026-09-14 23:16:04 +08:00
ranxianglei 6f867a93d4 Merge branch 'master' into 2026-09-13_opencode-v2 2026-09-14 22:08:40 +08:00
ework-agent 80f631cb98 docs(opencode-v2): scope runtime facts to specific builds after #754 review
External report (@jensenojs) showed all four next-17444 pre-release observations invert on 2.0.1 stable (model.request fires, ctx.tool.reload exists, context mutation reaches the wire). Independent probes of two adjacent npm dev builds confirmed the 2.x plugin surface changes between builds (one loads V1-only, the other exposes setup() but no ctx.session/ctx.tool). Docs now state facts per-build, the thin-shell rationale is re-based on single-authority + kernel-drift elimination instead of 'plugins cannot mutate context', and a new test pins setup({}) inert-safety on seam-less hosts. No code behavior change.
2026-09-14 21:45:00 +08:00
boundring 914aa27571 launcher: jcode client — env-only cert-MITM launch path (trae-style)
- LAUNCH_CLIENTS/BaseClientName += jcode; launcherInjectMcp skips it
  (jcode manages its own ~/.jcode/mcp.json)
- buildJcodeEnv: HTTPS_PROXY + SSL_CERT_FILE combined CA +
  BILLION_CONTEXT_PROXY + NO_PROXY localhost/127.0.0.1/::1 so loopback
  model servers stay direct
- discoverRoutes jcode branch whitelists JCODE_DEFAULT_MODEL_HOSTS
  (['api.z.ai']); no TOML config reader yet — extra MITM domains ride
  ambient BILI_MITM_DOMAINS (ceiling noted in devlog)
- ModelWindowScope += jcode (no collector branch, hermes/dsh/qoder/trae
  convention)
- cli help: usage row, list, mechanism para, example
- tests: isLaunchClient, buildJcodeEnv, discoverRoutes jcode cases

155 tests: 154 pass; the one trae-env failure is pre-existing on the
clean tree (ambient NODE_EXTRA_CA_CERTS leak) and unrelated.
2026-09-13 18:36:50 -04:00
ework-agent 80c089c1b2 fix(opencode-v2): honor BILLION_CONTEXT_PLUGIN=0 kill switch in tool forwarding + compaction report
The V2 kill switch only gated header stamping in httpRequestHook; native tool execute() still forwarded to the proxy via proxyBaseFromEnv() (the launcher always sets BILLION_CONTEXT_PROXY) and session.compaction.ended reporting ignored it too — a half-disabled state inconsistent with pi/omp detectProxyBase semantics (fully inert). Gate all three sites with one pluginDisabled() helper; strengthen the kill-switch test to set the proxy env and assert zero tool forwarding.
2026-09-13 22:52:57 +08:00
ework-agent 3e81d74d5d feat: OpenCode 2.0 support — V2 launcher mode + pure-proxy validation (#735)
- src/agent/opencode.ts: V2 branch (setup(ctx)) coexisting with V1 server()
  in one dual-shape default export { id, setup, server } (>=1.18.29);
  native tools compress/decompress/search_context/acp_status(+absorb)
  registered synchronously from bundled schemas (same source as proxy
  manifest, src/compress-tool.ts); header injection via probed working
  hook session.hook("http.request") (model.request registers but never
  fires in OC2 runtime); compaction-boundary reporting via
  session.compaction.ended -> /__bili/plugin/compact
- src/agent/shared.ts: fetchManifest gains "openai" format mapping;
  new reportCompactionBoundary helper
- src/launcher.ts: prepareOpencodeHttpRewrite merges compaction.auto=false
  into temp opencode config (safe on both generations)
- tests/opencode-v2.test.ts: 9 new cases (dual export shape, schema parity,
  inert-without-proxy, kill switch, activation+header timing+tool forwarding,
  env activation, compaction boundary, cleanup dispose, manifest mapping)
- tests/launcher.test.ts: +2 assertions (compaction.auto === false)
- README.md: OpenCode 2.0 section (pure-proxy config incl. apiKey
  requirement, launcher behavior, /acp limitation)
- devlog/2026-09-13_opencode-v2/: DESIGN/REQ/WORKLOG

Verified live against real OpenCode 2.0 pre-release binary: pure-proxy
round-trip OK; plugin mode confirmed ([plugin] tool executed via plugin,
zero [acp-loop] wire injection). typecheck clean, build clean,
tests 1243/1244 (sole failure pre-existing sandbox codex-path issue).
2026-09-13 22:42:58 +08:00
ework-agent 303d3d2fe7 docs: AGENTS.md — require issue tracking for discovered/fixed problems (#584) 2026-09-06 21:57:40 +08:00
ework-agent 29fc896261 fix: acp-loop zero-side-effect truncation retry + well-formed anthropic error stream (#413) 2026-09-02 09:27:34 +08:00
ework-agent 07c8fd1af7 docs: devlog entry for logger rotation orphan-inode fix (#210) 2026-08-28 00:49:43 +08:00
ranxianglei cc679ef240 Merge branch 'master' into 2026-08-26_plugin-identity-sticky 2026-08-26 23:56:03 +08:00
Sisyphus 3f217f94eb fix: identity plugin binding survives model switches across sessions (#162 semantic) 2026-08-26 23:25:48 +08:00
Sisyphus bd90581890 fix: stamp type:message on type-less Responses input items so they enter the kernel (omp wire form) 2026-08-26 21:21:13 +08:00
Sisyphus 270476d291 fix: address review follow-ups on plugin passthrough strip — non-streaming JSON parity (responses), stream-cut tail flush, multi-line data collapse, malformed content parts preserved 2026-08-26 20:30:52 +08:00
Sisyphus 7e95b488f6 fix: strip model-emitted render tags from plugin-mode passthrough responses (omp native-mode tag-echo loop) 2026-08-26 19:43:21 +08:00
ework-agent 871c6040ce docs: devlog addendum — regression branch now includes #257/#258 review-fix commits 2026-08-26 19:14:02 +08:00
Sisyphus 218c0df6e2 test: joint regression e2e for #257 + #258 2026-08-26 19:10:16 +08:00
Sisyphus 7f33f9e9e9 merge #258: drop whitespace-only Responses message items 2026-08-26 19:01:53 +08:00
Sisyphus 7e7fbb1299 fix: drop whitespace-only Responses message items at ingress (flattened-turn artifact) 2026-08-26 18:52:28 +08:00
Sisyphus f5342f36ab feat: restore omp native plugin mode — essential tools + identity register (#native)
omp 17.x mounts extension tools that omit loadMode under xd:// devices
(invisible to the main turn); declare loadMode:"essential" so the four
ACP tools reach the model natively. omp emits no before_provider_headers,
so bind the conversation via the launcher identity register (#162 path)
once tools are ready — bound sessions run in plugin mode with wire
injection suppressed. before_provider_request doubles as the retry
driver. Full native roundtrip e2e-verified against omp 17.3.8.
2026-08-26 17:43:46 +08:00
Sisyphus 8c1783f411 fix: net post-compress usage credit + hand launcher context windows to the proxy (#252) 2026-08-26 11:37:56 +08:00
Sisyphus 0d7f5d25d1 docs: devlog for joint regression + double review of PR#246/#248 2026-08-26 10:28:34 +08:00
Sisyphus 0da4274aa1 merge: regression test PR#248 2026-08-26 10:07:45 +08:00
Sisyphus 5eec4fe299 docs: devlog for omp zero-config plugin work 2026-08-26 01:40:33 +08:00
Sisyphus 3bcc3eaeec feat: native /acp command for dsh via --patch loader injection
bili dsh now splices a --patch overlay (~/.dsh-bili/.bili-acp.patch.yml)
into dsh's argv, inserting dist/agent/dsh-acp.js (a cordis command plugin,
same shape as dsh-command-compact) into whatever profile boots: a real
/acp slash command on the web/tui surfaces.

- src/agent/dsh-acp.ts: /acp → status panel (fallback=latest), else
  armed-but-idle info (#235 wording), else unreachable error
- src/agent/shared.ts: +fetchStatusLatest (conversationId=dsh placeholder;
  server rejects the empty string)
- src/launcher.ts: +writeDshAcpPatch (independent of the settings rewrite,
  exists with zero custom providers) +dshArgsWithPatch (prepend / after
  'web' / skip for 'plugin' & --dump-default-config)
- tests: launcher 85 (incl. argv assertions in runLaunch dsh e2e),
  tests/dsh-acp.test.ts 4 outcomes; 610/610
2026-08-25 23:06:30 +08:00
Sisyphus 935dc2da0e feat: bili dsh launcher for deepseek-harness (/bili/ rewrite via DSH_HOME overlay + DEEPSEEK_BASE_URL)
- client-config: resolveDshHome / parseDshSettingsYaml / readDshConfig
- launcher: dsh route discovery, prepareDshHome overlay (settings.yaml line
  rewrite, CRLF-preserving, siblings symlinked), runLaunch branch wiring
  BILLION_CONTEXT_PROXY + DEEPSEEK_BASE_URL (built-in deepseek-official route)
- fix(openai adapter): emitCompletion usage numeric fields ?? 0 — undefined
  prompt_tokens/completion_tokens serialized away and strict clients (dsh
  mapUsage) compute NaN → non-JSON-serializable session events
- cli help, README/CONFIGURATION (en+zh), 7 new tests
2026-08-25 22:11:10 +08:00
Sisyphus 30b33244f2 fix: heal already-poisoned Responses rollouts at ingress (#242)
Sanitize over-long input item ids before the projection reads them so
conversations stuck on 400 recover on the next request. Complements the
root-cause fix (hashId remapping) in this branch.
2026-08-25 21:13:53 +08:00
Sisyphus c4eed7cd58 fix: allow remote clients when bound to a non-loopback host (#240)
- setupMitm: new allowRemoteClients flag; remote CONNECT accepted only for
  whitelisted model hosts (blind tunnels stay loopback-only — no open relay)
- server: derive the flag from --host; honest 0.0.0.0 display + [security]
  warning on non-loopback binds
- tests: #77 case extended to the full remote policy matrix
- docs: README/CONFIGURATION remote-agents section (en+zh)
2026-08-25 20:31:31 +08:00
Sisyphus 646ece0137 fix(agent): /acp shows armed/idle info instead of warning before first request
A 404 from the status endpoint on a live proxy means the conversation
has sent no model request yet (e.g. /acp right after bili pi starts) —
not an error. Probe the manifest for liveness+version and show an info
notice; keep the old warning only when the proxy is unreachable.
2026-08-25 09:51:13 +08:00
Sisyphus e0eefadc6d docs: move deleted README usage detail into CONFIGURATION (en+zh) 2026-08-25 09:09:31 +08:00
Sisyphus 1b76449dfe docs: devlog e2e validation of -e injection (linux + windows vm) 2026-08-25 00:57:11 +08:00
Sisyphus 4caec3a600 feat: bili pi injects native plugin via -e when not installed
launcher pi branch prepends pi -e <dist/agent/pi.js> only when the user
has NOT run plugin install pi (mutually exclusive: pi dedups extensions
by resolved path, packages entry vs -e file would double-register).
Uninstalled users now get the native tool panel and /acp out of the box,
matching bili omp / bili opencode behavior.
2026-08-25 00:54:46 +08:00
Sisyphus e0a979bb73 docs: devlog for pi install legacy cleanup + Windows validation 2026-08-25 00:22:49 +08:00
Sisyphus 852966fdb9 docs: devlog follow-up 5 (zh restructure review) 2026-08-24 23:52:21 +08:00
Sisyphus 562f1d11cb docs: plugin-install parity zh/en — which hosts support install, launcher never needs it 2026-08-24 23:35:26 +08:00
Sisyphus ef5f87ea06 docs(devlog): record zh launcher chapter follow-up 2026-08-24 23:33:37 +08:00