@reconcrap/boss-recommend-mcp 2.0.45 → 2.0.47

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 (56) hide show
  1. package/bin/boss-recommend-mcp.js +4 -4
  2. package/config/screening-config.example.json +27 -27
  3. package/package.json +1 -1
  4. package/scripts/postinstall.cjs +44 -44
  5. package/skills/boss-chat/README.md +39 -39
  6. package/skills/boss-chat/SKILL.md +93 -93
  7. package/skills/boss-recommend-pipeline/README.md +12 -12
  8. package/skills/boss-recommend-pipeline/SKILL.md +180 -180
  9. package/skills/boss-recruit-pipeline/README.md +17 -17
  10. package/skills/boss-recruit-pipeline/SKILL.md +58 -58
  11. package/src/chat-mcp.js +1780 -1780
  12. package/src/chat-runtime-config.js +749 -749
  13. package/src/cli.js +3054 -3054
  14. package/src/core/boss-cards/index.js +199 -199
  15. package/src/core/browser/index.js +1453 -1446
  16. package/src/core/capture/index.js +1201 -1201
  17. package/src/core/cv-acquisition/index.js +238 -238
  18. package/src/core/cv-capture-target/index.js +299 -299
  19. package/src/core/greet-quota/index.js +54 -54
  20. package/src/core/infinite-list/index.js +1326 -1326
  21. package/src/core/reporting/legacy-csv.js +341 -341
  22. package/src/core/run/timing.js +33 -33
  23. package/src/core/screening/index.js +50 -3
  24. package/src/core/self-heal/index.js +973 -973
  25. package/src/core/self-heal/viewport.js +564 -564
  26. package/src/domains/chat/cards.js +137 -137
  27. package/src/domains/chat/constants.js +221 -221
  28. package/src/domains/chat/detail.js +1668 -1661
  29. package/src/domains/chat/index.js +7 -7
  30. package/src/domains/chat/jobs.js +592 -588
  31. package/src/domains/chat/page-guard.js +98 -98
  32. package/src/domains/chat/roots.js +56 -56
  33. package/src/domains/chat/run-service.js +1977 -1955
  34. package/src/domains/recommend/actions.js +457 -457
  35. package/src/domains/recommend/cards.js +243 -243
  36. package/src/domains/recommend/constants.js +165 -165
  37. package/src/domains/recommend/detail.js +36 -28
  38. package/src/domains/recommend/filters.js +610 -581
  39. package/src/domains/recommend/index.js +10 -10
  40. package/src/domains/recommend/jobs.js +316 -263
  41. package/src/domains/recommend/refresh.js +472 -472
  42. package/src/domains/recommend/roots.js +80 -80
  43. package/src/domains/recommend/run-service.js +75 -35
  44. package/src/domains/recommend/scopes.js +246 -245
  45. package/src/domains/recruit/actions.js +277 -277
  46. package/src/domains/recruit/cards.js +74 -74
  47. package/src/domains/recruit/constants.js +167 -167
  48. package/src/domains/recruit/detail.js +461 -460
  49. package/src/domains/recruit/index.js +9 -9
  50. package/src/domains/recruit/instruction-parser.js +451 -451
  51. package/src/domains/recruit/refresh.js +44 -44
  52. package/src/domains/recruit/roots.js +68 -68
  53. package/src/domains/recruit/run-service.js +1207 -1161
  54. package/src/domains/recruit/search.js +1202 -1149
  55. package/src/recommend-mcp.js +22 -22
  56. package/src/recruit-mcp.js +1338 -1338
@@ -1,199 +1,199 @@
1
- import { htmlToText, normalizeText } from "../screening/index.js";
2
-
3
- function uniqueTexts(values = []) {
4
- return Array.from(new Set(values.map((value) => normalizeText(value)).filter(Boolean)));
5
- }
6
-
7
- function classList(value = "") {
8
- return String(value || "").split(/\s+/).map((item) => item.trim()).filter(Boolean);
9
- }
10
-
11
- function hasAllClasses(classValue = "", requiredClasses = []) {
12
- const classes = classList(classValue);
13
- return requiredClasses.every((required) => classes.includes(required));
14
- }
15
-
16
- function findClassAttributeIndex(html = "", requiredClasses = [], startIndex = 0) {
17
- const regex = /class=(["'])(.*?)\1/gi;
18
- regex.lastIndex = Math.max(0, Number(startIndex) || 0);
19
- let match;
20
- while ((match = regex.exec(String(html || "")))) {
21
- if (hasAllClasses(match[2], requiredClasses)) return match.index;
22
- }
23
- return -1;
24
- }
25
-
26
- function sectionByClasses(html = "", startClasses = [], endClassGroups = []) {
27
- const source = String(html || "");
28
- const classIndex = findClassAttributeIndex(source, startClasses);
29
- if (classIndex < 0) return "";
30
- const start = Math.max(0, source.lastIndexOf("<", classIndex));
31
- let end = source.length;
32
- for (const group of endClassGroups) {
33
- const found = findClassAttributeIndex(source, group, classIndex + 1);
34
- if (found >= 0) {
35
- const tagStart = source.lastIndexOf("<", found);
36
- end = Math.min(end, tagStart >= 0 ? tagStart : found);
37
- }
38
- }
39
- return source.slice(start, end);
40
- }
41
-
42
- function textFromHtmlFragment(fragment = "") {
43
- return normalizeText(htmlToText(fragment).replace(/\n+/g, " "));
44
- }
45
-
46
- function stripNameSuffixes(value = "") {
47
- return normalizeText(value)
48
- .replace(/\s*(在线|刚刚活跃|今日活跃|本周活跃|本月活跃)$/u, "")
49
- .trim();
50
- }
51
-
52
- function extractFirstSpanWithClass(html = "", className = "") {
53
- const regex = /<span\b[^>]*class=(["'])(.*?)\1[^>]*>([\s\S]*?)<\/span>/gi;
54
- let match;
55
- while ((match = regex.exec(String(html || "")))) {
56
- if (classList(match[2]).includes(className)) {
57
- return textFromHtmlFragment(match[3]);
58
- }
59
- }
60
- return "";
61
- }
62
-
63
- function extractSpanTexts(fragment = "") {
64
- const values = [];
65
- const regex = /<span\b[^>]*>([\s\S]*?)<\/span>/gi;
66
- let match;
67
- while ((match = regex.exec(String(fragment || "")))) {
68
- values.push(textFromHtmlFragment(match[1]));
69
- }
70
- return uniqueTexts(values);
71
- }
72
-
73
- function extractDivTextsWithClasses(fragment = "", requiredClasses = []) {
74
- const values = [];
75
- const regex = /<div\b[^>]*class=(["'])(.*?)\1[^>]*>([\s\S]*?)<\/div>/gi;
76
- let match;
77
- while ((match = regex.exec(String(fragment || "")))) {
78
- if (hasAllClasses(match[2], requiredClasses)) {
79
- values.push(extractSpanTexts(match[3]));
80
- }
81
- }
82
- return values.filter((items) => items.length);
83
- }
84
-
85
- function parseAgeValue(value = "") {
86
- const match = normalizeText(value).match(/^(\d{2})岁$/u);
87
- if (!match) return null;
88
- const age = Number.parseInt(match[1], 10);
89
- return Number.isFinite(age) ? age : null;
90
- }
91
-
92
- function parseDegreeValue(value = "") {
93
- const normalized = normalizeText(value);
94
- const match = normalized.match(/博士|硕士|本科|大专|专科|高中|中专\/中技|中专|中技|初中及以下/u);
95
- return match ? match[0] : "";
96
- }
97
-
98
- function isSalaryLike(value = "") {
99
- const normalized = normalizeText(value);
100
- return Boolean(
101
- /^(?:面议|薪资面议)$/i.test(normalized)
102
- || /^\d+(?:\.\d+)?(?:\s*-\s*\d+(?:\.\d+)?)?\s*[kK](?:\s*[·xX*]\s*\d+\s*薪?)?$/.test(normalized)
103
- || /^\d+\s*-\s*\d+\s*元\s*\/\s*天$/.test(normalized)
104
- );
105
- }
106
-
107
- function extractSalary(html = "") {
108
- const section = sectionByClasses(html, ["salary-wrap"], [
109
- ["name-wrap"],
110
- ["col-2"]
111
- ]);
112
- return extractSpanTexts(section).find(isSalaryLike) || "";
113
- }
114
-
115
- function extractBaseInfo(html = "") {
116
- const section = sectionByClasses(html, ["base-info"], [
117
- ["expect-wrap"],
118
- ["geek-desc"],
119
- ["timeline-wrap"]
120
- ]);
121
- const parts = extractSpanTexts(section);
122
- return {
123
- parts,
124
- age: parts.map(parseAgeValue).find((value) => value != null) ?? null,
125
- degree: parts.map(parseDegreeValue).find(Boolean) || ""
126
- };
127
- }
128
-
129
- function extractFirstTimelineContent(html = "", timelineClass = "") {
130
- const section = sectionByClasses(html, ["timeline-wrap", timelineClass], [
131
- timelineClass === "work-exps" ? ["timeline-wrap", "edu-exps"] : ["card-btns"],
132
- ["action-wrap"]
133
- ]);
134
- const contentRows = extractDivTextsWithClasses(section, ["join-text-wrap", "content"]);
135
- return contentRows[0] || [];
136
- }
137
-
138
- function extractTagTexts(html = "") {
139
- const tags = [];
140
- const regex = /<span\b[^>]*class=(["'])(.*?)\1[^>]*>([\s\S]*?)<\/span>/gi;
141
- let match;
142
- while ((match = regex.exec(String(html || "")))) {
143
- if (classList(match[2]).includes("tag-item")) {
144
- tags.push(textFromHtmlFragment(match[3]));
145
- }
146
- }
147
- return uniqueTexts(tags);
148
- }
149
-
150
- export function parseBossCandidateCardFieldsFromHtml(html = "") {
151
- const name = stripNameSuffixes(extractFirstSpanWithClass(html, "name"));
152
- const baseInfo = extractBaseInfo(html);
153
- const work = extractFirstTimelineContent(html, "work-exps");
154
- const education = extractFirstTimelineContent(html, "edu-exps");
155
- const educationDegree = education.map(parseDegreeValue).find(Boolean) || "";
156
- return {
157
- identity: {
158
- name: name && !isSalaryLike(name) ? name : "",
159
- current_company: work[0] || "",
160
- current_position: work[1] || "",
161
- school: education[0] || "",
162
- major: education[1] || "",
163
- degree: educationDegree || baseInfo.degree || "",
164
- age: baseInfo.age
165
- },
166
- salary: extractSalary(html),
167
- base_info: baseInfo.parts,
168
- work,
169
- education,
170
- tags: extractTagTexts(html)
171
- };
172
- }
173
-
174
- export function mergeBossCandidateCardFields(candidate, outerHTML = "", {
175
- metadataKey = "boss_card_fields"
176
- } = {}) {
177
- const parsed = parseBossCandidateCardFieldsFromHtml(outerHTML);
178
- const identity = { ...(candidate.identity || {}) };
179
- for (const [key, value] of Object.entries(parsed.identity || {})) {
180
- if (value !== "" && value !== null && value !== undefined) {
181
- identity[key] = value;
182
- }
183
- }
184
- return {
185
- ...candidate,
186
- identity,
187
- tags: uniqueTexts([...(candidate.tags || []), ...(parsed.tags || [])]),
188
- metadata: {
189
- ...(candidate.metadata || {}),
190
- [metadataKey]: {
191
- salary: parsed.salary || "",
192
- base_info: parsed.base_info || [],
193
- work: parsed.work || [],
194
- education: parsed.education || [],
195
- tags: parsed.tags || []
196
- }
197
- }
198
- };
199
- }
1
+ import { htmlToText, normalizeText } from "../screening/index.js";
2
+
3
+ function uniqueTexts(values = []) {
4
+ return Array.from(new Set(values.map((value) => normalizeText(value)).filter(Boolean)));
5
+ }
6
+
7
+ function classList(value = "") {
8
+ return String(value || "").split(/\s+/).map((item) => item.trim()).filter(Boolean);
9
+ }
10
+
11
+ function hasAllClasses(classValue = "", requiredClasses = []) {
12
+ const classes = classList(classValue);
13
+ return requiredClasses.every((required) => classes.includes(required));
14
+ }
15
+
16
+ function findClassAttributeIndex(html = "", requiredClasses = [], startIndex = 0) {
17
+ const regex = /class=(["'])(.*?)\1/gi;
18
+ regex.lastIndex = Math.max(0, Number(startIndex) || 0);
19
+ let match;
20
+ while ((match = regex.exec(String(html || "")))) {
21
+ if (hasAllClasses(match[2], requiredClasses)) return match.index;
22
+ }
23
+ return -1;
24
+ }
25
+
26
+ function sectionByClasses(html = "", startClasses = [], endClassGroups = []) {
27
+ const source = String(html || "");
28
+ const classIndex = findClassAttributeIndex(source, startClasses);
29
+ if (classIndex < 0) return "";
30
+ const start = Math.max(0, source.lastIndexOf("<", classIndex));
31
+ let end = source.length;
32
+ for (const group of endClassGroups) {
33
+ const found = findClassAttributeIndex(source, group, classIndex + 1);
34
+ if (found >= 0) {
35
+ const tagStart = source.lastIndexOf("<", found);
36
+ end = Math.min(end, tagStart >= 0 ? tagStart : found);
37
+ }
38
+ }
39
+ return source.slice(start, end);
40
+ }
41
+
42
+ function textFromHtmlFragment(fragment = "") {
43
+ return normalizeText(htmlToText(fragment).replace(/\n+/g, " "));
44
+ }
45
+
46
+ function stripNameSuffixes(value = "") {
47
+ return normalizeText(value)
48
+ .replace(/\s*(在线|刚刚活跃|今日活跃|本周活跃|本月活跃)$/u, "")
49
+ .trim();
50
+ }
51
+
52
+ function extractFirstSpanWithClass(html = "", className = "") {
53
+ const regex = /<span\b[^>]*class=(["'])(.*?)\1[^>]*>([\s\S]*?)<\/span>/gi;
54
+ let match;
55
+ while ((match = regex.exec(String(html || "")))) {
56
+ if (classList(match[2]).includes(className)) {
57
+ return textFromHtmlFragment(match[3]);
58
+ }
59
+ }
60
+ return "";
61
+ }
62
+
63
+ function extractSpanTexts(fragment = "") {
64
+ const values = [];
65
+ const regex = /<span\b[^>]*>([\s\S]*?)<\/span>/gi;
66
+ let match;
67
+ while ((match = regex.exec(String(fragment || "")))) {
68
+ values.push(textFromHtmlFragment(match[1]));
69
+ }
70
+ return uniqueTexts(values);
71
+ }
72
+
73
+ function extractDivTextsWithClasses(fragment = "", requiredClasses = []) {
74
+ const values = [];
75
+ const regex = /<div\b[^>]*class=(["'])(.*?)\1[^>]*>([\s\S]*?)<\/div>/gi;
76
+ let match;
77
+ while ((match = regex.exec(String(fragment || "")))) {
78
+ if (hasAllClasses(match[2], requiredClasses)) {
79
+ values.push(extractSpanTexts(match[3]));
80
+ }
81
+ }
82
+ return values.filter((items) => items.length);
83
+ }
84
+
85
+ function parseAgeValue(value = "") {
86
+ const match = normalizeText(value).match(/^(\d{2})岁$/u);
87
+ if (!match) return null;
88
+ const age = Number.parseInt(match[1], 10);
89
+ return Number.isFinite(age) ? age : null;
90
+ }
91
+
92
+ function parseDegreeValue(value = "") {
93
+ const normalized = normalizeText(value);
94
+ const match = normalized.match(/博士|硕士|本科|大专|专科|高中|中专\/中技|中专|中技|初中及以下/u);
95
+ return match ? match[0] : "";
96
+ }
97
+
98
+ function isSalaryLike(value = "") {
99
+ const normalized = normalizeText(value);
100
+ return Boolean(
101
+ /^(?:面议|薪资面议)$/i.test(normalized)
102
+ || /^\d+(?:\.\d+)?(?:\s*-\s*\d+(?:\.\d+)?)?\s*[kK](?:\s*[·xX*]\s*\d+\s*薪?)?$/.test(normalized)
103
+ || /^\d+\s*-\s*\d+\s*元\s*\/\s*天$/.test(normalized)
104
+ );
105
+ }
106
+
107
+ function extractSalary(html = "") {
108
+ const section = sectionByClasses(html, ["salary-wrap"], [
109
+ ["name-wrap"],
110
+ ["col-2"]
111
+ ]);
112
+ return extractSpanTexts(section).find(isSalaryLike) || "";
113
+ }
114
+
115
+ function extractBaseInfo(html = "") {
116
+ const section = sectionByClasses(html, ["base-info"], [
117
+ ["expect-wrap"],
118
+ ["geek-desc"],
119
+ ["timeline-wrap"]
120
+ ]);
121
+ const parts = extractSpanTexts(section);
122
+ return {
123
+ parts,
124
+ age: parts.map(parseAgeValue).find((value) => value != null) ?? null,
125
+ degree: parts.map(parseDegreeValue).find(Boolean) || ""
126
+ };
127
+ }
128
+
129
+ function extractFirstTimelineContent(html = "", timelineClass = "") {
130
+ const section = sectionByClasses(html, ["timeline-wrap", timelineClass], [
131
+ timelineClass === "work-exps" ? ["timeline-wrap", "edu-exps"] : ["card-btns"],
132
+ ["action-wrap"]
133
+ ]);
134
+ const contentRows = extractDivTextsWithClasses(section, ["join-text-wrap", "content"]);
135
+ return contentRows[0] || [];
136
+ }
137
+
138
+ function extractTagTexts(html = "") {
139
+ const tags = [];
140
+ const regex = /<span\b[^>]*class=(["'])(.*?)\1[^>]*>([\s\S]*?)<\/span>/gi;
141
+ let match;
142
+ while ((match = regex.exec(String(html || "")))) {
143
+ if (classList(match[2]).includes("tag-item")) {
144
+ tags.push(textFromHtmlFragment(match[3]));
145
+ }
146
+ }
147
+ return uniqueTexts(tags);
148
+ }
149
+
150
+ export function parseBossCandidateCardFieldsFromHtml(html = "") {
151
+ const name = stripNameSuffixes(extractFirstSpanWithClass(html, "name"));
152
+ const baseInfo = extractBaseInfo(html);
153
+ const work = extractFirstTimelineContent(html, "work-exps");
154
+ const education = extractFirstTimelineContent(html, "edu-exps");
155
+ const educationDegree = education.map(parseDegreeValue).find(Boolean) || "";
156
+ return {
157
+ identity: {
158
+ name: name && !isSalaryLike(name) ? name : "",
159
+ current_company: work[0] || "",
160
+ current_position: work[1] || "",
161
+ school: education[0] || "",
162
+ major: education[1] || "",
163
+ degree: educationDegree || baseInfo.degree || "",
164
+ age: baseInfo.age
165
+ },
166
+ salary: extractSalary(html),
167
+ base_info: baseInfo.parts,
168
+ work,
169
+ education,
170
+ tags: extractTagTexts(html)
171
+ };
172
+ }
173
+
174
+ export function mergeBossCandidateCardFields(candidate, outerHTML = "", {
175
+ metadataKey = "boss_card_fields"
176
+ } = {}) {
177
+ const parsed = parseBossCandidateCardFieldsFromHtml(outerHTML);
178
+ const identity = { ...(candidate.identity || {}) };
179
+ for (const [key, value] of Object.entries(parsed.identity || {})) {
180
+ if (value !== "" && value !== null && value !== undefined) {
181
+ identity[key] = value;
182
+ }
183
+ }
184
+ return {
185
+ ...candidate,
186
+ identity,
187
+ tags: uniqueTexts([...(candidate.tags || []), ...(parsed.tags || [])]),
188
+ metadata: {
189
+ ...(candidate.metadata || {}),
190
+ [metadataKey]: {
191
+ salary: parsed.salary || "",
192
+ base_info: parsed.base_info || [],
193
+ work: parsed.work || [],
194
+ education: parsed.education || [],
195
+ tags: parsed.tags || []
196
+ }
197
+ }
198
+ };
199
+ }