linkedin-relay-mcp 1.5.0 → 1.6.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
@@ -913,9 +913,9 @@ function classify(res, opts = {}) {
913
913
  if (challenge !== null) return challenge;
914
914
  if (opts.expectJson === false) {
915
915
  try {
916
- return { outcome: "ok", retry: false, json: JSON.parse(res.body) };
916
+ return { outcome: "ok", retry: false, json: JSON.parse(res.body), raw: res.body };
917
917
  } catch {
918
- return { outcome: "ok", retry: false, json: null };
918
+ return { outcome: "ok", retry: false, json: null, raw: res.body };
919
919
  }
920
920
  }
921
921
  return classifyBody(res.body);
@@ -1799,6 +1799,10 @@ function terminalDeps() {
1799
1799
  write: (s) => process.stderr.write(s)
1800
1800
  };
1801
1801
  }
1802
+ function recordHarvestSpend(now) {
1803
+ const attempt = spend(ledger(), "page", now);
1804
+ if ("permit" in attempt) saveJson(cachePath("budget.json"), attempt.ledger);
1805
+ }
1802
1806
  function reserve(command, now) {
1803
1807
  const attempt = spend(ledger(), "write", now);
1804
1808
  return "error" in attempt ? err(command, attempt.error.code, attempt.error.message, attempt.error.hint) : null;
@@ -3341,7 +3345,10 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
3341
3345
  function activityIdOf(urn) {
3342
3346
  return /^urn:li:(?:activity|ugcPost|share):(\d+)$/.exec(urn)?.[1] ?? null;
3343
3347
  }
3344
- async function harvest(activityId, session) {
3348
+ async function harvest(activityId, session, now) {
3349
+ const spent = reserve("comment", now);
3350
+ if (spent !== null) return spent;
3351
+ recordHarvestSpend(now);
3345
3352
  const headers2 = buildHeaders(session);
3346
3353
  let html;
3347
3354
  try {
@@ -3390,7 +3397,7 @@ async function runComment(postUrn2, text2, now = Date.now(), deps = terminalDeps
3390
3397
  if (ctx.transport.kind !== "voyager") {
3391
3398
  return err("comment", "NOT_IMPLEMENTED", "commenting is only implemented over the private API");
3392
3399
  }
3393
- const harvested = await harvest(activityId, ctx.transport.session);
3400
+ const harvested = await harvest(activityId, ctx.transport.session, now);
3394
3401
  if ("ok" in harvested && harvested.ok !== true) return harvested;
3395
3402
  if (!("tokens" in harvested)) return harvested;
3396
3403
  const plan = {