@try-works/dsh-minimal-router 0.0.0-stage → 0.2.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.
@@ -0,0 +1,147 @@
1
+ - insert:
2
+ - id: router
3
+ name: "@try-works/dsh-minimal-router"
4
+ config:
5
+ localSelectionProvider: engine
6
+ policy:
7
+ floorTps: 30
8
+ # Run 24 (DEC-24-03/04): tool-result pruning, OFF until the cap is approved.
9
+ prune:
10
+ mode: off
11
+ maxChars: 20000
12
+ headChars: 10000
13
+ tailChars: 4000
14
+
15
+ # Run 37 · R-37-01 — lean role presets ship WITH the plugin: installing the
16
+ # @dsh-local-router/plugin bundle registers them, no profile hand-edit needed.
17
+ # The advisor reuses the built-in 'ptc' preset (full capability, no cap).
18
+ - insert:
19
+ - id: preset-lean-worker
20
+ name: '@deepseek-ai/dsh-agent-preset'
21
+ config:
22
+ id: lean-worker
23
+ name: Lean worker (PTC)
24
+ description: Lean PTC worker for L2 subagents - run_code plus the 9 core tools with lean instructions.
25
+ order: 10
26
+ plugins:
27
+ - id: persona
28
+ name: '@deepseek-ai/dsh-persona'
29
+ config:
30
+ prefix: You are a coding agent powered by the {{model}} model.
31
+ - id: agent-instructions
32
+ name: '@deepseek-ai/dsh-agent-instructions'
33
+ config:
34
+ maxBytes: 16384
35
+ - id: time-context
36
+ name: '@deepseek-ai/dsh-time-context'
37
+ - id: tool-bash
38
+ name: '@deepseek-ai/dsh-tool-bash'
39
+ disabled: !!js process.platform === 'win32'
40
+ - id: tool-pwsh
41
+ name: '@deepseek-ai/dsh-tool-pwsh'
42
+ disabled: !!js process.platform !== 'win32'
43
+ - id: tool-fs
44
+ name: '@deepseek-ai/dsh-tool-fs'
45
+ config:
46
+ applyPatch: false
47
+ - id: tool-fs-search
48
+ name: '@deepseek-ai/dsh-tool-fs-search'
49
+ config:
50
+ sampleOverCapGlobResults: false
51
+ - id: tool-working-directory
52
+ name: '@deepseek-ai/dsh-tool-working-directory'
53
+ - id: tool-todo
54
+ name: '@deepseek-ai/dsh-tool-todo'
55
+ config:
56
+ allowParallelInProgress: true
57
+ # tool-subagent registers delegation services, so it lives in an isolate
58
+ # group like the built-in ptc preset's 'delegation' row; a bare Service
59
+ # row leaks to the root realm and fails the mount.
60
+ - id: delegation
61
+ name: cordis:group
62
+ group: true
63
+ isolate:
64
+ workflowEngine: true
65
+ config:
66
+ - id: tool-subagent
67
+ name: '@deepseek-ai/dsh-tool-subagent'
68
+ config:
69
+ provider: spawn
70
+ toolName: subagent
71
+ modelSelection: true
72
+ modelDiscovery: true
73
+ - id: compaction
74
+ name: cordis:group
75
+ group: true
76
+ isolate:
77
+ compaction: true
78
+ config:
79
+ - id: compaction-basic
80
+ name: '@deepseek-ai/dsh-compaction-basic'
81
+ - id: tool-executor-ptc
82
+ name: '@deepseek-ai/dsh-tool-executor-ptc'
83
+
84
+ - id: preset-lean-assistant
85
+ name: '@deepseek-ai/dsh-agent-preset'
86
+ config:
87
+ id: lean-assistant
88
+ name: Lean assistant (PTC)
89
+ description: Lean PTC assistant for L3 assistants - run_code plus the 9 core tools with lean instructions.
90
+ order: 11
91
+ plugins:
92
+ - id: persona
93
+ name: '@deepseek-ai/dsh-persona'
94
+ config:
95
+ prefix: You are a coding agent powered by the {{model}} model.
96
+ - id: agent-instructions
97
+ name: '@deepseek-ai/dsh-agent-instructions'
98
+ config:
99
+ maxBytes: 16384
100
+ - id: time-context
101
+ name: '@deepseek-ai/dsh-time-context'
102
+ - id: tool-bash
103
+ name: '@deepseek-ai/dsh-tool-bash'
104
+ disabled: !!js process.platform === 'win32'
105
+ - id: tool-pwsh
106
+ name: '@deepseek-ai/dsh-tool-pwsh'
107
+ disabled: !!js process.platform !== 'win32'
108
+ - id: tool-fs
109
+ name: '@deepseek-ai/dsh-tool-fs'
110
+ config:
111
+ applyPatch: false
112
+ - id: tool-fs-search
113
+ name: '@deepseek-ai/dsh-tool-fs-search'
114
+ config:
115
+ sampleOverCapGlobResults: false
116
+ - id: tool-working-directory
117
+ name: '@deepseek-ai/dsh-tool-working-directory'
118
+ - id: tool-todo
119
+ name: '@deepseek-ai/dsh-tool-todo'
120
+ config:
121
+ allowParallelInProgress: true
122
+ # tool-subagent registers delegation services, so it lives in an isolate
123
+ # group like the built-in ptc preset's 'delegation' row; a bare Service
124
+ # row leaks to the root realm and fails the mount.
125
+ - id: delegation
126
+ name: cordis:group
127
+ group: true
128
+ isolate:
129
+ workflowEngine: true
130
+ config:
131
+ - id: tool-subagent
132
+ name: '@deepseek-ai/dsh-tool-subagent'
133
+ config:
134
+ provider: spawn
135
+ toolName: subagent
136
+ modelSelection: true
137
+ modelDiscovery: true
138
+ - id: compaction
139
+ name: cordis:group
140
+ group: true
141
+ isolate:
142
+ compaction: true
143
+ config:
144
+ - id: compaction-basic
145
+ name: '@deepseek-ai/dsh-compaction-basic'
146
+ - id: tool-executor-ptc
147
+ name: '@deepseek-ai/dsh-tool-executor-ptc'
package/lib/backend.js ADDED
@@ -0,0 +1,14 @@
1
+ // Backend boundary for the DSH host process. oMLX is the only adapter today;
2
+ // future mtplx / mlx-serve adapters return the same normalized snapshot.
3
+ import { createOmlxTelemetry } from "./telemetry.js"
4
+
5
+ export const createLocalBackend = (options = {}) => {
6
+ const kind = options.kind ?? "omlx"
7
+ if (kind !== "omlx") {
8
+ throw new Error("unsupported local backend: " + kind)
9
+ }
10
+ return {
11
+ kind,
12
+ read: createOmlxTelemetry(options)
13
+ }
14
+ }
@@ -0,0 +1,4 @@
1
+ // GENERATED by scripts/build-id.mjs - do not edit by hand.
2
+ // sha256 over the canonical 19-file list (11 plugin lib + 8 domain contract
3
+ // sources), so a domain-contract change moves the id too (DEC-30-01).
4
+ export const buildId = "05bec211f5afe235f2510ce06128a98aa892db2e48f29d84d53d5093c2fc8bba"
@@ -0,0 +1,27 @@
1
+ /** Signature of the engine's resident model set (order-insensitive). */
2
+ export const residentSignature = (snapshot) =>
3
+ snapshot !== null && typeof snapshot === "object" && Array.isArray(snapshot.residentModels)
4
+ ? snapshot.residentModels.slice().sort().join("|")
5
+ : null
6
+
7
+ /** Decide whether a telemetry snapshot requires a capability refresh. */
8
+ export const capabilitySyncDecision = (previous, snapshot) => {
9
+ const signature = residentSignature(snapshot)
10
+ if (signature === null) return { changed: false, signature: previous }
11
+ return { changed: previous !== null && signature !== previous, signature }
12
+ }
13
+
14
+ /** Wire the sync: snapshotOf -> invalidate + refresh only when the set changed. */
15
+ export const createCapabilitySync = ({ snapshotOf, invalidate, refresh }) => {
16
+ let previous = null
17
+ return () => {
18
+ const snapshot = typeof snapshotOf === "function" ? snapshotOf() : null
19
+ const decision = capabilitySyncDecision(previous, snapshot)
20
+ if (decision.signature === null) return
21
+ if (decision.changed) {
22
+ if (typeof invalidate === "function") invalidate()
23
+ if (typeof refresh === "function") refresh()
24
+ }
25
+ previous = decision.signature
26
+ }
27
+ }