@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
@@ -32,14 +32,54 @@ function clone(value) {
32
32
  return JSON.parse(JSON.stringify(value));
33
33
  }
34
34
 
35
- function errorDiagnostic(error) {
36
- if (!error) return null;
37
- const diagnostic = {
38
- name: error?.name || "Error",
39
- message: error?.message || String(error)
40
- };
41
- if (error?.code) diagnostic.code = error.code;
42
- return diagnostic;
35
+ const SAFE_CDP_ERROR_FIELDS = [
36
+ "cdp_method",
37
+ "cdp_at",
38
+ "cdp_node_id",
39
+ "cdp_backend_node_id",
40
+ "cdp_search_id",
41
+ "cdp_connection_epoch",
42
+ "cdp_replay_policy",
43
+ "cdp_reconnected",
44
+ "cdp_reconnected_epoch",
45
+ "cdp_replayed_after_reconnect",
46
+ "cdp_replay_suppressed",
47
+ "cdp_outcome_unknown",
48
+ "cdp_reconnect_error"
49
+ ];
50
+
51
+ function appendSafeCdpDiagnostics(diagnostic, error) {
52
+ for (const field of SAFE_CDP_ERROR_FIELDS) {
53
+ if (error?.[field] !== undefined) diagnostic[field] = error[field];
54
+ }
55
+ if (Array.isArray(error?.cdp_param_keys)) {
56
+ diagnostic.cdp_param_keys = error.cdp_param_keys
57
+ .filter((key) => typeof key === "string")
58
+ .slice(0, 20);
59
+ }
60
+ return diagnostic;
61
+ }
62
+
63
+ function errorDiagnostic(error, phase = null) {
64
+ if (!error) return null;
65
+ const diagnostic = {
66
+ name: error?.name || "Error",
67
+ message: error?.message || String(error)
68
+ };
69
+ if (error?.code) diagnostic.code = error.code;
70
+ const diagnosticPhase = error?.phase || phase;
71
+ if (diagnosticPhase) diagnostic.phase = diagnosticPhase;
72
+ appendSafeCdpDiagnostics(diagnostic, error);
73
+ if (error?.stack) diagnostic.stack = String(error.stack).split(/\r?\n/).slice(0, 12).join("\n");
74
+ if (error?.cause && error.cause !== error) {
75
+ diagnostic.cause = appendSafeCdpDiagnostics({
76
+ name: error.cause?.name || "Error",
77
+ message: error.cause?.message || String(error.cause),
78
+ ...(error.cause?.code ? { code: error.cause.code } : {}),
79
+ ...((error.cause?.phase || diagnosticPhase) ? { phase: error.cause?.phase || diagnosticPhase } : {})
80
+ }, error.cause);
81
+ }
82
+ return diagnostic;
43
83
  }
44
84
 
45
85
  function createDeferred() {
@@ -81,17 +121,18 @@ export function createRunLifecycleManager({
81
121
  } = {}) {
82
122
  const runs = new Map();
83
123
 
84
- function emitSnapshot(entry, event = {}) {
85
- if (typeof onSnapshot !== "function") return;
86
- try {
87
- onSnapshot(snapshotFromEntry(entry), {
88
- type: event.type || "update",
89
- at: now(),
90
- ...event
91
- });
92
- } catch {
93
- // Snapshot hooks must never interrupt an active browser run.
94
- }
124
+ function emitSnapshot(entry, event = {}, { required = false } = {}) {
125
+ if (typeof onSnapshot !== "function") return;
126
+ try {
127
+ onSnapshot(snapshotFromEntry(entry), {
128
+ type: event.type || "update",
129
+ at: now(),
130
+ ...event
131
+ });
132
+ } catch (error) {
133
+ if (required) throw error;
134
+ // Snapshot hooks must never interrupt an active browser run.
135
+ }
95
136
  }
96
137
 
97
138
  function getEntry(runId) {
@@ -133,16 +174,30 @@ export function createRunLifecycleManager({
133
174
  emitSnapshot(entry, { type: "progress", progressPatch });
134
175
  return snapshotFromEntry(entry);
135
176
  },
136
- checkpoint(checkpointPatch = {}) {
137
- entry.run.checkpoint = {
138
- ...entry.run.checkpoint,
139
- ...checkpointPatch,
140
- updatedAt: now()
177
+ checkpoint(checkpointPatch = {}) {
178
+ entry.run.checkpoint = {
179
+ ...entry.run.checkpoint,
180
+ ...checkpointPatch,
181
+ updatedAt: now()
141
182
  };
142
183
  touch(entry);
143
- emitSnapshot(entry, { type: "checkpoint", checkpointPatch });
144
- return snapshotFromEntry(entry);
145
- },
184
+ emitSnapshot(entry, { type: "checkpoint", checkpointPatch });
185
+ return snapshotFromEntry(entry);
186
+ },
187
+ checkpointCritical(checkpointPatch = {}) {
188
+ entry.run.checkpoint = {
189
+ ...entry.run.checkpoint,
190
+ ...checkpointPatch,
191
+ updatedAt: now()
192
+ };
193
+ touch(entry);
194
+ emitSnapshot(entry, {
195
+ type: "checkpoint",
196
+ checkpointPatch,
197
+ required: true
198
+ }, { required: true });
199
+ return snapshotFromEntry(entry);
200
+ },
146
201
  async waitIfPaused() {
147
202
  if (entry.controller.signal.aborted) {
148
203
  throw new RunCanceledError();
@@ -163,19 +218,34 @@ export function createRunLifecycleManager({
163
218
  }
164
219
  setStatus(entry, RUN_STATUS_RUNNING);
165
220
  },
166
- async sleep(ms) {
167
- if (entry.controller.signal.aborted) {
168
- throw new RunCanceledError();
169
- }
170
- await new Promise((resolve, reject) => {
171
- const timer = setTimeout(resolve, ms);
172
- const onAbort = () => {
173
- clearTimeout(timer);
174
- reject(new RunCanceledError());
175
- };
176
- entry.controller.signal.addEventListener("abort", onAbort, { once: true });
177
- });
178
- },
221
+ async sleep(ms) {
222
+ if (entry.controller.signal.aborted) {
223
+ throw new RunCanceledError();
224
+ }
225
+ await new Promise((resolve, reject) => {
226
+ let settled = false;
227
+ let timer = null;
228
+ const cleanup = () => {
229
+ entry.controller.signal.removeEventListener("abort", onAbort);
230
+ };
231
+ const onTimer = () => {
232
+ if (settled) return;
233
+ settled = true;
234
+ cleanup();
235
+ resolve();
236
+ };
237
+ const onAbort = () => {
238
+ if (settled) return;
239
+ settled = true;
240
+ clearTimeout(timer);
241
+ cleanup();
242
+ reject(new RunCanceledError());
243
+ };
244
+ timer = setTimeout(onTimer, Math.max(0, Number(ms) || 0));
245
+ entry.controller.signal.addEventListener("abort", onAbort, { once: true });
246
+ if (entry.controller.signal.aborted) onAbort();
247
+ });
248
+ },
179
249
  throwIfCanceled() {
180
250
  if (entry.controller.signal.aborted) {
181
251
  throw new RunCanceledError();
@@ -202,13 +272,13 @@ export function createRunLifecycleManager({
202
272
  if (error instanceof RunCanceledError || entry.controller.signal.aborted || entry.cancelRequested) {
203
273
  setStatus(entry, RUN_STATUS_CANCELED, {
204
274
  completedAt: now(),
205
- error: error instanceof RunCanceledError ? null : errorDiagnostic(error)
275
+ error: error instanceof RunCanceledError ? null : errorDiagnostic(error, entry.run.phase)
206
276
  });
207
277
  return;
208
278
  }
209
279
  setStatus(entry, RUN_STATUS_FAILED, {
210
280
  completedAt: now(),
211
- error: errorDiagnostic(error)
281
+ error: errorDiagnostic(error, entry.run.phase)
212
282
  });
213
283
  }
214
284
  }
@@ -1,33 +1,33 @@
1
- import path from "node:path";
2
-
3
- export function addTiming(timings, key, value) {
4
- if (!timings || !key) return;
5
- const numeric = Number(value);
6
- if (!Number.isFinite(numeric) || numeric < 0) return;
7
- timings[key] = (Number(timings[key]) || 0) + Math.round(numeric);
8
- }
9
-
10
- export async function measureTiming(timings, key, task) {
11
- const started = Date.now();
12
- try {
13
- return await task();
14
- } finally {
15
- addTiming(timings, key, Date.now() - started);
16
- }
17
- }
18
-
19
- export function imageEvidenceFilePath({
20
- imageOutputDir = "",
21
- domain = "candidate",
22
- runId = "",
23
- index = 0,
24
- extension = "png"
25
- } = {}) {
26
- const dir = String(imageOutputDir || "").trim();
27
- if (!dir) return "";
28
- const safeDomain = String(domain || "candidate").replace(/[^\w.-]+/g, "_");
29
- const safeRunId = String(runId || `${safeDomain}-run`).replace(/[^\w.-]+/g, "_");
30
- const safeIndex = String((Number(index) || 0) + 1).padStart(3, "0");
31
- const safeExt = String(extension || "png").replace(/^\./, "") || "png";
32
- return path.join(dir, safeRunId, `${safeDomain}-candidate-${safeIndex}.${safeExt}`);
33
- }
1
+ import path from "node:path";
2
+
3
+ export function addTiming(timings, key, value) {
4
+ if (!timings || !key) return;
5
+ const numeric = Number(value);
6
+ if (!Number.isFinite(numeric) || numeric < 0) return;
7
+ timings[key] = (Number(timings[key]) || 0) + Math.round(numeric);
8
+ }
9
+
10
+ export async function measureTiming(timings, key, task) {
11
+ const started = Date.now();
12
+ try {
13
+ return await task();
14
+ } finally {
15
+ addTiming(timings, key, Date.now() - started);
16
+ }
17
+ }
18
+
19
+ export function imageEvidenceFilePath({
20
+ imageOutputDir = "",
21
+ domain = "candidate",
22
+ runId = "",
23
+ index = 0,
24
+ extension = "png"
25
+ } = {}) {
26
+ const dir = String(imageOutputDir || "").trim();
27
+ if (!dir) return "";
28
+ const safeDomain = String(domain || "candidate").replace(/[^\w.-]+/g, "_");
29
+ const safeRunId = String(runId || `${safeDomain}-run`).replace(/[^\w.-]+/g, "_");
30
+ const safeIndex = String((Number(index) || 0) + 1).padStart(3, "0");
31
+ const safeExt = String(extension || "png").replace(/^\./, "") || "png";
32
+ return path.join(dir, safeRunId, `${safeDomain}-candidate-${safeIndex}.${safeExt}`);
33
+ }
@@ -0,0 +1,106 @@
1
+ param(
2
+ [Parameter(Mandatory = $true)]
3
+ [string]$NodePath,
4
+
5
+ [Parameter(Mandatory = $true)]
6
+ [string]$WorkerScriptPath,
7
+
8
+ [Parameter(Mandatory = $true)]
9
+ [ValidateSet('chat', 'recruit', 'recommend')]
10
+ [string]$Domain,
11
+
12
+ [Parameter(Mandatory = $true)]
13
+ [ValidatePattern('^[A-Za-z0-9._-]+$')]
14
+ [string]$RunId,
15
+
16
+ [Parameter(Mandatory = $true)]
17
+ [string]$StdoutPath,
18
+
19
+ [Parameter(Mandatory = $true)]
20
+ [string]$StderrPath,
21
+
22
+ [Parameter(Mandatory = $false)]
23
+ [string]$ChatRuntimeHomePath = '',
24
+
25
+ [Parameter(Mandatory = $false)]
26
+ [string]$ScreenConfigPath = ''
27
+ )
28
+
29
+ $ErrorActionPreference = 'Stop'
30
+ $utf8 = [System.Text.UTF8Encoding]::new($false)
31
+
32
+ function Assert-ControlledPath([string]$Value, [string]$Label) {
33
+ if (-not $Value -or -not [System.IO.Path]::IsPathRooted($Value)) {
34
+ throw "$Label must be an absolute path."
35
+ }
36
+ if ($Value.IndexOf([char]0) -ge 0 -or $Value -match '[\r\n"]') {
37
+ throw "$Label contains unsupported characters."
38
+ }
39
+ }
40
+
41
+ try {
42
+ Assert-ControlledPath $NodePath 'NodePath'
43
+ Assert-ControlledPath $WorkerScriptPath 'WorkerScriptPath'
44
+ Assert-ControlledPath $StdoutPath 'StdoutPath'
45
+ Assert-ControlledPath $StderrPath 'StderrPath'
46
+ if ($ChatRuntimeHomePath) {
47
+ Assert-ControlledPath $ChatRuntimeHomePath 'ChatRuntimeHomePath'
48
+ }
49
+ if ($ScreenConfigPath) {
50
+ Assert-ControlledPath $ScreenConfigPath 'ScreenConfigPath'
51
+ }
52
+ if (-not (Test-Path -LiteralPath $NodePath -PathType Leaf)) {
53
+ throw 'NodePath does not exist.'
54
+ }
55
+ if (-not (Test-Path -LiteralPath $WorkerScriptPath -PathType Leaf)) {
56
+ throw 'WorkerScriptPath does not exist.'
57
+ }
58
+ [System.IO.Directory]::CreateDirectory([System.IO.Path]::GetDirectoryName($StdoutPath)) | Out-Null
59
+ [System.IO.Directory]::CreateDirectory([System.IO.Path]::GetDirectoryName($StderrPath)) | Out-Null
60
+
61
+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo
62
+ $startInfo.FileName = $NodePath
63
+ $startInfo.Arguments = ('"{0}" --domain {1} --run-id {2}' -f $WorkerScriptPath, $Domain, $RunId)
64
+ $startInfo.WorkingDirectory = [System.IO.Path]::GetDirectoryName($WorkerScriptPath)
65
+ $startInfo.UseShellExecute = $false
66
+ $startInfo.CreateNoWindow = $true
67
+ $startInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
68
+ $startInfo.RedirectStandardOutput = $true
69
+ $startInfo.RedirectStandardError = $true
70
+ if ($ChatRuntimeHomePath) {
71
+ $startInfo.EnvironmentVariables['BOSS_CHAT_HOME'] = $ChatRuntimeHomePath
72
+ }
73
+ if ($ScreenConfigPath) {
74
+ $startInfo.EnvironmentVariables['BOSS_RECOMMEND_SCREEN_CONFIG'] = $ScreenConfigPath
75
+ }
76
+
77
+ $worker = New-Object System.Diagnostics.Process
78
+ $worker.StartInfo = $startInfo
79
+ if (-not $worker.Start()) {
80
+ throw 'Node detached worker did not start.'
81
+ }
82
+ $stdoutTask = $worker.StandardOutput.ReadToEndAsync()
83
+ $stderrTask = $worker.StandardError.ReadToEndAsync()
84
+ $worker.WaitForExit()
85
+ $stdout = $stdoutTask.GetAwaiter().GetResult()
86
+ $stderr = $stderrTask.GetAwaiter().GetResult()
87
+ if ($stdout) {
88
+ [System.IO.File]::AppendAllText($StdoutPath, $stdout, $utf8)
89
+ }
90
+ if ($stderr) {
91
+ [System.IO.File]::AppendAllText($StderrPath, $stderr, $utf8)
92
+ }
93
+ exit [int]$worker.ExitCode
94
+ } catch {
95
+ try {
96
+ [System.IO.Directory]::CreateDirectory([System.IO.Path]::GetDirectoryName($StderrPath)) | Out-Null
97
+ [System.IO.File]::AppendAllText(
98
+ $StderrPath,
99
+ "[windows-detached-worker] $($_.Exception.Message)$([Environment]::NewLine)",
100
+ $utf8
101
+ )
102
+ } catch {
103
+ # No additional recovery is available if even the controlled log path is unavailable.
104
+ }
105
+ exit 1
106
+ }