@zoraxylia/dsh-codex-adapter 0.1.4 → 0.1.5
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/.claude-plugin/plugin.json +1 -1
- package/lib/server.mjs +6 -1
- package/package.json +1 -1
- package/src/hub/index.mjs +36 -22
- package/src/install/install.mjs +5 -0
- package/src/server.mjs +1 -1
package/lib/server.mjs
CHANGED
|
@@ -14432,6 +14432,11 @@ var GLOBAL_CONFIG_DEFAULTS = {
|
|
|
14432
14432
|
flash_model: "",
|
|
14433
14433
|
pro_provider: "",
|
|
14434
14434
|
pro_model: "",
|
|
14435
|
+
// Set when the binding was discovered by the usable-route fallback rather
|
|
14436
|
+
// than chosen by the user; such a binding is re-validated when the default
|
|
14437
|
+
// effort changes instead of being treated as a deliberate pin.
|
|
14438
|
+
flash_auto: false,
|
|
14439
|
+
pro_auto: false,
|
|
14435
14440
|
// Hub-mode agent preset per tier: 'default' follows the DSH roster default.
|
|
14436
14441
|
preset_flash: "minimal",
|
|
14437
14442
|
preset_pro: "default"
|
|
@@ -15059,7 +15064,7 @@ function describeBindings(config = {}) {
|
|
|
15059
15064
|
}
|
|
15060
15065
|
|
|
15061
15066
|
// src/server.mjs
|
|
15062
|
-
var server = new McpServer({ name: "dsh-adapter", version: "0.1.
|
|
15067
|
+
var server = new McpServer({ name: "dsh-adapter", version: "0.1.5" });
|
|
15063
15068
|
var tierSchema = external_exports.enum(["flash", "pro"]).optional().describe("Worker model tier. flash = mechanical, well-scoped work (single-file edits, lookups, formatting); pro = multi-file changes, debugging, design judgment. Omit to use the session default. Ignored when worker= is set.");
|
|
15064
15069
|
var effortSchema = external_exports.enum(["off", "high", "max"]).optional().describe("Reasoning effort for the worker. Omit to use the session default. With worker= it only applies when passed explicitly and the profile supports it (agy maps to low/medium/high).");
|
|
15065
15070
|
var workerSchema = external_exports.string().optional().describe('Named CLI worker profile (e.g. "agy" or "grok"). Explicit opt-in only: set it when the user explicitly asks for that external coding CLI, never as a default. When set, dispatch bypasses tier/mode and runs the task through that CLI; the profile pins backend\xD7model\xD7effort. See dsh_worker_config output, worker_profiles field, for the available profiles.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoraxylia/dsh-codex-adapter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/hub/index.mjs",
|
|
6
6
|
"description": "DeepSeek Harness plugin: dispatch work to DSH agents from Claude Code / Codex, as native subagents with live progress",
|
package/src/hub/index.mjs
CHANGED
|
@@ -123,9 +123,9 @@ export class WorkerRegistry {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/** One bounded capability probe; the route counts as usable when it streams. */
|
|
126
|
-
async probeRoute(llm, binding) {
|
|
126
|
+
async probeRoute(llm, binding, effort) {
|
|
127
127
|
try {
|
|
128
|
-
const result = await probeProvider(llm, binding, { timeoutMs: 12000 });
|
|
128
|
+
const result = await probeProvider(llm, { ...binding, ...(effort ? { reasoningEffort: effort } : {}) }, { timeoutMs: 12000 });
|
|
129
129
|
return result.status === 'verified' || result.status === 'no_tool_call';
|
|
130
130
|
} catch { return false; }
|
|
131
131
|
}
|
|
@@ -138,17 +138,18 @@ export class WorkerRegistry {
|
|
|
138
138
|
* first route that streams, and persist it so later dispatches skip the
|
|
139
139
|
* search. Pinned bindings never reach this path.
|
|
140
140
|
*/
|
|
141
|
-
async resolveUsableTier(tier, bound) {
|
|
141
|
+
async resolveUsableTier(tier, bound, effort) {
|
|
142
142
|
this.autoTier ??= {};
|
|
143
|
-
|
|
143
|
+
const cacheKey = tier + ':' + effort;
|
|
144
|
+
if (this.autoTier[cacheKey]) return this.autoTier[cacheKey];
|
|
144
145
|
const llm = this.ctx?.get?.('llm') ?? this.ctx?.llm;
|
|
145
|
-
if (!llm) return bound;
|
|
146
|
-
if (await this.probeRoute(llm, bound)) { this.autoTier[
|
|
146
|
+
if (!llm) return { binding: bound, effort };
|
|
147
|
+
if (await this.probeRoute(llm, bound, effort)) { this.autoTier[cacheKey] = { binding: bound, effort }; return this.autoTier[cacheKey]; }
|
|
147
148
|
const builtin = new Set(['deepseek-official', 'deepseek-account']);
|
|
148
149
|
let ids = [];
|
|
149
150
|
try {
|
|
150
151
|
ids = llm.listProviders().map((p) => p.id).filter((id) => id !== bound.provider);
|
|
151
|
-
} catch { return bound; }
|
|
152
|
+
} catch { return { binding: bound, effort }; }
|
|
152
153
|
ids.sort((a, b) => Number(builtin.has(a)) - Number(builtin.has(b)));
|
|
153
154
|
const candidates = [];
|
|
154
155
|
for (const id of ids) {
|
|
@@ -157,18 +158,25 @@ export class WorkerRegistry {
|
|
|
157
158
|
for (const m of models.slice(0, 3)) candidates.push({ provider: id, model: m.id });
|
|
158
159
|
if (candidates.length >= 5) break;
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
const attempts = effort && effort !== 'off' ? [effort, 'off'] : [effort];
|
|
162
|
+
for (const attemptEffort of attempts) {
|
|
163
|
+
for (const candidate of candidates) {
|
|
164
|
+
if (!(await this.probeRoute(llm, candidate, attemptEffort))) continue;
|
|
165
|
+
const chosen = { binding: candidate, effort: attemptEffort };
|
|
166
|
+
this.autoTier[cacheKey] = chosen;
|
|
163
167
|
try {
|
|
164
|
-
writeGlobalConfig({
|
|
168
|
+
writeGlobalConfig({
|
|
169
|
+
[`${tier}_provider`]: candidate.provider,
|
|
170
|
+
[`${tier}_model`]: candidate.model,
|
|
171
|
+
[`${tier}_auto`]: true,
|
|
172
|
+
});
|
|
165
173
|
} catch { /* read-only home: keep the in-memory choice */ }
|
|
166
|
-
this.ctx?.logger?.info?.(`dsh-adapter: ${tier} auto-bound to ${candidate.provider}/${candidate.model}`);
|
|
167
|
-
return
|
|
174
|
+
this.ctx?.logger?.info?.(`dsh-adapter: ${tier} auto-bound to ${candidate.provider}/${candidate.model} @ ${attemptEffort}`);
|
|
175
|
+
return chosen;
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
178
|
this.ctx?.logger?.warn?.(`dsh-adapter: no usable ${tier} route; keeping ${bound.provider}/${bound.model}`);
|
|
171
|
-
return bound;
|
|
179
|
+
return { binding: bound, effort };
|
|
172
180
|
}
|
|
173
181
|
|
|
174
182
|
async spawn({ task, tier = 'flash', effort = 'max', cwd, source = 'api', provider, model, preset }) {
|
|
@@ -177,13 +185,19 @@ export class WorkerRegistry {
|
|
|
177
185
|
// session-level overrides, exactly as it does for presets); otherwise the
|
|
178
186
|
// hub's own stored config decides, and failing that the tier default.
|
|
179
187
|
const tierConfig = this.getConfig?.() ?? {};
|
|
180
|
-
const
|
|
181
|
-
|
|
188
|
+
const explicitArgs = [provider, model].some((v) => typeof v === 'string' && v.trim() !== '');
|
|
189
|
+
const configPinned = [tierConfig[`${tier}_provider`], tierConfig[`${tier}_model`]]
|
|
190
|
+
.some((v) => typeof v === 'string' && v.trim() !== '') && tierConfig[`${tier}_auto`] !== true;
|
|
191
|
+
const pinned = explicitArgs || configPinned;
|
|
182
192
|
let bound = resolveTierBinding(tier, tierConfig);
|
|
183
|
-
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
if (!pinned)
|
|
193
|
+
let dispatchEffort = effort;
|
|
194
|
+
// An unpinned tier gets a route that actually works for this effort; an
|
|
195
|
+
// auto-bound one is re-checked because the model catalog can change.
|
|
196
|
+
if (!pinned) {
|
|
197
|
+
const usable = await this.resolveUsableTier(tier, bound, effort);
|
|
198
|
+
bound = usable.binding;
|
|
199
|
+
dispatchEffort = usable.effort ?? effort;
|
|
200
|
+
}
|
|
187
201
|
const resolvedProvider = typeof provider === 'string' && provider.trim() !== '' ? provider.trim() : bound.provider;
|
|
188
202
|
const resolvedModel = typeof model === 'string' && model.trim() !== '' ? model.trim() : bound.model;
|
|
189
203
|
if (!['off', 'high', 'max'].includes(effort)) throw new Error(`unknown effort "${effort}"`);
|
|
@@ -197,7 +211,7 @@ export class WorkerRegistry {
|
|
|
197
211
|
const id = `hub-${this.nextId++}-${Date.now().toString(36)}`;
|
|
198
212
|
const sessionId = `session-${randomUUID()}`;
|
|
199
213
|
const job = {
|
|
200
|
-
id, sessionId, tier, model: resolvedModel, provider: resolvedProvider, effort, task, source, cwd: cwdPath,
|
|
214
|
+
id, sessionId, tier, model: resolvedModel, provider: resolvedProvider, effort: dispatchEffort, task, source, cwd: cwdPath,
|
|
201
215
|
status: 'running', turn: 0, step: 0, currentTool: null, toolCalls: 0,
|
|
202
216
|
tokens: { input: 0, output: 0, reasoning: 0 },
|
|
203
217
|
startedAt: new Date().toISOString(), endedAt: null,
|
|
@@ -206,7 +220,7 @@ export class WorkerRegistry {
|
|
|
206
220
|
};
|
|
207
221
|
this.jobs.set(id, job);
|
|
208
222
|
|
|
209
|
-
const selection = { provider: resolvedProvider, model: resolvedModel, reasoningEffort:
|
|
223
|
+
const selection = { provider: resolvedProvider, model: resolvedModel, reasoningEffort: dispatchEffort };
|
|
210
224
|
const presets = this.ctx.get('agentPresets');
|
|
211
225
|
const cfg = this.getConfig?.() ?? {};
|
|
212
226
|
const wanted = preset ?? (tier === 'flash' ? cfg.preset_flash : cfg.preset_pro);
|
package/src/install/install.mjs
CHANGED
|
@@ -109,6 +109,11 @@ export const GLOBAL_CONFIG_DEFAULTS = {
|
|
|
109
109
|
flash_model: '',
|
|
110
110
|
pro_provider: '',
|
|
111
111
|
pro_model: '',
|
|
112
|
+
// Set when the binding was discovered by the usable-route fallback rather
|
|
113
|
+
// than chosen by the user; such a binding is re-validated when the default
|
|
114
|
+
// effort changes instead of being treated as a deliberate pin.
|
|
115
|
+
flash_auto: false,
|
|
116
|
+
pro_auto: false,
|
|
112
117
|
// Hub-mode agent preset per tier: 'default' follows the DSH roster default.
|
|
113
118
|
preset_flash: 'minimal',
|
|
114
119
|
preset_pro: 'default',
|
package/src/server.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { acquireCwdLock, releaseCwdLockByJobId, updateCwdLockHolder, getCwdLocks
|
|
|
12
12
|
import { resolveWorkerCwd } from './paths.mjs';
|
|
13
13
|
import { detectOrchestrator } from './process-info.mjs';
|
|
14
14
|
|
|
15
|
-
const server = new McpServer({ name: 'dsh-adapter', version: '0.1.
|
|
15
|
+
const server = new McpServer({ name: 'dsh-adapter', version: '0.1.5' });
|
|
16
16
|
|
|
17
17
|
const tierSchema = z.enum(['flash', 'pro']).optional().describe('Worker model tier. flash = mechanical, well-scoped work (single-file edits, lookups, formatting); pro = multi-file changes, debugging, design judgment. Omit to use the session default. Ignored when worker= is set.');
|
|
18
18
|
const effortSchema = z.enum(['off', 'high', 'max']).optional().describe('Reasoning effort for the worker. Omit to use the session default. With worker= it only applies when passed explicitly and the profile supports it (agy maps to low/medium/high).');
|