@reconcrap/boss-recommend-mcp 2.1.22 → 2.1.24

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 (66) hide show
  1. package/README.md +5 -0
  2. package/bin/boss-recommend-mcp.js +4 -4
  3. package/package.json +14 -8
  4. package/scripts/install-macos.sh +280 -280
  5. package/scripts/postinstall.cjs +44 -44
  6. package/skills/boss-chat/README.md +43 -42
  7. package/skills/boss-chat/SKILL.md +107 -106
  8. package/skills/boss-recommend-pipeline/README.md +13 -13
  9. package/skills/boss-recommend-pipeline/SKILL.md +47 -47
  10. package/skills/boss-recruit-pipeline/README.md +19 -19
  11. package/skills/boss-recruit-pipeline/SKILL.md +89 -89
  12. package/src/chat-mcp.js +301 -127
  13. package/src/core/boss-cards/index.js +199 -199
  14. package/src/core/browser/index.js +291 -114
  15. package/src/core/capture/index.js +2930 -1201
  16. package/src/core/cv-acquisition/index.js +512 -238
  17. package/src/core/cv-capture-target/index.js +513 -299
  18. package/src/core/greet-quota/index.js +71 -71
  19. package/src/core/infinite-list/index.js +11 -2
  20. package/src/core/reporting/legacy-csv.js +12 -12
  21. package/src/core/run/detached-launcher.js +305 -0
  22. package/src/core/run/index.js +112 -42
  23. package/src/core/run/timing.js +33 -33
  24. package/src/core/run/windows-detached-worker.ps1 +106 -0
  25. package/src/core/screening/index.js +2135 -2135
  26. package/src/core/self-heal/index.js +989 -973
  27. package/src/core/self-heal/viewport.js +1505 -564
  28. package/src/detached-worker.js +99 -99
  29. package/src/domains/chat/action-journal.js +443 -0
  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 +1684 -401
  33. package/src/domains/chat/index.js +8 -7
  34. package/src/domains/chat/jobs.js +620 -620
  35. package/src/domains/chat/page-guard.js +157 -122
  36. package/src/domains/chat/roots.js +56 -56
  37. package/src/domains/chat/run-service.js +1801 -760
  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 +515 -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 +92 -92
  44. package/src/domains/recommend/detail.js +12 -3
  45. package/src/domains/recommend/filters.js +611 -611
  46. package/src/domains/recommend/index.js +9 -9
  47. package/src/domains/recommend/jobs.js +542 -542
  48. package/src/domains/recommend/location.js +736 -736
  49. package/src/domains/recommend/refresh.js +410 -329
  50. package/src/domains/recommend/roots.js +80 -80
  51. package/src/domains/recommend/run-service.js +1783 -592
  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 +1817 -1620
  62. package/src/domains/recruit/search.js +3229 -3229
  63. package/src/index.js +124 -5
  64. package/src/parser.js +1296 -1296
  65. package/src/recommend-mcp.js +515 -80
  66. package/src/recommend-scheduler.js +66 -0
@@ -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
+ }