linkedin-relay-mcp 3.0.2 → 3.1.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.
@@ -183,14 +183,31 @@ call again.
183
183
 
184
184
  ## What this tool will not do
185
185
 
186
- Writes — posting, commenting, reacting, deleting — are **not on this surface at all**. They exist as
187
- CLI commands (`lnrelay share`, `comment`, `react`, `delete`). Each stops at an interactive terminal,
188
- shows exactly what it will send and over which surface, and requires the user to type a token
189
- derived from the content.
190
-
191
- `share` prefers LinkedIn's official OAuth scope and falls back to the private API when the user has
192
- no developer app — the prompt always names which, and a Voyager write states the ToS breach. If a
193
- user asks why writing needs an app at all, the answer is in `docs/DECISION-writes.md`.
186
+ Writes are **not on this surface at all**. They exist only as CLI commands the user runs themselves:
187
+
188
+ | command | does |
189
+ |---|---|
190
+ | `lnrelay share "<text>" [--image <path> \| --video <path>]` | post to their own feed, optionally with one image or video |
191
+ | `lnrelay comment <activity-urn> "<text>"` | comment on a post |
192
+ | `lnrelay reply <comment-urn> "<text>"` | reply, nested under that comment |
193
+ | `lnrelay edit <comment-urn> "<text>"` | change the text of their own comment |
194
+ | `lnrelay react <urn> [--type X] [--remove]` | react to a post or comment |
195
+ | `lnrelay delete <activity-urn \| comment-urn>` | delete their post or comment |
196
+
197
+ The urn decides nothing on its own — `comment`, `reply` and `edit` are separate verbs because they
198
+ are separate operations, and passing a comment urn to `comment` is refused rather than guessed at.
199
+
200
+ Each stops at an interactive terminal, shows exactly what it will send and over which surface, and
201
+ requires the user to type a token derived from the content.
202
+
203
+ Two things worth telling a user who asks:
204
+
205
+ - `share` prefers LinkedIn's official OAuth scope and falls back to the private API when they have no
206
+ developer app — the prompt names which, and a Voyager write states the ToS breach. Why an app is
207
+ needed at all: `docs/DECISION-writes.md`.
208
+ - `--image` / `--video` upload over the private API only; `--via oauth` with media is refused. A
209
+ video post comes back as a `urn:li:ugcPost:` rather than `urn:li:share:`.
210
+ - **Deleting a comment also deletes every reply under it**, including other people's. Verified live.
194
211
 
195
212
  **Without a terminal there is no write and no network call.** That is deliberate and there is no
196
213
  flag that changes it: a flag an agent could set would not be confirming anything. If the user asks
package/dist/cli.js CHANGED
@@ -401,9 +401,13 @@ function shapePost(node, index) {
401
401
  const urn = postUrn(node);
402
402
  const social = deref(node, "*socialDetail", index);
403
403
  const counts = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
404
+ const meta = node.metadata;
404
405
  return defined({
405
406
  type: typeOf(node),
406
407
  urn,
408
+ // The urn the post was CREATED as (share or ugcPost) — what `share` prints,
409
+ // and a different number from the activity urn above.
410
+ shareUrn: typeof meta?.shareUrn === "string" ? meta.shareUrn : void 0,
407
411
  threadUrn: typeof social?.urn === "string" ? social.urn : void 0,
408
412
  author: text(actor?.name),
409
413
  // `text()` already trims; LinkedIn pads these with trailing spaces.
@@ -1008,14 +1012,20 @@ function createClient(session, deps) {
1008
1012
  }
1009
1013
  return { request };
1010
1014
  }
1015
+ function encodeBody(spec) {
1016
+ if (spec.bytes !== void 0) return spec.bytes;
1017
+ return spec.body === void 0 ? void 0 : JSON.stringify(spec.body);
1018
+ }
1011
1019
  async function fetchRaw(spec, session, deps) {
1012
1020
  const requestHeaders = buildHeaders(session);
1013
1021
  if (spec.body !== void 0) requestHeaders["content-type"] = "application/json; charset=UTF-8";
1022
+ Object.assign(requestHeaders, spec.headers);
1023
+ const body = encodeBody(spec);
1014
1024
  try {
1015
1025
  const res = await deps.fetch(spec.url, {
1016
1026
  method: spec.method ?? "GET",
1017
1027
  headers: requestHeaders,
1018
- ...spec.body === void 0 ? {} : { body: JSON.stringify(spec.body) },
1028
+ ...body === void 0 ? {} : { body },
1019
1029
  // Manual, so a login or checkpoint redirect is classified rather than
1020
1030
  // silently followed into an HTML page that parses as "no data".
1021
1031
  redirect: "manual"
@@ -1924,10 +1934,96 @@ function getAllCookies(wsUrl) {
1924
1934
  });
1925
1935
  }
1926
1936
 
1937
+ // src/engine/voyager-write.ts
1938
+ import { createHash } from "crypto";
1939
+
1940
+ // src/engine/voyager-media.ts
1941
+ var MEDIA_UPLOAD_URL = "https://www.linkedin.com/voyager/api/voyagerVideoDashMediaUploadMetadata?action=upload";
1942
+ var TYPES = {
1943
+ png: { kind: "IMAGE", contentType: "image/png" },
1944
+ jpg: { kind: "IMAGE", contentType: "image/jpeg" },
1945
+ jpeg: { kind: "IMAGE", contentType: "image/jpeg" },
1946
+ gif: { kind: "IMAGE", contentType: "image/gif" },
1947
+ webp: { kind: "IMAGE", contentType: "image/webp" },
1948
+ mp4: { kind: "VIDEO", contentType: "video/mp4" },
1949
+ mov: { kind: "VIDEO", contentType: "video/quicktime" }
1950
+ };
1951
+ function mediaKindOf(filename) {
1952
+ const ext = /\.([a-z0-9]+)$/i.exec(filename)?.[1]?.toLowerCase();
1953
+ return ext === void 0 ? null : TYPES[ext] ?? null;
1954
+ }
1955
+ function registerPayload(kind, fileSize, filename) {
1956
+ return {
1957
+ mediaUploadType: kind === "IMAGE" ? "IMAGE_SHARING" : "VIDEO_SHARING",
1958
+ fileSize,
1959
+ filename
1960
+ };
1961
+ }
1962
+ function parseUploadTicket(json) {
1963
+ const v = json?.data?.value;
1964
+ if (v?.type !== void 0 && v.type !== "SINGLE") {
1965
+ return {
1966
+ ok: false,
1967
+ code: "NOT_IMPLEMENTED",
1968
+ message: `LinkedIn asked for a ${String(v.type)} upload, which is only used for large files and has not been observed here. Nothing was uploaded or posted. Try a smaller file.`
1969
+ };
1970
+ }
1971
+ const urn = v?.urn;
1972
+ const uploadUrl = v?.singleUploadUrl;
1973
+ if (typeof urn !== "string" || typeof uploadUrl !== "string") {
1974
+ return {
1975
+ ok: false,
1976
+ code: "SCHEMA_DRIFT",
1977
+ message: "the upload ticket carried no asset urn or upload url; nothing was posted"
1978
+ };
1979
+ }
1980
+ const headers2 = v?.singleUploadHeaders;
1981
+ return {
1982
+ ok: true,
1983
+ urn,
1984
+ uploadUrl,
1985
+ uploadHeaders: headers2 !== null && typeof headers2 === "object" ? headers2 : {}
1986
+ };
1987
+ }
1988
+ async function uploadMedia(file, client) {
1989
+ const registered = await client.request({
1990
+ url: MEDIA_UPLOAD_URL,
1991
+ method: "POST",
1992
+ body: registerPayload(file.kind, file.bytes.byteLength, file.filename),
1993
+ spendClass: "write",
1994
+ operation: "register-upload"
1995
+ });
1996
+ if (!registered.ok) {
1997
+ return {
1998
+ ok: false,
1999
+ code: registered.code,
2000
+ message: `${registered.message}; nothing was posted`
2001
+ };
2002
+ }
2003
+ const ticket = parseUploadTicket(registered.json);
2004
+ if (!ticket.ok) return ticket;
2005
+ const put = await client.request({
2006
+ url: ticket.uploadUrl,
2007
+ method: "PUT",
2008
+ bytes: file.bytes,
2009
+ headers: { "content-type": file.contentType, ...ticket.uploadHeaders },
2010
+ spendClass: "write",
2011
+ operation: "upload"
2012
+ });
2013
+ if (!put.ok) {
2014
+ return {
2015
+ ok: false,
2016
+ code: put.code,
2017
+ message: `uploading ${file.filename} failed (${put.message}); nothing was posted`
2018
+ };
2019
+ }
2020
+ return { ok: true, urn: ticket.urn };
2021
+ }
2022
+
1927
2023
  // src/engine/voyager-write.ts
1928
2024
  var VOYAGER2 = "https://www.linkedin.com/voyager/api";
1929
2025
  var SHARE_URL = `${VOYAGER2}/contentcreation/normShares`;
1930
- function sharePayload(text2, visibility) {
2026
+ function sharePayload(text2, visibility, media = []) {
1931
2027
  return {
1932
2028
  visibleToConnectionsOnly: visibility === "CONNECTIONS",
1933
2029
  externalAudienceProviders: [],
@@ -1935,9 +2031,12 @@ function sharePayload(text2, visibility) {
1935
2031
  origin: "FEED",
1936
2032
  allowedCommentersScope: "ALL",
1937
2033
  postState: "PUBLISHED",
1938
- media: []
2034
+ media: media.map((m) => ({ category: m.category, mediaUrn: m.urn, tapTargets: [] }))
1939
2035
  };
1940
2036
  }
2037
+ function mediaDigest(bytes) {
2038
+ return createHash("sha256").update(bytes).digest("hex");
2039
+ }
1941
2040
  var POST_URN = /urn:li:(share|activity|ugcPost):\d+/;
1942
2041
  function isDeletableUrn(urn) {
1943
2042
  return new RegExp(`^${POST_URN.source}$`).test(urn);
@@ -1970,8 +2069,30 @@ async function deletePost(confirmed, client) {
1970
2069
  function extractShareUrn(json) {
1971
2070
  return JSON.stringify(json ?? null).match(POST_URN)?.[0] ?? null;
1972
2071
  }
1973
- async function share(confirmed, client) {
1974
- const body = sharePayload(confirmed.payload.text, confirmed.payload.visibility);
2072
+ async function share(confirmed, client, bytes) {
2073
+ const { media: approved } = confirmed.payload;
2074
+ const media = [];
2075
+ if (approved !== void 0) {
2076
+ if (bytes === void 0 || mediaDigest(bytes) !== approved.sha256) {
2077
+ return {
2078
+ ok: false,
2079
+ code: "INVALID_INPUT",
2080
+ message: `${approved.filename} changed after it was approved; nothing was sent`
2081
+ };
2082
+ }
2083
+ const uploaded = await uploadMedia(
2084
+ {
2085
+ bytes,
2086
+ filename: approved.filename,
2087
+ kind: approved.kind,
2088
+ contentType: approved.contentType
2089
+ },
2090
+ client
2091
+ );
2092
+ if (!uploaded.ok) return uploaded;
2093
+ media.push({ category: approved.kind, urn: uploaded.urn });
2094
+ }
2095
+ const body = sharePayload(confirmed.payload.text, confirmed.payload.visibility, media);
1975
2096
  const result = await client.request({
1976
2097
  url: SHARE_URL,
1977
2098
  method: "POST",
@@ -1996,9 +2117,9 @@ async function share(confirmed, client) {
1996
2117
  import { createInterface } from "readline/promises";
1997
2118
 
1998
2119
  // src/commands/confirm.ts
1999
- import { createHash } from "crypto";
2120
+ import { createHash as createHash2 } from "crypto";
2000
2121
  function confirmToken(action, payload) {
2001
- return createHash("sha256").update(`${action}:${JSON.stringify(payload)}`).digest("hex").slice(0, 4);
2122
+ return createHash2("sha256").update(`${action}:${JSON.stringify(payload)}`).digest("hex").slice(0, 4);
2002
2123
  }
2003
2124
  function riskLines(transport) {
2004
2125
  return transport === "oauth" ? [
@@ -2076,9 +2197,16 @@ function recordHarvestSpend(now) {
2076
2197
  const attempt = spend(ledger(), "page", now);
2077
2198
  if ("permit" in attempt) saveJson(cachePath("budget.json"), attempt.ledger);
2078
2199
  }
2079
- function reserve(command, now) {
2080
- const attempt = spend(ledger(), "write", now);
2081
- return "error" in attempt ? err(command, attempt.error.code, attempt.error.message, attempt.error.hint) : null;
2200
+ function reserve(command, now, calls = 1) {
2201
+ let current = ledger();
2202
+ for (let i = 0; i < calls; i++) {
2203
+ const attempt = spend(current, "write", now + i * MIN_GAP_MS);
2204
+ if ("error" in attempt) {
2205
+ return err(command, attempt.error.code, attempt.error.message, attempt.error.hint);
2206
+ }
2207
+ current = attempt.ledger;
2208
+ }
2209
+ return null;
2082
2210
  }
2083
2211
  async function gateWrite(command, plan, now, deps, opts = {}) {
2084
2212
  const outcome = await confirmWrite(plan, budgetLine(now), deps);
@@ -2099,7 +2227,9 @@ function postId(urn) {
2099
2227
  function findOwnPost(posts, urn) {
2100
2228
  const id = postId(urn);
2101
2229
  if (id === void 0) return void 0;
2102
- return posts.find((p) => typeof p.urn === "string" && postId(p.urn) === id);
2230
+ return posts.find(
2231
+ (p) => typeof p.urn === "string" && postId(p.urn) === id || p.shareUrn === urn
2232
+ );
2103
2233
  }
2104
2234
  function previewLines(post) {
2105
2235
  if (post === void 0) {
@@ -2243,7 +2373,9 @@ async function runDelete(urn, now = Date.now(), deps, quiet = false) {
2243
2373
  if ("ok" in gated) return gated;
2244
2374
  const result = await deletePost(gated.confirmed, createLiveClient(session.session));
2245
2375
  if (!result.ok) return err("delete", result.code, result.message, result.hint);
2246
- const evicted = evict(evictionTarget(result), now);
2376
+ const target = evictionTarget(result);
2377
+ const cached = typeof post?.urn === "string" ? post.urn : target;
2378
+ const evicted = evict(target === null ? null : cached, now);
2247
2379
  return ok("delete", { deleted: urn, verified: post !== void 0, evictedFromCache: evicted });
2248
2380
  }
2249
2381
 
@@ -2996,7 +3128,7 @@ var COMMANDS = [
2996
3128
  name: "share",
2997
3129
  cost: "1 call \u2014 write",
2998
3130
  summary: "Post to your own feed. Prefers LinkedIn's official OAuth scope, falls back to the private API when no token exists \u2014 the prompt always names which.",
2999
- usage: 'lnrelay share "<text>" [--visibility public|connections] [--via oauth|voyager]\n Stops and asks at an interactive terminal. No TTY = no write, and no network call.',
3131
+ usage: 'lnrelay share "<text>" [--image <path> | --video <path>] [--visibility public|connections]\n [--via oauth|voyager]\n Stops and asks at an interactive terminal. No TTY = no write, and no network call.\n --image (png/jpg/gif/webp) or --video (mp4/mov) uploads the file first, over the\n private API only; the prompt shows its size and sha256.',
3000
3132
  audience: ["cli"],
3001
3133
  risk: "write",
3002
3134
  implemented: true
@@ -3179,6 +3311,10 @@ async function runSync(source, limit, force, now = Date.now()) {
3179
3311
  }
3180
3312
  }
3181
3313
 
3314
+ // src/commands/write.ts
3315
+ import { readFileSync as readFileSync2, statSync } from "fs";
3316
+ import { basename } from "path";
3317
+
3182
3318
  // src/engine/oauth-write.ts
3183
3319
  var API = "https://api.linkedin.com";
3184
3320
  function headers(token) {
@@ -3599,7 +3735,7 @@ function chooseTransport(inputs, requested) {
3599
3735
  function authorLine(transport) {
3600
3736
  return transport.kind === "oauth" ? `as ${transport.token.memberUrn}` : `as ${transport.session.ownerUrn ?? "you (browser session)"}`;
3601
3737
  }
3602
- function prepare(command, now, via2) {
3738
+ function prepare(command, now, via2, calls = 1) {
3603
3739
  const session = loadSession();
3604
3740
  const choice = chooseTransport(
3605
3741
  { token: loadToken(), session: session.state === "ok" ? session.session : null, now },
@@ -3610,7 +3746,7 @@ function prepare(command, now, via2) {
3610
3746
 
3611
3747
  ${OAUTH_SETUP}`);
3612
3748
  }
3613
- const refused = reserve(command, now);
3749
+ const refused = reserve(command, now, calls);
3614
3750
  if (refused !== null) return refused;
3615
3751
  const ctx = { transport: choice.transport, now };
3616
3752
  if (choice.note !== void 0) ctx.note = choice.note;
@@ -3623,17 +3759,77 @@ async function gate(command, plan, ctx, deps) {
3623
3759
  if ("ok" in gated) return gated;
3624
3760
  return { confirmed: gated.confirmed };
3625
3761
  }
3626
- async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps(), via2) {
3762
+ function loadMedia(media) {
3763
+ const kind = mediaKindOf(media.path);
3764
+ if (kind === null) {
3765
+ return err(
3766
+ "share",
3767
+ "INVALID_INPUT",
3768
+ `unsupported file type: ${basename(media.path)}`,
3769
+ "images: png, jpg, jpeg, gif, webp. videos: mp4, mov."
3770
+ );
3771
+ }
3772
+ const expected = media.flag === "image" ? "IMAGE" : "VIDEO";
3773
+ if (kind.kind !== expected) {
3774
+ const right = kind.kind === "IMAGE" ? "--image" : "--video";
3775
+ return err(
3776
+ "share",
3777
+ "INVALID_INPUT",
3778
+ `${basename(media.path)} is not a${media.flag === "image" ? "n image" : " video"}`,
3779
+ `pass it with ${right}`
3780
+ );
3781
+ }
3782
+ let bytes;
3783
+ try {
3784
+ if (!statSync(media.path).isFile()) throw new Error("not a file");
3785
+ bytes = new Uint8Array(readFileSync2(media.path));
3786
+ } catch {
3787
+ return err("share", "INVALID_INPUT", `cannot read ${media.path}`);
3788
+ }
3789
+ return {
3790
+ bytes,
3791
+ approved: {
3792
+ filename: basename(media.path),
3793
+ kind: kind.kind,
3794
+ contentType: kind.contentType,
3795
+ size: bytes.byteLength,
3796
+ sha256: mediaDigest(bytes)
3797
+ }
3798
+ };
3799
+ }
3800
+ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps(), via2, media) {
3627
3801
  if (text2 === void 0 || text2.trim() === "") {
3628
3802
  return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
3629
3803
  }
3630
3804
  const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
3631
- const ctx = prepare("share", now, via2);
3805
+ const loaded = media === void 0 ? void 0 : loadMedia(media);
3806
+ if (loaded !== void 0 && "ok" in loaded) return loaded;
3807
+ if (loaded !== void 0 && via2 === "oauth") {
3808
+ return err(
3809
+ "share",
3810
+ "NOT_IMPLEMENTED",
3811
+ "posting media is only implemented over the private API",
3812
+ "drop --via oauth, or pass --via voyager"
3813
+ );
3814
+ }
3815
+ const ctx = loaded === void 0 ? prepare("share", now, via2) : prepare("share", now, "voyager", 3);
3632
3816
  if ("ok" in ctx) return ctx;
3817
+ const payload = {
3818
+ text: text2,
3819
+ visibility: vis
3820
+ };
3821
+ const summary = [authorLine(ctx.transport), `content "${text2}"`, `audience ${vis}`];
3822
+ if (loaded !== void 0) {
3823
+ payload.media = loaded.approved;
3824
+ const { filename, kind, size, sha256 } = loaded.approved;
3825
+ summary.push(
3826
+ `${kind === "IMAGE" ? "image" : "video"} ${filename} (${Math.ceil(size / 1024)} KB, sha256 ${sha256.slice(0, 12)})`
3827
+ );
3828
+ }
3633
3829
  const plan = {
3634
3830
  action: "post to your feed",
3635
- payload: { text: text2, visibility: vis },
3636
- summary: [authorLine(ctx.transport), `content "${text2}"`, `audience ${vis}`],
3831
+ payload,
3832
+ summary,
3637
3833
  reversibility: "deletable with `lnrelay delete <urn>`, but it is public under your name the moment it lands and anyone who saw it cannot un-see it",
3638
3834
  transport: ctx.transport.kind
3639
3835
  };
@@ -3642,7 +3838,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
3642
3838
  const result = ctx.transport.kind === "oauth" ? await share2(gated.confirmed, ctx.transport.token, {
3643
3839
  fetch: globalThis.fetch,
3644
3840
  now: () => now
3645
- }) : await share(gated.confirmed, createLiveClient(ctx.transport.session));
3841
+ }) : await share(gated.confirmed, createLiveClient(ctx.transport.session), loaded?.bytes);
3646
3842
  if (!result.ok) return err("share", result.code, result.message, result.hint);
3647
3843
  return ok("share", {
3648
3844
  id: result.id ?? null,
@@ -3877,7 +4073,7 @@ async function runReply(commentUrn, text2, now = Date.now(), deps = terminalDeps
3877
4073
 
3878
4074
  // src/entry.ts
3879
4075
  import { realpathSync } from "fs";
3880
- import { basename } from "path";
4076
+ import { basename as basename2 } from "path";
3881
4077
  import { fileURLToPath } from "url";
3882
4078
  function isMainModule(argv1, moduleUrl, importMetaMain) {
3883
4079
  if (importMetaMain === true) return true;
@@ -3892,7 +4088,7 @@ function isMainModule(argv1, moduleUrl, importMetaMain) {
3892
4088
  }
3893
4089
  function shouldForceEntry(argv1, binNames) {
3894
4090
  if (argv1 === void 0) return false;
3895
- return binNames.includes(basename(argv1));
4091
+ return binNames.includes(basename2(argv1));
3896
4092
  }
3897
4093
  function shouldRunAsEntry(argv1, moduleUrl, importMetaMain, binNames) {
3898
4094
  if (isMainModule(argv1, moduleUrl, importMetaMain)) {
@@ -4009,24 +4205,8 @@ async function dispatch(argv, now) {
4009
4205
  return runLogin();
4010
4206
  case "oauth":
4011
4207
  return oauth(args);
4012
- case "share": {
4013
- const surface = via(args);
4014
- if (surface === "invalid") {
4015
- return err(
4016
- "share",
4017
- "INVALID_INPUT",
4018
- `unknown --via '${str(args, "via") ?? ""}'`,
4019
- "one of: oauth, voyager. Omit it to prefer OAuth and fall back to Voyager."
4020
- );
4021
- }
4022
- return runShare(
4023
- args.positionals[0],
4024
- str(args, "visibility") ?? "public",
4025
- now,
4026
- void 0,
4027
- surface
4028
- );
4029
- }
4208
+ case "share":
4209
+ return share3(args, now);
4030
4210
  case "comment":
4031
4211
  return runComment(args.positionals[0], args.positionals[1], now);
4032
4212
  case "edit":
@@ -4083,6 +4263,43 @@ if (entry.run) {
4083
4263
  `);
4084
4264
  process.exit(exitCodeFor(envelope));
4085
4265
  }
4266
+ function share3(args, now) {
4267
+ const surface = via(args);
4268
+ if (surface === "invalid") {
4269
+ return err(
4270
+ "share",
4271
+ "INVALID_INPUT",
4272
+ `unknown --via '${str(args, "via") ?? ""}'`,
4273
+ "one of: oauth, voyager. Omit it to prefer OAuth and fall back to Voyager."
4274
+ );
4275
+ }
4276
+ for (const flag of ["image", "video"]) {
4277
+ if (args.flags[flag] === true) {
4278
+ return err("share", "INVALID_INPUT", `--${flag} needs a file path`);
4279
+ }
4280
+ }
4281
+ const image = str(args, "image");
4282
+ const video = str(args, "video");
4283
+ if (image !== void 0 && video !== void 0) {
4284
+ return err(
4285
+ "share",
4286
+ "INVALID_INPUT",
4287
+ "a post carries an image or a video, not both",
4288
+ "pass one of --image <path> or --video <path>"
4289
+ );
4290
+ }
4291
+ let media;
4292
+ if (image !== void 0) media = { flag: "image", path: image };
4293
+ else if (video !== void 0) media = { flag: "video", path: video };
4294
+ return runShare(
4295
+ args.positionals[0],
4296
+ str(args, "visibility") ?? "public",
4297
+ now,
4298
+ void 0,
4299
+ surface,
4300
+ media
4301
+ );
4302
+ }
4086
4303
  export {
4087
4304
  dispatch
4088
4305
  };