@nathan-adk/dsh-rea-lazy 1.1.0 → 1.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.
Files changed (2) hide show
  1. package/lib/index.js +22 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -215,9 +215,25 @@ function which(name) {
215
215
  return null;
216
216
  }
217
217
 
218
+ function readEnvFile() {
219
+ // DSH injects $DSH_HOME/.env into the process at launch; read it here too so
220
+ // detection also works in plain Node / tests. No hardcoded paths.
221
+ try {
222
+ const home = process.env.DSH_HOME || require('path').join(require('os').homedir(), '.dsh');
223
+ const f = require('path').join(home, '.env');
224
+ if (!fs.existsSync(f)) return {};
225
+ const out = {};
226
+ for (const line of fs.readFileSync(f, 'utf8').split(/\r?\n/)) {
227
+ const m = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/);
228
+ if (m) out[m[1]] = m[2];
229
+ }
230
+ return out;
231
+ } catch (_) { return {}; }
232
+ }
233
+
218
234
  function findRea() {
219
- // 1) explicit override
220
- const envCmd = process.env.REA_COMMAND;
235
+ // 1) explicit override (process env first, then DSH .env)
236
+ const envCmd = process.env.REA_COMMAND || readEnvFile().REA_COMMAND;
221
237
  if (envCmd && envCmd.trim()) {
222
238
  const parts = envCmd.trim().split(/\s+/);
223
239
  return { command: parts[0], args: parts.slice(1) };
@@ -253,6 +269,10 @@ async function apply(ctx, config = {}) {
253
269
  transport: 'stdio',
254
270
  command: found.command,
255
271
  args: found.args,
272
+ // McpServerSchema defaults: cacheKey() calls Object.entries(config.env)
273
+ // and Object.keys(config.headers) directly, so these must never be undefined.
274
+ env: {},
275
+ headers: {},
256
276
  catalogTtlMs: 315360000000,
257
277
  idleDisconnectMs: 300000,
258
278
  callTimeoutMs: 600000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathan-adk/dsh-rea-lazy",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "On-demand REA for DeepSeek Harness: auto-detects the local REA executable and registers it as a lazy capability, so 263 REA tools stay searchable while rea mcp never runs in the background. DSH-only.",
5
5
  "keywords": [
6
6
  "deepseek-harness",