linkedin-relay-mcp 3.9.0 → 3.10.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.
package/dist/cli.js CHANGED
@@ -1380,15 +1380,33 @@ var CONTRACTS = {
1380
1380
  provenance: "discovered",
1381
1381
  capturedAt: "2026-08-02"
1382
1382
  },
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.
1383
+ // Job search, captured 2026-10-14. The jobs page itself now opens an SDUI
1384
+ // "AI job search" that drops filters it does not support; these are the
1385
+ // classic Voyager resources still behind /jobs/search/, which take them all.
1386
+ // See engine/jobs.ts.
1385
1387
  jobCards: {
1386
1388
  name: "jobCards",
1387
- transport: "voyager-graphql",
1388
- path: `${VOYAGER}/graphql`,
1389
- queryId: "voyagerJobsDashJobCards.e5b6b761ede078dabe8ad857aa42c220",
1390
- provenance: "discovered",
1391
- capturedAt: "2026-08-02"
1389
+ transport: "voyager-restli",
1390
+ path: `${VOYAGER}/voyagerJobsDashJobCards`,
1391
+ decorationId: "com.linkedin.voyager.dash.deco.jobs.search.JobSearchCardsCollection-220",
1392
+ provenance: "verified",
1393
+ capturedAt: "2026-10-14"
1394
+ },
1395
+ jobFilters: {
1396
+ name: "jobFilters",
1397
+ transport: "voyager-restli",
1398
+ path: `${VOYAGER}/voyagerJobsDashSearchFilterClustersResource`,
1399
+ decorationId: "com.linkedin.voyager.dash.deco.search.SearchFilterCluster-44",
1400
+ provenance: "verified",
1401
+ capturedAt: "2026-10-14"
1402
+ },
1403
+ jobPosting: {
1404
+ name: "jobPosting",
1405
+ transport: "voyager-restli",
1406
+ path: `${VOYAGER}/jobs/jobPostings`,
1407
+ decorationId: "com.linkedin.voyager.deco.jobs.web.shared.WebFullJobPosting-65",
1408
+ provenance: "verified",
1409
+ capturedAt: "2026-10-14"
1392
1410
  }
1393
1411
  };
1394
1412
  var RETIRED = {
@@ -1639,10 +1657,10 @@ function createEngine(session, deps, quiet = false) {
1639
1657
  const client = createLiveClient(session, deps, quiet);
1640
1658
  return {
1641
1659
  async whoami() {
1642
- const contract = contractFor("me");
1643
- if (contract === void 0) return missingContract("me");
1660
+ const contract2 = contractFor("me");
1661
+ if (contract2 === void 0) return missingContract("me");
1644
1662
  const res = await client.request({
1645
- url: contract.path,
1663
+ url: contract2.path,
1646
1664
  spendClass: "profile",
1647
1665
  operation: "me"
1648
1666
  });
@@ -1650,10 +1668,10 @@ function createEngine(session, deps, quiet = false) {
1650
1668
  return { ok: true, value: parseSingle(res.json) };
1651
1669
  },
1652
1670
  async profile(memberId) {
1653
- const contract = contractFor("profile");
1654
- if (contract === void 0) return missingContract("profile");
1671
+ const contract2 = contractFor("profile");
1672
+ if (contract2 === void 0) return missingContract("profile");
1655
1673
  const variables = encodeVariables({ memberIdentity: memberId });
1656
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1674
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1657
1675
  const res = await client.request({ url, spendClass: "profile", operation: "profile" });
1658
1676
  if (!res.ok) return res;
1659
1677
  const envelope = res.json;
@@ -1665,9 +1683,9 @@ function createEngine(session, deps, quiet = false) {
1665
1683
  return { ok: true, value: { profile, index } };
1666
1684
  },
1667
1685
  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`;
1686
+ const contract2 = contractFor("feed");
1687
+ if (contract2 === void 0) return missingContract("feed");
1688
+ const url = `${contract2.path}?q=chronFeed&count=${limit}&start=0`;
1671
1689
  const res = await client.request({ url, spendClass: "page", operation: "feed" });
1672
1690
  if (!res.ok) return res;
1673
1691
  const envelope = res.json;
@@ -1676,21 +1694,21 @@ function createEngine(session, deps, quiet = false) {
1676
1694
  value: {
1677
1695
  parsed: parseCollection(res.json, {
1678
1696
  operation: "feed",
1679
- contractCapturedAt: contract.capturedAt
1697
+ contractCapturedAt: contract2.capturedAt
1680
1698
  }),
1681
1699
  index: indexIncluded(envelope.included)
1682
1700
  }
1683
1701
  };
1684
1702
  },
1685
1703
  async myPosts(profileUrn, limit) {
1686
- const contract = contractFor("myPosts");
1687
- if (contract === void 0) return missingContract("myPosts");
1704
+ const contract2 = contractFor("myPosts");
1705
+ if (contract2 === void 0) return missingContract("myPosts");
1688
1706
  const variables = encodeVariables({
1689
1707
  count: Math.min(limit, 100),
1690
1708
  start: 0,
1691
1709
  profileUrn: canonicalUrn(profileUrn)
1692
1710
  });
1693
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1711
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1694
1712
  const res = await client.request({ url, spendClass: "page", operation: "myPosts" });
1695
1713
  if (!res.ok) return res;
1696
1714
  const envelope = res.json;
@@ -1699,7 +1717,7 @@ function createEngine(session, deps, quiet = false) {
1699
1717
  value: {
1700
1718
  parsed: parseCollection(res.json, {
1701
1719
  operation: "myPosts",
1702
- contractCapturedAt: contract.capturedAt,
1720
+ contractCapturedAt: contract2.capturedAt,
1703
1721
  truncated: true
1704
1722
  }),
1705
1723
  index: indexIncluded(envelope.included)
@@ -1712,8 +1730,8 @@ function createEngine(session, deps, quiet = false) {
1712
1730
  * snapshot and diffs, rather than pretending a watermark exists.
1713
1731
  */
1714
1732
  async connections(limit) {
1715
- const contract = contractFor("search");
1716
- if (contract === void 0) return missingContract("search");
1733
+ const contract2 = contractFor("search");
1734
+ if (contract2 === void 0) return missingContract("search");
1717
1735
  const variables = encodeVariables({
1718
1736
  start: 0,
1719
1737
  origin: "FACETED_SEARCH",
@@ -1726,12 +1744,12 @@ function createEngine(session, deps, quiet = false) {
1726
1744
  includeFiltersInResponse: false
1727
1745
  }
1728
1746
  });
1729
- const url = `${contract.path}?variables=${variables}&queryId=${contract.queryId}`;
1747
+ const url = `${contract2.path}?variables=${variables}&queryId=${contract2.queryId}`;
1730
1748
  const res = await client.request({ url, spendClass: "search", operation: "connections" });
1731
1749
  if (!res.ok) return res;
1732
1750
  const parsed = parseCollection(res.json, {
1733
1751
  operation: "connections",
1734
- contractCapturedAt: contract.capturedAt,
1752
+ contractCapturedAt: contract2.capturedAt,
1735
1753
  claimedCount: totalResultCount(res.json),
1736
1754
  truncated: true
1737
1755
  });
@@ -1741,8 +1759,8 @@ function createEngine(session, deps, quiet = false) {
1741
1759
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1742
1760
  },
1743
1761
  async post(postUrn2, limit) {
1744
- const contract = contractFor("comments");
1745
- if (contract === void 0) return missingContract("comments");
1762
+ const contract2 = contractFor("comments");
1763
+ if (contract2 === void 0) return missingContract("comments");
1746
1764
  const variables = encodeVariables({
1747
1765
  count: Math.min(limit, 100),
1748
1766
  numReplies: 1,
@@ -1750,12 +1768,12 @@ function createEngine(session, deps, quiet = false) {
1750
1768
  sortOrder: "RELEVANCE",
1751
1769
  start: 0
1752
1770
  });
1753
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1771
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1754
1772
  const res = await client.request({ url, spendClass: "page", operation: "comments" });
1755
1773
  if (!res.ok) return res;
1756
1774
  const parsed = parseCollection(res.json, {
1757
1775
  operation: "comments",
1758
- contractCapturedAt: contract.capturedAt,
1776
+ contractCapturedAt: contract2.capturedAt,
1759
1777
  // A page of many; we follow no cursor yet, so never claim exhaustion.
1760
1778
  truncated: true
1761
1779
  });
@@ -1763,27 +1781,27 @@ function createEngine(session, deps, quiet = false) {
1763
1781
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1764
1782
  },
1765
1783
  async reactions(postUrn2, limit) {
1766
- const contract = contractFor("reactions");
1767
- if (contract === void 0) return missingContract("reactions");
1784
+ const contract2 = contractFor("reactions");
1785
+ if (contract2 === void 0) return missingContract("reactions");
1768
1786
  const variables = encodeVariables({
1769
1787
  count: Math.min(limit, 100),
1770
1788
  start: 0,
1771
1789
  threadUrn: postUrn2
1772
1790
  });
1773
- const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
1791
+ const url = `${contract2.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract2.queryId}`;
1774
1792
  const res = await client.request({ url, spendClass: "page", operation: "reactions" });
1775
1793
  if (!res.ok) return res;
1776
1794
  const parsed = parseCollection(res.json, {
1777
1795
  operation: "reactions",
1778
- contractCapturedAt: contract.capturedAt,
1796
+ contractCapturedAt: contract2.capturedAt,
1779
1797
  truncated: true
1780
1798
  });
1781
1799
  const envelope = res.json;
1782
1800
  return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
1783
1801
  },
1784
1802
  async search(kind, query, limit) {
1785
- const contract = contractFor("search");
1786
- if (contract === void 0) return missingContract("search");
1803
+ const contract2 = contractFor("search");
1804
+ if (contract2 === void 0) return missingContract("search");
1787
1805
  const variables = encodeVariables({
1788
1806
  start: 0,
1789
1807
  origin: "GLOBAL_SEARCH_HEADER",
@@ -1794,12 +1812,12 @@ function createEngine(session, deps, quiet = false) {
1794
1812
  includeFiltersInResponse: false
1795
1813
  }
1796
1814
  });
1797
- const url = `${contract.path}?variables=${variables}&queryId=${contract.queryId}`;
1815
+ const url = `${contract2.path}?variables=${variables}&queryId=${contract2.queryId}`;
1798
1816
  const res = await client.request({ url, spendClass: "search", operation: "search" });
1799
1817
  if (!res.ok) return res;
1800
1818
  const parsed = parseCollection(res.json, {
1801
1819
  operation: "search",
1802
- contractCapturedAt: contract.capturedAt,
1820
+ contractCapturedAt: contract2.capturedAt,
1803
1821
  claimedCount: totalResultCount(res.json),
1804
1822
  truncated: true
1805
1823
  // one page of many; we never claim exhaustion
@@ -1993,7 +2011,7 @@ async function fetchCommentMenu(ref, trackingId, client) {
1993
2011
  const stream = result.classification.raw ?? "";
1994
2012
  return { ok: true, stream };
1995
2013
  }
1996
- function textStates(payload, text2) {
2014
+ function textStates(payload, text3) {
1997
2015
  const keyOf = (...names) => {
1998
2016
  for (const n of names) {
1999
2017
  const slot = payload[n];
@@ -2012,12 +2030,12 @@ function textStates(payload, text2) {
2012
2030
  protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
2013
2031
  });
2014
2032
  return [
2015
- entry2(plain2, text2, "stringValue"),
2016
- entry2(rich, { text: text2, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
2033
+ entry2(plain2, text3, "stringValue"),
2034
+ entry2(rich, { text: text3, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
2017
2035
  ];
2018
2036
  }
2019
- function editStates(payload, text2) {
2020
- return textStates(payload, text2);
2037
+ function editStates(payload, text3) {
2038
+ return textStates(payload, text3);
2021
2039
  }
2022
2040
  async function runCommentAction(ref, operation, trackingId, client, newText) {
2023
2041
  const menu = await fetchCommentMenu(ref, trackingId, client);
@@ -2356,12 +2374,12 @@ var CATEGORY = {
2356
2374
  VIDEO: "VIDEO",
2357
2375
  DOCUMENT: "NATIVE_DOCUMENT"
2358
2376
  };
2359
- function sharePayload(text2, visibility, media = [], scheduledAt) {
2377
+ function sharePayload(text3, visibility, media = [], scheduledAt) {
2360
2378
  const schedule = scheduledAt === void 0 ? { postState: "PUBLISHED" } : { postState: "SCHEDULED", scheduledAt };
2361
2379
  return {
2362
2380
  visibleToConnectionsOnly: visibility === "CONNECTIONS",
2363
2381
  externalAudienceProviders: [],
2364
- commentaryV2: { text: text2, attributes: [] },
2382
+ commentaryV2: { text: text3, attributes: [] },
2365
2383
  origin: "FEED",
2366
2384
  allowedCommentersScope: "ALL",
2367
2385
  ...schedule,
@@ -2475,15 +2493,15 @@ async function share(confirmed, client, bytes) {
2475
2493
  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
2494
  } : { ok: true, id };
2477
2495
  }
2478
- function editPostBody(text2) {
2479
- return { patch: { $set: { commentaryV2: { text: text2, attributes: [] } } } };
2496
+ function editPostBody(text3) {
2497
+ return { patch: { $set: { commentaryV2: { text: text3, attributes: [] } } } };
2480
2498
  }
2481
2499
  async function editPost(confirmed, client) {
2482
- const { urn, text: text2 } = confirmed.payload;
2500
+ const { urn, text: text3 } = confirmed.payload;
2483
2501
  const result = await client.request({
2484
2502
  url: deleteUrl(urn),
2485
2503
  method: "POST",
2486
- body: editPostBody(text2),
2504
+ body: editPostBody(text3),
2487
2505
  spendClass: "write",
2488
2506
  operation: "edit-post"
2489
2507
  });
@@ -2493,7 +2511,7 @@ async function editPost(confirmed, client) {
2493
2511
  return out;
2494
2512
  }
2495
2513
  const held = result.json?.data?.commentary?.text;
2496
- if (held !== text2) {
2514
+ if (held !== text3) {
2497
2515
  return {
2498
2516
  ok: false,
2499
2517
  code: "SCHEMA_DRIFT",
@@ -2522,14 +2540,14 @@ function pollUrnOf(json) {
2522
2540
  return JSON.stringify(json ?? null).match(/urn:li:fsd_pollSummary:\d+/)?.[0] ?? null;
2523
2541
  }
2524
2542
  async function createPoll(poll, client) {
2525
- const contract = contractFor("createPoll");
2526
- if (contract?.queryId === void 0) {
2543
+ const contract2 = contractFor("createPoll");
2544
+ if (contract2?.queryId === void 0) {
2527
2545
  return { ok: false, code: "NOT_IMPLEMENTED", message: "no verified poll contract" };
2528
2546
  }
2529
2547
  const result = await client.request({
2530
- url: `${contract.path}?action=execute&queryId=${contract.queryId}`,
2548
+ url: `${contract2.path}?action=execute&queryId=${contract2.queryId}`,
2531
2549
  method: "POST",
2532
- body: { variables: { poll }, queryId: contract.queryId, includeWebMetadata: true },
2550
+ body: { variables: { poll }, queryId: contract2.queryId, includeWebMetadata: true },
2533
2551
  spendClass: "write",
2534
2552
  operation: "create-poll"
2535
2553
  });
@@ -2554,16 +2572,16 @@ async function createPoll(poll, client) {
2554
2572
  }
2555
2573
  return { ok: true, urn };
2556
2574
  }
2557
- function firstUrl(text2) {
2558
- const found = text2.match(/https?:\/\/[^\s<>"]+/)?.[0];
2575
+ function firstUrl(text3) {
2576
+ const found = text3.match(/https?:\/\/[^\s<>"]+/)?.[0];
2559
2577
  if (found === void 0) return null;
2560
2578
  let url = found.replace(/[.,;:!?'"]+$/, "");
2561
2579
  if (url.endsWith(")") && !url.includes("(")) url = url.slice(0, -1);
2562
2580
  return url;
2563
2581
  }
2564
2582
  function urlPreviewUrl(url) {
2565
- const contract = contractFor("urlPreview");
2566
- return `${contract?.path}?includeWebMetadata=true&variables=(url:${encodeURIComponent(url)})&queryId=${contract?.queryId}`;
2583
+ const contract2 = contractFor("urlPreview");
2584
+ return `${contract2?.path}?includeWebMetadata=true&variables=(url:${encodeURIComponent(url)})&queryId=${contract2?.queryId}`;
2567
2585
  }
2568
2586
  function parseUrlPreview(json) {
2569
2587
  const error = gqlError(json);
@@ -2719,8 +2737,8 @@ function previewLines2(post) {
2719
2737
  " about to delete, or that it is yours."
2720
2738
  ];
2721
2739
  }
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;
2740
+ const text3 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
2741
+ const shown = text3.length > PREVIEW_CHARS ? `${text3.slice(0, PREVIEW_CHARS)}\u2026` : text3;
2724
2742
  const lines = [`content "${shown.replace(/\n/g, " ")}"`];
2725
2743
  if (typeof post.scheduledAt === "string") {
2726
2744
  lines.push(`status scheduled, publishes ${post.scheduledAt} unless cancelled`);
@@ -2866,6 +2884,483 @@ async function runDelete(urn, now = Date.now(), deps, quiet = false) {
2866
2884
  return ok("delete", { deleted: urn, verified: post !== void 0, evictedFromCache: evicted });
2867
2885
  }
2868
2886
 
2887
+ // src/engine/jobs.ts
2888
+ function contract(name) {
2889
+ const c = CONTRACTS[name];
2890
+ if (c?.decorationId === void 0) throw new Error(`job contract '${name}' is missing`);
2891
+ return { path: c.path, decorationId: c.decorationId };
2892
+ }
2893
+ var PAGE_SIZE2 = 25;
2894
+ function queryTuple(q2) {
2895
+ const locationUnion = q2.geoId !== void 0 ? { geoId: q2.geoId } : q2.location !== void 0 ? { seoLocation: { location: q2.location } } : void 0;
2896
+ const selected = Object.entries(q2.filters).filter(([, v]) => v.length > 0);
2897
+ return encodeVariables({
2898
+ origin: "JOB_SEARCH_PAGE_JOB_FILTER",
2899
+ keywords: q2.keywords,
2900
+ locationUnion,
2901
+ selectedFilters: selected.length > 0 ? Object.fromEntries(selected) : void 0,
2902
+ spellCorrectionEnabled: true
2903
+ });
2904
+ }
2905
+ function jobSearchUrl(q2) {
2906
+ const c = contract("jobCards");
2907
+ return `${c.path}?decorationId=${c.decorationId}&count=${q2.count}&q=jobSearch&query=${queryTuple(q2)}&start=${q2.start}`;
2908
+ }
2909
+ function jobFiltersUrl(q2) {
2910
+ const c = contract("jobFilters");
2911
+ return `${c.path}?decorationId=${c.decorationId}&q=filters&query=${queryTuple(q2)}`;
2912
+ }
2913
+ function jobDetailUrl(id) {
2914
+ const c = contract("jobPosting");
2915
+ return `${c.path}/${id}?decorationId=${c.decorationId}`;
2916
+ }
2917
+ function jobIdOf(input) {
2918
+ const s = input.trim();
2919
+ if (/^\d+$/.test(s)) return s;
2920
+ const found = s.match(/\/jobs\/view\/(?:[^/?#]*-)?(\d+)/) ?? s.match(/[?&]currentJobId=(\d+)/) ?? s.match(/urn:li:(?:fsd_|fs_normalized_)?jobPosting:(\d+)/);
2921
+ return found?.[1];
2922
+ }
2923
+ var viewUrl = (id) => `https://www.linkedin.com/jobs/view/${id}/`;
2924
+ var day = (ms) => typeof ms === "number" ? new Date(ms).toISOString().slice(0, 10) : void 0;
2925
+ var text2 = (v) => {
2926
+ const t = v?.text;
2927
+ return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
2928
+ };
2929
+ function defined2(obj) {
2930
+ for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
2931
+ return obj;
2932
+ }
2933
+ var WORKPLACE_SUFFIX = {
2934
+ remote: "remote",
2935
+ hybrid: "hybrid",
2936
+ "on-site": "on-site"
2937
+ };
2938
+ function splitLocation(line) {
2939
+ if (line === void 0) return {};
2940
+ const m = line.match(/^(.*?)\s*\(([^()]+)\)$/);
2941
+ const kind = m?.[2] === void 0 ? void 0 : WORKPLACE_SUFFIX[m[2].toLowerCase()];
2942
+ return kind === void 0 || m?.[1] === void 0 ? { location: line } : { location: m[1], workplace: kind };
2943
+ }
2944
+ function cardToJob(card) {
2945
+ const urn = card.jobPostingUrn ?? card["*jobPosting"];
2946
+ const id = typeof urn === "string" ? jobIdOf(urn) : void 0;
2947
+ const title = typeof card.jobPostingTitle === "string" ? card.jobPostingTitle : text2(card.title);
2948
+ if (id === void 0 || title === void 0) return void 0;
2949
+ const footer = Array.isArray(card.footerItems) ? card.footerItems : [];
2950
+ const listed2 = footer.find((f) => f.type === "LISTED_DATE");
2951
+ 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);
2952
+ const insight = text2(card.relevanceInsight?.text);
2953
+ if (insight !== void 0) insights.push(insight);
2954
+ return defined2({
2955
+ id,
2956
+ title,
2957
+ company: text2(card.primaryDescription),
2958
+ ...splitLocation(text2(card.secondaryDescription)),
2959
+ listed: day(listed2?.timeAt),
2960
+ easyApply: footer.some((f) => f.type === "EASY_APPLY_TEXT"),
2961
+ promoted: footer.some((f) => f.type === "PROMOTED"),
2962
+ salary: text2(card.tertiaryDescription),
2963
+ insights: insights.length > 0 ? insights : void 0,
2964
+ url: viewUrl(id)
2965
+ });
2966
+ }
2967
+ var drift2 = (message) => ({
2968
+ ok: false,
2969
+ code: "SCHEMA_DRIFT",
2970
+ message,
2971
+ hint: "the job search response changed shape; re-capture it"
2972
+ });
2973
+ function readCards(elements, included) {
2974
+ const byUrn = /* @__PURE__ */ new Map();
2975
+ for (const node of included) {
2976
+ if (typeof node.entityUrn === "string") byUrn.set(node.entityUrn, node);
2977
+ }
2978
+ const jobs = [];
2979
+ const unknownTypes = {};
2980
+ let unresolved = 0;
2981
+ for (const el of elements) {
2982
+ const union = el.jobCardUnion ?? {};
2983
+ const ref = union["*jobPostingCard"];
2984
+ if (typeof ref !== "string") {
2985
+ for (const kind of Object.keys(union)) unknownTypes[kind] = (unknownTypes[kind] ?? 0) + 1;
2986
+ continue;
2987
+ }
2988
+ const card = byUrn.get(ref);
2989
+ const job = card === void 0 ? void 0 : cardToJob(card);
2990
+ if (job === void 0) unresolved++;
2991
+ else if (!jobs.some((j) => j.id === job.id)) jobs.push(job);
2992
+ }
2993
+ return { jobs, unknownTypes, unresolved };
2994
+ }
2995
+ function resolvedGeo(included) {
2996
+ const geo = included.find((n) => typeof n.$type === "string" && n.$type.endsWith(".common.Geo"));
2997
+ const geoId = typeof geo?.entityUrn === "string" ? geo.entityUrn.split(":").pop() : void 0;
2998
+ const name = typeof geo?.fullLocalizedName === "string" ? geo.fullLocalizedName : void 0;
2999
+ return geoId !== void 0 && name !== void 0 ? { location: { geoId, name } } : {};
3000
+ }
3001
+ function parseJobCards(json) {
3002
+ const root = json;
3003
+ const data = root?.data;
3004
+ const elements = data?.elements;
3005
+ if (data === void 0 || !Array.isArray(elements))
3006
+ return drift2("the job search returned no result list");
3007
+ const paging = data.paging ?? {};
3008
+ const total = typeof paging.total === "number" ? paging.total : void 0;
3009
+ const start = typeof paging.start === "number" ? paging.start : 0;
3010
+ const included = root?.included ?? [];
3011
+ const { jobs, unknownTypes, unresolved } = readCards(elements, included);
3012
+ if (unresolved > 0 && jobs.length === 0)
3013
+ return drift2(`${unresolved} job cards were listed but none could be read`);
3014
+ if (elements.length === 0 && total !== void 0 && total > start) {
3015
+ return {
3016
+ ok: false,
3017
+ code: "SCHEMA_DRIFT",
3018
+ message: `LinkedIn claims ${total} jobs but returned none from ${start}`,
3019
+ hint: 'a failed fetch, not an empty search; do not report "no jobs"'
3020
+ };
3021
+ }
3022
+ return { ok: true, jobs, total, start, ...resolvedGeo(included), unknownTypes };
3023
+ }
3024
+ var WORKPLACE_URN = { "1": "on-site", "2": "remote", "3": "hybrid" };
3025
+ function applyOf(method) {
3026
+ const m = method;
3027
+ if (m === null || m === void 0) return void 0;
3028
+ const type = String(m.$type ?? "");
3029
+ if (type.endsWith("OffsiteApply")) {
3030
+ const url = typeof m.companyApplyUrl === "string" ? m.companyApplyUrl : void 0;
3031
+ return defined2({ type: "external", url });
3032
+ }
3033
+ if (type.endsWith("OnsiteApply")) {
3034
+ const url = typeof m.easyApplyUrl === "string" ? m.easyApplyUrl : void 0;
3035
+ return defined2({ type: "easy-apply", url });
3036
+ }
3037
+ return void 0;
3038
+ }
3039
+ function parseJobDetail(json) {
3040
+ const root = json;
3041
+ const d = root?.data;
3042
+ const rawId = d?.jobPostingId ?? d?.entityUrn;
3043
+ const id = rawId === void 0 ? void 0 : jobIdOf(String(rawId));
3044
+ if (d === void 0 || id === void 0 || typeof d.title !== "string")
3045
+ return drift2("the job response carried no posting");
3046
+ const included = root?.included ?? [];
3047
+ const find = (urn) => typeof urn === "string" ? included.find((n) => n.entityUrn === urn) : void 0;
3048
+ const details = d.companyDetails ?? {};
3049
+ const company = find(details.company ?? details["*companyResolutionResult"]);
3050
+ const companyName = typeof company?.name === "string" ? company.name : typeof details.companyName === "string" ? details.companyName : void 0;
3051
+ const workplaces = Array.isArray(d.workplaceTypes) ? d.workplaceTypes : [];
3052
+ const workplace = WORKPLACE_URN[String(workplaces[0]?.split(":").pop())];
3053
+ const applying = find(d["*applyingInfo"]);
3054
+ const saving = find(d["*savingInfo"]);
3055
+ const list2 = (v) => Array.isArray(v) && v.length > 0 ? v.filter((x) => typeof x === "string") : void 0;
3056
+ return {
3057
+ ok: true,
3058
+ job: defined2({
3059
+ id,
3060
+ title: d.title,
3061
+ company: companyName,
3062
+ companyUrl: typeof company?.url === "string" ? company.url : void 0,
3063
+ location: typeof d.formattedLocation === "string" ? d.formattedLocation : void 0,
3064
+ workplace: workplace ?? (d.workRemoteAllowed === true ? "remote" : void 0),
3065
+ employmentType: typeof d.formattedEmploymentStatus === "string" && d.formattedEmploymentStatus !== "" ? d.formattedEmploymentStatus : void 0,
3066
+ experienceLevel: typeof d.formattedExperienceLevel === "string" && d.formattedExperienceLevel !== "" ? d.formattedExperienceLevel : void 0,
3067
+ industries: list2(d.formattedIndustries),
3068
+ functions: list2(d.formattedJobFunctions),
3069
+ listed: day(d.listedAt),
3070
+ expires: day(d.expireAt),
3071
+ state: typeof d.jobState === "string" ? d.jobState : void 0,
3072
+ applicants: typeof d.applies === "number" && d.applies > 0 ? d.applies : void 0,
3073
+ apply: applyOf(d.applyMethod),
3074
+ ats: typeof d.applicantTrackingSystem === "string" ? d.applicantTrackingSystem : void 0,
3075
+ applied: typeof applying?.applied === "boolean" ? applying.applied : void 0,
3076
+ saved: typeof saving?.saved === "boolean" ? saving.saved : void 0,
3077
+ description: text2(d.description),
3078
+ url: viewUrl(id)
3079
+ })
3080
+ };
3081
+ }
3082
+ function parseJobFilters(json) {
3083
+ const elements = json?.data?.elements;
3084
+ if (!Array.isArray(elements)) return drift2("the job filter list was missing");
3085
+ const filters = [];
3086
+ for (const el of elements) {
3087
+ const groups = [
3088
+ ...el.secondaryFilterGroups ?? [],
3089
+ ...el.primaryFilterGroups ?? []
3090
+ ];
3091
+ for (const group of groups) {
3092
+ for (const f of group.filters ?? []) {
3093
+ const key = f.parameterName;
3094
+ if (typeof key !== "string" || filters.some((x) => x.key === key)) continue;
3095
+ const values = [
3096
+ ...f.secondaryFilterValues ?? [],
3097
+ ...f.primaryFilterValues ?? []
3098
+ ];
3099
+ const options = values.filter((v) => typeof v.value === "string").map(
3100
+ (v) => defined2({
3101
+ value: v.value,
3102
+ label: text2(v.displayName) ?? (typeof v.displayName === "string" ? v.displayName : String(v.value)),
3103
+ count: typeof v.count === "number" ? v.count : void 0
3104
+ })
3105
+ );
3106
+ if (options.length === 0) continue;
3107
+ filters.push({ key, label: text2(f.displayName) ?? key, options });
3108
+ }
3109
+ }
3110
+ }
3111
+ if (filters.length === 0) return drift2("the job filter list was empty");
3112
+ return { ok: true, filters };
3113
+ }
3114
+ var NAMED = {
3115
+ experience: {
3116
+ param: "experience",
3117
+ values: {
3118
+ internship: "1",
3119
+ entry: "2",
3120
+ associate: "3",
3121
+ "mid-senior": "4",
3122
+ senior: "4",
3123
+ director: "5",
3124
+ executive: "6"
3125
+ }
3126
+ },
3127
+ type: {
3128
+ param: "jobType",
3129
+ values: {
3130
+ "full-time": "F",
3131
+ "part-time": "P",
3132
+ contract: "C",
3133
+ temporary: "T",
3134
+ volunteer: "V",
3135
+ internship: "I",
3136
+ other: "O"
3137
+ }
3138
+ },
3139
+ workplace: {
3140
+ param: "workplaceType",
3141
+ values: { "on-site": "1", onsite: "1", remote: "2", hybrid: "3" }
3142
+ }
3143
+ };
3144
+ var POSTED = {
3145
+ day: 86400,
3146
+ "24h": 86400,
3147
+ week: 604800,
3148
+ month: 2592e3
3149
+ };
3150
+ var Refused = class extends Error {
3151
+ };
3152
+ function postedRange(given) {
3153
+ const p = given.toLowerCase();
3154
+ const n = p.match(/^(\d+)([hd])$/);
3155
+ const seconds = POSTED[p] ?? (n ? Number(n[1]) * (n[2] === "h" ? 3600 : 86400) : void 0);
3156
+ if (seconds === void 0)
3157
+ throw new Refused(`--posted '${given}' is not one of: 24h, week, month, or <N>h / <N>d`);
3158
+ return `r${seconds}`;
3159
+ }
3160
+ function named(name, given) {
3161
+ const { values } = NAMED[name];
3162
+ const out = [];
3163
+ for (const v of given) {
3164
+ const mapped = values[v.toLowerCase()] ?? (Object.values(values).includes(v) ? v : void 0);
3165
+ if (mapped === void 0)
3166
+ throw new Refused(`--${name} '${v}' is not one of: ${Object.keys(values).join(", ")}`);
3167
+ if (!out.includes(mapped)) out.push(mapped);
3168
+ }
3169
+ return out;
3170
+ }
3171
+ function rawFilter(r) {
3172
+ const m = r.match(/^([A-Za-z_]+)=(.+)$/);
3173
+ if (m?.[1] === void 0 || m[2] === void 0)
3174
+ throw new Refused(`--filter '${r}' is not key=value[,value]`);
3175
+ const values = m[2].split(",").map((v) => v.trim()).filter((v) => v !== "");
3176
+ return [m[1], values];
3177
+ }
3178
+ function selection(o) {
3179
+ const filters = {};
3180
+ if (o.posted !== void 0) filters.timePostedRange = [postedRange(o.posted)];
3181
+ for (const name of ["experience", "type", "workplace"]) {
3182
+ const given = o[name];
3183
+ if (given !== void 0 && given.length > 0)
3184
+ filters[NAMED[name].param] = named(name, given);
3185
+ }
3186
+ const flags = [
3187
+ [o.easyApply, "applyWithLinkedin"],
3188
+ [o.under10, "earlyApplicant"],
3189
+ [o.verified, "verifiedJob"],
3190
+ [o.inNetwork, "jobInYourNetwork"],
3191
+ [o.fairChance, "fairChanceEmployer"]
3192
+ ];
3193
+ for (const [on, param] of flags) if (on === true) filters[param] = ["true"];
3194
+ const ids = [
3195
+ [o.company, "company"],
3196
+ [o.industry, "industry"],
3197
+ [o.function, "function"],
3198
+ [o.title, "title"],
3199
+ [o.place, "populatedPlace"]
3200
+ ];
3201
+ for (const [given, param] of ids)
3202
+ if (given !== void 0 && given.length > 0) filters[param] = given;
3203
+ if (o.sort !== void 0) {
3204
+ const sort = { recent: "DD", relevant: "R" }[o.sort.toLowerCase()];
3205
+ if (sort === void 0) throw new Refused(`--sort '${o.sort}' is not one of: recent, relevant`);
3206
+ filters.sortBy = [sort];
3207
+ }
3208
+ if (o.distance !== void 0) filters.distance = [String(o.distance)];
3209
+ for (const r of o.raw ?? []) {
3210
+ const [key, values] = rawFilter(r);
3211
+ filters[key] = values;
3212
+ }
3213
+ return filters;
3214
+ }
3215
+ function jobFilterSelection(o) {
3216
+ try {
3217
+ return { ok: true, filters: selection(o) };
3218
+ } catch (e) {
3219
+ if (e instanceof Refused) return { ok: false, code: "INVALID_INPUT", message: e.message };
3220
+ throw e;
3221
+ }
3222
+ }
3223
+
3224
+ // src/commands/jobs.ts
3225
+ function liveFetch(command, quiet) {
3226
+ const session = loadSession();
3227
+ if (session.state !== "ok")
3228
+ return err(command, "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
3229
+ const client = createLiveClient(session.session, void 0, quiet);
3230
+ return async (url, spendClass) => {
3231
+ const r = await client.request({ url, spendClass, operation: command });
3232
+ return r.ok ? { ok: true, json: r.json } : r;
3233
+ };
3234
+ }
3235
+ var MAX_RESULTS = 1e3;
3236
+ function compactJob(j) {
3237
+ const parts = [j.id, j.title, j.company, j.location, j.workplace, j.listed];
3238
+ if (j.easyApply) parts.push("easy apply");
3239
+ if (j.promoted) parts.push("promoted");
3240
+ parts.push(j.salary);
3241
+ if (j.apply?.url !== void 0) parts.push(`apply: ${j.apply.url}`);
3242
+ return parts.filter((p) => p !== void 0 && p !== "").map((p) => p.replaceAll(" | ", " / ")).join(" | ");
3243
+ }
3244
+ function shape(rows, opts, line) {
3245
+ if (opts.compact === true) return rows.map(line);
3246
+ if (opts.fields !== void 0 && opts.fields !== "")
3247
+ return project(rows, opts.fields);
3248
+ return rows;
3249
+ }
3250
+ function queryOf(req, filters) {
3251
+ return {
3252
+ ...req.keywords ? { keywords: req.keywords } : {},
3253
+ ...req.location ? { location: req.location } : {},
3254
+ ...req.geoId ? { geoId: req.geoId } : {},
3255
+ filters
3256
+ };
3257
+ }
3258
+ async function collect(get, query, first, want) {
3259
+ const out = { jobs: [], exhausted: false, unknownTypes: {} };
3260
+ for (let start = first; out.jobs.length < want && start < MAX_RESULTS; start += PAGE_SIZE2) {
3261
+ const res = await get(jobSearchUrl({ ...query, start, count: PAGE_SIZE2 }), "search");
3262
+ const page = res.ok ? parseJobCards(res.json) : res;
3263
+ if (!page.ok) {
3264
+ if (out.jobs.length === 0) return page;
3265
+ out.stoppedBy = page.code;
3266
+ break;
3267
+ }
3268
+ out.total = page.total ?? out.total;
3269
+ out.resolved = page.location ?? out.resolved;
3270
+ for (const [k, n] of Object.entries(page.unknownTypes))
3271
+ out.unknownTypes[k] = (out.unknownTypes[k] ?? 0) + n;
3272
+ const fresh = page.jobs.filter((j) => !out.jobs.some((x) => x.id === j.id));
3273
+ out.jobs.push(...fresh.slice(0, want - out.jobs.length));
3274
+ if (page.jobs.length === 0 || out.total !== void 0 && start + PAGE_SIZE2 >= out.total) {
3275
+ out.exhausted = true;
3276
+ break;
3277
+ }
3278
+ }
3279
+ return out;
3280
+ }
3281
+ async function addDetails(get, jobs, withDescription) {
3282
+ for (const job of jobs) {
3283
+ const res = await get(jobDetailUrl(job.id), "profile");
3284
+ const detail = res.ok ? parseJobDetail(res.json) : res;
3285
+ if (!detail.ok) return detail.code;
3286
+ const { description, id: _id, url: _url, ...rest } = detail.job;
3287
+ Object.assign(job, rest, withDescription ? { description } : {});
3288
+ }
3289
+ return void 0;
3290
+ }
3291
+ async function runJobs(req, opts = {}, fetch2) {
3292
+ const hasQuery = [req.keywords, req.location, req.geoId].some((v) => v !== void 0 && v !== "");
3293
+ if (!hasQuery) {
3294
+ return err(
3295
+ "jobs",
3296
+ "INVALID_INPUT",
3297
+ "give keywords, a location, or both",
3298
+ 'lnrelay jobs "<keywords>" [--location "<place>" | --geo <id>] [filters]'
3299
+ );
3300
+ }
3301
+ const selection2 = jobFilterSelection(req.filter ?? {});
3302
+ if (!selection2.ok)
3303
+ return err("jobs", selection2.code, selection2.message, "see `lnrelay help jobs`");
3304
+ const get = fetch2 ?? liveFetch("jobs", opts.quiet === true);
3305
+ if (typeof get !== "function") return get;
3306
+ const first = Math.max(0, req.start ?? 0);
3307
+ const want = Math.max(1, Math.min(req.limit, MAX_RESULTS - first));
3308
+ const query = queryOf(req, selection2.filters);
3309
+ const found = await collect(get, query, first, want);
3310
+ if ("ok" in found) return err("jobs", found.code, found.message, found.hint);
3311
+ if (req.details === true) {
3312
+ const stopped = await addDetails(get, found.jobs, req.description === true);
3313
+ found.stoppedBy = found.stoppedBy ?? stopped;
3314
+ }
3315
+ const { jobs, stoppedBy, exhausted, unknownTypes } = found;
3316
+ return ok("jobs", {
3317
+ query,
3318
+ ...found.resolved !== void 0 ? { location: found.resolved } : {},
3319
+ items: shape(jobs, opts, compactJob),
3320
+ meta: {
3321
+ state: stoppedBy === void 0 && exhausted ? "complete" : "partial",
3322
+ operation: "jobs",
3323
+ claimedCount: found.total,
3324
+ returnedCount: jobs.length,
3325
+ start: first,
3326
+ next: exhausted ? void 0 : first + jobs.length,
3327
+ ...stoppedBy !== void 0 ? { stoppedBy } : {},
3328
+ ...Object.keys(unknownTypes).length > 0 ? { unknownTypes } : {}
3329
+ }
3330
+ });
3331
+ }
3332
+ async function runJob(input, opts = {}, fetch2) {
3333
+ const id = input === void 0 ? void 0 : jobIdOf(input);
3334
+ if (id === void 0) {
3335
+ return err("job", "INVALID_INPUT", "a job id or job URL is required", "lnrelay job <id|url>");
3336
+ }
3337
+ const get = fetch2 ?? liveFetch("job", opts.quiet === true);
3338
+ if (typeof get !== "function") return get;
3339
+ const res = await get(jobDetailUrl(id), "profile");
3340
+ if (!res.ok) return err("job", res.code, res.message, res.hint);
3341
+ const detail = parseJobDetail(res.json);
3342
+ if (!detail.ok) return err("job", detail.code, detail.message, detail.hint);
3343
+ return ok("job", detail.job);
3344
+ }
3345
+ async function runJobFilters(req, opts = {}, fetch2) {
3346
+ const selection2 = jobFilterSelection(req.filter ?? {});
3347
+ if (!selection2.ok) return err("job-filters", selection2.code, selection2.message);
3348
+ const get = fetch2 ?? liveFetch("job-filters", opts.quiet === true);
3349
+ if (typeof get !== "function") return get;
3350
+ const url = jobFiltersUrl({ ...queryOf(req, selection2.filters), start: 0, count: PAGE_SIZE2 });
3351
+ const res = await get(url, "search");
3352
+ const parsed = res.ok ? parseJobFilters(res.json) : res;
3353
+ if (!parsed.ok) return err("job-filters", parsed.code, parsed.message, parsed.hint);
3354
+ return ok("job-filters", {
3355
+ items: shape(
3356
+ parsed.filters,
3357
+ opts,
3358
+ (f) => `${f.key}: ${f.options.map((o) => `${o.value}=${o.label}${o.count !== void 0 ? ` (${o.count})` : ""}`).join(", ")}`
3359
+ ),
3360
+ meta: { state: "complete", operation: "job-filters", returnedCount: parsed.filters.length }
3361
+ });
3362
+ }
3363
+
2869
3364
  // src/commands/live.ts
2870
3365
  function withSession(command, quiet = false) {
2871
3366
  const loaded = sessionFor(command);
@@ -3215,18 +3710,18 @@ async function exchange(code, config, deps) {
3215
3710
  } catch (e) {
3216
3711
  return { ok: false, message: `could not reach LinkedIn: ${e.message}` };
3217
3712
  }
3218
- const text2 = await res.text();
3713
+ const text3 = await res.text();
3219
3714
  if (res.status !== 200) {
3220
3715
  return {
3221
3716
  ok: false,
3222
3717
  message: `LinkedIn rejected the code exchange (${res.status})`,
3223
3718
  // 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)}`
3719
+ 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
3720
  };
3226
3721
  }
3227
3722
  let parsed;
3228
3723
  try {
3229
- parsed = JSON.parse(text2);
3724
+ parsed = JSON.parse(text3);
3230
3725
  } catch {
3231
3726
  return { ok: false, message: "token response was not JSON" };
3232
3727
  }
@@ -3522,7 +4017,34 @@ var COMMANDS = [
3522
4017
  name: "search",
3523
4018
  cost: "cheap \u2014 the net",
3524
4019
  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]',
4020
+ usage: 'lnrelay search people|companies|jobs "<query>" [--limit N] (jobs: see `jobs`)\n [--compact | --fields a,b,c] [--retain] [--raw]',
4021
+ audience: ["cli", "mcp"],
4022
+ risk: "read",
4023
+ implemented: true
4024
+ },
4025
+ {
4026
+ name: "jobs",
4027
+ cost: "1 search call per 25 jobs; --details adds 1 profile call per job",
4028
+ 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`.",
4029
+ 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.',
4030
+ audience: ["cli", "mcp"],
4031
+ risk: "read",
4032
+ implemented: true
4033
+ },
4034
+ {
4035
+ name: "job",
4036
+ cost: "1 profile call",
4037
+ summary: "One job: description, apply link (external or Easy Apply), applicants, state.",
4038
+ usage: "lnrelay job <id|job-url>",
4039
+ audience: ["cli", "mcp"],
4040
+ risk: "read",
4041
+ implemented: true
4042
+ },
4043
+ {
4044
+ name: "job-filters",
4045
+ cost: "1 search call",
4046
+ summary: "Every job filter for a query, with option ids and live counts: what `jobs --filter` and --company/--industry/--title/--place take.",
4047
+ usage: 'lnrelay job-filters "<keywords>" [--location "<place>" | --geo <id>] [jobs filters]',
3526
4048
  audience: ["cli", "mcp"],
3527
4049
  risk: "read",
3528
4050
  implemented: true
@@ -3554,15 +4076,6 @@ var COMMANDS = [
3554
4076
  risk: "read",
3555
4077
  implemented: false
3556
4078
  },
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
4079
  {
3567
4080
  name: "feed",
3568
4081
  cost: "medium",
@@ -3783,10 +4296,10 @@ function balanced(s, start) {
3783
4296
  return null;
3784
4297
  }
3785
4298
  function parseAt(s, start) {
3786
- const text2 = start < 0 ? null : balanced(s, start);
3787
- if (text2 === null) return null;
4299
+ const text3 = start < 0 ? null : balanced(s, start);
4300
+ if (text3 === null) return null;
3788
4301
  try {
3789
- return JSON.parse(text2);
4302
+ return JSON.parse(text3);
3790
4303
  } catch {
3791
4304
  return null;
3792
4305
  }
@@ -3957,7 +4470,7 @@ var PROFILE_FIELDS = {
3957
4470
  maxLength: 2600
3958
4471
  }
3959
4472
  };
3960
- var drift2 = (message) => ({
4473
+ var drift3 = (message) => ({
3961
4474
  ok: false,
3962
4475
  code: "SCHEMA_DRIFT",
3963
4476
  message,
@@ -3965,10 +4478,10 @@ var drift2 = (message) => ({
3965
4478
  });
3966
4479
  function readForm(stream, field) {
3967
4480
  const states2 = readModel(stream);
3968
- if (states2 === null) return drift2("the profile form carried no initial values");
4481
+ if (states2 === null) return drift3("the profile form carried no initial values");
3969
4482
  const args = findRequest(stream, field.save);
3970
4483
  if (args === null)
3971
- return drift2(`the profile form carried no ${field.save.split(".").pop()} action`);
4484
+ return drift3(`the profile form carried no ${field.save.split(".").pop()} action`);
3972
4485
  return { ok: true, args, states: states2, screen: field.screen, save: field.save };
3973
4486
  }
3974
4487
  function boundKey(form, property) {
@@ -3984,7 +4497,7 @@ function topSkills(form) {
3984
4497
  return (key) => {
3985
4498
  if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
3986
4499
  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");
4500
+ if (initial === void 0) return drift3("the About form carried no initial top skills");
3988
4501
  if (!Array.isArray(initial.value) || initial.value.length > 0) {
3989
4502
  return {
3990
4503
  ok: false,
@@ -4007,7 +4520,7 @@ function saveBody(form, field, value) {
4007
4520
  const target = boundKey(form, field.binding);
4008
4521
  const current = target === void 0 ? void 0 : form.states.get(target);
4009
4522
  if (target === void 0 || current === void 0) {
4010
- return drift2(`the profile form has no ${field.name} field`);
4523
+ return drift3(`the profile form has no ${field.name} field`);
4011
4524
  }
4012
4525
  const model = new Map(form.states);
4013
4526
  model.set(target, { ...current, value });
@@ -4076,7 +4589,7 @@ var POSITION = {
4076
4589
  var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
4077
4590
  function listPositions(stream) {
4078
4591
  if (readModel(stream) === null && !stream.includes(EDIT_NAV) && !stream.includes('"rows"')) {
4079
- return drift2("the Experience screen could not be read");
4592
+ return drift3("the Experience screen could not be read");
4080
4593
  }
4081
4594
  const positions = [];
4082
4595
  const seen = /* @__PURE__ */ new Set();
@@ -4084,27 +4597,27 @@ function listPositions(stream) {
4084
4597
  for (; ; ) {
4085
4598
  i = stream.indexOf(EDIT_NAV, i);
4086
4599
  if (i === -1) break;
4087
- const text2 = balanced(stream, i);
4600
+ const text3 = balanced(stream, i);
4088
4601
  i += EDIT_NAV.length;
4089
- if (text2 === null) continue;
4090
- const payload = JSON.parse(text2).requestedArguments?.payload;
4602
+ if (text3 === null) continue;
4603
+ const payload = JSON.parse(text3).requestedArguments?.payload;
4091
4604
  const id = payload?.positionId;
4092
4605
  if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
4093
4606
  seen.add(id);
4094
4607
  positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
4095
4608
  }
4096
4609
  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");
4610
+ return drift3("the Experience screen listed no roles and did not look like one");
4098
4611
  }
4099
4612
  return { ok: true, positions };
4100
4613
  }
4101
4614
  function readPositionForm(stream) {
4102
4615
  const model = readModel(stream);
4103
- if (model === null) return drift2("the position form carried no initial values");
4616
+ if (model === null) return drift3("the position form carried no initial values");
4104
4617
  const media = findRequest(stream, POSITION.media);
4105
4618
  const prefix = media?.payload.formIdPrefix;
4106
4619
  if (media === null || typeof prefix !== "string") {
4107
- return drift2("the position form carried no save step (uploadPositionMedia)");
4620
+ return drift3("the position form carried no save step (uploadPositionMedia)");
4108
4621
  }
4109
4622
  const del = findRequest(stream, POSITION.delete);
4110
4623
  return {
@@ -4155,7 +4668,7 @@ function applyChanges(form, changes) {
4155
4668
  }
4156
4669
  need("dynamicallyCreateHeadline", false);
4157
4670
  need("allowProfileEditBroadcasts", changes.notify === true);
4158
- if (missing.length > 0) return drift2(`the position form has no ${missing.join(", ")} field`);
4671
+ if (missing.length > 0) return drift3(`the position form has no ${missing.join(", ")} field`);
4159
4672
  const s = roleSummary(model);
4160
4673
  if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
4161
4674
  return {
@@ -4200,7 +4713,7 @@ function mediaBody(form, model) {
4200
4713
  }
4201
4714
  function saveFromReply(reply) {
4202
4715
  const args = findRequest(reply, POSITION.save);
4203
- return args === null ? drift2("the media step did not hand back the save action") : { ok: true, args };
4716
+ return args === null ? drift3("the media step did not hand back the save action") : { ok: true, args };
4204
4717
  }
4205
4718
  function positionSaveBody(save, model, screen) {
4206
4719
  const sending = new Map(model);
@@ -4212,7 +4725,7 @@ function positionSaveBody(save, model, screen) {
4212
4725
  }
4213
4726
  function deleteBody(form) {
4214
4727
  if (form.del === null)
4215
- return drift2("this form has no delete action (it is not an existing role)");
4728
+ return drift3("this form has no delete action (it is not an existing role)");
4216
4729
  const states2 = wireStates(keysOf(form.del), form.model, resolver);
4217
4730
  if (!Array.isArray(states2)) return states2;
4218
4731
  return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
@@ -4290,9 +4803,9 @@ async function send(url, body, token, deps) {
4290
4803
  } catch (e) {
4291
4804
  return { ok: false, code: "FETCH_FAILED", message: e.message };
4292
4805
  }
4293
- const text2 = await res.text();
4806
+ const text3 = await res.text();
4294
4807
  if (res.status === 201 || res.status === 200) {
4295
- const id = res.headers.get("x-restli-id") ?? extractId(text2);
4808
+ const id = res.headers.get("x-restli-id") ?? extractId(text3);
4296
4809
  return {
4297
4810
  ok: true,
4298
4811
  id: id ?? "(unknown)",
@@ -4319,7 +4832,7 @@ async function send(url, body, token, deps) {
4319
4832
  ok: false,
4320
4833
  code: "FETCH_FAILED",
4321
4834
  message: `write failed (${res.status})`,
4322
- hint: text2.slice(0, 300)
4835
+ hint: text3.slice(0, 300)
4323
4836
  };
4324
4837
  }
4325
4838
  function extractId(body) {
@@ -4367,7 +4880,7 @@ function feedTypeFor(bindingKey) {
4367
4880
  function stateKey(prefix, body) {
4368
4881
  return `${prefix}-${body}`;
4369
4882
  }
4370
- function states(text2, body) {
4883
+ function states(text3, body) {
4371
4884
  return STATE_PREFIXES.map((prefix) => {
4372
4885
  const key = stateKey(prefix, body);
4373
4886
  const base = {
@@ -4376,19 +4889,19 @@ function states(text2, body) {
4376
4889
  protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
4377
4890
  };
4378
4891
  if (prefix === "commentBoxText") {
4379
- return { ...base, value: text2, originalProtoCase: "stringValue" };
4892
+ return { ...base, value: text3, originalProtoCase: "stringValue" };
4380
4893
  }
4381
4894
  if (prefix === "richCommentBoxText") {
4382
4895
  return {
4383
4896
  ...base,
4384
- value: { text: text2, attribute: [], $type: "TextModel", source: "local" },
4897
+ value: { text: text3, attribute: [], $type: "TextModel", source: "local" },
4385
4898
  originalProtoCase: "textModelForWrite"
4386
4899
  };
4387
4900
  }
4388
4901
  return { ...base, value: "", originalProtoCase: "stringValue" };
4389
4902
  });
4390
4903
  }
4391
- function commentBody(activityId, text2, tokens, feedType) {
4904
+ function commentBody(activityId, text3, tokens, feedType) {
4392
4905
  const body = keyBody(tokens.bindingKey);
4393
4906
  const activityUrn = { activityUrn: { activityId } };
4394
4907
  const binding = (prefix) => ({
@@ -4435,17 +4948,17 @@ function commentBody(activityId, text2, tokens, feedType) {
4435
4948
  isStreaming: false,
4436
4949
  rumPageKey: ""
4437
4950
  },
4438
- states: states(text2, body),
4951
+ states: states(text3, body),
4439
4952
  requestedArguments: {
4440
4953
  ...args,
4441
- states: states(text2, body),
4954
+ states: states(text3, body),
4442
4955
  screenId: SCREEN_ID3,
4443
4956
  knownTemplateIds: []
4444
4957
  }
4445
4958
  };
4446
4959
  }
4447
4960
  async function comment(confirmed, client) {
4448
- const { activityId, text: text2, tokens } = confirmed.payload;
4961
+ const { activityId, text: text3, tokens } = confirmed.payload;
4449
4962
  if (!keyMatchesPost(tokens.bindingKey, activityId)) {
4450
4963
  return {
4451
4964
  ok: false,
@@ -4466,7 +4979,7 @@ async function comment(confirmed, client) {
4466
4979
  const result = await client.request({
4467
4980
  url: COMMENT_URL,
4468
4981
  method: "POST",
4469
- body: commentBody(activityId, text2, tokens, feedType),
4982
+ body: commentBody(activityId, text3, tokens, feedType),
4470
4983
  spendClass: "write",
4471
4984
  operation: "comment.create"
4472
4985
  });
@@ -4590,10 +5103,10 @@ var REPLY_URL = `https://www.linkedin.com/voyager/api/voyagerSocialDashNormComme
4590
5103
  function parentThreadUrn(ref) {
4591
5104
  return `urn:li:comment:(${ref.threadType}:${ref.activityId},${ref.commentId})`;
4592
5105
  }
4593
- function replyBody(ref, text2) {
5106
+ function replyBody(ref, text3) {
4594
5107
  return {
4595
5108
  commentary: {
4596
- text: text2,
5109
+ text: text3,
4597
5110
  // The captured reply carried a profileMention, because LinkedIn's UI
4598
5111
  // pre-fills "@Author " into the box. We send none: an @mention notifies a
4599
5112
  // real person, and inventing one would put words — and a notification —
@@ -4605,11 +5118,11 @@ function replyBody(ref, text2) {
4605
5118
  };
4606
5119
  }
4607
5120
  async function replyToComment(confirmed, client) {
4608
- const { ref, text: text2 } = confirmed.payload;
5121
+ const { ref, text: text3 } = confirmed.payload;
4609
5122
  const result = await client.request({
4610
5123
  url: REPLY_URL,
4611
5124
  method: "POST",
4612
- body: replyBody(ref, text2),
5125
+ body: replyBody(ref, text3),
4613
5126
  spendClass: "write",
4614
5127
  operation: "reply"
4615
5128
  });
@@ -4971,8 +5484,8 @@ function whenLine(at, now) {
4971
5484
  const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
4972
5485
  return `when ${local} (${zone}) \u2014 ${away}`;
4973
5486
  }
4974
- async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
4975
- if (text2 === void 0 || text2.trim() === "") {
5487
+ async function runShare(text3, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
5488
+ if (text3 === void 0 || text3.trim() === "") {
4976
5489
  return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
4977
5490
  }
4978
5491
  const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
@@ -4987,7 +5500,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
4987
5500
  via: via2
4988
5501
  });
4989
5502
  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;
5503
+ const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text3) : null;
4991
5504
  const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
4992
5505
  const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
4993
5506
  if ("ok" in ctx) return ctx;
@@ -4996,7 +5509,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
4996
5509
  const plan = sharePlan({
4997
5510
  author: authorLine(ctx.transport),
4998
5511
  transport: ctx.transport.kind,
4999
- text: text2,
5512
+ text: text3,
5000
5513
  visibility: vis,
5001
5514
  media: loaded?.approved,
5002
5515
  scheduledAt,
@@ -5019,7 +5532,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
5019
5532
  note: "note" in result ? result.note : ctx.note
5020
5533
  });
5021
5534
  }
5022
- async function runEditPost(urn, text2, now, deps) {
5535
+ async function runEditPost(urn, text3, now, deps) {
5023
5536
  const unapprovable = refuseUnapprovable("edit", "editing", deps);
5024
5537
  if (unapprovable !== null) return unapprovable;
5025
5538
  const ctx = prepare("edit", now, "voyager");
@@ -5034,12 +5547,12 @@ async function runEditPost(urn, text2, now, deps) {
5034
5547
  const before = await lookup(urn, true);
5035
5548
  const plan = {
5036
5549
  action: "edit your post",
5037
- payload: { urn, text: text2 },
5550
+ payload: { urn, text: text3 },
5038
5551
  summary: [
5039
5552
  authorLine(ctx.transport),
5040
5553
  `post ${urn}`,
5041
5554
  ...previewLines2(before).map((l) => l.replace(/^content /, "was ")),
5042
- `new text "${text2}"`
5555
+ `new text "${text3}"`
5043
5556
  ],
5044
5557
  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
5558
  transport: "voyager"
@@ -5063,7 +5576,7 @@ function liveProfile(session) {
5063
5576
  };
5064
5577
  }
5065
5578
  var PROFILE_HINT = `profile fields: ${Object.keys(PROFILE_FIELDS).join(", ")}`;
5066
- async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps(), surface) {
5579
+ async function runEditProfile(name, text3, now = Date.now(), deps = terminalDeps(), surface) {
5067
5580
  const field = PROFILE_FIELDS[name];
5068
5581
  if (field === void 0) {
5069
5582
  return err(
@@ -5073,7 +5586,7 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5073
5586
  PROFILE_HINT
5074
5587
  );
5075
5588
  }
5076
- if (text2 === void 0 || text2.trim() === "") {
5589
+ if (text3 === void 0 || text3.trim() === "") {
5077
5590
  return err(
5078
5591
  "edit",
5079
5592
  "INVALID_INPUT",
@@ -5081,11 +5594,11 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5081
5594
  `lnrelay edit ${name} "<text>"`
5082
5595
  );
5083
5596
  }
5084
- if (text2.length > field.maxLength) {
5597
+ if (text3.length > field.maxLength) {
5085
5598
  return err(
5086
5599
  "edit",
5087
5600
  "INVALID_INPUT",
5088
- `the ${name} is ${text2.length} characters; LinkedIn allows ${field.maxLength}`
5601
+ `the ${name} is ${text3.length} characters; LinkedIn allows ${field.maxLength}`
5089
5602
  );
5090
5603
  }
5091
5604
  const unapprovable = refuseUnapprovable("edit", "editing", deps);
@@ -5101,19 +5614,19 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5101
5614
  const form = await profile.open(field, me.vanity);
5102
5615
  if (!form.ok) return err("edit", form.code, form.message, form.hint);
5103
5616
  const was = currentValue(form, field) ?? "";
5104
- if (was === text2) {
5617
+ if (was === text3) {
5105
5618
  return err("edit", "INVALID_INPUT", `your ${name} already reads exactly that; nothing to save`);
5106
5619
  }
5107
- const built = saveBody(form, field, text2);
5620
+ const built = saveBody(form, field, text3);
5108
5621
  if (!built.ok) return err("edit", built.code, built.message, built.hint);
5109
5622
  const plan = {
5110
5623
  action: `change your ${name}`,
5111
- payload: { field: name, was, text: text2 },
5624
+ payload: { field: name, was, text: text3 },
5112
5625
  summary: [
5113
5626
  authorLine(ctx.transport),
5114
5627
  `field ${name}`,
5115
5628
  `was "${was}"`,
5116
- `new "${text2}"`
5629
+ `new "${text3}"`
5117
5630
  ],
5118
5631
  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
5632
  transport: "voyager"
@@ -5124,7 +5637,7 @@ async function runEditProfile(name, text2, now = Date.now(), deps = terminalDeps
5124
5637
  if (!sent.ok) return err("edit", sent.code, sent.message, sent.hint);
5125
5638
  const after = await profile.open(field, me.vanity);
5126
5639
  const reads = after.ok ? currentValue(after, field) : void 0;
5127
- if (reads !== text2) {
5640
+ if (reads !== text3) {
5128
5641
  return err(
5129
5642
  "edit",
5130
5643
  "SCHEMA_DRIFT",
@@ -5163,8 +5676,8 @@ async function harvest(activityId, session, now) {
5163
5676
  if (!found.ok) return err("comment", "SCHEMA_DRIFT", found.message, found.hint);
5164
5677
  return { ok: true, tokens: { bindingKey: found.bindingKey, trackingId: found.trackingId } };
5165
5678
  }
5166
- async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps()) {
5167
- if (postUrn2 === void 0 || text2 === void 0 || text2.trim() === "") {
5679
+ async function runComment(postUrn2, text3, now = Date.now(), deps = terminalDeps()) {
5680
+ if (postUrn2 === void 0 || text3 === void 0 || text3.trim() === "") {
5168
5681
  return err(
5169
5682
  "comment",
5170
5683
  "INVALID_INPUT",
@@ -5201,11 +5714,11 @@ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps
5201
5714
  if (!("tokens" in harvested)) return harvested;
5202
5715
  const plan = {
5203
5716
  action: "comment on a post",
5204
- payload: { activityId, text: text2, tokens: harvested.tokens },
5717
+ payload: { activityId, text: text3, tokens: harvested.tokens },
5205
5718
  // The harvested trackingId changes on every render, so --plan and --confirm
5206
5719
  // 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}"`],
5720
+ tokenBasis: { activityId, text: text3 },
5721
+ summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text3}"`],
5209
5722
  reversibility: "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately",
5210
5723
  transport: "voyager"
5211
5724
  };
@@ -5217,8 +5730,8 @@ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps
5217
5730
  );
5218
5731
  return result.ok ? ok("comment", { on: postUrn2 }) : err("comment", result.code, result.message, result.hint);
5219
5732
  }
5220
- async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps()) {
5221
- if (commentUrn === void 0 || text2 === void 0 || text2.trim() === "") {
5733
+ async function runEdit(commentUrn, text3, now = Date.now(), deps = terminalDeps()) {
5734
+ if (commentUrn === void 0 || text3 === void 0 || text3.trim() === "") {
5222
5735
  return err(
5223
5736
  "edit",
5224
5737
  "INVALID_INPUT",
@@ -5228,11 +5741,11 @@ async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps(
5228
5741
  }
5229
5742
  const ref = parseCommentUrn(commentUrn);
5230
5743
  if (ref === null && !commentUrn.startsWith("urn:")) {
5231
- return runEditProfile(commentUrn, text2, now, deps);
5744
+ return runEditProfile(commentUrn, text3, now, deps);
5232
5745
  }
5233
5746
  if (ref === null) {
5234
5747
  if (/^urn:li:(share|ugcPost):\d+$/.test(commentUrn)) {
5235
- return runEditPost(commentUrn, text2, now, deps);
5748
+ return runEditPost(commentUrn, text3, now, deps);
5236
5749
  }
5237
5750
  return err(
5238
5751
  "edit",
@@ -5252,8 +5765,8 @@ async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps(
5252
5765
  if (!("tokens" in harvested)) return harvested;
5253
5766
  const plan = {
5254
5767
  action: "edit your comment",
5255
- payload: { urn: commentUrn, text: text2 },
5256
- summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text2}"`],
5768
+ payload: { urn: commentUrn, text: text3 },
5769
+ summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text3}"`],
5257
5770
  reversibility: "editable again, but the previous text is NOT recoverable here and LinkedIn marks the comment as edited",
5258
5771
  transport: "voyager"
5259
5772
  };
@@ -5264,7 +5777,7 @@ async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps(
5264
5777
  UPDATE_OP,
5265
5778
  harvested.tokens.trackingId,
5266
5779
  createLiveClient(ctx.transport.session),
5267
- text2
5780
+ text3
5268
5781
  );
5269
5782
  return result.ok ? ok("edit", { edited: commentUrn }) : err("edit", result.code, result.message, result.hint);
5270
5783
  }
@@ -5308,8 +5821,8 @@ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(),
5308
5821
  const result = await react(gated.confirmed, createLiveClient(ctx.transport.session));
5309
5822
  return result.ok ? ok("react", { id: result.id, removed: remove }) : err("react", result.code, result.message, result.hint);
5310
5823
  }
5311
- async function runReply(commentUrn, text2, now = Date.now(), deps = terminalDeps()) {
5312
- if (commentUrn === void 0 || text2 === void 0 || text2.trim() === "") {
5824
+ async function runReply(commentUrn, text3, now = Date.now(), deps = terminalDeps()) {
5825
+ if (commentUrn === void 0 || text3 === void 0 || text3.trim() === "") {
5313
5826
  return err(
5314
5827
  "reply",
5315
5828
  "INVALID_INPUT",
@@ -5335,8 +5848,8 @@ async function runReply(commentUrn, text2, now = Date.now(), deps = terminalDeps
5335
5848
  }
5336
5849
  const plan = {
5337
5850
  action: "reply to a comment",
5338
- payload: { ref: parent, text: text2 },
5339
- summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text2}"`],
5851
+ payload: { ref: parent, text: text3 },
5852
+ summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text3}"`],
5340
5853
  reversibility: "deletable with `lnrelay delete <the reply urn>`; the comment author is notified immediately",
5341
5854
  transport: "voyager"
5342
5855
  };
@@ -5608,7 +6121,7 @@ var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":
5608
6121
  var TEXT2 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
5609
6122
  function skillsFromPage(stream) {
5610
6123
  if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
5611
- return drift2("the skills page could not be read");
6124
+ return drift3("the skills page could not be read");
5612
6125
  }
5613
6126
  const skills = [];
5614
6127
  let from = 0;
@@ -5616,11 +6129,11 @@ function skillsFromPage(stream) {
5616
6129
  for (; ; ) {
5617
6130
  i = stream.indexOf(EDIT_NAV2, i);
5618
6131
  if (i === -1) break;
5619
- const text2 = balanced(stream, i);
6132
+ const text3 = balanced(stream, i);
5620
6133
  const end = i;
5621
6134
  i += EDIT_NAV2.length;
5622
- if (text2 === null) continue;
5623
- const payload = JSON.parse(text2).requestedArguments?.payload;
6135
+ if (text3 === null) continue;
6136
+ const payload = JSON.parse(text3).requestedArguments?.payload;
5624
6137
  const id = payload?.skillId;
5625
6138
  if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
5626
6139
  continue;
@@ -5628,7 +6141,7 @@ function skillsFromPage(stream) {
5628
6141
  (m) => JSON.parse(`"${m[1]}"`)
5629
6142
  );
5630
6143
  skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
5631
- from = end + text2.length;
6144
+ from = end + text3.length;
5632
6145
  }
5633
6146
  return { ok: true, skills };
5634
6147
  }
@@ -5652,11 +6165,11 @@ function pagerFrom(payload, start) {
5652
6165
  }
5653
6166
  function readSkillForm(stream) {
5654
6167
  const model = readModel(stream);
5655
- if (model === null) return drift2("the skill form carried no initial values");
6168
+ if (model === null) return drift3("the skill form carried no initial values");
5656
6169
  const save = findRequest(stream, SKILL.save);
5657
6170
  const del = findRequest(stream, SKILL.delete);
5658
6171
  if (save === null && del === null)
5659
- return drift2("the skill form carried neither a save nor a delete");
6172
+ return drift3("the skill form carried neither a save nor a delete");
5660
6173
  return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
5661
6174
  }
5662
6175
  var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
@@ -5668,10 +6181,10 @@ function skillNameOf(form) {
5668
6181
  function addSkillBody(form, name) {
5669
6182
  if (name.trim() === "")
5670
6183
  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)");
6184
+ if (form.save === null) return drift3("this form has no save action (it is not the add form)");
5672
6185
  const key = nameKey(form.model);
5673
6186
  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");
6187
+ if (key === void 0 || current === void 0) return drift3("the skill form has no name field");
5675
6188
  const model = new Map(form.model);
5676
6189
  model.set(key, { ...current, value: name.trim() });
5677
6190
  const states2 = wireStates(keysOf(form.save), model, () => void 0);
@@ -5680,7 +6193,7 @@ function addSkillBody(form, name) {
5680
6193
  }
5681
6194
  function removeSkillBody(form) {
5682
6195
  if (form.del === null)
5683
- return drift2("this form has no delete action (it is not an existing skill)");
6196
+ return drift3("this form has no delete action (it is not an existing skill)");
5684
6197
  const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
5685
6198
  if (!Array.isArray(states2)) return states2;
5686
6199
  return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
@@ -5697,9 +6210,9 @@ async function fetchSkills(vanityName, client) {
5697
6210
  if (typeof screen !== "string") return screen;
5698
6211
  const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
5699
6212
  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);
6213
+ const text3 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
6214
+ if (text3 === null) return drift3("the Skills screen carried no list request");
6215
+ const payload = JSON.parse(text3);
5703
6216
  const count2 = typeof payload.count === "number" ? payload.count : 10;
5704
6217
  const skills = [];
5705
6218
  for (let page = 0; page < MAX_PAGES2; page++) {
@@ -6032,6 +6545,54 @@ function output(args) {
6032
6545
  if (fields !== void 0) opts.fields = fields;
6033
6546
  return opts;
6034
6547
  }
6548
+ function many(args, name) {
6549
+ return list(args, name).flatMap((v) => v.split(",")).map((v) => v.trim()).filter((v) => v !== "");
6550
+ }
6551
+ function jobsRequest(args) {
6552
+ const filter = {};
6553
+ const distance = num(args, "distance");
6554
+ if (distance !== void 0) filter.distance = distance;
6555
+ const posted = str(args, "posted");
6556
+ if (posted !== void 0) filter.posted = posted;
6557
+ const lists = [
6558
+ ["experience", "experience"],
6559
+ ["type", "type"],
6560
+ ["workplace", "workplace"],
6561
+ ["company", "company"],
6562
+ ["industry", "industry"],
6563
+ ["function", "function"],
6564
+ ["title", "title"],
6565
+ ["place", "place"]
6566
+ ];
6567
+ for (const [flag, key] of lists) {
6568
+ const values = many(args, flag);
6569
+ if (values.length > 0) filter[key] = values;
6570
+ }
6571
+ const flags = [
6572
+ ["easy-apply", "easyApply"],
6573
+ ["under-10", "under10"],
6574
+ ["verified", "verified"],
6575
+ ["in-network", "inNetwork"],
6576
+ ["fair-chance", "fairChance"]
6577
+ ];
6578
+ for (const [flag, key] of flags) if (bool(args, flag)) filter[key] = true;
6579
+ const raw = list(args, "filter");
6580
+ if (raw.length > 0) filter.raw = raw;
6581
+ const sort = str(args, "sort");
6582
+ if (sort !== void 0) filter.sort = sort;
6583
+ const req = { limit: num(args, "limit") ?? 25, filter };
6584
+ const keywords = args.positionals[0];
6585
+ if (keywords !== void 0) req.keywords = keywords;
6586
+ const location = str(args, "location");
6587
+ if (location !== void 0) req.location = location;
6588
+ const geo = str(args, "geo");
6589
+ if (geo !== void 0) req.geoId = geo;
6590
+ const start = num(args, "start");
6591
+ if (start !== void 0) req.start = start;
6592
+ if (bool(args, "details")) req.details = true;
6593
+ if (bool(args, "description")) req.description = true;
6594
+ return req;
6595
+ }
6035
6596
  function via(args) {
6036
6597
  const value = str(args, "via");
6037
6598
  if (value === void 0) return void 0;
@@ -6142,7 +6703,18 @@ async function dispatch(argv, now) {
6142
6703
  return runPost(args.positionals[0], num(args, "limit") ?? 20, output(args));
6143
6704
  case "reactions":
6144
6705
  return runReactions(args.positionals[0], num(args, "limit") ?? 20, output(args));
6706
+ case "jobs":
6707
+ return runJobs(jobsRequest(args), output(args));
6708
+ case "job":
6709
+ return runJob(args.positionals[0], output(args));
6710
+ case "job-filters":
6711
+ return runJobFilters(jobsRequest(args), output(args));
6145
6712
  case "search":
6713
+ if (args.positionals[0] === "jobs")
6714
+ return runJobs(
6715
+ { keywords: args.positionals[1] ?? "", limit: num(args, "limit") ?? 10, filter: {} },
6716
+ output(args)
6717
+ );
6146
6718
  return runSearch(
6147
6719
  args.positionals[0],
6148
6720
  args.positionals[1],
@@ -6199,13 +6771,13 @@ function edit(args, now, deps) {
6199
6771
  if (inline !== void 0) {
6200
6772
  return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
6201
6773
  }
6202
- let text2;
6774
+ let text3;
6203
6775
  try {
6204
- text2 = readFileSync3(file, "utf-8").replace(/\n$/, "");
6776
+ text3 = readFileSync3(file, "utf-8").replace(/\n$/, "");
6205
6777
  } catch {
6206
6778
  return err("edit", "INVALID_INPUT", `cannot read ${file}`);
6207
6779
  }
6208
- return runEdit(target, text2, now, deps);
6780
+ return runEdit(target, text3, now, deps);
6209
6781
  }
6210
6782
  function role(args, now, deps) {
6211
6783
  const [sub, target] = args.positionals;
@@ -6344,6 +6916,7 @@ function share3(args, now, deps) {
6344
6916
  );
6345
6917
  }
6346
6918
  export {
6347
- dispatch
6919
+ dispatch,
6920
+ jobsRequest
6348
6921
  };
6349
6922
  //# sourceMappingURL=cli.js.map