|
|
před 2 měsíci | |
|---|---|---|
| .. | ||
| src | před 2 měsíci | |
| tests | před 2 měsíci | |
| README.md | před 2 měsíci | |
| package.json | před 2 měsíci | |
| tsconfig.json | před 2 měsíci | |
Shared implementation policy for model-backed session-title providers. It resolves the auxiliary route, frames exact selected human messages as JSON, applies a language-aware title instruction, enforces input and output budgets, composes timeout and caller cancellation, assembles the stream, and returns normalized text with exact source seqs and model provenance.
This package is a library, not a Cordis plugin. The provider plugins call registerSessionTitleLlmProvider() with their cadence and message selector; it validates shared config and delegates each revision to generateSessionTitleWithLlm(), so registration, route, prompt, cancellation, and validation behavior cannot drift between them.
provider and model overrides are optional but must be supplied together as non-empty strings. Without that pair, the helper uses the exact provider/model route captured from the current session's logged request/header; an explicit refresh before any route exists therefore needs overrides. Input exceeding maxInputBytes rejects instead of being truncated. Timeout, cancellation, malformed or empty output, tool calls, and non-stop finish reasons also reject; the session-title service decides whether that rejection is an automatic warning or an explicit caller failure.
Every field is required except the paired route override; there are no library defaults.
| Key | Contract |
|---|---|
targetWords |
Positive target word count for non-CJK titles. |
targetCjkCharacters |
Positive target character count for Chinese, Japanese, or Korean titles. |
maxInputBytes |
Positive aggregate UTF-8 byte ceiling across selected messages. |
maxOutputTokens |
Positive auxiliary generation token cap. |
timeoutMs |
Positive end-to-end deadline within the runtime timer limit. |
provider, model |
Optional explicit route; both or neither. |
The title model receives a fixed system instruction to return one concise unadorned title in the input language, including the configured word and CJK-character targets. Its one user message contains a JSON array of the exact selected human messages and their seqs.
The auxiliary request consumes tokens according to selected input size and maxOutputTokens. It is separate from the main agent request and does not add title text or framing to agent history.
No main-request invalidation. Auxiliary cache reuse is provider-specific; the fixed instruction is reusable while the JSON message array changes with each revision.