@reconcrap/boss-recommend-mcp 1.3.39 → 2.0.0

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 (85) hide show
  1. package/README.md +53 -33
  2. package/package.json +61 -9
  3. package/skills/boss-recommend-pipeline/SKILL.md +4 -0
  4. package/src/chat-mcp.js +1333 -0
  5. package/src/chat-runtime-config.js +559 -0
  6. package/src/cli.js +1095 -196
  7. package/src/core/browser/index.js +378 -0
  8. package/src/core/capture/index.js +298 -0
  9. package/src/core/cv-acquisition/index.js +219 -0
  10. package/src/core/greet-quota/index.js +54 -0
  11. package/src/core/infinite-list/index.js +459 -0
  12. package/src/core/reporting/legacy-csv.js +332 -0
  13. package/src/core/run/index.js +286 -0
  14. package/src/core/screening/index.js +1166 -0
  15. package/src/core/self-heal/index.js +848 -0
  16. package/src/domains/chat/cards.js +129 -0
  17. package/src/domains/chat/constants.js +183 -0
  18. package/src/domains/chat/detail.js +1369 -0
  19. package/src/domains/chat/index.js +7 -0
  20. package/src/domains/chat/jobs.js +334 -0
  21. package/src/domains/chat/page-guard.js +88 -0
  22. package/src/domains/chat/roots.js +56 -0
  23. package/src/domains/chat/run-service.js +1101 -0
  24. package/src/domains/recommend/actions.js +457 -0
  25. package/src/domains/recommend/cards.js +228 -0
  26. package/src/domains/recommend/constants.js +141 -0
  27. package/src/domains/recommend/detail.js +341 -0
  28. package/src/domains/recommend/filters.js +581 -0
  29. package/src/domains/recommend/index.js +10 -0
  30. package/src/domains/recommend/jobs.js +232 -0
  31. package/src/domains/recommend/refresh.js +204 -0
  32. package/src/domains/recommend/roots.js +78 -0
  33. package/src/domains/recommend/run-service.js +903 -0
  34. package/src/domains/recommend/scopes.js +245 -0
  35. package/src/domains/recruit/actions.js +277 -0
  36. package/src/domains/recruit/cards.js +67 -0
  37. package/src/domains/recruit/constants.js +130 -0
  38. package/src/domains/recruit/detail.js +414 -0
  39. package/src/domains/recruit/index.js +9 -0
  40. package/src/domains/recruit/instruction-parser.js +451 -0
  41. package/src/domains/recruit/refresh.js +40 -0
  42. package/src/domains/recruit/roots.js +68 -0
  43. package/src/domains/recruit/run-service.js +580 -0
  44. package/src/domains/recruit/search.js +1149 -0
  45. package/src/index.js +578 -419
  46. package/src/recommend-mcp.js +1257 -0
  47. package/src/recruit-mcp.js +1035 -0
  48. package/src/adapters.js +0 -3079
  49. package/src/boss-chat.js +0 -1037
  50. package/src/pipeline.js +0 -2249
  51. package/src/recommend-healing-config.js +0 -131
  52. package/src/recommend-healing-rules.json +0 -261
  53. package/src/self-heal.js +0 -2237
  54. package/src/test-adapters-runtime.js +0 -628
  55. package/src/test-boss-chat.js +0 -3196
  56. package/src/test-index-async.js +0 -498
  57. package/src/test-parser.js +0 -742
  58. package/src/test-pipeline.js +0 -2703
  59. package/src/test-run-state.js +0 -152
  60. package/src/test-self-heal.js +0 -224
  61. package/vendor/boss-chat-cli/README.md +0 -134
  62. package/vendor/boss-chat-cli/package.json +0 -53
  63. package/vendor/boss-chat-cli/src/app.js +0 -1501
  64. package/vendor/boss-chat-cli/src/browser/chat-page.js +0 -3562
  65. package/vendor/boss-chat-cli/src/cli.js +0 -1713
  66. package/vendor/boss-chat-cli/src/mcp/server.js +0 -149
  67. package/vendor/boss-chat-cli/src/mcp/tool-runtime.js +0 -193
  68. package/vendor/boss-chat-cli/src/runtime/async-run-state.js +0 -260
  69. package/vendor/boss-chat-cli/src/runtime/interaction.js +0 -102
  70. package/vendor/boss-chat-cli/src/runtime/run-control.js +0 -102
  71. package/vendor/boss-chat-cli/src/services/chrome-client.js +0 -107
  72. package/vendor/boss-chat-cli/src/services/llm.js +0 -1292
  73. package/vendor/boss-chat-cli/src/services/llm.test.js +0 -326
  74. package/vendor/boss-chat-cli/src/services/profile-store.js +0 -173
  75. package/vendor/boss-chat-cli/src/services/report-store.js +0 -317
  76. package/vendor/boss-chat-cli/src/services/resume-capture.js +0 -469
  77. package/vendor/boss-chat-cli/src/services/resume-network.js +0 -727
  78. package/vendor/boss-chat-cli/src/services/state-store.js +0 -90
  79. package/vendor/boss-chat-cli/src/utils/customer-key.js +0 -82
  80. package/vendor/boss-recommend-screen-cli/boss-recommend-screen-cli.cjs +0 -7072
  81. package/vendor/boss-recommend-screen-cli/scripts/capture-full-resume-canvas.cjs +0 -817
  82. package/vendor/boss-recommend-screen-cli/scripts/stitch_resume_chunks.py +0 -141
  83. package/vendor/boss-recommend-screen-cli/test-recoverable-resume-failures.cjs +0 -2423
  84. package/vendor/boss-recommend-search-cli/src/cli.js +0 -1698
  85. package/vendor/boss-recommend-search-cli/src/test-job-selection.js +0 -211
@@ -1,742 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { parseRecommendInstruction } from "./parser.js";
3
-
4
- const REPRODUCTION_INSTRUCTION = `启动boss推荐任务。条件如下:
5
-
6
- 页面选择:推荐;
7
- 学校标签:985/211/国内外名校;
8
- 学历:本科及以上;
9
- 性别:不限;
10
- 是否过滤近14天看过:近14天没有;
11
- 目标筛选数:152;
12
- 通过筛选后动作:打招呼;
13
- 最大招呼数:152;
14
- 岗位:研发工程师(AI应用方向)-2026届校招 _ 杭州;
15
- 筛选条件:需同时满足全部条件:1)如果有本科学历,本科学历必须为 211 及以上或 QS 前 500 海外院校;2)至少一段学历为 985、QS 前 100 海外院校或中科院;3)具备大模型 / AI / 图形学 / 计算机视觉 / 3D相关的算法或工程经验(实习、项目、科研均可)。学校是否是985、211、qs排名等判断如果简历内没有明确标明,需要通过学校名称来判断;4)必须是25年应届生或者26年应届生或者27年应届生,除了标签以外需要通过人选最高学历的求学年份判断(比如:本科简历里写了2021 - 2025,应该理解为25年毕业,属于25年应届生);5)年龄必须35岁以内。`;
16
-
17
- function testNeedConfirmationIncludesPostAction() {
18
- const result = parseRecommendInstruction({
19
- instruction: "推荐页上筛选985男生,近14天没有,有大模型平台经验,符合标准的收藏",
20
- confirmation: null,
21
- overrides: null
22
- });
23
-
24
- assert.deepEqual(result.searchParams.school_tag, ["985"]);
25
- assert.deepEqual(result.searchParams.degree, ["不限"]);
26
- assert.equal(result.searchParams.gender, "男");
27
- assert.equal(result.searchParams.recent_not_view, "近14天没有");
28
- assert.equal(result.screenParams.criteria, "有大模型平台经验");
29
- assert.equal(result.proposed_post_action, "favorite");
30
- assert.equal(result.needs_filters_confirmation, true);
31
- assert.equal(result.needs_school_tag_confirmation, true);
32
- assert.equal(result.needs_degree_confirmation, true);
33
- assert.equal(result.needs_gender_confirmation, true);
34
- assert.equal(result.needs_recent_not_view_confirmation, true);
35
- assert.equal(result.needs_criteria_confirmation, true);
36
- assert.equal(result.needs_post_action_confirmation, true);
37
- }
38
-
39
- function testConfirmedPostActionAndOverrides() {
40
- const result = parseRecommendInstruction({
41
- instruction: "推荐页筛选女生,有多模态经历",
42
- confirmation: {
43
- filters_confirmed: true,
44
- school_tag_confirmed: true,
45
- school_tag_value: ["211"],
46
- degree_confirmed: true,
47
- degree_value: ["本科"],
48
- gender_confirmed: true,
49
- gender_value: "女",
50
- recent_not_view_confirmed: true,
51
- recent_not_view_value: "近14天没有",
52
- criteria_confirmed: true,
53
- target_count_confirmed: true,
54
- target_count_value: 12,
55
- post_action_confirmed: true,
56
- post_action_value: "greet",
57
- max_greet_count_confirmed: true,
58
- max_greet_count_value: 8
59
- },
60
- overrides: {
61
- school_tag: "211",
62
- degree: "本科",
63
- recent_not_view: "近14天没有",
64
- target_count: 12
65
- }
66
- });
67
-
68
- assert.deepEqual(result.searchParams.school_tag, ["211"]);
69
- assert.deepEqual(result.searchParams.degree, ["本科"]);
70
- assert.equal(result.searchParams.gender, "女");
71
- assert.equal(result.searchParams.recent_not_view, "近14天没有");
72
- assert.equal(result.screenParams.criteria, "有多模态经历");
73
- assert.equal(result.screenParams.target_count, 12);
74
- assert.equal(result.screenParams.post_action, "greet");
75
- assert.equal(result.screenParams.max_greet_count, 8);
76
- assert.equal(result.needs_filters_confirmation, false);
77
- assert.equal(result.needs_school_tag_confirmation, false);
78
- assert.equal(result.needs_degree_confirmation, false);
79
- assert.equal(result.needs_gender_confirmation, false);
80
- assert.equal(result.needs_recent_not_view_confirmation, false);
81
- assert.equal(result.needs_criteria_confirmation, false);
82
- assert.equal(result.needs_target_count_confirmation, false);
83
- assert.equal(result.needs_post_action_confirmation, false);
84
- assert.equal(result.needs_max_greet_count_confirmation, false);
85
- }
86
-
87
- function testMissingRecentNotViewValueShouldRequireReconfirmation() {
88
- const result = parseRecommendInstruction({
89
- instruction: "推荐页筛选985男生,近14天没有,有销售经验,符合标准收藏",
90
- confirmation: {
91
- filters_confirmed: true,
92
- school_tag_confirmed: true,
93
- school_tag_value: ["985"],
94
- degree_confirmed: true,
95
- degree_value: ["本科"],
96
- gender_confirmed: true,
97
- gender_value: "男",
98
- recent_not_view_confirmed: true,
99
- criteria_confirmed: true,
100
- target_count_confirmed: true,
101
- post_action_confirmed: true,
102
- post_action_value: "favorite"
103
- },
104
- overrides: null
105
- });
106
-
107
- assert.equal(result.needs_recent_not_view_confirmation, true);
108
- assert.equal(result.pending_questions.some((q) => q.field === "recent_not_view"), true);
109
- }
110
-
111
- function testFilterConfirmedWithoutExplicitValuesShouldRequireReconfirmation() {
112
- const result = parseRecommendInstruction({
113
- instruction: "通过boss推荐skill帮我找人",
114
- confirmation: {
115
- filters_confirmed: true,
116
- school_tag_confirmed: true,
117
- degree_confirmed: true,
118
- gender_confirmed: true,
119
- recent_not_view_confirmed: true,
120
- criteria_confirmed: true,
121
- target_count_confirmed: true,
122
- post_action_confirmed: true,
123
- post_action_value: "favorite"
124
- },
125
- overrides: {
126
- criteria: "必须有至少3年工作经验,且做过算法"
127
- }
128
- });
129
-
130
- assert.deepEqual(result.searchParams.school_tag, ["不限"]);
131
- assert.deepEqual(result.searchParams.degree, ["不限"]);
132
- assert.equal(result.searchParams.gender, "不限");
133
- assert.equal(result.searchParams.recent_not_view, "不限");
134
- assert.equal(result.needs_school_tag_confirmation, true);
135
- assert.equal(result.needs_degree_confirmation, true);
136
- assert.equal(result.needs_gender_confirmation, true);
137
- assert.equal(result.needs_recent_not_view_confirmation, true);
138
- assert.equal(result.needs_filters_confirmation, true);
139
- }
140
-
141
- function testFilterConfirmedWithExplicitConfirmationValuesShouldNotFallbackToUnlimited() {
142
- const result = parseRecommendInstruction({
143
- instruction: "通过boss推荐skill帮我找人",
144
- confirmation: {
145
- filters_confirmed: true,
146
- school_tag_confirmed: true,
147
- school_tag_value: ["985", "211"],
148
- degree_confirmed: true,
149
- degree_value: ["大专", "本科", "硕士", "博士"],
150
- gender_confirmed: true,
151
- gender_value: "男",
152
- recent_not_view_confirmed: true,
153
- recent_not_view_value: "近14天没有",
154
- criteria_confirmed: true,
155
- target_count_confirmed: true,
156
- target_count_value: 3,
157
- post_action_confirmed: true,
158
- post_action_value: "favorite"
159
- },
160
- overrides: {
161
- criteria: "必须有至少3年工作经验,且做过算法"
162
- }
163
- });
164
-
165
- assert.deepEqual(result.searchParams.school_tag, ["985", "211"]);
166
- assert.deepEqual(result.searchParams.degree, ["大专", "本科", "硕士", "博士"]);
167
- assert.equal(result.searchParams.gender, "男");
168
- assert.equal(result.searchParams.recent_not_view, "近14天没有");
169
- assert.equal(result.needs_school_tag_confirmation, false);
170
- assert.equal(result.needs_degree_confirmation, false);
171
- assert.equal(result.needs_gender_confirmation, false);
172
- assert.equal(result.needs_recent_not_view_confirmation, false);
173
- }
174
-
175
- function testMultipleSchoolTagsMarkedSuspicious() {
176
- const result = parseRecommendInstruction({
177
- instruction: "推荐页筛选985和211,有推荐系统经验",
178
- confirmation: {
179
- filters_confirmed: true,
180
- school_tag_confirmed: true,
181
- degree_confirmed: true,
182
- gender_confirmed: true,
183
- recent_not_view_confirmed: true,
184
- criteria_confirmed: true,
185
- post_action_confirmed: true,
186
- post_action_value: "favorite"
187
- },
188
- overrides: null
189
- });
190
-
191
- assert.deepEqual(result.searchParams.school_tag, ["985", "211"]);
192
- assert.deepEqual(result.searchParams.degree, ["不限"]);
193
- assert.equal(result.suspicious_fields.length, 0);
194
- }
195
-
196
- function testDegreeCanBeExtracted() {
197
- const result = parseRecommendInstruction({
198
- instruction: "推荐页筛选本科女生,近14天没有,有大模型项目经验",
199
- confirmation: null,
200
- overrides: null
201
- });
202
-
203
- assert.deepEqual(result.searchParams.degree, ["本科"]);
204
- }
205
-
206
- function testDegreeAtOrAboveExpansion() {
207
- const result = parseRecommendInstruction({
208
- instruction: "推荐页筛选大专及以上,近14天没有,有Agent经验",
209
- confirmation: null,
210
- overrides: null
211
- });
212
-
213
- assert.deepEqual(result.searchParams.degree, ["大专", "本科", "硕士", "博士"]);
214
- }
215
-
216
- function testDegreeShouldNotBeOverwrittenBySchoolTagUnlimitedClause() {
217
- const result = parseRecommendInstruction({
218
- instruction: "学校标签不限,学历要求大专及以上,性别不限,过滤近14天已看",
219
- confirmation: null,
220
- overrides: null
221
- });
222
-
223
- assert.deepEqual(result.searchParams.school_tag, ["不限"]);
224
- assert.deepEqual(result.searchParams.degree, ["大专", "本科", "硕士", "博士"]);
225
- }
226
-
227
- function testDegreeExplicitListOnly() {
228
- const result = parseRecommendInstruction({
229
- instruction: "推荐页筛选大专、本科,近14天没有,有Agent经验",
230
- confirmation: null,
231
- overrides: null
232
- });
233
-
234
- assert.deepEqual(result.searchParams.degree, ["大专", "本科"]);
235
- }
236
-
237
- function testDegreeOverrideCanBeArray() {
238
- const result = parseRecommendInstruction({
239
- instruction: "推荐页筛选本科,近14天没有,有Agent经验",
240
- confirmation: null,
241
- overrides: {
242
- degree: ["大专", "本科"]
243
- }
244
- });
245
-
246
- assert.deepEqual(result.searchParams.degree, ["大专", "本科"]);
247
- }
248
-
249
- function testSchoolTagOverrideCanBeArray() {
250
- const result = parseRecommendInstruction({
251
- instruction: "推荐页筛选985候选人,有算法经验",
252
- confirmation: null,
253
- overrides: {
254
- school_tag: ["985", "211"]
255
- }
256
- });
257
-
258
- assert.deepEqual(result.searchParams.school_tag, ["985", "211"]);
259
- }
260
-
261
- function testSchoolTagOverrideMixedValidAndInvalidShouldKeepValidOnes() {
262
- const result = parseRecommendInstruction({
263
- instruction: "推荐页筛选候选人,有算法经验",
264
- confirmation: null,
265
- overrides: {
266
- school_tag: ["985", "211", "foo_tag"]
267
- }
268
- });
269
-
270
- assert.deepEqual(result.searchParams.school_tag, ["985", "211"]);
271
- assert.equal(result.suspicious_fields.some((item) => item.field === "school_tag"), true);
272
- }
273
-
274
- function testSchoolTagOverrideAllInvalidShouldFallbackToUnlimited() {
275
- const result = parseRecommendInstruction({
276
- instruction: "推荐页筛选候选人,有算法经验",
277
- confirmation: null,
278
- overrides: {
279
- school_tag: ["abc", "foo"]
280
- }
281
- });
282
-
283
- assert.deepEqual(result.searchParams.school_tag, ["不限"]);
284
- }
285
-
286
- function testSchoolTagQsAliasShouldNormalizeToDomesticAndOverseasTop() {
287
- const result = parseRecommendInstruction({
288
- instruction: "推荐页筛选候选人,有算法经验",
289
- confirmation: null,
290
- overrides: {
291
- school_tag: ["985", "QS前200"]
292
- }
293
- });
294
-
295
- assert.deepEqual(result.searchParams.school_tag, ["985", "国内外名校"]);
296
- }
297
-
298
- function testRecentNotViewSpacedOverrideShouldNormalize() {
299
- const result = parseRecommendInstruction({
300
- instruction: "推荐页筛选985男生,有算法经验",
301
- confirmation: null,
302
- overrides: {
303
- recent_not_view: "近 14 天没有"
304
- }
305
- });
306
-
307
- assert.equal(result.searchParams.recent_not_view, "近14天没有");
308
- }
309
-
310
- function testCriteriaCanBeProvidedViaOverrides() {
311
- const result = parseRecommendInstruction({
312
- instruction: "推荐页筛选211女生",
313
- confirmation: {
314
- filters_confirmed: true,
315
- school_tag_confirmed: true,
316
- degree_confirmed: true,
317
- gender_confirmed: true,
318
- recent_not_view_confirmed: true,
319
- criteria_confirmed: true,
320
- target_count_confirmed: true,
321
- post_action_confirmed: true,
322
- post_action_value: "favorite"
323
- },
324
- overrides: {
325
- criteria: "候选人需要有 AI Agent 或 MCP 工具开发经验"
326
- }
327
- });
328
-
329
- assert.equal(result.missing_fields.length, 0);
330
- assert.equal(result.screenParams.criteria, "候选人需要有 AI Agent 或 MCP 工具开发经验");
331
- }
332
-
333
- function testMissingCriteriaTriggersNeedInput() {
334
- const result = parseRecommendInstruction({
335
- instruction: "推荐页筛选985男生",
336
- confirmation: {
337
- filters_confirmed: true,
338
- school_tag_confirmed: true,
339
- degree_confirmed: true,
340
- gender_confirmed: true,
341
- recent_not_view_confirmed: true,
342
- criteria_confirmed: true,
343
- target_count_confirmed: true,
344
- post_action_confirmed: true,
345
- post_action_value: "favorite"
346
- },
347
- overrides: null
348
- });
349
-
350
- assert.deepEqual(result.missing_fields, ["criteria"]);
351
- assert.equal(result.pending_questions.some((q) => q.field === "criteria"), true);
352
- }
353
-
354
- function testGreetNeedsMaxGreetCountConfirmation() {
355
- const result = parseRecommendInstruction({
356
- instruction: "推荐页筛选985男生,有大模型工程经验,符合标准直接沟通",
357
- confirmation: {
358
- filters_confirmed: true,
359
- school_tag_confirmed: true,
360
- degree_confirmed: true,
361
- gender_confirmed: true,
362
- recent_not_view_confirmed: true,
363
- criteria_confirmed: true,
364
- target_count_confirmed: true,
365
- post_action_confirmed: true,
366
- post_action_value: "greet"
367
- },
368
- overrides: null
369
- });
370
-
371
- assert.equal(result.screenParams.post_action, "greet");
372
- assert.equal(result.screenParams.max_greet_count, null);
373
- assert.equal(result.needs_max_greet_count_confirmation, true);
374
- assert.equal(result.pending_questions.some((q) => q.field === "max_greet_count"), true);
375
- }
376
-
377
- function testGreetMaxGreetCountCanComeFromOverrides() {
378
- const result = parseRecommendInstruction({
379
- instruction: "推荐页筛选985男生,有大模型工程经验,符合标准直接沟通",
380
- confirmation: {
381
- filters_confirmed: true,
382
- school_tag_confirmed: true,
383
- degree_confirmed: true,
384
- gender_confirmed: true,
385
- recent_not_view_confirmed: true,
386
- criteria_confirmed: true,
387
- target_count_confirmed: true,
388
- post_action_confirmed: true,
389
- post_action_value: "greet"
390
- },
391
- overrides: {
392
- max_greet_count: 5
393
- }
394
- });
395
-
396
- assert.equal(result.screenParams.post_action, "greet");
397
- assert.equal(result.screenParams.max_greet_count, null);
398
- assert.equal(result.needs_max_greet_count_confirmation, true);
399
- }
400
-
401
- function testGreetAutoFilledMaxGreetCountShouldRequireReconfirmationWhenNotExplicitlyConfirmed() {
402
- const result = parseRecommendInstruction({
403
- instruction: "推荐页筛选985男生,有大模型工程经验,目标3人,符合标准直接沟通",
404
- confirmation: {
405
- filters_confirmed: true,
406
- school_tag_confirmed: true,
407
- degree_confirmed: true,
408
- gender_confirmed: true,
409
- recent_not_view_confirmed: true,
410
- criteria_confirmed: true,
411
- target_count_confirmed: true,
412
- target_count_value: 3,
413
- post_action_confirmed: true,
414
- post_action_value: "greet"
415
- },
416
- overrides: {
417
- max_greet_count: 3
418
- }
419
- });
420
-
421
- assert.equal(result.screenParams.post_action, "greet");
422
- assert.equal(result.screenParams.max_greet_count, null);
423
- assert.equal(result.needs_max_greet_count_confirmation, true);
424
- assert.equal(result.pending_questions.some((q) => q.field === "max_greet_count"), true);
425
- assert.equal(result.suspicious_fields.some((item) => item.field === "max_greet_count"), true);
426
- }
427
-
428
- function testGreetMaxGreetCountEqualTargetShouldPassAfterExplicitConfirmation() {
429
- const result = parseRecommendInstruction({
430
- instruction: "推荐页筛选985男生,有大模型工程经验,目标3人,符合标准直接沟通",
431
- confirmation: {
432
- filters_confirmed: true,
433
- school_tag_confirmed: true,
434
- degree_confirmed: true,
435
- gender_confirmed: true,
436
- recent_not_view_confirmed: true,
437
- criteria_confirmed: true,
438
- target_count_confirmed: true,
439
- target_count_value: 3,
440
- post_action_confirmed: true,
441
- post_action_value: "greet",
442
- max_greet_count_confirmed: true,
443
- max_greet_count_value: 3
444
- },
445
- overrides: null
446
- });
447
-
448
- assert.equal(result.screenParams.post_action, "greet");
449
- assert.equal(result.screenParams.max_greet_count, 3);
450
- assert.equal(result.needs_max_greet_count_confirmation, false);
451
- assert.equal(result.pending_questions.some((q) => q.field === "max_greet_count"), false);
452
- }
453
-
454
- function testTargetCountNeedsConfirmationEvenWhenOptional() {
455
- const result = parseRecommendInstruction({
456
- instruction: "推荐页筛选985男生,有大模型平台经验,符合标准收藏",
457
- confirmation: {
458
- filters_confirmed: true,
459
- school_tag_confirmed: true,
460
- degree_confirmed: true,
461
- gender_confirmed: true,
462
- recent_not_view_confirmed: true,
463
- criteria_confirmed: true,
464
- post_action_confirmed: true,
465
- post_action_value: "favorite"
466
- },
467
- overrides: null
468
- });
469
-
470
- assert.equal(result.needs_target_count_confirmation, true);
471
- assert.equal(result.pending_questions.some((q) => q.field === "target_count"), true);
472
- }
473
-
474
- function testTargetCountCanBeSkippedAfterConfirmation() {
475
- const result = parseRecommendInstruction({
476
- instruction: "推荐页筛选985男生,有大模型平台经验,符合标准收藏",
477
- confirmation: {
478
- filters_confirmed: true,
479
- school_tag_confirmed: true,
480
- degree_confirmed: true,
481
- gender_confirmed: true,
482
- recent_not_view_confirmed: true,
483
- criteria_confirmed: true,
484
- target_count_confirmed: true,
485
- post_action_confirmed: true,
486
- post_action_value: "favorite"
487
- },
488
- overrides: null
489
- });
490
-
491
- assert.equal(result.needs_target_count_confirmation, false);
492
- assert.equal(result.screenParams.target_count, null);
493
- }
494
-
495
- function testPostActionNoneCanBeConfirmed() {
496
- const result = parseRecommendInstruction({
497
- instruction: "推荐页筛选211女生,近14天没有,有AI经验,符合标准什么也不做",
498
- confirmation: {
499
- filters_confirmed: true,
500
- school_tag_confirmed: true,
501
- school_tag_value: ["211"],
502
- degree_confirmed: true,
503
- degree_value: ["本科"],
504
- gender_confirmed: true,
505
- gender_value: "女",
506
- recent_not_view_confirmed: true,
507
- recent_not_view_value: "近14天没有",
508
- criteria_confirmed: true,
509
- target_count_confirmed: true,
510
- post_action_confirmed: true,
511
- post_action_value: "none"
512
- },
513
- overrides: null
514
- });
515
-
516
- assert.equal(result.screenParams.post_action, "none");
517
- assert.equal(result.needs_post_action_confirmation, false);
518
- }
519
-
520
- function testJobSelectionHintCanComeFromOverrides() {
521
- const result = parseRecommendInstruction({
522
- instruction: "推荐页筛选211女生,有算法经验,符合标准收藏",
523
- confirmation: null,
524
- overrides: {
525
- job: "算法工程师(视频/图像模型方向) _ 杭州"
526
- }
527
- });
528
-
529
- assert.equal(result.job_selection_hint, "算法工程师(视频/图像模型方向) _ 杭州");
530
- }
531
-
532
- function testMcpMentionShouldStayInCriteria() {
533
- const result = parseRecommendInstruction({
534
- instruction: "推荐页筛选211女生,近14天没有,有 AI Agent 或 MCP 工具开发经验,符合标准的直接沟通",
535
- confirmation: null,
536
- overrides: null
537
- });
538
-
539
- assert.equal(result.screenParams.criteria, "有 AI Agent 或 MCP 工具开发经验");
540
- }
541
-
542
- function testFeaturedKeywordShouldProposeFeaturedPageScope() {
543
- const result = parseRecommendInstruction({
544
- instruction: "在推荐页精选里筛选候选人,有 Agent 经验,符合标准收藏",
545
- confirmation: null,
546
- overrides: null
547
- });
548
-
549
- assert.equal(result.proposed_page_scope, "featured");
550
- assert.equal(result.needs_page_confirmation, true);
551
- assert.equal(result.pending_questions.some((item) => item.field === "page_scope"), true);
552
- }
553
-
554
- function testClosedQuestionsShouldExposeStructuredOptions() {
555
- const result = parseRecommendInstruction({
556
- instruction: "推荐页筛选候选人,有 Agent 经验,符合标准收藏",
557
- confirmation: null,
558
- overrides: null
559
- });
560
- const schoolTagQuestion = result.pending_questions.find((item) => item.field === "school_tag");
561
- const recentNotViewQuestion = result.pending_questions.find((item) => item.field === "recent_not_view");
562
- const filtersQuestion = result.pending_questions.find((item) => item.field === "filters");
563
-
564
- assert.equal(Boolean(schoolTagQuestion), true);
565
- assert.equal(Array.isArray(schoolTagQuestion.options), true);
566
- assert.equal(schoolTagQuestion.options.some((item) => item.value === "国内外名校"), true);
567
- assert.equal(schoolTagQuestion.options.every((item) => typeof item.label === "string" && typeof item.value === "string"), true);
568
-
569
- assert.equal(Boolean(recentNotViewQuestion), true);
570
- assert.equal(Array.isArray(recentNotViewQuestion.options), true);
571
- assert.equal(recentNotViewQuestion.options.some((item) => item.value === "近14天没有"), true);
572
-
573
- assert.equal(Boolean(filtersQuestion), true);
574
- assert.equal(Array.isArray(filtersQuestion.options), true);
575
- assert.equal(filtersQuestion.options.some((item) => item.value === "confirm"), true);
576
- }
577
-
578
- function testLatestKeywordShouldProposeLatestPageScope() {
579
- const result = parseRecommendInstruction({
580
- instruction: "在推荐页最新里筛选候选人,有 Agent 经验,符合标准收藏",
581
- confirmation: null,
582
- overrides: null
583
- });
584
-
585
- assert.equal(result.proposed_page_scope, "latest");
586
- assert.equal(result.needs_page_confirmation, true);
587
- const pageQuestion = result.pending_questions.find((item) => item.field === "page_scope");
588
- assert.equal(Boolean(pageQuestion), true);
589
- assert.equal(Array.isArray(pageQuestion.options), true);
590
- assert.equal(pageQuestion.options.some((item) => item.value === "latest"), true);
591
- }
592
-
593
- function testConfirmedPageScopeShouldBeResolved() {
594
- const result = parseRecommendInstruction({
595
- instruction: "在推荐页筛选候选人,有 Agent 经验,符合标准收藏",
596
- confirmation: {
597
- page_confirmed: true,
598
- page_value: "featured"
599
- },
600
- overrides: null
601
- });
602
-
603
- assert.equal(result.page_scope, "featured");
604
- assert.equal(result.needs_page_confirmation, false);
605
- }
606
-
607
- function testPageScopeOverrideShouldNotBypassConfirmation() {
608
- const result = parseRecommendInstruction({
609
- instruction: "在推荐页筛选候选人,有 Agent 经验,符合标准收藏",
610
- confirmation: null,
611
- overrides: {
612
- page_scope: "featured"
613
- }
614
- });
615
-
616
- assert.equal(result.proposed_page_scope, "featured");
617
- assert.equal(result.page_scope, null);
618
- assert.equal(result.needs_page_confirmation, true);
619
- assert.equal(result.pending_questions.some((item) => item.field === "page_scope"), true);
620
- }
621
-
622
- function testExplicitCriteriaBlockShouldKeepAllCoreRulesAndExcludeMetaFields() {
623
- const result = parseRecommendInstruction({
624
- instruction: REPRODUCTION_INSTRUCTION,
625
- confirmation: null,
626
- overrides: null
627
- });
628
- const criteria = result.screenParams.criteria || "";
629
-
630
- assert.equal(criteria.includes("需同时满足全部条件"), true);
631
- assert.equal(criteria.includes("1)如果有本科学历,本科学历必须为 211 及以上或 QS 前 500 海外院校"), true);
632
- assert.equal(criteria.includes("2)至少一段学历为 985、QS 前 100 海外院校或中科院"), true);
633
- assert.equal(criteria.includes("3)具备大模型 / AI / 图形学 / 计算机视觉 / 3D相关的算法或工程经验"), true);
634
- assert.equal(criteria.includes("4)必须是25年应届生或者26年应届生或者27年应届生"), true);
635
- assert.equal(criteria.includes("5)年龄必须35岁以内"), true);
636
-
637
- assert.equal(criteria.includes("页面选择"), false);
638
- assert.equal(criteria.includes("目标筛选数"), false);
639
- assert.equal(criteria.includes("通过筛选后动作"), false);
640
- assert.equal(criteria.includes("最大招呼数"), false);
641
- assert.equal(criteria.includes("岗位"), false);
642
- }
643
-
644
- function testFallbackCriteriaShouldStillWorkWithoutExplicitMarker() {
645
- const result = parseRecommendInstruction({
646
- instruction: "页面选择:推荐;学校标签:985/211;岗位:算法工程师;候选人需满足至少两段 AI 项目经验;最大招呼数:20;",
647
- confirmation: null,
648
- overrides: null
649
- });
650
- const criteria = result.screenParams.criteria || "";
651
-
652
- assert.equal(criteria.includes("至少两段 AI 项目经验"), true);
653
- assert.equal(criteria.includes("页面选择"), false);
654
- assert.equal(criteria.includes("岗位"), false);
655
- assert.equal(criteria.includes("最大招呼数"), false);
656
- }
657
-
658
- function testOverrideCriteriaShouldHaveHighestPriorityOverExplicitCriteriaBlock() {
659
- const result = parseRecommendInstruction({
660
- instruction: REPRODUCTION_INSTRUCTION,
661
- confirmation: null,
662
- overrides: {
663
- criteria: "只看有开源 Agent 项目经验的人选"
664
- }
665
- });
666
-
667
- assert.equal(result.screenParams.criteria, "只看有开源 Agent 项目经验的人选");
668
- }
669
-
670
- function testFallbackCriteriaShouldNotDropReal985211QsRules() {
671
- const result = parseRecommendInstruction({
672
- instruction: "页面选择:推荐;目标筛选数:10;至少一段学历为985或QS前100海外院校;如果有本科学历,本科必须211或QS前500;岗位:算法工程师;",
673
- confirmation: null,
674
- overrides: null
675
- });
676
- const criteria = result.screenParams.criteria || "";
677
-
678
- assert.equal(criteria.includes("985"), true);
679
- assert.equal(criteria.includes("QS前100"), true);
680
- assert.equal(criteria.includes("211"), true);
681
- assert.equal(criteria.includes("QS前500"), true);
682
- }
683
-
684
- function testMetaHintsShouldBeProposedFromInstruction() {
685
- const result = parseRecommendInstruction({
686
- instruction: `页面选择:推荐;目标筛选数:5;通过筛选后动作:打招呼;最大招呼数:3;岗位:研发工程师(AI应用方向)-2026届校招 _ 杭州;筛选条件:需同时满足全部条件:1)具备AI经验;`,
687
- confirmation: null,
688
- overrides: null
689
- });
690
-
691
- assert.equal(result.proposed_page_scope, "recommend");
692
- assert.equal(result.proposed_target_count, 5);
693
- assert.equal(result.proposed_post_action, "greet");
694
- assert.equal(result.proposed_max_greet_count, 3);
695
- assert.equal(result.job_selection_hint, "研发工程师(AI应用方向)-2026届校招 _ 杭州");
696
- assert.equal(result.screenParams.target_count, null);
697
- assert.equal(result.screenParams.post_action, null);
698
- assert.equal(result.screenParams.max_greet_count, null);
699
- }
700
-
701
- function main() {
702
- testNeedConfirmationIncludesPostAction();
703
- testConfirmedPostActionAndOverrides();
704
- testMissingRecentNotViewValueShouldRequireReconfirmation();
705
- testFilterConfirmedWithoutExplicitValuesShouldRequireReconfirmation();
706
- testFilterConfirmedWithExplicitConfirmationValuesShouldNotFallbackToUnlimited();
707
- testMultipleSchoolTagsMarkedSuspicious();
708
- testDegreeCanBeExtracted();
709
- testDegreeAtOrAboveExpansion();
710
- testDegreeShouldNotBeOverwrittenBySchoolTagUnlimitedClause();
711
- testDegreeExplicitListOnly();
712
- testDegreeOverrideCanBeArray();
713
- testSchoolTagOverrideCanBeArray();
714
- testSchoolTagOverrideMixedValidAndInvalidShouldKeepValidOnes();
715
- testSchoolTagOverrideAllInvalidShouldFallbackToUnlimited();
716
- testSchoolTagQsAliasShouldNormalizeToDomesticAndOverseasTop();
717
- testRecentNotViewSpacedOverrideShouldNormalize();
718
- testCriteriaCanBeProvidedViaOverrides();
719
- testMissingCriteriaTriggersNeedInput();
720
- testMcpMentionShouldStayInCriteria();
721
- testGreetNeedsMaxGreetCountConfirmation();
722
- testGreetMaxGreetCountCanComeFromOverrides();
723
- testGreetAutoFilledMaxGreetCountShouldRequireReconfirmationWhenNotExplicitlyConfirmed();
724
- testGreetMaxGreetCountEqualTargetShouldPassAfterExplicitConfirmation();
725
- testTargetCountNeedsConfirmationEvenWhenOptional();
726
- testTargetCountCanBeSkippedAfterConfirmation();
727
- testPostActionNoneCanBeConfirmed();
728
- testJobSelectionHintCanComeFromOverrides();
729
- testFeaturedKeywordShouldProposeFeaturedPageScope();
730
- testClosedQuestionsShouldExposeStructuredOptions();
731
- testLatestKeywordShouldProposeLatestPageScope();
732
- testConfirmedPageScopeShouldBeResolved();
733
- testPageScopeOverrideShouldNotBypassConfirmation();
734
- testExplicitCriteriaBlockShouldKeepAllCoreRulesAndExcludeMetaFields();
735
- testFallbackCriteriaShouldStillWorkWithoutExplicitMarker();
736
- testOverrideCriteriaShouldHaveHighestPriorityOverExplicitCriteriaBlock();
737
- testFallbackCriteriaShouldNotDropReal985211QsRules();
738
- testMetaHintsShouldBeProposedFromInstruction();
739
- console.log("parser tests passed");
740
- }
741
-
742
- main();