@reconcrap/boss-recommend-mcp 2.1.22 → 2.1.23

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.
@@ -11,10 +11,17 @@ import {
11
11
  startRecommendPipelineRunTool
12
12
  } from "./recommend-mcp.js";
13
13
 
14
- const SCHEDULE_WORKER_FLAG = "--schedule-worker";
15
- const SCHEDULE_ID_FLAG = "--schedule-id";
16
- const TERMINAL_SCHEDULE_STATES = new Set(["completed", "failed", "canceled"]);
17
- const TERMINAL_RUN_STATES = new Set(["completed", "failed", "canceled"]);
14
+ const SCHEDULE_WORKER_FLAG = "--schedule-worker";
15
+ const SCHEDULE_ID_FLAG = "--schedule-id";
16
+ const TERMINAL_SCHEDULE_STATES = new Set(["completed", "failed", "canceled"]);
17
+ const TERMINAL_RUN_STATES = new Set(["completed", "failed", "canceled"]);
18
+ const SCHEDULE_FORBIDDEN_DEBUG_FIELDS = Object.freeze([
19
+ "debug_test_mode",
20
+ "allow_debug_test_mode",
21
+ "debug_force_list_end_after_processed",
22
+ "debug_force_context_recovery_after_processed",
23
+ "debug_force_cdp_reconnect_after_processed"
24
+ ]);
18
25
 
19
26
  let spawnProcessImpl = spawn;
20
27
 
@@ -22,13 +29,58 @@ function normalizeText(value) {
22
29
  return String(value || "").replace(/\s+/g, " ").trim();
23
30
  }
24
31
 
25
- function clonePlain(value, fallback = null) {
32
+ function clonePlain(value, fallback = null) {
26
33
  try {
27
34
  return value === undefined ? fallback : JSON.parse(JSON.stringify(value));
28
35
  } catch {
29
36
  return fallback;
30
37
  }
31
- }
38
+ }
39
+
40
+ function hasOwn(source, key) {
41
+ return Boolean(source && Object.prototype.hasOwnProperty.call(source, key));
42
+ }
43
+
44
+ function collectScheduledRecommendDebugOptions(args = {}) {
45
+ const options = [];
46
+ for (const field of SCHEDULE_FORBIDDEN_DEBUG_FIELDS) {
47
+ if (hasOwn(args, field)) options.push(field);
48
+ }
49
+
50
+ const screeningMode = normalizeText(args.screening_mode || args.screeningMode).toLowerCase();
51
+ if (["deterministic", "local", "local_scorer"].includes(screeningMode)) {
52
+ options.push(`screening_mode=${screeningMode}`);
53
+ }
54
+ if (args.use_llm === false || args.useLlm === false) {
55
+ options.push("use_llm=false");
56
+ }
57
+ if (args.allow_card_only_screening === true || args.allowCardOnlyScreening === true) {
58
+ options.push("allow_card_only_screening");
59
+ }
60
+ const detailLimit = Number.parseInt(String(args.detail_limit ?? args.detailLimit ?? ""), 10);
61
+ if (Number.isFinite(detailLimit) && detailLimit === 0) options.push("detail_limit=0");
62
+ if (args.no_filter === true || args.noFilter === true) options.push("no_filter");
63
+ if (args.filter_enabled === false || args.filterEnabled === false) options.push("filter_enabled=false");
64
+ if (args.dry_run_post_action === true || args.dryRunPostAction === true) {
65
+ options.push("dry_run_post_action");
66
+ }
67
+ if (args.dry_run === true || args.dryRun === true) options.push("dry_run");
68
+
69
+ const requestedPostAction = normalizeText(
70
+ args.overrides?.post_action
71
+ ?? args.confirmation?.post_action_value
72
+ ?? args.post_action
73
+ ?? args.postAction
74
+ ).toLowerCase();
75
+ if (
76
+ requestedPostAction
77
+ && requestedPostAction !== "none"
78
+ && (args.execute_post_action === false || args.executePostAction === false)
79
+ ) {
80
+ options.push("execute_post_action=false");
81
+ }
82
+ return Array.from(new Set(options));
83
+ }
32
84
 
33
85
  function nowIso() {
34
86
  return new Date().toISOString();
@@ -229,9 +281,23 @@ function launchScheduleWorker(scheduleId) {
229
281
  };
230
282
  }
231
283
 
232
- export async function scheduleRecommendPipelineRunTool({ workspaceRoot = "", args = {} } = {}) {
233
- const runArgs = stripScheduleArgs(args);
234
- const prepared = prepareRecommendPipelineRunTool({ workspaceRoot, args: runArgs });
284
+ export async function scheduleRecommendPipelineRunTool({ workspaceRoot = "", args = {} } = {}) {
285
+ const runArgs = stripScheduleArgs(args);
286
+ const forbiddenDebugOptions = collectScheduledRecommendDebugOptions(runArgs);
287
+ if (forbiddenDebugOptions.length) {
288
+ return {
289
+ status: "FAILED",
290
+ schedule_created: false,
291
+ cron_ready: false,
292
+ error: {
293
+ code: "RECOMMEND_SCHEDULE_DEBUG_OPTIONS_FORBIDDEN",
294
+ message: `Recommend schedules cannot contain diagnostic-only run options: ${forbiddenDebugOptions.join(", ")}`,
295
+ retryable: false
296
+ },
297
+ forbidden_debug_options: forbiddenDebugOptions
298
+ };
299
+ }
300
+ const prepared = prepareRecommendPipelineRunTool({ workspaceRoot, args: runArgs });
235
301
  if (prepared.status !== "READY" || prepared.cron_ready !== true) {
236
302
  return {
237
303
  ...prepared,