linkedin-relay-mcp 3.12.0 → 3.13.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
@@ -2028,7 +2028,7 @@ async function fetchCommentMenu(ref, trackingId, client) {
2028
2028
  const stream = result.classification.raw ?? "";
2029
2029
  return { ok: true, stream };
2030
2030
  }
2031
- function textStates(payload, text3) {
2031
+ function textStates(payload, text4) {
2032
2032
  const keyOf = (...names) => {
2033
2033
  for (const n of names) {
2034
2034
  const slot = payload[n];
@@ -2047,12 +2047,12 @@ function textStates(payload, text3) {
2047
2047
  protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
2048
2048
  });
2049
2049
  return [
2050
- entry2(plain2, text3, "stringValue"),
2051
- entry2(rich, { text: text3, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
2050
+ entry2(plain2, text4, "stringValue"),
2051
+ entry2(rich, { text: text4, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
2052
2052
  ];
2053
2053
  }
2054
- function editStates(payload, text3) {
2055
- return textStates(payload, text3);
2054
+ function editStates(payload, text4) {
2055
+ return textStates(payload, text4);
2056
2056
  }
2057
2057
  async function runCommentAction(ref, operation, trackingId, client, newText) {
2058
2058
  const menu = await fetchCommentMenu(ref, trackingId, client);
@@ -2391,12 +2391,12 @@ var CATEGORY = {
2391
2391
  VIDEO: "VIDEO",
2392
2392
  DOCUMENT: "NATIVE_DOCUMENT"
2393
2393
  };
2394
- function sharePayload(text3, visibility, media = [], scheduledAt) {
2394
+ function sharePayload(text4, visibility, media = [], scheduledAt) {
2395
2395
  const schedule = scheduledAt === void 0 ? { postState: "PUBLISHED" } : { postState: "SCHEDULED", scheduledAt };
2396
2396
  return {
2397
2397
  visibleToConnectionsOnly: visibility === "CONNECTIONS",
2398
2398
  externalAudienceProviders: [],
2399
- commentaryV2: { text: text3, attributes: [] },
2399
+ commentaryV2: { text: text4, attributes: [] },
2400
2400
  origin: "FEED",
2401
2401
  allowedCommentersScope: "ALL",
2402
2402
  ...schedule,
@@ -2510,15 +2510,15 @@ async function share(confirmed, client, bytes) {
2510
2510
  note: "LinkedIn accepted the post but the response carried no recognisable urn. Run `lnrelay sync my-posts && lnrelay my-posts` to confirm what actually landed \u2014 and do NOT re-run this command on the assumption it failed, or you will post twice."
2511
2511
  } : { ok: true, id };
2512
2512
  }
2513
- function editPostBody(text3) {
2514
- return { patch: { $set: { commentaryV2: { text: text3, attributes: [] } } } };
2513
+ function editPostBody(text4) {
2514
+ return { patch: { $set: { commentaryV2: { text: text4, attributes: [] } } } };
2515
2515
  }
2516
2516
  async function editPost(confirmed, client) {
2517
- const { urn, text: text3 } = confirmed.payload;
2517
+ const { urn, text: text4 } = confirmed.payload;
2518
2518
  const result = await client.request({
2519
2519
  url: deleteUrl(urn),
2520
2520
  method: "POST",
2521
- body: editPostBody(text3),
2521
+ body: editPostBody(text4),
2522
2522
  spendClass: "write",
2523
2523
  operation: "edit-post"
2524
2524
  });
@@ -2528,7 +2528,7 @@ async function editPost(confirmed, client) {
2528
2528
  return out;
2529
2529
  }
2530
2530
  const held = result.json?.data?.commentary?.text;
2531
- if (held !== text3) {
2531
+ if (held !== text4) {
2532
2532
  return {
2533
2533
  ok: false,
2534
2534
  code: "SCHEMA_DRIFT",
@@ -2589,8 +2589,8 @@ async function createPoll(poll, client) {
2589
2589
  }
2590
2590
  return { ok: true, urn };
2591
2591
  }
2592
- function firstUrl(text3) {
2593
- const found = text3.match(/https?:\/\/[^\s<>"]+/)?.[0];
2592
+ function firstUrl(text4) {
2593
+ const found = text4.match(/https?:\/\/[^\s<>"]+/)?.[0];
2594
2594
  if (found === void 0) return null;
2595
2595
  let url = found.replace(/[.,;:!?'"]+$/, "");
2596
2596
  if (url.endsWith(")") && !url.includes("(")) url = url.slice(0, -1);
@@ -2754,8 +2754,8 @@ function previewLines2(post) {
2754
2754
  " about to delete, or that it is yours."
2755
2755
  ];
2756
2756
  }
2757
- const text3 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
2758
- const shown = text3.length > PREVIEW_CHARS ? `${text3.slice(0, PREVIEW_CHARS)}\u2026` : text3;
2757
+ const text4 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
2758
+ const shown = text4.length > PREVIEW_CHARS ? `${text4.slice(0, PREVIEW_CHARS)}\u2026` : text4;
2759
2759
  const lines = [`content "${shown.replace(/\n/g, " ")}"`];
2760
2760
  if (typeof post.scheduledAt === "string") {
2761
2761
  lines.push(`status scheduled, publishes ${post.scheduledAt} unless cancelled`);
@@ -2957,11 +2957,11 @@ var WORKPLACE_SUFFIX = {
2957
2957
  hybrid: "hybrid",
2958
2958
  "on-site": "on-site"
2959
2959
  };
2960
- function splitLocation(line) {
2961
- if (line === void 0) return {};
2962
- const m = line.match(/^(.*?)\s*\(([^()]+)\)$/);
2960
+ function splitLocation(line2) {
2961
+ if (line2 === void 0) return {};
2962
+ const m = line2.match(/^(.*?)\s*\(([^()]+)\)$/);
2963
2963
  const kind = m?.[2] === void 0 ? void 0 : WORKPLACE_SUFFIX[m[2].toLowerCase()];
2964
- return kind === void 0 || m?.[1] === void 0 ? { location: line } : { location: m[1], workplace: kind };
2964
+ return kind === void 0 || m?.[1] === void 0 ? { location: line2 } : { location: m[1], workplace: kind };
2965
2965
  }
2966
2966
  function cardToJob(card) {
2967
2967
  const urn = card.jobPostingUrn ?? card["*jobPosting"];
@@ -3261,33 +3261,7 @@ function jobFilterSelection(o) {
3261
3261
  }
3262
3262
  }
3263
3263
 
3264
- // src/commands/jobs.ts
3265
- function liveFetch(command, quiet) {
3266
- const session = loadSession();
3267
- if (session.state !== "ok")
3268
- return err(command, "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
3269
- const client = createLiveClient(session.session, void 0, quiet);
3270
- return async (url, spendClass) => {
3271
- const r = await client.request({ url, spendClass, operation: command });
3272
- return r.ok ? { ok: true, json: r.json } : r;
3273
- };
3274
- }
3275
- var MAX_RESULTS = 1e3;
3276
- function compactJob(j) {
3277
- const parts = [j.id, j.title, j.company, j.location, j.workplace, j.listed];
3278
- if (j.easyApply) parts.push("easy apply");
3279
- if (j.promoted) parts.push("promoted");
3280
- parts.push(j.salary);
3281
- if (j.apply?.url !== void 0) parts.push(`apply: ${j.apply.url}`);
3282
- if (j.matched !== void 0) parts.push(`matched: ${j.matched.join(" + ")}`);
3283
- return parts.filter((p) => p !== void 0 && p !== "").map((p) => p.replaceAll(" | ", " / ")).join(" | ");
3284
- }
3285
- function shape(rows, opts, line) {
3286
- if (opts.compact === true) return rows.map(line);
3287
- if (opts.fields !== void 0 && opts.fields !== "")
3288
- return project(rows, opts.fields);
3289
- return rows;
3290
- }
3264
+ // src/commands/paged.ts
3291
3265
  function keywordSets(keywords) {
3292
3266
  const given = keywords === void 0 ? [] : Array.isArray(keywords) ? keywords : [keywords];
3293
3267
  const out = [];
@@ -3296,92 +3270,64 @@ function keywordSets(keywords) {
3296
3270
  }
3297
3271
  return out;
3298
3272
  }
3299
- function queryOf(req, filters, keywords) {
3300
- return {
3301
- ...keywords ? { keywords } : {},
3302
- ...req.location ? { location: req.location } : {},
3303
- ...req.geoId ? { geoId: req.geoId } : {},
3304
- filters
3305
- };
3273
+ function addCounts(into, from) {
3274
+ for (const [k, n] of Object.entries(from)) into[k] = (into[k] ?? 0) + n;
3306
3275
  }
3307
- async function collect(get, query, first, want) {
3308
- const out = { jobs: [], exhausted: false, unknownTypes: {} };
3309
- for (let start = first; out.jobs.length < want && start < MAX_RESULTS; start += PAGE_SIZE2) {
3310
- const res = await get(jobSearchUrl({ ...query, start, count: PAGE_SIZE2 }), "jobSearch");
3311
- const page = res.ok ? parseJobCards(res.json) : res;
3276
+ async function collect(fetchPage, keywords, first, want, paging) {
3277
+ const out = { items: [], exhausted: false, unknownTypes: {} };
3278
+ for (let start = first; out.items.length < want && start < paging.max; start += paging.pageSize) {
3279
+ const page = await fetchPage(keywords, start);
3312
3280
  if (!page.ok) {
3313
- if (out.jobs.length === 0) return page;
3281
+ if (out.items.length === 0) return page;
3314
3282
  out.stoppedBy = page.code;
3315
3283
  break;
3316
3284
  }
3317
3285
  out.total = page.total ?? out.total;
3318
- out.resolved = page.location ?? out.resolved;
3319
- for (const [k, n] of Object.entries(page.unknownTypes))
3320
- out.unknownTypes[k] = (out.unknownTypes[k] ?? 0) + n;
3321
- const fresh = page.jobs.filter((j) => !out.jobs.some((x) => x.id === j.id));
3322
- const room = want - out.jobs.length;
3323
- out.jobs.push(...fresh.slice(0, room));
3286
+ out.claimed = page.claimed ?? out.claimed;
3287
+ out.resolved = page.resolved ?? out.resolved;
3288
+ addCounts(out.unknownTypes, page.unknownTypes);
3289
+ const fresh = page.items.filter((j) => !out.items.some((x) => x.id === j.id));
3290
+ const room = want - out.items.length;
3291
+ out.items.push(...fresh.slice(0, room));
3324
3292
  if (fresh.length > room) break;
3325
- if (page.jobs.length === 0 || out.total !== void 0 && start + PAGE_SIZE2 >= out.total) {
3293
+ if (page.items.length === 0 || out.total !== void 0 && start + paging.pageSize >= out.total) {
3326
3294
  out.exhausted = true;
3327
3295
  break;
3328
3296
  }
3329
3297
  }
3330
3298
  return out;
3331
3299
  }
3332
- async function readJobs(get, ids) {
3333
- const jobs = /* @__PURE__ */ new Map();
3334
- for (let at = 0; at < ids.length; at += BATCH_SIZE) {
3335
- const res = await get(jobBatchUrl(ids.slice(at, at + BATCH_SIZE)), "jobRead");
3336
- const batch = res.ok ? parseJobBatch(res.json) : res;
3337
- if (!batch.ok) return { jobs, stoppedBy: batch.code };
3338
- for (const job of batch.jobs) if (ids.includes(job.id)) jobs.set(job.id, job);
3339
- }
3340
- return { jobs };
3341
- }
3342
- async function addDetails(get, rows, withDescription) {
3343
- const read = await readJobs(
3344
- get,
3345
- rows.map((r) => r.id)
3346
- );
3347
- for (const row of rows) {
3348
- const detail = read.jobs.get(row.id);
3349
- if (detail === void 0) continue;
3350
- const { description, id: _id, url: _url, ...rest } = detail;
3351
- Object.assign(row, rest, withDescription ? { description } : {});
3352
- }
3353
- const unread = rows.filter((r) => !read.jobs.has(r.id)).length;
3354
- return read.stoppedBy === void 0 ? { unread } : { unread, stoppedBy: read.stoppedBy };
3355
- }
3356
3300
  function reportOf(keywords, found, first) {
3301
+ const capped = found.exhausted && found.claimed !== void 0 && found.total !== void 0 && found.claimed > found.total;
3357
3302
  const report = {
3358
3303
  ...keywords !== void 0 ? { keywords } : {},
3359
- claimedCount: found.total,
3360
- returnedCount: found.jobs.length,
3361
- state: found.stoppedBy === void 0 && found.exhausted ? "complete" : "partial"
3304
+ claimedCount: found.claimed ?? found.total,
3305
+ returnedCount: found.items.length,
3306
+ state: found.stoppedBy === void 0 && found.exhausted && !capped ? "complete" : "partial"
3362
3307
  };
3363
- if (!found.exhausted) report.next = first + found.jobs.length;
3308
+ if (!found.exhausted) report.next = first + found.items.length;
3309
+ if (capped) report.servedLimit = found.total;
3364
3310
  if (found.stoppedBy !== void 0) report.stoppedBy = found.stoppedBy;
3365
3311
  return report;
3366
3312
  }
3367
- function mergeInto(out, byId, jobs, keywords) {
3368
- for (const job of jobs) {
3369
- const seen = byId.get(job.id);
3313
+ function mergeInto(out, byId, items, keywords) {
3314
+ for (const item of items) {
3315
+ const seen = byId.get(item.id);
3370
3316
  if (seen !== void 0) {
3371
3317
  out.duplicates++;
3372
3318
  if (keywords !== void 0) seen.matched?.push(keywords);
3373
3319
  continue;
3374
3320
  }
3375
- const row = keywords !== void 0 ? { ...job, matched: [keywords] } : job;
3376
- byId.set(job.id, row);
3321
+ const row = keywords !== void 0 ? { ...item, matched: [keywords] } : item;
3322
+ byId.set(item.id, row);
3377
3323
  out.rows.push(row);
3378
3324
  }
3379
3325
  }
3380
- async function searchAll(get, sets, base, first, want) {
3326
+ async function searchAll(fetchPage, sets, first, want, paging) {
3381
3327
  const out = { rows: [], searches: [], duplicates: 0, unknownTypes: {} };
3382
3328
  const byId = /* @__PURE__ */ new Map();
3383
3329
  for (const keywords of sets) {
3384
- const found = await collect(get, { ...base, ...keywords ? { keywords } : {} }, first, want);
3330
+ const found = await collect(fetchPage, keywords, first, want, paging);
3385
3331
  if ("ok" in found) {
3386
3332
  out.failure = out.failure ?? found;
3387
3333
  out.searches.push({
@@ -3394,19 +3340,19 @@ async function searchAll(get, sets, base, first, want) {
3394
3340
  }
3395
3341
  out.searches.push(reportOf(keywords, found, first));
3396
3342
  out.resolved = out.resolved ?? found.resolved;
3397
- for (const [k, n] of Object.entries(found.unknownTypes))
3398
- out.unknownTypes[k] = (out.unknownTypes[k] ?? 0) + n;
3399
- mergeInto(out, byId, found.jobs, sets.length > 1 ? keywords : void 0);
3343
+ addCounts(out.unknownTypes, found.unknownTypes);
3344
+ mergeInto(out, byId, found.items, sets.length > 1 ? keywords : void 0);
3400
3345
  }
3401
3346
  if (sets.length > 1) out.rows.sort((x, y) => (y.matched?.length ?? 0) - (x.matched?.length ?? 0));
3402
3347
  return out;
3403
3348
  }
3404
- function metaOf(merged, single, first, unread, readStop) {
3349
+ function metaOf(operation, merged, single, first, extra = {}) {
3350
+ const { unread = 0, readStop } = extra;
3405
3351
  const searched = merged.searches;
3406
3352
  const allComplete = searched.every((r) => r.state === "complete");
3407
3353
  const meta = {
3408
3354
  state: allComplete && unread === 0 && readStop === void 0 ? "complete" : "partial",
3409
- operation: "jobs"
3355
+ operation
3410
3356
  };
3411
3357
  if (single) {
3412
3358
  const { keywords: _k, state: _s, ...report } = searched[0];
@@ -3425,6 +3371,75 @@ function metaOf(merged, single, first, unread, readStop) {
3425
3371
  if (Object.keys(merged.unknownTypes).length > 0) meta.unknownTypes = merged.unknownTypes;
3426
3372
  return meta;
3427
3373
  }
3374
+ function line(parts) {
3375
+ return parts.filter((p) => p !== void 0 && p !== "").map((p) => p.replaceAll(" | ", " / ")).join(" | ");
3376
+ }
3377
+
3378
+ // src/commands/jobs.ts
3379
+ function liveFetch(command, quiet) {
3380
+ const session = loadSession();
3381
+ if (session.state !== "ok")
3382
+ return err(command, "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
3383
+ const client = createLiveClient(session.session, void 0, quiet);
3384
+ return async (url, spendClass) => {
3385
+ const r = await client.request({ url, spendClass, operation: command });
3386
+ return r.ok ? { ok: true, json: r.json } : r;
3387
+ };
3388
+ }
3389
+ var PAGING = { pageSize: PAGE_SIZE2, max: 1e3 };
3390
+ function compactJob(j) {
3391
+ return line([
3392
+ j.id,
3393
+ j.title,
3394
+ j.company,
3395
+ j.location,
3396
+ j.workplace,
3397
+ j.listed,
3398
+ j.easyApply ? "easy apply" : void 0,
3399
+ j.promoted ? "promoted" : void 0,
3400
+ j.salary,
3401
+ j.apply?.url !== void 0 ? `apply: ${j.apply.url}` : void 0,
3402
+ j.matched !== void 0 ? `matched: ${j.matched.join(" + ")}` : void 0
3403
+ ]);
3404
+ }
3405
+ function shape(rows, opts, line2) {
3406
+ if (opts.compact === true) return rows.map(line2);
3407
+ if (opts.fields !== void 0 && opts.fields !== "")
3408
+ return project(rows, opts.fields);
3409
+ return rows;
3410
+ }
3411
+ function queryOf(req, filters, keywords) {
3412
+ return {
3413
+ ...keywords ? { keywords } : {},
3414
+ ...req.location ? { location: req.location } : {},
3415
+ ...req.geoId ? { geoId: req.geoId } : {},
3416
+ filters
3417
+ };
3418
+ }
3419
+ async function readJobs(get, ids) {
3420
+ const jobs = /* @__PURE__ */ new Map();
3421
+ for (let at = 0; at < ids.length; at += BATCH_SIZE) {
3422
+ const res = await get(jobBatchUrl(ids.slice(at, at + BATCH_SIZE)), "jobRead");
3423
+ const batch = res.ok ? parseJobBatch(res.json) : res;
3424
+ if (!batch.ok) return { jobs, stoppedBy: batch.code };
3425
+ for (const job of batch.jobs) if (ids.includes(job.id)) jobs.set(job.id, job);
3426
+ }
3427
+ return { jobs };
3428
+ }
3429
+ async function addDetails(get, rows, withDescription) {
3430
+ const read = await readJobs(
3431
+ get,
3432
+ rows.map((r) => r.id)
3433
+ );
3434
+ for (const row of rows) {
3435
+ const detail = read.jobs.get(row.id);
3436
+ if (detail === void 0) continue;
3437
+ const { description, id: _id, url: _url, ...rest } = detail;
3438
+ Object.assign(row, rest, withDescription ? { description } : {});
3439
+ }
3440
+ const unread = rows.filter((r) => !read.jobs.has(r.id)).length;
3441
+ return read.stoppedBy === void 0 ? { unread } : { unread, stoppedBy: read.stoppedBy };
3442
+ }
3428
3443
  async function runJobs(req, opts = {}, fetch2) {
3429
3444
  const sets = keywordSets(req.keywords);
3430
3445
  const hasQuery = sets.length > 0 || [req.location, req.geoId].some((v) => v !== void 0 && v !== "");
@@ -3436,15 +3451,39 @@ async function runJobs(req, opts = {}, fetch2) {
3436
3451
  'lnrelay jobs "<keywords>" ["<more keywords>" ...] [--location "<place>" | --geo <id>] [filters]'
3437
3452
  );
3438
3453
  }
3439
- const selection2 = jobFilterSelection(req.filter ?? {});
3440
- if (!selection2.ok)
3441
- return err("jobs", selection2.code, selection2.message, "see `lnrelay help jobs`");
3454
+ const selection3 = jobFilterSelection(req.filter ?? {});
3455
+ if (!selection3.ok)
3456
+ return err("jobs", selection3.code, selection3.message, "see `lnrelay help jobs`");
3442
3457
  const get = fetch2 ?? liveFetch("jobs", opts.quiet === true);
3443
3458
  if (typeof get !== "function") return get;
3444
3459
  const first = Math.max(0, req.start ?? 0);
3445
- const want = Math.max(1, Math.min(req.limit, MAX_RESULTS - first));
3446
- const base = queryOf(req, selection2.filters);
3447
- const merged = await searchAll(get, sets.length > 0 ? sets : [void 0], base, first, want);
3460
+ const want = Math.max(1, Math.min(req.limit, PAGING.max - first));
3461
+ const base = queryOf(req, selection3.filters);
3462
+ const fetchPage = async (keywords, start) => {
3463
+ const url = jobSearchUrl({
3464
+ ...base,
3465
+ ...keywords ? { keywords } : {},
3466
+ start,
3467
+ count: PAGE_SIZE2
3468
+ });
3469
+ const res = await get(url, "jobSearch");
3470
+ const page = res.ok ? parseJobCards(res.json) : res;
3471
+ if (!page.ok) return page;
3472
+ return {
3473
+ ok: true,
3474
+ items: page.jobs,
3475
+ ...page.total !== void 0 ? { total: page.total } : {},
3476
+ ...page.location !== void 0 ? { resolved: page.location } : {},
3477
+ unknownTypes: page.unknownTypes
3478
+ };
3479
+ };
3480
+ const merged = await searchAll(
3481
+ fetchPage,
3482
+ sets.length > 0 ? sets : [void 0],
3483
+ first,
3484
+ want,
3485
+ PAGING
3486
+ );
3448
3487
  if (merged.rows.length === 0 && merged.failure !== void 0) {
3449
3488
  const f = merged.failure;
3450
3489
  return err("jobs", f.code, f.message, f.hint);
@@ -3457,7 +3496,10 @@ async function runJobs(req, opts = {}, fetch2) {
3457
3496
  readStop = added.stoppedBy;
3458
3497
  }
3459
3498
  const single = sets.length <= 1;
3460
- const meta = metaOf(merged, single, first, unread, readStop);
3499
+ const meta = metaOf("jobs", merged, single, first, {
3500
+ unread,
3501
+ ...readStop !== void 0 ? { readStop } : {}
3502
+ });
3461
3503
  return ok("jobs", {
3462
3504
  query: { ...base, ...sets.length > 0 ? { keywords: single ? sets[0] : sets } : {} },
3463
3505
  ...merged.resolved !== void 0 ? { location: merged.resolved } : {},
@@ -3517,12 +3559,12 @@ async function runJobFilters(req, opts = {}, fetch2) {
3517
3559
  'lnrelay job-filters "<keywords>" [filters]'
3518
3560
  );
3519
3561
  }
3520
- const selection2 = jobFilterSelection(req.filter ?? {});
3521
- if (!selection2.ok) return err("job-filters", selection2.code, selection2.message);
3562
+ const selection3 = jobFilterSelection(req.filter ?? {});
3563
+ if (!selection3.ok) return err("job-filters", selection3.code, selection3.message);
3522
3564
  const get = fetch2 ?? liveFetch("job-filters", opts.quiet === true);
3523
3565
  if (typeof get !== "function") return get;
3524
3566
  const url = jobFiltersUrl({
3525
- ...queryOf(req, selection2.filters, sets[0]),
3567
+ ...queryOf(req, selection3.filters, sets[0]),
3526
3568
  start: 0,
3527
3569
  count: PAGE_SIZE2
3528
3570
  });
@@ -3896,18 +3938,18 @@ async function exchange(code, config, deps) {
3896
3938
  } catch (e) {
3897
3939
  return { ok: false, message: `could not reach LinkedIn: ${e.message}` };
3898
3940
  }
3899
- const text3 = await res.text();
3941
+ const text4 = await res.text();
3900
3942
  if (res.status !== 200) {
3901
3943
  return {
3902
3944
  ok: false,
3903
3945
  message: `LinkedIn rejected the code exchange (${res.status})`,
3904
3946
  // The most common causes, in the order they actually happen.
3905
- 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)}`
3947
+ hint: `Check that the app has BOTH products added, and that its Auth tab lists exactly ${REDIRECT_URI} as an authorized redirect URL. Response: ${text4.slice(0, 200)}`
3906
3948
  };
3907
3949
  }
3908
3950
  let parsed;
3909
3951
  try {
3910
- parsed = JSON.parse(text3);
3952
+ parsed = JSON.parse(text4);
3911
3953
  } catch {
3912
3954
  return { ok: false, message: "token response was not JSON" };
3913
3955
  }
@@ -4140,6 +4182,460 @@ function runOauthStatus() {
4140
4182
  });
4141
4183
  }
4142
4184
 
4185
+ // src/engine/people.ts
4186
+ var PEOPLE_PAGE = 50;
4187
+ var text3 = (v) => {
4188
+ const t = v?.text;
4189
+ return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
4190
+ };
4191
+ function defined3(obj) {
4192
+ for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
4193
+ return obj;
4194
+ }
4195
+ var drift3 = (message) => ({
4196
+ ok: false,
4197
+ code: "SCHEMA_DRIFT",
4198
+ message,
4199
+ hint: "the people search response changed shape; re-capture it"
4200
+ });
4201
+ function peopleSearchUrl(q2) {
4202
+ const c = CONTRACTS.search;
4203
+ if (c?.queryId === void 0) throw new Error("the 'search' contract is missing");
4204
+ const queryParameters = [
4205
+ ...Object.entries(q2.params).filter(([, v]) => v.length > 0).map(([key, value]) => ({ key, value })),
4206
+ { key: "resultType", value: [q2.kind ?? "PEOPLE"] }
4207
+ ];
4208
+ const variables = encodeVariables({
4209
+ start: q2.start,
4210
+ count: PEOPLE_PAGE,
4211
+ origin: "FACETED_SEARCH",
4212
+ query: {
4213
+ keywords: q2.keywords,
4214
+ flagshipSearchIntent: "SEARCH_SRP",
4215
+ queryParameters,
4216
+ includeFiltersInResponse: q2.withFilters === true
4217
+ }
4218
+ });
4219
+ return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
4220
+ }
4221
+ var DEGREE = {
4222
+ DISTANCE_1: "1st",
4223
+ DISTANCE_2: "2nd",
4224
+ DISTANCE_3: "3rd+",
4225
+ OUT_OF_NETWORK: "out of network"
4226
+ };
4227
+ var PROFILE_ID = /urn:li:fsd_profile:([A-Za-z0-9_-]+)/;
4228
+ function insightOf(row) {
4229
+ const all = Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : [];
4230
+ const lines = all.map((i) => text3(i.simpleInsight?.title)).filter((t) => t !== void 0);
4231
+ return text3(row.summary) ?? (lines.length > 0 ? lines.join("; ") : void 0);
4232
+ }
4233
+ function profileUrl(nav) {
4234
+ if (typeof nav !== "string") return void 0;
4235
+ const m = nav.match(/^(https:\/\/www\.linkedin\.com\/in\/[^/?#]+)/);
4236
+ return m?.[1] === void 0 ? void 0 : `${m[1]}/`;
4237
+ }
4238
+ function rowToPerson(row) {
4239
+ const id = String(row.entityUrn ?? "").match(PROFILE_ID)?.[1];
4240
+ const name = text3(row.title);
4241
+ if (id === void 0 || name === void 0) return void 0;
4242
+ const tracking = row.entityCustomTrackingInfo ?? {};
4243
+ const badge = JSON.stringify(row.badgeIcon ?? null);
4244
+ return defined3({
4245
+ id,
4246
+ name,
4247
+ headline: text3(row.primarySubtitle),
4248
+ location: text3(row.secondarySubtitle),
4249
+ degree: DEGREE[String(tracking.memberDistance)],
4250
+ verified: badge.includes("VERIFIED") ? true : void 0,
4251
+ insight: insightOf(row),
4252
+ url: profileUrl(row.navigationUrl)
4253
+ });
4254
+ }
4255
+ function clustersOf(json) {
4256
+ const d = json?.data?.data;
4257
+ const c = d?.searchDashClustersByAll;
4258
+ return c !== null && typeof c === "object" ? c : void 0;
4259
+ }
4260
+ var FURNITURE = /* @__PURE__ */ new Set(["*feedbackCard", "*bannerCard", "*searchSuggestionCard", "*simpleText"]);
4261
+ function classify2(item) {
4262
+ const ref = item?.["*entityResult"];
4263
+ if (typeof ref === "string") return { ref };
4264
+ const kinds = Object.entries(item ?? {}).filter(([k, v]) => v !== null && !k.startsWith("$")).map(([k]) => k);
4265
+ return kinds.every((k) => FURNITURE.has(k)) ? "furniture" : kinds;
4266
+ }
4267
+ function readItems(c, included) {
4268
+ const byUrn = new Map(included.map((n) => [n.entityUrn, n]));
4269
+ const people = [];
4270
+ const unknownTypes = {};
4271
+ let excluded = 0;
4272
+ let unresolved = 0;
4273
+ const items = (c.elements ?? []).flatMap((el) => el.items ?? []);
4274
+ for (const { item } of items) {
4275
+ const kind = classify2(item);
4276
+ if (kind === "furniture") {
4277
+ excluded++;
4278
+ } else if (Array.isArray(kind)) {
4279
+ for (const k of kind) unknownTypes[k] = (unknownTypes[k] ?? 0) + 1;
4280
+ } else {
4281
+ const row = byUrn.get(kind.ref);
4282
+ const person = row === void 0 ? void 0 : rowToPerson(row);
4283
+ if (person === void 0) unresolved++;
4284
+ else if (!people.some((p) => p.id === person.id)) people.push(person);
4285
+ }
4286
+ }
4287
+ return { people, unknownTypes, excluded, unresolved };
4288
+ }
4289
+ function parsePeople(json) {
4290
+ const c = clustersOf(json);
4291
+ if (c === void 0 || !Array.isArray(c.elements))
4292
+ return drift3("the people search returned no result list");
4293
+ const included = json.included ?? [];
4294
+ const { people, unknownTypes, excluded, unresolved } = readItems(c, included);
4295
+ const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
4296
+ const start = typeof c.paging?.start === "number" ? c.paging.start : 0;
4297
+ const claimedRaw = c.metadata?.totalResultCount;
4298
+ const claimed = typeof claimedRaw === "number" ? claimedRaw : total;
4299
+ if (unresolved > 0 && people.length === 0)
4300
+ return drift3(`${unresolved} people were listed but none could be read`);
4301
+ if (people.length === 0 && total !== void 0 && total > start) {
4302
+ return {
4303
+ ok: false,
4304
+ code: "SCHEMA_DRIFT",
4305
+ message: `LinkedIn claims ${total} people but returned none from ${start}`,
4306
+ hint: 'a failed fetch, not an empty search; do not report "nobody"'
4307
+ };
4308
+ }
4309
+ return {
4310
+ ok: true,
4311
+ people,
4312
+ ...total !== void 0 ? { total } : {},
4313
+ ...claimed !== void 0 ? { claimed } : {},
4314
+ start,
4315
+ excluded,
4316
+ unknownTypes
4317
+ };
4318
+ }
4319
+ function parsePeopleFilters(json) {
4320
+ const cluster = clustersOf(json)?.metadata?.primaryFilterCluster;
4321
+ if (cluster === null || cluster === void 0)
4322
+ return drift3("the people search returned no filter list");
4323
+ const groups = [
4324
+ ...cluster.secondaryFilterGroups ?? [],
4325
+ ...cluster.primaryFilterGroups ?? []
4326
+ ];
4327
+ const filters = [];
4328
+ for (const g of groups) {
4329
+ for (const f of g.filters ?? []) {
4330
+ const key = f.parameterName;
4331
+ if (typeof key !== "string" || f.renderType === "NAVIGATION") continue;
4332
+ if (filters.some((x) => x.key === key)) continue;
4333
+ const values = [
4334
+ ...f.secondaryFilterValues ?? [],
4335
+ ...f.primaryFilterValues ?? []
4336
+ ];
4337
+ filters.push(
4338
+ defined3({
4339
+ key,
4340
+ label: text3(f.displayName) ?? key,
4341
+ input: f.renderType === "FREE_TEXT" ? "text" : "select",
4342
+ lookup: typeof f.typeaheadType === "string" ? f.typeaheadType : void 0,
4343
+ options: values.filter((v) => typeof v.value === "string").map(
4344
+ (v) => defined3({
4345
+ value: v.value,
4346
+ label: typeof v.displayName === "string" ? v.displayName : String(v.value),
4347
+ count: typeof v.count === "number" && v.count > 0 ? v.count : void 0
4348
+ })
4349
+ )
4350
+ })
4351
+ );
4352
+ }
4353
+ }
4354
+ if (filters.length === 0) return drift3("the people filter list was empty");
4355
+ return { ok: true, filters };
4356
+ }
4357
+ function parseOrgHits(json) {
4358
+ const c = clustersOf(json);
4359
+ if (c === void 0) return drift3("the organisation search returned no result list");
4360
+ const included = json.included ?? [];
4361
+ const byUrn = new Map(included.map((n) => [n.entityUrn, n]));
4362
+ const hits = [];
4363
+ for (const el of c.elements ?? []) {
4364
+ for (const { item } of el.items ?? []) {
4365
+ const row = byUrn.get(item?.["*entityResult"]);
4366
+ const id = String(row?.entityUrn ?? "").match(/urn:li:fsd_company:(\d+)/)?.[1];
4367
+ const name = text3(row?.title);
4368
+ if (id !== void 0 && name !== void 0 && !hits.some((h) => h.id === id))
4369
+ hits.push({ id, name });
4370
+ }
4371
+ }
4372
+ return { ok: true, hits };
4373
+ }
4374
+ var NETWORK = {
4375
+ "1st": "F",
4376
+ "1": "F",
4377
+ "2nd": "S",
4378
+ "2": "S",
4379
+ "3rd+": "O",
4380
+ "3rd": "O",
4381
+ "3": "O"
4382
+ };
4383
+ var profileId = (v) => v.match(/^(?:urn:li:fsd_profile:)?(AC[A-Za-z0-9_-]{10,})$/)?.[1];
4384
+ var Refused2 = class extends Error {
4385
+ };
4386
+ function selection2(o) {
4387
+ const params = {};
4388
+ if (o.network !== void 0 && o.network.length > 0) {
4389
+ params.network = o.network.map((n) => {
4390
+ const code = NETWORK[n.toLowerCase()] ?? (["F", "S", "O"].includes(n) ? n : void 0);
4391
+ if (code === void 0) throw new Refused2(`--network '${n}' is not one of: 1st, 2nd, 3rd+`);
4392
+ return code;
4393
+ });
4394
+ }
4395
+ const ids = [
4396
+ [o.company, "currentCompany"],
4397
+ [o.pastCompany, "pastCompany"],
4398
+ [o.school, "schoolFilter"],
4399
+ [o.geo, "geoUrn"],
4400
+ [o.industry, "industry"],
4401
+ [o.language, "profileLanguage"],
4402
+ [o.service, "serviceCategory"]
4403
+ ];
4404
+ for (const [given, param] of ids)
4405
+ if (given !== void 0 && given.length > 0) params[param] = given;
4406
+ for (const [given, param, flag] of [
4407
+ [o.connectionOf, "connectionOf", "--connection-of"],
4408
+ [o.followerOf, "followerOf", "--follower-of"]
4409
+ ]) {
4410
+ if (given === void 0) continue;
4411
+ const id = profileId(given.trim());
4412
+ if (id === void 0)
4413
+ throw new Refused2(`${flag} takes a profile id (ACo\u2026) or urn, from a people row's \`id\``);
4414
+ params[param] = [id];
4415
+ }
4416
+ const texts = [
4417
+ [o.firstName, "firstName"],
4418
+ [o.lastName, "lastName"],
4419
+ [o.title, "title"],
4420
+ [o.companyText, "company"],
4421
+ [o.schoolText, "schoolFreetext"]
4422
+ ];
4423
+ for (const [given, param] of texts)
4424
+ if (given !== void 0 && given.trim() !== "") params[param] = [given.trim()];
4425
+ if (o.openToVolunteer === true) params.openToVolunteer = ["true"];
4426
+ for (const r of o.raw ?? []) {
4427
+ const m = r.match(/^([A-Za-z_]+)=(.+)$/);
4428
+ if (m?.[1] === void 0 || m[2] === void 0)
4429
+ throw new Refused2(`--filter '${r}' is not key=value[,value]`);
4430
+ params[m[1]] = m[2].split(",").map((v) => v.trim()).filter((v) => v !== "");
4431
+ }
4432
+ return params;
4433
+ }
4434
+ function peopleFilterSelection(o) {
4435
+ try {
4436
+ return { ok: true, params: selection2(o) };
4437
+ } catch (e) {
4438
+ if (e instanceof Refused2) return { ok: false, code: "INVALID_INPUT", message: e.message };
4439
+ throw e;
4440
+ }
4441
+ }
4442
+
4443
+ // src/commands/people.ts
4444
+ function liveFetch2(command, quiet) {
4445
+ const session = loadSession();
4446
+ if (session.state !== "ok")
4447
+ return err(command, "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
4448
+ const client = createLiveClient(session.session, void 0, quiet);
4449
+ return async (url, spendClass) => {
4450
+ const r = await client.request({ url, spendClass, operation: command });
4451
+ return r.ok ? { ok: true, json: r.json } : r;
4452
+ };
4453
+ }
4454
+ var PAGING2 = { pageSize: PEOPLE_PAGE, max: 1e3 };
4455
+ function compactPerson(p) {
4456
+ return line([
4457
+ p.id,
4458
+ p.name,
4459
+ p.headline,
4460
+ p.location,
4461
+ p.degree,
4462
+ p.verified ? "verified" : void 0,
4463
+ p.insight,
4464
+ p.url,
4465
+ p.matched !== void 0 ? `matched: ${p.matched.join(" + ")}` : void 0
4466
+ ]);
4467
+ }
4468
+ function shape2(rows, opts, toLine) {
4469
+ if (opts.compact === true) return rows.map(toLine);
4470
+ if (opts.fields !== void 0 && opts.fields !== "")
4471
+ return project(rows, opts.fields);
4472
+ return rows;
4473
+ }
4474
+ var isId = (v) => /^\d+$/.test(v);
4475
+ async function resolveOrgs(get, given, kind) {
4476
+ if (given === void 0 || given.length === 0) return void 0;
4477
+ const ids = [];
4478
+ const found = [];
4479
+ for (const v of given) {
4480
+ if (isId(v)) {
4481
+ ids.push(v);
4482
+ continue;
4483
+ }
4484
+ const res = await get(peopleSearchUrl({ keywords: v, params: {}, start: 0, kind }), "search");
4485
+ const hits = res.ok ? parseOrgHits(res.json) : res;
4486
+ if (!hits.ok) return hits;
4487
+ const top = hits.hits[0];
4488
+ if (top === void 0) {
4489
+ return {
4490
+ ok: false,
4491
+ code: "INVALID_INPUT",
4492
+ message: `no ${kind === "SCHOOLS" ? "school" : "company"} on LinkedIn matches "${v}"`,
4493
+ hint: "check the spelling, or pass its id (from `people-filters`)"
4494
+ };
4495
+ }
4496
+ ids.push(top.id);
4497
+ found.push({ given: v, id: top.id, name: top.name });
4498
+ }
4499
+ return { ids, found };
4500
+ }
4501
+ async function resolvePlace(get, place) {
4502
+ const res = await get(
4503
+ jobSearchUrl({ location: place, filters: {}, start: 0, count: 1 }),
4504
+ "search"
4505
+ );
4506
+ const page = res.ok ? parseJobCards(res.json) : res;
4507
+ if (!page.ok) return page;
4508
+ if (page.location === void 0) {
4509
+ return {
4510
+ ok: false,
4511
+ code: "INVALID_INPUT",
4512
+ message: `LinkedIn could not place "${place}"`,
4513
+ hint: "try a city, region or country, or pass --geo <id> (ids are in `people-filters`)"
4514
+ };
4515
+ }
4516
+ return { given: place, id: page.location.geoId, name: page.location.name };
4517
+ }
4518
+ async function resolveNames(get, req) {
4519
+ const filter = { ...req.filter ?? {} };
4520
+ const resolved = {};
4521
+ const orgs2 = [
4522
+ ["company", "COMPANIES"],
4523
+ ["pastCompany", "COMPANIES"],
4524
+ ["school", "SCHOOLS"]
4525
+ ];
4526
+ for (const [key, kind] of orgs2) {
4527
+ const r = await resolveOrgs(get, filter[key], kind);
4528
+ if (r === void 0) continue;
4529
+ if ("ok" in r) return r;
4530
+ filter[key] = r.ids;
4531
+ if (r.found.length > 0) resolved[key] = r.found;
4532
+ }
4533
+ if (req.location !== void 0 && req.location.trim() !== "") {
4534
+ const place = await resolvePlace(get, req.location.trim());
4535
+ if ("ok" in place) return place;
4536
+ filter.geo = [...filter.geo ?? [], place.id];
4537
+ resolved.location = place;
4538
+ }
4539
+ return { filter, resolved };
4540
+ }
4541
+ var BY_NAME = {
4542
+ currentCompany: "ids, or names via --company",
4543
+ pastCompany: "ids, or names via --past-company",
4544
+ schoolFilter: "ids, or names via --school",
4545
+ geoUrn: "ids via --geo, or a place via --location"
4546
+ };
4547
+ async function runPeople(req, opts = {}, fetch2) {
4548
+ const sets = keywordSets(req.keywords);
4549
+ const named2 = peopleFilterSelection(req.filter ?? {});
4550
+ if (!named2.ok) return err("people", named2.code, named2.message, "see `lnrelay help people`");
4551
+ const hasFilter = Object.keys(named2.params).length > 0 || (req.location ?? "").trim() !== "";
4552
+ if (sets.length === 0 && !hasFilter) {
4553
+ return err(
4554
+ "people",
4555
+ "INVALID_INPUT",
4556
+ "give keywords, a filter, or both",
4557
+ 'lnrelay people "<keywords>" ["<more>" ...] [--company "<name|id>"] [--location "<place>"] [filters]'
4558
+ );
4559
+ }
4560
+ const get = fetch2 ?? liveFetch2("people", opts.quiet === true);
4561
+ if (typeof get !== "function") return get;
4562
+ const names = await resolveNames(get, req);
4563
+ if ("ok" in names) return err("people", names.code, names.message, names.hint);
4564
+ const selection3 = peopleFilterSelection(names.filter);
4565
+ if (!selection3.ok) return err("people", selection3.code, selection3.message);
4566
+ const params = selection3.params;
4567
+ const first = Math.max(0, req.start ?? 0);
4568
+ const want = Math.max(1, Math.min(req.limit, PAGING2.max - first));
4569
+ const fetchPage = async (keywords, start) => {
4570
+ const res = await get(
4571
+ peopleSearchUrl({ ...keywords ? { keywords } : {}, params, start }),
4572
+ "search"
4573
+ );
4574
+ const page = res.ok ? parsePeople(res.json) : res;
4575
+ if (!page.ok) return page;
4576
+ return {
4577
+ ok: true,
4578
+ items: page.people,
4579
+ ...page.total !== void 0 ? { total: page.total } : {},
4580
+ ...page.claimed !== void 0 ? { claimed: page.claimed } : {},
4581
+ unknownTypes: page.unknownTypes
4582
+ };
4583
+ };
4584
+ const merged = await searchAll(
4585
+ fetchPage,
4586
+ sets.length > 0 ? sets : [void 0],
4587
+ first,
4588
+ want,
4589
+ PAGING2
4590
+ );
4591
+ if (merged.rows.length === 0 && merged.failure !== void 0) {
4592
+ const f = merged.failure;
4593
+ return err("people", f.code, f.message, f.hint);
4594
+ }
4595
+ const single = sets.length <= 1;
4596
+ return ok("people", {
4597
+ query: { ...sets.length > 0 ? { keywords: single ? sets[0] : sets } : {}, params },
4598
+ ...Object.keys(names.resolved).length > 0 ? { resolved: names.resolved } : {},
4599
+ items: shape2(merged.rows, opts, compactPerson),
4600
+ meta: metaOf("people", merged, single, first)
4601
+ });
4602
+ }
4603
+ async function runPeopleFilters(req, opts = {}, fetch2) {
4604
+ const sets = keywordSets(req.keywords);
4605
+ if (sets.length > 1) {
4606
+ return err(
4607
+ "people-filters",
4608
+ "INVALID_INPUT",
4609
+ "people-filters takes one keyword set: its counts belong to that one query",
4610
+ 'lnrelay people-filters "<keywords>" [filters]'
4611
+ );
4612
+ }
4613
+ const get = fetch2 ?? liveFetch2("people-filters", opts.quiet === true);
4614
+ if (typeof get !== "function") return get;
4615
+ const names = await resolveNames(get, req);
4616
+ if ("ok" in names) return err("people-filters", names.code, names.message, names.hint);
4617
+ const selection3 = peopleFilterSelection(names.filter);
4618
+ if (!selection3.ok) return err("people-filters", selection3.code, selection3.message);
4619
+ const url = peopleSearchUrl({
4620
+ ...sets[0] !== void 0 ? { keywords: sets[0] } : {},
4621
+ params: selection3.params,
4622
+ start: 0,
4623
+ withFilters: true
4624
+ });
4625
+ const res = await get(url, "search");
4626
+ const parsed = res.ok ? parsePeopleFilters(res.json) : res;
4627
+ if (!parsed.ok) return err("people-filters", parsed.code, parsed.message, parsed.hint);
4628
+ return ok("people-filters", {
4629
+ ...Object.keys(names.resolved).length > 0 ? { resolved: names.resolved } : {},
4630
+ items: shape2(parsed.filters, opts, (f) => {
4631
+ const how = f.input === "text" ? "free text" : BY_NAME[f.key] ?? "ids";
4632
+ const options = f.options.map((o) => `${o.value}=${o.label}${o.count !== void 0 ? ` (${o.count})` : ""}`).join(", ");
4633
+ return `${f.key} [${how}]${options !== "" ? `: ${options}` : ""}`;
4634
+ }),
4635
+ meta: { state: "complete", operation: "people-filters", returnedCount: parsed.filters.length }
4636
+ });
4637
+ }
4638
+
4143
4639
  // src/commands/registry.ts
4144
4640
  var COMMANDS = [
4145
4641
  // ─── local / meta — no network, available today ────────────────────────────
@@ -4202,12 +4698,30 @@ var COMMANDS = [
4202
4698
  {
4203
4699
  name: "search",
4204
4700
  cost: "cheap \u2014 the net",
4205
- summary: "Search people, companies or jobs. Cast wide, then deep-read the finalists.",
4701
+ summary: "Search people or companies, one page. For people with filters use `people`; jobs: `jobs`.",
4206
4702
  usage: 'lnrelay search people|companies|jobs "<query>" [--limit N] (jobs: see `jobs`)\n [--compact | --fields a,b,c] [--retain] [--raw]',
4207
4703
  audience: ["cli", "mcp"],
4208
4704
  risk: "read",
4209
4705
  implemented: true
4210
4706
  },
4707
+ {
4708
+ name: "people",
4709
+ cost: "1 search call per 50 people; +1 per company, school or place given by name",
4710
+ summary: "People search with every filter LinkedIn has: company, past company, school, place, degree, industry, title, connections of someone, \u2026 Several keyword sets merge by person.",
4711
+ usage: 'lnrelay people ["<keywords>" ...] [--company "<name|id>" ...] [--past-company "<name|id>" ...]\n [--school "<name|id>" ...] [--location "<place>" | --geo <ids>] [--network 1st,2nd,3rd+]\n [--industry <ids>] [--language en,de] [--service <ids>] [--title "<text>"]\n [--first-name "<text>"] [--last-name "<text>"] [--company-text "<text>"]\n [--school-text "<text>"] [--connection-of <profile-id>] [--follower-of <profile-id>]\n [--open-to-volunteer] [--filter key=v1,v2 ...] [--limit N] [--start N]\n [--compact | --fields a,b,c]\n Names are looked up and data.resolved says what each became: check it.\n LinkedIn pages at most 1000 people per query; meta.servedLimit says when it held back.',
4712
+ audience: ["cli", "mcp"],
4713
+ risk: "read",
4714
+ implemented: true
4715
+ },
4716
+ {
4717
+ name: "people-filters",
4718
+ cost: "1 search call (+1 per name looked up)",
4719
+ summary: "Every people filter for a query, with option ids and live counts: what `people` and --filter take.",
4720
+ usage: 'lnrelay people-filters ["<keywords>"] [people filters]',
4721
+ audience: ["cli", "mcp"],
4722
+ risk: "read",
4723
+ implemented: true
4724
+ },
4211
4725
  {
4212
4726
  name: "jobs",
4213
4727
  cost: "1 job-search call per 100 jobs; --details adds 1 job read per 100 jobs",
@@ -4482,10 +4996,10 @@ function balanced(s, start) {
4482
4996
  return null;
4483
4997
  }
4484
4998
  function parseAt(s, start) {
4485
- const text3 = start < 0 ? null : balanced(s, start);
4486
- if (text3 === null) return null;
4999
+ const text4 = start < 0 ? null : balanced(s, start);
5000
+ if (text4 === null) return null;
4487
5001
  try {
4488
- return JSON.parse(text3);
5002
+ return JSON.parse(text4);
4489
5003
  } catch {
4490
5004
  return null;
4491
5005
  }
@@ -4656,7 +5170,7 @@ var PROFILE_FIELDS = {
4656
5170
  maxLength: 2600
4657
5171
  }
4658
5172
  };
4659
- var drift3 = (message) => ({
5173
+ var drift4 = (message) => ({
4660
5174
  ok: false,
4661
5175
  code: "SCHEMA_DRIFT",
4662
5176
  message,
@@ -4664,10 +5178,10 @@ var drift3 = (message) => ({
4664
5178
  });
4665
5179
  function readForm(stream, field) {
4666
5180
  const states2 = readModel(stream);
4667
- if (states2 === null) return drift3("the profile form carried no initial values");
5181
+ if (states2 === null) return drift4("the profile form carried no initial values");
4668
5182
  const args = findRequest(stream, field.save);
4669
5183
  if (args === null)
4670
- return drift3(`the profile form carried no ${field.save.split(".").pop()} action`);
5184
+ return drift4(`the profile form carried no ${field.save.split(".").pop()} action`);
4671
5185
  return { ok: true, args, states: states2, screen: field.screen, save: field.save };
4672
5186
  }
4673
5187
  function boundKey(form, property) {
@@ -4683,7 +5197,7 @@ function topSkills(form) {
4683
5197
  return (key) => {
4684
5198
  if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
4685
5199
  const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
4686
- if (initial === void 0) return drift3("the About form carried no initial top skills");
5200
+ if (initial === void 0) return drift4("the About form carried no initial top skills");
4687
5201
  if (!Array.isArray(initial.value) || initial.value.length > 0) {
4688
5202
  return {
4689
5203
  ok: false,
@@ -4706,7 +5220,7 @@ function saveBody(form, field, value) {
4706
5220
  const target = boundKey(form, field.binding);
4707
5221
  const current = target === void 0 ? void 0 : form.states.get(target);
4708
5222
  if (target === void 0 || current === void 0) {
4709
- return drift3(`the profile form has no ${field.name} field`);
5223
+ return drift4(`the profile form has no ${field.name} field`);
4710
5224
  }
4711
5225
  const model = new Map(form.states);
4712
5226
  model.set(target, { ...current, value });
@@ -4775,7 +5289,7 @@ var POSITION = {
4775
5289
  var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
4776
5290
  function listPositions(stream) {
4777
5291
  if (readModel(stream) === null && !stream.includes(EDIT_NAV) && !stream.includes('"rows"')) {
4778
- return drift3("the Experience screen could not be read");
5292
+ return drift4("the Experience screen could not be read");
4779
5293
  }
4780
5294
  const positions = [];
4781
5295
  const seen = /* @__PURE__ */ new Set();
@@ -4783,27 +5297,27 @@ function listPositions(stream) {
4783
5297
  for (; ; ) {
4784
5298
  i = stream.indexOf(EDIT_NAV, i);
4785
5299
  if (i === -1) break;
4786
- const text3 = balanced(stream, i);
5300
+ const text4 = balanced(stream, i);
4787
5301
  i += EDIT_NAV.length;
4788
- if (text3 === null) continue;
4789
- const payload = JSON.parse(text3).requestedArguments?.payload;
5302
+ if (text4 === null) continue;
5303
+ const payload = JSON.parse(text4).requestedArguments?.payload;
4790
5304
  const id = payload?.positionId;
4791
5305
  if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
4792
5306
  seen.add(id);
4793
5307
  positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
4794
5308
  }
4795
5309
  if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
4796
- return drift3("the Experience screen listed no roles and did not look like one");
5310
+ return drift4("the Experience screen listed no roles and did not look like one");
4797
5311
  }
4798
5312
  return { ok: true, positions };
4799
5313
  }
4800
5314
  function readPositionForm(stream) {
4801
5315
  const model = readModel(stream);
4802
- if (model === null) return drift3("the position form carried no initial values");
5316
+ if (model === null) return drift4("the position form carried no initial values");
4803
5317
  const media = findRequest(stream, POSITION.media);
4804
5318
  const prefix = media?.payload.formIdPrefix;
4805
5319
  if (media === null || typeof prefix !== "string") {
4806
- return drift3("the position form carried no save step (uploadPositionMedia)");
5320
+ return drift4("the position form carried no save step (uploadPositionMedia)");
4807
5321
  }
4808
5322
  const del = findRequest(stream, POSITION.delete);
4809
5323
  return {
@@ -4854,7 +5368,7 @@ function applyChanges(form, changes) {
4854
5368
  }
4855
5369
  need("dynamicallyCreateHeadline", false);
4856
5370
  need("allowProfileEditBroadcasts", changes.notify === true);
4857
- if (missing.length > 0) return drift3(`the position form has no ${missing.join(", ")} field`);
5371
+ if (missing.length > 0) return drift4(`the position form has no ${missing.join(", ")} field`);
4858
5372
  const s = roleSummary(model);
4859
5373
  if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
4860
5374
  return {
@@ -4899,7 +5413,7 @@ function mediaBody(form, model) {
4899
5413
  }
4900
5414
  function saveFromReply(reply) {
4901
5415
  const args = findRequest(reply, POSITION.save);
4902
- return args === null ? drift3("the media step did not hand back the save action") : { ok: true, args };
5416
+ return args === null ? drift4("the media step did not hand back the save action") : { ok: true, args };
4903
5417
  }
4904
5418
  function positionSaveBody(save, model, screen) {
4905
5419
  const sending = new Map(model);
@@ -4911,7 +5425,7 @@ function positionSaveBody(save, model, screen) {
4911
5425
  }
4912
5426
  function deleteBody(form) {
4913
5427
  if (form.del === null)
4914
- return drift3("this form has no delete action (it is not an existing role)");
5428
+ return drift4("this form has no delete action (it is not an existing role)");
4915
5429
  const states2 = wireStates(keysOf(form.del), form.model, resolver);
4916
5430
  if (!Array.isArray(states2)) return states2;
4917
5431
  return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
@@ -4989,9 +5503,9 @@ async function send(url, body, token, deps) {
4989
5503
  } catch (e) {
4990
5504
  return { ok: false, code: "FETCH_FAILED", message: e.message };
4991
5505
  }
4992
- const text3 = await res.text();
5506
+ const text4 = await res.text();
4993
5507
  if (res.status === 201 || res.status === 200) {
4994
- const id = res.headers.get("x-restli-id") ?? extractId(text3);
5508
+ const id = res.headers.get("x-restli-id") ?? extractId(text4);
4995
5509
  return {
4996
5510
  ok: true,
4997
5511
  id: id ?? "(unknown)",
@@ -5018,7 +5532,7 @@ async function send(url, body, token, deps) {
5018
5532
  ok: false,
5019
5533
  code: "FETCH_FAILED",
5020
5534
  message: `write failed (${res.status})`,
5021
- hint: text3.slice(0, 300)
5535
+ hint: text4.slice(0, 300)
5022
5536
  };
5023
5537
  }
5024
5538
  function extractId(body) {
@@ -5066,7 +5580,7 @@ function feedTypeFor(bindingKey) {
5066
5580
  function stateKey(prefix, body) {
5067
5581
  return `${prefix}-${body}`;
5068
5582
  }
5069
- function states(text3, body) {
5583
+ function states(text4, body) {
5070
5584
  return STATE_PREFIXES.map((prefix) => {
5071
5585
  const key = stateKey(prefix, body);
5072
5586
  const base = {
@@ -5075,19 +5589,19 @@ function states(text3, body) {
5075
5589
  protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
5076
5590
  };
5077
5591
  if (prefix === "commentBoxText") {
5078
- return { ...base, value: text3, originalProtoCase: "stringValue" };
5592
+ return { ...base, value: text4, originalProtoCase: "stringValue" };
5079
5593
  }
5080
5594
  if (prefix === "richCommentBoxText") {
5081
5595
  return {
5082
5596
  ...base,
5083
- value: { text: text3, attribute: [], $type: "TextModel", source: "local" },
5597
+ value: { text: text4, attribute: [], $type: "TextModel", source: "local" },
5084
5598
  originalProtoCase: "textModelForWrite"
5085
5599
  };
5086
5600
  }
5087
5601
  return { ...base, value: "", originalProtoCase: "stringValue" };
5088
5602
  });
5089
5603
  }
5090
- function commentBody(activityId, text3, tokens, feedType) {
5604
+ function commentBody(activityId, text4, tokens, feedType) {
5091
5605
  const body = keyBody(tokens.bindingKey);
5092
5606
  const activityUrn = { activityUrn: { activityId } };
5093
5607
  const binding = (prefix) => ({
@@ -5134,17 +5648,17 @@ function commentBody(activityId, text3, tokens, feedType) {
5134
5648
  isStreaming: false,
5135
5649
  rumPageKey: ""
5136
5650
  },
5137
- states: states(text3, body),
5651
+ states: states(text4, body),
5138
5652
  requestedArguments: {
5139
5653
  ...args,
5140
- states: states(text3, body),
5654
+ states: states(text4, body),
5141
5655
  screenId: SCREEN_ID3,
5142
5656
  knownTemplateIds: []
5143
5657
  }
5144
5658
  };
5145
5659
  }
5146
5660
  async function comment(confirmed, client) {
5147
- const { activityId, text: text3, tokens } = confirmed.payload;
5661
+ const { activityId, text: text4, tokens } = confirmed.payload;
5148
5662
  if (!keyMatchesPost(tokens.bindingKey, activityId)) {
5149
5663
  return {
5150
5664
  ok: false,
@@ -5165,7 +5679,7 @@ async function comment(confirmed, client) {
5165
5679
  const result = await client.request({
5166
5680
  url: COMMENT_URL,
5167
5681
  method: "POST",
5168
- body: commentBody(activityId, text3, tokens, feedType),
5682
+ body: commentBody(activityId, text4, tokens, feedType),
5169
5683
  spendClass: "write",
5170
5684
  operation: "comment.create"
5171
5685
  });
@@ -5289,10 +5803,10 @@ var REPLY_URL = `https://www.linkedin.com/voyager/api/voyagerSocialDashNormComme
5289
5803
  function parentThreadUrn(ref) {
5290
5804
  return `urn:li:comment:(${ref.threadType}:${ref.activityId},${ref.commentId})`;
5291
5805
  }
5292
- function replyBody(ref, text3) {
5806
+ function replyBody(ref, text4) {
5293
5807
  return {
5294
5808
  commentary: {
5295
- text: text3,
5809
+ text: text4,
5296
5810
  // The captured reply carried a profileMention, because LinkedIn's UI
5297
5811
  // pre-fills "@Author " into the box. We send none: an @mention notifies a
5298
5812
  // real person, and inventing one would put words — and a notification —
@@ -5304,11 +5818,11 @@ function replyBody(ref, text3) {
5304
5818
  };
5305
5819
  }
5306
5820
  async function replyToComment(confirmed, client) {
5307
- const { ref, text: text3 } = confirmed.payload;
5821
+ const { ref, text: text4 } = confirmed.payload;
5308
5822
  const result = await client.request({
5309
5823
  url: REPLY_URL,
5310
5824
  method: "POST",
5311
- body: replyBody(ref, text3),
5825
+ body: replyBody(ref, text4),
5312
5826
  spendClass: "write",
5313
5827
  operation: "reply"
5314
5828
  });
@@ -5670,8 +6184,8 @@ function whenLine(at, now) {
5670
6184
  const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
5671
6185
  return `when ${local} (${zone}) \u2014 ${away}`;
5672
6186
  }
5673
- async function runShare(text3, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
5674
- if (text3 === void 0 || text3.trim() === "") {
6187
+ async function runShare(text4, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
6188
+ if (text4 === void 0 || text4.trim() === "") {
5675
6189
  return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
5676
6190
  }
5677
6191
  const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
@@ -5686,7 +6200,7 @@ async function runShare(text3, visibility, now = Date.now(), deps = terminalDeps
5686
6200
  via: via2
5687
6201
  });
5688
6202
  if (pollSpec !== void 0 && "ok" in pollSpec) return pollSpec;
5689
- const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text3) : null;
6203
+ const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text4) : null;
5690
6204
  const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
5691
6205
  const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
5692
6206
  if ("ok" in ctx) return ctx;
@@ -5695,7 +6209,7 @@ async function runShare(text3, visibility, now = Date.now(), deps = terminalDeps
5695
6209
  const plan = sharePlan({
5696
6210
  author: authorLine(ctx.transport),
5697
6211
  transport: ctx.transport.kind,
5698
- text: text3,
6212
+ text: text4,
5699
6213
  visibility: vis,
5700
6214
  media: loaded?.approved,
5701
6215
  scheduledAt,
@@ -5718,7 +6232,7 @@ async function runShare(text3, visibility, now = Date.now(), deps = terminalDeps
5718
6232
  note: "note" in result ? result.note : ctx.note
5719
6233
  });
5720
6234
  }
5721
- async function runEditPost(urn, text3, now, deps) {
6235
+ async function runEditPost(urn, text4, now, deps) {
5722
6236
  const unapprovable = refuseUnapprovable("edit", "editing", deps);
5723
6237
  if (unapprovable !== null) return unapprovable;
5724
6238
  const ctx = prepare("edit", now, "voyager");
@@ -5733,12 +6247,12 @@ async function runEditPost(urn, text3, now, deps) {
5733
6247
  const before = await lookup(urn, true);
5734
6248
  const plan = {
5735
6249
  action: "edit your post",
5736
- payload: { urn, text: text3 },
6250
+ payload: { urn, text: text4 },
5737
6251
  summary: [
5738
6252
  authorLine(ctx.transport),
5739
6253
  `post ${urn}`,
5740
6254
  ...previewLines2(before).map((l) => l.replace(/^content /, "was ")),
5741
- `new text "${text3}"`
6255
+ `new text "${text4}"`
5742
6256
  ],
5743
6257
  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",
5744
6258
  transport: "voyager"
@@ -5762,7 +6276,7 @@ function liveProfile(session) {
5762
6276
  };
5763
6277
  }
5764
6278
  var PROFILE_HINT = `profile fields: ${Object.keys(PROFILE_FIELDS).join(", ")}`;
5765
- async function runEditProfile(name, text3, now = Date.now(), deps = terminalDeps(), surface) {
6279
+ async function runEditProfile(name, text4, now = Date.now(), deps = terminalDeps(), surface) {
5766
6280
  const field = PROFILE_FIELDS[name];
5767
6281
  if (field === void 0) {
5768
6282
  return err(
@@ -5772,7 +6286,7 @@ async function runEditProfile(name, text3, now = Date.now(), deps = terminalDeps
5772
6286
  PROFILE_HINT
5773
6287
  );
5774
6288
  }
5775
- if (text3 === void 0 || text3.trim() === "") {
6289
+ if (text4 === void 0 || text4.trim() === "") {
5776
6290
  return err(
5777
6291
  "edit",
5778
6292
  "INVALID_INPUT",
@@ -5780,11 +6294,11 @@ async function runEditProfile(name, text3, now = Date.now(), deps = terminalDeps
5780
6294
  `lnrelay edit ${name} "<text>"`
5781
6295
  );
5782
6296
  }
5783
- if (text3.length > field.maxLength) {
6297
+ if (text4.length > field.maxLength) {
5784
6298
  return err(
5785
6299
  "edit",
5786
6300
  "INVALID_INPUT",
5787
- `the ${name} is ${text3.length} characters; LinkedIn allows ${field.maxLength}`
6301
+ `the ${name} is ${text4.length} characters; LinkedIn allows ${field.maxLength}`
5788
6302
  );
5789
6303
  }
5790
6304
  const unapprovable = refuseUnapprovable("edit", "editing", deps);
@@ -5800,19 +6314,19 @@ async function runEditProfile(name, text3, now = Date.now(), deps = terminalDeps
5800
6314
  const form = await profile.open(field, me.vanity);
5801
6315
  if (!form.ok) return err("edit", form.code, form.message, form.hint);
5802
6316
  const was = currentValue(form, field) ?? "";
5803
- if (was === text3) {
6317
+ if (was === text4) {
5804
6318
  return err("edit", "INVALID_INPUT", `your ${name} already reads exactly that; nothing to save`);
5805
6319
  }
5806
- const built = saveBody(form, field, text3);
6320
+ const built = saveBody(form, field, text4);
5807
6321
  if (!built.ok) return err("edit", built.code, built.message, built.hint);
5808
6322
  const plan = {
5809
6323
  action: `change your ${name}`,
5810
- payload: { field: name, was, text: text3 },
6324
+ payload: { field: name, was, text: text4 },
5811
6325
  summary: [
5812
6326
  authorLine(ctx.transport),
5813
6327
  `field ${name}`,
5814
6328
  `was "${was}"`,
5815
- `new "${text3}"`
6329
+ `new "${text4}"`
5816
6330
  ],
5817
6331
  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.",
5818
6332
  transport: "voyager"
@@ -5823,7 +6337,7 @@ async function runEditProfile(name, text3, now = Date.now(), deps = terminalDeps
5823
6337
  if (!sent.ok) return err("edit", sent.code, sent.message, sent.hint);
5824
6338
  const after = await profile.open(field, me.vanity);
5825
6339
  const reads = after.ok ? currentValue(after, field) : void 0;
5826
- if (reads !== text3) {
6340
+ if (reads !== text4) {
5827
6341
  return err(
5828
6342
  "edit",
5829
6343
  "SCHEMA_DRIFT",
@@ -5862,8 +6376,8 @@ async function harvest(activityId, session, now) {
5862
6376
  if (!found.ok) return err("comment", "SCHEMA_DRIFT", found.message, found.hint);
5863
6377
  return { ok: true, tokens: { bindingKey: found.bindingKey, trackingId: found.trackingId } };
5864
6378
  }
5865
- async function runComment(postUrn2, text3, now = Date.now(), deps = terminalDeps()) {
5866
- if (postUrn2 === void 0 || text3 === void 0 || text3.trim() === "") {
6379
+ async function runComment(postUrn2, text4, now = Date.now(), deps = terminalDeps()) {
6380
+ if (postUrn2 === void 0 || text4 === void 0 || text4.trim() === "") {
5867
6381
  return err(
5868
6382
  "comment",
5869
6383
  "INVALID_INPUT",
@@ -5900,11 +6414,11 @@ async function runComment(postUrn2, text3, now = Date.now(), deps = terminalDeps
5900
6414
  if (!("tokens" in harvested)) return harvested;
5901
6415
  const plan = {
5902
6416
  action: "comment on a post",
5903
- payload: { activityId, text: text3, tokens: harvested.tokens },
6417
+ payload: { activityId, text: text4, tokens: harvested.tokens },
5904
6418
  // The harvested trackingId changes on every render, so --plan and --confirm
5905
6419
  // would never agree on a token derived from it. The intent is what's approved.
5906
- tokenBasis: { activityId, text: text3 },
5907
- summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text3}"`],
6420
+ tokenBasis: { activityId, text: text4 },
6421
+ summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text4}"`],
5908
6422
  reversibility: "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately",
5909
6423
  transport: "voyager"
5910
6424
  };
@@ -5916,8 +6430,8 @@ async function runComment(postUrn2, text3, now = Date.now(), deps = terminalDeps
5916
6430
  );
5917
6431
  return result.ok ? ok("comment", { on: postUrn2 }) : err("comment", result.code, result.message, result.hint);
5918
6432
  }
5919
- async function runEdit(commentUrn, text3, now = Date.now(), deps = terminalDeps()) {
5920
- if (commentUrn === void 0 || text3 === void 0 || text3.trim() === "") {
6433
+ async function runEdit(commentUrn, text4, now = Date.now(), deps = terminalDeps()) {
6434
+ if (commentUrn === void 0 || text4 === void 0 || text4.trim() === "") {
5921
6435
  return err(
5922
6436
  "edit",
5923
6437
  "INVALID_INPUT",
@@ -5927,11 +6441,11 @@ async function runEdit(commentUrn, text3, now = Date.now(), deps = terminalDeps(
5927
6441
  }
5928
6442
  const ref = parseCommentUrn(commentUrn);
5929
6443
  if (ref === null && !commentUrn.startsWith("urn:")) {
5930
- return runEditProfile(commentUrn, text3, now, deps);
6444
+ return runEditProfile(commentUrn, text4, now, deps);
5931
6445
  }
5932
6446
  if (ref === null) {
5933
6447
  if (/^urn:li:(share|ugcPost):\d+$/.test(commentUrn)) {
5934
- return runEditPost(commentUrn, text3, now, deps);
6448
+ return runEditPost(commentUrn, text4, now, deps);
5935
6449
  }
5936
6450
  return err(
5937
6451
  "edit",
@@ -5951,8 +6465,8 @@ async function runEdit(commentUrn, text3, now = Date.now(), deps = terminalDeps(
5951
6465
  if (!("tokens" in harvested)) return harvested;
5952
6466
  const plan = {
5953
6467
  action: "edit your comment",
5954
- payload: { urn: commentUrn, text: text3 },
5955
- summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text3}"`],
6468
+ payload: { urn: commentUrn, text: text4 },
6469
+ summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text4}"`],
5956
6470
  reversibility: "editable again, but the previous text is NOT recoverable here and LinkedIn marks the comment as edited",
5957
6471
  transport: "voyager"
5958
6472
  };
@@ -5963,7 +6477,7 @@ async function runEdit(commentUrn, text3, now = Date.now(), deps = terminalDeps(
5963
6477
  UPDATE_OP,
5964
6478
  harvested.tokens.trackingId,
5965
6479
  createLiveClient(ctx.transport.session),
5966
- text3
6480
+ text4
5967
6481
  );
5968
6482
  return result.ok ? ok("edit", { edited: commentUrn }) : err("edit", result.code, result.message, result.hint);
5969
6483
  }
@@ -6007,8 +6521,8 @@ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(),
6007
6521
  const result = await react(gated.confirmed, createLiveClient(ctx.transport.session));
6008
6522
  return result.ok ? ok("react", { id: result.id, removed: remove }) : err("react", result.code, result.message, result.hint);
6009
6523
  }
6010
- async function runReply(commentUrn, text3, now = Date.now(), deps = terminalDeps()) {
6011
- if (commentUrn === void 0 || text3 === void 0 || text3.trim() === "") {
6524
+ async function runReply(commentUrn, text4, now = Date.now(), deps = terminalDeps()) {
6525
+ if (commentUrn === void 0 || text4 === void 0 || text4.trim() === "") {
6012
6526
  return err(
6013
6527
  "reply",
6014
6528
  "INVALID_INPUT",
@@ -6034,8 +6548,8 @@ async function runReply(commentUrn, text3, now = Date.now(), deps = terminalDeps
6034
6548
  }
6035
6549
  const plan = {
6036
6550
  action: "reply to a comment",
6037
- payload: { ref: parent, text: text3 },
6038
- summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text3}"`],
6551
+ payload: { ref: parent, text: text4 },
6552
+ summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text4}"`],
6039
6553
  reversibility: "deletable with `lnrelay delete <the reply urn>`; the comment author is notified immediately",
6040
6554
  transport: "voyager"
6041
6555
  };
@@ -6307,7 +6821,7 @@ var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":
6307
6821
  var TEXT2 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
6308
6822
  function skillsFromPage(stream) {
6309
6823
  if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV2) && !stream.includes("isPartialPage")) {
6310
- return drift3("the skills page could not be read");
6824
+ return drift4("the skills page could not be read");
6311
6825
  }
6312
6826
  const skills = [];
6313
6827
  let from = 0;
@@ -6315,11 +6829,11 @@ function skillsFromPage(stream) {
6315
6829
  for (; ; ) {
6316
6830
  i = stream.indexOf(EDIT_NAV2, i);
6317
6831
  if (i === -1) break;
6318
- const text3 = balanced(stream, i);
6832
+ const text4 = balanced(stream, i);
6319
6833
  const end = i;
6320
6834
  i += EDIT_NAV2.length;
6321
- if (text3 === null) continue;
6322
- const payload = JSON.parse(text3).requestedArguments?.payload;
6835
+ if (text4 === null) continue;
6836
+ const payload = JSON.parse(text4).requestedArguments?.payload;
6323
6837
  const id = payload?.skillId;
6324
6838
  if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
6325
6839
  continue;
@@ -6327,7 +6841,7 @@ function skillsFromPage(stream) {
6327
6841
  (m) => JSON.parse(`"${m[1]}"`)
6328
6842
  );
6329
6843
  skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
6330
- from = end + text3.length;
6844
+ from = end + text4.length;
6331
6845
  }
6332
6846
  return { ok: true, skills };
6333
6847
  }
@@ -6351,11 +6865,11 @@ function pagerFrom(payload, start) {
6351
6865
  }
6352
6866
  function readSkillForm(stream) {
6353
6867
  const model = readModel(stream);
6354
- if (model === null) return drift3("the skill form carried no initial values");
6868
+ if (model === null) return drift4("the skill form carried no initial values");
6355
6869
  const save = findRequest(stream, SKILL.save);
6356
6870
  const del = findRequest(stream, SKILL.delete);
6357
6871
  if (save === null && del === null)
6358
- return drift3("the skill form carried neither a save nor a delete");
6872
+ return drift4("the skill form carried neither a save nor a delete");
6359
6873
  return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
6360
6874
  }
6361
6875
  var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
@@ -6367,10 +6881,10 @@ function skillNameOf(form) {
6367
6881
  function addSkillBody(form, name) {
6368
6882
  if (name.trim() === "")
6369
6883
  return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
6370
- if (form.save === null) return drift3("this form has no save action (it is not the add form)");
6884
+ if (form.save === null) return drift4("this form has no save action (it is not the add form)");
6371
6885
  const key = nameKey(form.model);
6372
6886
  const current = key === void 0 ? void 0 : form.model.get(key);
6373
- if (key === void 0 || current === void 0) return drift3("the skill form has no name field");
6887
+ if (key === void 0 || current === void 0) return drift4("the skill form has no name field");
6374
6888
  const model = new Map(form.model);
6375
6889
  model.set(key, { ...current, value: name.trim() });
6376
6890
  const states2 = wireStates(keysOf(form.save), model, () => void 0);
@@ -6379,7 +6893,7 @@ function addSkillBody(form, name) {
6379
6893
  }
6380
6894
  function removeSkillBody(form) {
6381
6895
  if (form.del === null)
6382
- return drift3("this form has no delete action (it is not an existing skill)");
6896
+ return drift4("this form has no delete action (it is not an existing skill)");
6383
6897
  const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
6384
6898
  if (!Array.isArray(states2)) return states2;
6385
6899
  return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
@@ -6396,9 +6910,9 @@ async function fetchSkills(vanityName, client) {
6396
6910
  if (typeof screen !== "string") return screen;
6397
6911
  const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
6398
6912
  const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
6399
- const text3 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
6400
- if (text3 === null) return drift3("the Skills screen carried no list request");
6401
- const payload = JSON.parse(text3);
6913
+ const text4 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
6914
+ if (text4 === null) return drift4("the Skills screen carried no list request");
6915
+ const payload = JSON.parse(text4);
6402
6916
  const count2 = typeof payload.count === "number" ? payload.count : 10;
6403
6917
  const skills = [];
6404
6918
  for (let page = 0; page < MAX_PAGES2; page++) {
@@ -6778,6 +7292,53 @@ function jobsRequest(args) {
6778
7292
  if (bool(args, "description")) req.description = true;
6779
7293
  return req;
6780
7294
  }
7295
+ function orgs(args, name) {
7296
+ return list(args, name).flatMap((v) => /^[\d,\s]+$/.test(v) ? v.split(",") : [v]).map((v) => v.trim()).filter((v) => v !== "");
7297
+ }
7298
+ function peopleRequest(args) {
7299
+ const filter = {};
7300
+ const network = many(args, "network");
7301
+ if (network.length > 0) filter.network = network;
7302
+ for (const [flag, key] of [
7303
+ ["company", "company"],
7304
+ ["past-company", "pastCompany"],
7305
+ ["school", "school"]
7306
+ ]) {
7307
+ const values = orgs(args, flag);
7308
+ if (values.length > 0) filter[key] = values;
7309
+ }
7310
+ for (const [flag, key] of [
7311
+ ["geo", "geo"],
7312
+ ["industry", "industry"],
7313
+ ["language", "language"],
7314
+ ["service", "service"]
7315
+ ]) {
7316
+ const values = many(args, flag);
7317
+ if (values.length > 0) filter[key] = values;
7318
+ }
7319
+ for (const [flag, key] of [
7320
+ ["connection-of", "connectionOf"],
7321
+ ["follower-of", "followerOf"],
7322
+ ["first-name", "firstName"],
7323
+ ["last-name", "lastName"],
7324
+ ["title", "title"],
7325
+ ["company-text", "companyText"],
7326
+ ["school-text", "schoolText"]
7327
+ ]) {
7328
+ const value = str(args, flag);
7329
+ if (value !== void 0) filter[key] = value;
7330
+ }
7331
+ if (bool(args, "open-to-volunteer")) filter.openToVolunteer = true;
7332
+ const raw = list(args, "filter");
7333
+ if (raw.length > 0) filter.raw = raw;
7334
+ const req = { limit: num(args, "limit") ?? 25, filter };
7335
+ if (args.positionals.length > 0) req.keywords = [...args.positionals];
7336
+ const location = str(args, "location");
7337
+ if (location !== void 0) req.location = location;
7338
+ const start = num(args, "start");
7339
+ if (start !== void 0) req.start = start;
7340
+ return req;
7341
+ }
6781
7342
  function via(args) {
6782
7343
  const value = str(args, "via");
6783
7344
  if (value === void 0) return void 0;
@@ -6894,6 +7455,10 @@ async function dispatch(argv, now) {
6894
7455
  return runJob(args.positionals, output(args));
6895
7456
  case "job-filters":
6896
7457
  return runJobFilters(jobsRequest(args), output(args));
7458
+ case "people":
7459
+ return runPeople(peopleRequest(args), output(args));
7460
+ case "people-filters":
7461
+ return runPeopleFilters(peopleRequest(args), output(args));
6897
7462
  case "search":
6898
7463
  if (args.positionals[0] === "jobs")
6899
7464
  return runJobs(
@@ -6956,13 +7521,13 @@ function edit(args, now, deps) {
6956
7521
  if (inline !== void 0) {
6957
7522
  return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
6958
7523
  }
6959
- let text3;
7524
+ let text4;
6960
7525
  try {
6961
- text3 = readFileSync3(file, "utf-8").replace(/\n$/, "");
7526
+ text4 = readFileSync3(file, "utf-8").replace(/\n$/, "");
6962
7527
  } catch {
6963
7528
  return err("edit", "INVALID_INPUT", `cannot read ${file}`);
6964
7529
  }
6965
- return runEdit(target, text3, now, deps);
7530
+ return runEdit(target, text4, now, deps);
6966
7531
  }
6967
7532
  function role(args, now, deps) {
6968
7533
  const [sub, target] = args.positionals;
@@ -7102,6 +7667,7 @@ function share3(args, now, deps) {
7102
7667
  }
7103
7668
  export {
7104
7669
  dispatch,
7105
- jobsRequest
7670
+ jobsRequest,
7671
+ peopleRequest
7106
7672
  };
7107
7673
  //# sourceMappingURL=cli.js.map