linkedin-relay-mcp 3.15.0 → 3.16.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
@@ -630,7 +630,7 @@ function shapePost(node, index) {
630
630
  const actor = node.actor;
631
631
  const urn = postUrn(node);
632
632
  const social = deref(node, "*socialDetail", index);
633
- const counts = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
633
+ const counts2 = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
634
634
  const meta = node.metadata;
635
635
  return defined({
636
636
  type: typeOf(node),
@@ -643,9 +643,9 @@ function shapePost(node, index) {
643
643
  // `text()` already trims; LinkedIn pads these with trailing spaces.
644
644
  posted: text(actor?.subDescription),
645
645
  text: text(node.commentary),
646
- likes: numberOf(counts?.numLikes),
647
- comments: numberOf(counts?.numComments),
648
- shares: numberOf(counts?.numShares ?? social?.totalShares),
646
+ likes: numberOf(counts2?.numLikes),
647
+ comments: numberOf(counts2?.numComments),
648
+ shares: numberOf(counts2?.numShares ?? social?.totalShares),
649
649
  url: urn === void 0 ? void 0 : `https://www.linkedin.com/feed/update/${urn}/`
650
650
  });
651
651
  }
@@ -701,7 +701,7 @@ function shapeMember(node) {
701
701
  function shapeComment(node, index) {
702
702
  const commenter = node.commenter;
703
703
  const social = deref(node, "*socialDetail", index);
704
- const counts = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
704
+ const counts2 = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
705
705
  return defined({
706
706
  type: typeOf(node),
707
707
  urn: typeof node.urn === "string" ? node.urn : void 0,
@@ -709,7 +709,7 @@ function shapeComment(node, index) {
709
709
  headline: text(commenter?.subtitle),
710
710
  authorUrl: cleanUrl(commenter?.navigationUrl),
711
711
  text: text(node.comment) ?? text(node.commentary),
712
- likes: numberOf(counts?.numLikes),
712
+ likes: numberOf(counts2?.numLikes),
713
713
  postedAt: typeof node.createdAt === "number" ? new Date(node.createdAt).toISOString() : void 0,
714
714
  edited: node.edited === true ? true : void 0,
715
715
  url: cleanUrl(node.permalink)
@@ -776,8 +776,8 @@ function compactRows(rows) {
776
776
  const v = row[key];
777
777
  if (typeof v === "string" && v !== "") parts.push(v);
778
778
  }
779
- const counts = ["likes", "comments"].map((k) => typeof row[k] === "number" ? `${row[k]} ${k}` : void 0).filter((v) => v !== void 0);
780
- parts.push(...counts);
779
+ const counts2 = ["likes", "comments"].map((k) => typeof row[k] === "number" ? `${row[k]} ${k}` : void 0).filter((v) => v !== void 0);
780
+ parts.push(...counts2);
781
781
  if (parts.length === 0) {
782
782
  const urn = row.urn ?? row.type;
783
783
  if (typeof urn === "string") parts.push(urn);
@@ -1419,6 +1419,15 @@ var CONTRACTS = {
1419
1419
  provenance: "verified",
1420
1420
  capturedAt: "2026-10-14"
1421
1421
  },
1422
+ // Connection invitations the owner has sent, captured 2026-10-14; see
1423
+ // engine/network.ts.
1424
+ sentInvitations: {
1425
+ name: "sentInvitations",
1426
+ transport: "voyager-restli",
1427
+ path: `${VOYAGER}/relationships/sentInvitationViewsV2`,
1428
+ provenance: "verified",
1429
+ capturedAt: "2026-10-14"
1430
+ },
1422
1431
  jobCards: {
1423
1432
  name: "jobCards",
1424
1433
  transport: "voyager-restli",
@@ -4101,10 +4110,11 @@ function peopleSearchUrl(q2) {
4101
4110
  const variables = encodeVariables({
4102
4111
  start: q2.start,
4103
4112
  count: PEOPLE_PAGE,
4104
- origin: "FACETED_SEARCH",
4113
+ origin: q2.origin ?? "FACETED_SEARCH",
4105
4114
  query: {
4106
- keywords: q2.keywords,
4107
- flagshipSearchIntent: "SEARCH_SRP",
4115
+ // An empty `keywords` is answered with a 400: none is sent then.
4116
+ keywords: q2.keywords === "" ? void 0 : q2.keywords,
4117
+ flagshipSearchIntent: q2.intent ?? "SEARCH_SRP",
4108
4118
  queryParameters,
4109
4119
  includeFiltersInResponse: q2.withFilters === true
4110
4120
  }
@@ -4764,6 +4774,285 @@ function runDraftRemove(id) {
4764
4774
  return ok("draft", { removed: id });
4765
4775
  }
4766
4776
 
4777
+ // src/engine/search.ts
4778
+ var SEARCH_KINDS = {
4779
+ companies: "COMPANIES",
4780
+ groups: "GROUPS",
4781
+ events: "EVENTS",
4782
+ courses: "LEARNING",
4783
+ products: "PRODUCTS",
4784
+ services: "SERVICES",
4785
+ schools: "SCHOOLS"
4786
+ };
4787
+ var SEARCH_PAGE = PEOPLE_PAGE;
4788
+ function searchUrl(q2) {
4789
+ return peopleSearchUrl({
4790
+ ...q2.keywords !== void 0 ? { keywords: q2.keywords } : {},
4791
+ params: q2.params,
4792
+ start: q2.start,
4793
+ ...q2.withFilters === true ? { withFilters: true } : {},
4794
+ kind: SEARCH_KINDS[q2.kind]
4795
+ });
4796
+ }
4797
+ var text4 = (v) => {
4798
+ const t = v?.text;
4799
+ return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
4800
+ };
4801
+ function idOf(entityUrn) {
4802
+ const inner = String(entityUrn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
4803
+ return inner?.split(":").pop();
4804
+ }
4805
+ function cleanUrl2(nav) {
4806
+ if (typeof nav !== "string" || !nav.startsWith("https://")) return void 0;
4807
+ return nav.split("?")[0];
4808
+ }
4809
+ function rowToFound(row) {
4810
+ const id = idOf(row.entityUrn);
4811
+ const name = text4(row.title);
4812
+ if (id === void 0 || name === void 0) return void 0;
4813
+ const found = { id, name };
4814
+ const fields = [
4815
+ ["subtitle", text4(row.primarySubtitle)],
4816
+ ["detail", text4(row.secondarySubtitle)],
4817
+ ["summary", text4(row.summary)],
4818
+ ["url", cleanUrl2(row.navigationUrl)]
4819
+ ];
4820
+ for (const [k, v] of fields)
4821
+ if (v !== void 0) found[k] = v;
4822
+ if (JSON.stringify(row.badgeIcon ?? null).includes("VERIFIED")) found.verified = true;
4823
+ return found;
4824
+ }
4825
+ var drift5 = (message) => ({
4826
+ ok: false,
4827
+ code: "SCHEMA_DRIFT",
4828
+ message,
4829
+ hint: "the search response changed shape; re-capture it"
4830
+ });
4831
+ function parseResults(json) {
4832
+ const c = clustersOf(json);
4833
+ if (c === void 0 || !Array.isArray(c.elements))
4834
+ return drift5("the search returned no result list");
4835
+ const included = json.included ?? [];
4836
+ const { people: items, unknownTypes, excluded, unresolved } = readItems(c, included, rowToFound);
4837
+ const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
4838
+ const start = typeof c.paging?.start === "number" ? c.paging.start : 0;
4839
+ const claimedRaw = c.metadata?.totalResultCount;
4840
+ const claimed = typeof claimedRaw === "number" ? claimedRaw : total;
4841
+ if (unresolved > 0 && items.length === 0)
4842
+ return drift5(`${unresolved} results were listed but none could be read`);
4843
+ if (items.length === 0 && total !== void 0 && total > start) {
4844
+ return {
4845
+ ok: false,
4846
+ code: "SCHEMA_DRIFT",
4847
+ message: `LinkedIn claims ${total} results but returned none from ${start}`,
4848
+ hint: 'a failed fetch, not an empty search; do not report "none"'
4849
+ };
4850
+ }
4851
+ return {
4852
+ ok: true,
4853
+ items,
4854
+ ...total !== void 0 ? { total } : {},
4855
+ ...claimed !== void 0 ? { claimed } : {},
4856
+ start,
4857
+ excluded,
4858
+ unknownTypes
4859
+ };
4860
+ }
4861
+
4862
+ // src/engine/network.ts
4863
+ var HUB = {
4864
+ connections: "CONNECTIONS",
4865
+ following: "PEOPLE_FOLLOW",
4866
+ followers: "FOLLOWERS",
4867
+ pages: "PAGES",
4868
+ events: "EVENTS",
4869
+ groups: "GROUPS"
4870
+ };
4871
+ var PEOPLE_LISTS = /* @__PURE__ */ new Set(["connections", "following", "followers"]);
4872
+ function hubUrl(list2, start) {
4873
+ return peopleSearchUrl({
4874
+ params: {},
4875
+ start,
4876
+ kind: HUB[list2],
4877
+ origin: "CurationHub",
4878
+ intent: "MYNETWORK_CURATION_HUB"
4879
+ });
4880
+ }
4881
+ var HUB_PAGE = PEOPLE_PAGE;
4882
+ function parseHub(list2, json) {
4883
+ if (PEOPLE_LISTS.has(list2)) {
4884
+ const r2 = parsePeople(json);
4885
+ if (!r2.ok) return r2;
4886
+ return {
4887
+ ok: true,
4888
+ items: r2.people,
4889
+ ...r2.total !== void 0 ? { total: r2.total } : {},
4890
+ unknownTypes: r2.unknownTypes
4891
+ };
4892
+ }
4893
+ const r = parseResults(json);
4894
+ if (!r.ok) return r;
4895
+ return {
4896
+ ok: true,
4897
+ items: r.items,
4898
+ ...r.total !== void 0 ? { total: r.total } : {},
4899
+ unknownTypes: r.unknownTypes
4900
+ };
4901
+ }
4902
+ function sentInvitationsUrl(start, count2 = 10) {
4903
+ const c = CONTRACTS.sentInvitations;
4904
+ if (c === void 0) throw new Error("the 'sentInvitations' contract is missing");
4905
+ return `${c.path}?count=${count2}&invitationType=CONNECTION&q=invitationType&start=${start}`;
4906
+ }
4907
+ function parseSentInvitations(json) {
4908
+ const data = json?.data;
4909
+ const refs = data?.["*elements"] ?? data?.elements;
4910
+ if (!Array.isArray(refs))
4911
+ return { ok: false, code: "SCHEMA_DRIFT", message: "the sent invitations list was missing" };
4912
+ const included = json.included ?? [];
4913
+ const byUrn = new Map(included.map((n) => [n.entityUrn, n]));
4914
+ const invitations2 = [];
4915
+ for (const ref of refs) {
4916
+ const view = byUrn.get(ref);
4917
+ const inv = byUrn.get(view?.["*invitation"]) ?? included.find(
4918
+ (n) => String(n.$type).endsWith(".Invitation") && typeof ref === "string" && ref.endsWith(String(n.entityUrn))
4919
+ );
4920
+ if (inv === void 0) continue;
4921
+ const who = byUrn.get(inv["*toMember"]);
4922
+ const name = [who?.firstName, who?.lastName].filter((x) => typeof x === "string" && x !== "").join(" ");
4923
+ const id = String(inv["*toMember"] ?? "").split(":").pop();
4924
+ const note = typeof inv.message === "string" ? inv.message : inv.message?.text;
4925
+ const out = { to: name !== "" ? name : "LinkedIn Member" };
4926
+ if (id) out.id = id;
4927
+ if (typeof who?.occupation === "string") out.headline = who.occupation;
4928
+ if (typeof who?.publicIdentifier === "string")
4929
+ out.url = `https://www.linkedin.com/in/${who.publicIdentifier}/`;
4930
+ if (typeof inv.sentTime === "number") out.sent = new Date(inv.sentTime).toISOString();
4931
+ if (typeof note === "string" && note.trim() !== "") out.note = note.trim();
4932
+ invitations2.push(out);
4933
+ }
4934
+ if (refs.length > 0 && invitations2.length === 0)
4935
+ return {
4936
+ ok: false,
4937
+ code: "SCHEMA_DRIFT",
4938
+ message: `${refs.length} invitations were listed but none were sent`
4939
+ };
4940
+ return { ok: true, invitations: invitations2 };
4941
+ }
4942
+
4943
+ // src/commands/network.ts
4944
+ function liveFetch3(quiet) {
4945
+ const session = loadSession();
4946
+ if (session.state !== "ok")
4947
+ return err("network", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
4948
+ const client = createLiveClient(session.session, void 0, quiet);
4949
+ return async (url, spendClass) => {
4950
+ const r = await client.request({ url, spendClass, operation: "network" });
4951
+ return r.ok ? { ok: true, json: r.json } : r;
4952
+ };
4953
+ }
4954
+ var LISTS = [...Object.keys(HUB), "invitations"];
4955
+ var PAGING3 = { pageSize: HUB_PAGE, max: 1e3 };
4956
+ var INVITATIONS_PAGE = 10;
4957
+ function compactRow(r) {
4958
+ const p = r;
4959
+ return line([p.id, p.name, p.headline ?? p.subtitle, p.location ?? p.detail, p.degree, p.url]);
4960
+ }
4961
+ async function counts(get) {
4962
+ const out = {};
4963
+ for (const list2 of Object.keys(HUB)) {
4964
+ const res2 = await get(hubUrl(list2, 0), "page");
4965
+ const page = res2.ok ? parseHub(list2, res2.json) : res2;
4966
+ if (!page.ok) return err("network", page.code, `${list2}: ${page.message}`, page.hint);
4967
+ out[list2] = page.total ?? page.items.length;
4968
+ }
4969
+ const res = await get(sentInvitationsUrl(0, INVITATIONS_PAGE), "page");
4970
+ const inv = res.ok ? parseSentInvitations(res.json) : res;
4971
+ if (!inv.ok) return err("network", inv.code, `invitations: ${inv.message}`);
4972
+ out.invitationsSent = inv.invitations.length;
4973
+ return { counts: out };
4974
+ }
4975
+ async function invitations(get, req, opts) {
4976
+ const all = [];
4977
+ let exhausted = false;
4978
+ let stoppedBy;
4979
+ for (let start = req.start ?? 0; all.length < req.limit; start += INVITATIONS_PAGE) {
4980
+ const res = await get(sentInvitationsUrl(start, INVITATIONS_PAGE), "page");
4981
+ const page = res.ok ? parseSentInvitations(res.json) : res;
4982
+ if (!page.ok) {
4983
+ if (all.length === 0) return err("network", page.code, page.message);
4984
+ stoppedBy = page.code;
4985
+ break;
4986
+ }
4987
+ all.push(...page.invitations.slice(0, req.limit - all.length));
4988
+ if (page.invitations.length < INVITATIONS_PAGE) {
4989
+ exhausted = true;
4990
+ break;
4991
+ }
4992
+ }
4993
+ return ok("network", {
4994
+ list: "invitations",
4995
+ items: shape2(
4996
+ all,
4997
+ opts,
4998
+ (i) => line([i.id, i.to, i.headline, i.sent?.slice(0, 10), i.note, i.url])
4999
+ ),
5000
+ meta: {
5001
+ state: exhausted && stoppedBy === void 0 ? "complete" : "partial",
5002
+ operation: "network invitations",
5003
+ returnedCount: all.length,
5004
+ ...stoppedBy !== void 0 ? { stoppedBy } : {}
5005
+ }
5006
+ });
5007
+ }
5008
+ async function runNetwork(list2, req, opts = {}, fetch2) {
5009
+ if (list2 !== void 0 && !LISTS.includes(list2)) {
5010
+ return err(
5011
+ "network",
5012
+ "INVALID_INPUT",
5013
+ `no list '${list2}'`,
5014
+ `one of: ${LISTS.join(", ")} \u2014 or none, for the counts`
5015
+ );
5016
+ }
5017
+ const get = fetch2 ?? liveFetch3(opts.quiet === true);
5018
+ if (typeof get !== "function") return get;
5019
+ if (list2 === void 0) {
5020
+ const c = await counts(get);
5021
+ if (!("counts" in c)) return c;
5022
+ return ok("network", { counts: c.counts, meta: { state: "complete", operation: "network" } });
5023
+ }
5024
+ if (list2 === "invitations") return invitations(get, req, opts);
5025
+ const hub = list2;
5026
+ const first = Math.max(0, req.start ?? 0);
5027
+ const fetchPage = async (_keywords, start) => {
5028
+ const res = await get(hubUrl(hub, start), "page");
5029
+ const page = res.ok ? parseHub(hub, res.json) : res;
5030
+ if (!page.ok) return page;
5031
+ return {
5032
+ ok: true,
5033
+ items: page.items,
5034
+ ...page.total !== void 0 ? { total: page.total } : {},
5035
+ unknownTypes: page.unknownTypes
5036
+ };
5037
+ };
5038
+ const merged = await searchAll(
5039
+ fetchPage,
5040
+ [void 0],
5041
+ first,
5042
+ Math.max(1, Math.min(req.limit, PAGING3.max - first)),
5043
+ PAGING3
5044
+ );
5045
+ if (merged.rows.length === 0 && merged.failure !== void 0) {
5046
+ const f = merged.failure;
5047
+ return err("network", f.code, f.message, f.hint);
5048
+ }
5049
+ return ok("network", {
5050
+ list: hub,
5051
+ items: shape2(merged.rows, opts, compactRow),
5052
+ meta: metaOf(`network ${hub}`, merged, true, first)
5053
+ });
5054
+ }
5055
+
4767
5056
  // src/commands/oauth.ts
4768
5057
  import { spawn } from "child_process";
4769
5058
  import { createServer } from "http";
@@ -5458,7 +5747,7 @@ function parsePosts(stream) {
5458
5747
  }
5459
5748
 
5460
5749
  // src/commands/posts-search.ts
5461
- function liveFetch3(quiet) {
5750
+ function liveFetch4(quiet) {
5462
5751
  const session = loadSession();
5463
5752
  if (session.state !== "ok")
5464
5753
  return err("search posts", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
@@ -5474,7 +5763,7 @@ function liveFetch3(quiet) {
5474
5763
  return { ok: true, raw: r.classification.raw ?? "", json: r.json };
5475
5764
  };
5476
5765
  }
5477
- var PAGING3 = { pageSize: POSTS_PAGE, max: 1e3 };
5766
+ var PAGING4 = { pageSize: POSTS_PAGE, max: 1e3 };
5478
5767
  var CHOICES = {
5479
5768
  sort: { param: "sortBy", values: { recent: "date_posted", relevant: "relevance" } },
5480
5769
  posted: {
@@ -5585,7 +5874,7 @@ async function filtersOf(req, get) {
5585
5874
  return { filters, resolved };
5586
5875
  }
5587
5876
  function compactPost(p) {
5588
- const counts = [
5877
+ const counts2 = [
5589
5878
  p.reactions !== void 0 ? `${p.reactions} reactions` : void 0,
5590
5879
  p.comments !== void 0 ? `${p.comments} comments` : void 0,
5591
5880
  p.reposts !== void 0 ? `${p.reposts} reposts` : void 0
@@ -5595,7 +5884,7 @@ function compactPost(p) {
5595
5884
  p.id,
5596
5885
  p.author,
5597
5886
  p.posted,
5598
- counts.length > 0 ? counts.join(" \xB7 ") : void 0,
5887
+ counts2.length > 0 ? counts2.join(" \xB7 ") : void 0,
5599
5888
  text5 !== void 0 && text5.length > 160 ? `${text5.slice(0, 157)}\u2026` : text5,
5600
5889
  p.url,
5601
5890
  p.matched !== void 0 ? `matched: ${p.matched.join(" + ")}` : void 0
@@ -5614,12 +5903,12 @@ async function runPostsSearch(req, opts = {}, fetch2) {
5614
5903
  "give keywords, a filter, or both",
5615
5904
  'lnrelay search posts "<keywords>"'
5616
5905
  );
5617
- const get = fetch2 ?? liveFetch3(opts.quiet === true);
5906
+ const get = fetch2 ?? liveFetch4(opts.quiet === true);
5618
5907
  if (typeof get !== "function") return get;
5619
5908
  const f = await filtersOf(req, get);
5620
5909
  if ("ok" in f) return err(command, f.code, f.message, f.hint);
5621
5910
  const first = Math.max(0, req.start ?? 0);
5622
- const want = Math.max(1, Math.min(req.limit, PAGING3.max - first));
5911
+ const want = Math.max(1, Math.min(req.limit, PAGING4.max - first));
5623
5912
  const fetchPage = async (keywords, start) => {
5624
5913
  const body = postsPagerBody({ ...keywords ? { keywords } : {}, filters: f.filters, start });
5625
5914
  const res = await get(POSTS_URL, body, "search");
@@ -5640,7 +5929,7 @@ async function runPostsSearch(req, opts = {}, fetch2) {
5640
5929
  sets.length > 0 ? sets : [void 0],
5641
5930
  first,
5642
5931
  want,
5643
- PAGING3
5932
+ PAGING4
5644
5933
  );
5645
5934
  if (merged.rows.length === 0 && merged.failure !== void 0) {
5646
5935
  const fail2 = merged.failure;
@@ -5845,6 +6134,15 @@ var COMMANDS = [
5845
6134
  risk: "read",
5846
6135
  implemented: true
5847
6136
  },
6137
+ {
6138
+ name: "network",
6139
+ cost: "1 page call per 50 rows; the counts are 7 calls",
6140
+ summary: "Your My Network: connections, people you follow, followers, pages, events, groups, and invitations you sent. With no list, the count of each. Read only.",
6141
+ usage: "lnrelay network [connections|following|followers|pages|events|groups|invitations]\n [--limit N] [--start N] [--compact | --fields a,b,c]",
6142
+ audience: ["cli", "mcp"],
6143
+ risk: "read",
6144
+ implemented: true
6145
+ },
5848
6146
  {
5849
6147
  name: "inbox",
5850
6148
  cost: "1 page call per 20 conversations",
@@ -6063,7 +6361,7 @@ var PROFILE_FIELDS = {
6063
6361
  maxLength: 2600
6064
6362
  }
6065
6363
  };
6066
- var drift5 = (message) => ({
6364
+ var drift6 = (message) => ({
6067
6365
  ok: false,
6068
6366
  code: "SCHEMA_DRIFT",
6069
6367
  message,
@@ -6071,10 +6369,10 @@ var drift5 = (message) => ({
6071
6369
  });
6072
6370
  function readForm(stream, field) {
6073
6371
  const states2 = readModel(stream);
6074
- if (states2 === null) return drift5("the profile form carried no initial values");
6372
+ if (states2 === null) return drift6("the profile form carried no initial values");
6075
6373
  const args = findRequest(stream, field.save);
6076
6374
  if (args === null)
6077
- return drift5(`the profile form carried no ${field.save.split(".").pop()} action`);
6375
+ return drift6(`the profile form carried no ${field.save.split(".").pop()} action`);
6078
6376
  return { ok: true, args, states: states2, screen: field.screen, save: field.save };
6079
6377
  }
6080
6378
  function boundKey(form, property) {
@@ -6090,7 +6388,7 @@ function topSkills(form) {
6090
6388
  return (key) => {
6091
6389
  if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
6092
6390
  const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
6093
- if (initial === void 0) return drift5("the About form carried no initial top skills");
6391
+ if (initial === void 0) return drift6("the About form carried no initial top skills");
6094
6392
  if (!Array.isArray(initial.value) || initial.value.length > 0) {
6095
6393
  return {
6096
6394
  ok: false,
@@ -6113,7 +6411,7 @@ function saveBody(form, field, value) {
6113
6411
  const target = boundKey(form, field.binding);
6114
6412
  const current = target === void 0 ? void 0 : form.states.get(target);
6115
6413
  if (target === void 0 || current === void 0) {
6116
- return drift5(`the profile form has no ${field.name} field`);
6414
+ return drift6(`the profile form has no ${field.name} field`);
6117
6415
  }
6118
6416
  const model = new Map(form.states);
6119
6417
  model.set(target, { ...current, value });
@@ -6182,7 +6480,7 @@ var POSITION = {
6182
6480
  var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
6183
6481
  function listPositions(stream) {
6184
6482
  if (readModel(stream) === null && !stream.includes(EDIT_NAV) && !stream.includes('"rows"')) {
6185
- return drift5("the Experience screen could not be read");
6483
+ return drift6("the Experience screen could not be read");
6186
6484
  }
6187
6485
  const positions = [];
6188
6486
  const seen = /* @__PURE__ */ new Set();
@@ -6200,17 +6498,17 @@ function listPositions(stream) {
6200
6498
  positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
6201
6499
  }
6202
6500
  if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
6203
- return drift5("the Experience screen listed no roles and did not look like one");
6501
+ return drift6("the Experience screen listed no roles and did not look like one");
6204
6502
  }
6205
6503
  return { ok: true, positions };
6206
6504
  }
6207
6505
  function readPositionForm(stream) {
6208
6506
  const model = readModel(stream);
6209
- if (model === null) return drift5("the position form carried no initial values");
6507
+ if (model === null) return drift6("the position form carried no initial values");
6210
6508
  const media = findRequest(stream, POSITION.media);
6211
6509
  const prefix = media?.payload.formIdPrefix;
6212
6510
  if (media === null || typeof prefix !== "string") {
6213
- return drift5("the position form carried no save step (uploadPositionMedia)");
6511
+ return drift6("the position form carried no save step (uploadPositionMedia)");
6214
6512
  }
6215
6513
  const del = findRequest(stream, POSITION.delete);
6216
6514
  return {
@@ -6261,7 +6559,7 @@ function applyChanges(form, changes) {
6261
6559
  }
6262
6560
  need("dynamicallyCreateHeadline", false);
6263
6561
  need("allowProfileEditBroadcasts", changes.notify === true);
6264
- if (missing.length > 0) return drift5(`the position form has no ${missing.join(", ")} field`);
6562
+ if (missing.length > 0) return drift6(`the position form has no ${missing.join(", ")} field`);
6265
6563
  const s = roleSummary(model);
6266
6564
  if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
6267
6565
  return {
@@ -6306,7 +6604,7 @@ function mediaBody(form, model) {
6306
6604
  }
6307
6605
  function saveFromReply(reply) {
6308
6606
  const args = findRequest(reply, POSITION.save);
6309
- return args === null ? drift5("the media step did not hand back the save action") : { ok: true, args };
6607
+ return args === null ? drift6("the media step did not hand back the save action") : { ok: true, args };
6310
6608
  }
6311
6609
  function positionSaveBody(save, model, screen) {
6312
6610
  const sending = new Map(model);
@@ -6318,7 +6616,7 @@ function positionSaveBody(save, model, screen) {
6318
6616
  }
6319
6617
  function deleteBody(form) {
6320
6618
  if (form.del === null)
6321
- return drift5("this form has no delete action (it is not an existing role)");
6619
+ return drift6("this form has no delete action (it is not an existing role)");
6322
6620
  const states2 = wireStates(keysOf(form.del), form.model, resolver);
6323
6621
  if (!Array.isArray(states2)) return states2;
6324
6622
  return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
@@ -7701,93 +7999,8 @@ async function runExperience(quiet = false) {
7701
7999
  });
7702
8000
  }
7703
8001
 
7704
- // src/engine/search.ts
7705
- var SEARCH_KINDS = {
7706
- companies: "COMPANIES",
7707
- groups: "GROUPS",
7708
- events: "EVENTS",
7709
- courses: "LEARNING",
7710
- products: "PRODUCTS",
7711
- services: "SERVICES",
7712
- schools: "SCHOOLS"
7713
- };
7714
- var SEARCH_PAGE = PEOPLE_PAGE;
7715
- function searchUrl(q2) {
7716
- return peopleSearchUrl({
7717
- ...q2.keywords !== void 0 ? { keywords: q2.keywords } : {},
7718
- params: q2.params,
7719
- start: q2.start,
7720
- ...q2.withFilters === true ? { withFilters: true } : {},
7721
- kind: SEARCH_KINDS[q2.kind]
7722
- });
7723
- }
7724
- var text4 = (v) => {
7725
- const t = v?.text;
7726
- return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
7727
- };
7728
- function idOf(entityUrn) {
7729
- const inner = String(entityUrn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
7730
- return inner?.split(":").pop();
7731
- }
7732
- function cleanUrl2(nav) {
7733
- if (typeof nav !== "string" || !nav.startsWith("https://")) return void 0;
7734
- return nav.split("?")[0];
7735
- }
7736
- function rowToFound(row) {
7737
- const id = idOf(row.entityUrn);
7738
- const name = text4(row.title);
7739
- if (id === void 0 || name === void 0) return void 0;
7740
- const found = { id, name };
7741
- const fields = [
7742
- ["subtitle", text4(row.primarySubtitle)],
7743
- ["detail", text4(row.secondarySubtitle)],
7744
- ["summary", text4(row.summary)],
7745
- ["url", cleanUrl2(row.navigationUrl)]
7746
- ];
7747
- for (const [k, v] of fields)
7748
- if (v !== void 0) found[k] = v;
7749
- if (JSON.stringify(row.badgeIcon ?? null).includes("VERIFIED")) found.verified = true;
7750
- return found;
7751
- }
7752
- var drift6 = (message) => ({
7753
- ok: false,
7754
- code: "SCHEMA_DRIFT",
7755
- message,
7756
- hint: "the search response changed shape; re-capture it"
7757
- });
7758
- function parseResults(json) {
7759
- const c = clustersOf(json);
7760
- if (c === void 0 || !Array.isArray(c.elements))
7761
- return drift6("the search returned no result list");
7762
- const included = json.included ?? [];
7763
- const { people: items, unknownTypes, excluded, unresolved } = readItems(c, included, rowToFound);
7764
- const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
7765
- const start = typeof c.paging?.start === "number" ? c.paging.start : 0;
7766
- const claimedRaw = c.metadata?.totalResultCount;
7767
- const claimed = typeof claimedRaw === "number" ? claimedRaw : total;
7768
- if (unresolved > 0 && items.length === 0)
7769
- return drift6(`${unresolved} results were listed but none could be read`);
7770
- if (items.length === 0 && total !== void 0 && total > start) {
7771
- return {
7772
- ok: false,
7773
- code: "SCHEMA_DRIFT",
7774
- message: `LinkedIn claims ${total} results but returned none from ${start}`,
7775
- hint: 'a failed fetch, not an empty search; do not report "none"'
7776
- };
7777
- }
7778
- return {
7779
- ok: true,
7780
- items,
7781
- ...total !== void 0 ? { total } : {},
7782
- ...claimed !== void 0 ? { claimed } : {},
7783
- start,
7784
- excluded,
7785
- unknownTypes
7786
- };
7787
- }
7788
-
7789
8002
  // src/commands/search-kinds.ts
7790
- var PAGING4 = { pageSize: SEARCH_PAGE, max: 1e3 };
8003
+ var PAGING5 = { pageSize: SEARCH_PAGE, max: 1e3 };
7791
8004
  var FLAGS = {
7792
8005
  location: { companies: "companyHqGeo", services: "geoUrn" },
7793
8006
  industry: { companies: "industryCompanyVertical" },
@@ -7876,7 +8089,7 @@ async function runFind(kind, req, opts = {}, fetch2) {
7876
8089
  const p = await paramsOf(kind, req, get);
7877
8090
  if ("ok" in p) return err(command, p.code, p.message, p.hint);
7878
8091
  const first = Math.max(0, req.start ?? 0);
7879
- const want = Math.max(1, Math.min(req.limit, PAGING4.max - first));
8092
+ const want = Math.max(1, Math.min(req.limit, PAGING5.max - first));
7880
8093
  const fetchPage = async (keywords, start) => {
7881
8094
  const res = await get(
7882
8095
  searchUrl({ kind, ...keywords ? { keywords } : {}, params: p.params, start }),
@@ -7897,7 +8110,7 @@ async function runFind(kind, req, opts = {}, fetch2) {
7897
8110
  sets.length > 0 ? sets : [void 0],
7898
8111
  first,
7899
8112
  want,
7900
- PAGING4
8113
+ PAGING5
7901
8114
  );
7902
8115
  if (merged.rows.length === 0 && merged.failure !== void 0) {
7903
8116
  const f = merged.failure;
@@ -7962,7 +8175,7 @@ var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":
7962
8175
  var TEXT2 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
7963
8176
  function skillsFromPage(stream) {
7964
8177
  if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
7965
- return drift5("the skills page could not be read");
8178
+ return drift6("the skills page could not be read");
7966
8179
  }
7967
8180
  const skills = [];
7968
8181
  let from = 0;
@@ -8006,11 +8219,11 @@ function pagerFrom(payload, start) {
8006
8219
  }
8007
8220
  function readSkillForm(stream) {
8008
8221
  const model = readModel(stream);
8009
- if (model === null) return drift5("the skill form carried no initial values");
8222
+ if (model === null) return drift6("the skill form carried no initial values");
8010
8223
  const save = findRequest(stream, SKILL.save);
8011
8224
  const del = findRequest(stream, SKILL.delete);
8012
8225
  if (save === null && del === null)
8013
- return drift5("the skill form carried neither a save nor a delete");
8226
+ return drift6("the skill form carried neither a save nor a delete");
8014
8227
  return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
8015
8228
  }
8016
8229
  var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
@@ -8022,10 +8235,10 @@ function skillNameOf(form) {
8022
8235
  function addSkillBody(form, name) {
8023
8236
  if (name.trim() === "")
8024
8237
  return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
8025
- if (form.save === null) return drift5("this form has no save action (it is not the add form)");
8238
+ if (form.save === null) return drift6("this form has no save action (it is not the add form)");
8026
8239
  const key = nameKey(form.model);
8027
8240
  const current = key === void 0 ? void 0 : form.model.get(key);
8028
- if (key === void 0 || current === void 0) return drift5("the skill form has no name field");
8241
+ if (key === void 0 || current === void 0) return drift6("the skill form has no name field");
8029
8242
  const model = new Map(form.model);
8030
8243
  model.set(key, { ...current, value: name.trim() });
8031
8244
  const states2 = wireStates(keysOf(form.save), model, () => void 0);
@@ -8034,7 +8247,7 @@ function addSkillBody(form, name) {
8034
8247
  }
8035
8248
  function removeSkillBody(form) {
8036
8249
  if (form.del === null)
8037
- return drift5("this form has no delete action (it is not an existing skill)");
8250
+ return drift6("this form has no delete action (it is not an existing skill)");
8038
8251
  const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
8039
8252
  if (!Array.isArray(states2)) return states2;
8040
8253
  return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
@@ -8052,7 +8265,7 @@ async function fetchSkills(vanityName, client) {
8052
8265
  const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
8053
8266
  const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
8054
8267
  const text5 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
8055
- if (text5 === null) return drift5("the Skills screen carried no list request");
8268
+ if (text5 === null) return drift6("the Skills screen carried no list request");
8056
8269
  const payload = JSON.parse(text5);
8057
8270
  const count2 = typeof payload.count === "number" ? payload.count : 10;
8058
8271
  const skills = [];
@@ -8705,6 +8918,15 @@ async function dispatch(argv, now) {
8705
8918
  return runPeople(peopleRequest(args), output(args));
8706
8919
  case "people-filters":
8707
8920
  return runPeopleFilters(peopleRequest(args), output(args));
8921
+ case "network":
8922
+ return runNetwork(
8923
+ args.positionals[0],
8924
+ {
8925
+ limit: num(args, "limit") ?? 50,
8926
+ ...num(args, "start") !== void 0 ? { start: num(args, "start") } : {}
8927
+ },
8928
+ output(args)
8929
+ );
8708
8930
  case "inbox":
8709
8931
  case "messages":
8710
8932
  case "draft":