linkedin-relay-mcp 3.18.0 → 3.19.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.
@@ -113,6 +113,11 @@ From a shell the same is
113
113
  `lnrelay jobs "frontend engineer" "AI agent developer" --location "European Union" --workplace remote --posted week --limit 200 --compact`
114
114
  and `lnrelay job 4479248573 4475225930 4476083905`.
115
115
 
116
+ - **Who to contact about a job: `job` with `team:true`** (`--team`). Each job gains `hiringTeam`:
117
+ name, profile id, profile URL, headline, connection degree, `role` ("Job poster") and `verified`.
118
+ It costs one page call per job (60 a day), so ask only for the finalists. `[]` means LinkedIn
119
+ shows no one for that job, which is most jobs; `hiringTeamError` means it could not be read.
120
+
116
121
  - **Put every keyword set in one `jobs` call**, never one call per keyword: the tool merges them by
117
122
  job id, so you read each job once and `job` reads it once. Separate calls leave the merging to you
118
123
  and spend reads twice on the same job.
package/README.md CHANGED
@@ -151,6 +151,7 @@ lnrelay job-filters "frontend engineer" --location "European Union" # every fi
151
151
  lnrelay jobs "frontend engineer" "AI agent developer" "agent engineer" \
152
152
  --location "European Union" --workplace remote --posted week --limit 200 --compact
153
153
  lnrelay job <id> <id> <id> # finalists in full, apply links
154
+ lnrelay job <id> --team # + who posted it, who is hiring
154
155
  ```
155
156
 
156
157
  - **Every filter the jobs page has:** location or exact geo id, distance, date posted, experience,
package/dist/cli.js CHANGED
@@ -3851,6 +3851,63 @@ function parseJobBatch(json) {
3851
3851
  const errors = root?.data?.errors ?? {};
3852
3852
  return { ok: true, jobs, missing: Object.keys(errors).map((k) => k.replace(/^\*/, "")) };
3853
3853
  }
3854
+ var HIRING_TEAM = "com.linkedin.sdui.generated.jobseeker.dsl.impl.peopleWhoCanHelp";
3855
+ var HIRING_TEAM_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/component?componentId=${HIRING_TEAM}&sduiid=${HIRING_TEAM}`;
3856
+ function hiringTeamBody(jobId) {
3857
+ return {
3858
+ componentId: HIRING_TEAM,
3859
+ clientArguments: {
3860
+ payload: { jobId, isTwoPane: false },
3861
+ states: [],
3862
+ requestMetadata: { $type: "proto.sdui.common.RequestMetadata" },
3863
+ screenId: "com.linkedin.sdui.flagshipnav.jobs.JobDetails",
3864
+ knownTemplateIds: []
3865
+ }
3866
+ };
3867
+ }
3868
+ var unquote = (s) => JSON.parse(`"${s}"`);
3869
+ function memberOf(card, id) {
3870
+ const url = card.match(/"url":"(https:\/\/www\.linkedin\.com\/in\/[^"/]+\/)"/)?.[1];
3871
+ const name = card.match(/\[null,"((?:[^"\\]|\\.)+)"/)?.[1];
3872
+ if (url === void 0 || name === void 0) return void 0;
3873
+ const lines = [...card.matchAll(/"children":\["((?:[^"\\$]|\\.)(?:[^"\\]|\\.)*)"\]/g)].map(
3874
+ (m) => unquote(m[1]).trim()
3875
+ );
3876
+ const degree = lines.find((l) => l.startsWith("\u2022"));
3877
+ const [headline, role2] = lines.filter((l) => l !== degree && l !== "");
3878
+ return defined2({
3879
+ name: unquote(name).trim(),
3880
+ id,
3881
+ url,
3882
+ headline,
3883
+ degree: degree?.replace(/^•\s*/, ""),
3884
+ role: role2,
3885
+ verified: /"role":"img","aria-label"/.test(card) ? true : void 0
3886
+ });
3887
+ }
3888
+ function parseHiringTeam(stream) {
3889
+ if (/^0:null\s*$/.test(stream.trim())) return { ok: true, members: [] };
3890
+ if (!stream.includes("peopleWhoCanHelp"))
3891
+ return drift2("the hiring team answer was not the hiring team component");
3892
+ const rows = new Rows(stream);
3893
+ const cards = [...rows.byId].filter(([, row]) => /linkedin\.com\\?\/in\\?\//.test(row));
3894
+ const at = (card) => stream.indexOf(`"$L${card}"`);
3895
+ const placed = cards.map(([key]) => at(key)).sort((a, b) => a - b);
3896
+ const members = [];
3897
+ for (const [key, row] of cards) {
3898
+ const from = at(key);
3899
+ const to = placed.find((p) => p > from) ?? stream.length;
3900
+ const id = stream.slice(from, to).match(/recipient=([A-Za-z0-9_-]+)/)?.[1];
3901
+ const m = memberOf(row, from === -1 ? void 0 : id);
3902
+ if (m !== void 0) members.push(m);
3903
+ }
3904
+ const shown = (stream.match(/screenContext=JOB_DETAILS_HIRING_TEAM/g) ?? []).length;
3905
+ if (members.length === 0 && Math.max(shown, cards.length) > 0)
3906
+ return drift2(
3907
+ `${Math.max(shown, cards.length)} hiring team members were shown but none could be read`
3908
+ );
3909
+ return { ok: true, members };
3910
+ }
3854
3911
  function parseJobFilters(json) {
3855
3912
  const elements = json?.data?.elements;
3856
3913
  if (!Array.isArray(elements)) return drift2("the job filter list was missing");
@@ -4560,12 +4617,21 @@ function liveFetch3(command, quiet) {
4560
4617
  if (session.state !== "ok")
4561
4618
  return err(command, "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
4562
4619
  const client = createLiveClient(session.session, void 0, quiet);
4563
- return async (url, spendClass) => {
4564
- const r = await client.request({ url, spendClass, operation: command });
4565
- return r.ok ? { ok: true, json: r.json } : r;
4620
+ return async (url, spendClass, body) => {
4621
+ const r = await client.request({
4622
+ url,
4623
+ ...body !== void 0 ? { method: "POST", body } : {},
4624
+ spendClass,
4625
+ operation: command
4626
+ });
4627
+ if (!r.ok) return r;
4628
+ return { ok: true, json: r.json, raw: r.classification.raw ?? "" };
4566
4629
  };
4567
4630
  }
4568
4631
  var PAGING2 = { pageSize: PAGE_SIZE2, max: 1e3 };
4632
+ var teamLine = (team) => team === void 0 || team.length === 0 ? void 0 : `team: ${team.map(
4633
+ (m) => [m.name, m.role !== void 0 ? `(${m.role})` : void 0, m.url].filter(Boolean).join(" ")
4634
+ ).join("; ")}`;
4569
4635
  function compactJob(j) {
4570
4636
  return line([
4571
4637
  j.id,
@@ -4578,7 +4644,8 @@ function compactJob(j) {
4578
4644
  j.promoted ? "promoted" : void 0,
4579
4645
  j.salary,
4580
4646
  j.apply?.url !== void 0 ? `apply: ${j.apply.url}` : void 0,
4581
- j.matched !== void 0 ? `matched: ${j.matched.join(" + ")}` : void 0
4647
+ j.matched !== void 0 ? `matched: ${j.matched.join(" + ")}` : void 0,
4648
+ teamLine(j.hiringTeam)
4582
4649
  ]);
4583
4650
  }
4584
4651
  function shape2(rows, opts, line2) {
@@ -4686,7 +4753,15 @@ async function runJobs(req, opts = {}, fetch2) {
4686
4753
  meta
4687
4754
  });
4688
4755
  }
4689
- async function runJob(input, opts = {}, fetch2) {
4756
+ async function addTeams(get, jobs) {
4757
+ for (const job of jobs) {
4758
+ const res = await get(HIRING_TEAM_URL, "page", hiringTeamBody(job.id));
4759
+ const team = res.ok ? parseHiringTeam(res.raw ?? "") : res;
4760
+ if (team.ok) job.hiringTeam = team.members;
4761
+ else job.hiringTeamError = `${team.code}: ${team.message}`;
4762
+ }
4763
+ }
4764
+ async function runJob(input, opts = {}, fetch2, req = {}) {
4690
4765
  const given = input === void 0 ? [] : Array.isArray(input) ? input : [input];
4691
4766
  const ids = [...new Set(given.map(jobIdOf))];
4692
4767
  if (ids.length === 0 || ids.some((id) => id === void 0)) {
@@ -4706,6 +4781,7 @@ async function runJob(input, opts = {}, fetch2) {
4706
4781
  if (!res.ok) return err("job", res.code, res.message, res.hint);
4707
4782
  const detail = parseJobDetail(res.json);
4708
4783
  if (!detail.ok) return err("job", detail.code, detail.message, detail.hint);
4784
+ if (req.team === true) await addTeams(get, [detail.job]);
4709
4785
  return ok("job", detail.job);
4710
4786
  }
4711
4787
  const read = await readJobs(get, wanted);
@@ -4713,6 +4789,7 @@ async function runJob(input, opts = {}, fetch2) {
4713
4789
  return err("job", read.stoppedBy, "no job could be read");
4714
4790
  const unread = wanted.filter((id) => !read.jobs.has(id));
4715
4791
  const jobs = wanted.flatMap((id) => read.jobs.get(id) ?? []);
4792
+ if (req.team === true) await addTeams(get, jobs);
4716
4793
  return ok("job", {
4717
4794
  items: shape2(
4718
4795
  jobs,
@@ -6553,9 +6630,9 @@ var COMMANDS = [
6553
6630
  },
6554
6631
  {
6555
6632
  name: "job",
6556
- cost: "1 job read per 100 jobs",
6557
- summary: "Jobs in full: description, apply link (external or Easy Apply), applicants, state. Several ids are read together, 100 a call.",
6558
- usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--compact | --fields a,b,c]",
6633
+ cost: "1 job read per 100 jobs; --team adds 1 page call per job",
6634
+ summary: "Jobs in full: description, apply link (external or Easy Apply), applicants, state. Several ids are read together, 100 a call. --team adds who posted it and who is hiring.",
6635
+ usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--compact | --fields a,b,c]",
6559
6636
  audience: ["cli", "mcp"],
6560
6637
  risk: "read",
6561
6638
  implemented: true
@@ -9462,7 +9539,7 @@ async function dispatch(argv, now) {
9462
9539
  case "jobs":
9463
9540
  return runJobs(jobsRequest(args), output(args));
9464
9541
  case "job":
9465
- return runJob(args.positionals, output(args));
9542
+ return runJob(args.positionals, output(args), void 0, { team: bool(args, "team") });
9466
9543
  case "job-filters":
9467
9544
  return runJobFilters(jobsRequest(args), output(args));
9468
9545
  case "people":