dsh-auto-effort 0.1.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-auto-effort",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Per-turn reasoning effort picker for DeepSeek Harness: judges the newest user message with one lightweight LLM call and selects off/low/high/max for that same turn.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,7 +9,9 @@
9
9
  "deepseek-harness",
10
10
  "dsh-bundle",
11
11
  "reasoning-effort",
12
- "thinking"
12
+ "thinking",
13
+ "自动推理",
14
+ "推理等级"
13
15
  ],
14
16
  "engines": {
15
17
  "node": ">=20"
@@ -17,14 +19,23 @@
17
19
  "publishConfig": {
18
20
  "access": "public"
19
21
  },
22
+ "scripts": {
23
+ "test": "node test/think-level.mjs && node test/think-level-wiring.mjs"
24
+ },
25
+ "dependencies": {
26
+ "@deepseek-ai/schemastery": "^3.19.0"
27
+ },
20
28
  "exports": {
21
29
  ".": "./index.js",
30
+ "./client": "./client.js",
22
31
  "./icon": "./icon.svg",
23
32
  "./locale/en": "./locale/en.json",
24
33
  "./locale/zh": "./locale/zh.json"
25
34
  },
26
35
  "files": [
27
36
  "index.js",
37
+ "client.js",
38
+ "schema.js",
28
39
  "judge.js",
29
40
  "config.js",
30
41
  "state.js",
@@ -39,6 +50,9 @@
39
50
  "dsh": {
40
51
  "bundle": {
41
52
  "patch": "./cordis.patch.yml"
53
+ },
54
+ "client": {
55
+ "platform": "web"
42
56
  }
43
57
  }
44
58
  }
package/schema.js ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Configuration schema for the plugin page and the composer switch.
3
+ *
4
+ * DSH only exposes a settings namespace for an entry that declares a `Config`
5
+ * schema, and the browser half writes it through `ctx.configForms.get(entryId)`.
6
+ * The host half validates the same fields again in `config.js`, so this schema
7
+ * is the UI-facing description, not the enforcement point.
8
+ */
9
+ import z from '@deepseek-ai/schemastery'
10
+
11
+ /** Four efforts the DeepSeek adapter publishes. */
12
+ const LEVEL = z.union([z.const('off'), z.const('low'), z.const('high'), z.const('max')])
13
+
14
+ export const Config = z.object({
15
+ enabled: z.boolean().default(true).description('开启插件。关闭后插件完全不介入。'),
16
+ mode: z
17
+ .union([z.const('manual'), z.const('auto')])
18
+ .default('manual')
19
+ .volatile()
20
+ .description('manual:插件不介入,完全由你手动选档位;auto:每条消息自动判定档位。'),
21
+ judgeModel: z.string().default('deepseek-flash').description('用来判定档位的模型。'),
22
+ timeoutMs: z.number().default(3000).description('判定超时(毫秒);超时后保持你当前的档位。'),
23
+ levels: z
24
+ .array(LEVEL)
25
+ .default(['off', 'low', 'high', 'max'])
26
+ .description('允许自动判定的档位集合。'),
27
+ defaultLevel: z
28
+ .union([z.const(null), LEVEL])
29
+ .default(null)
30
+ .description('判定失败时使用的档位;null 表示保持你手动选的档位。'),
31
+ logFile: z.string().default(null).description('调试日志路径;留空用默认位置。'),
32
+ requireMaxForUpgrade: z
33
+ .boolean()
34
+ .default(false)
35
+ .description('开启后自动判定最多升到 high,max 只由你手动选择。'),
36
+ escalateAfterSteps: z
37
+ .number()
38
+ .default(3)
39
+ .description('同轮升档:判为 off/low 的回合跑到这一步数后,剩余步骤升到 high;0 表示关闭。'),
40
+ debug: z.boolean().default(false).description('把每条判定写入日志文件,便于排查。'),
41
+ })
package/state.js CHANGED
@@ -39,6 +39,18 @@ export function stateOf(agent, config) {
39
39
  failures: 0,
40
40
  /** judgedTurns value of the last level change; -Infinity allows the first one. */
41
41
  lastChangeTurn: Number.NEGATIVE_INFINITY,
42
+ /** What the judge said for the turn running now (off/low/high/max). */
43
+ judgedLevel: null,
44
+ /** Task card the judge maintains across turns; the only cross-turn context. */
45
+ card: '',
46
+ /** User message of the turn running now, for the background card writer. */
47
+ pendingText: '',
48
+ /** Assistant text collected during the turn running now. */
49
+ pendingAssistant: '',
50
+ /** Route used for the judge calls of this session. */
51
+ judgeRoute: null,
52
+ /** judgedTurns value of the last same-turn escalation, 0 when never. */
53
+ escalatedTurn: 0,
42
54
  }
43
55
  states.set(agent, state)
44
56
  }