Files
deepseek-harness/packages/llm
Yichen Jiang 54c60f4079 fix(llm,settings): refuse post-disposal route replacement and teardown notifications
Two lifecycle holes the registry and the consumer helper left open.

`AdapterRegistrationHandle.replace` had no liveness guard: after the handle's
disposer ran, a replace put routes back into the registry with nothing left to
release them, so the adapter leaked permanently. `owned` being empty cannot
carry that fact, because `replace([])` is the legal empty-section state, so the
disposer records it explicitly.

`installSettingsSection`'s watcher lacked the guard its own disposer carries:
a stored change landing while the consumer unloads reached `onChange`, which
re-registers routes against a fiber whose resources are being released.

Also documents `withFileLock` in the atomic-write README (it claimed one
export), records the age-based lock takeover as a known limitation, and lists
ctx.settings and ctx.credentials in the architecture capability table.
2026-07-30 23:23:18 +08:00
..

llm/ — LLM capability family

English | 中文

The LLM seam and its provider adapters. The interface package (llm) owns the abstract service, the content-block vocabulary, and the stream-chunk assembler; the adapters are concrete implementations that register on ctx.llm. All product packages.

Package Role ctx key
llm/ Abstract LLM service + content-block vocabulary + chunk assembler ctx.llm
token-meter/ Replay-aware request and surface token measurement ctx.tokenMeter
llm-retry/ Exact-provider normal or unbounded request retry policy (listens to agent/request-error)
llm-deepseek/ DeepSeek API adapter (direct fetch + eventsource-parser SSE) (registers on ctx.llm)
llm-pi-ai/ Multi-provider adapter via @earendil-works/pi-ai (registers on ctx.llm)

The interface lives at llm/llm/; adapters, retry policy, and the reusable token meter are flat siblings under the group. Requests route by provider, while model is passed through to the selected adapter. The route-owning adapter supplies retry policy and resolves available exact-model identity, context capacity, and reasoning metadata; the retry executor and token meter remain provider-agnostic. A new provider adapter registers one or more provider routes on ctx.llm without touching the consumers. See twin LLM adapters for the two shipping implementations, the replay token meter Agent Note for measurement ownership, and the routed model context Agent Note for capacity and compaction-policy ownership.