158 Commits
Author SHA1 Message Date
shreynshah 0b2ce30272 fix(pi): negotiate full Anthropic requests for bili
Fixes #6796. Preserve bili compression by disabling incompatible native thread deltas through Pi session-local model compatibility.

(cherry picked from commit 7d790d9970)
2026-11-18 10:16:19 +08:00
ranxianglei 80daffc2f5 fix(storage): keep the reply stash out of the messages table (direction C1, #6947)
The first cut of this fix persisted the turn-final reply as non-tail rows
in the messages table. That breaks the table's contract: its seq space is
the ref-ledger substrate — on the first fold, persist.maybeRestampToLedger
aligns every live ref onto the store row's seq+1 (#4316), so a non-view row
interleaved in the table desyncs every post-fold ref (golden wire drift:
responses/google legs, body #10 onward).

C1: the stash lives only in sessions.metadata_json.handoffReply. That column
is persisted in both the legacy file and the unified DB, identical in both
views (digest-equal), so the reply still lands durably in the database for
#6947's 'anything reading the DB loses the turn's final reply' concern —
without touching the view, the ledger, or any wire. A client re-send then
persists the reply as a normal view row with the kernel-minted ref, exactly
as before #6947.

- handoff-response.ts: unchanged from the previous cut (metadata-only stash,
  plan-ready rows with the codec-canonical ids, restampForJoin sidecars)
- ingest.ts: keep the planStoredMessageRow/HandoffReplyStashRow exports the
  capture uses; no planner emission
- store.ts / mysql.ts: back to the pre-cut delta/full paths (the join
  extension is gone with the table rows)
- tests: rewrite for C1 (stash never reaches the table; re-send is base
  behavior; identity join-key parity; golden re-baseline = metadata section
  only)

Local (node 22, clean env): issue6947 12/12, fork 4 files 91/91, lane/
storage/golden 6 files + storage-engine-proofs green at BASE expectations,
build OK.
2026-11-17 10:58:38 +08:00
ci-check 1a4450bc85 Merge remote-tracking branch 'upstream/master' into HEAD 2026-11-16 20:44:19 +08:00
ci-check 8ed56be997 docs(architecture): add src/responses-system-sections.ts to the module map (#6922) 2026-11-16 20:42:39 +08:00
ranxianglei 301e1a5459 Merge pull request #6151 from ranxianglei/nudge-debug-pi
[PR] feat: pi lane — show the injected nudge text verbatim in the terminal when debug is on
2026-11-16 20:35:23 +08:00
ranxianglei e484c0322f Merge remote-tracking branch 'origin/master' into fix-2817
# Conflicts:
#	tests/notice-registry.test.ts
2026-11-14 00:57:16 +08:00
ranxianglei 99c22d283f Merge pull request #6514 from ranxianglei/2026-11-13_announcement-policy
docs(governance): 公告政策——禁止全员广播、owner 确认、写明影响范围、插件公告必须触发式 (#6508)
2026-11-13 15:46:07 +08:00
ranxianglei baaeab5bae docs(governance): announcement policy — no broadcast-to-all, owner confirmation, blast-radius PRs, plugin notices trigger-only (#6508)
Owner ruling 2026-11-13, after the dsh-live-compact record (#5984) shipped
as an ungated remote-feed broadcast and had to be retracted (#6508/#6509):

1. strict prohibition on announcements visible to every machine unconditionally
2. explicit owner confirmation before ANY announcement PR (add/change/retract)
3. announcement PRs must state the blast radius: audience, version coverage
   (incl. which older versions ignore new gate fields), and display duration
4. plugin-targeted announcements disallowed in principle — plugin conflict
   surfacing belongs to the read-only conflict scan (#1206); a plugin-targeted
   notice must be trigger-based (scan surfaces, or a requiresScan-gated record)

AGENTS.md: new MANDATORY table row + 'Remote Announcements' section in §4;
reference/design-decisions.md: KDD #19 with the full ruling and precedent.
2026-11-13 15:45:13 +08:00
ranxianglei e6e4ad90bc fix(notices): gate announcement records on the live conflict scan via requiresScan (#6508)
The dsh-live-compact-conflict entry in announcements/remote.json
broadcast to EVERY instance: NoticeRecord gates (versions/percent/time
window/dismiss) carry no client dimension, so the banner showed even on
machines where the plugin is not installed — contradicting the conflict
scan's 'flag only when found' semantics (#5984).

Add optional requiresScan: { client, knownId? } to the record schema
(validated by the shared validateRecord, counted in contentHash16):
when set, noticePassesGates keeps the record hidden unless that
client's read-only plugin-registry scan actually reports the plugin
(any finding, or a matching knownId). Empty registries scan empty, so
the gate fails closed and can never force user action. Scan results
are cached per client+cwd for 5 min, keeping hot poll paths cheap.

- remote.json: the #5984 entry now gates on dsh + dsh-live-compact
- docs: configuration (en/ja/zh) + KDD #16 record the field
- tests/remote-announcements.test.ts: gate behavior (hidden→shown→
  knownId mismatch→any-finding), validation matrix, remote-lane
  end-to-end, shipped-feed validation — hermetic DSH_HOME fixture,
  scan cache cleared per case
2026-11-13 13:59:07 +08:00
ci-check 8edc22ab6a docs(architecture): add src/server/rejection-diagnostics.ts to the module map
The #4452 batch added a new src/server/ module but the file-by-file map in
reference/architecture.md was not regenerated, so the architecture-docs CI
guard failed with 'missing: src/server/rejection-diagnostics.ts'. Add the row
(alphabetically between relay.ts and request-cost.ts) so the map covers all
src files again.
2026-11-13 13:10:31 +08:00
ci-check a5996bb931 Merge remote-tracking branch 'origin/master' into pr6151-conflict
# Conflicts:
#	src/server/prepare-anthropic.ts
2026-11-12 22:37:56 +08:00
ranxianglei 873715d40a Merge pull request #6439 from ranxianglei/afloat-dry
[PR] chore(batch): land 50 open Afloat16 fixes in one history-preserving batch
2026-11-12 22:01:24 +08:00
Afloat baf19a1411 docs: register shared TOML integer reader in architecture map
(cherry picked from commit 46a95888c2)
2026-11-11 23:02:54 +08:00
ranxianglei c26c31ace4 Merge pull request #6260 from ranxianglei/handoff-render-ework
[PR] Web Panel: Handoff Documentation and Collapsed Tree Diagram Rendering Upgrade (eWork-Level Rendering, Appendix Sectionin | Web 面板:交接文档与压缩树图渲染升级(eWork 级渲染、附录分节、冻结快照水合)
2026-11-11 22:55:07 +08:00
ranxianglei bb8de86c3c web: eWork-grade handoff document rendering (markdown + syntax highlight + role cards)
The sessions' handoff (交接文档) tab rendered every message body as
escaped plain text: markdown in assistant replies stayed literal, code
fences showed raw backticks, and tool input/output was one giant
unhighlighted pre with no copy button.

- new src/web/mdrender.ts: single escape-first Markdown + hand-rolled
  syntax-highlight core (json/diff/js/ts/py/sh lexers, GitHub light+dark
  palettes, unknown languages degrade to escaped text, zero runtime
  deps). Inlined into the browser IIFE via .toString() exactly like the
  JSONC helpers; tests/mdrender.test.ts pins behavior plus the
  self-contained inlining contract (esbuild-minified .toString() must
  run in a bare scope, mirroring the tsup pipeline).
- web/markdown.ts becomes a thin wrapper over the same core, so the
  server-rendered handoff fallback and blog articles gain highlighting
  too.
- client.ts renderHandoffMd: role cards (user/assistant/tool left border
  + badge), markdown-rendered bodies incl. thinking chains (collapsed by
  default), structured tool cards (input/output label, language detection
  json/diff, per-block copy button, JSON pretty-print, open when <= 20
  lines), document meta (title/session id/token stats) rendered as a
  key/value box instead of being skipped.
- styles.ts: card/token CSS vars in light + both dark palettes (#2559
  verbatim-equality kept); i18n: det.io_in/det.io_out.
- tests/web-handoff-roles.test.ts adapted to the new markup; the #2065
  invariant (in-body headings never become role dividers) is preserved.

CHANGELOG + docs/architecture/webui(.zh-CN).md + reference/architecture.md
file map updated (architecture-docs lane green).
2026-11-11 10:24:37 +08:00
ranxianglei 1090cd8764 pi lane: drop the persistent nudge record line — transient verbatim notify only
Per owner review: the always-on compact record line (acp-nudge CustomEntry,
billion-context-pi #326 parity) is unnecessary — the transient verbatim
terminal notification (debug switch on) is the whole point of this feature.

- src/agent/pi.ts: no more registerEntryRenderer/appendEntry wiring; one
  after_provider_response hook shows the verbatim wire text once per user
  turn via ctx.ui.notify (consumes+clears the pending event, turnKey dedup)
- src/nudge-debug.ts: drop ACP_NUDGE_CUSTOM_TYPE + formatNudgeRecord
- tests: wiring test asserts the pi host carries exactly one extra
  after_provider_response subscription vs omp (the #3248 ack channel
  subscribes both lanes); formatNudgeRecord test removed
- docs en+zh, architecture.md: transient notify only, never persisted
2026-11-11 09:38:10 +08:00
ranxianglei 56bb58302e pi lane: align the nudge view with billion-context-pi #326
- custom type acp-nudge (was bili-nudge); compact one-liner
  [ACP nudge] <pct>% · T<tier>[ EMERGENCY][ · top range a–b]
- the compact record line is ALWAYS on (no debug config needed):
  one per user turn, persistent in the session file, pi-visible /
  model-invisible (type:custom never enters LLM context)
- the verbatim wire text becomes a transient terminal notification
  (debug switch on: ACP_DEBUG / config debug), shown once per turn
  after the model answered — never persisted
- dedup per (session, turn) via a stable key of the last text user
  message (anthropic tool_result user messages skipped)
- bus events carry the record metadata (pct/tier/emergency/topRange/
  turnKey); emitters compute it from the PRE-nudge array
2026-11-11 09:05:48 +08:00
ci-check 24ff4e2d74 docs(architecture): register src/acp-block-ops.ts in the file map (#5765)
The #5924 architecture-docs guard (landed on master via the branch sync)
requires every tracked src/ file in reference/architecture.md; the new block-ops
host executor module was added by this PR without its map row, so the guard
failed on the merged head. One-line registration next to the acp-* cluster;
guard passes locally (320 src files covered, no ghosts).
2026-11-11 06:05:53 +08:00
ranxianglei 141cfbcf97 pi lane: show the injected nudge text verbatim in the transcript when debug is on
With the existing debug switch on (ACP_DEBUG=1 / config debug), every
compression nudge the proxy injects is mirrored into the pi transcript
as a transcript-only CustomEntry: [bili-nudge] <protocol>/<kind>
tier=… reason=… label + the final wire text the model actually read
that turn. Human-only: pi's session-context build ignores
type:"custom", so the view never enters LLM context or re-sent history.

Mechanism: the prepare stage (anthropic + openai lanes — the two pi
reaches) emits the post-wrapper text into a tiny in-process pub/sub
(src/nudge-debug.ts); in the default INLINE pi mode the extension is
the same bundle/process and mirrors each event via
pi.appendEntry("bili-nudge") + registerEntryRenderer. Emitters are
listener-less no-ops, so the prepare sites stay config-plumbing-free;
the consumer gate is a new debugEnabled() knob (src/knobs.ts) mirroring
Options.debug exactly (env ACP_DEBUG > file debug > false).

No new config fields / env vars / CLI flags — rides the existing debug
switch (owner decision; a draft nudgeDebug field from the first draft
was removed before the PR). kernel/ and pi-subagents/ untouched.
2026-11-10 23:55:59 +08:00
ranxianglei e1e33a974c Merge pull request #6032 from suyeku1/2026-11-09_merge-master-into-1444
[PR] Rebase #1444 onto master: declarable model endpoints + commandcode wire family
2026-11-10 21:17:52 +08:00
ci-check 9914dcae91 Merge origin/master into PR #6032 head — resolve handle.ts import split (logRequestCost → request-cost.js; keep declPinConflictWarned) 2026-11-10 09:32:20 +08:00
ranxianglei f8b2591f35 Merge pull request #6033 from ranxianglei/2026-11-09_fix-web-detail-restamp-refnum-miss
[PR] fix: hydrate web block-detail leaves by stable msg_id, not restamped ref number
2026-11-10 09:27:09 +08:00
ranxianglei a9ba419362 Merge pull request #5481 from Maziar123/fix/factual-request-cost
[PR] fix(diagnostics): report large histories without attributing stalls
2026-11-10 09:05:10 +08:00
ranxianglei 16cd4577a5 Merge pull request #6068 from ranxianglei/2026-11-10_6003-egress-transform-pipeline
[PR] feat: user-registerable egress request-body rewrite pipeline
2026-11-10 08:59:42 +08:00
ci-check c7e0582d33 docs: list src/egress-transforms.ts in the architecture file map (#6003) 2026-11-10 03:37:54 +08:00
ci-check d271b14476 Merge upstream/master (4446301708) — resolve #5481 conflicts
- src/server.ts / src/server/request-cost.ts: keep this PR's module
  extraction; port master's #5907 once-per-session slow-warn dedup
  (SLOW_SESSION_WARNED map + bound, est-tok field,
  _resetSlowSessionWarnedForTest) into request-cost.ts. The warn line
  composes both intents as pinned by the merged test suite in
  tests/issue4528-event-loop-yield.test.ts: factual non-attributing core
  (#5481) + size picture with the bili sessions rm cleanup command
  (#5907); restart/enabling-compression advice stays out.
- src/server/relay.ts: master's #5998 strict-thinking-posture strip runs
  BEFORE this PR's requestBody extraction, so onWireBody captures the
  bytes actually handed to fetch.
- src/server.ts imports: drop queryLogLines (no longer used on master)
  and noteRequest (moved with logRequestCost); keep configureLogRetention.
- CHANGELOG.md / reference/architecture.md: union of both sides' entries.
- Targeted local runs green: issue4528-event-loop-yield,
  issue903-request-cost-log, issue5998-unsigned-thinking-egress (25/25);
  typecheck clean.
2026-11-10 02:05:28 +08:00
ci-check 7291f0e136 Merge origin/master into PR #6032 head — resolve commandcode-adapter vs separatorSlots conflict in relay.ts 2026-11-10 01:55:26 +08:00
ework-agent 0968d50951 docs: list src/exit-deadline.ts in the reference map (#5753)
The rebase onto master picked up the new architecture-docs guard
(#5930) which requires reference/architecture.md to list every tracked
src/ file. exit-deadline.ts (split out in the exit-flush hardening
commit of this PR) was missing.
2026-11-10 00:48:08 +08:00
ranxianglei 8f090b8336 Merge branch 'master' into fix/private-log-retention 2026-11-10 00:00:07 +08:00
ranxianglei 697f45b325 Merge pull request #5478 from Maziar123/fix/invariant-provenance
[PR] fix(invariants): bind separator exemptions to producer-owned wire items
2026-11-09 23:47:11 +08:00
ranxianglei 48dc0d5ff1 docs: adopt the #1444 branch's wire-contracts doc wording (relative link + index/architecture lines)
The #1444 feature branch polished these five lines after this PR's tip
was cut: the wire-contracts ledger reference becomes a clickable
relative link (the file lives next to configuration.md), the docs
index row states the ledger's permanence rule, and the architecture
source map carries the longer comments with adapter-commandcode.ts
in position. Taking the #1444 versions verbatim makes this PR a
superset of the feature branch, so either merge path offered in the
PR body (merge tip into the feature branch, or replace its head)
lands identical docs.
2026-11-09 23:36:40 +08:00
tomato_Ketchup c7ac7b5554 docs(architecture): register the three #1295 modules in the source map
The architecture-docs CI guard (#5930) requires every tracked src/ file to
appear in reference/architecture.md. Merging master exposed three modules the
PR adds without registering, so the guard fails on the merged head 0f502f4
with:

  FAIL: reference/architecture.md missing: src/commandcode-wire.ts
  FAIL: reference/architecture.md missing: src/loop/adapter-commandcode.ts
  FAIL: reference/architecture.md missing: src/model-endpoints.ts

Ran the guard's own logic against this tree: 311 src files, 0 missing,
0 ghosts, ledger/page/SVG checks green.
2026-11-09 22:03:02 +08:00
ci-check 9e3d8e1cf8 fix: hydrate web block-detail leaves by stable msg_id, not restamped ref number
restampRefsToLedger renumbers the live refs at cold load (the #5196 parked band
lands on fresh high numbers), but messages.ref_num stays frozen at index time.
The web block-detail path resolved each direct message's raw id through the live
byRaw map to a ref NUMBER and queried the store by that number, so every
renumbered row silently missed: ~37% of a long session's block-detail leaves
rendered "该消息已不在会话里". Folding, summaries and model volume were
unaffected; only the retrospective "what did this block fold" inspection broke,
and once refLedgerAligned=true set it never self-healed.

Switch both hydration callers (buildSessionDetail leaves + buildMessageContent)
to join on the stable msg_id — invariant across restamps — via a new
store.messageContentByMsgIds → shadow → persist.unifiedMessageContentByIds path
that mirrors the existing ref-number sibling (same fail-open posture, same
retired-row exclusion). The ref stays display-only. Export JSONL reads rows by
seq order and never joins live refs, so it is untouched. Registry row updated.

Closes #6029
2026-11-09 21:20:38 +08:00
mz 38569746a9 docs(architecture): map the Responses separator module 2026-11-09 14:21:14 +03:00
mz c1a4409f92 Merge remote-tracking branch 'origin/master' into fix/invariant-provenance
# Conflicts:
#	CHANGELOG.md
#	src/server/prepare-responses.ts
#	src/server/relay.ts
2026-11-09 14:04:22 +03:00
mz 1db639fd2a Merge remote-tracking branch 'origin/master' into fix/private-log-retention 2026-11-09 12:55:00 +03:00
ci-check 287c48c15d docs: register src/server/thinking-posture.ts in the architecture file map (#5998) 2026-11-09 13:47:19 +08:00
ranxianglei ba0ae45406 Merge pull request #5966 from ranxianglei/2026-11-08_nonstream-anthropic-proxy-loop
[PR] fix: execute proxy-owned tools on the non-stream Anthropic path (#5957)
2026-11-09 12:59:01 +08:00
mz d2ad8bf484 Merge remote-tracking branch 'origin/master' into fix/factual-request-cost 2026-11-09 12:53:00 +08:00
ranxianglei dc14f44289 chore: pass unused-exports + architecture-docs gates (#5963)
- mark the nine internal-only symbols in src/context-analysis.ts
  (InitMessageEntry/InitProfile/NudgeEvent/HarvestRecord/CommitSample/
  TierReadiness/ContextAnalysis/NudgeObservationTurn/buildVerdict) as
  consumed inside the module or through the view formatter, satisfying
  the unused-exports gate
- add src/context-analysis.ts to the reference/architecture.md file map
2026-11-09 00:36:34 +08:00
ci-check e6cb37e845 fix: execute proxy-owned tools on the non-stream Anthropic path (#5957)
A stream:false Anthropic response that calls a proxy tool (compress,
acp_status, search_context, decompress) was rewritten once: each
tool_use became its result text and stop_reason was forced to
end_turn, so a compress round ended the client turn with the fold
receipt and the model never saw the result. Port the streaming
decision (core.ts reRequest gate) to this lane: proxy-only rounds
execute through the same executors, append the original assistant turn
plus a tool_result user turn to the forwarded body, and re-request;
mixed or tool-free rounds fall through to the untouched one-shot
rewriter. Bounded by MAX_LOOP_ROUNDS with degradation to the pre-fix
shape at the limit.
2026-11-08 23:51:39 +08:00
ranxianglei 44faff0c00 docs: slim AGENTS.md — KDD full text to reference/design-decisions.md, triage table to reference/triage.md (owner request 2026-11-08) 2026-11-08 16:16:12 +08:00
ranxianglei 8f1fca8471 docs: live architecture hub — overall diagram, module pages with diagrams, file-map CI guard (owner request 2026-11-08) 2026-11-08 13:46:53 +08:00
ranxianglei 05bb1dc948 docs: centralize 14 root docs under docs/ with hub index + redirect stubs (owner request 2026-11-08) 2026-11-08 13:33:45 +08:00
mz 4954a1226d Merge remote-tracking branch 'origin/master' into fix/factual-request-cost 2026-11-06 13:32:19 +03:00
mz 63081baa4b Merge remote-tracking branch 'origin/master' into fix/private-log-retention 2026-11-06 13:24:07 +03:00
ci-check 6b443339af Merge origin/master into fix/invariant-provenance (resolve #5478 conflict)
Union of the two divergent edits in the compat-role rewrite path: keep #5478's object-graph/string split for the carrier binding, and retain master's Kiro judgeRoleRestore capture in BOTH success branches (graph and string) so Kiro turns carrying a separator manifest still get the invariant-judge role restore. CHANGELOG keeps both sides' entries.
2026-11-03 23:38:53 +08:00
ci-check 2af70db07e Merge remote-tracking branch 'origin/master' into HEAD 2026-11-02 19:01:44 +08:00
Meet Vaghani 42ca54f545 feat: bili kiro — Kiro CLI launcher lane (Responses wire on runtime.*.kiro.dev)
Kiro CLI's agent calls its model gateway over the OpenAI Responses wire
(POST https://runtime.<region>.kiro.dev/v1/responses, SSE), replays the full
history every turn, authenticates with a bearer token (no body signature)
and honors HTTPS_PROXY — so the existing responses pipeline compresses it
once two gateway quirks are handled (src/kiro.ts):

- Roles: the gateway accepts only user/assistant items; the injected
  developer compress prompt was rejected (400 "not supported", param
  input[0]), system likewise. Built-in compat map developer/system -> user
  for Kiro traffic, lowest precedence (compat.roles and learned roles win
  per key). The invariant judge sees the injected prompt with its original
  role (no false I1 mid-insertion).
- Identity: Kiro's first item is not byte-stable across processes, so every
  'kiro-cli chat --resume' minted a new session. Promote
  metadata["kiro:conversation_id"] (kiro-<id>) over a content fingerprint.

Launcher: 'bili kiro' cert-MITMs only the four runtime.*.kiro.dev gateways,
combined CA on SSL_CERT_FILE (Rust shell) + NODE_EXTRA_CA_CERTS (Node agent
server), loopback via NO_PROXY, resolves kiro-cli.

Tests: tests/kiro.test.ts (9), runLaunch kiro in tests/launcher.test.ts.
Docs: CLIENTS.md / CLIENTS.zh-CN.md, README tables + launcher lists,
CHANGELOG, reference/architecture.md.
2026-11-02 16:30:23 +05:30
mz ec24a19e17 Merge remote-tracking branch 'origin/master' into fix/invariant-provenance
# Conflicts:
#	src/server/prepare-responses.ts
#	src/server/relay.ts
2026-11-02 11:32:47 +03:00