@reconcrap/boss-recommend-mcp 2.0.47 → 2.0.48
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.
- package/bin/boss-recommend-mcp.js +4 -4
- package/config/screening-config.example.json +27 -27
- package/package.json +1 -1
- package/scripts/postinstall.cjs +44 -44
- package/skills/boss-chat/README.md +39 -39
- package/skills/boss-chat/SKILL.md +93 -93
- package/skills/boss-recommend-pipeline/README.md +12 -12
- package/skills/boss-recommend-pipeline/SKILL.md +180 -180
- package/skills/boss-recruit-pipeline/README.md +17 -17
- package/skills/boss-recruit-pipeline/SKILL.md +58 -58
- package/src/chat-mcp.js +1780 -1780
- package/src/chat-runtime-config.js +749 -749
- package/src/cli.js +3054 -3054
- package/src/core/boss-cards/index.js +199 -199
- package/src/core/browser/index.js +1586 -1453
- package/src/core/capture/index.js +1201 -1201
- package/src/core/cv-acquisition/index.js +238 -238
- package/src/core/cv-capture-target/index.js +299 -299
- package/src/core/greet-quota/index.js +54 -54
- package/src/core/infinite-list/index.js +1326 -1326
- package/src/core/reporting/legacy-csv.js +341 -341
- package/src/core/run/timing.js +33 -33
- package/src/core/self-heal/index.js +973 -973
- package/src/core/self-heal/viewport.js +564 -564
- package/src/domains/chat/cards.js +137 -137
- package/src/domains/chat/constants.js +221 -221
- package/src/domains/chat/detail.js +1668 -1668
- package/src/domains/chat/index.js +7 -7
- package/src/domains/chat/jobs.js +592 -592
- package/src/domains/chat/page-guard.js +98 -98
- package/src/domains/chat/roots.js +56 -56
- package/src/domains/chat/run-service.js +1977 -1977
- package/src/domains/recommend/actions.js +457 -457
- package/src/domains/recommend/cards.js +243 -243
- package/src/domains/recommend/constants.js +165 -165
- package/src/domains/recommend/filters.js +610 -610
- package/src/domains/recommend/index.js +10 -10
- package/src/domains/recommend/jobs.js +316 -316
- package/src/domains/recommend/refresh.js +472 -472
- package/src/domains/recommend/roots.js +80 -80
- package/src/domains/recommend/scopes.js +246 -246
- package/src/domains/recruit/actions.js +277 -277
- package/src/domains/recruit/cards.js +74 -74
- package/src/domains/recruit/constants.js +167 -167
- package/src/domains/recruit/detail.js +461 -461
- package/src/domains/recruit/index.js +9 -9
- package/src/domains/recruit/instruction-parser.js +451 -451
- package/src/domains/recruit/refresh.js +44 -44
- package/src/domains/recruit/roots.js +68 -68
- package/src/domains/recruit/run-service.js +1207 -1207
- package/src/domains/recruit/search.js +1202 -1202
- package/src/recommend-mcp.js +22 -22
- package/src/recruit-mcp.js +1338 -1338
|
@@ -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
|
+
}
|