@reconcrap/boss-recommend-mcp 2.0.51 → 2.0.53

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/src/index.js CHANGED
@@ -157,7 +157,12 @@ function clonePlain(value, fallback = null) {
157
157
  }
158
158
  }
159
159
 
160
- function isLikelyAgentRuntime() {
160
+ function hasAgentPathHint(value = "") {
161
+ const hint = normalizeText(value).toLowerCase();
162
+ return /(^|[/\\])\.(openclaw|codex)([/\\]|$)|qclaw|openclaw|codex|trae/.test(hint);
163
+ }
164
+
165
+ function isLikelyAgentRuntime({ workspaceRoot = "" } = {}) {
161
166
  for (const key of AGENT_RUNTIME_HINT_KEYS) {
162
167
  if (normalizeText(process.env[key] || "")) return true;
163
168
  }
@@ -165,13 +170,19 @@ function isLikelyAgentRuntime() {
165
170
  normalizeText(process.env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE || ""),
166
171
  normalizeText(process.env.TERM_PROGRAM || "")
167
172
  ].join(" ").toLowerCase();
168
- return /codex|openclaw|trae/.test(originHints);
173
+ if (/codex|openclaw|trae/.test(originHints)) return true;
174
+ return [
175
+ workspaceRoot,
176
+ process.env.BOSS_WORKSPACE_ROOT || "",
177
+ process.env.PWD || "",
178
+ process.cwd()
179
+ ].some(hasAgentPathHint);
169
180
  }
170
181
 
171
- function shouldStartRecommendDetached() {
182
+ function shouldStartRecommendDetached({ workspaceRoot = "" } = {}) {
172
183
  if (normalizeText(process.env.BOSS_RECOMMEND_CDP_INPROC || "") === "1") return false;
173
184
  if (normalizeText(process.env.BOSS_RECOMMEND_CDP_DETACHED || "") === "1") return true;
174
- return isLikelyAgentRuntime();
185
+ return isLikelyAgentRuntime({ workspaceRoot });
175
186
  }
176
187
 
177
188
  function isUnlimitedTargetCountToken(value) {
@@ -2155,7 +2166,7 @@ async function runDetachedWorker({ runId, resumeRun = false, workerPid = process
2155
2166
  }
2156
2167
 
2157
2168
  async function handleStartRunTool({ workspaceRoot, args }) {
2158
- if (!shouldStartRecommendDetached()) {
2169
+ if (!shouldStartRecommendDetached({ workspaceRoot })) {
2159
2170
  return startRecommendPipelineRunTool({ workspaceRoot, args });
2160
2171
  }
2161
2172