linkedin-relay-mcp 3.17.0 → 3.18.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/.claude/skills/linkedin-relay/SKILL.md +14 -1
- package/README.md +2 -1
- package/dist/cli.js +351 -111
- package/dist/cli.js.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +284 -39
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -572,12 +572,12 @@ var NAMESPACE_ALIASES = {
|
|
|
572
572
|
fs_profile: "fsd_profile"
|
|
573
573
|
};
|
|
574
574
|
function canonicalUrn(urn) {
|
|
575
|
-
const
|
|
576
|
-
const parts =
|
|
575
|
+
const inner2 = innerUrn(urn);
|
|
576
|
+
const parts = inner2.split(":");
|
|
577
577
|
const namespace = parts[2];
|
|
578
|
-
if (namespace === void 0) return
|
|
578
|
+
if (namespace === void 0) return inner2;
|
|
579
579
|
const alias = NAMESPACE_ALIASES[namespace];
|
|
580
|
-
if (alias === void 0) return
|
|
580
|
+
if (alias === void 0) return inner2;
|
|
581
581
|
parts[2] = alias;
|
|
582
582
|
return parts.join(":");
|
|
583
583
|
}
|
|
@@ -1908,8 +1908,8 @@ function activityIdSegment(activityId) {
|
|
|
1908
1908
|
if (!/^\d+$/.test(activityId)) {
|
|
1909
1909
|
throw new Error(`'${activityId}' is not a numeric activity id`);
|
|
1910
1910
|
}
|
|
1911
|
-
const
|
|
1912
|
-
const message = Uint8Array.from([10,
|
|
1911
|
+
const inner2 = [8, ...varint(zigzag(BigInt(activityId)))];
|
|
1912
|
+
const message = Uint8Array.from([10, inner2.length, ...inner2]);
|
|
1913
1913
|
return btoa(String.fromCharCode(...message)).replace(/=+$/, "");
|
|
1914
1914
|
}
|
|
1915
1915
|
function keyMatchesPost(bindingKey, activityId) {
|
|
@@ -2064,7 +2064,7 @@ async function fetchCommentMenu(ref, trackingId, client) {
|
|
|
2064
2064
|
const stream = result.classification.raw ?? "";
|
|
2065
2065
|
return { ok: true, stream };
|
|
2066
2066
|
}
|
|
2067
|
-
function textStates(payload,
|
|
2067
|
+
function textStates(payload, text6) {
|
|
2068
2068
|
const keyOf = (...names) => {
|
|
2069
2069
|
for (const n of names) {
|
|
2070
2070
|
const slot = payload[n];
|
|
@@ -2083,12 +2083,12 @@ function textStates(payload, text5) {
|
|
|
2083
2083
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
2084
2084
|
});
|
|
2085
2085
|
return [
|
|
2086
|
-
entry2(plain2,
|
|
2087
|
-
entry2(rich, { text:
|
|
2086
|
+
entry2(plain2, text6, "stringValue"),
|
|
2087
|
+
entry2(rich, { text: text6, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
|
|
2088
2088
|
];
|
|
2089
2089
|
}
|
|
2090
|
-
function editStates(payload,
|
|
2091
|
-
return textStates(payload,
|
|
2090
|
+
function editStates(payload, text6) {
|
|
2091
|
+
return textStates(payload, text6);
|
|
2092
2092
|
}
|
|
2093
2093
|
async function runCommentAction(ref, operation, trackingId, client, newText) {
|
|
2094
2094
|
const menu = await fetchCommentMenu(ref, trackingId, client);
|
|
@@ -2427,12 +2427,12 @@ var CATEGORY = {
|
|
|
2427
2427
|
VIDEO: "VIDEO",
|
|
2428
2428
|
DOCUMENT: "NATIVE_DOCUMENT"
|
|
2429
2429
|
};
|
|
2430
|
-
function sharePayload(
|
|
2430
|
+
function sharePayload(text6, visibility, media = [], scheduledAt) {
|
|
2431
2431
|
const schedule = scheduledAt === void 0 ? { postState: "PUBLISHED" } : { postState: "SCHEDULED", scheduledAt };
|
|
2432
2432
|
return {
|
|
2433
2433
|
visibleToConnectionsOnly: visibility === "CONNECTIONS",
|
|
2434
2434
|
externalAudienceProviders: [],
|
|
2435
|
-
commentaryV2: { text:
|
|
2435
|
+
commentaryV2: { text: text6, attributes: [] },
|
|
2436
2436
|
origin: "FEED",
|
|
2437
2437
|
allowedCommentersScope: "ALL",
|
|
2438
2438
|
...schedule,
|
|
@@ -2546,15 +2546,15 @@ async function share(confirmed, client, bytes) {
|
|
|
2546
2546
|
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."
|
|
2547
2547
|
} : { ok: true, id };
|
|
2548
2548
|
}
|
|
2549
|
-
function editPostBody(
|
|
2550
|
-
return { patch: { $set: { commentaryV2: { text:
|
|
2549
|
+
function editPostBody(text6) {
|
|
2550
|
+
return { patch: { $set: { commentaryV2: { text: text6, attributes: [] } } } };
|
|
2551
2551
|
}
|
|
2552
2552
|
async function editPost(confirmed, client) {
|
|
2553
|
-
const { urn, text:
|
|
2553
|
+
const { urn, text: text6 } = confirmed.payload;
|
|
2554
2554
|
const result = await client.request({
|
|
2555
2555
|
url: deleteUrl(urn),
|
|
2556
2556
|
method: "POST",
|
|
2557
|
-
body: editPostBody(
|
|
2557
|
+
body: editPostBody(text6),
|
|
2558
2558
|
spendClass: "write",
|
|
2559
2559
|
operation: "edit-post"
|
|
2560
2560
|
});
|
|
@@ -2564,7 +2564,7 @@ async function editPost(confirmed, client) {
|
|
|
2564
2564
|
return out;
|
|
2565
2565
|
}
|
|
2566
2566
|
const held = result.json?.data?.commentary?.text;
|
|
2567
|
-
if (held !==
|
|
2567
|
+
if (held !== text6) {
|
|
2568
2568
|
return {
|
|
2569
2569
|
ok: false,
|
|
2570
2570
|
code: "SCHEMA_DRIFT",
|
|
@@ -2625,8 +2625,8 @@ async function createPoll(poll, client) {
|
|
|
2625
2625
|
}
|
|
2626
2626
|
return { ok: true, urn };
|
|
2627
2627
|
}
|
|
2628
|
-
function firstUrl(
|
|
2629
|
-
const found =
|
|
2628
|
+
function firstUrl(text6) {
|
|
2629
|
+
const found = text6.match(/https?:\/\/[^\s<>"]+/)?.[0];
|
|
2630
2630
|
if (found === void 0) return null;
|
|
2631
2631
|
let url = found.replace(/[.,;:!?'"]+$/, "");
|
|
2632
2632
|
if (url.endsWith(")") && !url.includes("(")) url = url.slice(0, -1);
|
|
@@ -2790,8 +2790,8 @@ function previewLines2(post) {
|
|
|
2790
2790
|
" about to delete, or that it is yours."
|
|
2791
2791
|
];
|
|
2792
2792
|
}
|
|
2793
|
-
const
|
|
2794
|
-
const shown =
|
|
2793
|
+
const text6 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
|
|
2794
|
+
const shown = text6.length > PREVIEW_CHARS ? `${text6.slice(0, PREVIEW_CHARS)}\u2026` : text6;
|
|
2795
2795
|
const lines = [`content "${shown.replace(/\n/g, " ")}"`];
|
|
2796
2796
|
if (typeof post.scheduledAt === "string") {
|
|
2797
2797
|
lines.push(`status scheduled, publishes ${post.scheduledAt} unless cancelled`);
|
|
@@ -2958,10 +2958,10 @@ function balanced(s, start) {
|
|
|
2958
2958
|
return null;
|
|
2959
2959
|
}
|
|
2960
2960
|
function parseAt(s, start) {
|
|
2961
|
-
const
|
|
2962
|
-
if (
|
|
2961
|
+
const text6 = start < 0 ? null : balanced(s, start);
|
|
2962
|
+
if (text6 === null) return null;
|
|
2963
2963
|
try {
|
|
2964
|
-
return JSON.parse(
|
|
2964
|
+
return JSON.parse(text6);
|
|
2965
2965
|
} catch {
|
|
2966
2966
|
return null;
|
|
2967
2967
|
}
|
|
@@ -3292,13 +3292,13 @@ function readPost(rows, top, model) {
|
|
|
3292
3292
|
const subRow = sub === void 0 ? "" : rows.byId.get(sub.row) ?? "";
|
|
3293
3293
|
const posted = sub === void 0 ? void 0 : texts(subRow, subRow.indexOf('"viewName":"feed-actor-sub-description"'))[0];
|
|
3294
3294
|
const said = commentary === void 0 ? void 0 : firstIn(rows, commentary.under, (row) => texts(row)[0]);
|
|
3295
|
-
const
|
|
3295
|
+
const text6 = said?.v;
|
|
3296
3296
|
const post = {
|
|
3297
3297
|
id,
|
|
3298
3298
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
3299
3299
|
...author.fields,
|
|
3300
3300
|
...posted !== void 0 ? { posted } : {},
|
|
3301
|
-
...
|
|
3301
|
+
...text6 !== void 0 ? { text: text6 } : {},
|
|
3302
3302
|
...reactions !== void 0 ? { reactions } : {}
|
|
3303
3303
|
};
|
|
3304
3304
|
const comments = n(`commentCount-${id}`);
|
|
@@ -3703,8 +3703,8 @@ function cardToJob(card) {
|
|
|
3703
3703
|
const footer = Array.isArray(card.footerItems) ? card.footerItems : [];
|
|
3704
3704
|
const listed2 = footer.find((f) => f.type === "LISTED_DATE");
|
|
3705
3705
|
const insights = footer.filter((f) => !["LISTED_DATE", "PROMOTED", "EASY_APPLY_TEXT"].includes(String(f.type))).map((f) => text2(f.text)).filter((t) => t !== void 0);
|
|
3706
|
-
const
|
|
3707
|
-
if (
|
|
3706
|
+
const insight2 = text2(card.relevanceInsight?.text);
|
|
3707
|
+
if (insight2 !== void 0) insights.push(insight2);
|
|
3708
3708
|
return defined2({
|
|
3709
3709
|
id,
|
|
3710
3710
|
title,
|
|
@@ -5386,8 +5386,8 @@ function loadDrafts() {
|
|
|
5386
5386
|
};
|
|
5387
5387
|
return Array.isArray(loaded.value) ? loaded.value : [];
|
|
5388
5388
|
}
|
|
5389
|
-
async function runDraft(conversation,
|
|
5390
|
-
const body =
|
|
5389
|
+
async function runDraft(conversation, text6, fetch2, opts = {}) {
|
|
5390
|
+
const body = text6?.trim() ?? "";
|
|
5391
5391
|
if (body === "")
|
|
5392
5392
|
return err(
|
|
5393
5393
|
"draft",
|
|
@@ -5430,8 +5430,8 @@ async function runDraft(conversation, text5, fetch2, opts = {}) {
|
|
|
5430
5430
|
notice: "Saved on this machine only. Nothing was sent: open the link, review, and send it yourself."
|
|
5431
5431
|
});
|
|
5432
5432
|
}
|
|
5433
|
-
function draftText(
|
|
5434
|
-
return file !== void 0 ? readFileSync2(file, "utf-8") :
|
|
5433
|
+
function draftText(text6, file) {
|
|
5434
|
+
return file !== void 0 ? readFileSync2(file, "utf-8") : text6;
|
|
5435
5435
|
}
|
|
5436
5436
|
function runDrafts(opts = {}) {
|
|
5437
5437
|
const drafts = loadDrafts();
|
|
@@ -5463,6 +5463,225 @@ function runDraftRemove(id) {
|
|
|
5463
5463
|
return ok("draft", { removed: id });
|
|
5464
5464
|
}
|
|
5465
5465
|
|
|
5466
|
+
// src/engine/my-items.ts
|
|
5467
|
+
var ITEMS = {
|
|
5468
|
+
posts: "SEARCH_MY_ITEMS_SAVED_POSTS",
|
|
5469
|
+
learning: "SEARCH_MY_ITEMS_LEARNING",
|
|
5470
|
+
jobs: "SEARCH_MY_ITEMS_JOB_SEEKER"
|
|
5471
|
+
};
|
|
5472
|
+
var STAGES = {
|
|
5473
|
+
saved: "SAVED",
|
|
5474
|
+
"in-progress": "IN_PROGRESS",
|
|
5475
|
+
applied: "APPLIED",
|
|
5476
|
+
interview: "INTERVIEW",
|
|
5477
|
+
archived: "ARCHIVED"
|
|
5478
|
+
};
|
|
5479
|
+
var ITEMS_PAGE = 10;
|
|
5480
|
+
function itemsUrl(list2, q2) {
|
|
5481
|
+
const c = CONTRACTS.search;
|
|
5482
|
+
if (c?.queryId === void 0) throw new Error("the 'search' contract is missing");
|
|
5483
|
+
const variables = encodeVariables({
|
|
5484
|
+
start: q2.start,
|
|
5485
|
+
paginationToken: q2.token,
|
|
5486
|
+
query: {
|
|
5487
|
+
flagshipSearchIntent: ITEMS[list2],
|
|
5488
|
+
queryParameters: q2.stage !== void 0 ? [{ key: "cardType", value: [STAGES[q2.stage]] }] : void 0
|
|
5489
|
+
}
|
|
5490
|
+
});
|
|
5491
|
+
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
5492
|
+
}
|
|
5493
|
+
var text4 = (v) => {
|
|
5494
|
+
const t = v?.text;
|
|
5495
|
+
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
5496
|
+
};
|
|
5497
|
+
var inner = (urn) => String(urn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
|
|
5498
|
+
var clean = (url) => typeof url === "string" && url.startsWith("https://") ? url.split("?")[0] : void 0;
|
|
5499
|
+
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) => text4(i.simpleInsight?.title)).find((t) => t !== void 0);
|
|
5500
|
+
function defined5(obj) {
|
|
5501
|
+
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5502
|
+
return obj;
|
|
5503
|
+
}
|
|
5504
|
+
var WORKPLACE = {
|
|
5505
|
+
remote: "remote",
|
|
5506
|
+
hybrid: "hybrid",
|
|
5507
|
+
"on-site": "on-site"
|
|
5508
|
+
};
|
|
5509
|
+
function postRow(row) {
|
|
5510
|
+
const id = inner(row.entityUrn);
|
|
5511
|
+
if (id === void 0 || !/^urn:li:(activity|ugcPost|share):/.test(id)) return void 0;
|
|
5512
|
+
const posted = text4(row.secondarySubtitle)?.replace(/\s*•\s*$/, "");
|
|
5513
|
+
return defined5({
|
|
5514
|
+
id,
|
|
5515
|
+
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
5516
|
+
author: text4(row.title),
|
|
5517
|
+
authorHeadline: text4(row.primarySubtitle),
|
|
5518
|
+
posted,
|
|
5519
|
+
text: text4(row.summary)
|
|
5520
|
+
});
|
|
5521
|
+
}
|
|
5522
|
+
function courseRow(row) {
|
|
5523
|
+
const id = inner(row.entityUrn)?.split(":").pop();
|
|
5524
|
+
const name = text4(row.title);
|
|
5525
|
+
if (id === void 0 || name === void 0) return void 0;
|
|
5526
|
+
return defined5({
|
|
5527
|
+
id,
|
|
5528
|
+
name,
|
|
5529
|
+
length: text4(row.primarySubtitle),
|
|
5530
|
+
detail: text4(row.secondarySubtitle),
|
|
5531
|
+
progress: text4(row.summary),
|
|
5532
|
+
url: clean(row.navigationUrl)
|
|
5533
|
+
});
|
|
5534
|
+
}
|
|
5535
|
+
function jobRow(row, stage) {
|
|
5536
|
+
const id = inner(row.entityUrn)?.split(":").pop();
|
|
5537
|
+
const title = text4(row.title);
|
|
5538
|
+
if (id === void 0 || title === void 0) return void 0;
|
|
5539
|
+
const place = text4(row.secondarySubtitle);
|
|
5540
|
+
const m = place?.match(/^(.*?)\s*\(([^()]+)\)$/);
|
|
5541
|
+
const workplace = m?.[2] === void 0 ? void 0 : WORKPLACE[m[2].toLowerCase()];
|
|
5542
|
+
return defined5({
|
|
5543
|
+
id,
|
|
5544
|
+
title,
|
|
5545
|
+
company: text4(row.primarySubtitle),
|
|
5546
|
+
location: workplace !== void 0 ? m?.[1] : place,
|
|
5547
|
+
workplace,
|
|
5548
|
+
stage,
|
|
5549
|
+
note: insight(row),
|
|
5550
|
+
url: `https://www.linkedin.com/jobs/view/${id}/`
|
|
5551
|
+
});
|
|
5552
|
+
}
|
|
5553
|
+
function parseItems(list2, json, stage) {
|
|
5554
|
+
const c = clustersOf(json);
|
|
5555
|
+
if (c === void 0 || !Array.isArray(c.elements))
|
|
5556
|
+
return { ok: false, code: "SCHEMA_DRIFT", message: "the My items list was missing" };
|
|
5557
|
+
const included = json.included ?? [];
|
|
5558
|
+
const toRow = (row) => list2 === "posts" ? postRow(row) : list2 === "learning" ? courseRow(row) : jobRow(row, stage);
|
|
5559
|
+
const { people: items, unresolved } = readItems(
|
|
5560
|
+
c,
|
|
5561
|
+
included,
|
|
5562
|
+
toRow
|
|
5563
|
+
);
|
|
5564
|
+
if (unresolved > 0 && items.length === 0)
|
|
5565
|
+
return {
|
|
5566
|
+
ok: false,
|
|
5567
|
+
code: "SCHEMA_DRIFT",
|
|
5568
|
+
message: `${unresolved} items were listed but none could be read`
|
|
5569
|
+
};
|
|
5570
|
+
const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
|
|
5571
|
+
const token = c.metadata?.paginationToken;
|
|
5572
|
+
return {
|
|
5573
|
+
ok: true,
|
|
5574
|
+
items,
|
|
5575
|
+
...total !== void 0 ? { total } : {},
|
|
5576
|
+
...typeof token === "string" && token !== "" ? { token } : {}
|
|
5577
|
+
};
|
|
5578
|
+
}
|
|
5579
|
+
|
|
5580
|
+
// src/commands/my-items.ts
|
|
5581
|
+
function liveFetch4(quiet) {
|
|
5582
|
+
const session = loadSession();
|
|
5583
|
+
if (session.state !== "ok")
|
|
5584
|
+
return err("my-items", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
5585
|
+
const client = createLiveClient(session.session, void 0, quiet);
|
|
5586
|
+
return async (url, spendClass) => {
|
|
5587
|
+
const r = await client.request({ url, spendClass, operation: "my-items" });
|
|
5588
|
+
return r.ok ? { ok: true, json: r.json } : r;
|
|
5589
|
+
};
|
|
5590
|
+
}
|
|
5591
|
+
async function collect2(get, list2, want, stage) {
|
|
5592
|
+
const items = [];
|
|
5593
|
+
let token;
|
|
5594
|
+
for (let start = 0; items.length < want; start += ITEMS_PAGE) {
|
|
5595
|
+
const res = await get(
|
|
5596
|
+
itemsUrl(list2, { start, ...stage ? { stage } : {}, ...token ? { token } : {} }),
|
|
5597
|
+
"page"
|
|
5598
|
+
);
|
|
5599
|
+
const page = res.ok ? parseItems(list2, res.json, stage) : res;
|
|
5600
|
+
if (!page.ok)
|
|
5601
|
+
return items.length === 0 ? page : { items, complete: false, stoppedBy: page.code };
|
|
5602
|
+
const room = want - items.length;
|
|
5603
|
+
items.push(...page.items.slice(0, room));
|
|
5604
|
+
if (page.items.length > room) return { items, complete: false };
|
|
5605
|
+
const last = page.items.length < ITEMS_PAGE || page.total !== void 0 && start + ITEMS_PAGE >= page.total;
|
|
5606
|
+
if (last) return { items, complete: true };
|
|
5607
|
+
token = page.token;
|
|
5608
|
+
}
|
|
5609
|
+
return { items, complete: false };
|
|
5610
|
+
}
|
|
5611
|
+
function compactRow(r) {
|
|
5612
|
+
return line(
|
|
5613
|
+
[
|
|
5614
|
+
r.id,
|
|
5615
|
+
r.title ?? r.name ?? r.author,
|
|
5616
|
+
r.company ?? r.length ?? r.authorHeadline,
|
|
5617
|
+
r.location ?? r.detail ?? r.posted,
|
|
5618
|
+
r.workplace,
|
|
5619
|
+
r.stage,
|
|
5620
|
+
r.note ?? r.progress,
|
|
5621
|
+
typeof r.text === "string" ? r.text.replace(/\s+/g, " ").slice(0, 140) : void 0,
|
|
5622
|
+
r.url
|
|
5623
|
+
].map((x) => typeof x === "string" ? x : void 0)
|
|
5624
|
+
);
|
|
5625
|
+
}
|
|
5626
|
+
async function collectStages(get, which, want, stages) {
|
|
5627
|
+
const out = { items: [], byStage: {}, complete: true };
|
|
5628
|
+
let failure;
|
|
5629
|
+
for (const stage of stages) {
|
|
5630
|
+
const got = await collect2(get, which, want - out.items.length, stage);
|
|
5631
|
+
if ("ok" in got) {
|
|
5632
|
+
failure = failure ?? got;
|
|
5633
|
+
out.complete = false;
|
|
5634
|
+
out.stoppedBy = got.code;
|
|
5635
|
+
continue;
|
|
5636
|
+
}
|
|
5637
|
+
out.items.push(...got.items);
|
|
5638
|
+
if (stage !== void 0) out.byStage[stage] = got.items.length;
|
|
5639
|
+
out.complete &&= got.complete;
|
|
5640
|
+
if (got.stoppedBy !== void 0) out.stoppedBy = got.stoppedBy;
|
|
5641
|
+
if (out.items.length >= want) break;
|
|
5642
|
+
}
|
|
5643
|
+
if (out.items.length === 0 && failure !== void 0) return { failure };
|
|
5644
|
+
return out;
|
|
5645
|
+
}
|
|
5646
|
+
async function runMyItems(list2, req, opts = {}, fetch2) {
|
|
5647
|
+
if (list2 === void 0 || !(list2 in ITEMS))
|
|
5648
|
+
return err(
|
|
5649
|
+
"my-items",
|
|
5650
|
+
"INVALID_INPUT",
|
|
5651
|
+
`no list '${list2 ?? ""}'`,
|
|
5652
|
+
`one of: ${Object.keys(ITEMS).join(", ")}`
|
|
5653
|
+
);
|
|
5654
|
+
if (req.stage !== void 0 && !(req.stage in STAGES))
|
|
5655
|
+
return err(
|
|
5656
|
+
"my-items",
|
|
5657
|
+
"INVALID_INPUT",
|
|
5658
|
+
`no stage '${req.stage}'`,
|
|
5659
|
+
`one of: ${Object.keys(STAGES).join(", ")}`
|
|
5660
|
+
);
|
|
5661
|
+
const get = fetch2 ?? liveFetch4(opts.quiet === true);
|
|
5662
|
+
if (typeof get !== "function") return get;
|
|
5663
|
+
const want = Math.max(1, req.limit);
|
|
5664
|
+
const which = list2;
|
|
5665
|
+
const stages = which === "jobs" ? req.stage !== void 0 ? [req.stage] : Object.keys(STAGES) : [void 0];
|
|
5666
|
+
const got = await collectStages(get, which, want, stages);
|
|
5667
|
+
if ("failure" in got) {
|
|
5668
|
+
const f = got.failure;
|
|
5669
|
+
return err("my-items", f.code, f.message, f.hint);
|
|
5670
|
+
}
|
|
5671
|
+
const { items, byStage, complete, stoppedBy } = got;
|
|
5672
|
+
return ok("my-items", {
|
|
5673
|
+
list: which,
|
|
5674
|
+
items: shape(items, opts, compactRow),
|
|
5675
|
+
meta: {
|
|
5676
|
+
state: complete && stoppedBy === void 0 ? "complete" : "partial",
|
|
5677
|
+
operation: `my-items ${which}`,
|
|
5678
|
+
returnedCount: items.length,
|
|
5679
|
+
...which === "jobs" && req.stage === void 0 ? { byStage } : {},
|
|
5680
|
+
...stoppedBy !== void 0 ? { stoppedBy } : {}
|
|
5681
|
+
}
|
|
5682
|
+
});
|
|
5683
|
+
}
|
|
5684
|
+
|
|
5466
5685
|
// src/engine/search.ts
|
|
5467
5686
|
var SEARCH_KINDS = {
|
|
5468
5687
|
companies: "COMPANIES",
|
|
@@ -5483,13 +5702,13 @@ function searchUrl(q2) {
|
|
|
5483
5702
|
kind: SEARCH_KINDS[q2.kind]
|
|
5484
5703
|
});
|
|
5485
5704
|
}
|
|
5486
|
-
var
|
|
5705
|
+
var text5 = (v) => {
|
|
5487
5706
|
const t = v?.text;
|
|
5488
5707
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
5489
5708
|
};
|
|
5490
5709
|
function idOf(entityUrn) {
|
|
5491
|
-
const
|
|
5492
|
-
return
|
|
5710
|
+
const inner2 = String(entityUrn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
|
|
5711
|
+
return inner2?.split(":").pop();
|
|
5493
5712
|
}
|
|
5494
5713
|
function cleanUrl2(nav) {
|
|
5495
5714
|
if (typeof nav !== "string" || !nav.startsWith("https://")) return void 0;
|
|
@@ -5497,13 +5716,13 @@ function cleanUrl2(nav) {
|
|
|
5497
5716
|
}
|
|
5498
5717
|
function rowToFound(row) {
|
|
5499
5718
|
const id = idOf(row.entityUrn);
|
|
5500
|
-
const name =
|
|
5719
|
+
const name = text5(row.title);
|
|
5501
5720
|
if (id === void 0 || name === void 0) return void 0;
|
|
5502
5721
|
const found = { id, name };
|
|
5503
5722
|
const fields = [
|
|
5504
|
-
["subtitle",
|
|
5505
|
-
["detail",
|
|
5506
|
-
["summary",
|
|
5723
|
+
["subtitle", text5(row.primarySubtitle)],
|
|
5724
|
+
["detail", text5(row.secondarySubtitle)],
|
|
5725
|
+
["summary", text5(row.summary)],
|
|
5507
5726
|
["url", cleanUrl2(row.navigationUrl)]
|
|
5508
5727
|
];
|
|
5509
5728
|
for (const [k, v] of fields)
|
|
@@ -5630,7 +5849,7 @@ function parseSentInvitations(json) {
|
|
|
5630
5849
|
}
|
|
5631
5850
|
|
|
5632
5851
|
// src/commands/network.ts
|
|
5633
|
-
function
|
|
5852
|
+
function liveFetch5(quiet) {
|
|
5634
5853
|
const session = loadSession();
|
|
5635
5854
|
if (session.state !== "ok")
|
|
5636
5855
|
return err("network", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
@@ -5643,7 +5862,7 @@ function liveFetch4(quiet) {
|
|
|
5643
5862
|
var LISTS = [...Object.keys(HUB), "invitations"];
|
|
5644
5863
|
var PAGING3 = { pageSize: HUB_PAGE, max: 1e3 };
|
|
5645
5864
|
var INVITATIONS_PAGE = 10;
|
|
5646
|
-
function
|
|
5865
|
+
function compactRow2(r) {
|
|
5647
5866
|
const p = r;
|
|
5648
5867
|
return line([p.id, p.name, p.headline ?? p.subtitle, p.location ?? p.detail, p.degree, p.url]);
|
|
5649
5868
|
}
|
|
@@ -5703,7 +5922,7 @@ async function runNetwork(list2, req, opts = {}, fetch2) {
|
|
|
5703
5922
|
`one of: ${LISTS.join(", ")} \u2014 or none, for the counts`
|
|
5704
5923
|
);
|
|
5705
5924
|
}
|
|
5706
|
-
const get = fetch2 ??
|
|
5925
|
+
const get = fetch2 ?? liveFetch5(opts.quiet === true);
|
|
5707
5926
|
if (typeof get !== "function") return get;
|
|
5708
5927
|
if (list2 === void 0) {
|
|
5709
5928
|
const c = await counts(get);
|
|
@@ -5737,7 +5956,7 @@ async function runNetwork(list2, req, opts = {}, fetch2) {
|
|
|
5737
5956
|
}
|
|
5738
5957
|
return ok("network", {
|
|
5739
5958
|
list: hub,
|
|
5740
|
-
items: shape(merged.rows, opts,
|
|
5959
|
+
items: shape(merged.rows, opts, compactRow2),
|
|
5741
5960
|
meta: metaOf(`network ${hub}`, merged, true, first)
|
|
5742
5961
|
});
|
|
5743
5962
|
}
|
|
@@ -5782,18 +6001,18 @@ async function exchange(code, config, deps) {
|
|
|
5782
6001
|
} catch (e) {
|
|
5783
6002
|
return { ok: false, message: `could not reach LinkedIn: ${e.message}` };
|
|
5784
6003
|
}
|
|
5785
|
-
const
|
|
6004
|
+
const text6 = await res.text();
|
|
5786
6005
|
if (res.status !== 200) {
|
|
5787
6006
|
return {
|
|
5788
6007
|
ok: false,
|
|
5789
6008
|
message: `LinkedIn rejected the code exchange (${res.status})`,
|
|
5790
6009
|
// The most common causes, in the order they actually happen.
|
|
5791
|
-
hint: `Check that the app has BOTH products added, and that its Auth tab lists exactly ${REDIRECT_URI} as an authorized redirect URL. Response: ${
|
|
6010
|
+
hint: `Check that the app has BOTH products added, and that its Auth tab lists exactly ${REDIRECT_URI} as an authorized redirect URL. Response: ${text6.slice(0, 200)}`
|
|
5792
6011
|
};
|
|
5793
6012
|
}
|
|
5794
6013
|
let parsed;
|
|
5795
6014
|
try {
|
|
5796
|
-
parsed = JSON.parse(
|
|
6015
|
+
parsed = JSON.parse(text6);
|
|
5797
6016
|
} catch {
|
|
5798
6017
|
return { ok: false, message: "token response was not JSON" };
|
|
5799
6018
|
}
|
|
@@ -6027,7 +6246,7 @@ function runOauthStatus() {
|
|
|
6027
6246
|
}
|
|
6028
6247
|
|
|
6029
6248
|
// src/commands/posts-search.ts
|
|
6030
|
-
function
|
|
6249
|
+
function liveFetch6(quiet) {
|
|
6031
6250
|
const session = loadSession();
|
|
6032
6251
|
if (session.state !== "ok")
|
|
6033
6252
|
return err("search posts", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
@@ -6159,13 +6378,13 @@ function compactPost(p) {
|
|
|
6159
6378
|
p.comments !== void 0 ? `${p.comments} comments` : void 0,
|
|
6160
6379
|
p.reposts !== void 0 ? `${p.reposts} reposts` : void 0
|
|
6161
6380
|
].filter(Boolean);
|
|
6162
|
-
const
|
|
6381
|
+
const text6 = p.text?.replace(/\s+/g, " ");
|
|
6163
6382
|
return line([
|
|
6164
6383
|
p.id,
|
|
6165
6384
|
p.author,
|
|
6166
6385
|
p.posted,
|
|
6167
6386
|
counts2.length > 0 ? counts2.join(" \xB7 ") : void 0,
|
|
6168
|
-
|
|
6387
|
+
text6 !== void 0 && text6.length > 160 ? `${text6.slice(0, 157)}\u2026` : text6,
|
|
6169
6388
|
p.url,
|
|
6170
6389
|
p.matched !== void 0 ? `matched: ${p.matched.join(" + ")}` : void 0
|
|
6171
6390
|
]);
|
|
@@ -6183,7 +6402,7 @@ async function runPostsSearch(req, opts = {}, fetch2) {
|
|
|
6183
6402
|
"give keywords, a filter, or both",
|
|
6184
6403
|
'lnrelay search posts "<keywords>"'
|
|
6185
6404
|
);
|
|
6186
|
-
const get = fetch2 ??
|
|
6405
|
+
const get = fetch2 ?? liveFetch6(opts.quiet === true);
|
|
6187
6406
|
if (typeof get !== "function") return get;
|
|
6188
6407
|
const f = await filtersOf(req, get);
|
|
6189
6408
|
if ("ok" in f) return err(command, f.code, f.message, f.hint);
|
|
@@ -6414,6 +6633,15 @@ var COMMANDS = [
|
|
|
6414
6633
|
risk: "read",
|
|
6415
6634
|
implemented: true
|
|
6416
6635
|
},
|
|
6636
|
+
{
|
|
6637
|
+
name: "my-items",
|
|
6638
|
+
cost: "1 page call per 10 items; jobs with no --stage read all 5 stages",
|
|
6639
|
+
summary: "Your My items: saved posts, LinkedIn Learning courses, and the job tracker (saved, in progress, applied, interview, archived).",
|
|
6640
|
+
usage: "lnrelay my-items posts|learning|jobs [--stage saved|in-progress|applied|interview|archived]\n [--limit N] [--compact | --fields a,b,c]",
|
|
6641
|
+
audience: ["cli", "mcp"],
|
|
6642
|
+
risk: "read",
|
|
6643
|
+
implemented: true
|
|
6644
|
+
},
|
|
6417
6645
|
{
|
|
6418
6646
|
name: "events",
|
|
6419
6647
|
cost: "1 page call",
|
|
@@ -6786,10 +7014,10 @@ function listPositions(stream) {
|
|
|
6786
7014
|
for (; ; ) {
|
|
6787
7015
|
i = stream.indexOf(EDIT_NAV, i);
|
|
6788
7016
|
if (i === -1) break;
|
|
6789
|
-
const
|
|
7017
|
+
const text6 = balanced(stream, i);
|
|
6790
7018
|
i += EDIT_NAV.length;
|
|
6791
|
-
if (
|
|
6792
|
-
const payload = JSON.parse(
|
|
7019
|
+
if (text6 === null) continue;
|
|
7020
|
+
const payload = JSON.parse(text6).requestedArguments?.payload;
|
|
6793
7021
|
const id = payload?.positionId;
|
|
6794
7022
|
if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
|
|
6795
7023
|
seen.add(id);
|
|
@@ -6992,9 +7220,9 @@ async function send(url, body, token, deps) {
|
|
|
6992
7220
|
} catch (e) {
|
|
6993
7221
|
return { ok: false, code: "FETCH_FAILED", message: e.message };
|
|
6994
7222
|
}
|
|
6995
|
-
const
|
|
7223
|
+
const text6 = await res.text();
|
|
6996
7224
|
if (res.status === 201 || res.status === 200) {
|
|
6997
|
-
const id = res.headers.get("x-restli-id") ?? extractId(
|
|
7225
|
+
const id = res.headers.get("x-restli-id") ?? extractId(text6);
|
|
6998
7226
|
return {
|
|
6999
7227
|
ok: true,
|
|
7000
7228
|
id: id ?? "(unknown)",
|
|
@@ -7021,7 +7249,7 @@ async function send(url, body, token, deps) {
|
|
|
7021
7249
|
ok: false,
|
|
7022
7250
|
code: "FETCH_FAILED",
|
|
7023
7251
|
message: `write failed (${res.status})`,
|
|
7024
|
-
hint:
|
|
7252
|
+
hint: text6.slice(0, 300)
|
|
7025
7253
|
};
|
|
7026
7254
|
}
|
|
7027
7255
|
function extractId(body) {
|
|
@@ -7069,7 +7297,7 @@ function feedTypeFor(bindingKey) {
|
|
|
7069
7297
|
function stateKey(prefix, body) {
|
|
7070
7298
|
return `${prefix}-${body}`;
|
|
7071
7299
|
}
|
|
7072
|
-
function states(
|
|
7300
|
+
function states(text6, body) {
|
|
7073
7301
|
return STATE_PREFIXES.map((prefix) => {
|
|
7074
7302
|
const key = stateKey(prefix, body);
|
|
7075
7303
|
const base = {
|
|
@@ -7078,19 +7306,19 @@ function states(text5, body) {
|
|
|
7078
7306
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
7079
7307
|
};
|
|
7080
7308
|
if (prefix === "commentBoxText") {
|
|
7081
|
-
return { ...base, value:
|
|
7309
|
+
return { ...base, value: text6, originalProtoCase: "stringValue" };
|
|
7082
7310
|
}
|
|
7083
7311
|
if (prefix === "richCommentBoxText") {
|
|
7084
7312
|
return {
|
|
7085
7313
|
...base,
|
|
7086
|
-
value: { text:
|
|
7314
|
+
value: { text: text6, attribute: [], $type: "TextModel", source: "local" },
|
|
7087
7315
|
originalProtoCase: "textModelForWrite"
|
|
7088
7316
|
};
|
|
7089
7317
|
}
|
|
7090
7318
|
return { ...base, value: "", originalProtoCase: "stringValue" };
|
|
7091
7319
|
});
|
|
7092
7320
|
}
|
|
7093
|
-
function commentBody(activityId,
|
|
7321
|
+
function commentBody(activityId, text6, tokens, feedType) {
|
|
7094
7322
|
const body = keyBody(tokens.bindingKey);
|
|
7095
7323
|
const activityUrn = { activityUrn: { activityId } };
|
|
7096
7324
|
const binding = (prefix) => ({
|
|
@@ -7137,17 +7365,17 @@ function commentBody(activityId, text5, tokens, feedType) {
|
|
|
7137
7365
|
isStreaming: false,
|
|
7138
7366
|
rumPageKey: ""
|
|
7139
7367
|
},
|
|
7140
|
-
states: states(
|
|
7368
|
+
states: states(text6, body),
|
|
7141
7369
|
requestedArguments: {
|
|
7142
7370
|
...args,
|
|
7143
|
-
states: states(
|
|
7371
|
+
states: states(text6, body),
|
|
7144
7372
|
screenId: SCREEN_ID3,
|
|
7145
7373
|
knownTemplateIds: []
|
|
7146
7374
|
}
|
|
7147
7375
|
};
|
|
7148
7376
|
}
|
|
7149
7377
|
async function comment(confirmed, client) {
|
|
7150
|
-
const { activityId, text:
|
|
7378
|
+
const { activityId, text: text6, tokens } = confirmed.payload;
|
|
7151
7379
|
if (!keyMatchesPost(tokens.bindingKey, activityId)) {
|
|
7152
7380
|
return {
|
|
7153
7381
|
ok: false,
|
|
@@ -7168,7 +7396,7 @@ async function comment(confirmed, client) {
|
|
|
7168
7396
|
const result = await client.request({
|
|
7169
7397
|
url: COMMENT_URL,
|
|
7170
7398
|
method: "POST",
|
|
7171
|
-
body: commentBody(activityId,
|
|
7399
|
+
body: commentBody(activityId, text6, tokens, feedType),
|
|
7172
7400
|
spendClass: "write",
|
|
7173
7401
|
operation: "comment.create"
|
|
7174
7402
|
});
|
|
@@ -7292,10 +7520,10 @@ var REPLY_URL = `https://www.linkedin.com/voyager/api/voyagerSocialDashNormComme
|
|
|
7292
7520
|
function parentThreadUrn(ref) {
|
|
7293
7521
|
return `urn:li:comment:(${ref.threadType}:${ref.activityId},${ref.commentId})`;
|
|
7294
7522
|
}
|
|
7295
|
-
function replyBody(ref,
|
|
7523
|
+
function replyBody(ref, text6) {
|
|
7296
7524
|
return {
|
|
7297
7525
|
commentary: {
|
|
7298
|
-
text:
|
|
7526
|
+
text: text6,
|
|
7299
7527
|
// The captured reply carried a profileMention, because LinkedIn's UI
|
|
7300
7528
|
// pre-fills "@Author " into the box. We send none: an @mention notifies a
|
|
7301
7529
|
// real person, and inventing one would put words — and a notification —
|
|
@@ -7307,11 +7535,11 @@ function replyBody(ref, text5) {
|
|
|
7307
7535
|
};
|
|
7308
7536
|
}
|
|
7309
7537
|
async function replyToComment(confirmed, client) {
|
|
7310
|
-
const { ref, text:
|
|
7538
|
+
const { ref, text: text6 } = confirmed.payload;
|
|
7311
7539
|
const result = await client.request({
|
|
7312
7540
|
url: REPLY_URL,
|
|
7313
7541
|
method: "POST",
|
|
7314
|
-
body: replyBody(ref,
|
|
7542
|
+
body: replyBody(ref, text6),
|
|
7315
7543
|
spendClass: "write",
|
|
7316
7544
|
operation: "reply"
|
|
7317
7545
|
});
|
|
@@ -7673,8 +7901,8 @@ function whenLine(at, now) {
|
|
|
7673
7901
|
const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
|
|
7674
7902
|
return `when ${local} (${zone}) \u2014 ${away}`;
|
|
7675
7903
|
}
|
|
7676
|
-
async function runShare(
|
|
7677
|
-
if (
|
|
7904
|
+
async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
|
|
7905
|
+
if (text6 === void 0 || text6.trim() === "") {
|
|
7678
7906
|
return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
|
|
7679
7907
|
}
|
|
7680
7908
|
const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
|
|
@@ -7689,7 +7917,7 @@ async function runShare(text5, visibility, now = Date.now(), deps = terminalDeps
|
|
|
7689
7917
|
via: via2
|
|
7690
7918
|
});
|
|
7691
7919
|
if (pollSpec !== void 0 && "ok" in pollSpec) return pollSpec;
|
|
7692
|
-
const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(
|
|
7920
|
+
const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text6) : null;
|
|
7693
7921
|
const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
|
|
7694
7922
|
const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
|
|
7695
7923
|
if ("ok" in ctx) return ctx;
|
|
@@ -7698,7 +7926,7 @@ async function runShare(text5, visibility, now = Date.now(), deps = terminalDeps
|
|
|
7698
7926
|
const plan = sharePlan({
|
|
7699
7927
|
author: authorLine(ctx.transport),
|
|
7700
7928
|
transport: ctx.transport.kind,
|
|
7701
|
-
text:
|
|
7929
|
+
text: text6,
|
|
7702
7930
|
visibility: vis,
|
|
7703
7931
|
media: loaded?.approved,
|
|
7704
7932
|
scheduledAt,
|
|
@@ -7721,7 +7949,7 @@ async function runShare(text5, visibility, now = Date.now(), deps = terminalDeps
|
|
|
7721
7949
|
note: "note" in result ? result.note : ctx.note
|
|
7722
7950
|
});
|
|
7723
7951
|
}
|
|
7724
|
-
async function runEditPost(urn,
|
|
7952
|
+
async function runEditPost(urn, text6, now, deps) {
|
|
7725
7953
|
const unapprovable = refuseUnapprovable("edit", "editing", deps);
|
|
7726
7954
|
if (unapprovable !== null) return unapprovable;
|
|
7727
7955
|
const ctx = prepare("edit", now, "voyager");
|
|
@@ -7736,12 +7964,12 @@ async function runEditPost(urn, text5, now, deps) {
|
|
|
7736
7964
|
const before = await lookup(urn, true);
|
|
7737
7965
|
const plan = {
|
|
7738
7966
|
action: "edit your post",
|
|
7739
|
-
payload: { urn, text:
|
|
7967
|
+
payload: { urn, text: text6 },
|
|
7740
7968
|
summary: [
|
|
7741
7969
|
authorLine(ctx.transport),
|
|
7742
7970
|
`post ${urn}`,
|
|
7743
7971
|
...previewLines2(before).map((l) => l.replace(/^content /, "was ")),
|
|
7744
|
-
`new text "${
|
|
7972
|
+
`new text "${text6}"`
|
|
7745
7973
|
],
|
|
7746
7974
|
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",
|
|
7747
7975
|
transport: "voyager"
|
|
@@ -7765,7 +7993,7 @@ function liveProfile(session) {
|
|
|
7765
7993
|
};
|
|
7766
7994
|
}
|
|
7767
7995
|
var PROFILE_HINT = `profile fields: ${Object.keys(PROFILE_FIELDS).join(", ")}`;
|
|
7768
|
-
async function runEditProfile(name,
|
|
7996
|
+
async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps(), surface) {
|
|
7769
7997
|
const field = PROFILE_FIELDS[name];
|
|
7770
7998
|
if (field === void 0) {
|
|
7771
7999
|
return err(
|
|
@@ -7775,7 +8003,7 @@ async function runEditProfile(name, text5, now = Date.now(), deps = terminalDeps
|
|
|
7775
8003
|
PROFILE_HINT
|
|
7776
8004
|
);
|
|
7777
8005
|
}
|
|
7778
|
-
if (
|
|
8006
|
+
if (text6 === void 0 || text6.trim() === "") {
|
|
7779
8007
|
return err(
|
|
7780
8008
|
"edit",
|
|
7781
8009
|
"INVALID_INPUT",
|
|
@@ -7783,11 +8011,11 @@ async function runEditProfile(name, text5, now = Date.now(), deps = terminalDeps
|
|
|
7783
8011
|
`lnrelay edit ${name} "<text>"`
|
|
7784
8012
|
);
|
|
7785
8013
|
}
|
|
7786
|
-
if (
|
|
8014
|
+
if (text6.length > field.maxLength) {
|
|
7787
8015
|
return err(
|
|
7788
8016
|
"edit",
|
|
7789
8017
|
"INVALID_INPUT",
|
|
7790
|
-
`the ${name} is ${
|
|
8018
|
+
`the ${name} is ${text6.length} characters; LinkedIn allows ${field.maxLength}`
|
|
7791
8019
|
);
|
|
7792
8020
|
}
|
|
7793
8021
|
const unapprovable = refuseUnapprovable("edit", "editing", deps);
|
|
@@ -7803,19 +8031,19 @@ async function runEditProfile(name, text5, now = Date.now(), deps = terminalDeps
|
|
|
7803
8031
|
const form = await profile.open(field, me.vanity);
|
|
7804
8032
|
if (!form.ok) return err("edit", form.code, form.message, form.hint);
|
|
7805
8033
|
const was = currentValue(form, field) ?? "";
|
|
7806
|
-
if (was ===
|
|
8034
|
+
if (was === text6) {
|
|
7807
8035
|
return err("edit", "INVALID_INPUT", `your ${name} already reads exactly that; nothing to save`);
|
|
7808
8036
|
}
|
|
7809
|
-
const built = saveBody(form, field,
|
|
8037
|
+
const built = saveBody(form, field, text6);
|
|
7810
8038
|
if (!built.ok) return err("edit", built.code, built.message, built.hint);
|
|
7811
8039
|
const plan = {
|
|
7812
8040
|
action: `change your ${name}`,
|
|
7813
|
-
payload: { field: name, was, text:
|
|
8041
|
+
payload: { field: name, was, text: text6 },
|
|
7814
8042
|
summary: [
|
|
7815
8043
|
authorLine(ctx.transport),
|
|
7816
8044
|
`field ${name}`,
|
|
7817
8045
|
`was "${was}"`,
|
|
7818
|
-
`new "${
|
|
8046
|
+
`new "${text6}"`
|
|
7819
8047
|
],
|
|
7820
8048
|
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.",
|
|
7821
8049
|
transport: "voyager"
|
|
@@ -7826,7 +8054,7 @@ async function runEditProfile(name, text5, now = Date.now(), deps = terminalDeps
|
|
|
7826
8054
|
if (!sent.ok) return err("edit", sent.code, sent.message, sent.hint);
|
|
7827
8055
|
const after = await profile.open(field, me.vanity);
|
|
7828
8056
|
const reads = after.ok ? currentValue(after, field) : void 0;
|
|
7829
|
-
if (reads !==
|
|
8057
|
+
if (reads !== text6) {
|
|
7830
8058
|
return err(
|
|
7831
8059
|
"edit",
|
|
7832
8060
|
"SCHEMA_DRIFT",
|
|
@@ -7865,8 +8093,8 @@ async function harvest(activityId, session, now) {
|
|
|
7865
8093
|
if (!found.ok) return err("comment", "SCHEMA_DRIFT", found.message, found.hint);
|
|
7866
8094
|
return { ok: true, tokens: { bindingKey: found.bindingKey, trackingId: found.trackingId } };
|
|
7867
8095
|
}
|
|
7868
|
-
async function runComment(postUrn2,
|
|
7869
|
-
if (postUrn2 === void 0 ||
|
|
8096
|
+
async function runComment(postUrn2, text6, now = Date.now(), deps = terminalDeps()) {
|
|
8097
|
+
if (postUrn2 === void 0 || text6 === void 0 || text6.trim() === "") {
|
|
7870
8098
|
return err(
|
|
7871
8099
|
"comment",
|
|
7872
8100
|
"INVALID_INPUT",
|
|
@@ -7903,11 +8131,11 @@ async function runComment(postUrn2, text5, now = Date.now(), deps = terminalDeps
|
|
|
7903
8131
|
if (!("tokens" in harvested)) return harvested;
|
|
7904
8132
|
const plan = {
|
|
7905
8133
|
action: "comment on a post",
|
|
7906
|
-
payload: { activityId, text:
|
|
8134
|
+
payload: { activityId, text: text6, tokens: harvested.tokens },
|
|
7907
8135
|
// The harvested trackingId changes on every render, so --plan and --confirm
|
|
7908
8136
|
// would never agree on a token derived from it. The intent is what's approved.
|
|
7909
|
-
tokenBasis: { activityId, text:
|
|
7910
|
-
summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${
|
|
8137
|
+
tokenBasis: { activityId, text: text6 },
|
|
8138
|
+
summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text6}"`],
|
|
7911
8139
|
reversibility: "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately",
|
|
7912
8140
|
transport: "voyager"
|
|
7913
8141
|
};
|
|
@@ -7919,8 +8147,8 @@ async function runComment(postUrn2, text5, now = Date.now(), deps = terminalDeps
|
|
|
7919
8147
|
);
|
|
7920
8148
|
return result.ok ? ok("comment", { on: postUrn2 }) : err("comment", result.code, result.message, result.hint);
|
|
7921
8149
|
}
|
|
7922
|
-
async function runEdit(commentUrn,
|
|
7923
|
-
if (commentUrn === void 0 ||
|
|
8150
|
+
async function runEdit(commentUrn, text6, now = Date.now(), deps = terminalDeps()) {
|
|
8151
|
+
if (commentUrn === void 0 || text6 === void 0 || text6.trim() === "") {
|
|
7924
8152
|
return err(
|
|
7925
8153
|
"edit",
|
|
7926
8154
|
"INVALID_INPUT",
|
|
@@ -7930,11 +8158,11 @@ async function runEdit(commentUrn, text5, now = Date.now(), deps = terminalDeps(
|
|
|
7930
8158
|
}
|
|
7931
8159
|
const ref = parseCommentUrn(commentUrn);
|
|
7932
8160
|
if (ref === null && !commentUrn.startsWith("urn:")) {
|
|
7933
|
-
return runEditProfile(commentUrn,
|
|
8161
|
+
return runEditProfile(commentUrn, text6, now, deps);
|
|
7934
8162
|
}
|
|
7935
8163
|
if (ref === null) {
|
|
7936
8164
|
if (/^urn:li:(share|ugcPost):\d+$/.test(commentUrn)) {
|
|
7937
|
-
return runEditPost(commentUrn,
|
|
8165
|
+
return runEditPost(commentUrn, text6, now, deps);
|
|
7938
8166
|
}
|
|
7939
8167
|
return err(
|
|
7940
8168
|
"edit",
|
|
@@ -7954,8 +8182,8 @@ async function runEdit(commentUrn, text5, now = Date.now(), deps = terminalDeps(
|
|
|
7954
8182
|
if (!("tokens" in harvested)) return harvested;
|
|
7955
8183
|
const plan = {
|
|
7956
8184
|
action: "edit your comment",
|
|
7957
|
-
payload: { urn: commentUrn, text:
|
|
7958
|
-
summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${
|
|
8185
|
+
payload: { urn: commentUrn, text: text6 },
|
|
8186
|
+
summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text6}"`],
|
|
7959
8187
|
reversibility: "editable again, but the previous text is NOT recoverable here and LinkedIn marks the comment as edited",
|
|
7960
8188
|
transport: "voyager"
|
|
7961
8189
|
};
|
|
@@ -7966,7 +8194,7 @@ async function runEdit(commentUrn, text5, now = Date.now(), deps = terminalDeps(
|
|
|
7966
8194
|
UPDATE_OP,
|
|
7967
8195
|
harvested.tokens.trackingId,
|
|
7968
8196
|
createLiveClient(ctx.transport.session),
|
|
7969
|
-
|
|
8197
|
+
text6
|
|
7970
8198
|
);
|
|
7971
8199
|
return result.ok ? ok("edit", { edited: commentUrn }) : err("edit", result.code, result.message, result.hint);
|
|
7972
8200
|
}
|
|
@@ -8010,8 +8238,8 @@ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(),
|
|
|
8010
8238
|
const result = await react(gated.confirmed, createLiveClient(ctx.transport.session));
|
|
8011
8239
|
return result.ok ? ok("react", { id: result.id, removed: remove }) : err("react", result.code, result.message, result.hint);
|
|
8012
8240
|
}
|
|
8013
|
-
async function runReply(commentUrn,
|
|
8014
|
-
if (commentUrn === void 0 ||
|
|
8241
|
+
async function runReply(commentUrn, text6, now = Date.now(), deps = terminalDeps()) {
|
|
8242
|
+
if (commentUrn === void 0 || text6 === void 0 || text6.trim() === "") {
|
|
8015
8243
|
return err(
|
|
8016
8244
|
"reply",
|
|
8017
8245
|
"INVALID_INPUT",
|
|
@@ -8037,8 +8265,8 @@ async function runReply(commentUrn, text5, now = Date.now(), deps = terminalDeps
|
|
|
8037
8265
|
}
|
|
8038
8266
|
const plan = {
|
|
8039
8267
|
action: "reply to a comment",
|
|
8040
|
-
payload: { ref: parent, text:
|
|
8041
|
-
summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${
|
|
8268
|
+
payload: { ref: parent, text: text6 },
|
|
8269
|
+
summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text6}"`],
|
|
8042
8270
|
reversibility: "deletable with `lnrelay delete <the reply urn>`; the comment author is notified immediately",
|
|
8043
8271
|
transport: "voyager"
|
|
8044
8272
|
};
|
|
@@ -8481,11 +8709,11 @@ function skillsFromPage(stream) {
|
|
|
8481
8709
|
for (; ; ) {
|
|
8482
8710
|
i = stream.indexOf(EDIT_NAV2, i);
|
|
8483
8711
|
if (i === -1) break;
|
|
8484
|
-
const
|
|
8712
|
+
const text6 = balanced(stream, i);
|
|
8485
8713
|
const end = i;
|
|
8486
8714
|
i += EDIT_NAV2.length;
|
|
8487
|
-
if (
|
|
8488
|
-
const payload = JSON.parse(
|
|
8715
|
+
if (text6 === null) continue;
|
|
8716
|
+
const payload = JSON.parse(text6).requestedArguments?.payload;
|
|
8489
8717
|
const id = payload?.skillId;
|
|
8490
8718
|
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
8491
8719
|
continue;
|
|
@@ -8493,7 +8721,7 @@ function skillsFromPage(stream) {
|
|
|
8493
8721
|
(m) => JSON.parse(`"${m[1]}"`)
|
|
8494
8722
|
);
|
|
8495
8723
|
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
8496
|
-
from = end +
|
|
8724
|
+
from = end + text6.length;
|
|
8497
8725
|
}
|
|
8498
8726
|
return { ok: true, skills };
|
|
8499
8727
|
}
|
|
@@ -8562,9 +8790,9 @@ async function fetchSkills(vanityName, client) {
|
|
|
8562
8790
|
if (typeof screen !== "string") return screen;
|
|
8563
8791
|
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
8564
8792
|
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
8565
|
-
const
|
|
8566
|
-
if (
|
|
8567
|
-
const payload = JSON.parse(
|
|
8793
|
+
const text6 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
8794
|
+
if (text6 === null) return drift6("the Skills screen carried no list request");
|
|
8795
|
+
const payload = JSON.parse(text6);
|
|
8568
8796
|
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
8569
8797
|
const skills = [];
|
|
8570
8798
|
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
@@ -9083,6 +9311,17 @@ function mine(command, args) {
|
|
|
9083
9311
|
output(args)
|
|
9084
9312
|
);
|
|
9085
9313
|
if (command === "event") return runEvent(args.positionals, output(args));
|
|
9314
|
+
if (command === "my-items") {
|
|
9315
|
+
const stage = str(args, "stage");
|
|
9316
|
+
return runMyItems(
|
|
9317
|
+
args.positionals[0],
|
|
9318
|
+
{
|
|
9319
|
+
limit: num(args, "limit") ?? 50,
|
|
9320
|
+
...stage !== void 0 ? { stage } : {}
|
|
9321
|
+
},
|
|
9322
|
+
output(args)
|
|
9323
|
+
);
|
|
9324
|
+
}
|
|
9086
9325
|
const start = num(args, "start");
|
|
9087
9326
|
return runNetwork(
|
|
9088
9327
|
args.positionals[0],
|
|
@@ -9232,6 +9471,7 @@ async function dispatch(argv, now) {
|
|
|
9232
9471
|
return runPeopleFilters(peopleRequest(args), output(args));
|
|
9233
9472
|
case "events":
|
|
9234
9473
|
case "event":
|
|
9474
|
+
case "my-items":
|
|
9235
9475
|
case "network":
|
|
9236
9476
|
return mine(command, args);
|
|
9237
9477
|
case "inbox":
|
|
@@ -9293,13 +9533,13 @@ function edit(args, now, deps) {
|
|
|
9293
9533
|
if (inline !== void 0) {
|
|
9294
9534
|
return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
|
|
9295
9535
|
}
|
|
9296
|
-
let
|
|
9536
|
+
let text6;
|
|
9297
9537
|
try {
|
|
9298
|
-
|
|
9538
|
+
text6 = readFileSync4(file, "utf-8").replace(/\n$/, "");
|
|
9299
9539
|
} catch {
|
|
9300
9540
|
return err("edit", "INVALID_INPUT", `cannot read ${file}`);
|
|
9301
9541
|
}
|
|
9302
|
-
return runEdit(target,
|
|
9542
|
+
return runEdit(target, text6, now, deps);
|
|
9303
9543
|
}
|
|
9304
9544
|
function role(args, now, deps) {
|
|
9305
9545
|
const [sub, target] = args.positionals;
|