@reconcrap/boss-recommend-mcp 2.1.21 → 2.1.22

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 +8 -8
  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 +2419 -2415
  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 +1326 -1326
  23. package/src/core/reporting/legacy-csv.js +334 -332
  24. package/src/core/run/index.js +32 -32
  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 +650 -650
  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 +504 -361
  50. package/src/domains/recommend/roots.js +80 -80
  51. package/src/domains/recommend/run-service.js +987 -854
  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 +13 -0
  64. package/src/parser.js +376 -8
  65. package/src/recommend-mcp.js +929 -915
  66. package/src/recommend-scheduler.js +496 -496
  67. package/src/recruit-mcp.js +2121 -2121
@@ -1,99 +1,99 @@
1
- #!/usr/bin/env node
2
- import {
3
- markBossChatDetachedWorkerFailed,
4
- runBossChatDetachedWorker
5
- } from "./chat-mcp.js";
6
- import {
7
- markBossRecruitDetachedWorkerFailed,
8
- runBossRecruitDetachedWorker
9
- } from "./recruit-mcp.js";
10
-
11
- function normalizeText(value) {
12
- return String(value || "").replace(/\s+/g, " ").trim();
13
- }
14
-
15
- function parseArgs(argv = []) {
16
- const args = {};
17
- for (let index = 0; index < argv.length; index += 1) {
18
- const item = argv[index];
19
- if (item === "--domain") {
20
- args.domain = normalizeText(argv[index + 1]).toLowerCase();
21
- index += 1;
22
- } else if (item === "--run-id") {
23
- args.runId = normalizeText(argv[index + 1]);
24
- index += 1;
25
- }
26
- }
27
- return args;
28
- }
29
-
30
- function markFailed(domain, runId, error, options = {}) {
31
- if (domain === "chat") {
32
- return markBossChatDetachedWorkerFailed(runId, error, options);
33
- }
34
- if (domain === "recruit") {
35
- return markBossRecruitDetachedWorkerFailed(runId, error, options);
36
- }
37
- return null;
38
- }
39
-
40
- function installFailureHandlers(domain, runId) {
41
- let handled = false;
42
- const failOnce = (error, options = {}) => {
43
- if (handled) return;
44
- handled = true;
45
- try {
46
- markFailed(domain, runId, error, options);
47
- } catch (markError) {
48
- console.error("[boss-recommend-mcp] failed to persist detached worker failure", markError);
49
- }
50
- };
51
-
52
- process.on("uncaughtException", (error) => {
53
- console.error("[boss-recommend-mcp] detached worker uncaught exception", error);
54
- failOnce(error, { code: "DETACHED_WORKER_UNCAUGHT_EXCEPTION" });
55
- process.exit(1);
56
- });
57
-
58
- process.on("unhandledRejection", (reason) => {
59
- console.error("[boss-recommend-mcp] detached worker unhandled rejection", reason);
60
- const error = reason instanceof Error ? reason : new Error(normalizeText(reason) || "Unhandled promise rejection");
61
- failOnce(error, { code: "DETACHED_WORKER_UNHANDLED_REJECTION" });
62
- process.exit(1);
63
- });
64
-
65
- for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"]) {
66
- process.on(signal, () => {
67
- const error = new Error(`detached ${domain} worker received ${signal}`);
68
- console.error("[boss-recommend-mcp] detached worker received signal", signal);
69
- failOnce(error, { code: "DETACHED_WORKER_SIGNAL" });
70
- const signalExitCodes = { SIGHUP: 129, SIGINT: 130, SIGTERM: 143 };
71
- process.exit(signalExitCodes[signal] || 1);
72
- });
73
- }
74
- }
75
-
76
- async function main() {
77
- const options = parseArgs(process.argv.slice(2));
78
- if (!options.domain || !options.runId) {
79
- console.error("[boss-recommend-mcp] detached worker requires --domain and --run-id");
80
- process.exitCode = 1;
81
- return;
82
- }
83
- installFailureHandlers(options.domain, options.runId);
84
- const result = options.domain === "chat"
85
- ? await runBossChatDetachedWorker({ runId: options.runId })
86
- : options.domain === "recruit"
87
- ? await runBossRecruitDetachedWorker({ runId: options.runId })
88
- : { ok: false, error: `Unsupported detached worker domain: ${options.domain}` };
89
- if (!result?.ok) {
90
- process.exitCode = 1;
91
- }
92
- }
93
-
94
- await main().catch((error) => {
95
- const options = parseArgs(process.argv.slice(2));
96
- console.error("[boss-recommend-mcp] detached worker failed", error);
97
- markFailed(options.domain, options.runId, error, { code: "DETACHED_WORKER_FAILED" });
98
- process.exitCode = 1;
99
- });
1
+ #!/usr/bin/env node
2
+ import {
3
+ markBossChatDetachedWorkerFailed,
4
+ runBossChatDetachedWorker
5
+ } from "./chat-mcp.js";
6
+ import {
7
+ markBossRecruitDetachedWorkerFailed,
8
+ runBossRecruitDetachedWorker
9
+ } from "./recruit-mcp.js";
10
+
11
+ function normalizeText(value) {
12
+ return String(value || "").replace(/\s+/g, " ").trim();
13
+ }
14
+
15
+ function parseArgs(argv = []) {
16
+ const args = {};
17
+ for (let index = 0; index < argv.length; index += 1) {
18
+ const item = argv[index];
19
+ if (item === "--domain") {
20
+ args.domain = normalizeText(argv[index + 1]).toLowerCase();
21
+ index += 1;
22
+ } else if (item === "--run-id") {
23
+ args.runId = normalizeText(argv[index + 1]);
24
+ index += 1;
25
+ }
26
+ }
27
+ return args;
28
+ }
29
+
30
+ function markFailed(domain, runId, error, options = {}) {
31
+ if (domain === "chat") {
32
+ return markBossChatDetachedWorkerFailed(runId, error, options);
33
+ }
34
+ if (domain === "recruit") {
35
+ return markBossRecruitDetachedWorkerFailed(runId, error, options);
36
+ }
37
+ return null;
38
+ }
39
+
40
+ function installFailureHandlers(domain, runId) {
41
+ let handled = false;
42
+ const failOnce = (error, options = {}) => {
43
+ if (handled) return;
44
+ handled = true;
45
+ try {
46
+ markFailed(domain, runId, error, options);
47
+ } catch (markError) {
48
+ console.error("[boss-recommend-mcp] failed to persist detached worker failure", markError);
49
+ }
50
+ };
51
+
52
+ process.on("uncaughtException", (error) => {
53
+ console.error("[boss-recommend-mcp] detached worker uncaught exception", error);
54
+ failOnce(error, { code: "DETACHED_WORKER_UNCAUGHT_EXCEPTION" });
55
+ process.exit(1);
56
+ });
57
+
58
+ process.on("unhandledRejection", (reason) => {
59
+ console.error("[boss-recommend-mcp] detached worker unhandled rejection", reason);
60
+ const error = reason instanceof Error ? reason : new Error(normalizeText(reason) || "Unhandled promise rejection");
61
+ failOnce(error, { code: "DETACHED_WORKER_UNHANDLED_REJECTION" });
62
+ process.exit(1);
63
+ });
64
+
65
+ for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"]) {
66
+ process.on(signal, () => {
67
+ const error = new Error(`detached ${domain} worker received ${signal}`);
68
+ console.error("[boss-recommend-mcp] detached worker received signal", signal);
69
+ failOnce(error, { code: "DETACHED_WORKER_SIGNAL" });
70
+ const signalExitCodes = { SIGHUP: 129, SIGINT: 130, SIGTERM: 143 };
71
+ process.exit(signalExitCodes[signal] || 1);
72
+ });
73
+ }
74
+ }
75
+
76
+ async function main() {
77
+ const options = parseArgs(process.argv.slice(2));
78
+ if (!options.domain || !options.runId) {
79
+ console.error("[boss-recommend-mcp] detached worker requires --domain and --run-id");
80
+ process.exitCode = 1;
81
+ return;
82
+ }
83
+ installFailureHandlers(options.domain, options.runId);
84
+ const result = options.domain === "chat"
85
+ ? await runBossChatDetachedWorker({ runId: options.runId })
86
+ : options.domain === "recruit"
87
+ ? await runBossRecruitDetachedWorker({ runId: options.runId })
88
+ : { ok: false, error: `Unsupported detached worker domain: ${options.domain}` };
89
+ if (!result?.ok) {
90
+ process.exitCode = 1;
91
+ }
92
+ }
93
+
94
+ await main().catch((error) => {
95
+ const options = parseArgs(process.argv.slice(2));
96
+ console.error("[boss-recommend-mcp] detached worker failed", error);
97
+ markFailed(options.domain, options.runId, error, { code: "DETACHED_WORKER_FAILED" });
98
+ process.exitCode = 1;
99
+ });
@@ -1,137 +1,137 @@
1
- import { candidateKeyFromProfile } from "../../core/infinite-list/index.js";
2
- import {
3
- getAttributesMap,
4
- getOuterHTML,
5
- querySelectorAll,
6
- sleep
7
- } from "../../core/browser/index.js";
8
- import { mergeBossCandidateCardFields } from "../../core/boss-cards/index.js";
9
- import {
10
- htmlToText,
11
- normalizeCandidateProfile,
12
- normalizeText
13
- } from "../../core/screening/index.js";
14
- import { CHAT_CARD_SELECTORS } from "./constants.js";
15
-
16
- function firstCandidateId(attributes = {}) {
17
- return normalizeText(
18
- attributes["data-id"]
19
- || attributes["data-geekid"]
20
- || attributes["data-geek"]
21
- || attributes["data-uid"]
22
- || attributes.key
23
- || attributes.id
24
- || ""
25
- ) || null;
26
- }
27
-
28
- function mergeChatCardFields(candidate, outerHTML = "") {
29
- return mergeBossCandidateCardFields(candidate, outerHTML, {
30
- metadataKey: "chat_card_fields"
31
- });
32
- }
33
-
34
- export async function findChatCandidateNodeIds(client, rootNodeId, {
35
- selectors = CHAT_CARD_SELECTORS
36
- } = {}) {
37
- for (const selector of selectors) {
38
- let nodeIds = [];
39
- try {
40
- nodeIds = await querySelectorAll(client, rootNodeId, selector);
41
- } catch {
42
- nodeIds = [];
43
- }
44
- if (nodeIds.length) {
45
- return {
46
- selector,
47
- nodeIds
48
- };
49
- }
50
- }
51
- return {
52
- selector: "",
53
- nodeIds: []
54
- };
55
- }
56
-
57
- export function chatCandidateKeyFromProfile(candidate = {}, options = {}) {
58
- const id = normalizeText(candidate.id);
59
- if (id) return `${candidate.domain || "chat"}:id:${id}`;
60
- return candidateKeyFromProfile(candidate, options);
61
- }
62
-
63
- export async function findChatCandidateNodeIdById(client, rootNodeId, candidateId, {
64
- selectors = CHAT_CARD_SELECTORS
65
- } = {}) {
66
- const expectedId = normalizeText(candidateId);
67
- if (!expectedId) return 0;
68
- const result = await findChatCandidateNodeIds(client, rootNodeId, { selectors });
69
- for (const nodeId of result.nodeIds || []) {
70
- try {
71
- const attributes = await getAttributesMap(client, nodeId);
72
- if (firstCandidateId(attributes) === expectedId) return nodeId;
73
- } catch {
74
- // Boss can remount chat cards while the list is active; keep scanning.
75
- }
76
- }
77
- return 0;
78
- }
79
-
80
- export async function waitForChatCandidateNodeIds(client, rootNodeId, {
81
- selectors = CHAT_CARD_SELECTORS,
82
- timeoutMs = 12000,
83
- intervalMs = 300
84
- } = {}) {
85
- const started = Date.now();
86
- let result = {
87
- selector: "",
88
- nodeIds: []
89
- };
90
- while (Date.now() - started <= timeoutMs) {
91
- result = await findChatCandidateNodeIds(client, rootNodeId, { selectors });
92
- if (result.nodeIds.length) return result;
93
- await sleep(intervalMs);
94
- }
95
- return result;
96
- }
97
-
98
- export async function readChatCardCandidate(client, cardNodeId, {
99
- targetUrl = "",
100
- source = "chat-domain-card",
101
- metadata = {}
102
- } = {}) {
103
- const [attributes, outerHTML] = await Promise.all([
104
- getAttributesMap(client, cardNodeId),
105
- getOuterHTML(client, cardNodeId)
106
- ]);
107
- const candidate = normalizeCandidateProfile({
108
- domain: "chat",
109
- source,
110
- id: firstCandidateId(attributes),
111
- text: htmlToText(outerHTML),
112
- attributes,
113
- metadata: {
114
- target_url: targetUrl,
115
- card_node_id: cardNodeId,
116
- html_length: outerHTML.length,
117
- ...metadata
118
- }
119
- });
120
- return mergeChatCardFields(candidate, outerHTML);
121
- }
122
-
123
- export async function readFirstChatCardCandidate(client, rootNodeId, options = {}) {
124
- const cardResult = await findChatCandidateNodeIds(client, rootNodeId, options);
125
- if (!cardResult.nodeIds.length) {
126
- throw new Error("No chat candidate conversation cards found");
127
- }
128
-
129
- const candidate = await readChatCardCandidate(client, cardResult.nodeIds[0], options);
130
- return {
131
- card_count: cardResult.nodeIds.length,
132
- selector: cardResult.selector,
133
- first_card_node_id: cardResult.nodeIds[0],
134
- card_node_ids: cardResult.nodeIds,
135
- candidate
136
- };
137
- }
1
+ import { candidateKeyFromProfile } from "../../core/infinite-list/index.js";
2
+ import {
3
+ getAttributesMap,
4
+ getOuterHTML,
5
+ querySelectorAll,
6
+ sleep
7
+ } from "../../core/browser/index.js";
8
+ import { mergeBossCandidateCardFields } from "../../core/boss-cards/index.js";
9
+ import {
10
+ htmlToText,
11
+ normalizeCandidateProfile,
12
+ normalizeText
13
+ } from "../../core/screening/index.js";
14
+ import { CHAT_CARD_SELECTORS } from "./constants.js";
15
+
16
+ function firstCandidateId(attributes = {}) {
17
+ return normalizeText(
18
+ attributes["data-id"]
19
+ || attributes["data-geekid"]
20
+ || attributes["data-geek"]
21
+ || attributes["data-uid"]
22
+ || attributes.key
23
+ || attributes.id
24
+ || ""
25
+ ) || null;
26
+ }
27
+
28
+ function mergeChatCardFields(candidate, outerHTML = "") {
29
+ return mergeBossCandidateCardFields(candidate, outerHTML, {
30
+ metadataKey: "chat_card_fields"
31
+ });
32
+ }
33
+
34
+ export async function findChatCandidateNodeIds(client, rootNodeId, {
35
+ selectors = CHAT_CARD_SELECTORS
36
+ } = {}) {
37
+ for (const selector of selectors) {
38
+ let nodeIds = [];
39
+ try {
40
+ nodeIds = await querySelectorAll(client, rootNodeId, selector);
41
+ } catch {
42
+ nodeIds = [];
43
+ }
44
+ if (nodeIds.length) {
45
+ return {
46
+ selector,
47
+ nodeIds
48
+ };
49
+ }
50
+ }
51
+ return {
52
+ selector: "",
53
+ nodeIds: []
54
+ };
55
+ }
56
+
57
+ export function chatCandidateKeyFromProfile(candidate = {}, options = {}) {
58
+ const id = normalizeText(candidate.id);
59
+ if (id) return `${candidate.domain || "chat"}:id:${id}`;
60
+ return candidateKeyFromProfile(candidate, options);
61
+ }
62
+
63
+ export async function findChatCandidateNodeIdById(client, rootNodeId, candidateId, {
64
+ selectors = CHAT_CARD_SELECTORS
65
+ } = {}) {
66
+ const expectedId = normalizeText(candidateId);
67
+ if (!expectedId) return 0;
68
+ const result = await findChatCandidateNodeIds(client, rootNodeId, { selectors });
69
+ for (const nodeId of result.nodeIds || []) {
70
+ try {
71
+ const attributes = await getAttributesMap(client, nodeId);
72
+ if (firstCandidateId(attributes) === expectedId) return nodeId;
73
+ } catch {
74
+ // Boss can remount chat cards while the list is active; keep scanning.
75
+ }
76
+ }
77
+ return 0;
78
+ }
79
+
80
+ export async function waitForChatCandidateNodeIds(client, rootNodeId, {
81
+ selectors = CHAT_CARD_SELECTORS,
82
+ timeoutMs = 12000,
83
+ intervalMs = 300
84
+ } = {}) {
85
+ const started = Date.now();
86
+ let result = {
87
+ selector: "",
88
+ nodeIds: []
89
+ };
90
+ while (Date.now() - started <= timeoutMs) {
91
+ result = await findChatCandidateNodeIds(client, rootNodeId, { selectors });
92
+ if (result.nodeIds.length) return result;
93
+ await sleep(intervalMs);
94
+ }
95
+ return result;
96
+ }
97
+
98
+ export async function readChatCardCandidate(client, cardNodeId, {
99
+ targetUrl = "",
100
+ source = "chat-domain-card",
101
+ metadata = {}
102
+ } = {}) {
103
+ const [attributes, outerHTML] = await Promise.all([
104
+ getAttributesMap(client, cardNodeId),
105
+ getOuterHTML(client, cardNodeId)
106
+ ]);
107
+ const candidate = normalizeCandidateProfile({
108
+ domain: "chat",
109
+ source,
110
+ id: firstCandidateId(attributes),
111
+ text: htmlToText(outerHTML),
112
+ attributes,
113
+ metadata: {
114
+ target_url: targetUrl,
115
+ card_node_id: cardNodeId,
116
+ html_length: outerHTML.length,
117
+ ...metadata
118
+ }
119
+ });
120
+ return mergeChatCardFields(candidate, outerHTML);
121
+ }
122
+
123
+ export async function readFirstChatCardCandidate(client, rootNodeId, options = {}) {
124
+ const cardResult = await findChatCandidateNodeIds(client, rootNodeId, options);
125
+ if (!cardResult.nodeIds.length) {
126
+ throw new Error("No chat candidate conversation cards found");
127
+ }
128
+
129
+ const candidate = await readChatCardCandidate(client, cardResult.nodeIds[0], options);
130
+ return {
131
+ card_count: cardResult.nodeIds.length,
132
+ selector: cardResult.selector,
133
+ first_card_node_id: cardResult.nodeIds[0],
134
+ card_node_ids: cardResult.nodeIds,
135
+ candidate
136
+ };
137
+ }
@@ -1,9 +1,9 @@
1
- import {
2
- BOSS_ACCOUNT_RIGHTS_PANEL_CLOSE_SELECTORS,
3
- BOSS_ACCOUNT_RIGHTS_PANEL_TEXT_QUERIES
4
- } from "../common/account-rights-panel.js";
5
-
6
- export const CHAT_TARGET_URL = "https://www.zhipin.com/web/chat/index";
1
+ import {
2
+ BOSS_ACCOUNT_RIGHTS_PANEL_CLOSE_SELECTORS,
3
+ BOSS_ACCOUNT_RIGHTS_PANEL_TEXT_QUERIES
4
+ } from "../common/account-rights-panel.js";
5
+
6
+ export const CHAT_TARGET_URL = "https://www.zhipin.com/web/chat/index";
7
7
 
8
8
  export const CHAT_CARD_SELECTORS = Object.freeze([
9
9
  ".geek-item[data-id]",
@@ -213,9 +213,9 @@ export const CHAT_RESUME_CLOSE_SELECTORS = Object.freeze([
213
213
  '[title*="关闭"]'
214
214
  ]);
215
215
 
216
- export const CHAT_BLOCKING_PANEL_TEXT_QUERIES = BOSS_ACCOUNT_RIGHTS_PANEL_TEXT_QUERIES;
217
-
218
- export const CHAT_BLOCKING_PANEL_CLOSE_SELECTORS = BOSS_ACCOUNT_RIGHTS_PANEL_CLOSE_SELECTORS;
216
+ export const CHAT_BLOCKING_PANEL_TEXT_QUERIES = BOSS_ACCOUNT_RIGHTS_PANEL_TEXT_QUERIES;
217
+
218
+ export const CHAT_BLOCKING_PANEL_CLOSE_SELECTORS = BOSS_ACCOUNT_RIGHTS_PANEL_CLOSE_SELECTORS;
219
219
 
220
220
  export const CHAT_PROFILE_NETWORK_PATTERNS = Object.freeze([
221
221
  /\/wapi\/zpjob\/view\/geek\/info(?:\/v2)?\b/i,