linkedin-relay-mcp 3.21.0 → 3.22.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
@@ -88,13 +88,13 @@ function loadJson(path) {
88
88
  }
89
89
  function quarantine(path, reason) {
90
90
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
91
- const target = cachePath("quarantine", stamp, path.split("/").pop() ?? "file");
91
+ const target2 = cachePath("quarantine", stamp, path.split("/").pop() ?? "file");
92
92
  try {
93
- mkdirSync(dirname(target), { recursive: true });
94
- renameSync(path, target);
93
+ mkdirSync(dirname(target2), { recursive: true });
94
+ renameSync(path, target2);
95
95
  } catch {
96
96
  }
97
- return { state: "corrupt", quarantinedTo: target, reason };
97
+ return { state: "corrupt", quarantinedTo: target2, reason };
98
98
  }
99
99
  function saveJson(path, value) {
100
100
  mkdirSync(dirname(path), { recursive: true });
@@ -394,15 +394,15 @@ function migrate(db) {
394
394
  }
395
395
  function quarantine2(path, reason, now) {
396
396
  const stamp = new Date(now).toISOString().replace(/[:.]/g, "-");
397
- const target = cachePath("quarantine", stamp, DB_FILE);
397
+ const target2 = cachePath("quarantine", stamp, DB_FILE);
398
398
  try {
399
399
  mkdirSync3(cachePath("quarantine", stamp), { recursive: true });
400
- renameSync2(path, target);
400
+ renameSync2(path, target2);
401
401
  } catch {
402
402
  }
403
403
  return new CacheCorrupt(
404
404
  `the local cache was unreadable and has been quarantined: ${reason}`,
405
- target
405
+ target2
406
406
  );
407
407
  }
408
408
  function sweepExpired(db, now = Date.now()) {
@@ -841,14 +841,14 @@ function runSourceRead(command, query, limit, opts = {}) {
841
841
  return ok(command, data);
842
842
  }
843
843
  function runPurge(scope, confirmed) {
844
- const target = scope === "all" ? "all" : "third-party";
844
+ const target2 = scope === "all" ? "all" : "third-party";
845
845
  if (!confirmed) {
846
846
  try {
847
847
  const db = openDb();
848
848
  return err(
849
849
  "purge",
850
850
  "CONFIRMATION_REQUIRED",
851
- `would delete ${target === "all" ? count(db) : count(db, "third-party")} records (${target})`,
851
+ `would delete ${target2 === "all" ? count(db) : count(db, "third-party")} records (${target2})`,
852
852
  "Re-run with --confirm. This only touches local files; it never contacts LinkedIn."
853
853
  );
854
854
  } catch (e) {
@@ -857,8 +857,8 @@ function runPurge(scope, confirmed) {
857
857
  }
858
858
  try {
859
859
  const db = openDb();
860
- const removed = purge(db, target);
861
- return ok("purge", { scope: target, removed, remaining: count(db) });
860
+ const removed = purge(db, target2);
861
+ return ok("purge", { scope: target2, removed, remaining: count(db) });
862
862
  } catch (e) {
863
863
  return corruptEnvelope("purge", e);
864
864
  }
@@ -4179,7 +4179,7 @@ async function uploadMedia(file, client) {
4179
4179
  }
4180
4180
  const ticket = parseUploadTicket(registered.json);
4181
4181
  if (!ticket.ok) return ticket;
4182
- const put = await client.request({
4182
+ const put2 = await client.request({
4183
4183
  url: ticket.uploadUrl,
4184
4184
  method: "PUT",
4185
4185
  bytes: file.bytes,
@@ -4187,11 +4187,11 @@ async function uploadMedia(file, client) {
4187
4187
  spendClass: "write",
4188
4188
  operation: "upload"
4189
4189
  });
4190
- if (!put.ok) {
4190
+ if (!put2.ok) {
4191
4191
  return {
4192
4192
  ok: false,
4193
- code: put.code,
4194
- message: `uploading ${file.filename} failed (${put.message}); nothing was posted`
4193
+ code: put2.code,
4194
+ message: `uploading ${file.filename} failed (${put2.message}); nothing was posted`
4195
4195
  };
4196
4196
  }
4197
4197
  return { ok: true, urn: ticket.urn };
@@ -4711,9 +4711,9 @@ async function runDelete(urn, now = Date.now(), deps, quiet = false) {
4711
4711
  if ("ok" in gated) return gated;
4712
4712
  const result = await deletePost(gated.confirmed, createLiveClient(session.session));
4713
4713
  if (!result.ok) return err("delete", result.code, result.message, result.hint);
4714
- const target = evictionTarget(result);
4715
- const cached = typeof post?.urn === "string" ? post.urn : target;
4716
- const evicted = evict(target === null ? null : cached, now);
4714
+ const target2 = evictionTarget(result);
4715
+ const cached = typeof post?.urn === "string" ? post.urn : target2;
4716
+ const evicted = evict(target2 === null ? null : cached, now);
4717
4717
  return ok("delete", { deleted: urn, verified: post !== void 0, evictedFromCache: evicted });
4718
4718
  }
4719
4719
 
@@ -6673,6 +6673,107 @@ function runOauthStatus() {
6673
6673
  });
6674
6674
  }
6675
6675
 
6676
+ // src/engine/contact-info.ts
6677
+ var SCREEN2 = "com.linkedin.sdui.flagshipnav.profile.ProfileContactDetailsOverlay";
6678
+ var CONTACT_INFO_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/navigation?screenId=${SCREEN2}&sduiid=${SCREEN2}`;
6679
+ function contactInfoBody(publicId, firstName, lastName) {
6680
+ return {
6681
+ clientArguments: {
6682
+ $type: "proto.sdui.actions.requests.RequestedArguments",
6683
+ requestedStateKeys: [],
6684
+ payload: {
6685
+ vanityName: publicId,
6686
+ givenName: firstName,
6687
+ familyName: lastName,
6688
+ isVanityNameResolved: true
6689
+ },
6690
+ requestMetadata: { $type: "proto.sdui.common.RequestMetadata" },
6691
+ states: [],
6692
+ screenId: SCREEN2,
6693
+ knownTemplateIds: []
6694
+ },
6695
+ isModal: true
6696
+ };
6697
+ }
6698
+ var drift7 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
6699
+ var unquote2 = (s) => JSON.parse(`"${s}"`);
6700
+ var LABEL = /\["\$","p",null,\{"className":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]\}\]/g;
6701
+ var VIEW = /"viewName":"contact-([a-z-]+)"/g;
6702
+ var LINK = /"urlValue":\{"\$case":"url","url":"((?:[^"\\]|\\.)+)"/g;
6703
+ var TEXT2 = /"children":\["((?:[^"\\$]|\\.)(?:[^"\\]|\\.)*)"\]/g;
6704
+ var TYPE = /"\(([^"()]+)\)"/g;
6705
+ function target(link) {
6706
+ const url = unquote2(link);
6707
+ const away = url.match(/\/safety\/go\/?\?url=([^&]+)/)?.[1];
6708
+ if (away !== void 0) return decodeURIComponent(away);
6709
+ return url.replace(/^(mailto|tel):/, "");
6710
+ }
6711
+ function fieldsOf(stream) {
6712
+ const start = stream.indexOf("profile-contact-info-details-view");
6713
+ const upsell = stream.indexOf('"viewName":"premium-upsell-card"', start);
6714
+ const region = stream.slice(start, upsell === -1 ? void 0 : upsell);
6715
+ const labels = [...region.matchAll(LABEL)];
6716
+ const fields = [];
6717
+ let before = 0;
6718
+ labels.forEach((m, i) => {
6719
+ const at = m.index ?? 0;
6720
+ const end = at + m[0].length;
6721
+ const seg = region.slice(end, labels[i + 1]?.index ?? region.length);
6722
+ const view = [...region.slice(before, at).matchAll(VIEW)].pop()?.[1];
6723
+ fields.push({
6724
+ label: unquote2(m[1]).trim(),
6725
+ view,
6726
+ links: [...seg.matchAll(LINK)].map((l) => target(l[1])),
6727
+ texts: [...seg.matchAll(TEXT2)].map((t) => unquote2(t[1]).trim()),
6728
+ types: [...seg.matchAll(TYPE)].map((t) => t[1])
6729
+ });
6730
+ before = end;
6731
+ });
6732
+ return fields;
6733
+ }
6734
+ var camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
6735
+ function put(contact, f) {
6736
+ const text6 = f.texts.join(", ");
6737
+ switch (f.view) {
6738
+ case "your-profile":
6739
+ return;
6740
+ // `profile` already has the profile URL.
6741
+ case "email":
6742
+ contact.email = f.links[0] ?? text6;
6743
+ return;
6744
+ case "website":
6745
+ contact.websites = [
6746
+ ...contact.websites ?? [],
6747
+ ...f.links.map((url, i) => f.types[i] ? { url, type: f.types[i] } : { url })
6748
+ ];
6749
+ return;
6750
+ case "phone":
6751
+ contact.phones = [
6752
+ ...contact.phones ?? [],
6753
+ ...f.texts.map((number, i) => f.types[i] ? { number, type: f.types[i] } : { number })
6754
+ ];
6755
+ return;
6756
+ case "twitter":
6757
+ contact.twitter = [...contact.twitter ?? [], ...f.texts];
6758
+ return;
6759
+ case void 0:
6760
+ if (/^connected since$/i.test(f.label)) contact.connectedSince = text6;
6761
+ else contact.other = { ...contact.other, [f.label]: text6 };
6762
+ return;
6763
+ default:
6764
+ contact[camel(f.view)] = text6;
6765
+ }
6766
+ }
6767
+ function parseContactInfo(stream) {
6768
+ if (!stream.includes("profile-contact-info-details-view"))
6769
+ return drift7("the contact info answer was not the contact info overlay");
6770
+ const fields = fieldsOf(stream);
6771
+ if (fields.length === 0) return drift7("the contact info overlay had no fields");
6772
+ const contact = {};
6773
+ for (const f of fields) put(contact, f);
6774
+ return { ok: true, contact };
6775
+ }
6776
+
6676
6777
  // src/engine/full-profile.ts
6677
6778
  function contract3(name) {
6678
6779
  const c = CONTRACTS[name];
@@ -6688,7 +6789,7 @@ function positionsPageUrl(profileUrn, start) {
6688
6789
  const c = contract3("profilePositions");
6689
6790
  return `${c.path}?q=viewee&profileUrn=${encodeURIComponent(profileUrn)}&decorationId=${c.decorationId}&start=${start}&count=${POSITIONS_PAGE}`;
6690
6791
  }
6691
- var drift7 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
6792
+ var drift8 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
6692
6793
  var str4 = (v) => typeof v === "string" && v.trim() !== "" && v.trim() !== "-" ? v.trim() : void 0;
6693
6794
  var idOf3 = (urn) => String(urn ?? "").match(/:(\d+)$/)?.[1];
6694
6795
  function defined7(obj) {
@@ -6801,13 +6902,13 @@ var some = (xs) => xs.length > 0 ? xs : void 0;
6801
6902
  function parseFullProfile(json) {
6802
6903
  const root = json;
6803
6904
  const listed2 = root?.data?.["*elements"];
6804
- if (!Array.isArray(listed2)) return drift7("the profile answer carried no profile list");
6905
+ if (!Array.isArray(listed2)) return drift8("the profile answer carried no profile list");
6805
6906
  if (listed2.length === 0)
6806
6907
  return { ok: false, code: "NOT_FOUND", message: "no profile has that id on LinkedIn" };
6807
6908
  const ix = new Index(root?.included ?? []);
6808
6909
  const p = ix.get(listed2[0]);
6809
6910
  const urn = typeof p?.entityUrn === "string" ? p.entityUrn : void 0;
6810
- if (p === void 0 || urn === void 0) return drift7("the profile was listed but not sent");
6911
+ if (p === void 0 || urn === void 0) return drift8("the profile was listed but not sent");
6811
6912
  const counts2 = {};
6812
6913
  const count3 = (key, shown, total) => {
6813
6914
  if (total !== void 0 && total > shown) counts2[key] = { shown, total };
@@ -6862,11 +6963,11 @@ function parseFullProfile(json) {
6862
6963
  function parsePositionsPage(json) {
6863
6964
  const root = json;
6864
6965
  const refs = root?.data?.["*elements"];
6865
- if (!Array.isArray(refs)) return drift7("the experience page carried no position groups");
6966
+ if (!Array.isArray(refs)) return drift8("the experience page carried no position groups");
6866
6967
  const ix = new Index(root?.included ?? []);
6867
6968
  const groups = refs.flatMap((r) => ix.list(r));
6868
6969
  if (refs.length > 0 && groups.length === 0)
6869
- return drift7(`${refs.length} position groups were listed but none sent`);
6970
+ return drift8(`${refs.length} position groups were listed but none sent`);
6870
6971
  const total = root?.data?.paging?.total;
6871
6972
  return {
6872
6973
  ok: true,
@@ -6882,9 +6983,15 @@ function liveFetch8(quiet) {
6882
6983
  if (session.state !== "ok")
6883
6984
  return err("profile", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
6884
6985
  const client = createLiveClient(session.session, void 0, quiet);
6885
- return async (url, spendClass) => {
6886
- const r = await client.request({ url, spendClass, operation: "profile" });
6887
- return r.ok ? { ok: true, json: r.json } : r;
6986
+ return async (url, spendClass, body) => {
6987
+ const r = await client.request({
6988
+ url,
6989
+ ...body !== void 0 ? { method: "POST", body } : {},
6990
+ spendClass,
6991
+ operation: "profile"
6992
+ });
6993
+ if (!r.ok) return r;
6994
+ return { ok: true, json: r.json, raw: r.classification.raw ?? "" };
6888
6995
  };
6889
6996
  }
6890
6997
  function memberIdOf(input) {
@@ -6920,6 +7027,17 @@ async function readRestOfExperience(get, p) {
6920
7027
  if (Object.keys(counts2).length > 0) p.counts = counts2;
6921
7028
  else delete p.counts;
6922
7029
  }
7030
+ async function readContact(get, p) {
7031
+ if (p.publicId === void 0 || p.firstName === void 0) {
7032
+ p.contactError = "NOT_FOUND: the profile has no public id or name to ask with";
7033
+ return;
7034
+ }
7035
+ const body = contactInfoBody(p.publicId, p.firstName, p.lastName ?? "");
7036
+ const res = await get(CONTACT_INFO_URL, "profile", body);
7037
+ const read = res.ok ? parseContactInfo(res.raw ?? "") : res;
7038
+ if (read.ok) p.contact = read.contact;
7039
+ else p.contactError = `${read.code}: ${read.message}`;
7040
+ }
6923
7041
  var span = (x) => x.start === void 0 && x.end === void 0 ? void 0 : `${x.start ?? "?"} \u2013 ${x.current === true ? "now" : x.end ?? "?"}`;
6924
7042
  var roleLine = (r) => line([r.title, r.company, span(r), r.employmentType, r.location]);
6925
7043
  var schoolLine = (s) => line([s.school, s.degree, s.field, span(s)]);
@@ -6951,7 +7069,7 @@ function compact(p) {
6951
7069
  }
6952
7070
  return out;
6953
7071
  }
6954
- async function runProfile(input, opts = {}, fetch2) {
7072
+ async function runProfile(input, opts = {}, fetch2, req = {}) {
6955
7073
  if (input === void 0 || input.trim() === "")
6956
7074
  return err(
6957
7075
  "profile",
@@ -6967,6 +7085,7 @@ async function runProfile(input, opts = {}, fetch2) {
6967
7085
  if (!parsed.ok) return err("profile", parsed.code, parsed.message, parsed.hint);
6968
7086
  const p = parsed.profile;
6969
7087
  await readRestOfExperience(get, p);
7088
+ if (req.contact === true) await readContact(get, p);
6970
7089
  if (opts.raw === true) return ok("profile", { ...p, raw: res.json });
6971
7090
  if (opts.fields !== void 0 && opts.fields !== "")
6972
7091
  return ok("profile", project([p], opts.fields)[0]);
@@ -7025,9 +7144,9 @@ var COMMANDS = [
7025
7144
  },
7026
7145
  {
7027
7146
  name: "profile",
7028
- cost: "1 profile read (+1 per 50 companies past the first 10)",
7029
- summary: "A profile in full: name, headline, about, every role with dates and descriptions, education, skills, honors, publications, volunteering and the other sections.",
7030
- usage: "lnrelay profile <public-id|profile-id|urn|url> [--compact | --fields a,b,c] [--raw]",
7147
+ cost: "1 profile read (+1 per 50 companies past the first 10; --contact +1)",
7148
+ summary: "A profile in full: name, headline, about, every role with dates and descriptions, education, skills, honors, publications, volunteering and the other sections. --contact adds contact info: email, websites, phone, birthday, connected since.",
7149
+ usage: "lnrelay profile <public-id|profile-id|urn|url> [--contact] [--compact | --fields a,b,c] [--raw]",
7031
7150
  audience: ["cli", "mcp"],
7032
7151
  risk: "read",
7033
7152
  implemented: true
@@ -7413,7 +7532,7 @@ var PROFILE_FIELDS = {
7413
7532
  maxLength: 2600
7414
7533
  }
7415
7534
  };
7416
- var drift8 = (message) => ({
7535
+ var drift9 = (message) => ({
7417
7536
  ok: false,
7418
7537
  code: "SCHEMA_DRIFT",
7419
7538
  message,
@@ -7421,10 +7540,10 @@ var drift8 = (message) => ({
7421
7540
  });
7422
7541
  function readForm(stream, field) {
7423
7542
  const states2 = readModel(stream);
7424
- if (states2 === null) return drift8("the profile form carried no initial values");
7543
+ if (states2 === null) return drift9("the profile form carried no initial values");
7425
7544
  const args = findRequest(stream, field.save);
7426
7545
  if (args === null)
7427
- return drift8(`the profile form carried no ${field.save.split(".").pop()} action`);
7546
+ return drift9(`the profile form carried no ${field.save.split(".").pop()} action`);
7428
7547
  return { ok: true, args, states: states2, screen: field.screen, save: field.save };
7429
7548
  }
7430
7549
  function boundKey(form, property) {
@@ -7440,7 +7559,7 @@ function topSkills(form) {
7440
7559
  return (key) => {
7441
7560
  if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
7442
7561
  const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
7443
- if (initial === void 0) return drift8("the About form carried no initial top skills");
7562
+ if (initial === void 0) return drift9("the About form carried no initial top skills");
7444
7563
  if (!Array.isArray(initial.value) || initial.value.length > 0) {
7445
7564
  return {
7446
7565
  ok: false,
@@ -7460,13 +7579,13 @@ function saveBody(form, field, value) {
7460
7579
  message: `the ${field.name} is ${value.length} characters; LinkedIn allows ${field.maxLength}`
7461
7580
  };
7462
7581
  }
7463
- const target = boundKey(form, field.binding);
7464
- const current = target === void 0 ? void 0 : form.states.get(target);
7465
- if (target === void 0 || current === void 0) {
7466
- return drift8(`the profile form has no ${field.name} field`);
7582
+ const target2 = boundKey(form, field.binding);
7583
+ const current = target2 === void 0 ? void 0 : form.states.get(target2);
7584
+ if (target2 === void 0 || current === void 0) {
7585
+ return drift9(`the profile form has no ${field.name} field`);
7467
7586
  }
7468
7587
  const model = new Map(form.states);
7469
- model.set(target, { ...current, value });
7588
+ model.set(target2, { ...current, value });
7470
7589
  const states2 = wireStates(keysOf(form.args), model, topSkills(form));
7471
7590
  if (!Array.isArray(states2)) return states2;
7472
7591
  return { ok: true, body: requestBody(form.save, form.args, states2, form.screen) };
@@ -7532,7 +7651,7 @@ var POSITION = {
7532
7651
  var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
7533
7652
  function listPositions(stream) {
7534
7653
  if (readModel(stream) === null && !stream.includes(EDIT_NAV) && !stream.includes('"rows"')) {
7535
- return drift8("the Experience screen could not be read");
7654
+ return drift9("the Experience screen could not be read");
7536
7655
  }
7537
7656
  const positions = [];
7538
7657
  const seen = /* @__PURE__ */ new Set();
@@ -7550,17 +7669,17 @@ function listPositions(stream) {
7550
7669
  positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
7551
7670
  }
7552
7671
  if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
7553
- return drift8("the Experience screen listed no roles and did not look like one");
7672
+ return drift9("the Experience screen listed no roles and did not look like one");
7554
7673
  }
7555
7674
  return { ok: true, positions };
7556
7675
  }
7557
7676
  function readPositionForm(stream) {
7558
7677
  const model = readModel(stream);
7559
- if (model === null) return drift8("the position form carried no initial values");
7678
+ if (model === null) return drift9("the position form carried no initial values");
7560
7679
  const media = findRequest(stream, POSITION.media);
7561
7680
  const prefix = media?.payload.formIdPrefix;
7562
7681
  if (media === null || typeof prefix !== "string") {
7563
- return drift8("the position form carried no save step (uploadPositionMedia)");
7682
+ return drift9("the position form carried no save step (uploadPositionMedia)");
7564
7683
  }
7565
7684
  const del = findRequest(stream, POSITION.delete);
7566
7685
  return {
@@ -7611,7 +7730,7 @@ function applyChanges(form, changes) {
7611
7730
  }
7612
7731
  need("dynamicallyCreateHeadline", false);
7613
7732
  need("allowProfileEditBroadcasts", changes.notify === true);
7614
- if (missing.length > 0) return drift8(`the position form has no ${missing.join(", ")} field`);
7733
+ if (missing.length > 0) return drift9(`the position form has no ${missing.join(", ")} field`);
7615
7734
  const s = roleSummary(model);
7616
7735
  if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
7617
7736
  return {
@@ -7656,7 +7775,7 @@ function mediaBody(form, model) {
7656
7775
  }
7657
7776
  function saveFromReply(reply) {
7658
7777
  const args = findRequest(reply, POSITION.save);
7659
- return args === null ? drift8("the media step did not hand back the save action") : { ok: true, args };
7778
+ return args === null ? drift9("the media step did not hand back the save action") : { ok: true, args };
7660
7779
  }
7661
7780
  function positionSaveBody(save, model, screen) {
7662
7781
  const sending = new Map(model);
@@ -7668,7 +7787,7 @@ function positionSaveBody(save, model, screen) {
7668
7787
  }
7669
7788
  function deleteBody(form) {
7670
7789
  if (form.del === null)
7671
- return drift8("this form has no delete action (it is not an existing role)");
7790
+ return drift9("this form has no delete action (it is not an existing role)");
7672
7791
  const states2 = wireStates(keysOf(form.del), form.model, resolver);
7673
7792
  if (!Array.isArray(states2)) return states2;
7674
7793
  return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
@@ -7984,16 +8103,16 @@ function targetFor(urn) {
7984
8103
  `'${urn}' does not identify a post or a comment \u2014 expected urn:li:activity:<id> or urn:li:comment:(urn:li:activity:<id>,<id>)`
7985
8104
  );
7986
8105
  }
7987
- function reactionPayload(target, reaction) {
8106
+ function reactionPayload(target2, reaction) {
7988
8107
  return {
7989
- threadUrn: target.threadUrn,
8108
+ threadUrn: target2.threadUrn,
7990
8109
  reactionType: `ReactionType_${reaction}`,
7991
- reactionSource: target.reactionSource
8110
+ reactionSource: target2.reactionSource
7992
8111
  };
7993
8112
  }
7994
- function sduiBody(op, target, reaction) {
8113
+ function sduiBody(op, target2, reaction) {
7995
8114
  const requestId = `com.linkedin.sdui.reactions.${op}`;
7996
- const payload = reactionPayload(target, reaction);
8115
+ const payload = reactionPayload(target2, reaction);
7997
8116
  const args = {
7998
8117
  $type: "proto.sdui.actions.requests.RequestedArguments",
7999
8118
  requestedStateKeys: [],
@@ -8020,9 +8139,9 @@ function sduiBody(op, target, reaction) {
8020
8139
  }
8021
8140
  async function react(confirmed, client) {
8022
8141
  const { urn, type, remove } = confirmed.payload;
8023
- let target;
8142
+ let target2;
8024
8143
  try {
8025
- target = targetFor(urn);
8144
+ target2 = targetFor(urn);
8026
8145
  } catch (e) {
8027
8146
  return { ok: false, code: "INVALID_INPUT", message: e.message };
8028
8147
  }
@@ -8030,7 +8149,7 @@ async function react(confirmed, client) {
8030
8149
  const result = await client.request({
8031
8150
  url: reactionUrl(op),
8032
8151
  method: "POST",
8033
- body: sduiBody(op, target, type),
8152
+ body: sduiBody(op, target2, type),
8034
8153
  spendClass: "write",
8035
8154
  operation: `reaction.${op}`
8036
8155
  });
@@ -8885,7 +9004,7 @@ var SAFETY = (notify) => [
8885
9004
  "headline unchanged (LinkedIn would otherwise rewrite it from this role)",
8886
9005
  `notify ${notify ? "ON \u2014 your network may be told" : "off"}`
8887
9006
  ];
8888
- async function runRole(sub, target, req, now = Date.now(), deps = terminalDeps(), surface) {
9007
+ async function runRole(sub, target2, req, now = Date.now(), deps = terminalDeps(), surface) {
8889
9008
  if (sub !== "add" && sub !== "edit" && sub !== "remove") {
8890
9009
  return err(
8891
9010
  "role",
@@ -8905,7 +9024,7 @@ async function runRole(sub, target, req, now = Date.now(), deps = terminalDeps()
8905
9024
  `a new role needs ${missing.map((f) => `--${f}`).join(", ")}`
8906
9025
  );
8907
9026
  }
8908
- } else if (target === void 0 || !/^\d+$/.test(target)) {
9027
+ } else if (target2 === void 0 || !/^\d+$/.test(target2)) {
8909
9028
  return err(
8910
9029
  "role",
8911
9030
  "INVALID_INPUT",
@@ -8936,12 +9055,12 @@ async function runRole(sub, target, req, now = Date.now(), deps = terminalDeps()
8936
9055
  const listed2 = await roles.list(me.vanity);
8937
9056
  if (!listed2.ok) return err("role", listed2.code, listed2.message, listed2.hint);
8938
9057
  if (sub === "add") return addRole(changes, me.vanity, listed2.positions, roles, ctx, deps);
8939
- const position = listed2.positions.find((p) => p.positionId === target);
9058
+ const position = listed2.positions.find((p) => p.positionId === target2);
8940
9059
  if (position === void 0) {
8941
9060
  return err(
8942
9061
  "role",
8943
9062
  "NOT_FOUND",
8944
- `no role ${target} on your profile`,
9063
+ `no role ${target2} on your profile`,
8945
9064
  `your roles: ${listed2.positions.map((p) => `${p.positionId} (${p.title})`).join(", ") || "none"}`
8946
9065
  );
8947
9066
  }
@@ -9224,10 +9343,10 @@ var SKILL = {
9224
9343
  delete: "com.linkedin.sdui.requests.profile.deleteProfileSkillForm"
9225
9344
  };
9226
9345
  var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${SKILL.editScreen}"`;
9227
- var TEXT2 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
9346
+ var TEXT3 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
9228
9347
  function skillsFromPage(stream) {
9229
9348
  if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
9230
- return drift8("the skills page could not be read");
9349
+ return drift9("the skills page could not be read");
9231
9350
  }
9232
9351
  const skills = [];
9233
9352
  let from = 0;
@@ -9243,7 +9362,7 @@ function skillsFromPage(stream) {
9243
9362
  const id = payload?.skillId;
9244
9363
  if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
9245
9364
  continue;
9246
- const names = [...stream.slice(from, end).matchAll(TEXT2)].map(
9365
+ const names = [...stream.slice(from, end).matchAll(TEXT3)].map(
9247
9366
  (m) => JSON.parse(`"${m[1]}"`)
9248
9367
  );
9249
9368
  skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
@@ -9271,11 +9390,11 @@ function pagerFrom(payload, start) {
9271
9390
  }
9272
9391
  function readSkillForm(stream) {
9273
9392
  const model = readModel(stream);
9274
- if (model === null) return drift8("the skill form carried no initial values");
9393
+ if (model === null) return drift9("the skill form carried no initial values");
9275
9394
  const save = findRequest(stream, SKILL.save);
9276
9395
  const del = findRequest(stream, SKILL.delete);
9277
9396
  if (save === null && del === null)
9278
- return drift8("the skill form carried neither a save nor a delete");
9397
+ return drift9("the skill form carried neither a save nor a delete");
9279
9398
  return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
9280
9399
  }
9281
9400
  var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
@@ -9287,10 +9406,10 @@ function skillNameOf(form) {
9287
9406
  function addSkillBody(form, name) {
9288
9407
  if (name.trim() === "")
9289
9408
  return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
9290
- if (form.save === null) return drift8("this form has no save action (it is not the add form)");
9409
+ if (form.save === null) return drift9("this form has no save action (it is not the add form)");
9291
9410
  const key = nameKey(form.model);
9292
9411
  const current = key === void 0 ? void 0 : form.model.get(key);
9293
- if (key === void 0 || current === void 0) return drift8("the skill form has no name field");
9412
+ if (key === void 0 || current === void 0) return drift9("the skill form has no name field");
9294
9413
  const model = new Map(form.model);
9295
9414
  model.set(key, { ...current, value: name.trim() });
9296
9415
  const states2 = wireStates(keysOf(form.save), model, () => void 0);
@@ -9299,7 +9418,7 @@ function addSkillBody(form, name) {
9299
9418
  }
9300
9419
  function removeSkillBody(form) {
9301
9420
  if (form.del === null)
9302
- return drift8("this form has no delete action (it is not an existing skill)");
9421
+ return drift9("this form has no delete action (it is not an existing skill)");
9303
9422
  const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
9304
9423
  if (!Array.isArray(states2)) return states2;
9305
9424
  return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
@@ -9317,7 +9436,7 @@ async function fetchSkills(vanityName, client) {
9317
9436
  const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
9318
9437
  const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
9319
9438
  const text6 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
9320
- if (text6 === null) return drift8("the Skills screen carried no list request");
9439
+ if (text6 === null) return drift9("the Skills screen carried no list request");
9321
9440
  const payload = JSON.parse(text6);
9322
9441
  const count3 = typeof payload.count === "number" ? payload.count : 10;
9323
9442
  const skills = [];
@@ -9442,23 +9561,23 @@ async function addSkill(name, current, vanity, skills, ctx, deps) {
9442
9561
  return ok("skill", { added: added.skillId, name: added.name, verified: true });
9443
9562
  }
9444
9563
  async function removeSkill(arg, current, vanity, skills, ctx, deps) {
9445
- const target = current.find((s) => s.skillId === arg);
9446
- if (target === void 0)
9564
+ const target2 = current.find((s) => s.skillId === arg);
9565
+ if (target2 === void 0)
9447
9566
  return err(
9448
9567
  "skill",
9449
9568
  "NOT_FOUND",
9450
9569
  `no skill ${arg} on your profile`,
9451
9570
  `your skills: ${listed(current)}`
9452
9571
  );
9453
- const form = await skills.open({ ...target.payload, vanityName: vanity }, true);
9572
+ const form = await skills.open({ ...target2.payload, vanityName: vanity }, true);
9454
9573
  if (!form.ok) return err("skill", form.code, form.message, form.hint);
9455
9574
  const body = removeSkillBody(form);
9456
9575
  if (!body.ok) return err("skill", body.code, body.message, body.hint);
9457
- const name = skillNameOf(form) ?? target.name ?? "?";
9576
+ const name = skillNameOf(form) ?? target2.name ?? "?";
9458
9577
  const plan = {
9459
9578
  action: "remove a skill from your profile",
9460
- payload: { skillId: target.skillId, name },
9461
- summary: [authorLine(ctx.transport), `skill "${name}" (${target.skillId})`],
9579
+ payload: { skillId: target2.skillId, name },
9580
+ summary: [authorLine(ctx.transport), `skill "${name}" (${target2.skillId})`],
9462
9581
  reversibility: "NONE for its endorsements, which go with it; the skill itself can be added again",
9463
9582
  transport: "voyager"
9464
9583
  };
@@ -9467,14 +9586,14 @@ async function removeSkill(arg, current, vanity, skills, ctx, deps) {
9467
9586
  const sent = await skills.send(body.body, SKILL.delete);
9468
9587
  if (!sent.ok) return err("skill", sent.code, sent.message, sent.hint);
9469
9588
  const after = await skills.list(vanity);
9470
- if (!after.ok || after.skills.some((s) => s.skillId === target.skillId)) {
9589
+ if (!after.ok || after.skills.some((s) => s.skillId === target2.skillId)) {
9471
9590
  return err(
9472
9591
  "skill",
9473
9592
  "SCHEMA_DRIFT",
9474
9593
  "LinkedIn accepted the removal, but the skill is still listed"
9475
9594
  );
9476
9595
  }
9477
- return ok("skill", { removed: target.skillId, verified: true });
9596
+ return ok("skill", { removed: target2.skillId, verified: true });
9478
9597
  }
9479
9598
  async function runSkills(quiet = false) {
9480
9599
  const session = loadSession();
@@ -9982,7 +10101,9 @@ async function dispatch(argv, now) {
9982
10101
  case "whoami":
9983
10102
  return runWhoami(bool(args, "raw"));
9984
10103
  case "profile":
9985
- return runProfile(args.positionals[0], output(args));
10104
+ return runProfile(args.positionals[0], output(args), void 0, {
10105
+ contact: bool(args, "contact")
10106
+ });
9986
10107
  case "feed":
9987
10108
  return runFeed(num(args, "limit") ?? 10, output(args));
9988
10109
  case "post":
@@ -10057,10 +10178,10 @@ async function write(command, args, now) {
10057
10178
  return envelope;
10058
10179
  }
10059
10180
  function edit(args, now, deps) {
10060
- const [target, inline] = args.positionals;
10181
+ const [target2, inline] = args.positionals;
10061
10182
  if (args.flags.file === true) return err("edit", "INVALID_INPUT", "--file needs a path");
10062
10183
  const file = str(args, "file");
10063
- if (file === void 0) return runEdit(target, inline, now, deps);
10184
+ if (file === void 0) return runEdit(target2, inline, now, deps);
10064
10185
  if (inline !== void 0) {
10065
10186
  return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
10066
10187
  }
@@ -10070,10 +10191,10 @@ function edit(args, now, deps) {
10070
10191
  } catch {
10071
10192
  return err("edit", "INVALID_INPUT", `cannot read ${file}`);
10072
10193
  }
10073
- return runEdit(target, text6, now, deps);
10194
+ return runEdit(target2, text6, now, deps);
10074
10195
  }
10075
10196
  function role2(args, now, deps) {
10076
- const [sub, target] = args.positionals;
10197
+ const [sub, target2] = args.positionals;
10077
10198
  const valued = [
10078
10199
  "title",
10079
10200
  "company",
@@ -10104,7 +10225,7 @@ function role2(args, now, deps) {
10104
10225
  }
10105
10226
  if (bool(args, "current")) req.current = true;
10106
10227
  if (bool(args, "notify")) req.notify = true;
10107
- return runRole(sub, target, req, now, deps);
10228
+ return runRole(sub, target2, req, now, deps);
10108
10229
  }
10109
10230
  function runWrite(command, args, now, deps) {
10110
10231
  const [first, second] = args.positionals;