@oxygen-agent/cli 1.1032.16 → 1.1033.20
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/README.md +1 -1
- package/dist/commands/publishing.js +45 -3
- package/node_modules/@oxygen/shared/dist/provider-http-error.d.ts +8 -0
- package/node_modules/@oxygen/shared/dist/provider-http-error.js +11 -0
- package/node_modules/@oxygen/shared/dist/version.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
- package/node_modules/@oxygen/shared/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -259,6 +259,43 @@ function buildPublishingPostUpdateBody(options) {
|
|
|
259
259
|
body.confirm_not_published = true;
|
|
260
260
|
return body;
|
|
261
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* The media flags: uploaded media ids and local files (uploaded first, in order)
|
|
264
|
+
* become the post's `media_asset_ids`, the attachments of this one channel. On
|
|
265
|
+
* update they replace the list as a content merge, so the rest of the content
|
|
266
|
+
* stays; `--clear-media` removes every attachment.
|
|
267
|
+
*/
|
|
268
|
+
async function withPublishingMediaOption(body, options, mode) {
|
|
269
|
+
const ids = (options.media ?? []).map((id) => id.trim()).filter(Boolean);
|
|
270
|
+
const files = (options.mediaFile ?? []).map((path) => path.trim()).filter(Boolean);
|
|
271
|
+
if (options.clearMedia && (ids.length > 0 || files.length > 0)) {
|
|
272
|
+
throw new OxygenError("invalid_request", "Choose --media/--media-file or --clear-media, not both.", { exitCode: 2 });
|
|
273
|
+
}
|
|
274
|
+
if (!options.clearMedia && ids.length === 0 && files.length === 0)
|
|
275
|
+
return body;
|
|
276
|
+
const content = isRecord(body.content) ? body.content : null;
|
|
277
|
+
if (content && content.media_asset_ids !== undefined) {
|
|
278
|
+
throw new OxygenError("invalid_request", "Set attachments with --media/--media-file or with media_asset_ids in --content-json, not both.", { exitCode: 2 });
|
|
279
|
+
}
|
|
280
|
+
let mediaAssetIds = null;
|
|
281
|
+
if (!options.clearMedia) {
|
|
282
|
+
const uploadedIds = [];
|
|
283
|
+
for (const path of files) {
|
|
284
|
+
const uploaded = await uploadPublishingMediaFile(path, { contentType: null, scheduledPostId: null });
|
|
285
|
+
const id = isRecord(uploaded.media) ? readRecordString(uploaded.media, "id") : null;
|
|
286
|
+
if (!id)
|
|
287
|
+
throw new OxygenError("publishing_media_upload_failed", `${basename(path)} uploaded but no media id came back.`, { exitCode: 1 });
|
|
288
|
+
uploadedIds.push(id);
|
|
289
|
+
}
|
|
290
|
+
mediaAssetIds = [...new Set([...ids, ...uploadedIds])];
|
|
291
|
+
}
|
|
292
|
+
if (content)
|
|
293
|
+
return { ...body, content: { ...content, ...(mediaAssetIds ? { media_asset_ids: mediaAssetIds } : {}) } };
|
|
294
|
+
if (!mode.update)
|
|
295
|
+
return mediaAssetIds ? { ...body, content: { media_asset_ids: mediaAssetIds } } : body;
|
|
296
|
+
const merge = isRecord(body.content_merge) ? body.content_merge : {};
|
|
297
|
+
return { ...body, content_merge: { ...merge, media_asset_ids: mediaAssetIds } };
|
|
298
|
+
}
|
|
262
299
|
/**
|
|
263
300
|
* The video cover flags (LinkedIn videos, Instagram Reels): a media id, a local file uploaded first, or
|
|
264
301
|
* (update only) a clear. Sent as the top-level `video_thumbnail_media_asset_id`,
|
|
@@ -787,7 +824,7 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
787
824
|
.addCommand(new Command("create")
|
|
788
825
|
.description("Create a personal Publishing post. Use --ugc-participation-id to save it into one program as an unapproved draft; otherwise it defaults to scheduled and publishes only after approval.")
|
|
789
826
|
.option("--publish-at <iso>", "When the post publishes, e.g. 2026-10-06T09:00:00+02:00. With Z or an offset it is that exact instant; without one (2026-10-06T09:00) it is wall-clock time in --timezone. Required unless --group-with, where the channel takes that post's time.")
|
|
790
|
-
.option("--group-with <post_id>", "Add this as another channel of an existing post (one post per channel), with its own account and
|
|
827
|
+
.option("--group-with <post_id>", "Add this as another channel of an existing post (one post per channel), with its own account, copy and media; pass the same --media ids to share one upload, or other ones for different files. It publishes at that post's time, so omit --publish-at and --timezone; `publishing posts get` lists the post's channels under group.")
|
|
791
828
|
.option("--provider <provider>", "Publishing provider: linkedin, x, instagram, tiktok, facebook, or youtube. Defaults to linkedin. LinkedIn publishes through --sender; every other provider publishes through a connected account (--provider-connection), which the worker needs before it can deliver.")
|
|
792
829
|
.option("--channel <channel>", "Publishing channel override. Defaults to provider.")
|
|
793
830
|
.option("--sender <sender_account_id>", "LinkedIn sender account id. Required for LinkedIn before the worker can publish.")
|
|
@@ -814,11 +851,13 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
814
851
|
.option("--photo-tag <username>", "X: tag an account in the first post's images (up to 10). Repeatable.", collectRepeatable, [])
|
|
815
852
|
.option("--video-thumbnail <media_id>", "Video cover for a LinkedIn video or Instagram Reel: an uploaded media id (`publishing media upload`); JPEG or PNG on LinkedIn, a JPEG up to 8 MB on Instagram. Needs a video in media_asset_ids (first on Instagram).")
|
|
816
853
|
.option("--video-thumbnail-file <path>", "Upload a local image and use it as the video cover (JPEG or PNG on LinkedIn, JPEG on Instagram).")
|
|
854
|
+
.option("--media <media_id>", "Attach an uploaded media id (`publishing media upload`) to this channel's post, in order. Repeatable. Each channel of a post has its own media: pass other ids with --group-with to give a channel different files, or the same ids to share one upload.", collectRepeatable, [])
|
|
855
|
+
.option("--media-file <path>", "Upload a local image, video or PDF and attach it to this channel's post, after any --media. Repeatable.", collectRepeatable, [])
|
|
817
856
|
.option("--json", "Print a JSON envelope.")
|
|
818
857
|
.action(async (options) => {
|
|
819
858
|
await handleAsyncAction("publishing posts create", options, async () => requestOxygen("/api/cli/publishing/posts", {
|
|
820
859
|
method: "POST",
|
|
821
|
-
body: await withPublishingVideoThumbnailOption(buildPublishingPostCreateBody(options), options),
|
|
860
|
+
body: await withPublishingVideoThumbnailOption(await withPublishingMediaOption(buildPublishingPostCreateBody(options), options, { update: false }), options),
|
|
822
861
|
}));
|
|
823
862
|
}))
|
|
824
863
|
.addCommand(new Command("get")
|
|
@@ -856,12 +895,15 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
856
895
|
.option("--video-thumbnail <media_id>", "Set the video cover of a LinkedIn video or Instagram Reel to an uploaded media id (`publishing media upload`); JPEG or PNG on LinkedIn, a JPEG up to 8 MB on Instagram. The post needs a video attached (first on Instagram).")
|
|
857
896
|
.option("--video-thumbnail-file <path>", "Upload a local image and set it as the video cover (JPEG or PNG on LinkedIn, JPEG on Instagram). To pick a frame from the video instead, open the post's web_url and use Cover.")
|
|
858
897
|
.option("--clear-video-thumbnail", "Remove the video cover.")
|
|
898
|
+
.option("--media <media_id>", "Replace this channel's attachments with uploaded media ids, in order; the post's other channels keep theirs. Repeatable. Revokes approval on an approved post.", collectRepeatable, [])
|
|
899
|
+
.option("--media-file <path>", "Upload a local image, video or PDF and attach it, after any --media; together they replace this channel's attachments. Repeatable.", collectRepeatable, [])
|
|
900
|
+
.option("--clear-media", "Remove every attachment from this channel's post.")
|
|
859
901
|
.option("--confirm-not-published", "Only after you checked the account: the post OXYGEN could not confirm is NOT there. Unlocks a post that failed with publishing_effect_outcome_uncertain; if the post is live, do not use it or it publishes twice.")
|
|
860
902
|
.option("--json", "Print a JSON envelope.")
|
|
861
903
|
.action(async (postId, options) => {
|
|
862
904
|
await handleAsyncAction("publishing posts update", options, async () => requestOxygen(`/api/cli/publishing/posts/${encodeURIComponent(postId)}`, {
|
|
863
905
|
method: "PATCH",
|
|
864
|
-
body: await withPublishingVideoThumbnailOption(buildPublishingPostUpdateBody(options), options),
|
|
906
|
+
body: await withPublishingVideoThumbnailOption(await withPublishingMediaOption(buildPublishingPostUpdateBody(options), options, { update: true }), options),
|
|
865
907
|
}));
|
|
866
908
|
}))
|
|
867
909
|
.addCommand(new Command("approve")
|
|
@@ -8,3 +8,11 @@ export type ProviderHttpError = Error & {
|
|
|
8
8
|
export declare function hasProviderHttpErrorIdentity(error: Error): boolean;
|
|
9
9
|
/** A provider HTTP error with a finite numeric status, ready to classify. */
|
|
10
10
|
export declare function isProviderHttpError(error: unknown): error is ProviderHttpError;
|
|
11
|
+
/**
|
|
12
|
+
* A provider's refusal of the request's TARGET, never of a credential: Firecrawl
|
|
13
|
+
* answers 403 "we do not support this site" for social networks and similar. The
|
|
14
|
+
* client stamps this code on its error and its span; classifiers key on the code,
|
|
15
|
+
* never on the 403 alone.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PROVIDER_TARGET_UNSUPPORTED = "provider_target_unsupported";
|
|
18
|
+
export declare function isProviderTargetUnsupported(error: unknown): boolean;
|
|
@@ -25,3 +25,14 @@ export function isProviderHttpError(error) {
|
|
|
25
25
|
const status = error.status;
|
|
26
26
|
return typeof status === "number" && Number.isFinite(status);
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A provider's refusal of the request's TARGET, never of a credential: Firecrawl
|
|
30
|
+
* answers 403 "we do not support this site" for social networks and similar. The
|
|
31
|
+
* client stamps this code on its error and its span; classifiers key on the code,
|
|
32
|
+
* never on the 403 alone.
|
|
33
|
+
*/
|
|
34
|
+
export const PROVIDER_TARGET_UNSUPPORTED = "provider_target_unsupported";
|
|
35
|
+
export function isProviderTargetUnsupported(error) {
|
|
36
|
+
return typeof error === "object" && error !== null
|
|
37
|
+
&& error.code === PROVIDER_TARGET_UNSUPPORTED;
|
|
38
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OXYGEN_BUILD_VERSION = "1.
|
|
1
|
+
export declare const OXYGEN_BUILD_VERSION = "1.1033.20";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// GENERATED by scripts/ci/version-stamp.mjs from VERSION + git history. Do not edit; do not commit.
|
|
2
|
-
export const OXYGEN_BUILD_VERSION = "1.
|
|
2
|
+
export const OXYGEN_BUILD_VERSION = "1.1033.20";
|
|
@@ -49,7 +49,7 @@ export const OXYGEN_VERSION = OXYGEN_BUILD_VERSION;
|
|
|
49
49
|
// Since 2026-09-28 the release-preparation step advances this literal to the
|
|
50
50
|
// highest CLI version published on npm for at least 30 days. It never lowers
|
|
51
51
|
// the floor. The source change lands on dev before the next production release.
|
|
52
|
-
export const OXYGEN_MINIMUM_CLI_VERSION = "1.1011.
|
|
52
|
+
export const OXYGEN_MINIMUM_CLI_VERSION = "1.1011.974";
|
|
53
53
|
// The internal GEO export first gains required pagination in this dev version.
|
|
54
54
|
// Earlier pilot clients would save a partial file without its continuation.
|
|
55
55
|
export const GEO_EXPORT_MINIMUM_CLI_VERSION = "1.1013.0";
|