dsh-cc/dsh-cc--packages-llm-tuning-side-query ↗★ 1
@dsh-cc/side-query
First-class auxiliary-LLM primitive: one-shot, non-streaming, fail-soft side query over a cheap-lane alias route with timeout/tool-call rejection/unrouted semantics 适合插件开发者复用统一的小模型旁路调用,含超时与工具调用拒绝语义。
インストール
検証済み bundle がないか、互換性チェックに失敗しています。先にリポジトリの説明を読んでください。 README 全文を読む ↗
ドキュメント
README 全文を読む ↗@dsh-cc/side-query
English | 中文
The side-query primitive: a declarative, never-throws, non-streaming auxiliary LLM call for harness features that need a small/fast model answer off the main agent loop (design: docs/plans/2026-09-15-side-queries.md). Before this package, web_fetch's page summarizer, the session-title provider, and the permission auto-mode classifier each hand-rolled their own one-shot call with drifting timeout/failure/route semantics; runSideQuery is the single shared shape.
API
export interface SideQueryOptions {
agent: Agent // required: provider fill via agent.session.requestHeader (web-fetch precedent)
alias?: string // default 'haiku' (resolveAlias / ccModelRoutes lane)
system?: string
prompt: string
maxTokens?: number // default 512
timeoutMs?: number // default 8000
signal?: AbortSignal // caller-owned; composed with the timeout (AbortSignal.any)
onUnrouted?: 'inherit' | 'skip' // default 'inherit' (alias unconfigured -> parent route)
rejectToolCalls?: boolean // default true
}
export type SideQueryResult =
| { ok: true; text: string; inheritedRoute: boolean; durationMs: number }
| { ok: false; reason: 'unrouted' | 'timeout' | 'error' | 'empty'; inheritedRoute?: boolean }
export async function runSideQuery(ctx: Context, opts: SideQueryOptions): Promise
Semantics
- Never throws. Every failure shape — unrouted alias, timeout, adapter error, empty text — collapses into
SideQueryResult. The dsh-llm runtime normalizes adapter throws into terminal error chunks, soreason: 'error'covers both paths. - Non-streaming contract: consumes
ctx.llm.streamthrough the BlockAssembler pattern and awaits the full text (thetool-web-fetchone-shot pattern). rejectToolCalls(default) rejects streams that emit tool-call blocks. A side query that tries to act is a bug, not a capability (the memory recall-selector rogue-execution lesson).inheritedRoutereports whether the alias fell back to the parent route, so consumers can meter zero-savings runs (seewarnOnInheritin@dsh-cc/cc-model-aliases).- No retry, no cache, no persistence, no ledger — those belong to consumers (e.g.
@dsh-cc/tool-use-summarykeeps the ledger).
Shape
Library package: no preset row, no settings namespace, no capability-manifest entry. Consumers depend on it with workspace:^ and add a project reference in their own tsconfig.json.