@reconcrap/boss-recommend-mcp 2.1.21 → 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.
Files changed (67) hide show
  1. package/README.md +5 -2
  2. package/bin/boss-recommend-mcp.js +4 -4
  3. package/config/screening-config.example.json +33 -33
  4. package/package.json +2 -1
  5. package/scripts/install-macos.sh +280 -280
  6. package/scripts/postinstall.cjs +44 -44
  7. package/skills/boss-chat/README.md +42 -42
  8. package/skills/boss-chat/SKILL.md +106 -106
  9. package/skills/boss-recommend-pipeline/README.md +13 -13
  10. package/skills/boss-recommend-pipeline/SKILL.md +219 -214
  11. package/skills/boss-recruit-pipeline/README.md +19 -19
  12. package/skills/boss-recruit-pipeline/SKILL.md +89 -89
  13. package/src/chat-mcp.js +127 -127
  14. package/src/chat-runtime-config.js +775 -775
  15. package/src/cli.js +573 -573
  16. package/src/core/boss-cards/index.js +199 -199
  17. package/src/core/browser/index.js +2416 -2385
  18. package/src/core/capture/index.js +1201 -1201
  19. package/src/core/cv-acquisition/index.js +238 -238
  20. package/src/core/cv-capture-target/index.js +299 -299
  21. package/src/core/greet-quota/index.js +71 -71
  22. package/src/core/infinite-list/index.js +1315 -1306
  23. package/src/core/reporting/legacy-csv.js +334 -332
  24. package/src/core/run/index.js +44 -27
  25. package/src/core/run/timing.js +33 -33
  26. package/src/core/screening/index.js +2135 -2135
  27. package/src/core/self-heal/index.js +973 -973
  28. package/src/core/self-heal/viewport.js +564 -564
  29. package/src/detached-worker.js +99 -99
  30. package/src/domains/chat/cards.js +137 -137
  31. package/src/domains/chat/constants.js +9 -9
  32. package/src/domains/chat/detail.js +113 -113
  33. package/src/domains/chat/index.js +7 -7
  34. package/src/domains/chat/jobs.js +620 -620
  35. package/src/domains/chat/page-guard.js +122 -122
  36. package/src/domains/chat/roots.js +56 -56
  37. package/src/domains/chat/run-service.js +571 -571
  38. package/src/domains/common/account-rights-panel.js +314 -314
  39. package/src/domains/common/recovery-settle.js +159 -159
  40. package/src/domains/recommend/actions.js +472 -472
  41. package/src/domains/recommend/cards.js +243 -243
  42. package/src/domains/recommend/colleague-contact.js +333 -333
  43. package/src/domains/recommend/constants.js +228 -159
  44. package/src/domains/recommend/detail.js +655 -646
  45. package/src/domains/recommend/filters.js +748 -377
  46. package/src/domains/recommend/index.js +4 -3
  47. package/src/domains/recommend/jobs.js +542 -542
  48. package/src/domains/recommend/location.js +736 -0
  49. package/src/domains/recommend/refresh.js +575 -351
  50. package/src/domains/recommend/roots.js +80 -80
  51. package/src/domains/recommend/run-service.js +1616 -878
  52. package/src/domains/recommend/scopes.js +246 -246
  53. package/src/domains/recruit/actions.js +277 -277
  54. package/src/domains/recruit/cards.js +74 -74
  55. package/src/domains/recruit/constants.js +236 -236
  56. package/src/domains/recruit/detail.js +588 -588
  57. package/src/domains/recruit/index.js +9 -9
  58. package/src/domains/recruit/instruction-parser.js +866 -866
  59. package/src/domains/recruit/refresh.js +45 -45
  60. package/src/domains/recruit/roots.js +68 -68
  61. package/src/domains/recruit/run-service.js +1620 -1620
  62. package/src/domains/recruit/search.js +3229 -3229
  63. package/src/index.js +121 -4
  64. package/src/parser.js +376 -8
  65. package/src/recommend-mcp.js +1174 -914
  66. package/src/recommend-scheduler.js +535 -469
  67. package/src/recruit-mcp.js +2121 -2121
@@ -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
+ }