@ddtcorex/dsh-maestro-supervisor 0.6.7 → 0.6.8

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.
@@ -268,6 +268,7 @@ async function defaultFetchLLM(prompt) {
268
268
  body: JSON.stringify({
269
269
  model: cfg.model,
270
270
  temperature: 0.2,
271
+ ...(cfg.reasoningEffort ? { reasoning_effort: cfg.reasoningEffort, reasoningEffort: cfg.reasoningEffort } : {}),
271
272
  messages: [
272
273
  { role: 'system', content: 'You are a systematic-debugging agent for DSH Web resilience. Follow the 4 phases: root cause, pattern analysis, hypothesis, implementation. Always propose minimal single-file fix.' },
273
274
  { role: 'user', content: prompt },
@@ -312,7 +313,7 @@ async function defaultFetchLLM(prompt) {
312
313
  { role: 'user', content: prompt },
313
314
  ],
314
315
  max_output_tokens: 4000,
315
- reasoning: { effort: 'low' },
316
+ ...(cfg.reasoningEffort ? { reasoning: { effort: cfg.reasoningEffort } } : { reasoning: { effort: 'low' } }),
316
317
  }),
317
318
  });
318
319
  if (!res2.ok)
@@ -339,7 +340,9 @@ async function resolveLLMConfig() {
339
340
  // Model: AI_MODEL / DEEPSEEK_MODEL / settings.json domains.supervisor.model -> domains.review.model / default
340
341
  // Supervisor has its own picker; falls back to review model for backward compat, then DSH default.
341
342
  let model = process.env.AI_MODEL ?? process.env.DEEPSEEK_MODEL ?? process.env.OPENAI_MODEL ?? null;
342
- if (!model) {
343
+ // reasoningEffort: env first, then supervisor -> review, then settings.yaml fallback
344
+ let reasoningEffort = (process.env.AI_REASONING_EFFORT ?? process.env.REASONING_EFFORT ?? null) ?? undefined;
345
+ if (!model || !reasoningEffort) {
343
346
  try {
344
347
  const { readFileSync } = await import('node:fs');
345
348
  const { homedir } = await import('node:os');
@@ -347,24 +350,57 @@ async function resolveLLMConfig() {
347
350
  const raw = readFileSync(settingsPath, 'utf-8');
348
351
  const j = JSON.parse(raw);
349
352
  // Prefer supervisor model, fall back to review model (so old installs keep working)
350
- const sup = j?.domains?.supervisor?.model?.model ?? j?.domains?.supervisor?.model;
351
- const rev = j?.domains?.review?.model?.model ?? j?.domains?.review?.model;
352
- let m = null;
353
- if (typeof sup === 'string')
354
- m = sup;
355
- else if (sup?.model && typeof sup.model === 'string')
356
- m = sup.model;
357
- else if (typeof rev === 'string')
358
- m = rev;
359
- else if (rev?.model && typeof rev.model === 'string')
360
- m = rev.model;
361
- if (typeof m === 'string' && m.trim() !== '')
362
- model = m;
353
+ if (!model) {
354
+ const sup = j?.domains?.supervisor?.model?.model ?? j?.domains?.supervisor?.model;
355
+ const rev = j?.domains?.review?.model?.model ?? j?.domains?.review?.model;
356
+ let m = null;
357
+ if (typeof sup === 'string')
358
+ m = sup;
359
+ else if (sup?.model && typeof sup.model === 'string')
360
+ m = sup.model;
361
+ else if (typeof rev === 'string')
362
+ m = rev;
363
+ else if (rev?.model && typeof rev.model === 'string')
364
+ m = rev.model;
365
+ if (typeof m === 'string' && m.trim() !== '')
366
+ model = m;
367
+ }
368
+ if (!reasoningEffort) {
369
+ // config-lib validator: model is {provider, model, reasoningEffort?} inside domains.supervisor.model / domains.review.model
370
+ // Support both nested object and flat legacy fallback for future compat
371
+ const supObj = j?.domains?.supervisor?.model;
372
+ const revObj = j?.domains?.review?.model;
373
+ const supEff = typeof supObj === 'object' && supObj !== null ? supObj.reasoningEffort : undefined;
374
+ const supFlat = j?.domains?.supervisor?.reasoningEffort;
375
+ const revEff = typeof revObj === 'object' && revObj !== null ? revObj.reasoningEffort : undefined;
376
+ const revFlat = j?.domains?.review?.reasoningEffort;
377
+ const candidate = supEff ?? supFlat ?? revEff ?? revFlat;
378
+ if (typeof candidate === 'string' && candidate.trim() !== '')
379
+ reasoningEffort = candidate.trim();
380
+ }
363
381
  }
364
382
  catch { }
365
383
  }
366
384
  if (!model)
367
385
  model = 'deepseek-chat';
386
+ // Also try settings.yaml for reasoningEffort if still missing (e.g., llm-pi-ai default reasoning)
387
+ if (!reasoningEffort) {
388
+ try {
389
+ const { readFileSync } = await import('node:fs');
390
+ const { homedir } = await import('node:os');
391
+ const yamlPath = `${homedir()}/.dsh/settings.yaml`;
392
+ const yaml = readFileSync(yamlPath, 'utf-8');
393
+ // Look for reasoningEffort near the model id in provider blocks (future-proof; currently not in yaml)
394
+ const re = new RegExp(`id:\\s*${model}[\\s\\S]{0,200}reasoningEffort:\\s*(\\S+)`, 'm');
395
+ const m = yaml.match(re);
396
+ if (m) {
397
+ const v = m[1].trim().replace(/^["']|["']$/g, '');
398
+ if (v)
399
+ reasoningEffort = v;
400
+ }
401
+ }
402
+ catch { }
403
+ }
368
404
  // If url not set via env, try to resolve from ~/.dsh/settings.yaml llm-pi-ai providers (DeepSeek suggested setup)
369
405
  if (!url) {
370
406
  try {
@@ -432,7 +468,7 @@ async function resolveLLMConfig() {
432
468
  if (!url.includes('/v1/') && !url.includes('/chat/completions')) {
433
469
  finalUrl = url.replace(/\/$/, '') + '/v1/chat/completions';
434
470
  }
435
- return { key, url: finalUrl, model };
471
+ return { key, url: finalUrl, model, ...(reasoningEffort ? { reasoningEffort } : {}) };
436
472
  }
437
473
  async function resolveApiKey() {
438
474
  const cfg = await resolveLLMConfig();
@@ -50,6 +50,10 @@ function isRecentlyStarted(opts, wallMs) {
50
50
  return true;
51
51
  return false;
52
52
  }
53
+ // Specific parse/boot-failure markers only. Bare 'JSON'/'YAML' were removed
54
+ // (2026-08-31): they matched any line whose payload merely *contained* those
55
+ // substrings — e.g. maestro-sync's status JSON listing session.jsonl.zstd /
56
+ // settings.json paths — turning a healthy 401 into a rollback + restart.
53
57
  const ERROR_PATTERNS = [
54
58
  'ERR_MODULE_NOT_FOUND',
55
59
  'ERR_PNPM',
@@ -58,8 +62,6 @@ const ERROR_PATTERNS = [
58
62
  'SyntaxError',
59
63
  'YAMLParseError',
60
64
  'ParseError',
61
- 'YAML',
62
- 'JSON',
63
65
  'corrupted',
64
66
  'allowBuilds',
65
67
  'Cannot find module',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddtcorex/dsh-maestro-supervisor",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Supervisor daemon for DSH Web resilience — auto-detect crashes, rollback to LKG, report",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",