linkedin-relay-mcp 1.7.0 → 2.0.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 +84 -22
- package/dist/cli.js.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +11 -2
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2971,8 +2971,8 @@ var COMMANDS = [
|
|
|
2971
2971
|
{
|
|
2972
2972
|
name: "comment",
|
|
2973
2973
|
cost: "1 call \u2014 write",
|
|
2974
|
-
summary: "Add a comment
|
|
2975
|
-
usage: 'lnrelay comment <activity-urn> "<text>"
|
|
2974
|
+
summary: "Add a comment to a post. Harvests its binding tokens from the rendered page; no browser needed, but it costs one heavy read.",
|
|
2975
|
+
usage: 'lnrelay comment <activity-urn> "<text>"\n Fetches the post page (~2.8 MB) to harvest a binding key and trackingId, and proves\n the key belongs to that post before asking. To change a comment, see `edit`.',
|
|
2976
2976
|
audience: ["cli"],
|
|
2977
2977
|
risk: "write",
|
|
2978
2978
|
implemented: true
|
|
@@ -2986,6 +2986,15 @@ var COMMANDS = [
|
|
|
2986
2986
|
risk: "write",
|
|
2987
2987
|
implemented: true
|
|
2988
2988
|
},
|
|
2989
|
+
{
|
|
2990
|
+
name: "edit",
|
|
2991
|
+
cost: "1 read + 1 write",
|
|
2992
|
+
summary: "Change the text of a comment you wrote. Its own verb, so a comment urn can never be mistaken for something to comment ON.",
|
|
2993
|
+
usage: 'lnrelay edit <comment-urn> "<text>"',
|
|
2994
|
+
audience: ["cli"],
|
|
2995
|
+
risk: "write",
|
|
2996
|
+
implemented: true
|
|
2997
|
+
},
|
|
2989
2998
|
{
|
|
2990
2999
|
name: "react",
|
|
2991
3000
|
cost: "1 call \u2014 write",
|
|
@@ -3600,14 +3609,21 @@ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps
|
|
|
3600
3609
|
'lnrelay comment <urn> "<text>"'
|
|
3601
3610
|
);
|
|
3602
3611
|
}
|
|
3603
|
-
|
|
3604
|
-
|
|
3612
|
+
if (parseCommentUrn(postUrn2) !== null) {
|
|
3613
|
+
return err(
|
|
3614
|
+
"comment",
|
|
3615
|
+
"INVALID_INPUT",
|
|
3616
|
+
"that is a comment urn, not a post urn",
|
|
3617
|
+
`To change its text: lnrelay edit ${postUrn2} "<text>". Replying to a comment is not implemented \u2014 pass the POST urn to add a top-level comment.`
|
|
3618
|
+
);
|
|
3619
|
+
}
|
|
3620
|
+
const activityId = activityIdOf(postUrn2);
|
|
3605
3621
|
if (activityId === null) {
|
|
3606
3622
|
return err(
|
|
3607
3623
|
"comment",
|
|
3608
3624
|
"INVALID_INPUT",
|
|
3609
|
-
`'${postUrn2}'
|
|
3610
|
-
"Pass urn:li:activity:<id
|
|
3625
|
+
`'${postUrn2}' does not identify a post`,
|
|
3626
|
+
"Pass urn:li:activity:<id>."
|
|
3611
3627
|
);
|
|
3612
3628
|
}
|
|
3613
3629
|
if (!deps.isTty) {
|
|
@@ -3627,26 +3643,70 @@ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps
|
|
|
3627
3643
|
if ("ok" in harvested && harvested.ok !== true) return harvested;
|
|
3628
3644
|
if (!("tokens" in harvested)) return harvested;
|
|
3629
3645
|
const plan = {
|
|
3630
|
-
action:
|
|
3631
|
-
payload: {
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
tokens: harvested.tokens,
|
|
3635
|
-
...editing === null ? {} : { edit: editing }
|
|
3636
|
-
},
|
|
3637
|
-
summary: [
|
|
3638
|
-
authorLine(ctx.transport),
|
|
3639
|
-
`on ${postUrn2}`,
|
|
3640
|
-
`${editing === null ? "content " : "new text"} "${text2}"`
|
|
3641
|
-
],
|
|
3642
|
-
reversibility: editing === null ? "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately" : "editable again; LinkedIn marks the comment edited and the original is not recoverable here",
|
|
3646
|
+
action: "comment on a post",
|
|
3647
|
+
payload: { activityId, text: text2, tokens: harvested.tokens },
|
|
3648
|
+
summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text2}"`],
|
|
3649
|
+
reversibility: "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately",
|
|
3643
3650
|
transport: "voyager"
|
|
3644
3651
|
};
|
|
3645
3652
|
const gated = await gate("comment", plan, ctx, deps);
|
|
3646
3653
|
if ("ok" in gated) return gated;
|
|
3647
|
-
const
|
|
3648
|
-
|
|
3649
|
-
|
|
3654
|
+
const result = await comment(
|
|
3655
|
+
gated.confirmed,
|
|
3656
|
+
createLiveClient(ctx.transport.session)
|
|
3657
|
+
);
|
|
3658
|
+
return result.ok ? ok("comment", { on: postUrn2 }) : err("comment", result.code, result.message, result.hint);
|
|
3659
|
+
}
|
|
3660
|
+
async function runEdit(commentUrn, text2, now = Date.now(), deps = terminalDeps()) {
|
|
3661
|
+
if (commentUrn === void 0 || text2 === void 0 || text2.trim() === "") {
|
|
3662
|
+
return err(
|
|
3663
|
+
"edit",
|
|
3664
|
+
"INVALID_INPUT",
|
|
3665
|
+
"a comment urn and the new text are required",
|
|
3666
|
+
'lnrelay edit <comment-urn> "<text>"'
|
|
3667
|
+
);
|
|
3668
|
+
}
|
|
3669
|
+
const ref = parseCommentUrn(commentUrn);
|
|
3670
|
+
if (ref === null) {
|
|
3671
|
+
return err(
|
|
3672
|
+
"edit",
|
|
3673
|
+
"INVALID_INPUT",
|
|
3674
|
+
`'${commentUrn}' is not a comment urn`,
|
|
3675
|
+
"Only comments can be edited here \u2014 a published post cannot. Get the urn from `lnrelay post <activity-urn>`."
|
|
3676
|
+
);
|
|
3677
|
+
}
|
|
3678
|
+
if (!deps.isTty) {
|
|
3679
|
+
return err(
|
|
3680
|
+
"edit",
|
|
3681
|
+
"CONFIRMATION_REQUIRED",
|
|
3682
|
+
"editing needs a human to confirm it at an interactive terminal",
|
|
3683
|
+
"No terminal is attached, so nothing was sent and no network call was made."
|
|
3684
|
+
);
|
|
3685
|
+
}
|
|
3686
|
+
const ctx = prepare("edit", now, "voyager");
|
|
3687
|
+
if ("ok" in ctx) return ctx;
|
|
3688
|
+
if (ctx.transport.kind !== "voyager") {
|
|
3689
|
+
return err("edit", "NOT_IMPLEMENTED", "editing is only implemented over the private API");
|
|
3690
|
+
}
|
|
3691
|
+
const harvested = await harvest(ref.activityId, ctx.transport.session, now);
|
|
3692
|
+
if (!("tokens" in harvested)) return harvested;
|
|
3693
|
+
const plan = {
|
|
3694
|
+
action: "edit your comment",
|
|
3695
|
+
payload: { urn: commentUrn, text: text2 },
|
|
3696
|
+
summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text2}"`],
|
|
3697
|
+
reversibility: "editable again, but the previous text is NOT recoverable here and LinkedIn marks the comment as edited",
|
|
3698
|
+
transport: "voyager"
|
|
3699
|
+
};
|
|
3700
|
+
const gated = await gate("edit", plan, ctx, deps);
|
|
3701
|
+
if ("ok" in gated) return gated;
|
|
3702
|
+
const result = await runCommentAction(
|
|
3703
|
+
ref,
|
|
3704
|
+
UPDATE_OP,
|
|
3705
|
+
harvested.tokens.trackingId,
|
|
3706
|
+
createLiveClient(ctx.transport.session),
|
|
3707
|
+
text2
|
|
3708
|
+
);
|
|
3709
|
+
return result.ok ? ok("edit", { edited: commentUrn }) : err("edit", result.code, result.message, result.hint);
|
|
3650
3710
|
}
|
|
3651
3711
|
var REACTIONS2 = REACTIONS;
|
|
3652
3712
|
async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(), remove = false) {
|
|
@@ -3843,6 +3903,8 @@ async function dispatch(argv, now) {
|
|
|
3843
3903
|
}
|
|
3844
3904
|
case "comment":
|
|
3845
3905
|
return runComment(args.positionals[0], args.positionals[1], now);
|
|
3906
|
+
case "edit":
|
|
3907
|
+
return runEdit(args.positionals[0], args.positionals[1], now);
|
|
3846
3908
|
case "react":
|
|
3847
3909
|
return runReact(
|
|
3848
3910
|
args.positionals[0],
|