dsh-switchman 1.3.0
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/LICENSE +21 -0
- package/README.md +79 -0
- package/README.zh.md +79 -0
- package/client.js +2441 -0
- package/cordis.patch.yml +599 -0
- package/host/config.js +116 -0
- package/host/context-watch.js +620 -0
- package/host/data/capability-default.json +1097 -0
- package/host/dispatch.js +205 -0
- package/host/lang.js +182 -0
- package/host/lib/rank.js +187 -0
- package/host/routes.js +398 -0
- package/icon.svg +7 -0
- package/index.js +154 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +70 -0
- package/skills/db-query/SKILL.md +322 -0
- package/skills/db-query/package-lock.json +251 -0
- package/skills/db-query/package.json +20 -0
- package/skills/db-query/references/mysql.md +137 -0
- package/skills/db-query/references/redis.md +213 -0
- package/skills/db-query/references/security.md +176 -0
- package/skills/db-query/scripts/lib/cli.js +118 -0
- package/skills/db-query/scripts/lib/config.js +215 -0
- package/skills/db-query/scripts/lib/mysql-readonly.js +655 -0
- package/skills/db-query/scripts/lib/output.js +322 -0
- package/skills/db-query/scripts/lib/redis-readonly.js +362 -0
- package/skills/db-query/scripts/mysql-query.js +198 -0
- package/skills/db-query/scripts/redis-query.js +181 -0
- package/skills/db-query/scripts/setup.sh +51 -0
- package/skills/git-commit-message/SKILL.md +49 -0
- package/skills/requirement-docs/SKILL.md +38 -0
- package/skills/requirement-docs/references/templates.md +187 -0
package/host/config.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** dsh-switchman host-side configuration schema.
|
|
2
|
+
*
|
|
3
|
+
* One flat set of `.volatile()` fields so every value is individually editable
|
|
4
|
+
* through the DSH settings system (`ctx.settings` forms keyed by this plugin's
|
|
5
|
+
* `name` export, persisted into the profile's cordis.patch.yml row) and is a
|
|
6
|
+
* live reference on the host side (`config.<field>.get()` re-reads without a
|
|
7
|
+
* plugin restart). Flat names keep settings-mutation paths single-segment,
|
|
8
|
+
* which the hand-written settings page relies on.
|
|
9
|
+
*
|
|
10
|
+
* Groups:
|
|
11
|
+
* - lang* project language preference (Phase 1)
|
|
12
|
+
* - pool/rank dispatch pools and capability ranking (Phase 2)
|
|
13
|
+
* - wm* context watermark control (Phase 3)
|
|
14
|
+
*
|
|
15
|
+
* Ported from opencode-switchman's opencode-switchman.jsonc surface
|
|
16
|
+
* (oc/src/config.ts:23-51, oc/src/types.ts:281-344) onto DSH settings.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import z from "@deepseek-ai/schemastery";
|
|
20
|
+
|
|
21
|
+
/** One addressable provider/model route (same shape the platform uses). */
|
|
22
|
+
export const ModelRouteSchema = z.object({
|
|
23
|
+
provider: z.string().min(1).required(),
|
|
24
|
+
model: z.string().min(1).required(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** One rank entry: a route plus the optional anchored capability tier.
|
|
28
|
+
* (String enums are `z.union([...])` here — the shipped schemastery 3.18.4
|
|
29
|
+
* build has no `z.enum`; same idiom as dsh-tool-ask-user's Config.) */
|
|
30
|
+
export const RankEntrySchema = z.object({
|
|
31
|
+
provider: z.string().min(1).required(),
|
|
32
|
+
model: z.string().min(1).required(),
|
|
33
|
+
tier: z.union(["S", "A", "B", "C"]),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/** One per-model effort pin: a route plus the reasoning effort to use when
|
|
37
|
+
* dispatching that model (overrides the lane's default effort). The value
|
|
38
|
+
* is free-form on purpose — the valid set is whatever the DSH adapter for
|
|
39
|
+
* that model reports (low/medium/high, off, …). */
|
|
40
|
+
export const EffortEntrySchema = z.object({
|
|
41
|
+
provider: z.string().min(1).required(),
|
|
42
|
+
model: z.string().min(1).required(),
|
|
43
|
+
effort: z.string().min(1).required(),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/** All dsh-switchman settings. Field names are the settings mutation paths. */
|
|
47
|
+
export const Config = z.object({
|
|
48
|
+
// --- Phase 1: project language preference -----------------------------
|
|
49
|
+
/** Language for conversational replies. Empty = ask once, then remember. */
|
|
50
|
+
langConversation: z.string().default("").volatile(),
|
|
51
|
+
/** Language for code comments. Empty = follow langConversation. */
|
|
52
|
+
langComments: z.string().default("").volatile(),
|
|
53
|
+
/** Language for documents the agent authors. Empty = follow langConversation. */
|
|
54
|
+
langDocs: z.string().default("").volatile(),
|
|
55
|
+
|
|
56
|
+
// --- Phase 2: dispatch pools & model ranking ---------------------------
|
|
57
|
+
/** Candidate routes per cognitive lane. Empty lane = system default. */
|
|
58
|
+
poolEconomy: z.array(ModelRouteSchema).default([]).volatile(),
|
|
59
|
+
poolMechanical: z.array(ModelRouteSchema).default([]).volatile(),
|
|
60
|
+
poolMain: z.array(ModelRouteSchema).default([]).volatile(),
|
|
61
|
+
poolHard: z.array(ModelRouteSchema).default([]).volatile(),
|
|
62
|
+
poolVision: z.array(ModelRouteSchema).default([]).volatile(),
|
|
63
|
+
poolReview: z.array(ModelRouteSchema).default([]).volatile(),
|
|
64
|
+
/** Per-lane manual ordering: true = the lane's stored array order IS the
|
|
65
|
+
* dispatch priority (host skips the capability/modelRank re-sort); false
|
|
66
|
+
* = auto ordering (modelRank anchors first, then capability score). */
|
|
67
|
+
poolEconomyManual: z.boolean().default(false).volatile(),
|
|
68
|
+
poolMechanicalManual: z.boolean().default(false).volatile(),
|
|
69
|
+
poolMainManual: z.boolean().default(false).volatile(),
|
|
70
|
+
poolHardManual: z.boolean().default(false).volatile(),
|
|
71
|
+
poolVisionManual: z.boolean().default(false).volatile(),
|
|
72
|
+
poolReviewManual: z.boolean().default(false).volatile(),
|
|
73
|
+
/** Per-lane manually pinned reasoning efforts: one {provider, model,
|
|
74
|
+
* effort} entry per route the user pinned; routes without an entry use
|
|
75
|
+
* the lane's default effort. */
|
|
76
|
+
poolEconomyEfforts: z.array(EffortEntrySchema).default([]).volatile(),
|
|
77
|
+
poolMechanicalEfforts: z.array(EffortEntrySchema).default([]).volatile(),
|
|
78
|
+
poolMainEfforts: z.array(EffortEntrySchema).default([]).volatile(),
|
|
79
|
+
poolHardEfforts: z.array(EffortEntrySchema).default([]).volatile(),
|
|
80
|
+
poolVisionEfforts: z.array(EffortEntrySchema).default([]).volatile(),
|
|
81
|
+
poolReviewEfforts: z.array(EffortEntrySchema).default([]).volatile(),
|
|
82
|
+
/** Capability ranking, strongest first; manual order overrides defaults. */
|
|
83
|
+
modelRank: z.array(RankEntrySchema).default([]).volatile(),
|
|
84
|
+
/** How pool guidance is enforced on delegation tools. */
|
|
85
|
+
dispatchEnforce: z.union(["off", "advice", "enforce"]).default("advice").volatile(),
|
|
86
|
+
|
|
87
|
+
// --- Phase 3: context watermark control --------------------------------
|
|
88
|
+
/** Soft watermark: advisory banner + delegation nudge (tokens). */
|
|
89
|
+
wmSoftTokens: z.number().min(1000).default(50000).volatile(),
|
|
90
|
+
/** Hard watermark: read budget tightens, wrap-up advised (tokens). */
|
|
91
|
+
wmHardTokens: z.number().min(2000).default(90000).volatile(),
|
|
92
|
+
/** Force watermark: backup + compaction handover (tokens). */
|
|
93
|
+
wmForceTokens: z.number().min(3000).default(130000).volatile(),
|
|
94
|
+
/** Per-call read budget for read/glob/grep (tokens). */
|
|
95
|
+
wmReadBudgetTokens: z.number().min(200).default(1500).volatile(),
|
|
96
|
+
/** Hard-tier behavior: cap reads and advise, or deny outright. */
|
|
97
|
+
wmDenyMode: z.union(["cap", "deny"]).default("cap").volatile(),
|
|
98
|
+
/** Force tier triggers backup + compaction automatically. */
|
|
99
|
+
wmAutoHandover: z.boolean().default(true).volatile(),
|
|
100
|
+
/** Cap subagent contexts at wmSubagentForceTokens. */
|
|
101
|
+
wmSubagentCap: z.boolean().default(true).volatile(),
|
|
102
|
+
/** Subagent hard cap; 0 = share wmForceTokens. */
|
|
103
|
+
wmSubagentForceTokens: z.number().min(0).default(0).volatile(),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/** The six dispatch lanes, in display order. */
|
|
107
|
+
export const LANES = ["economy", "mechanical", "main", "hard", "vision", "review"];
|
|
108
|
+
|
|
109
|
+
/** Settings field name for one lane. */
|
|
110
|
+
export const laneField = (lane) => `pool${lane[0].toUpperCase()}${lane.slice(1)}`;
|
|
111
|
+
|
|
112
|
+
/** Manual-order flag field name for one lane. */
|
|
113
|
+
export const laneManualField = (lane) => `${laneField(lane)}Manual`;
|
|
114
|
+
|
|
115
|
+
/** Per-model effort-pin list field name for one lane. */
|
|
116
|
+
export const laneEffortsField = (lane) => `${laneField(lane)}Efforts`;
|