Files
deepseek-harness/packages/llm
Turtle aeb48cc5f3 Render error cause chains at every diagnostic seam
A TUI run against an unreachable endpoint failed with only 'fetch failed':
undici wraps transport failures in a bare TypeError whose diagnosis lives
on .cause, and every diagnostic seam rendered only error.message. The
readline front door additionally rendered failed turns as pure silence.

- dsh-llm: new errorChain(value) renders the full cause chain and
  AggregateError members with circular/hostile-coercion containment.
- llm-deepseek: pre-response transport failures throw LlmError('NETWORK')
  naming the endpoint and chaining the fetch TypeError; aborts keep their
  DOMException so the loop still classifies them as cancellation.
- agent-loop: durable turn/end error messages and logger warnings render
  through errorChain; local renderThrown copies removed.
- ui-stdio: failure turn/end reasons now render ([turn failed <code>],
  [turn aborted], [turn rejected], output-token-limit); startup-failure
  logs use errorChain.
- ui-tui: agent/error notices and the startup-failure line use errorChain.
2026-07-20 12:35:10 +08:00
..
2026-07-19 22:52:03 +08:00

llm/ — LLM capability family

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-deepseek/ DeepSeek API adapter (hand-rolled fetch/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 and the reusable token meter are flat siblings under the group. Requests route by provider, while model is passed through to the selected adapter. A new provider adapter joins here and registers one or more provider routes on ctx.llm without touching the interface. See twin LLM adapters for the contract-validation origin of the two shipping implementations and the replay token meter Agent Note for measurement ownership.