@reconcrap/boss-recommend-mcp 2.1.23 → 2.1.25

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 -0
  2. package/bin/boss-recommend-mcp.js +4 -4
  3. package/package.json +6 -1
  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/chat-runtime-config.js +7 -5
  14. package/src/core/boss-cards/index.js +199 -199
  15. package/src/core/browser/index.js +302 -145
  16. package/src/core/capture/index.js +2930 -1201
  17. package/src/core/cv-acquisition/index.js +512 -238
  18. package/src/core/cv-capture-target/index.js +513 -299
  19. package/src/core/greet-quota/index.js +71 -71
  20. package/src/core/infinite-list/index.js +31 -31
  21. package/src/core/reporting/legacy-csv.js +12 -12
  22. package/src/core/run/detached-launcher.js +305 -0
  23. package/src/core/run/index.js +109 -55
  24. package/src/core/run/timing.js +33 -33
  25. package/src/core/run/windows-detached-worker.ps1 +106 -0
  26. package/src/core/screening/index.js +2400 -2135
  27. package/src/core/self-heal/index.js +989 -973
  28. package/src/core/self-heal/viewport.js +1505 -564
  29. package/src/detached-worker.js +99 -99
  30. package/src/domains/chat/action-journal.js +536 -0
  31. package/src/domains/chat/cards.js +137 -137
  32. package/src/domains/chat/constants.js +9 -9
  33. package/src/domains/chat/detail.js +1684 -401
  34. package/src/domains/chat/index.js +8 -7
  35. package/src/domains/chat/jobs.js +620 -620
  36. package/src/domains/chat/page-guard.js +157 -122
  37. package/src/domains/chat/roots.js +56 -56
  38. package/src/domains/chat/run-service.js +1801 -760
  39. package/src/domains/common/account-rights-panel.js +314 -314
  40. package/src/domains/common/recovery-settle.js +159 -159
  41. package/src/domains/recommend/actions.js +1219 -472
  42. package/src/domains/recommend/cards.js +243 -243
  43. package/src/domains/recommend/colleague-contact.js +1079 -333
  44. package/src/domains/recommend/constants.js +92 -92
  45. package/src/domains/recommend/detail.js +4037 -136
  46. package/src/domains/recommend/filters.js +608 -590
  47. package/src/domains/recommend/index.js +9 -9
  48. package/src/domains/recommend/jobs.js +571 -542
  49. package/src/domains/recommend/location.js +754 -707
  50. package/src/domains/recommend/refresh.js +677 -392
  51. package/src/domains/recommend/roots.js +80 -80
  52. package/src/domains/recommend/run-service.js +4048 -1447
  53. package/src/domains/recommend/scopes.js +246 -246
  54. package/src/domains/recruit/actions.js +277 -277
  55. package/src/domains/recruit/cards.js +74 -74
  56. package/src/domains/recruit/constants.js +236 -236
  57. package/src/domains/recruit/detail.js +588 -588
  58. package/src/domains/recruit/index.js +9 -9
  59. package/src/domains/recruit/instruction-parser.js +866 -866
  60. package/src/domains/recruit/refresh.js +45 -45
  61. package/src/domains/recruit/roots.js +68 -68
  62. package/src/domains/recruit/run-service.js +1817 -1620
  63. package/src/domains/recruit/search.js +3229 -3229
  64. package/src/index.js +16 -1
  65. package/src/parser.js +1296 -1296
  66. package/src/recommend-mcp.js +1061 -450
  67. package/src/recommend-scheduler.js +75 -75
@@ -1,122 +1,157 @@
1
- import {
2
- getMainFrameUrl,
3
- sleep,
4
- waitForMainFrameUrl
5
- } from "../../core/browser/index.js";
6
- import {
7
- buildChatSelfHealConfig,
8
- resolveChatSelfHealRoots
9
- } from "../../core/self-heal/index.js";
10
- import {
11
- createRecoverySettleError,
12
- waitForMiniFreshStartSettle
13
- } from "../common/recovery-settle.js";
14
- import { CHAT_TARGET_URL } from "./constants.js";
15
-
16
- export const CHAT_FORBIDDEN_TOP_LEVEL_RESUME_CODE = "CHAT_FORBIDDEN_TOP_LEVEL_RESUME_NAVIGATION";
17
-
18
- export function isChatShellUrl(url = "") {
19
- const value = String(url || "");
20
- return /https?:\/\/[^/]*zhipin\.com\/web\/chat\/index(?:[/?#]|$)/i.test(value)
21
- || /https?:\/\/[^/]*zhipin\.com\/web\/chat\/index$/i.test(value);
22
- }
23
-
24
- export function isForbiddenChatResumeTopLevelUrl(url = "") {
25
- return /https?:\/\/[^/]*zhipin\.com\/web\/frame\/c-resume\/?/i.test(String(url || ""));
26
- }
27
-
28
- export async function getChatTopLevelState(client) {
29
- let url = "";
30
- let error = null;
31
- try {
32
- url = await getMainFrameUrl(client);
33
- } catch (err) {
34
- error = err?.message || String(err);
35
- }
36
- return {
37
- url,
38
- is_chat_shell: isChatShellUrl(url),
39
- is_forbidden_resume_top_level: isForbiddenChatResumeTopLevelUrl(url),
40
- error
41
- };
42
- }
43
-
44
- export function makeForbiddenChatResumeNavigationError(pageState, message = "") {
45
- const error = new Error(message || `Chat tab navigated to forbidden top-level resume URL: ${pageState?.url || "unknown"}`);
46
- error.code = CHAT_FORBIDDEN_TOP_LEVEL_RESUME_CODE;
47
- error.page_state = pageState || null;
48
- return error;
49
- }
50
-
51
- export function isForbiddenChatResumeNavigationError(error) {
52
- return error?.code === CHAT_FORBIDDEN_TOP_LEVEL_RESUME_CODE
53
- || /CHAT_FORBIDDEN_TOP_LEVEL_RESUME_NAVIGATION/i.test(String(error?.message || error || ""));
54
- }
55
-
56
- export async function assertChatShellNotResumeTopLevel(client, {
57
- context = "chat"
58
- } = {}) {
59
- const state = await getChatTopLevelState(client);
60
- if (state.is_forbidden_resume_top_level) {
61
- throw makeForbiddenChatResumeNavigationError(
62
- state,
63
- `CHAT_FORBIDDEN_TOP_LEVEL_RESUME_NAVIGATION during ${context}: ${state.url}`
64
- );
65
- }
66
- return state;
67
- }
68
-
69
- export async function recoverChatShell(client, {
70
- targetUrl = CHAT_TARGET_URL,
71
- timeoutMs = 60000,
72
- intervalMs = 500,
73
- forceNavigate = false,
74
- settleMs = 1200,
75
- settleAfterNavigate = false
76
- } = {}) {
77
- const before = await getChatTopLevelState(client);
78
- if (before.is_chat_shell && !forceNavigate) {
79
- return {
80
- recovered: false,
81
- before,
82
- after: before,
83
- navigate_url: null,
84
- force_navigate: false
85
- };
86
- }
87
-
88
- const navigateResult = await client.Page.navigate({ url: targetUrl });
89
- if (forceNavigate && settleMs > 0) {
90
- await sleep(settleMs);
91
- }
92
- const waited = await waitForMainFrameUrl(client, isChatShellUrl, {
93
- timeoutMs,
94
- intervalMs
95
- });
96
- const after = await getChatTopLevelState(client);
97
- let miniFreshStart = null;
98
- if (after.is_chat_shell && settleAfterNavigate) {
99
- miniFreshStart = await waitForMiniFreshStartSettle(client, {
100
- domain: "chat",
101
- timeoutMs,
102
- intervalMs: Math.max(intervalMs, 800),
103
- settleMs: Math.min(settleMs, 5000),
104
- selfHealConfig: buildChatSelfHealConfig(),
105
- resolveSelfHealRoots: resolveChatSelfHealRoots
106
- });
107
- if (!miniFreshStart.ok) {
108
- throw createRecoverySettleError("chat", miniFreshStart);
109
- }
110
- }
111
- return {
112
- recovered: waited.ok && after.is_chat_shell,
113
- refreshed: Boolean(forceNavigate && before.is_chat_shell && after.is_chat_shell),
114
- before,
115
- after,
116
- mini_fresh_start: miniFreshStart,
117
- wait: waited,
118
- navigate_result: navigateResult || null,
119
- navigate_url: targetUrl,
120
- force_navigate: Boolean(forceNavigate)
121
- };
122
- }
1
+ import {
2
+ getMainFrameUrl,
3
+ sleep,
4
+ waitForMainFrameUrl
5
+ } from "../../core/browser/index.js";
6
+ import {
7
+ buildChatSelfHealConfig,
8
+ resolveChatSelfHealRoots
9
+ } from "../../core/self-heal/index.js";
10
+ import {
11
+ createRecoverySettleError,
12
+ waitForMiniFreshStartSettle
13
+ } from "../common/recovery-settle.js";
14
+ import { CHAT_TARGET_URL } from "./constants.js";
15
+
16
+ export const CHAT_FORBIDDEN_TOP_LEVEL_RESUME_CODE = "CHAT_FORBIDDEN_TOP_LEVEL_RESUME_NAVIGATION";
17
+ export const BOSS_SECURITY_VERIFICATION_REQUIRED_CODE = "BOSS_SECURITY_VERIFICATION_REQUIRED";
18
+
19
+ export function isChatShellUrl(url = "") {
20
+ const value = String(url || "");
21
+ return /https?:\/\/[^/]*zhipin\.com\/web\/chat\/index(?:[/?#]|$)/i.test(value)
22
+ || /https?:\/\/[^/]*zhipin\.com\/web\/chat\/index$/i.test(value);
23
+ }
24
+
25
+ export function isForbiddenChatResumeTopLevelUrl(url = "") {
26
+ return /https?:\/\/[^/]*zhipin\.com\/web\/frame\/c-resume\/?/i.test(String(url || ""));
27
+ }
28
+
29
+ export function isBossSecurityVerificationUrl(url = "") {
30
+ return /https?:\/\/[^/]*zhipin\.com\/web\/passport\/zp\/verify\.html(?:[?#]|$)/i.test(String(url || ""));
31
+ }
32
+
33
+ export async function getChatTopLevelState(client) {
34
+ let url = "";
35
+ let error = null;
36
+ try {
37
+ url = await getMainFrameUrl(client);
38
+ } catch (err) {
39
+ error = err?.message || String(err);
40
+ }
41
+ return {
42
+ url,
43
+ is_chat_shell: isChatShellUrl(url),
44
+ is_forbidden_resume_top_level: isForbiddenChatResumeTopLevelUrl(url),
45
+ is_security_verification: isBossSecurityVerificationUrl(url),
46
+ error
47
+ };
48
+ }
49
+
50
+ export function makeBossSecurityVerificationRequiredError(pageState, context = "chat") {
51
+ const error = new Error(
52
+ `BOSS_SECURITY_VERIFICATION_REQUIRED during ${context}: ${pageState?.url || "unknown"}`
53
+ );
54
+ error.code = BOSS_SECURITY_VERIFICATION_REQUIRED_CODE;
55
+ error.requires_user_verification = true;
56
+ error.retryable = true;
57
+ error.page_state = pageState || null;
58
+ return error;
59
+ }
60
+
61
+ export function isBossSecurityVerificationRequiredError(error) {
62
+ return error?.code === BOSS_SECURITY_VERIFICATION_REQUIRED_CODE
63
+ || /BOSS_SECURITY_VERIFICATION_REQUIRED/i.test(String(error?.message || error || ""));
64
+ }
65
+
66
+ export function makeForbiddenChatResumeNavigationError(pageState, message = "") {
67
+ const error = new Error(message || `Chat tab navigated to forbidden top-level resume URL: ${pageState?.url || "unknown"}`);
68
+ error.code = CHAT_FORBIDDEN_TOP_LEVEL_RESUME_CODE;
69
+ error.page_state = pageState || null;
70
+ return error;
71
+ }
72
+
73
+ export function isForbiddenChatResumeNavigationError(error) {
74
+ return error?.code === CHAT_FORBIDDEN_TOP_LEVEL_RESUME_CODE
75
+ || /CHAT_FORBIDDEN_TOP_LEVEL_RESUME_NAVIGATION/i.test(String(error?.message || error || ""));
76
+ }
77
+
78
+ export async function assertChatShellNotResumeTopLevel(client, {
79
+ context = "chat"
80
+ } = {}) {
81
+ const state = await getChatTopLevelState(client);
82
+ if (state.is_security_verification) {
83
+ throw makeBossSecurityVerificationRequiredError(state, context);
84
+ }
85
+ if (state.is_forbidden_resume_top_level) {
86
+ throw makeForbiddenChatResumeNavigationError(
87
+ state,
88
+ `CHAT_FORBIDDEN_TOP_LEVEL_RESUME_NAVIGATION during ${context}: ${state.url}`
89
+ );
90
+ }
91
+ return state;
92
+ }
93
+
94
+ export async function recoverChatShell(client, {
95
+ targetUrl = CHAT_TARGET_URL,
96
+ timeoutMs = 60000,
97
+ intervalMs = 500,
98
+ forceNavigate = false,
99
+ settleMs = 1200,
100
+ settleAfterNavigate = false
101
+ } = {}) {
102
+ const before = await getChatTopLevelState(client);
103
+ if (before.is_security_verification) {
104
+ throw makeBossSecurityVerificationRequiredError(before, "chat_shell_recovery");
105
+ }
106
+ if (before.is_chat_shell && !forceNavigate) {
107
+ return {
108
+ recovered: false,
109
+ before,
110
+ after: before,
111
+ navigate_url: null,
112
+ force_navigate: false
113
+ };
114
+ }
115
+
116
+ const navigateResult = await client.Page.navigate({ url: targetUrl });
117
+ if (forceNavigate && settleMs > 0) {
118
+ await sleep(settleMs);
119
+ }
120
+ const waited = await waitForMainFrameUrl(
121
+ client,
122
+ (url) => isChatShellUrl(url) || isBossSecurityVerificationUrl(url),
123
+ {
124
+ timeoutMs,
125
+ intervalMs
126
+ }
127
+ );
128
+ const after = await getChatTopLevelState(client);
129
+ if (after.is_security_verification) {
130
+ throw makeBossSecurityVerificationRequiredError(after, "chat_shell_recovery");
131
+ }
132
+ let miniFreshStart = null;
133
+ if (after.is_chat_shell && settleAfterNavigate) {
134
+ miniFreshStart = await waitForMiniFreshStartSettle(client, {
135
+ domain: "chat",
136
+ timeoutMs,
137
+ intervalMs: Math.max(intervalMs, 800),
138
+ settleMs: Math.min(settleMs, 5000),
139
+ selfHealConfig: buildChatSelfHealConfig(),
140
+ resolveSelfHealRoots: resolveChatSelfHealRoots
141
+ });
142
+ if (!miniFreshStart.ok) {
143
+ throw createRecoverySettleError("chat", miniFreshStart);
144
+ }
145
+ }
146
+ return {
147
+ recovered: waited.ok && after.is_chat_shell,
148
+ refreshed: Boolean(forceNavigate && before.is_chat_shell && after.is_chat_shell),
149
+ before,
150
+ after,
151
+ mini_fresh_start: miniFreshStart,
152
+ wait: waited,
153
+ navigate_result: navigateResult || null,
154
+ navigate_url: targetUrl,
155
+ force_navigate: Boolean(forceNavigate)
156
+ };
157
+ }
@@ -1,56 +1,56 @@
1
- import {
2
- getDocumentRoot,
3
- querySelector,
4
- sleep
5
- } from "../../core/browser/index.js";
6
-
7
- export async function getChatRoots(client) {
8
- const topRoot = await getDocumentRoot(client);
9
- return {
10
- topRoot,
11
- roots: [
12
- { name: "top", nodeId: topRoot.nodeId }
13
- ],
14
- rootNodes: {
15
- top: topRoot.nodeId
16
- }
17
- };
18
- }
19
-
20
- export async function waitForChatRoots(client, {
21
- timeoutMs = 12000,
22
- intervalMs = 300
23
- } = {}) {
24
- const started = Date.now();
25
- let lastState = null;
26
- let lastError = null;
27
- while (Date.now() - started <= timeoutMs) {
28
- try {
29
- lastState = await getChatRoots(client);
30
- if (lastState?.rootNodes?.top) return lastState;
31
- } catch (error) {
32
- lastError = error;
33
- }
34
- await sleep(intervalMs);
35
- }
36
- if (lastError && !lastState) throw lastError;
37
- return lastState;
38
- }
39
-
40
- export async function queryFirstAcrossChatRoots(client, roots, selectors) {
41
- for (const root of roots) {
42
- if (!root?.nodeId) continue;
43
- for (const selector of selectors) {
44
- const nodeId = await querySelector(client, root.nodeId, selector);
45
- if (nodeId) {
46
- return {
47
- root: root.name,
48
- root_node_id: root.nodeId,
49
- selector,
50
- node_id: nodeId
51
- };
52
- }
53
- }
54
- }
55
- return null;
56
- }
1
+ import {
2
+ getDocumentRoot,
3
+ querySelector,
4
+ sleep
5
+ } from "../../core/browser/index.js";
6
+
7
+ export async function getChatRoots(client) {
8
+ const topRoot = await getDocumentRoot(client);
9
+ return {
10
+ topRoot,
11
+ roots: [
12
+ { name: "top", nodeId: topRoot.nodeId }
13
+ ],
14
+ rootNodes: {
15
+ top: topRoot.nodeId
16
+ }
17
+ };
18
+ }
19
+
20
+ export async function waitForChatRoots(client, {
21
+ timeoutMs = 12000,
22
+ intervalMs = 300
23
+ } = {}) {
24
+ const started = Date.now();
25
+ let lastState = null;
26
+ let lastError = null;
27
+ while (Date.now() - started <= timeoutMs) {
28
+ try {
29
+ lastState = await getChatRoots(client);
30
+ if (lastState?.rootNodes?.top) return lastState;
31
+ } catch (error) {
32
+ lastError = error;
33
+ }
34
+ await sleep(intervalMs);
35
+ }
36
+ if (lastError && !lastState) throw lastError;
37
+ return lastState;
38
+ }
39
+
40
+ export async function queryFirstAcrossChatRoots(client, roots, selectors) {
41
+ for (const root of roots) {
42
+ if (!root?.nodeId) continue;
43
+ for (const selector of selectors) {
44
+ const nodeId = await querySelector(client, root.nodeId, selector);
45
+ if (nodeId) {
46
+ return {
47
+ root: root.name,
48
+ root_node_id: root.nodeId,
49
+ selector,
50
+ node_id: nodeId
51
+ };
52
+ }
53
+ }
54
+ }
55
+ return null;
56
+ }