@lsfcy/dsh-composer-predictions 0.1.1 → 0.1.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.en.md +1 -1
- package/README.md +1 -1
- package/client.js +2 -2
- package/index.js +26 -4
- package/package.json +1 -1
- package/src/main.js +2 -2
package/README.en.md
CHANGED
|
@@ -37,7 +37,7 @@ dsh plugin --profile desktop add @lsfcy/dsh-composer-predictions
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Restart DSH afterwards. The desktop app uses `desktop`; other entrypoints use their profile under `~/.dsh/profiles`, e.g. `web`. To pin a version without npm:
|
|
40
|
-
`dsh plugin --profile desktop add git+https://github.com/lsfcy/dsh-composer-predictions.git#v0.1.
|
|
40
|
+
`dsh plugin --profile desktop add git+https://github.com/lsfcy/dsh-composer-predictions.git#v0.1.2`.
|
|
41
41
|
|
|
42
42
|
## Config
|
|
43
43
|
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ dsh plugin --profile desktop add @lsfcy/dsh-composer-predictions
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
装完重启 DSH。桌面端 profile 是 `desktop`;其他入口用 `~/.dsh/profiles` 里对应的名字,如 `web`。不想走 npm 时,也可以用固定版本:
|
|
40
|
-
`dsh plugin --profile desktop add git+https://github.com/lsfcy/dsh-composer-predictions.git#v0.1.
|
|
40
|
+
`dsh plugin --profile desktop add git+https://github.com/lsfcy/dsh-composer-predictions.git#v0.1.2`。
|
|
41
41
|
|
|
42
42
|
## 配置
|
|
43
43
|
|
package/client.js
CHANGED
|
@@ -473,7 +473,7 @@ const COPY = {
|
|
|
473
473
|
model: '模型 id',
|
|
474
474
|
modelHint: '留空 = 自动选该 provider 下最便宜的型号。',
|
|
475
475
|
effort: '推理档',
|
|
476
|
-
effortHint: '留空 =
|
|
476
|
+
effortHint: '留空 = 自动选支持的最省一档;模型不支持的档位会自动退到最省档。',
|
|
477
477
|
auto: '自动',
|
|
478
478
|
save: '保存',
|
|
479
479
|
reset: '恢复默认',
|
|
@@ -494,7 +494,7 @@ const COPY = {
|
|
|
494
494
|
model: 'Model id',
|
|
495
495
|
modelHint: 'Empty = the cheapest model on that provider.',
|
|
496
496
|
effort: 'Reasoning effort',
|
|
497
|
-
effortHint: 'Empty = the cheapest effort the model supports.',
|
|
497
|
+
effortHint: 'Empty = the cheapest effort the model supports; an unsupported pinned effort falls back to the cheapest one.',
|
|
498
498
|
auto: 'Auto',
|
|
499
499
|
save: 'Save',
|
|
500
500
|
reset: 'Reset to defaults',
|
package/index.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import z from '@deepseek-ai/schemastery'
|
|
24
24
|
|
|
25
25
|
export const name = 'composer-predictions'
|
|
26
|
-
export const GENERATOR_VERSION = '0.1.
|
|
26
|
+
export const GENERATOR_VERSION = '0.1.2'
|
|
27
27
|
// webServer: the route; sessions: the transcript; llm: the model call.
|
|
28
28
|
export const inject = ['webServer', 'sessions', 'llm']
|
|
29
29
|
|
|
@@ -317,7 +317,7 @@ export async function resolveRoute(llm, config = {}, signal) {
|
|
|
317
317
|
* The cheapest reasoning effort the adapter supports, or undefined when the
|
|
318
318
|
* model does not reason (or cannot be inspected). Explicit config always wins.
|
|
319
319
|
*/
|
|
320
|
-
|
|
320
|
+
async function supportedEfforts(llm, route, signal) {
|
|
321
321
|
if (!llm || typeof llm.resolveModelInfo !== 'function') return undefined
|
|
322
322
|
let info
|
|
323
323
|
try {
|
|
@@ -326,9 +326,31 @@ export async function resolveEffort(llm, route, signal) {
|
|
|
326
326
|
return undefined
|
|
327
327
|
}
|
|
328
328
|
const efforts = info && info.reasoning && Array.isArray(info.reasoning.efforts) ? info.reasoning.efforts : []
|
|
329
|
-
|
|
329
|
+
return efforts
|
|
330
330
|
.map((effort) => (effort && effort.id != null ? String(effort.id) : ''))
|
|
331
331
|
.filter(Boolean)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** The cheapest effort the model advertises, when the adapter can tell us. */
|
|
335
|
+
export async function resolveEffort(llm, route, signal) {
|
|
336
|
+
const ids = await supportedEfforts(llm, route, signal)
|
|
337
|
+
if (!ids) return undefined
|
|
338
|
+
for (const candidate of EFFORT_PREFERENCE) {
|
|
339
|
+
if (ids.includes(candidate)) return candidate
|
|
340
|
+
}
|
|
341
|
+
return undefined
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* A pinned effort is only used when the model advertises it. Otherwise the
|
|
346
|
+
* prediction falls back to the cheapest supported effort: an explicit but
|
|
347
|
+
* unsupported id makes the provider reject the whole call
|
|
348
|
+
* (UNSUPPORTED_REASONING_EFFORT) and the composer would show nothing.
|
|
349
|
+
*/
|
|
350
|
+
export async function chooseEffort(llm, route, signal, requested) {
|
|
351
|
+
const ids = await supportedEfforts(llm, route, signal)
|
|
352
|
+
if (!ids) return undefined
|
|
353
|
+
if (requested && ids.includes(requested)) return requested
|
|
332
354
|
for (const candidate of EFFORT_PREFERENCE) {
|
|
333
355
|
if (ids.includes(candidate)) return candidate
|
|
334
356
|
}
|
|
@@ -541,7 +563,7 @@ export async function predict(ctx, config, sessionId, signal) {
|
|
|
541
563
|
},
|
|
542
564
|
signal,
|
|
543
565
|
)
|
|
544
|
-
const reasoningEffort =
|
|
566
|
+
const reasoningEffort = await chooseEffort(ctx.llm, route, signal, config.reasoningEffort)
|
|
545
567
|
|
|
546
568
|
let raw = ''
|
|
547
569
|
let finish
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lsfcy/dsh-composer-predictions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Codex-style composer predictions for DeepSeek Harness: after a turn settles, the empty composer shows a dimmed suggestion of your next message; Tab accepts it.",
|
package/src/main.js
CHANGED
|
@@ -149,7 +149,7 @@ const COPY = {
|
|
|
149
149
|
model: '模型 id',
|
|
150
150
|
modelHint: '留空 = 自动选该 provider 下最便宜的型号。',
|
|
151
151
|
effort: '推理档',
|
|
152
|
-
effortHint: '留空 =
|
|
152
|
+
effortHint: '留空 = 自动选支持的最省一档;模型不支持的档位会自动退到最省档。',
|
|
153
153
|
auto: '自动',
|
|
154
154
|
save: '保存',
|
|
155
155
|
reset: '恢复默认',
|
|
@@ -170,7 +170,7 @@ const COPY = {
|
|
|
170
170
|
model: 'Model id',
|
|
171
171
|
modelHint: 'Empty = the cheapest model on that provider.',
|
|
172
172
|
effort: 'Reasoning effort',
|
|
173
|
-
effortHint: 'Empty = the cheapest effort the model supports.',
|
|
173
|
+
effortHint: 'Empty = the cheapest effort the model supports; an unsupported pinned effort falls back to the cheapest one.',
|
|
174
174
|
auto: 'Auto',
|
|
175
175
|
save: 'Save',
|
|
176
176
|
reset: 'Reset to defaults',
|