linkedin-relay-mcp 1.3.0 → 1.3.1
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 +34 -10
- package/dist/cli.js.map +1 -1
- package/dist/mcp-shim.js +21 -8
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -836,13 +836,16 @@ function classifyRedirect(location) {
|
|
|
836
836
|
}
|
|
837
837
|
return fail("FETCH_FAILED", `unexpected redirect to ${location || "(none)"}`);
|
|
838
838
|
}
|
|
839
|
+
function challengeIn(body) {
|
|
840
|
+
if (!CHALLENGE_MARKERS.test(body.slice(0, 4e3))) return null;
|
|
841
|
+
return fail("CHALLENGE_DETECTED", "a challenge page was returned with status 200", {
|
|
842
|
+
cooldown: "CHALLENGE_DETECTED",
|
|
843
|
+
hint: CHALLENGE_HINT
|
|
844
|
+
});
|
|
845
|
+
}
|
|
839
846
|
function classifyBody(body) {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
cooldown: "CHALLENGE_DETECTED",
|
|
843
|
-
hint: CHALLENGE_HINT
|
|
844
|
-
});
|
|
845
|
-
}
|
|
847
|
+
const challenge = challengeIn(body);
|
|
848
|
+
if (challenge !== null) return challenge;
|
|
846
849
|
let json;
|
|
847
850
|
try {
|
|
848
851
|
json = JSON.parse(body);
|
|
@@ -865,7 +868,7 @@ function classifyBody(body) {
|
|
|
865
868
|
}
|
|
866
869
|
return { outcome: "ok", retry: false, json };
|
|
867
870
|
}
|
|
868
|
-
function classify(res) {
|
|
871
|
+
function classify(res, opts = {}) {
|
|
869
872
|
const headers2 = res.headers ?? {};
|
|
870
873
|
if (res.status >= 300 && res.status < 400) {
|
|
871
874
|
return classifyRedirect(headers2.location ?? "");
|
|
@@ -906,6 +909,15 @@ function classify(res) {
|
|
|
906
909
|
return fail("FETCH_FAILED", `unexpected status ${res.status}`);
|
|
907
910
|
}
|
|
908
911
|
if (res.body.trim() === "") return { outcome: "ok", retry: false, json: null };
|
|
912
|
+
const challenge = challengeIn(res.body);
|
|
913
|
+
if (challenge !== null) return challenge;
|
|
914
|
+
if (opts.expectJson === false) {
|
|
915
|
+
try {
|
|
916
|
+
return { outcome: "ok", retry: false, json: JSON.parse(res.body) };
|
|
917
|
+
} catch {
|
|
918
|
+
return { outcome: "ok", retry: false, json: null };
|
|
919
|
+
}
|
|
920
|
+
}
|
|
909
921
|
return classifyBody(res.body);
|
|
910
922
|
}
|
|
911
923
|
function referencesUrns(data) {
|
|
@@ -967,7 +979,8 @@ function createClient(session, deps) {
|
|
|
967
979
|
if (raw === null) {
|
|
968
980
|
return { ok: false, code: "FETCH_FAILED", message: "the request could not be completed" };
|
|
969
981
|
}
|
|
970
|
-
const
|
|
982
|
+
const isRead = (spec.method ?? "GET") === "GET";
|
|
983
|
+
const classification = classify(raw, { expectJson: isRead });
|
|
971
984
|
if (classification.cooldown !== void 0) {
|
|
972
985
|
deps.saveCooldown(openCooldown(classification.cooldown, deps.now()));
|
|
973
986
|
}
|
|
@@ -2904,6 +2917,17 @@ var REACTIONS = [
|
|
|
2904
2917
|
"APPRECIATION",
|
|
2905
2918
|
"ENTERTAINMENT"
|
|
2906
2919
|
];
|
|
2920
|
+
var LABELS = {
|
|
2921
|
+
LIKE: "Like",
|
|
2922
|
+
PRAISE: "Celebrate",
|
|
2923
|
+
EMPATHY: "Love",
|
|
2924
|
+
INTEREST: "Insightful",
|
|
2925
|
+
APPRECIATION: "Support",
|
|
2926
|
+
ENTERTAINMENT: "Funny"
|
|
2927
|
+
};
|
|
2928
|
+
function reactionLabel(reaction) {
|
|
2929
|
+
return LABELS[reaction];
|
|
2930
|
+
}
|
|
2907
2931
|
function reactionUrl(op) {
|
|
2908
2932
|
return `${SDUI_ACTION}?sduiid=com.linkedin.sdui.reactions.${op}`;
|
|
2909
2933
|
}
|
|
@@ -3167,9 +3191,9 @@ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(),
|
|
|
3167
3191
|
summary: [
|
|
3168
3192
|
authorLine(ctx.transport),
|
|
3169
3193
|
`on ${postUrn2}`,
|
|
3170
|
-
`reaction ${
|
|
3194
|
+
`reaction ${reaction} \u2014 shows as "${reactionLabel(reaction)}"${remove ? " (REMOVING)" : ""}`
|
|
3171
3195
|
],
|
|
3172
|
-
reversibility: remove ? "you can react again; the author may have been notified the first time" :
|
|
3196
|
+
reversibility: remove ? "you can react again; the author may have been notified the first time" : `removable with \`lnrelay react ${postUrn2} --remove --type ${reaction}\` \u2014 the type is required, LinkedIn deletes a specific reaction; the author is notified immediately`,
|
|
3173
3197
|
transport: "voyager"
|
|
3174
3198
|
};
|
|
3175
3199
|
const gated = await gate("react", plan, ctx, deps);
|