{"_id":"@buckeyestudio/toh-session-title-llm","name":"@buckeyestudio/toh-session-title-llm","dist-tags":{"next":"0.1.1-rc.2","latest":"0.1.1-rc.2"},"versions":{"0.1.1-rc.2":{"name":"@buckeyestudio/toh-session-title-llm","description":"Shared LLM generation policy for TheOpen Harness session-title providers","version":"0.1.1-rc.2","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/dustinwloring1988/theopen-harness.git","directory":"packages/session/session-title-llm"},"type":"module","main":"lib/index.js","types":"lib/types/index.d.ts","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","author":{"name":"buckeyestudio"},"peerDependencies":{"@buckeyestudio/toh-invariants":"^0.1.1-rc.2","@buckeyestudio/toh-llm":"^0.1.1-rc.2","@buckeyestudio/toh-session":"^0.1.1-rc.2","@buckeyestudio/toh-session-title":"^0.1.1-rc.2","@buckeyestudio/toh-timeout":"^0.1.1-rc.2","@buckeyestudio/cordis":"^4.0.1"},"dependencies":{"@buckeyestudio/schemastery":"^3.18.1"},"devDependencies":{"@buckeyestudio/toh-invariants":"^0.1.1-rc.2","@buckeyestudio/toh-llm":"^0.1.1-rc.2","@buckeyestudio/toh-session":"^0.1.1-rc.2","@buckeyestudio/toh-session-title":"^0.1.1-rc.2","@buckeyestudio/toh-timeout":"^0.1.1-rc.2","@buckeyestudio/cordis":"^4.0.1"},"_id":"@buckeyestudio/toh-session-title-llm@0.1.1-rc.2","bugs":{"url":"https://github.com/dustinwloring1988/theopen-harness/issues"},"homepage":"https://github.com/dustinwloring1988/theopen-harness#readme","_integrity":"sha512-CCnzClEFjGe/XLNWFl5ivD3gaSsOMNFZ3wVMTzG5VD9FI8G3vL1Wbgunpsq3KtXBD+x3+UxKUGx/xRV3IaLtBQ==","_resolved":"/home/runner/work/theopen-harness/theopen-harness/dist/npm/buckeyestudio-toh-session-title-llm-0.1.1-rc.2.tgz","_from":"file:/home/runner/work/theopen-harness/theopen-harness/dist/npm/buckeyestudio-toh-session-title-llm-0.1.1-rc.2.tgz","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-CCnzClEFjGe/XLNWFl5ivD3gaSsOMNFZ3wVMTzG5VD9FI8G3vL1Wbgunpsq3KtXBD+x3+UxKUGx/xRV3IaLtBQ==","shasum":"857378efd61380a3c653ad2e5afc4948f612798e","tarball":"https://registry.npmjs.org/@buckeyestudio/toh-session-title-llm/-/toh-session-title-llm-0.1.1-rc.2.tgz","fileCount":9,"unpackedSize":29581,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBnZ3T6Wnz28oN2vlo8mAqVuld6pQczvoiNKKdvQd12MAiEA2UK7RRLpS+jv6Mb3xDuhs1Pn9WUxj3jM4aILKJc/1P0="}]},"_npmUser":{"name":"buckeyestudio","email":"dustinwloring1988@gmail.com"},"directories":{},"maintainers":[{"name":"buckeyestudio","email":"dustinwloring1988@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/toh-session-title-llm_0.1.1-rc.2_1787489305070_0.7120476992571769"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-23T12:48:24.966Z","0.1.1-rc.2":"2026-08-23T12:48:25.210Z","modified":"2026-08-23T12:48:25.381Z"},"maintainers":[{"name":"buckeyestudio","email":"dustinwloring1988@gmail.com"}],"description":"Shared LLM generation policy for TheOpen Harness session-title providers","homepage":"https://github.com/dustinwloring1988/theopen-harness#readme","repository":{"type":"git","url":"git+https://github.com/dustinwloring1988/theopen-harness.git","directory":"packages/session/session-title-llm"},"author":{"name":"buckeyestudio"},"bugs":{"url":"https://github.com/dustinwloring1988/theopen-harness/issues"},"license":"MIT","readme":"# @buckeyestudio/toh-session-title-llm\n\n[English](README.md) | 中文\n\n由模型支持的会话标题提供方的共享实现策略。它解析辅助路由，将精确选中的用户消息封装为 JSON，记录可分发的确切请求，应用语言感知的标题指令，强制执行输入和输出预算，组合超时与调用方取消，组装流，并返回规范化文本，同时给出确切来源 seq 以及生成该文本时使用的提供方／模型路由。\n\n此包是普通库，不是 Cordis 插件。提供方插件调用 `registerSessionTitleLlmProvider()`，传入各自节奏与消息选择器；该函数验证共享配置，并将每次修订委派给 `generateSessionTitleWithLlm()`，使各插件的注册、路由、提示词、取消与验证行为不会漂移。\n\n## 路由与失败约定\n\n`provider` 和 `model` 覆盖项都是可选的，但必须同时作为非空字符串提供。如果没有这一对取值，辅助模块会使用当前会话已记录 `request/header` 中捕获的确切提供方／模型路由；因此，在任何路由出现前显式刷新时必须提供覆盖项。辅助模块在记录或分发前，依据 `maxInputBytes` 检查最终 JSON 封装用户提示词的大小，包括 seq 字段、包装层与 JSON 转义，而不是将其截断。消费流期间和流完成后都会重新检查超时与调用方取消，因此即使拦截器或适配器忽略 abort，也不能接受迟到的成功结果。格式错误或空输出、工具调用和非 stop 结束原因同样会导致调用被拒绝；会话标题服务决定该拒绝属于自动警告还是显式调用方失败。\n\n路由与输入验证完成后，辅助模块会在模型分发前直接通过 `Session` 追加仅写入日志的 `session/title-llm-request` 事件。它包含标题提供方 id、确切来源 seq、路由、系统提示词、消息列表，以及该调用使用的输出 token 上限。持久化会立即观察到该记录；追加不需要标题专属标记、类型断言、结算队列或刷写。分发的请求封套会深度冻结，携带 `purpose: 'session-title'`，且有意不包含 toh-agent-loop 的进程本地请求身份。拦截器会与记录保持一致，而循环专用重建观察者不会把它与对话请求头比较。DeepSeek 适配器会根据该用途禁用思考，使少量输出预算全部用于可见标题文本；其他适配器负责自身用途专用行为。后续模型失败会保留请求记录；从未成为可分发请求的验证失败不会创建记录。该事件始终位于派生模型历史之外。\n\n<a id=\"configuration\"></a>\n\n## 配置\n\n除成对的路由覆盖项外，每个字段都必填；库不提供默认值。\n\n| 键 | 约定 |\n|---|---|\n| `targetWords` | 非 CJK 标题的正整数目标词数。 |\n| `targetCjkCharacters` | 中文、日文或韩文标题的正整数目标字符数。 |\n| `maxInputBytes` | 最终 JSON 封装用户提示词的正整数 UTF-8 字节上限。 |\n| `maxOutputTokens` | 辅助生成的正整数 token 上限。 |\n| `timeoutMs` | 运行时定时器限制内的正数端到端时限。 |\n| `provider`, `model` | 可选显式路由；二者同时提供或同时省略。 |\n\n## 模型体验\n\n### 辅助标题请求\n\n#### 模型看到的内容\n\n标题模型会收到固定系统指令，要求以输入语言返回一个简洁且无装饰的标题；该指令包含所配置的词数与 CJK 字符数目标。它唯一的用户消息包含一个 JSON 数组，其中是精确选中的用户消息及其 seq。\n\n#### Token 影响\n\n辅助请求根据所选输入大小和 `maxOutputTokens` 消耗 token。它与主 agent（智能体）请求相互独立，不会向 agent 历史增加标题文本或封装内容。DeepSeek 标题调用会关闭思考；主对话保留自身配置的思考模式。\n\n#### KV Cache 影响\n\n不会使主请求的 KV Cache 失效。辅助缓存复用由提供方决定；固定指令可复用，而 JSON 消息数组会随每次修订变化。\n\n## 已知限制与暂缓事项\n\n- 辅助模块只接受文本输出，并拒绝工具调用；不公开结构化输出适配器或提供方专用提示词变体。\n- 它对整个封装用户提示词强制执行字节上限，不会剪裁单条消息或应用保留策略。\n","readmeFilename":"README.zh.md","_rev":"1-ed1f041192212b9ec0b764d0e82dd6a0"}