linkedin-relay-mcp 1.3.1 → 1.3.3
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 +27 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1803,11 +1803,13 @@ function reserve(command, now) {
|
|
|
1803
1803
|
const attempt = spend(ledger(), "write", now);
|
|
1804
1804
|
return "error" in attempt ? err(command, attempt.error.code, attempt.error.message, attempt.error.hint) : null;
|
|
1805
1805
|
}
|
|
1806
|
-
async function gateWrite(command, plan, now, deps) {
|
|
1806
|
+
async function gateWrite(command, plan, now, deps, opts = {}) {
|
|
1807
1807
|
const outcome = await confirmWrite(plan, budgetLine(now), deps);
|
|
1808
1808
|
if (!outcome.ok) return err(command, outcome.code, outcome.message, outcome.hint);
|
|
1809
|
-
|
|
1810
|
-
|
|
1809
|
+
if (opts.commitSpend !== false) {
|
|
1810
|
+
const attempt = spend(ledger(), "write", now);
|
|
1811
|
+
if ("permit" in attempt) saveJson(cachePath("budget.json"), attempt.ledger);
|
|
1812
|
+
}
|
|
1811
1813
|
return { confirmed: outcome.confirmed, payload: plan.payload };
|
|
1812
1814
|
}
|
|
1813
1815
|
|
|
@@ -1847,6 +1849,19 @@ async function lookup(urn, quiet) {
|
|
|
1847
1849
|
if (!posts.ok) return void 0;
|
|
1848
1850
|
return findOwnPost(shapeAll(posts.value.parsed.items, posts.value.index), urn);
|
|
1849
1851
|
}
|
|
1852
|
+
function evictionTarget(result) {
|
|
1853
|
+
if (!result.ok) return null;
|
|
1854
|
+
return typeof result.id === "string" && result.id !== "" ? result.id : null;
|
|
1855
|
+
}
|
|
1856
|
+
function evict(urn, now) {
|
|
1857
|
+
if (urn === null) return false;
|
|
1858
|
+
try {
|
|
1859
|
+
return removeUrns(openDb(now), "my-posts", [urn]) > 0;
|
|
1860
|
+
} catch (e) {
|
|
1861
|
+
if (e instanceof CacheCorrupt) return false;
|
|
1862
|
+
throw e;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1850
1865
|
async function runDelete(urn, now = Date.now(), deps, quiet = false) {
|
|
1851
1866
|
if (urn === void 0 || urn === "") {
|
|
1852
1867
|
return err(
|
|
@@ -1886,10 +1901,14 @@ async function runDelete(urn, now = Date.now(), deps, quiet = false) {
|
|
|
1886
1901
|
reversibility: "NONE. A deleted post is gone, with its comments and reactions.",
|
|
1887
1902
|
transport: "voyager"
|
|
1888
1903
|
};
|
|
1889
|
-
const gated = await gateWrite("delete", plan, now, deps ?? terminalDeps()
|
|
1904
|
+
const gated = await gateWrite("delete", plan, now, deps ?? terminalDeps(), {
|
|
1905
|
+
commitSpend: false
|
|
1906
|
+
});
|
|
1890
1907
|
if ("ok" in gated) return gated;
|
|
1891
1908
|
const result = await deletePost(gated.confirmed, createLiveClient(session.session));
|
|
1892
|
-
|
|
1909
|
+
if (!result.ok) return err("delete", result.code, result.message, result.hint);
|
|
1910
|
+
const evicted = evict(evictionTarget(result), now);
|
|
1911
|
+
return ok("delete", { deleted: urn, verified: post !== void 0, evictedFromCache: evicted });
|
|
1893
1912
|
}
|
|
1894
1913
|
|
|
1895
1914
|
// src/commands/live.ts
|
|
@@ -3101,7 +3120,9 @@ function requireOauth(command, ctx) {
|
|
|
3101
3120
|
);
|
|
3102
3121
|
}
|
|
3103
3122
|
async function gate(command, plan, ctx, deps) {
|
|
3104
|
-
const gated = await gateWrite(command, plan, ctx.now, deps
|
|
3123
|
+
const gated = await gateWrite(command, plan, ctx.now, deps, {
|
|
3124
|
+
commitSpend: ctx.transport.kind === "oauth"
|
|
3125
|
+
});
|
|
3105
3126
|
if ("ok" in gated) return gated;
|
|
3106
3127
|
return { confirmed: gated.confirmed };
|
|
3107
3128
|
}
|