linkedin-relay-mcp 3.9.0 → 3.10.1

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/dist/cli.js CHANGED
@@ -946,6 +946,21 @@ var CAPS = {
946
946
  },
947
947
  search: { perDay: 25, provenance: "guessed", note: "no corroborated figure exists" },
948
948
  page: { perDay: 60, provenance: "guessed", note: "thread/feed pagination" },
949
+ // Set on 2026-10-14 by the owner's decision, for job hunting: about ten
950
+ // keyword searches read in full (25 jobs a page, often 100-300 a search),
951
+ // then the finalists read for their apply links. Kept apart from `search`
952
+ // so a hunt neither uses up nor is stopped by people and company research.
953
+ // Guesses like every other cap; the client's 3-15s gap still paces each call.
954
+ jobSearch: {
955
+ perDay: 150,
956
+ provenance: "guessed",
957
+ note: "job search pages and filter lists; set for ~10 keyword searches a day"
958
+ },
959
+ jobRead: {
960
+ perDay: 60,
961
+ provenance: "guessed",
962
+ note: "one job read in full, for its apply link"
963
+ },
949
964
  write: {
950
965
  // Raised from 10 on 2026-08-14 by the owner's explicit decision, after 10
951
966
  // blocked ordinary development on a tool whose writes are the point — a
@@ -961,7 +976,9 @@ var CAPS = {
961
976
  provenance: "guessed",
962
977
  note: "raised from 10 for development; still below the ~20/day connection lore per action type"
963
978
  },
964
- global: { perDay: 250, provenance: "guessed", note: "all classes combined" }
979
+ // Raised from 250 with the job classes, so a full hunt (~120 searches and
980
+ // 60 reads) still leaves room for everything else.
981
+ global: { perDay: 350, provenance: "guessed", note: "all classes combined" }
965
982
  };
966
983
  var MIN_GAP_MS = 3e3;
967
984
  function emptyLedger() {
@@ -1380,15 +1397,33 @@ var CONTRACTS = {
1380
1397
  provenance: "discovered",
1381
1398
  capturedAt: "2026-08-02"
1382
1399
  },
1383
- // A job CARDS list, not a job detail. Observed on /jobs/collections/recommended
1384
- // and never exercised; `job` needs a detail endpoint we have not captured.
1400
+ // Job search, captured 2026-10-14. The jobs page itself now opens an SDUI
1401
+ // "AI job search" that drops filters it does not support; these are the
1402
+ // classic Voyager resources still behind /jobs/search/, which take them all.
1403
+ // See engine/jobs.ts.
1385
1404
  jobCards: {
1386
1405
  name: "jobCards",
1387
- transport: "voyager-graphql",
1388
- path: `${VOYAGER}/graphql`,
1389
- queryId: "voyagerJobsDashJobCards.e5b6b761ede078dabe8ad857aa42c220",
1390
- provenance: "discovered",
1391
- capturedAt: "2026-08-02"
1406
+ transport: "voyager-restli",
1407
+ path: `${VOYAGER}/voyagerJobsDashJobCards`,
1408
+ decorationId: "com.linkedin.voyager.dash.deco.jobs.search.JobSearchCardsCollection-220",
1409
+ provenance: "verified",
1410
+ capturedAt: "2026-10-14"
1411
+ },
1412
+ jobFilters: {
1413
+ name: "jobFilters",
1414
+ transport: "voyager-restli",
1415
+ path: `${VOYAGER}/voyagerJobsDashSearchFilterClustersResource`,
1416
+ decorationId: "com.linkedin.voyager.dash.deco.search.SearchFilterCluster-44",
1417
+ provenance: "verified",
1418
+ capturedAt: "2026-10-14"
1419
+ },
1420
+ jobPosting: {
1421
+ name: "jobPosting",
1422
+ transport: "voyager-restli",
1423
+ path: `${VOYAGER}/jobs/jobPostings`,
1424
+ decorationId: "com.linkedin.voyager.deco.jobs.web.shared.WebFullJobPosting-65",
1425
+ provenance: "verified",
1426
+ capturedAt: "2026-10-14"
1392
1427
  }
1393
1428
  };
1394
1429
  var RETIRED = {
@@ -1639,10 +1674,10 @@ function createEngine(session, deps, quiet = false) {
1639
1674
  const client = createLiveClient(session, deps, quiet);
1640
1675
  return {
1641
1676
  async whoami() {
1642
- const contract = contractFor("me");
1643
- if (contract === void 0) return missingContract("me");
1677
+ const contract2 = contractFor("me");
1678
+ if (contract2 === void 0) return missingContract("me");
1644
1679
  const res = await client.request({
1645
- url: contract.path,
1680
+ url: contract2.path,
1646
1681
  spendClass: "profile",
1647
1682
  operation: "me"
1648
1683
  });
@@ -1650,10 +1685,10 @@ function createEngine(session, deps, quiet = false) {
1650
1685
  return { ok: true, value: parseSingle(res.json) };
1651
1686
  },
1652
1687
  async profile(memberId) {
1653
- const contract = contractFor("profile");
1654
- if (contract === void 0) return missingContract("profile");
1688
+ const contract2 = contractFor("profile");
1689
+ if (contract2 === void 0) return missingContract("profile");
1655
1690
  const variables = encodeVariables({ memberIdentity: memberId });
1656
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1691
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1657
1692
  const res = await client.request({ url, spendClass: "profile", operation: "profile" });
1658
1693
  if (!res.ok) return res;
1659
1694
  const envelope = res.json;
@@ -1665,9 +1700,9 @@ function createEngine(session, deps, quiet = false) {
1665
1700
  return { ok: true, value: { profile, index } };
1666
1701
  },
1667
1702
  async feed(limit) {
1668
- const contract = contractFor("feed");
1669
- if (contract === void 0) return missingContract("feed");
1670
- const url = `${contract.path}?q=chronFeed&count=${limit}&start=0`;
1703
+ const contract2 = contractFor("feed");
1704
+ if (contract2 === void 0) return missingContract("feed");
1705
+ const url = `${contract2.path}?q=chronFeed&count=${limit}&start=0`;
1671
1706
  const res = await client.request({ url, spendClass: "page", operation: "feed" });
1672
1707
  if (!res.ok) return res;
1673
1708
  const envelope = res.json;
@@ -1676,21 +1711,21 @@ function createEngine(session, deps, quiet = false) {
1676
1711
  value: {
1677
1712
  parsed: parseCollection(res.json, {
1678
1713
  operation: "feed",
1679
- contractCapturedAt: contract.capturedAt
1714
+ contractCapturedAt: contract2.capturedAt
1680
1715
  }),
1681
1716
  index: indexIncluded(envelope.included)
1682
1717
  }
1683
1718
  };
1684
1719
  },
1685
1720
  async myPosts(profileUrn, limit) {
1686
- const contract = contractFor("myPosts");
1687
- if (contract === void 0) return missingContract("myPosts");
1721
+ const contract2 = contractFor("myPosts");
1722
+ if (contract2 === void 0) return missingContract("myPosts");
1688
1723
  const variables = encodeVariables({
1689
1724
  count: Math.min(limit, 100),
1690
1725
  start: 0,
1691
1726
  profileUrn: canonicalUrn(profileUrn)
1692
1727
  });
1693
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1728
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1694
1729
  const res = await client.request({ url, spendClass: "page", operation: "myPosts" });
1695
1730
  if (!res.ok) return res;
1696
1731
  const envelope = res.json;
@@ -1699,7 +1734,7 @@ function createEngine(session, deps, quiet = false) {
1699
1734
  value: {
1700
1735
  parsed: parseCollection(res.json, {
1701
1736
  operation: "myPosts",
1702
- contractCapturedAt: contract.capturedAt,
1737
+ contractCapturedAt: contract2.capturedAt,
1703
1738
  truncated: true
1704
1739
  }),
1705
1740
  index: indexIncluded(envelope.included)
@@ -1712,8 +1747,8 @@ function createEngine(session, deps, quiet = false) {
1712
1747
  * snapshot and diffs, rather than pretending a watermark exists.
1713
1748
  */
1714
1749
  async connections(limit) {
1715
- const contract = contractFor("search");
1716
- if (contract === void 0) return missingContract("search");
1750
+ const contract2 = contractFor("search");
1751
+ if (contract2 === void 0) return missingContract("search");
1717
1752
  const variables = encodeVariables({
1718
1753
  start: 0,
1719
1754
  origin: "FACETED_SEARCH",
@@ -1726,12 +1761,12 @@ function createEngine(session, deps, quiet = false) {
1726
1761
  includeFiltersInResponse: false
1727
1762
  }
1728
1763
  });
1729
- const url = `${contract.path}?variables=${variables}&queryId=${contract.queryId}`;
1764
+ const url = `${contract2.path}?variables=${variables}&queryId=${contract2.queryId}`;
1730
1765
  const res = await client.request({ url, spendClass: "search", operation: "connections" });
1731
1766
  if (!res.ok) return res;
1732
1767
  const parsed = parseCollection(res.json, {
1733
1768
  operation: "connections",
1734
- contractCapturedAt: contract.capturedAt,
1769
+ contractCapturedAt: contract2.capturedAt,
1735
1770
  claimedCount: totalResultCount(res.json),
1736
1771
  truncated: true
1737
1772
  });
@@ -1741,8 +1776,8 @@ function createEngine(session, deps, quiet = false) {
1741
1776
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1742
1777
  },
1743
1778
  async post(postUrn2, limit) {
1744
- const contract = contractFor("comments");
1745
- if (contract === void 0) return missingContract("comments");
1779
+ const contract2 = contractFor("comments");
1780
+ if (contract2 === void 0) return missingContract("comments");
1746
1781
  const variables = encodeVariables({
1747
1782
  count: Math.min(limit, 100),
1748
1783
  numReplies: 1,
@@ -1750,12 +1785,12 @@ function createEngine(session, deps, quiet = false) {
1750
1785
  sortOrder: "RELEVANCE",
1751
1786
  start: 0
1752
1787
  });
1753
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1788
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1754
1789
  const res = await client.request({ url, spendClass: "page", operation: "comments" });
1755
1790
  if (!res.ok) return res;
1756
1791
  const parsed = parseCollection(res.json, {
1757
1792
  operation: "comments",
1758
- contractCapturedAt: contract.capturedAt,
1793
+ contractCapturedAt: contract2.capturedAt,
1759
1794
  // A page of many; we follow no cursor yet, so never claim exhaustion.
1760
1795
  truncated: true
1761
1796
  });
@@ -1763,27 +1798,27 @@ function createEngine(session, deps, quiet = false) {
1763
1798
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1764
1799
  },
1765
1800
  async reactions(postUrn2, limit) {
1766
- const contract = contractFor("reactions");
1767
- if (contract === void 0) return missingContract("reactions");
1801
+ const contract2 = contractFor("reactions");
1802
+ if (contract2 === void 0) return missingContract("reactions");
1768
1803
  const variables = encodeVariables({
1769
1804
  count: Math.min(limit, 100),
1770
1805
  start: 0,
1771
1806
  threadUrn: postUrn2
1772
1807
  });
1773
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1808
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1774
1809
  const res = await client.request({ url, spendClass: "page", operation: "reactions" });
1775
1810
  if (!res.ok) return res;
1776
1811
  const parsed = parseCollection(res.json, {
1777
1812
  operation: "reactions",
1778
- contractCapturedAt: contract.capturedAt,
1813
+ contractCapturedAt: contract2.capturedAt,
1779
1814
  truncated: true
1780
1815
  });
1781
1816
  const envelope = res.json;
1782
1817
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1783
1818
  },
1784
1819
  async search(kind, query, limit) {
1785
- const contract = contractFor("search");
1786
- if (contract === void 0) return missingContract("search");
1820
+ const contract2 = contractFor("search");
1821
+ if (contract2 === void 0) return missingContract("search");
1787
1822
  const variables = encodeVariables({
1788
1823
  start: 0,
1789
1824
  origin: "GLOBAL_SEARCH_HEADER",
@@ -1794,12 +1829,12 @@ function createEngine(session, deps, quiet = false) {
1794
1829
  includeFiltersInResponse: false
1795
1830
  }
1796
1831
  });
1797
- const url = `${contract.path}?variables=${variables}&queryId=${contract.queryId}`;
1832
+ const url = `${contract2.path}?variables=${variables}&queryId=${contract2.queryId}`;
1798
1833
  const res = await client.request({ url, spendClass: "search", operation: "search" });
1799
1834
  if (!res.ok) return res;
1800
1835
  const parsed = parseCollection(res.json, {
1801
1836
  operation: "search",
1802
- contractCapturedAt: contract.capturedAt,
1837
+ contractCapturedAt: contract2.capturedAt,
1803
1838
  claimedCount: totalResultCount(res.json),
1804
1839
  truncated: true
1805
1840
  // one page of many; we never claim exhaustion
@@ -1993,7 +2028,7 @@ async function fetchCommentMenu(ref, trackingId, client) {
1993
2028
  const stream = result.classification.raw ?? "";
1994
2029
  return { ok: true, stream };
1995
2030
  }
1996
- function textStates(payload, text2) {
2031
+ function textStates(payload, text3) {
1997
2032
  const keyOf = (...names) => {
1998
2033
  for (const n of names) {
1999
2034
  const slot = payload[n];
@@ -2012,12 +2047,12 @@ function textStates(payload, text2) {
2012
2047
  protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
2013
2048
  });
2014
2049
  return [
2015
- entry2(plain2, text2, "stringValue"),
2016
- entry2(rich, { text: text2, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
2050
+ entry2(plain2, text3, "stringValue"),
2051
+ entry2(rich, { text: text3, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
2017
2052
  ];
2018
2053
  }
2019
- function editStates(payload, text2) {
2020
- return textStates(payload, text2);
2054
+ function editStates(payload, text3) {
2055
+ return textStates(payload, text3);
2021
2056
  }
2022
2057
  async function runCommentAction(ref, operation, trackingId, client, newText) {
2023
2058
  const menu = await fetchCommentMenu(ref, trackingId, client);
@@ -2356,12 +2391,12 @@ var CATEGORY = {
2356
2391
  VIDEO: "VIDEO",
2357
2392
  DOCUMENT: "NATIVE_DOCUMENT"
2358
2393
  };
2359
- function sharePayload(text2, visibility, media = [], scheduledAt) {
2394
+ function sharePayload(text3, visibility, media = [], scheduledAt) {
2360
2395
  const schedule = scheduledAt === void 0 ? { postState: "PUBLISHED" } : { postState: "SCHEDULED", scheduledAt };
2361
2396
  return {
2362
2397
  visibleToConnectionsOnly: visibility === "CONNECTIONS",
2363
2398
  externalAudienceProviders: [],
2364
- commentaryV2: { text: text2, attributes: [] },
2399
+ commentaryV2: { text: text3, attributes: [] },
2365
2400
  origin: "FEED",
2366
2401
  allowedCommentersScope: "ALL",
2367
2402
  ...schedule,
@@ -2475,15 +2510,15 @@ async function share(confirmed, client, bytes) {
2475
2510
  note: "LinkedIn accepted the post but the response carried no recognisable urn. Run `lnrelay sync my-posts && lnrelay my-posts` to confirm what actually landed \u2014 and do NOT re-run this command on the assumption it failed, or you will post twice."
2476
2511
  } : { ok: true, id };
2477
2512
  }
2478
- function editPostBody(text2) {
2479
- return { patch: { $set: { commentaryV2: { text: text2, attributes: [] } } } };
2513
+ function editPostBody(text3) {
2514
+ return { patch: { $set: { commentaryV2: { text: text3, attributes: [] } } } };
2480
2515
  }
2481
2516
  async function editPost(confirmed, client) {
2482
- const { urn, text: text2 } = confirmed.payload;
2517
+ const { urn, text: text3 } = confirmed.payload;
2483
2518
  const result = await client.request({
2484
2519
  url: deleteUrl(urn),
2485
2520
  method: "POST",
2486
- body: editPostBody(text2),
2521
+ body: editPostBody(text3),
2487
2522
  spendClass: "write",
2488
2523
  operation: "edit-post"
2489
2524
  });
@@ -2493,7 +2528,7 @@ async function editPost(confirmed, client) {
2493
2528
  return out;
2494
2529
  }
2495
2530
  const held = result.json?.data?.commentary?.text;
2496
- if (held !== text2) {
2531
+ if (held !== text3) {
2497
2532
  return {
2498
2533
  ok: false,
2499
2534
  code: "SCHEMA_DRIFT",
@@ -2522,14 +2557,14 @@ function pollUrnOf(json) {
2522
2557
  return JSON.stringify(json ?? null).match(/urn:li:fsd_pollSummary:\d+/)?.[0] ?? null;
2523
2558
  }
2524
2559
  async function createPoll(poll, client) {
2525
- const contract = contractFor("createPoll");
2526
- if (contract?.queryId === void 0) {
2560
+ const contract2 = contractFor("createPoll");
2561
+ if (contract2?.queryId === void 0) {
2527
2562
  return { ok: false, code: "NOT_IMPLEMENTED", message: "no verified poll contract" };
2528
2563
  }
2529
2564
  const result = await client.request({
2530
- url: `${contract.path}?action=execute&queryId=${contract.queryId}`,
2565
+ url: `${contract2.path}?action=execute&queryId=${contract2.queryId}`,
2531
2566
  method: "POST",
2532
- body: { variables: { poll }, queryId: contract.queryId, includeWebMetadata: true },
2567
+ body: { variables: { poll }, queryId: contract2.queryId, includeWebMetadata: true },
2533
2568
  spendClass: "write",
2534
2569
  operation: "create-poll"
2535
2570
  });
@@ -2554,16 +2589,16 @@ async function createPoll(poll, client) {
2554
2589
  }
2555
2590
  return { ok: true, urn };
2556
2591
  }
2557
- function firstUrl(text2) {
2558
- const found = text2.match(/https?:\/\/[^\s<>"]+/)?.[0];
2592
+ function firstUrl(text3) {
2593
+ const found = text3.match(/https?:\/\/[^\s<>"]+/)?.[0];
2559
2594
  if (found === void 0) return null;
2560
2595
  let url = found.replace(/[.,;:!?'"]+$/, "");
2561
2596
  if (url.endsWith(")") && !url.includes("(")) url = url.slice(0, -1);
2562
2597
  return url;
2563
2598
  }
2564
2599
  function urlPreviewUrl(url) {
2565
- const contract = contractFor("urlPreview");
2566
- return `${contract?.path}?includeWebMetadata=true&variables=(url:${encodeURIComponent(url)})&queryId=${contract?.queryId}`;
2600
+ const contract2 = contractFor("urlPreview");
2601
+ return `${contract2?.path}?includeWebMetadata=true&variables=(url:${encodeURIComponent(url)})&queryId=${contract2?.queryId}`;
2567
2602
  }
2568
2603
  function parseUrlPreview(json) {
2569
2604
  const error = gqlError(json);
@@ -2719,8 +2754,8 @@ function previewLines2(post) {
2719
2754
  " about to delete, or that it is yours."
2720
2755
  ];
2721
2756
  }
2722
- const text2 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
2723
- const shown = text2.length > PREVIEW_CHARS ? `${text2.slice(0, PREVIEW_CHARS)}\u2026` : text2;
2757
+ const text3 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
2758
+ const shown = text3.length > PREVIEW_CHARS ? `${text3.slice(0, PREVIEW_CHARS)}\u2026` : text3;
2724
2759
  const lines = [`content "${shown.replace(/\n/g, " ")}"`];
2725
2760
  if (typeof post.scheduledAt === "string") {
2726
2761
  lines.push(`status scheduled, publishes ${post.scheduledAt} unless cancelled`);
@@ -2866,6 +2901,483 @@ async function runDelete(urn, now = Date.now(), deps, quiet = false) {
2866
2901
  return ok("delete", { deleted: urn, verified: post !== void 0, evictedFromCache: evicted });
2867
2902
  }
2868
2903
 
2904
+ // src/engine/jobs.ts
2905
+ function contract(name) {
2906
+ const c = CONTRACTS[name];
2907
+ if (c?.decorationId === void 0) throw new Error(`job contract '${name}' is missing`);
2908
+ return { path: c.path, decorationId: c.decorationId };
2909
+ }
2910
+ var PAGE_SIZE2 = 25;
2911
+ function queryTuple(q2) {
2912
+ const locationUnion = q2.geoId !== void 0 ? { geoId: q2.geoId } : q2.location !== void 0 ? { seoLocation: { location: q2.location } } : void 0;
2913
+ const selected = Object.entries(q2.filters).filter(([, v]) => v.length > 0);
2914
+ return encodeVariables({
2915
+ origin: "JOB_SEARCH_PAGE_JOB_FILTER",
2916
+ keywords: q2.keywords,
2917
+ locationUnion,
2918
+ selectedFilters: selected.length > 0 ? Object.fromEntries(selected) : void 0,
2919
+ spellCorrectionEnabled: true
2920
+ });
2921
+ }
2922
+ function jobSearchUrl(q2) {
2923
+ const c = contract("jobCards");
2924
+ return `${c.path}?decorationId=${c.decorationId}&count=${q2.count}&q=jobSearch&query=${queryTuple(q2)}&start=${q2.start}`;
2925
+ }
2926
+ function jobFiltersUrl(q2) {
2927
+ const c = contract("jobFilters");
2928
+ return `${c.path}?decorationId=${c.decorationId}&q=filters&query=${queryTuple(q2)}`;
2929
+ }
2930
+ function jobDetailUrl(id) {
2931
+ const c = contract("jobPosting");
2932
+ return `${c.path}/${id}?decorationId=${c.decorationId}`;
2933
+ }
2934
+ function jobIdOf(input) {
2935
+ const s = input.trim();
2936
+ if (/^\d+$/.test(s)) return s;
2937
+ const found = s.match(/\/jobs\/view\/(?:[^/?#]*-)?(\d+)/) ?? s.match(/[?&]currentJobId=(\d+)/) ?? s.match(/urn:li:(?:fsd_|fs_normalized_)?jobPosting:(\d+)/);
2938
+ return found?.[1];
2939
+ }
2940
+ var viewUrl = (id) => `https://www.linkedin.com/jobs/view/${id}/`;
2941
+ var day = (ms) => typeof ms === "number" ? new Date(ms).toISOString().slice(0, 10) : void 0;
2942
+ var text2 = (v) => {
2943
+ const t = v?.text;
2944
+ return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
2945
+ };
2946
+ function defined2(obj) {
2947
+ for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
2948
+ return obj;
2949
+ }
2950
+ var WORKPLACE_SUFFIX = {
2951
+ remote: "remote",
2952
+ hybrid: "hybrid",
2953
+ "on-site": "on-site"
2954
+ };
2955
+ function splitLocation(line) {
2956
+ if (line === void 0) return {};
2957
+ const m = line.match(/^(.*?)\s*\(([^()]+)\)$/);
2958
+ const kind = m?.[2] === void 0 ? void 0 : WORKPLACE_SUFFIX[m[2].toLowerCase()];
2959
+ return kind === void 0 || m?.[1] === void 0 ? { location: line } : { location: m[1], workplace: kind };
2960
+ }
2961
+ function cardToJob(card) {
2962
+ const urn = card.jobPostingUrn ?? card["*jobPosting"];
2963
+ const id = typeof urn === "string" ? jobIdOf(urn) : void 0;
2964
+ const title = typeof card.jobPostingTitle === "string" ? card.jobPostingTitle : text2(card.title);
2965
+ if (id === void 0 || title === void 0) return void 0;
2966
+ const footer = Array.isArray(card.footerItems) ? card.footerItems : [];
2967
+ const listed2 = footer.find((f) => f.type === "LISTED_DATE");
2968
+ const insights = footer.filter((f) => !["LISTED_DATE", "PROMOTED", "EASY_APPLY_TEXT"].includes(String(f.type))).map((f) => text2(f.text)).filter((t) => t !== void 0);
2969
+ const insight = text2(card.relevanceInsight?.text);
2970
+ if (insight !== void 0) insights.push(insight);
2971
+ return defined2({
2972
+ id,
2973
+ title,
2974
+ company: text2(card.primaryDescription),
2975
+ ...splitLocation(text2(card.secondaryDescription)),
2976
+ listed: day(listed2?.timeAt),
2977
+ easyApply: footer.some((f) => f.type === "EASY_APPLY_TEXT"),
2978
+ promoted: footer.some((f) => f.type === "PROMOTED"),
2979
+ salary: text2(card.tertiaryDescription),
2980
+ insights: insights.length > 0 ? insights : void 0,
2981
+ url: viewUrl(id)
2982
+ });
2983
+ }
2984
+ var drift2 = (message) => ({
2985
+ ok: false,
2986
+ code: "SCHEMA_DRIFT",
2987
+ message,
2988
+ hint: "the job search response changed shape; re-capture it"
2989
+ });
2990
+ function readCards(elements, included) {
2991
+ const byUrn = /* @__PURE__ */ new Map();
2992
+ for (const node of included) {
2993
+ if (typeof node.entityUrn === "string") byUrn.set(node.entityUrn, node);
2994
+ }
2995
+ const jobs = [];
2996
+ const unknownTypes = {};
2997
+ let unresolved = 0;
2998
+ for (const el of elements) {
2999
+ const union = el.jobCardUnion ?? {};
3000
+ const ref = union["*jobPostingCard"];
3001
+ if (typeof ref !== "string") {
3002
+ for (const kind of Object.keys(union)) unknownTypes[kind] = (unknownTypes[kind] ?? 0) + 1;
3003
+ continue;
3004
+ }
3005
+ const card = byUrn.get(ref);
3006
+ const job = card === void 0 ? void 0 : cardToJob(card);
3007
+ if (job === void 0) unresolved++;
3008
+ else if (!jobs.some((j) => j.id === job.id)) jobs.push(job);
3009
+ }
3010
+ return { jobs, unknownTypes, unresolved };
3011
+ }
3012
+ function resolvedGeo(included) {
3013
+ const geo = included.find((n) => typeof n.$type === "string" && n.$type.endsWith(".common.Geo"));
3014
+ const geoId = typeof geo?.entityUrn === "string" ? geo.entityUrn.split(":").pop() : void 0;
3015
+ const name = typeof geo?.fullLocalizedName === "string" ? geo.fullLocalizedName : void 0;
3016
+ return geoId !== void 0 && name !== void 0 ? { location: { geoId, name } } : {};
3017
+ }
3018
+ function parseJobCards(json) {
3019
+ const root = json;
3020
+ const data = root?.data;
3021
+ const elements = data?.elements;
3022
+ if (data === void 0 || !Array.isArray(elements))
3023
+ return drift2("the job search returned no result list");
3024
+ const paging = data.paging ?? {};
3025
+ const total = typeof paging.total === "number" ? paging.total : void 0;
3026
+ const start = typeof paging.start === "number" ? paging.start : 0;
3027
+ const included = root?.included ?? [];
3028
+ const { jobs, unknownTypes, unresolved } = readCards(elements, included);
3029
+ if (unresolved > 0 && jobs.length === 0)
3030
+ return drift2(`${unresolved} job cards were listed but none could be read`);
3031
+ if (elements.length === 0 && total !== void 0 && total > start) {
3032
+ return {
3033
+ ok: false,
3034
+ code: "SCHEMA_DRIFT",
3035
+ message: `LinkedIn claims ${total} jobs but returned none from ${start}`,
3036
+ hint: 'a failed fetch, not an empty search; do not report "no jobs"'
3037
+ };
3038
+ }
3039
+ return { ok: true, jobs, total, start, ...resolvedGeo(included), unknownTypes };
3040
+ }
3041
+ var WORKPLACE_URN = { "1": "on-site", "2": "remote", "3": "hybrid" };
3042
+ function applyOf(method) {
3043
+ const m = method;
3044
+ if (m === null || m === void 0) return void 0;
3045
+ const type = String(m.$type ?? "");
3046
+ if (type.endsWith("OffsiteApply")) {
3047
+ const url = typeof m.companyApplyUrl === "string" ? m.companyApplyUrl : void 0;
3048
+ return defined2({ type: "external", url });
3049
+ }
3050
+ if (type.endsWith("OnsiteApply")) {
3051
+ const url = typeof m.easyApplyUrl === "string" ? m.easyApplyUrl : void 0;
3052
+ return defined2({ type: "easy-apply", url });
3053
+ }
3054
+ return void 0;
3055
+ }
3056
+ function parseJobDetail(json) {
3057
+ const root = json;
3058
+ const d = root?.data;
3059
+ const rawId = d?.jobPostingId ?? d?.entityUrn;
3060
+ const id = rawId === void 0 ? void 0 : jobIdOf(String(rawId));
3061
+ if (d === void 0 || id === void 0 || typeof d.title !== "string")
3062
+ return drift2("the job response carried no posting");
3063
+ const included = root?.included ?? [];
3064
+ const find = (urn) => typeof urn === "string" ? included.find((n) => n.entityUrn === urn) : void 0;
3065
+ const details = d.companyDetails ?? {};
3066
+ const company = find(details.company ?? details["*companyResolutionResult"]);
3067
+ const companyName = typeof company?.name === "string" ? company.name : typeof details.companyName === "string" ? details.companyName : void 0;
3068
+ const workplaces = Array.isArray(d.workplaceTypes) ? d.workplaceTypes : [];
3069
+ const workplace = WORKPLACE_URN[String(workplaces[0]?.split(":").pop())];
3070
+ const applying = find(d["*applyingInfo"]);
3071
+ const saving = find(d["*savingInfo"]);
3072
+ const list2 = (v) => Array.isArray(v) && v.length > 0 ? v.filter((x) => typeof x === "string") : void 0;
3073
+ return {
3074
+ ok: true,
3075
+ job: defined2({
3076
+ id,
3077
+ title: d.title,
3078
+ company: companyName,
3079
+ companyUrl: typeof company?.url === "string" ? company.url : void 0,
3080
+ location: typeof d.formattedLocation === "string" ? d.formattedLocation : void 0,
3081
+ workplace: workplace ?? (d.workRemoteAllowed === true ? "remote" : void 0),
3082
+ employmentType: typeof d.formattedEmploymentStatus === "string" && d.formattedEmploymentStatus !== "" ? d.formattedEmploymentStatus : void 0,
3083
+ experienceLevel: typeof d.formattedExperienceLevel === "string" && d.formattedExperienceLevel !== "" ? d.formattedExperienceLevel : void 0,
3084
+ industries: list2(d.formattedIndustries),
3085
+ functions: list2(d.formattedJobFunctions),
3086
+ listed: day(d.listedAt),
3087
+ expires: day(d.expireAt),
3088
+ state: typeof d.jobState === "string" ? d.jobState : void 0,
3089
+ applicants: typeof d.applies === "number" && d.applies > 0 ? d.applies : void 0,
3090
+ apply: applyOf(d.applyMethod),
3091
+ ats: typeof d.applicantTrackingSystem === "string" ? d.applicantTrackingSystem : void 0,
3092
+ applied: typeof applying?.applied === "boolean" ? applying.applied : void 0,
3093
+ saved: typeof saving?.saved === "boolean" ? saving.saved : void 0,
3094
+ description: text2(d.description),
3095
+ url: viewUrl(id)
3096
+ })
3097
+ };
3098
+ }
3099
+ function parseJobFilters(json) {
3100
+ const elements = json?.data?.elements;
3101
+ if (!Array.isArray(elements)) return drift2("the job filter list was missing");
3102
+ const filters = [];
3103
+ for (const el of elements) {
3104
+ const groups = [
3105
+ ...el.secondaryFilterGroups ?? [],
3106
+ ...el.primaryFilterGroups ?? []
3107
+ ];
3108
+ for (const group of groups) {
3109
+ for (const f of group.filters ?? []) {
3110
+ const key = f.parameterName;
3111
+ if (typeof key !== "string" || filters.some((x) => x.key === key)) continue;
3112
+ const values = [
3113
+ ...f.secondaryFilterValues ?? [],
3114
+ ...f.primaryFilterValues ?? []
3115
+ ];
3116
+ const options = values.filter((v) => typeof v.value === "string").map(
3117
+ (v) => defined2({
3118
+ value: v.value,
3119
+ label: text2(v.displayName) ?? (typeof v.displayName === "string" ? v.displayName : String(v.value)),
3120
+ count: typeof v.count === "number" ? v.count : void 0
3121
+ })
3122
+ );
3123
+ if (options.length === 0) continue;
3124
+ filters.push({ key, label: text2(f.displayName) ?? key, options });
3125
+ }
3126
+ }
3127
+ }
3128
+ if (filters.length === 0) return drift2("the job filter list was empty");
3129
+ return { ok: true, filters };
3130
+ }
3131
+ var NAMED = {
3132
+ experience: {
3133
+ param: "experience",
3134
+ values: {
3135
+ internship: "1",
3136
+ entry: "2",
3137
+ associate: "3",
3138
+ "mid-senior": "4",
3139
+ senior: "4",
3140
+ director: "5",
3141
+ executive: "6"
3142
+ }
3143
+ },
3144
+ type: {
3145
+ param: "jobType",
3146
+ values: {
3147
+ "full-time": "F",
3148
+ "part-time": "P",
3149
+ contract: "C",
3150
+ temporary: "T",
3151
+ volunteer: "V",
3152
+ internship: "I",
3153
+ other: "O"
3154
+ }
3155
+ },
3156
+ workplace: {
3157
+ param: "workplaceType",
3158
+ values: { "on-site": "1", onsite: "1", remote: "2", hybrid: "3" }
3159
+ }
3160
+ };
3161
+ var POSTED = {
3162
+ day: 86400,
3163
+ "24h": 86400,
3164
+ week: 604800,
3165
+ month: 2592e3
3166
+ };
3167
+ var Refused = class extends Error {
3168
+ };
3169
+ function postedRange(given) {
3170
+ const p = given.toLowerCase();
3171
+ const n = p.match(/^(\d+)([hd])$/);
3172
+ const seconds = POSTED[p] ?? (n ? Number(n[1]) * (n[2] === "h" ? 3600 : 86400) : void 0);
3173
+ if (seconds === void 0)
3174
+ throw new Refused(`--posted '${given}' is not one of: 24h, week, month, or <N>h / <N>d`);
3175
+ return `r${seconds}`;
3176
+ }
3177
+ function named(name, given) {
3178
+ const { values } = NAMED[name];
3179
+ const out = [];
3180
+ for (const v of given) {
3181
+ const mapped = values[v.toLowerCase()] ?? (Object.values(values).includes(v) ? v : void 0);
3182
+ if (mapped === void 0)
3183
+ throw new Refused(`--${name} '${v}' is not one of: ${Object.keys(values).join(", ")}`);
3184
+ if (!out.includes(mapped)) out.push(mapped);
3185
+ }
3186
+ return out;
3187
+ }
3188
+ function rawFilter(r) {
3189
+ const m = r.match(/^([A-Za-z_]+)=(.+)$/);
3190
+ if (m?.[1] === void 0 || m[2] === void 0)
3191
+ throw new Refused(`--filter '${r}' is not key=value[,value]`);
3192
+ const values = m[2].split(",").map((v) => v.trim()).filter((v) => v !== "");
3193
+ return [m[1], values];
3194
+ }
3195
+ function selection(o) {
3196
+ const filters = {};
3197
+ if (o.posted !== void 0) filters.timePostedRange = [postedRange(o.posted)];
3198
+ for (const name of ["experience", "type", "workplace"]) {
3199
+ const given = o[name];
3200
+ if (given !== void 0 && given.length > 0)
3201
+ filters[NAMED[name].param] = named(name, given);
3202
+ }
3203
+ const flags = [
3204
+ [o.easyApply, "applyWithLinkedin"],
3205
+ [o.under10, "earlyApplicant"],
3206
+ [o.verified, "verifiedJob"],
3207
+ [o.inNetwork, "jobInYourNetwork"],
3208
+ [o.fairChance, "fairChanceEmployer"]
3209
+ ];
3210
+ for (const [on, param] of flags) if (on === true) filters[param] = ["true"];
3211
+ const ids = [
3212
+ [o.company, "company"],
3213
+ [o.industry, "industry"],
3214
+ [o.function, "function"],
3215
+ [o.title, "title"],
3216
+ [o.place, "populatedPlace"]
3217
+ ];
3218
+ for (const [given, param] of ids)
3219
+ if (given !== void 0 && given.length > 0) filters[param] = given;
3220
+ if (o.sort !== void 0) {
3221
+ const sort = { recent: "DD", relevant: "R" }[o.sort.toLowerCase()];
3222
+ if (sort === void 0) throw new Refused(`--sort '${o.sort}' is not one of: recent, relevant`);
3223
+ filters.sortBy = [sort];
3224
+ }
3225
+ if (o.distance !== void 0) filters.distance = [String(o.distance)];
3226
+ for (const r of o.raw ?? []) {
3227
+ const [key, values] = rawFilter(r);
3228
+ filters[key] = values;
3229
+ }
3230
+ return filters;
3231
+ }
3232
+ function jobFilterSelection(o) {
3233
+ try {
3234
+ return { ok: true, filters: selection(o) };
3235
+ } catch (e) {
3236
+ if (e instanceof Refused) return { ok: false, code: "INVALID_INPUT", message: e.message };
3237
+ throw e;
3238
+ }
3239
+ }
3240
+
3241
+ // src/commands/jobs.ts
3242
+ function liveFetch(command, quiet) {
3243
+ const session = loadSession();
3244
+ if (session.state !== "ok")
3245
+ return err(command, "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
3246
+ const client = createLiveClient(session.session, void 0, quiet);
3247
+ return async (url, spendClass) => {
3248
+ const r = await client.request({ url, spendClass, operation: command });
3249
+ return r.ok ? { ok: true, json: r.json } : r;
3250
+ };
3251
+ }
3252
+ var MAX_RESULTS = 1e3;
3253
+ function compactJob(j) {
3254
+ const parts = [j.id, j.title, j.company, j.location, j.workplace, j.listed];
3255
+ if (j.easyApply) parts.push("easy apply");
3256
+ if (j.promoted) parts.push("promoted");
3257
+ parts.push(j.salary);
3258
+ if (j.apply?.url !== void 0) parts.push(`apply: ${j.apply.url}`);
3259
+ return parts.filter((p) => p !== void 0 && p !== "").map((p) => p.replaceAll(" | ", " / ")).join(" | ");
3260
+ }
3261
+ function shape(rows, opts, line) {
3262
+ if (opts.compact === true) return rows.map(line);
3263
+ if (opts.fields !== void 0 && opts.fields !== "")
3264
+ return project(rows, opts.fields);
3265
+ return rows;
3266
+ }
3267
+ function queryOf(req, filters) {
3268
+ return {
3269
+ ...req.keywords ? { keywords: req.keywords } : {},
3270
+ ...req.location ? { location: req.location } : {},
3271
+ ...req.geoId ? { geoId: req.geoId } : {},
3272
+ filters
3273
+ };
3274
+ }
3275
+ async function collect(get, query, first, want) {
3276
+ const out = { jobs: [], exhausted: false, unknownTypes: {} };
3277
+ for (let start = first; out.jobs.length < want && start < MAX_RESULTS; start += PAGE_SIZE2) {
3278
+ const res = await get(jobSearchUrl({ ...query, start, count: PAGE_SIZE2 }), "jobSearch");
3279
+ const page = res.ok ? parseJobCards(res.json) : res;
3280
+ if (!page.ok) {
3281
+ if (out.jobs.length === 0) return page;
3282
+ out.stoppedBy = page.code;
3283
+ break;
3284
+ }
3285
+ out.total = page.total ?? out.total;
3286
+ out.resolved = page.location ?? out.resolved;
3287
+ for (const [k, n] of Object.entries(page.unknownTypes))
3288
+ out.unknownTypes[k] = (out.unknownTypes[k] ?? 0) + n;
3289
+ const fresh = page.jobs.filter((j) => !out.jobs.some((x) => x.id === j.id));
3290
+ out.jobs.push(...fresh.slice(0, want - out.jobs.length));
3291
+ if (page.jobs.length === 0 || out.total !== void 0 && start + PAGE_SIZE2 >= out.total) {
3292
+ out.exhausted = true;
3293
+ break;
3294
+ }
3295
+ }
3296
+ return out;
3297
+ }
3298
+ async function addDetails(get, jobs, withDescription) {
3299
+ for (const job of jobs) {
3300
+ const res = await get(jobDetailUrl(job.id), "jobRead");
3301
+ const detail = res.ok ? parseJobDetail(res.json) : res;
3302
+ if (!detail.ok) return detail.code;
3303
+ const { description, id: _id, url: _url, ...rest } = detail.job;
3304
+ Object.assign(job, rest, withDescription ? { description } : {});
3305
+ }
3306
+ return void 0;
3307
+ }
3308
+ async function runJobs(req, opts = {}, fetch2) {
3309
+ const hasQuery = [req.keywords, req.location, req.geoId].some((v) => v !== void 0 && v !== "");
3310
+ if (!hasQuery) {
3311
+ return err(
3312
+ "jobs",
3313
+ "INVALID_INPUT",
3314
+ "give keywords, a location, or both",
3315
+ 'lnrelay jobs "<keywords>" [--location "<place>" | --geo <id>] [filters]'
3316
+ );
3317
+ }
3318
+ const selection2 = jobFilterSelection(req.filter ?? {});
3319
+ if (!selection2.ok)
3320
+ return err("jobs", selection2.code, selection2.message, "see `lnrelay help jobs`");
3321
+ const get = fetch2 ?? liveFetch("jobs", opts.quiet === true);
3322
+ if (typeof get !== "function") return get;
3323
+ const first = Math.max(0, req.start ?? 0);
3324
+ const want = Math.max(1, Math.min(req.limit, MAX_RESULTS - first));
3325
+ const query = queryOf(req, selection2.filters);
3326
+ const found = await collect(get, query, first, want);
3327
+ if ("ok" in found) return err("jobs", found.code, found.message, found.hint);
3328
+ if (req.details === true) {
3329
+ const stopped = await addDetails(get, found.jobs, req.description === true);
3330
+ found.stoppedBy = found.stoppedBy ?? stopped;
3331
+ }
3332
+ const { jobs, stoppedBy, exhausted, unknownTypes } = found;
3333
+ return ok("jobs", {
3334
+ query,
3335
+ ...found.resolved !== void 0 ? { location: found.resolved } : {},
3336
+ items: shape(jobs, opts, compactJob),
3337
+ meta: {
3338
+ state: stoppedBy === void 0 && exhausted ? "complete" : "partial",
3339
+ operation: "jobs",
3340
+ claimedCount: found.total,
3341
+ returnedCount: jobs.length,
3342
+ start: first,
3343
+ next: exhausted ? void 0 : first + jobs.length,
3344
+ ...stoppedBy !== void 0 ? { stoppedBy } : {},
3345
+ ...Object.keys(unknownTypes).length > 0 ? { unknownTypes } : {}
3346
+ }
3347
+ });
3348
+ }
3349
+ async function runJob(input, opts = {}, fetch2) {
3350
+ const id = input === void 0 ? void 0 : jobIdOf(input);
3351
+ if (id === void 0) {
3352
+ return err("job", "INVALID_INPUT", "a job id or job URL is required", "lnrelay job <id|url>");
3353
+ }
3354
+ const get = fetch2 ?? liveFetch("job", opts.quiet === true);
3355
+ if (typeof get !== "function") return get;
3356
+ const res = await get(jobDetailUrl(id), "jobRead");
3357
+ if (!res.ok) return err("job", res.code, res.message, res.hint);
3358
+ const detail = parseJobDetail(res.json);
3359
+ if (!detail.ok) return err("job", detail.code, detail.message, detail.hint);
3360
+ return ok("job", detail.job);
3361
+ }
3362
+ async function runJobFilters(req, opts = {}, fetch2) {
3363
+ const selection2 = jobFilterSelection(req.filter ?? {});
3364
+ if (!selection2.ok) return err("job-filters", selection2.code, selection2.message);
3365
+ const get = fetch2 ?? liveFetch("job-filters", opts.quiet === true);
3366
+ if (typeof get !== "function") return get;
3367
+ const url = jobFiltersUrl({ ...queryOf(req, selection2.filters), start: 0, count: PAGE_SIZE2 });
3368
+ const res = await get(url, "jobSearch");
3369
+ const parsed = res.ok ? parseJobFilters(res.json) : res;
3370
+ if (!parsed.ok) return err("job-filters", parsed.code, parsed.message, parsed.hint);
3371
+ return ok("job-filters", {
3372
+ items: shape(
3373
+ parsed.filters,
3374
+ opts,
3375
+ (f) => `${f.key}: ${f.options.map((o) => `${o.value}=${o.label}${o.count !== void 0 ? ` (${o.count})` : ""}`).join(", ")}`
3376
+ ),
3377
+ meta: { state: "complete", operation: "job-filters", returnedCount: parsed.filters.length }
3378
+ });
3379
+ }
3380
+
2869
3381
  // src/commands/live.ts
2870
3382
  function withSession(command, quiet = false) {
2871
3383
  const loaded = sessionFor(command);
@@ -3102,7 +3614,15 @@ function runBudget(now, resetCooldown, confirmed) {
3102
3614
  `moved to ${corrupt.quarantinedTo}. A corrupt ledger is NOT treated as an empty one \u2014 that would silently restore a full budget. Inspect it, then re-run.`
3103
3615
  );
3104
3616
  }
3105
- const classes = ["profile", "search", "page", "write", "global"];
3617
+ const classes = [
3618
+ "profile",
3619
+ "search",
3620
+ "page",
3621
+ "jobSearch",
3622
+ "jobRead",
3623
+ "write",
3624
+ "global"
3625
+ ];
3106
3626
  const { value: cooldown } = loadCooldown();
3107
3627
  return ok("budget", {
3108
3628
  classes: classes.map((c) => ({
@@ -3215,18 +3735,18 @@ async function exchange(code, config, deps) {
3215
3735
  } catch (e) {
3216
3736
  return { ok: false, message: `could not reach LinkedIn: ${e.message}` };
3217
3737
  }
3218
- const text2 = await res.text();
3738
+ const text3 = await res.text();
3219
3739
  if (res.status !== 200) {
3220
3740
  return {
3221
3741
  ok: false,
3222
3742
  message: `LinkedIn rejected the code exchange (${res.status})`,
3223
3743
  // The most common causes, in the order they actually happen.
3224
- hint: `Check that the app has BOTH products added, and that its Auth tab lists exactly ${REDIRECT_URI} as an authorized redirect URL. Response: ${text2.slice(0, 200)}`
3744
+ hint: `Check that the app has BOTH products added, and that its Auth tab lists exactly ${REDIRECT_URI} as an authorized redirect URL. Response: ${text3.slice(0, 200)}`
3225
3745
  };
3226
3746
  }
3227
3747
  let parsed;
3228
3748
  try {
3229
- parsed = JSON.parse(text2);
3749
+ parsed = JSON.parse(text3);
3230
3750
  } catch {
3231
3751
  return { ok: false, message: "token response was not JSON" };
3232
3752
  }
@@ -3522,7 +4042,34 @@ var COMMANDS = [
3522
4042
  name: "search",
3523
4043
  cost: "cheap \u2014 the net",
3524
4044
  summary: "Search people, companies or jobs. Cast wide, then deep-read the finalists.",
3525
- usage: 'lnrelay search people|companies|jobs "<query>" [--limit N]\n [--compact | --fields a,b,c] [--retain] [--raw]',
4045
+ usage: 'lnrelay search people|companies|jobs "<query>" [--limit N] (jobs: see `jobs`)\n [--compact | --fields a,b,c] [--retain] [--raw]',
4046
+ audience: ["cli", "mcp"],
4047
+ risk: "read",
4048
+ implemented: true
4049
+ },
4050
+ {
4051
+ name: "jobs",
4052
+ cost: "1 job-search call per 25 jobs; --details adds 1 job read per job",
4053
+ summary: "Job search with every filter the jobs page has. Cards carry id, title, company, place, workplace, listed date, Easy Apply. Read finalists with `job`.",
4054
+ usage: 'lnrelay jobs "<keywords>" [--location "<place>" | --geo <id>] [--distance <miles>]\n [--posted 24h|week|month|<N>h|<N>d] [--experience internship,entry,associate,\n mid-senior,director,executive] [--type full-time,part-time,contract,temporary,\n volunteer,internship,other] [--workplace on-site,remote,hybrid] [--easy-apply]\n [--under-10] [--verified] [--in-network] [--fair-chance] [--company <ids>]\n [--industry <ids>] [--function <codes>] [--title <ids>] [--place <geo-ids>]\n [--filter key=v1,v2 ...] [--sort recent|relevant] [--limit N] [--start N]\n [--details [--description]] [--compact | --fields a,b,c]\n Ids for --company/--industry/--title/--place/--filter come from `job-filters`.\n The resolved place is in data.location: check it, "Vienna" may resolve narrow.',
4055
+ audience: ["cli", "mcp"],
4056
+ risk: "read",
4057
+ implemented: true
4058
+ },
4059
+ {
4060
+ name: "job",
4061
+ cost: "1 job read",
4062
+ summary: "One job: description, apply link (external or Easy Apply), applicants, state.",
4063
+ usage: "lnrelay job <id|job-url>",
4064
+ audience: ["cli", "mcp"],
4065
+ risk: "read",
4066
+ implemented: true
4067
+ },
4068
+ {
4069
+ name: "job-filters",
4070
+ cost: "1 job-search call",
4071
+ summary: "Every job filter for a query, with option ids and live counts: what `jobs --filter` and --company/--industry/--title/--place take.",
4072
+ usage: 'lnrelay job-filters "<keywords>" [--location "<place>" | --geo <id>] [jobs filters]',
3526
4073
  audience: ["cli", "mcp"],
3527
4074
  risk: "read",
3528
4075
  implemented: true
@@ -3554,15 +4101,6 @@ var COMMANDS = [
3554
4101
  risk: "read",
3555
4102
  implemented: false
3556
4103
  },
3557
- {
3558
- name: "job",
3559
- cost: "1 call",
3560
- summary: "A job posting detail.",
3561
- usage: "lnrelay job <job-id|url>",
3562
- audience: ["cli", "mcp"],
3563
- risk: "read",
3564
- implemented: false
3565
- },
3566
4104
  {
3567
4105
  name: "feed",
3568
4106
  cost: "medium",
@@ -3783,10 +4321,10 @@ function balanced(s, start) {
3783
4321
  return null;
3784
4322
  }
3785
4323
  function parseAt(s, start) {
3786
- const text2 = start < 0 ? null : balanced(s, start);
3787
- if (text2 === null) return null;
4324
+ const text3 = start < 0 ? null : balanced(s, start);
4325
+ if (text3 === null) return null;
3788
4326
  try {
3789
- return JSON.parse(text2);
4327
+ return JSON.parse(text3);
3790
4328
  } catch {
3791
4329
  return null;
3792
4330
  }
@@ -3957,7 +4495,7 @@ var PROFILE_FIELDS = {
3957
4495
  maxLength: 2600
3958
4496
  }
3959
4497
  };
3960
- var drift2 = (message) => ({
4498
+ var drift3 = (message) => ({
3961
4499
  ok: false,
3962
4500
  code: "SCHEMA_DRIFT",
3963
4501
  message,
@@ -3965,10 +4503,10 @@ var drift2 = (message) => ({
3965
4503
  });
3966
4504
  function readForm(stream, field) {
3967
4505
  const states2 = readModel(stream);
3968
- if (states2 === null) return drift2("the profile form carried no initial values");
4506
+ if (states2 === null) return drift3("the profile form carried no initial values");
3969
4507
  const args = findRequest(stream, field.save);
3970
4508
  if (args === null)
3971
- return drift2(`the profile form carried no ${field.save.split(".").pop()} action`);
4509
+ return drift3(`the profile form carried no ${field.save.split(".").pop()} action`);
3972
4510
  return { ok: true, args, states: states2, screen: field.screen, save: field.save };
3973
4511
  }
3974
4512
  function boundKey(form, property) {
@@ -3984,7 +4522,7 @@ function topSkills(form) {
3984
4522
  return (key) => {
3985
4523
  if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
3986
4524
  const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
3987
- if (initial === void 0) return drift2("the About form carried no initial top skills");
4525
+ if (initial === void 0) return drift3("the About form carried no initial top skills");
3988
4526
  if (!Array.isArray(initial.value) || initial.value.length > 0) {
3989
4527
  return {
3990
4528
  ok: false,
@@ -4007,7 +4545,7 @@ function saveBody(form, field, value) {
4007
4545
  const target = boundKey(form, field.binding);
4008
4546
  const current = target === void 0 ? void 0 : form.states.get(target);
4009
4547
  if (target === void 0 || current === void 0) {
4010
- return drift2(`the profile form has no ${field.name} field`);
4548
+ return drift3(`the profile form has no ${field.name} field`);
4011
4549
  }
4012
4550
  const model = new Map(form.states);
4013
4551
  model.set(target, { ...current, value });
@@ -4076,7 +4614,7 @@ var POSITION = {
4076
4614
  var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
4077
4615
  function listPositions(stream) {
4078
4616
  if (readModel(stream) === null && !stream.includes(EDIT_NAV) && !stream.includes('"rows"')) {
4079
- return drift2("the Experience screen could not be read");
4617
+ return drift3("the Experience screen could not be read");
4080
4618
  }
4081
4619
  const positions = [];
4082
4620
  const seen = /* @__PURE__ */ new Set();
@@ -4084,27 +4622,27 @@ function listPositions(stream) {
4084
4622
  for (; ; ) {
4085
4623
  i = stream.indexOf(EDIT_NAV, i);
4086
4624
  if (i === -1) break;
4087
- const text2 = balanced(stream, i);
4625
+ const text3 = balanced(stream, i);
4088
4626
  i += EDIT_NAV.length;
4089
- if (text2 === null) continue;
4090
- const payload = JSON.parse(text2).requestedArguments?.payload;
4627
+ if (text3 === null) continue;
4628
+ const payload = JSON.parse(text3).requestedArguments?.payload;
4091
4629
  const id = payload?.positionId;
4092
4630
  if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
4093
4631
  seen.add(id);
4094
4632
  positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
4095
4633
  }
4096
4634
  if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
4097
- return drift2("the Experience screen listed no roles and did not look like one");
4635
+ return drift3("the Experience screen listed no roles and did not look like one");
4098
4636
  }
4099
4637
  return { ok: true, positions };
4100
4638
  }
4101
4639
  function readPositionForm(stream) {
4102
4640
  const model = readModel(stream);
4103
- if (model === null) return drift2("the position form carried no initial values");
4641
+ if (model === null) return drift3("the position form carried no initial values");
4104
4642
  const media = findRequest(stream, POSITION.media);
4105
4643
  const prefix = media?.payload.formIdPrefix;
4106
4644
  if (media === null || typeof prefix !== "string") {
4107
- return drift2("the position form carried no save step (uploadPositionMedia)");
4645
+ return drift3("the position form carried no save step (uploadPositionMedia)");
4108
4646
  }
4109
4647
  const del = findRequest(stream, POSITION.delete);
4110
4648
  return {
@@ -4155,7 +4693,7 @@ function applyChanges(form, changes) {
4155
4693
  }
4156
4694
  need("dynamicallyCreateHeadline", false);
4157
4695
  need("allowProfileEditBroadcasts", changes.notify === true);
4158
- if (missing.length > 0) return drift2(`the position form has no ${missing.join(", ")} field`);
4696
+ if (missing.length > 0) return drift3(`the position form has no ${missing.join(", ")} field`);
4159
4697
  const s = roleSummary(model);
4160
4698
  if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
4161
4699
  return {
@@ -4200,7 +4738,7 @@ function mediaBody(form, model) {
4200
4738
  }
4201
4739
  function saveFromReply(reply) {
4202
4740
  const args = findRequest(reply, POSITION.save);
4203
- return args === null ? drift2("the media step did not hand back the save action") : { ok: true, args };
4741
+ return args === null ? drift3("the media step did not hand back the save action") : { ok: true, args };
4204
4742
  }
4205
4743
  function positionSaveBody(save, model, screen) {
4206
4744
  const sending = new Map(model);
@@ -4212,7 +4750,7 @@ function positionSaveBody(save, model, screen) {
4212
4750
  }
4213
4751
  function deleteBody(form) {
4214
4752
  if (form.del === null)
4215
- return drift2("this form has no delete action (it is not an existing role)");
4753
+ return drift3("this form has no delete action (it is not an existing role)");
4216
4754
  const states2 = wireStates(keysOf(form.del), form.model, resolver);
4217
4755
  if (!Array.isArray(states2)) return states2;
4218
4756
  return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
@@ -4290,9 +4828,9 @@ async function send(url, body, token, deps) {
4290
4828
  } catch (e) {
4291
4829
  return { ok: false, code: "FETCH_FAILED", message: e.message };
4292
4830
  }
4293
- const text2 = await res.text();
4831
+ const text3 = await res.text();
4294
4832
  if (res.status === 201 || res.status === 200) {
4295
- const id = res.headers.get("x-restli-id") ?? extractId(text2);
4833
+ const id = res.headers.get("x-restli-id") ?? extractId(text3);
4296
4834
  return {
4297
4835
  ok: true,
4298
4836
  id: id ?? "(unknown)",
@@ -4319,7 +4857,7 @@ async function send(url, body, token, deps) {
4319
4857
  ok: false,
4320
4858
  code: "FETCH_FAILED",
4321
4859
  message: `write failed (${res.status})`,
4322
- hint: text2.slice(0, 300)
4860
+ hint: text3.slice(0, 300)
4323
4861
  };
4324
4862
  }
4325
4863
  function extractId(body) {
@@ -4367,7 +4905,7 @@ function feedTypeFor(bindingKey) {
4367
4905
  function stateKey(prefix, body) {
4368
4906
  return `${prefix}-${body}`;
4369
4907
  }
4370
- function states(text2, body) {
4908
+ function states(text3, body) {
4371
4909
  return STATE_PREFIXES.map((prefix) => {
4372
4910
  const key = stateKey(prefix, body);
4373
4911
  const base = {
@@ -4376,19 +4914,19 @@ function states(text2, body) {
4376
4914
  protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
4377
4915
  };
4378
4916
  if (prefix === "commentBoxText") {
4379
- return { ...base, value: text2, originalProtoCase: "stringValue" };
4917
+ return { ...base, value: text3, originalProtoCase: "stringValue" };
4380
4918
  }
4381
4919
  if (prefix === "richCommentBoxText") {
4382
4920
  return {
4383
4921
  ...base,
4384
- value: { text: text2, attribute: [], $type: "TextModel", source: "local" },
4922
+ value: { text: text3, attribute: [], $type: "TextModel", source: "local" },
4385
4923
  originalProtoCase: "textModelForWrite"
4386
4924
  };
4387
4925
  }
4388
4926
  return { ...base, value: "", originalProtoCase: "stringValue" };
4389
4927
  });
4390
4928
  }
4391
- function commentBody(activityId, text2, tokens, feedType) {
4929
+ function commentBody(activityId, text3, tokens, feedType) {
4392
4930
  const body = keyBody(tokens.bindingKey);
4393
4931
  const activityUrn = { activityUrn: { activityId } };
4394
4932
  const binding = (prefix) => ({
@@ -4435,17 +4973,17 @@ function commentBody(activityId, text2, tokens, feedType) {
4435
4973
  isStreaming: false,
4436
4974
  rumPageKey: ""
4437
4975
  },
4438
- states: states(text2, body),
4976
+ states: states(text3, body),
4439
4977
  requestedArguments: {
4440
4978
  ...args,
4441
- states: states(text2, body),
4979
+ states: states(text3, body),
4442
4980
  screenId: SCREEN_ID3,
4443
4981
  knownTemplateIds: []
4444
4982
  }
4445
4983
  };
4446
4984
  }
4447
4985
  async function comment(confirmed, client) {
4448
- const { activityId, text: text2, tokens } = confirmed.payload;
4986
+ const { activityId, text: text3, tokens } = confirmed.payload;
4449
4987
  if (!keyMatchesPost(tokens.bindingKey, activityId)) {
4450
4988
  return {
4451
4989
  ok: false,
@@ -4466,7 +5004,7 @@ async function comment(confirmed, client) {
4466
5004
  const result = await client.request({
4467
5005
  url: COMMENT_URL,
4468
5006
  method: "POST",
4469
- body: commentBody(activityId, text2, tokens, feedType),
5007
+ body: commentBody(activityId, text3, tokens, feedType),
4470
5008
  spendClass: "write",
4471
5009
  operation: "comment.create"
4472
5010
  });
@@ -4590,10 +5128,10 @@ var REPLY_URL = `https://www.linkedin.com/voyager/api/voyagerSocialDashNormComme
4590
5128
  function parentThreadUrn(ref) {
4591
5129
  return `urn:li:comment:(${ref.threadType}:${ref.activityId},${ref.commentId})`;
4592
5130
  }
4593
- function replyBody(ref, text2) {
5131
+ function replyBody(ref, text3) {
4594
5132
  return {
4595
5133
  commentary: {
4596
- text: text2,
5134
+ text: text3,
4597
5135
  // The captured reply carried a profileMention, because LinkedIn's UI
4598
5136
  // pre-fills "@Author " into the box. We send none: an @mention notifies a
4599
5137
  // real person, and inventing one would put words — and a notification —
@@ -4605,11 +5143,11 @@ function replyBody(ref, text2) {
4605
5143
  };
4606
5144
  }
4607
5145
  async function replyToComment(confirmed, client) {
4608
- const { ref, text: text2 } = confirmed.payload;
5146
+ const { ref, text: text3 } = confirmed.payload;
4609
5147
  const result = await client.request({
4610
5148
  url: REPLY_URL,
4611
5149
  method: "POST",
4612
- body: replyBody(ref, text2),
5150
+ body: replyBody(ref, text3),
4613
5151
  spendClass: "write",
4614
5152
  operation: "reply"
4615
5153
  });
@@ -4971,8 +5509,8 @@ function whenLine(at, now) {
4971
5509
  const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
4972
5510
  return `when ${local} (${zone}) \u2014 ${away}`;
4973
5511
  }
4974
- async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
4975
- if (text2 === void 0 || text2.trim() === "") {
5512
+ async function runShare(text3, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
5513
+ if (text3 === void 0 || text3.trim() === "") {
4976
5514
  return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
4977
5515
  }
4978
5516
  const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
@@ -4987,7 +5525,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
4987
5525
  via: via2
4988
5526
  });
4989
5527
  if (pollSpec !== void 0 && "ok" in pollSpec) return pollSpec;
4990
- const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text2) : null;
5528
+ const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text3) : null;
4991
5529
  const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
4992
5530
  const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
4993
5531
  if ("ok" in ctx) return ctx;
@@ -4996,7 +5534,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
4996
5534
  const plan = sharePlan({
4997
5535
  author: authorLine(ctx.transport),
4998
5536
  transport: ctx.transport.kind,
4999
- text: text2,
5537
+ text: text3,
5000
5538
  visibility: vis,
5001
5539
  media: loaded?.approved,
5002
5540
  scheduledAt,
@@ -5019,7 +5557,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
5019
5557
  note: "note" in result ? result.note : ctx.note
5020
5558
  });
5021
5559
  }
5022
- async function runEditPost(urn, text2, now, deps) {
5560
+ async function runEditPost(urn, text3, now, deps) {
5023
5561
  const unapprovable = refuseUnapprovable("edit", "editing", deps);
5024
5562
  if (unapprovable !== null) return unapprovable;
5025
5563
  const ctx = prepare("edit", now, "voyager");
@@ -5034,12 +5572,12 @@ async function runEditPost(urn, text2, now, deps) {
5034
5572
  const before = await lookup(urn, true);
5035
5573
  const plan = {
5036
5574
  action: "edit your post",
5037
- payload: { urn, text: text2 },
5575
+ payload: { urn, text: text3 },
5038
5576
  summary: [
5039
5577
  authorLine(ctx.transport),
5040
5578
  `post ${urn}`,
5041
5579
  ...previewLines2(before).map((l) => l.replace(/^content /, "was ")),
5042
- `new text "${text2}"`
5580
+ `new text "${text3}"`
5043
5581
  ],
5044
5582
  reversibility: "editable again, but the previous text is NOT kept here, LinkedIn marks the post as edited, and an @mention in the old text is not carried over",
5045
5583
  transport: "voyager"
@@ -5063,7 +5601,7 @@ function liveProfile(session) {
5063
5601
  };
5064
5602
  }
5065
5603
  var PROFILE_HINT = `profile fields: ${Object.keys(PROFILE_FIELDS).join(", ")}`;
5066
- async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps(), surface) {
5604
+ async function runEditProfile(name, text3, now = Date.now(), deps = terminalDeps(), surface) {
5067
5605
  const field = PROFILE_FIELDS[name];
5068
5606
  if (field === void 0) {
5069
5607
  return err(
@@ -5073,7 +5611,7 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5073
5611
  PROFILE_HINT
5074
5612
  );
5075
5613
  }
5076
- if (text2 === void 0 || text2.trim() === "") {
5614
+ if (text3 === void 0 || text3.trim() === "") {
5077
5615
  return err(
5078
5616
  "edit",
5079
5617
  "INVALID_INPUT",
@@ -5081,11 +5619,11 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5081
5619
  `lnrelay edit ${name} "<text>"`
5082
5620
  );
5083
5621
  }
5084
- if (text2.length > field.maxLength) {
5622
+ if (text3.length > field.maxLength) {
5085
5623
  return err(
5086
5624
  "edit",
5087
5625
  "INVALID_INPUT",
5088
- `the ${name} is ${text2.length} characters; LinkedIn allows ${field.maxLength}`
5626
+ `the ${name} is ${text3.length} characters; LinkedIn allows ${field.maxLength}`
5089
5627
  );
5090
5628
  }
5091
5629
  const unapprovable = refuseUnapprovable("edit", "editing", deps);
@@ -5101,19 +5639,19 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5101
5639
  const form = await profile.open(field, me.vanity);
5102
5640
  if (!form.ok) return err("edit", form.code, form.message, form.hint);
5103
5641
  const was = currentValue(form, field) ?? "";
5104
- if (was === text2) {
5642
+ if (was === text3) {
5105
5643
  return err("edit", "INVALID_INPUT", `your ${name} already reads exactly that; nothing to save`);
5106
5644
  }
5107
- const built = saveBody(form, field, text2);
5645
+ const built = saveBody(form, field, text3);
5108
5646
  if (!built.ok) return err("edit", built.code, built.message, built.hint);
5109
5647
  const plan = {
5110
5648
  action: `change your ${name}`,
5111
- payload: { field: name, was, text: text2 },
5649
+ payload: { field: name, was, text: text3 },
5112
5650
  summary: [
5113
5651
  authorLine(ctx.transport),
5114
5652
  `field ${name}`,
5115
5653
  `was "${was}"`,
5116
- `new "${text2}"`
5654
+ `new "${text3}"`
5117
5655
  ],
5118
5656
  reversibility: "editable again, but the old text is kept only in this preview and the audit log (~/.lnrelay/writes.jsonl). Every other profile field is sent back as LinkedIn holds it.",
5119
5657
  transport: "voyager"
@@ -5124,7 +5662,7 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5124
5662
  if (!sent.ok) return err("edit", sent.code, sent.message, sent.hint);
5125
5663
  const after = await profile.open(field, me.vanity);
5126
5664
  const reads = after.ok ? currentValue(after, field) : void 0;
5127
- if (reads !== text2) {
5665
+ if (reads !== text3) {
5128
5666
  return err(
5129
5667
  "edit",
5130
5668
  "SCHEMA_DRIFT",
@@ -5163,8 +5701,8 @@ async function harvest(activityId, session, now) {
5163
5701
  if (!found.ok) return err("comment", "SCHEMA_DRIFT", found.message, found.hint);
5164
5702
  return { ok: true, tokens: { bindingKey: found.bindingKey, trackingId: found.trackingId } };
5165
5703
  }
5166
- async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps()) {
5167
- if (postUrn2 === void 0 || text2 === void 0 || text2.trim() === "") {
5704
+ async function runComment(postUrn2, text3, now = Date.now(), deps = terminalDeps()) {
5705
+ if (postUrn2 === void 0 || text3 === void 0 || text3.trim() === "") {
5168
5706
  return err(
5169
5707
  "comment",
5170
5708
  "INVALID_INPUT",
@@ -5201,11 +5739,11 @@ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps
5201
5739
  if (!("tokens" in harvested)) return harvested;
5202
5740
  const plan = {
5203
5741
  action: "comment on a post",
5204
- payload: { activityId, text: text2, tokens: harvested.tokens },
5742
+ payload: { activityId, text: text3, tokens: harvested.tokens },
5205
5743
  // The harvested trackingId changes on every render, so --plan and --confirm
5206
5744
  // would never agree on a token derived from it. The intent is what's approved.
5207
- tokenBasis: { activityId, text: text2 },
5208
- summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text2}"`],
5745
+ tokenBasis: { activityId, text: text3 },
5746
+ summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text3}"`],
5209
5747
  reversibility: "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately",
5210
5748
  transport: "voyager"
5211
5749
  };
@@ -5217,8 +5755,8 @@ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps
5217
5755
  );
5218
5756
  return result.ok ? ok("comment", { on: postUrn2 }) : err("comment", result.code, result.message, result.hint);
5219
5757
  }
5220
- async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps()) {
5221
- if (commentUrn === void 0 || text2 === void 0 || text2.trim() === "") {
5758
+ async function runEdit(commentUrn, text3, now = Date.now(), deps = terminalDeps()) {
5759
+ if (commentUrn === void 0 || text3 === void 0 || text3.trim() === "") {
5222
5760
  return err(
5223
5761
  "edit",
5224
5762
  "INVALID_INPUT",
@@ -5228,11 +5766,11 @@ async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps(
5228
5766
  }
5229
5767
  const ref = parseCommentUrn(commentUrn);
5230
5768
  if (ref === null && !commentUrn.startsWith("urn:")) {
5231
- return runEditProfile(commentUrn, text2, now, deps);
5769
+ return runEditProfile(commentUrn, text3, now, deps);
5232
5770
  }
5233
5771
  if (ref === null) {
5234
5772
  if (/^urn:li:(share|ugcPost):\d+$/.test(commentUrn)) {
5235
- return runEditPost(commentUrn, text2, now, deps);
5773
+ return runEditPost(commentUrn, text3, now, deps);
5236
5774
  }
5237
5775
  return err(
5238
5776
  "edit",
@@ -5252,8 +5790,8 @@ async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps(
5252
5790
  if (!("tokens" in harvested)) return harvested;
5253
5791
  const plan = {
5254
5792
  action: "edit your comment",
5255
- payload: { urn: commentUrn, text: text2 },
5256
- summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text2}"`],
5793
+ payload: { urn: commentUrn, text: text3 },
5794
+ summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text3}"`],
5257
5795
  reversibility: "editable again, but the previous text is NOT recoverable here and LinkedIn marks the comment as edited",
5258
5796
  transport: "voyager"
5259
5797
  };
@@ -5264,7 +5802,7 @@ async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps(
5264
5802
  UPDATE_OP,
5265
5803
  harvested.tokens.trackingId,
5266
5804
  createLiveClient(ctx.transport.session),
5267
- text2
5805
+ text3
5268
5806
  );
5269
5807
  return result.ok ? ok("edit", { edited: commentUrn }) : err("edit", result.code, result.message, result.hint);
5270
5808
  }
@@ -5308,8 +5846,8 @@ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(),
5308
5846
  const result = await react(gated.confirmed, createLiveClient(ctx.transport.session));
5309
5847
  return result.ok ? ok("react", { id: result.id, removed: remove }) : err("react", result.code, result.message, result.hint);
5310
5848
  }
5311
- async function runReply(commentUrn, text2, now = Date.now(), deps = terminalDeps()) {
5312
- if (commentUrn === void 0 || text2 === void 0 || text2.trim() === "") {
5849
+ async function runReply(commentUrn, text3, now = Date.now(), deps = terminalDeps()) {
5850
+ if (commentUrn === void 0 || text3 === void 0 || text3.trim() === "") {
5313
5851
  return err(
5314
5852
  "reply",
5315
5853
  "INVALID_INPUT",
@@ -5335,8 +5873,8 @@ async function runReply(commentUrn, text2, now = Date.now(), deps = terminalDeps
5335
5873
  }
5336
5874
  const plan = {
5337
5875
  action: "reply to a comment",
5338
- payload: { ref: parent, text: text2 },
5339
- summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text2}"`],
5876
+ payload: { ref: parent, text: text3 },
5877
+ summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text3}"`],
5340
5878
  reversibility: "deletable with `lnrelay delete <the reply urn>`; the comment author is notified immediately",
5341
5879
  transport: "voyager"
5342
5880
  };
@@ -5608,7 +6146,7 @@ var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":
5608
6146
  var TEXT2 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
5609
6147
  function skillsFromPage(stream) {
5610
6148
  if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
5611
- return drift2("the skills page could not be read");
6149
+ return drift3("the skills page could not be read");
5612
6150
  }
5613
6151
  const skills = [];
5614
6152
  let from = 0;
@@ -5616,11 +6154,11 @@ function skillsFromPage(stream) {
5616
6154
  for (; ; ) {
5617
6155
  i = stream.indexOf(EDIT_NAV2, i);
5618
6156
  if (i === -1) break;
5619
- const text2 = balanced(stream, i);
6157
+ const text3 = balanced(stream, i);
5620
6158
  const end = i;
5621
6159
  i += EDIT_NAV2.length;
5622
- if (text2 === null) continue;
5623
- const payload = JSON.parse(text2).requestedArguments?.payload;
6160
+ if (text3 === null) continue;
6161
+ const payload = JSON.parse(text3).requestedArguments?.payload;
5624
6162
  const id = payload?.skillId;
5625
6163
  if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
5626
6164
  continue;
@@ -5628,7 +6166,7 @@ function skillsFromPage(stream) {
5628
6166
  (m) => JSON.parse(`"${m[1]}"`)
5629
6167
  );
5630
6168
  skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
5631
- from = end + text2.length;
6169
+ from = end + text3.length;
5632
6170
  }
5633
6171
  return { ok: true, skills };
5634
6172
  }
@@ -5652,11 +6190,11 @@ function pagerFrom(payload, start) {
5652
6190
  }
5653
6191
  function readSkillForm(stream) {
5654
6192
  const model = readModel(stream);
5655
- if (model === null) return drift2("the skill form carried no initial values");
6193
+ if (model === null) return drift3("the skill form carried no initial values");
5656
6194
  const save = findRequest(stream, SKILL.save);
5657
6195
  const del = findRequest(stream, SKILL.delete);
5658
6196
  if (save === null && del === null)
5659
- return drift2("the skill form carried neither a save nor a delete");
6197
+ return drift3("the skill form carried neither a save nor a delete");
5660
6198
  return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
5661
6199
  }
5662
6200
  var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
@@ -5668,10 +6206,10 @@ function skillNameOf(form) {
5668
6206
  function addSkillBody(form, name) {
5669
6207
  if (name.trim() === "")
5670
6208
  return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
5671
- if (form.save === null) return drift2("this form has no save action (it is not the add form)");
6209
+ if (form.save === null) return drift3("this form has no save action (it is not the add form)");
5672
6210
  const key = nameKey(form.model);
5673
6211
  const current = key === void 0 ? void 0 : form.model.get(key);
5674
- if (key === void 0 || current === void 0) return drift2("the skill form has no name field");
6212
+ if (key === void 0 || current === void 0) return drift3("the skill form has no name field");
5675
6213
  const model = new Map(form.model);
5676
6214
  model.set(key, { ...current, value: name.trim() });
5677
6215
  const states2 = wireStates(keysOf(form.save), model, () => void 0);
@@ -5680,7 +6218,7 @@ function addSkillBody(form, name) {
5680
6218
  }
5681
6219
  function removeSkillBody(form) {
5682
6220
  if (form.del === null)
5683
- return drift2("this form has no delete action (it is not an existing skill)");
6221
+ return drift3("this form has no delete action (it is not an existing skill)");
5684
6222
  const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
5685
6223
  if (!Array.isArray(states2)) return states2;
5686
6224
  return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
@@ -5697,9 +6235,9 @@ async function fetchSkills(vanityName, client) {
5697
6235
  if (typeof screen !== "string") return screen;
5698
6236
  const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
5699
6237
  const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
5700
- const text2 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
5701
- if (text2 === null) return drift2("the Skills screen carried no list request");
5702
- const payload = JSON.parse(text2);
6238
+ const text3 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
6239
+ if (text3 === null) return drift3("the Skills screen carried no list request");
6240
+ const payload = JSON.parse(text3);
5703
6241
  const count2 = typeof payload.count === "number" ? payload.count : 10;
5704
6242
  const skills = [];
5705
6243
  for (let page = 0; page < MAX_PAGES2; page++) {
@@ -6032,6 +6570,54 @@ function output(args) {
6032
6570
  if (fields !== void 0) opts.fields = fields;
6033
6571
  return opts;
6034
6572
  }
6573
+ function many(args, name) {
6574
+ return list(args, name).flatMap((v) => v.split(",")).map((v) => v.trim()).filter((v) => v !== "");
6575
+ }
6576
+ function jobsRequest(args) {
6577
+ const filter = {};
6578
+ const distance = num(args, "distance");
6579
+ if (distance !== void 0) filter.distance = distance;
6580
+ const posted = str(args, "posted");
6581
+ if (posted !== void 0) filter.posted = posted;
6582
+ const lists = [
6583
+ ["experience", "experience"],
6584
+ ["type", "type"],
6585
+ ["workplace", "workplace"],
6586
+ ["company", "company"],
6587
+ ["industry", "industry"],
6588
+ ["function", "function"],
6589
+ ["title", "title"],
6590
+ ["place", "place"]
6591
+ ];
6592
+ for (const [flag, key] of lists) {
6593
+ const values = many(args, flag);
6594
+ if (values.length > 0) filter[key] = values;
6595
+ }
6596
+ const flags = [
6597
+ ["easy-apply", "easyApply"],
6598
+ ["under-10", "under10"],
6599
+ ["verified", "verified"],
6600
+ ["in-network", "inNetwork"],
6601
+ ["fair-chance", "fairChance"]
6602
+ ];
6603
+ for (const [flag, key] of flags) if (bool(args, flag)) filter[key] = true;
6604
+ const raw = list(args, "filter");
6605
+ if (raw.length > 0) filter.raw = raw;
6606
+ const sort = str(args, "sort");
6607
+ if (sort !== void 0) filter.sort = sort;
6608
+ const req = { limit: num(args, "limit") ?? 25, filter };
6609
+ const keywords = args.positionals[0];
6610
+ if (keywords !== void 0) req.keywords = keywords;
6611
+ const location = str(args, "location");
6612
+ if (location !== void 0) req.location = location;
6613
+ const geo = str(args, "geo");
6614
+ if (geo !== void 0) req.geoId = geo;
6615
+ const start = num(args, "start");
6616
+ if (start !== void 0) req.start = start;
6617
+ if (bool(args, "details")) req.details = true;
6618
+ if (bool(args, "description")) req.description = true;
6619
+ return req;
6620
+ }
6035
6621
  function via(args) {
6036
6622
  const value = str(args, "via");
6037
6623
  if (value === void 0) return void 0;
@@ -6142,7 +6728,18 @@ async function dispatch(argv, now) {
6142
6728
  return runPost(args.positionals[0], num(args, "limit") ?? 20, output(args));
6143
6729
  case "reactions":
6144
6730
  return runReactions(args.positionals[0], num(args, "limit") ?? 20, output(args));
6731
+ case "jobs":
6732
+ return runJobs(jobsRequest(args), output(args));
6733
+ case "job":
6734
+ return runJob(args.positionals[0], output(args));
6735
+ case "job-filters":
6736
+ return runJobFilters(jobsRequest(args), output(args));
6145
6737
  case "search":
6738
+ if (args.positionals[0] === "jobs")
6739
+ return runJobs(
6740
+ { keywords: args.positionals[1] ?? "", limit: num(args, "limit") ?? 10, filter: {} },
6741
+ output(args)
6742
+ );
6146
6743
  return runSearch(
6147
6744
  args.positionals[0],
6148
6745
  args.positionals[1],
@@ -6199,13 +6796,13 @@ function edit(args, now, deps) {
6199
6796
  if (inline !== void 0) {
6200
6797
  return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
6201
6798
  }
6202
- let text2;
6799
+ let text3;
6203
6800
  try {
6204
- text2 = readFileSync3(file, "utf-8").replace(/\n$/, "");
6801
+ text3 = readFileSync3(file, "utf-8").replace(/\n$/, "");
6205
6802
  } catch {
6206
6803
  return err("edit", "INVALID_INPUT", `cannot read ${file}`);
6207
6804
  }
6208
- return runEdit(target, text2, now, deps);
6805
+ return runEdit(target, text3, now, deps);
6209
6806
  }
6210
6807
  function role(args, now, deps) {
6211
6808
  const [sub, target] = args.positionals;
@@ -6344,6 +6941,7 @@ function share3(args, now, deps) {
6344
6941
  );
6345
6942
  }
6346
6943
  export {
6347
- dispatch
6944
+ dispatch,
6945
+ jobsRequest
6348
6946
  };
6349
6947
  //# sourceMappingURL=cli.js.map