@deepseek-ai/dsh-session-title-first-prompt-llm 0.2.0-rc.2 → 0.2.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +18 -18
- package/README.md +10 -12
- package/README.zh.md +10 -12
- package/lib/index.js +91 -8
- package/lib/types/index.d.ts +9 -4
- package/package.json +20 -18
package/README.i18n.yaml
CHANGED
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
en: c93e663d382f0ca7
|
|
10
10
|
zh: ddbea0a6b61ddb72
|
|
11
11
|
/deepseek-ai-dsh-session-title-first-prompt-llm/summary:
|
|
12
|
-
en:
|
|
13
|
-
zh:
|
|
12
|
+
en: f285f80e499c78e7
|
|
13
|
+
zh: 4001261b52131d29
|
|
14
14
|
/deepseek-ai-dsh-session-title-first-prompt-llm/table-of-contents:
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
|
17
17
|
/deepseek-ai-dsh-session-title-first-prompt-llm/use-this-package:
|
|
18
|
-
en:
|
|
19
|
-
zh:
|
|
18
|
+
en: 2e60e0b77b5f4813
|
|
19
|
+
zh: 0523c0af3a78f67a
|
|
20
20
|
/deepseek-ai-dsh-session-title-first-prompt-llm/use-this-package/when-titles-are-generated:
|
|
21
21
|
en: 3215179477572a94
|
|
22
22
|
zh: 54bf9a139aeafa44
|
|
23
23
|
/deepseek-ai-dsh-session-title-first-prompt-llm/use-this-package/configuration:
|
|
24
|
-
en:
|
|
25
|
-
zh:
|
|
24
|
+
en: 623d02888bda633e
|
|
25
|
+
zh: 969f25b04c20995c
|
|
26
26
|
/deepseek-ai-dsh-session-title-first-prompt-llm/use-this-package/failures-and-recovery:
|
|
27
27
|
en: 9e5b1bd0b388b87d
|
|
28
28
|
zh: 7b1d07e48d4267ca
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
en: 506933ffa7745b7d
|
|
31
31
|
zh: a9bb6f06a32b7c18
|
|
32
32
|
/deepseek-ai-dsh-session-title-first-prompt-llm/understand-the-implementation/design-concept:
|
|
33
|
-
en:
|
|
34
|
-
zh:
|
|
33
|
+
en: dc7b69fcfd3a5538
|
|
34
|
+
zh: 57cbc803f2938cc0
|
|
35
35
|
/deepseek-ai-dsh-session-title-first-prompt-llm/understand-the-implementation/source-map:
|
|
36
|
-
en:
|
|
37
|
-
zh:
|
|
36
|
+
en: 7daf8c1232bc702d
|
|
37
|
+
zh: 4b4147eb8994e325
|
|
38
38
|
/deepseek-ai-dsh-session-title-first-prompt-llm/understand-the-implementation/scheduling:
|
|
39
39
|
en: a79488f550380f5e
|
|
40
40
|
zh: 0ca8a457084c0fca
|
|
41
41
|
/deepseek-ai-dsh-session-title-first-prompt-llm/further-exploration:
|
|
42
|
-
en:
|
|
43
|
-
zh:
|
|
42
|
+
en: 5a8cd304162c6fd1
|
|
43
|
+
zh: 7a8008989d8a0de8
|
|
44
44
|
/deepseek-ai-dsh-session-title-first-prompt-llm/model-experience:
|
|
45
45
|
en: 215e7ba838619b7b
|
|
46
46
|
zh: a311da3843709f90
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
en: b216200be66e9ec4
|
|
49
49
|
zh: 6805c5bfb9c55091
|
|
50
50
|
/deepseek-ai-dsh-session-title-first-prompt-llm/model-experience/first-message-title-request/what-the-model-sees:
|
|
51
|
-
en:
|
|
52
|
-
zh:
|
|
51
|
+
en: 54d7319253bad069
|
|
52
|
+
zh: 48fe072d55271912
|
|
53
53
|
/deepseek-ai-dsh-session-title-first-prompt-llm/model-experience/first-message-title-request/token-effect:
|
|
54
|
-
en:
|
|
55
|
-
zh:
|
|
54
|
+
en: e4640d9fe3e33875
|
|
55
|
+
zh: fd22d9196a32aa69
|
|
56
56
|
/deepseek-ai-dsh-session-title-first-prompt-llm/model-experience/first-message-title-request/kv-cache-effect:
|
|
57
57
|
en: 22c407527c295def
|
|
58
58
|
zh: c7e35aa298fe6b5f
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
en: 7df1fa6515924136
|
|
61
61
|
zh: 39535dca0c9fe9ab
|
|
62
62
|
/deepseek-ai-dsh-session-title-first-prompt-llm/known-limitations-and-deferred-work/dev-note:
|
|
63
|
-
en:
|
|
64
|
-
zh:
|
|
63
|
+
en: e67f633dc6fe7773
|
|
64
|
+
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
`dsh-session-title-first-prompt-llm` summarizes the first eligible human message through `ctx.llm` as an optional `ctx.sessionTitle` provider. It registers the `first-prompt` cadence, runs automatically only when a fresh non-fork session first creates its fallback, and attributes the result to that message's exact seq. An automatic failure retains the fallback and is retried only through `ctx.sessionTitle.refresh()`.
|
|
12
|
+
`dsh-session-title-first-prompt-llm` summarizes the first eligible human message through `ctx.llm` as an optional `ctx.sessionTitle` provider. It registers the `first-prompt` cadence, runs automatically only when a fresh non-fork session first creates its fallback, and attributes the result to that message's exact seq. An automatic failure retains the fallback and is retried only through `ctx.sessionTitle.refresh()`. The plugin owns its system instruction, JSON framing, and output parsing; it shares only the [execution module](../session-title-llm/README.md) from `dsh-session-title-llm` with the all-prompts provider. Automatic behavior and configuration come first; the implementation is a small provider strategy over that executor.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ English | [中文](README.zh.md)
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## Use this package
|
|
27
27
|
|
|
28
|
-
Mount this plugin beside the title service when a session should be titled from its first eligible human message. It requires the
|
|
28
|
+
Mount this plugin beside the title service when a session should be titled from its first eligible human message. It requires its own `targetWords` and `targetCjkCharacters` plus the shared [execution controls](../session-title-llm/README.md#configuration), all with no defaults.
|
|
29
29
|
|
|
30
30
|
### When titles are generated
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ Automatic generation runs only for a fresh session with no parent and no prior t
|
|
|
33
33
|
|
|
34
34
|
### Configuration
|
|
35
35
|
|
|
36
|
-
The plugin
|
|
36
|
+
The plugin requires `targetWords` and `targetCjkCharacters` plus the shared [execution controls](../session-title-llm/README.md#configuration): `maxInputBytes`, `maxOutputTokens`, `timeoutMs`, and the optional paired `provider`/`model` route. Omit both to inherit the exact route from the current logged main request, or set both to route title generation independently. The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-session-title-first-prompt-llm) is the exhaustive source for every accepted field.
|
|
37
37
|
|
|
38
38
|
### Failures and recovery
|
|
39
39
|
|
|
@@ -51,13 +51,13 @@ This section explains the plugin's shape; the observable behavior is fully cover
|
|
|
51
51
|
|
|
52
52
|
### Design concept
|
|
53
53
|
|
|
54
|
-
A
|
|
54
|
+
A small provider strategy: it builds the first-message system instruction and JSON input, parses the assembled response into a title, and delegates only route, bounds, cancellation, logging, and assembly to the [shared execution module](../session-title-llm/README.md).
|
|
55
55
|
|
|
56
56
|
### Source map
|
|
57
57
|
|
|
58
58
|
| File | Role |
|
|
59
59
|
|---|---|
|
|
60
|
-
| [`src/index.ts`](src/index.ts) | Plugin entry:
|
|
60
|
+
| [`src/index.ts`](src/index.ts) | Plugin entry: config schema, first-message prompt and framing, output parsing, and direct provider registration |
|
|
61
61
|
|
|
62
62
|
### Scheduling
|
|
63
63
|
|
|
@@ -70,10 +70,10 @@ The title service schedules automatic work: for the `first-prompt` cadence it st
|
|
|
70
70
|
<a id="further-exploration"></a>
|
|
71
71
|
## Further Exploration
|
|
72
72
|
|
|
73
|
-
Read these pages when the provider contract is not enough. They move from the shared
|
|
73
|
+
Read these pages when the provider contract is not enough. They move from the shared execution module to the alternative cadence and the service it plugs into.
|
|
74
74
|
|
|
75
|
-
- [Shared LLM
|
|
76
|
-
- [All-messages title provider](
|
|
75
|
+
- [Shared LLM execution module](../session-title-llm/README.md) — the execution module this provider uses.
|
|
76
|
+
- [All-messages title provider](../../experimental/session-title-all-prompts-llm/README.md) — the cadence that retitles after every new prompt.
|
|
77
77
|
- [Session title service](../session-title/README.md) — fallback behavior, rename, refresh, and provider registration.
|
|
78
78
|
- [Session package map](../README.md) — adjacent persistence, projection, title, and telemetry packages.
|
|
79
79
|
|
|
@@ -86,11 +86,11 @@ Read these pages when the provider contract is not enough. They move from the sh
|
|
|
86
86
|
|
|
87
87
|
#### What the model sees
|
|
88
88
|
|
|
89
|
-
The title model receives
|
|
89
|
+
The title model receives this provider's title instruction and a JSON array containing only the first eligible human message; it never receives a `currentTitle`. Later prompts and inherited fork history do not trigger another automatic call.
|
|
90
90
|
|
|
91
91
|
#### Token effect
|
|
92
92
|
|
|
93
|
-
At most one automatic auxiliary request is made for a fresh session, bounded by `maxInputBytes` and `maxOutputTokens`; explicit refreshes may make additional calls. The main agent request gains zero tokens.
|
|
93
|
+
At most one automatic auxiliary request is made for a fresh session, bounded by `maxInputBytes` and `maxOutputTokens`; explicit refreshes may make additional calls. It selects the route's least supported reasoning effort, or leaves effort unspecified when the route exposes none. The main agent request gains zero tokens.
|
|
94
94
|
|
|
95
95
|
#### KV Cache effect
|
|
96
96
|
|
|
@@ -115,5 +115,3 @@ These limits define when this provider stops representing the session. They are
|
|
|
115
115
|
None.
|
|
116
116
|
|
|
117
117
|
</details>
|
|
118
|
-
|
|
119
|
-
**Runtime invariant:** No companion is published. This thin provider delegates request and result validation to the shared title service and LLM helper and retains no independent mutable state.
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
`dsh-session-title-first-prompt-llm` 作为可选的 `ctx.sessionTitle` 提供方,通过 `ctx.llm` 总结第一条符合条件的用户消息。它注册 `first-prompt` 节奏,只在全新非 fork 会话首次创建回退时自动运行,并把结果归因于该消息的确切 seq。自动失败会保留回退,之后只能通过 `ctx.sessionTitle.refresh()`
|
|
12
|
+
`dsh-session-title-first-prompt-llm` 作为可选的 `ctx.sessionTitle` 提供方,通过 `ctx.llm` 总结第一条符合条件的用户消息。它注册 `first-prompt` 节奏,只在全新非 fork 会话首次创建回退时自动运行,并把结果归因于该消息的确切 seq。自动失败会保留回退,之后只能通过 `ctx.sessionTitle.refresh()` 重试。它拥有自己的系统指令、JSON 封装与输出解析;只与全消息提供方共享 `dsh-session-title-llm` 的[执行模块](../session-title-llm/README.zh.md)。自动行为与配置优先;实现是建立在该执行器之上的小型提供方策略。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ kind: "package-reference"
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## 使用本包
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
当会话应从第一条符合条件用户消息生成标题时,在标题服务旁挂载此插件。它要求自己的 `targetWords` 与 `targetCjkCharacters`,外加共享的[执行控制](../session-title-llm/README.zh.md#configuration),且全部无默认值。
|
|
29
29
|
|
|
30
30
|
### 标题生成时机
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ kind: "package-reference"
|
|
|
33
33
|
|
|
34
34
|
### 配置
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
插件要求 `targetWords` 与 `targetCjkCharacters`,外加共享的[执行控制](../session-title-llm/README.zh.md#configuration):`maxInputBytes`、`maxOutputTokens`、`timeoutMs`,以及可选成对的 `provider`/`model` 路由。同时省略二者,会继承当前已记录主请求的确切路由;同时设置二者,则让标题生成使用独立路由。生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-session-title-first-prompt-llm)是每个受支持字段的穷尽式真源。
|
|
37
37
|
|
|
38
38
|
### 失败与恢复
|
|
39
39
|
|
|
@@ -51,13 +51,13 @@ kind: "package-reference"
|
|
|
51
51
|
|
|
52
52
|
### 设计理念
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
一个小型提供方策略:它构建首消息系统指令与 JSON 输入,把组装后的响应解析为标题,只把路由、上限、取消、记录与组装委托给[共享执行模块](../session-title-llm/README.zh.md)。
|
|
55
55
|
|
|
56
56
|
### 源码地图
|
|
57
57
|
|
|
58
58
|
| 文件 | 职责 |
|
|
59
59
|
|---|---|
|
|
60
|
-
| [`src/index.ts`](src/index.ts) |
|
|
60
|
+
| [`src/index.ts`](src/index.ts) | 插件入口:配置 schema、首消息提示词与封装、输出解析与直接提供方注册 |
|
|
61
61
|
|
|
62
62
|
### 调度
|
|
63
63
|
|
|
@@ -70,10 +70,10 @@ kind: "package-reference"
|
|
|
70
70
|
<a id="further-exploration"></a>
|
|
71
71
|
## 进一步探索
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
当提供方约定不够用时阅读以下页面。它们从共享执行模块逐步进入替代节奏与它所插入的服务。
|
|
74
74
|
|
|
75
|
-
- [共享 LLM
|
|
76
|
-
- [全消息标题提供方](
|
|
75
|
+
- [共享 LLM 执行模块](../session-title-llm/README.zh.md)——此提供方使用的执行模块。
|
|
76
|
+
- [全消息标题提供方](../../experimental/session-title-all-prompts-llm/README.zh.md)——在每条新提示词后重新生成标题的节奏。
|
|
77
77
|
- [会话标题服务](../session-title/README.zh.md)——回退行为、重命名、刷新与提供方注册。
|
|
78
78
|
- [会话包映射](../README.zh.md)——相邻的持久化、投影、标题与遥测包。
|
|
79
79
|
|
|
@@ -86,11 +86,11 @@ kind: "package-reference"
|
|
|
86
86
|
|
|
87
87
|
#### 模型看到什么
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
标题模型会收到此提供方的标题指令,以及一个只包含第一条符合条件用户消息的 JSON 数组,永远不会收到 `currentTitle`。后续提示词与继承的 fork 历史不会触发再次自动调用。
|
|
90
90
|
|
|
91
91
|
#### Token 影响
|
|
92
92
|
|
|
93
|
-
全新会话最多自动发出一次辅助请求,并受 `maxInputBytes` 与 `maxOutputTokens`
|
|
93
|
+
全新会话最多自动发出一次辅助请求,并受 `maxInputBytes` 与 `maxOutputTokens` 约束;显式刷新可能发出额外调用。它选择路由支持的最低推理强度;路由没有可选强度时不指定。主 agent 请求不会增加 token。
|
|
94
94
|
|
|
95
95
|
#### KV Cache 影响
|
|
96
96
|
|
|
@@ -115,5 +115,3 @@ kind: "package-reference"
|
|
|
115
115
|
无。
|
|
116
116
|
|
|
117
117
|
</details>
|
|
118
|
-
|
|
119
|
-
**运行时不变式:** 不发布伴生入口。这个轻量提供方将请求与结果校验委托给共享标题服务和 LLM 辅助模块,不保留独立的可变状态。
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import {
|
|
2
|
+
import { assertNever } from "@deepseek-ai/dsh-util-values";
|
|
3
|
+
import { SessionTitleProviderId, normalizeSessionTitle } from "@deepseek-ai/dsh-session-title";
|
|
4
|
+
import { SessionTitleLlmConfigFields, executeSessionTitleLlm, resolveSessionTitleLlmConfig } from "@deepseek-ai/dsh-session-title-llm";
|
|
3
5
|
//#region lib/types/index.js
|
|
4
6
|
/** First-human-message model provider for `ctx.sessionTitle`. */
|
|
5
7
|
const name = "session-title-first-prompt-llm";
|
|
@@ -8,26 +10,107 @@ const inject = [
|
|
|
8
10
|
"llm",
|
|
9
11
|
"sessions"
|
|
10
12
|
];
|
|
11
|
-
/** Loader schema
|
|
13
|
+
/** Loader schema for this provider's required execution controls and title-length targets. */
|
|
12
14
|
const Config = z.object({
|
|
13
|
-
targetWords:
|
|
14
|
-
targetCjkCharacters:
|
|
15
|
+
targetWords: z.number().step(1).min(1).required(),
|
|
16
|
+
targetCjkCharacters: z.number().step(1).min(1).required(),
|
|
15
17
|
maxInputBytes: SessionTitleLlmConfigFields.maxInputBytes,
|
|
16
18
|
maxOutputTokens: SessionTitleLlmConfigFields.maxOutputTokens,
|
|
17
19
|
timeoutMs: SessionTitleLlmConfigFields.timeoutMs,
|
|
18
20
|
provider: SessionTitleLlmConfigFields.provider,
|
|
19
21
|
model: SessionTitleLlmConfigFields.model
|
|
20
22
|
});
|
|
23
|
+
/** Validate one positive title-length target. */
|
|
24
|
+
function assertTarget(name, value) {
|
|
25
|
+
if (!Number.isInteger(value) || value <= 0) throw new Error(`session-title-first-prompt-llm: ${name} must be a positive integer`);
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validate the shared execution controls and this provider's title-length targets.
|
|
30
|
+
* @param config - untrusted plugin configuration.
|
|
31
|
+
* @returns immutable provider policy.
|
|
32
|
+
*/
|
|
33
|
+
function resolveConfig(config) {
|
|
34
|
+
const { targetWords, targetCjkCharacters, ...execution } = config;
|
|
35
|
+
return {
|
|
36
|
+
...resolveSessionTitleLlmConfig(execution),
|
|
37
|
+
targetWords: assertTarget("targetWords", targetWords),
|
|
38
|
+
targetCjkCharacters: assertTarget("targetCjkCharacters", targetCjkCharacters)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Select the route's least supported reasoning effort for a title call. */
|
|
42
|
+
const selectReasoningEffort = (model) => model.reasoning?.efforts[0]?.id;
|
|
43
|
+
/** Language-aware system instruction for a title derived from one message. */
|
|
44
|
+
function systemPrompt(config) {
|
|
45
|
+
return [
|
|
46
|
+
"Create a concise title for an AI coding-assistant session from the supplied human messages.",
|
|
47
|
+
"Return only the title on one line, **in plain text of natural language**, with no quotes, prefix, explanation, Markdown, XML, or terminal control codes. No code is allowed.",
|
|
48
|
+
"Use the language of the messages.",
|
|
49
|
+
`Aim for about ${config.targetWords} words in non-CJK languages or ${config.targetCjkCharacters} CJK characters.`,
|
|
50
|
+
"If the messages give little to name, still return a short best-effort title, such as Greeting, instead of explaining."
|
|
51
|
+
].join("\n");
|
|
52
|
+
}
|
|
53
|
+
/** Frame the selected messages as JSON so user text cannot break structural delimiters. */
|
|
54
|
+
function frameMessages(messages) {
|
|
55
|
+
return `Generate the session title from this JSON array of human messages:\n${JSON.stringify(messages)}`;
|
|
56
|
+
}
|
|
57
|
+
/** Asterisk emphasis wrapping a whole line, such as `**Title**`. */
|
|
58
|
+
const EMPHASIS_WRAPPER = /^(?<marker>\*{1,3})(?<inner>\S(?:.*\S)?)\k<marker>$/u;
|
|
59
|
+
/**
|
|
60
|
+
* Take the title from model output: the first non-empty line, without
|
|
61
|
+
* asterisk emphasis that wraps that whole line. Models that disregard the
|
|
62
|
+
* one-line instruction put the title first and commentary after it. A line
|
|
63
|
+
* that is entirely `*` emphasis loses the marker pair even when the model
|
|
64
|
+
* meant it literally; the inner-marker check keeps emphasis inside a longer
|
|
65
|
+
* line, and the system instruction forbids Markdown.
|
|
66
|
+
*/
|
|
67
|
+
function titleFromOutput(text) {
|
|
68
|
+
const line = text.split(/\r?\n/u).map((item) => item.trim()).find((item) => item.length > 0) ?? "";
|
|
69
|
+
const groups = EMPHASIS_WRAPPER.exec(line)?.groups;
|
|
70
|
+
const marker = groups?.["marker"];
|
|
71
|
+
const inner = groups?.["inner"];
|
|
72
|
+
return marker === void 0 || inner === void 0 || inner.includes(marker) ? line : inner;
|
|
73
|
+
}
|
|
74
|
+
/** Reject terminal tool-call or max-token outcomes and derive one non-empty title from the text blocks. */
|
|
75
|
+
function titleFromResponse(response) {
|
|
76
|
+
switch (response.finish.kind) {
|
|
77
|
+
case "stop": break;
|
|
78
|
+
case "tool-calls": throw new Error("session-title-llm: title output must contain text only");
|
|
79
|
+
case "max-tokens": throw new Error("session-title-llm: title output reached maxOutputTokens");
|
|
80
|
+
/* v8 ignore next -- closed SessionTitleLlmFinish union exhaustiveness guard */
|
|
81
|
+
default: return assertNever(response.finish, "SessionTitleLlmFinish");
|
|
82
|
+
}
|
|
83
|
+
if (response.blocks.some((block) => block.type === "tool-call")) throw new Error("session-title-llm: title output must contain text only");
|
|
84
|
+
const title = normalizeSessionTitle(titleFromOutput(response.blocks.filter((block) => block.type === "text").map((block) => block.text).join(" ")), Number.MAX_SAFE_INTEGER);
|
|
85
|
+
if (title.length === 0) throw new Error("session-title-llm: title model produced no text");
|
|
86
|
+
return title;
|
|
87
|
+
}
|
|
21
88
|
/**
|
|
22
89
|
* Register the first-prompt model provider.
|
|
23
90
|
* @param ctx - context exposing session-title, LLM, and session services.
|
|
24
91
|
* @param config - required route, target, byte, token, and timeout policy.
|
|
25
92
|
*/
|
|
26
93
|
function apply(ctx, config) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
94
|
+
const resolved = resolveConfig(config);
|
|
95
|
+
const titleProvider = SessionTitleProviderId(name);
|
|
96
|
+
ctx.sessionTitle.register({
|
|
97
|
+
id: titleProvider,
|
|
98
|
+
automatic: "first-prompt",
|
|
99
|
+
async generate(request) {
|
|
100
|
+
const first = request.messages[0];
|
|
101
|
+
if (first === void 0) throw new Error("first-prompt title provider requires one human message");
|
|
102
|
+
const response = await executeSessionTitleLlm(ctx, resolved, request, titleProvider, {
|
|
103
|
+
system: systemPrompt(resolved),
|
|
104
|
+
input: frameMessages([first]),
|
|
105
|
+
messageSeqs: [first.seq],
|
|
106
|
+
selectReasoningEffort
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
title: titleFromResponse(response),
|
|
110
|
+
messageSeqs: [first.seq],
|
|
111
|
+
model: response.model
|
|
112
|
+
};
|
|
113
|
+
}
|
|
31
114
|
});
|
|
32
115
|
}
|
|
33
116
|
//#endregion
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/** First-human-message model provider for `ctx.sessionTitle`. */
|
|
2
2
|
import type { Context } from '@deepseek-ai/cordis';
|
|
3
3
|
import z from '@deepseek-ai/schemastery';
|
|
4
|
-
import type
|
|
4
|
+
import { type SessionTitleLlmConfig } from '@deepseek-ai/dsh-session-title-llm';
|
|
5
5
|
export declare const name = "session-title-first-prompt-llm";
|
|
6
6
|
export declare const inject: string[];
|
|
7
|
-
/** Required
|
|
8
|
-
export
|
|
9
|
-
/**
|
|
7
|
+
/** Required execution controls plus this provider's title-length targets; no defaults. */
|
|
8
|
+
export interface Config extends SessionTitleLlmConfig {
|
|
9
|
+
/** Target word count for non-CJK titles. */
|
|
10
|
+
readonly targetWords: number;
|
|
11
|
+
/** Target character count for Chinese, Japanese, or Korean titles. */
|
|
12
|
+
readonly targetCjkCharacters: number;
|
|
13
|
+
}
|
|
14
|
+
/** Loader schema for this provider's required execution controls and title-length targets. */
|
|
10
15
|
export declare const Config: z<Config>;
|
|
11
16
|
/**
|
|
12
17
|
* Register the first-prompt model provider.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session-title-first-prompt-llm",
|
|
3
3
|
"description": "First-message LLM provider plugin for DeepSeek Harness session titles",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -26,26 +26,28 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
30
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
31
|
-
"@deepseek-ai/dsh-session-title": "0.2.
|
|
32
|
-
"@deepseek-ai/
|
|
33
|
-
"@deepseek-ai/
|
|
29
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
|
|
30
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.2",
|
|
31
|
+
"@deepseek-ai/dsh-session-title": "0.2.1-alpha.2",
|
|
32
|
+
"@deepseek-ai/dsh-session-title-llm": "0.2.1-alpha.2",
|
|
33
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@deepseek-ai/
|
|
36
|
+
"@deepseek-ai/dsh-util-values": "0.2.1-alpha.2",
|
|
37
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.1"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@deepseek-ai/cordis-plugin-include": "~1.0.
|
|
40
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0.
|
|
41
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
42
|
-
"@deepseek-ai/dsh-llm-deepseek": "0.2.
|
|
43
|
-
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/dsh-session
|
|
46
|
-
"@deepseek-ai/dsh-session-title
|
|
47
|
-
"@deepseek-ai/
|
|
48
|
-
"@deepseek-ai/
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
40
|
+
"@deepseek-ai/cordis-plugin-include": "~1.0.10-alpha.1",
|
|
41
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.1",
|
|
42
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-llm-deepseek": "0.2.1-alpha.2",
|
|
44
|
+
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.1-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.2",
|
|
47
|
+
"@deepseek-ai/dsh-session-title": "0.2.1-alpha.2",
|
|
48
|
+
"@deepseek-ai/dsh-session-title-llm": "0.2.1-alpha.2",
|
|
49
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
50
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.2",
|
|
51
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.2"
|
|
50
52
|
}
|
|
51
53
|
}
|