@reconcrap/boss-recommend-mcp 2.1.2 → 2.1.4
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/README.md +30 -37
- package/package.json +7 -6
- package/skills/boss-recommend-pipeline/SKILL.md +53 -31
- package/src/cli.js +99 -0
- package/src/index.js +72 -3
- package/src/parser.js +38 -61
- package/src/recommend-mcp.js +158 -67
- package/src/recommend-scheduler.js +482 -0
package/src/parser.js
CHANGED
|
@@ -546,7 +546,7 @@ function buildCriteria({ instruction, rawInstruction, overrideCriteria }) {
|
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
function resolvePostAction({ instruction, confirmation, overrides }) {
|
|
549
|
+
function resolvePostAction({ instruction, confirmation, overrides, finalConfirmed = false }) {
|
|
550
550
|
const confirmed = confirmation?.post_action_confirmed === true;
|
|
551
551
|
const confirmationValue = normalizePostAction(confirmation?.post_action_value);
|
|
552
552
|
const overrideValue = normalizePostAction(overrides?.post_action);
|
|
@@ -557,40 +557,34 @@ function resolvePostAction({ instruction, confirmation, overrides }) {
|
|
|
557
557
|
? "greet"
|
|
558
558
|
: /什么也不做|不做任何操作|不操作|仅筛选|只筛选/.test(instruction)
|
|
559
559
|
? "none"
|
|
560
|
-
|
|
560
|
+
: null;
|
|
561
561
|
const proposed = overrideValue || confirmationValue || instructionValue || null;
|
|
562
562
|
|
|
563
|
-
if (confirmed && confirmationValue) {
|
|
564
|
-
return {
|
|
565
|
-
post_action: confirmationValue,
|
|
566
|
-
proposed_post_action: confirmationValue,
|
|
567
|
-
needs_post_action_confirmation: false
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
|
|
571
563
|
return {
|
|
572
|
-
post_action: confirmed
|
|
564
|
+
post_action: (confirmed || finalConfirmed) && proposed ? proposed : null,
|
|
573
565
|
proposed_post_action: proposed,
|
|
574
|
-
needs_post_action_confirmation:
|
|
566
|
+
needs_post_action_confirmation: !proposed
|
|
575
567
|
};
|
|
576
568
|
}
|
|
577
569
|
|
|
578
|
-
function resolveTargetCount({ instruction, confirmation, overrides }) {
|
|
570
|
+
function resolveTargetCount({ instruction, confirmation, overrides, finalConfirmed = false }) {
|
|
579
571
|
const confirmed = confirmation?.target_count_confirmed === true;
|
|
580
572
|
const overrideValue = parsePositiveIntegerValue(overrides?.target_count);
|
|
581
573
|
const confirmationValue = parsePositiveIntegerValue(confirmation?.target_count_value);
|
|
582
574
|
const instructionValue = extractTargetCount(instruction);
|
|
583
575
|
const proposed = overrideValue || confirmationValue || instructionValue || null;
|
|
584
|
-
const resolved =
|
|
576
|
+
const resolved = (confirmed || finalConfirmed)
|
|
577
|
+
? (overrideValue || confirmationValue || instructionValue || null)
|
|
578
|
+
: null;
|
|
585
579
|
|
|
586
580
|
return {
|
|
587
581
|
target_count: resolved,
|
|
588
582
|
proposed_target_count: proposed,
|
|
589
|
-
needs_target_count_confirmation:
|
|
583
|
+
needs_target_count_confirmation: false
|
|
590
584
|
};
|
|
591
585
|
}
|
|
592
586
|
|
|
593
|
-
function resolveMaxGreetCount({ instruction, confirmation, overrides, postActionResolution }) {
|
|
587
|
+
function resolveMaxGreetCount({ instruction, confirmation, overrides, postActionResolution, finalConfirmed = false }) {
|
|
594
588
|
const actionHint = postActionResolution.post_action || postActionResolution.proposed_post_action;
|
|
595
589
|
if (actionHint !== "greet") {
|
|
596
590
|
return {
|
|
@@ -612,9 +606,12 @@ function resolveMaxGreetCount({ instruction, confirmation, overrides, postAction
|
|
|
612
606
|
|| null
|
|
613
607
|
);
|
|
614
608
|
const proposed = confirmationValue || overrideValue || instructionValue || null;
|
|
615
|
-
const resolved = confirmed
|
|
609
|
+
const resolved = (confirmed || finalConfirmed)
|
|
610
|
+
? (confirmationValue || overrideValue || instructionValue || null)
|
|
611
|
+
: null;
|
|
616
612
|
const suspiciousAutoFill = Boolean(
|
|
617
613
|
!confirmed
|
|
614
|
+
&& !finalConfirmed
|
|
618
615
|
&& Number.isInteger(proposed)
|
|
619
616
|
&& proposed > 0
|
|
620
617
|
&& !Number.isInteger(instructionValue)
|
|
@@ -622,32 +619,31 @@ function resolveMaxGreetCount({ instruction, confirmation, overrides, postAction
|
|
|
622
619
|
&& targetCountHint > 0
|
|
623
620
|
&& proposed === targetCountHint
|
|
624
621
|
);
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
);
|
|
622
|
+
const hasProposedValue = Number.isInteger(proposed) && proposed > 0;
|
|
623
|
+
const needsConfirmation = !hasProposedValue;
|
|
628
624
|
|
|
629
625
|
return {
|
|
630
|
-
max_greet_count:
|
|
626
|
+
max_greet_count: (confirmed || finalConfirmed) && hasProposedValue ? resolved : null,
|
|
631
627
|
proposed_max_greet_count: proposed,
|
|
632
628
|
needs_max_greet_count_confirmation: needsConfirmation,
|
|
633
629
|
suspicious_auto_fill: suspiciousAutoFill
|
|
634
630
|
};
|
|
635
631
|
}
|
|
636
632
|
|
|
637
|
-
function resolvePageScope({ instruction, confirmation, overrides }) {
|
|
633
|
+
function resolvePageScope({ instruction, confirmation, overrides, finalConfirmed = false }) {
|
|
638
634
|
const confirmed = confirmation?.page_confirmed === true;
|
|
639
635
|
const confirmationValue = normalizePageScope(confirmation?.page_value);
|
|
640
636
|
const overrideValue = normalizePageScope(overrides?.page_scope);
|
|
641
637
|
const instructionValue = extractPageScope(instruction);
|
|
642
638
|
const proposed = overrideValue || confirmationValue || instructionValue || "recommend";
|
|
643
639
|
return {
|
|
644
|
-
page_scope: confirmed && confirmationValue ?
|
|
640
|
+
page_scope: (confirmed && confirmationValue) || finalConfirmed ? proposed : null,
|
|
645
641
|
proposed_page_scope: proposed,
|
|
646
|
-
needs_page_confirmation: !
|
|
642
|
+
needs_page_confirmation: !proposed
|
|
647
643
|
};
|
|
648
644
|
}
|
|
649
645
|
|
|
650
|
-
function collectSuspiciousFields({ invalidOverrideSchoolTags
|
|
646
|
+
function collectSuspiciousFields({ invalidOverrideSchoolTags }) {
|
|
651
647
|
const suspicious = [];
|
|
652
648
|
if (Array.isArray(invalidOverrideSchoolTags) && invalidOverrideSchoolTags.length > 0) {
|
|
653
649
|
suspicious.push({
|
|
@@ -656,19 +652,13 @@ function collectSuspiciousFields({ invalidOverrideSchoolTags, maxGreetCountResol
|
|
|
656
652
|
reason: `已忽略无效学校标签:${invalidOverrideSchoolTags.join(" / ")};仅保留可识别选项。`
|
|
657
653
|
});
|
|
658
654
|
}
|
|
659
|
-
if (maxGreetCountResolution?.suspicious_auto_fill) {
|
|
660
|
-
suspicious.push({
|
|
661
|
-
field: "max_greet_count",
|
|
662
|
-
value: maxGreetCountResolution.proposed_max_greet_count,
|
|
663
|
-
reason: "检测到 max_greet_count 与 target_count 相同且原始指令未明确该值,可能是自动填充,需用户再次确认。"
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
655
|
return suspicious;
|
|
667
656
|
}
|
|
668
657
|
|
|
669
658
|
export function parseRecommendInstruction({ instruction, confirmation, overrides }) {
|
|
670
659
|
const rawInstruction = String(instruction || "");
|
|
671
660
|
const text = normalizeText(rawInstruction);
|
|
661
|
+
const finalConfirmed = confirmation?.final_confirmed === true;
|
|
672
662
|
const detectedSchoolTags = extractSchoolTags(text);
|
|
673
663
|
const detectedDegrees = extractDegrees(text);
|
|
674
664
|
const schoolTagAudit = auditSchoolTagSelections(overrides?.school_tag);
|
|
@@ -692,7 +682,7 @@ export function parseRecommendInstruction({ instruction, confirmation, overrides
|
|
|
692
682
|
|| extractJobSelectionHint(rawInstruction)
|
|
693
683
|
|| ""
|
|
694
684
|
);
|
|
695
|
-
const pageScopeResolution = resolvePageScope({ instruction: text, confirmation, overrides });
|
|
685
|
+
const pageScopeResolution = resolvePageScope({ instruction: text, confirmation, overrides, finalConfirmed });
|
|
696
686
|
|
|
697
687
|
const inferredSchoolTag = detectedSchoolTags.length > 0
|
|
698
688
|
? sortSchoolTagSelections(detectedSchoolTags)
|
|
@@ -717,15 +707,16 @@ export function parseRecommendInstruction({ instruction, confirmation, overrides
|
|
|
717
707
|
post_action: null,
|
|
718
708
|
max_greet_count: null
|
|
719
709
|
};
|
|
720
|
-
const targetCountResolution = resolveTargetCount({ instruction: text, confirmation, overrides });
|
|
710
|
+
const targetCountResolution = resolveTargetCount({ instruction: text, confirmation, overrides, finalConfirmed });
|
|
721
711
|
screenParams.target_count = targetCountResolution.target_count;
|
|
722
|
-
const postActionResolution = resolvePostAction({ instruction: text, confirmation, overrides });
|
|
712
|
+
const postActionResolution = resolvePostAction({ instruction: text, confirmation, overrides, finalConfirmed });
|
|
723
713
|
screenParams.post_action = postActionResolution.post_action;
|
|
724
714
|
const maxGreetCountResolution = resolveMaxGreetCount({
|
|
725
715
|
instruction: text,
|
|
726
716
|
confirmation,
|
|
727
717
|
overrides,
|
|
728
|
-
postActionResolution
|
|
718
|
+
postActionResolution,
|
|
719
|
+
finalConfirmed
|
|
729
720
|
});
|
|
730
721
|
screenParams.max_greet_count = maxGreetCountResolution.max_greet_count;
|
|
731
722
|
|
|
@@ -735,37 +726,23 @@ export function parseRecommendInstruction({ instruction, confirmation, overrides
|
|
|
735
726
|
}
|
|
736
727
|
|
|
737
728
|
const suspicious_fields = collectSuspiciousFields({
|
|
738
|
-
invalidOverrideSchoolTags: schoolTagAudit.invalid
|
|
739
|
-
maxGreetCountResolution
|
|
729
|
+
invalidOverrideSchoolTags: schoolTagAudit.invalid
|
|
740
730
|
});
|
|
741
|
-
const
|
|
742
|
-
const
|
|
743
|
-
const
|
|
744
|
-
const
|
|
745
|
-
const needs_school_tag_confirmation =
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
const needs_degree_confirmation = (
|
|
750
|
-
confirmation?.degree_confirmed !== true
|
|
751
|
-
|| !hasConfirmedDegreeValue
|
|
752
|
-
);
|
|
753
|
-
const needs_gender_confirmation = (
|
|
754
|
-
confirmation?.gender_confirmed !== true
|
|
755
|
-
|| !hasConfirmedGenderValue
|
|
756
|
-
);
|
|
757
|
-
const needs_recent_not_view_confirmation = (
|
|
758
|
-
confirmation?.recent_not_view_confirmed !== true
|
|
759
|
-
|| !hasConfirmedRecentNotViewValue
|
|
760
|
-
);
|
|
731
|
+
const hasResolvedSchoolTagValue = Array.isArray(searchParams.school_tag) && searchParams.school_tag.length > 0;
|
|
732
|
+
const hasResolvedDegreeValue = Array.isArray(searchParams.degree) && searchParams.degree.length > 0;
|
|
733
|
+
const hasResolvedGenderValue = Boolean(searchParams.gender);
|
|
734
|
+
const hasResolvedRecentNotViewValue = Boolean(searchParams.recent_not_view);
|
|
735
|
+
const needs_school_tag_confirmation = !hasResolvedSchoolTagValue;
|
|
736
|
+
const needs_degree_confirmation = !hasResolvedDegreeValue;
|
|
737
|
+
const needs_gender_confirmation = !hasResolvedGenderValue;
|
|
738
|
+
const needs_recent_not_view_confirmation = !hasResolvedRecentNotViewValue;
|
|
761
739
|
const needs_filters_confirmation = (
|
|
762
|
-
|
|
763
|
-
|| needs_school_tag_confirmation
|
|
740
|
+
needs_school_tag_confirmation
|
|
764
741
|
|| needs_degree_confirmation
|
|
765
742
|
|| needs_gender_confirmation
|
|
766
743
|
|| needs_recent_not_view_confirmation
|
|
767
744
|
);
|
|
768
|
-
const needs_criteria_confirmation =
|
|
745
|
+
const needs_criteria_confirmation = !screenParams.criteria;
|
|
769
746
|
const needs_target_count_confirmation = targetCountResolution.needs_target_count_confirmation;
|
|
770
747
|
const needs_post_action_confirmation = postActionResolution.needs_post_action_confirmation;
|
|
771
748
|
const needs_max_greet_count_confirmation = maxGreetCountResolution.needs_max_greet_count_confirmation;
|
package/src/recommend-mcp.js
CHANGED
|
@@ -52,10 +52,12 @@ import {
|
|
|
52
52
|
import { DEFAULT_MAX_IMAGE_PAGES } from "./core/cv-acquisition/index.js";
|
|
53
53
|
|
|
54
54
|
const DEFAULT_RECOMMEND_HOST = "127.0.0.1";
|
|
55
|
-
const DEFAULT_RECOMMEND_PORT = 9222;
|
|
56
|
-
const DEFAULT_RECOMMEND_POLL_AFTER_SEC = 10;
|
|
57
|
-
const TARGET_COUNT_SEMANTICS = "target_count means candidates that pass screening; scan continues until that many candidates pass or the list ends";
|
|
58
|
-
const RUN_MODE_ASYNC = "async";
|
|
55
|
+
const DEFAULT_RECOMMEND_PORT = 9222;
|
|
56
|
+
const DEFAULT_RECOMMEND_POLL_AFTER_SEC = 10;
|
|
57
|
+
const TARGET_COUNT_SEMANTICS = "target_count means candidates that pass screening; scan continues until that many candidates pass or the list ends";
|
|
58
|
+
const RUN_MODE_ASYNC = "async";
|
|
59
|
+
const REST_LEVEL_OPTIONS = ["low", "medium", "high"];
|
|
60
|
+
const REST_LEVEL_SET = new Set(REST_LEVEL_OPTIONS);
|
|
59
61
|
|
|
60
62
|
const TERMINAL_STATUSES = new Set([
|
|
61
63
|
RUN_STATUS_COMPLETED,
|
|
@@ -1019,17 +1021,68 @@ async function connectRecommendChromeSession({
|
|
|
1019
1021
|
};
|
|
1020
1022
|
}
|
|
1021
1023
|
|
|
1022
|
-
function parseRecommendPipelineRequest(args = {}) {
|
|
1023
|
-
return parseRecommendInstruction({
|
|
1024
|
-
instruction: args.instruction,
|
|
1024
|
+
function parseRecommendPipelineRequest(args = {}) {
|
|
1025
|
+
return parseRecommendInstruction({
|
|
1026
|
+
instruction: args.instruction,
|
|
1025
1027
|
confirmation: args.confirmation,
|
|
1026
1028
|
overrides: args.overrides
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
function
|
|
1031
|
-
|
|
1032
|
-
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function readOwn(source, keys = []) {
|
|
1033
|
+
if (!source || typeof source !== "object" || Array.isArray(source)) return undefined;
|
|
1034
|
+
for (const key of keys) {
|
|
1035
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) return source[key];
|
|
1036
|
+
}
|
|
1037
|
+
return undefined;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
function getExplicitRestLevel(args = {}) {
|
|
1041
|
+
const behavior = readOwn(args, ["human_behavior", "humanBehavior"]);
|
|
1042
|
+
const raw = readOwn(behavior, ["restLevel", "rest_level"]);
|
|
1043
|
+
const normalized = normalizeText(raw).toLowerCase();
|
|
1044
|
+
return {
|
|
1045
|
+
raw: raw ?? null,
|
|
1046
|
+
restLevel: REST_LEVEL_SET.has(normalized) ? normalized : null,
|
|
1047
|
+
valid: REST_LEVEL_SET.has(normalized),
|
|
1048
|
+
missing: raw === undefined || raw === null || normalizeText(raw) === ""
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function buildReviewScreenParams(parsed) {
|
|
1053
|
+
return {
|
|
1054
|
+
...(parsed.screenParams || {}),
|
|
1055
|
+
criteria: parsed.screenParams?.criteria || null,
|
|
1056
|
+
criteria_normalized: parsed.criteria_normalized || null,
|
|
1057
|
+
target_count: parsed.screenParams?.target_count ?? parsed.proposed_target_count ?? null,
|
|
1058
|
+
post_action: parsed.screenParams?.post_action || parsed.proposed_post_action || null,
|
|
1059
|
+
max_greet_count: parsed.screenParams?.max_greet_count ?? parsed.proposed_max_greet_count ?? null
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
function buildReviewPageScope(parsed) {
|
|
1064
|
+
return parsed.page_scope || parsed.proposed_page_scope || "recommend";
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
function buildReviewJob(args = {}) {
|
|
1068
|
+
return normalizeText(args.confirmation?.job_value || args.overrides?.job || "") || null;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function buildScheduleReview(args = {}) {
|
|
1072
|
+
const scheduleRunAt = normalizeText(args.schedule_run_at || args.scheduleRunAt || args.run_at || args.runAt);
|
|
1073
|
+
const scheduleDelayMinutes = args.schedule_delay_minutes ?? args.scheduleDelayMinutes;
|
|
1074
|
+
const scheduleDelaySeconds = args.schedule_delay_seconds ?? args.scheduleDelaySeconds;
|
|
1075
|
+
if (!scheduleRunAt && scheduleDelayMinutes === undefined && scheduleDelaySeconds === undefined) return null;
|
|
1076
|
+
return {
|
|
1077
|
+
schedule_run_at: scheduleRunAt || null,
|
|
1078
|
+
schedule_delay_minutes: scheduleDelayMinutes ?? null,
|
|
1079
|
+
schedule_delay_seconds: scheduleDelaySeconds ?? null
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
function buildRequiredConfirmations(parsed, args = {}) {
|
|
1084
|
+
const required = [];
|
|
1085
|
+
if (parsed.needs_page_confirmation) required.push("page_scope");
|
|
1033
1086
|
if (parsed.needs_filters_confirmation) required.push("filters");
|
|
1034
1087
|
if (parsed.needs_school_tag_confirmation) required.push("school_tag");
|
|
1035
1088
|
if (parsed.needs_degree_confirmation) required.push("degree");
|
|
@@ -1037,45 +1090,77 @@ function buildRequiredConfirmations(parsed, args = {}) {
|
|
|
1037
1090
|
if (parsed.needs_recent_not_view_confirmation) required.push("recent_not_view");
|
|
1038
1091
|
if (parsed.needs_criteria_confirmation) required.push("criteria");
|
|
1039
1092
|
if (parsed.needs_target_count_confirmation) required.push("target_count");
|
|
1040
|
-
if (parsed.needs_post_action_confirmation) required.push("post_action");
|
|
1041
|
-
if (parsed.needs_max_greet_count_confirmation) required.push("max_greet_count");
|
|
1042
|
-
if ((parsed.suspicious_fields || []).length) required.push("suspicious_fields");
|
|
1043
|
-
|
|
1044
|
-
const confirmation = args.confirmation || {};
|
|
1045
|
-
const jobValue = normalizeText(confirmation.job_value || args.overrides?.job || "");
|
|
1046
|
-
if (
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1093
|
+
if (parsed.needs_post_action_confirmation) required.push("post_action");
|
|
1094
|
+
if (parsed.needs_max_greet_count_confirmation) required.push("max_greet_count");
|
|
1095
|
+
if ((parsed.suspicious_fields || []).length) required.push("suspicious_fields");
|
|
1096
|
+
|
|
1097
|
+
const confirmation = args.confirmation || {};
|
|
1098
|
+
const jobValue = normalizeText(confirmation.job_value || args.overrides?.job || "");
|
|
1099
|
+
if (!jobValue) required.push("job");
|
|
1100
|
+
const restLevel = getExplicitRestLevel(args);
|
|
1101
|
+
if (!restLevel.valid) required.push("rest_level");
|
|
1102
|
+
const blocksFinalReview = required.some((field) => field !== "rest_level");
|
|
1103
|
+
if (confirmation.final_confirmed !== true && !blocksFinalReview) required.push("final_review");
|
|
1104
|
+
return Array.from(new Set(required));
|
|
1105
|
+
}
|
|
1050
1106
|
|
|
1051
|
-
function buildJobPendingQuestion(args = {}) {
|
|
1052
|
-
const value = normalizeText(args.confirmation?.job_value || args.overrides?.job || "");
|
|
1107
|
+
function buildJobPendingQuestion(args = {}) {
|
|
1108
|
+
const value = normalizeText(args.confirmation?.job_value || args.overrides?.job || "");
|
|
1053
1109
|
return {
|
|
1054
1110
|
field: "job",
|
|
1055
1111
|
question: "请确认推荐页岗位。CDP-only rewrite 会先切换到该岗位,再按所选页面范围执行筛选。",
|
|
1056
1112
|
value: value || null
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
function
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
function buildRestLevelPendingQuestion(args = {}) {
|
|
1117
|
+
const restLevel = getExplicitRestLevel(args);
|
|
1118
|
+
return {
|
|
1119
|
+
field: "rest_level",
|
|
1120
|
+
question: restLevel.missing
|
|
1121
|
+
? "请确认本次运行休息强度 rest_level。"
|
|
1122
|
+
: "rest_level 只能是 low / medium / high,请重新确认本次运行休息强度。",
|
|
1123
|
+
value: restLevel.restLevel || restLevel.raw || null,
|
|
1124
|
+
options: REST_LEVEL_OPTIONS.map((value) => ({
|
|
1125
|
+
label: value,
|
|
1126
|
+
value
|
|
1127
|
+
}))
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
function buildSuspiciousFieldsQuestion(parsed) {
|
|
1132
|
+
return {
|
|
1133
|
+
field: "suspicious_fields",
|
|
1134
|
+
question: "检测到需要修正或明确确认的异常字段,请先修正后再启动。",
|
|
1135
|
+
value: parsed.suspicious_fields || []
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function buildFinalReviewQuestion(parsed, args = {}) {
|
|
1140
|
+
const restLevel = getExplicitRestLevel(args);
|
|
1141
|
+
return {
|
|
1142
|
+
field: "final_review",
|
|
1143
|
+
question: "请最终确认本次推荐页筛选参数无误;确认后设置 final_confirmed=true 即可启动或创建定时任务。",
|
|
1144
|
+
value: {
|
|
1145
|
+
page_scope: buildReviewPageScope(parsed),
|
|
1146
|
+
job: buildReviewJob(args),
|
|
1147
|
+
search_params: parsed.searchParams,
|
|
1148
|
+
screen_params: buildReviewScreenParams(parsed),
|
|
1149
|
+
human_behavior: {
|
|
1150
|
+
restLevel: restLevel.restLevel || null
|
|
1151
|
+
},
|
|
1152
|
+
schedule: buildScheduleReview(args)
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
function buildNeedInputResponse(parsed, args = {}) {
|
|
1158
|
+
return {
|
|
1159
|
+
status: "NEED_INPUT",
|
|
1160
|
+
missing_fields: parsed.missing_fields,
|
|
1161
|
+
required_confirmations: buildRequiredConfirmations(parsed, args),
|
|
1162
|
+
search_params: parsed.searchParams,
|
|
1163
|
+
screen_params: parsed.screenParams,
|
|
1079
1164
|
pending_questions: parsed.pending_questions,
|
|
1080
1165
|
review: parsed.review,
|
|
1081
1166
|
error: {
|
|
@@ -1086,30 +1171,36 @@ function buildNeedInputResponse(parsed) {
|
|
|
1086
1171
|
};
|
|
1087
1172
|
}
|
|
1088
1173
|
|
|
1089
|
-
function buildNeedConfirmationResponse(parsed, args, requiredConfirmations) {
|
|
1090
|
-
const pending = [...(parsed.pending_questions || [])];
|
|
1091
|
-
if (requiredConfirmations.includes("
|
|
1092
|
-
pending.push(
|
|
1093
|
-
}
|
|
1094
|
-
if (requiredConfirmations.includes("
|
|
1095
|
-
pending.push(
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1174
|
+
function buildNeedConfirmationResponse(parsed, args, requiredConfirmations) {
|
|
1175
|
+
const pending = [...(parsed.pending_questions || [])];
|
|
1176
|
+
if (requiredConfirmations.includes("suspicious_fields") && !pending.some((item) => item.field === "suspicious_fields")) {
|
|
1177
|
+
pending.push(buildSuspiciousFieldsQuestion(parsed));
|
|
1178
|
+
}
|
|
1179
|
+
if (requiredConfirmations.includes("job") && !pending.some((item) => item.field === "job")) {
|
|
1180
|
+
pending.push(buildJobPendingQuestion(args));
|
|
1181
|
+
}
|
|
1182
|
+
if (requiredConfirmations.includes("rest_level") && !pending.some((item) => item.field === "rest_level")) {
|
|
1183
|
+
pending.push(buildRestLevelPendingQuestion(args));
|
|
1184
|
+
}
|
|
1185
|
+
if (requiredConfirmations.includes("final_review") && !pending.some((item) => item.field === "final_review")) {
|
|
1186
|
+
pending.push(buildFinalReviewQuestion(parsed, args));
|
|
1187
|
+
}
|
|
1188
|
+
return {
|
|
1189
|
+
status: "NEED_CONFIRMATION",
|
|
1190
|
+
required_confirmations: requiredConfirmations,
|
|
1191
|
+
page_scope: buildReviewPageScope(parsed),
|
|
1192
|
+
search_params: parsed.searchParams,
|
|
1193
|
+
screen_params: buildReviewScreenParams(parsed),
|
|
1194
|
+
pending_questions: pending,
|
|
1195
|
+
review: {
|
|
1196
|
+
...(parsed.review || {}),
|
|
1106
1197
|
required_confirmations: requiredConfirmations
|
|
1107
1198
|
}
|
|
1108
1199
|
};
|
|
1109
1200
|
}
|
|
1110
|
-
|
|
1111
|
-
function evaluateRecommendPipelineGate(parsed, args = {}) {
|
|
1112
|
-
if (parsed.missing_fields?.length) return buildNeedInputResponse(parsed);
|
|
1201
|
+
|
|
1202
|
+
function evaluateRecommendPipelineGate(parsed, args = {}) {
|
|
1203
|
+
if (parsed.missing_fields?.length) return buildNeedInputResponse(parsed, args);
|
|
1113
1204
|
const requiredConfirmations = buildRequiredConfirmations(parsed, args);
|
|
1114
1205
|
if (requiredConfirmations.length) {
|
|
1115
1206
|
return buildNeedConfirmationResponse(parsed, args, requiredConfirmations);
|