post-engineer-mcp 1.52.622 → 1.52.629
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 +2 -2
- package/dist/account-shapes.d.ts +4 -4
- package/dist/account-shapes.js +2 -1
- package/dist/account-shapes.js.map +1 -1
- package/dist/client-posts.d.ts +1 -1
- package/dist/client-publish-existing.js +10 -72
- package/dist/client-publish-existing.js.map +1 -1
- package/dist/client-publish-uploaded.js +11 -12
- package/dist/client-publish-uploaded.js.map +1 -1
- package/dist/client-types.d.ts +28 -43
- package/dist/client-user-media.d.ts +12 -4
- package/dist/client-user-media.js +14 -6
- package/dist/client-user-media.js.map +1 -1
- package/dist/client.js +3 -3
- package/dist/client.js.map +1 -1
- package/dist/cloned-voice-client.js +2 -2
- package/dist/cloned-voice-client.js.map +1 -1
- package/dist/connect-account.d.ts +6 -4
- package/dist/connect-account.js +2 -1
- package/dist/connect-account.js.map +1 -1
- package/dist/contracts/accounts.d.ts +0 -5
- package/dist/contracts/accounts.js +1 -5
- package/dist/contracts/accounts.js.map +1 -1
- package/dist/contracts/metrics.d.ts +13 -17
- package/dist/contracts/metrics.js +1 -17
- package/dist/contracts/metrics.js.map +1 -1
- package/dist/contracts/posts.d.ts +10 -15
- package/dist/contracts/posts.js +2 -17
- package/dist/contracts/posts.js.map +1 -1
- package/dist/contracts/providers.d.ts +18 -0
- package/dist/contracts/providers.js +48 -0
- package/dist/contracts/providers.js.map +1 -0
- package/dist/contracts/schedule.d.ts +4 -4
- package/dist/contracts/upload-types.d.ts +13 -0
- package/dist/contracts/upload-types.js +22 -0
- package/dist/contracts/upload-types.js.map +1 -0
- package/dist/contracts/videos.d.ts +25 -20
- package/dist/contracts/videos.js +13 -20
- package/dist/contracts/videos.js.map +1 -1
- package/dist/generate-video.d.ts +10 -6
- package/dist/generate-video.js +4 -17
- package/dist/generate-video.js.map +1 -1
- package/dist/intent-content.js +9 -4
- package/dist/intent-content.js.map +1 -1
- package/dist/limits.d.ts +1 -1
- package/dist/limits.js +1 -1
- package/dist/limits.js.map +1 -1
- package/dist/public-ip.d.ts +1 -0
- package/dist/public-ip.js +50 -27
- package/dist/public-ip.js.map +1 -1
- package/dist/publish-direct-shape.d.ts +4 -4
- package/dist/publish-direct-shape.js +2 -1
- package/dist/publish-direct-shape.js.map +1 -1
- package/dist/publish-existing-shape.d.ts +75 -44
- package/dist/publish-existing-shape.js +62 -47
- package/dist/publish-existing-shape.js.map +1 -1
- package/dist/publish-uploaded-shape.d.ts +8 -4
- package/dist/publish-uploaded-shape.js +5 -4
- package/dist/publish-uploaded-shape.js.map +1 -1
- package/dist/schedule-shapes.js +32 -5
- package/dist/schedule-shapes.js.map +1 -1
- package/dist/single-video-shape.d.ts +4 -4
- package/dist/single-video-shape.js +2 -1
- package/dist/single-video-shape.js.map +1 -1
- package/dist/tools-batch.d.ts +6 -6
- package/dist/tools-experiments.d.ts +4 -4
- package/dist/tools-posts.d.ts +4 -4
- package/dist/tools-publish-existing.d.ts +2 -3
- package/dist/tools-publish-existing.js +125 -49
- package/dist/tools-publish-existing.js.map +1 -1
- package/dist/tools-single-video.d.ts +4 -4
- package/dist/tools-single-video.js +2 -1
- package/dist/tools-single-video.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -197,7 +197,7 @@ The server offers **16 intent tools**, not one tool per API endpoint. A tool is
|
|
|
197
197
|
| `billing` | `balance`, `transactions` | Prepaid tokens. |
|
|
198
198
|
| `prompts` | `list`, `get` | The recipe prompts. |
|
|
199
199
|
| `check_script` | `validate`, `score` | Check a script before spending tokens. |
|
|
200
|
-
| `publish_video` | `from_file`, `create_upload`, `complete_upload`, `publish_upload` | Publish a
|
|
200
|
+
| `publish_video` | `from_file`, `create_upload`, `complete_upload`, `publish_upload`, `publish_existing` | Publish media that already exists, with no generation and no charge. `publish_existing` takes a finished video (`taskId`), a completed upload (`uploadId`) or a local image (`imagePath`, stdio only; over HTTP an image goes through `create_upload` like a video, never as base64), sends it to every network of its `accounts` (names or ids, or the persona's bound accounts) in one call, and needs `mode`: `asap`, or `scheduled` once at `publishAt`. A retry with the same `idempotencyKey` replays the original result in both modes. Images (JPEG/PNG, 8 MB) post to Instagram, Bluesky (1 MB), LinkedIn, Threads, Facebook and Pinterest. |
|
|
201
201
|
|
|
202
202
|
Actions that read a file from the disk (`persona_media` `add_image`, `media` `upload`, `publish_video` `from_file`, and a local `audioPath`/`avatarPath`) exist only on the stdio server: a path served over HTTP would resolve on the server's host. Over HTTP use public URLs, or the signed upload of `publish_video`.
|
|
203
203
|
|
|
@@ -281,4 +281,4 @@ objective). The MCP needs no change: it serves whatever the web hub lists.
|
|
|
281
281
|
|
|
282
282
|
- Platform: https://post-engineer.com/
|
|
283
283
|
- API keys: https://post-engineer.com/recipes
|
|
284
|
-
- Recipes: [docs/recipes/daily-news.md](../../docs/recipes/daily-news.md) (daily news becomes a video), [docs/recipes/place-spotlight.md](../../docs/recipes/place-spotlight.md) (place spotlight becomes a video), [docs/recipes/subject-spotlight.md](../../docs/recipes/subject-spotlight.md) (subject spotlight becomes a video), [docs/recipes/last-30-days.md](../../docs/recipes/last-30-days.md) (last 30 days become a video), [docs/recipes/multi-rede.md](../../docs/recipes/multi-rede.md) (one week, one video per network), [docs/recipes/viral-shorts.md](../../docs/recipes/viral-shorts.md) (a viral video becomes your Short)
|
|
284
|
+
- Recipes: [docs/recipes/daily-news.md](../../docs/recipes/daily-news.md) (daily news becomes a video), [docs/recipes/place-spotlight.md](../../docs/recipes/place-spotlight.md) (place spotlight becomes a video), [docs/recipes/subject-spotlight.md](../../docs/recipes/subject-spotlight.md) (subject spotlight becomes a video), [docs/recipes/last-30-days.md](../../docs/recipes/last-30-days.md) (last 30 days become a video), [docs/recipes/multi-rede.md](../../docs/recipes/multi-rede.md) (one week, one video per network), [docs/recipes/viral-shorts.md](../../docs/recipes/viral-shorts.md) (a viral video becomes your Short), [docs/recipes/ab-hook-test.md](../../docs/recipes/ab-hook-test.md) (test two hooks) and [docs/recipes/story-first-reels.md](../../docs/recipes/story-first-reels.md) (write scripts story-first)
|
package/dist/account-shapes.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ export declare const DisconnectAccountShape: {
|
|
|
3
3
|
provider: z.ZodEnum<{
|
|
4
4
|
youtube: "youtube";
|
|
5
5
|
instagram: "instagram";
|
|
6
|
-
linkedin: "linkedin";
|
|
7
6
|
bluesky: "bluesky";
|
|
7
|
+
linkedin: "linkedin";
|
|
8
8
|
threads: "threads";
|
|
9
9
|
facebook: "facebook";
|
|
10
10
|
pinterest: "pinterest";
|
|
11
|
-
fanvue: "fanvue";
|
|
12
11
|
"3speak": "3speak";
|
|
13
12
|
rumble: "rumble";
|
|
13
|
+
fanvue: "fanvue";
|
|
14
14
|
}>;
|
|
15
15
|
providerAccountId: z.ZodString;
|
|
16
16
|
};
|
|
@@ -18,14 +18,14 @@ export declare const DisconnectAccountSchema: z.ZodObject<{
|
|
|
18
18
|
provider: z.ZodEnum<{
|
|
19
19
|
youtube: "youtube";
|
|
20
20
|
instagram: "instagram";
|
|
21
|
-
linkedin: "linkedin";
|
|
22
21
|
bluesky: "bluesky";
|
|
22
|
+
linkedin: "linkedin";
|
|
23
23
|
threads: "threads";
|
|
24
24
|
facebook: "facebook";
|
|
25
25
|
pinterest: "pinterest";
|
|
26
|
-
fanvue: "fanvue";
|
|
27
26
|
"3speak": "3speak";
|
|
28
27
|
rumble: "rumble";
|
|
28
|
+
fanvue: "fanvue";
|
|
29
29
|
}>;
|
|
30
30
|
providerAccountId: z.ZodString;
|
|
31
31
|
}, z.core.$strip>;
|
package/dist/account-shapes.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// under the file-size ratchet; tools.ts re-exports them so existing import
|
|
3
3
|
// sites (`./tools.js`) keep working.
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { SOCIAL_PROVIDERS } from './contracts/providers.js';
|
|
5
6
|
export const DisconnectAccountShape = {
|
|
6
7
|
provider: z
|
|
7
|
-
.enum(
|
|
8
|
+
.enum(SOCIAL_PROVIDERS)
|
|
8
9
|
.describe('The social platform of the account to disconnect.'),
|
|
9
10
|
providerAccountId: z
|
|
10
11
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-shapes.js","sourceRoot":"","sources":["../src/account-shapes.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,qCAAqC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"account-shapes.js","sourceRoot":"","sources":["../src/account-shapes.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,qCAAqC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,CAAC;SACR,IAAI,CAAC,gBAAgB,CAAC;SACtB,QAAQ,CAAC,mDAAmD,CAAC;IAChE,iBAAiB,EAAE,CAAC;SACjB,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC;SACvC,QAAQ,CACP,0HAA0H,CAC3H;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAExE,iBAAiB;AACjB,mEAAmE;AACnE,qEAAqE;AACrE,sEAAsE;AACtE,oEAAoE;AACpE,kEAAkE;AAClE,uEAAuE;AACvE,2BAA2B;AAC3B,iBAAiB;AACjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAC9C,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;IAC3E,OAAO,EAAE,0DAA0D;CACpE,CAAC;KACD,QAAQ,CACP,4IAA4I;IAC1I,mIAAmI,CACtI,CAAC"}
|
package/dist/client-posts.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PostEngineerClient } from './client.js';
|
|
2
2
|
import { getRetentionCurve as getRetentionCurveContract, listMetrics as listMetricsContract } from './contracts/metrics.js';
|
|
3
|
-
import type { SocialProvider } from './contracts/
|
|
3
|
+
import type { SocialProvider } from './contracts/providers.js';
|
|
4
4
|
import { getPost as getPostContract } from './contracts/posts.js';
|
|
5
5
|
import { listPostsInRange as listPostsInRangeContract } from './contracts/schedule.js';
|
|
6
6
|
import { scoreDraft as scoreDraftContract } from './contracts/videos.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isRecord, narrowDirectPublishAccountResult } from './direct-publish-narrowing.js';
|
|
2
|
-
import { MAX_SEGMENT_MEDIA_BYTES, MAX_SEGMENT_MEDIA_MB } from './limits.js';
|
|
3
2
|
//---------------
|
|
4
3
|
// Publish-existing client call (issue #384). Standalone function (not a
|
|
5
4
|
// client method) because client.ts is grandfathered over the 500-line cap
|
|
@@ -7,18 +6,11 @@ import { MAX_SEGMENT_MEDIA_BYTES, MAX_SEGMENT_MEDIA_MB } from './limits.js';
|
|
|
7
6
|
// call publishes or schedules media that already exists (a finished engine
|
|
8
7
|
// video, a ready signed-upload video, or an inline image) with no
|
|
9
8
|
// generation and no token charge. JSON only: no local path ever crosses
|
|
10
|
-
// this surface.
|
|
9
|
+
// this surface. The input arrives validated and resolved (the handler's
|
|
10
|
+
// strict schema, then the account references), so this module only
|
|
11
|
+
// builds the body and narrows the answer: the server re-checks every rule.
|
|
11
12
|
//---------------
|
|
12
13
|
const PUBLISH_EXISTING_TIMEOUT_MS = 120_000;
|
|
13
|
-
const VALID_PROVIDERS = ['youtube', 'instagram', 'linkedin', 'bluesky', 'threads', 'facebook', 'pinterest', 'fanvue', '3speak', 'rumble'];
|
|
14
|
-
/** Base64 strictness is a length + round-trip check, never a regex: the alphabet pattern backtracks on multi-megabyte input. */
|
|
15
|
-
function decodedImageBytes(imageData) {
|
|
16
|
-
const compact = imageData.replace(/\s/g, '');
|
|
17
|
-
if (compact.length === 0 || compact.length % 4 !== 0)
|
|
18
|
-
return null;
|
|
19
|
-
const buffer = Buffer.from(compact, 'base64');
|
|
20
|
-
return buffer.toString('base64') === compact ? buffer : null;
|
|
21
|
-
}
|
|
22
14
|
function narrowScheduledSlot(value) {
|
|
23
15
|
if (!isRecord(value))
|
|
24
16
|
return null;
|
|
@@ -68,78 +60,26 @@ function narrowPublishExistingResult(value) {
|
|
|
68
60
|
return {
|
|
69
61
|
mode: 'asap',
|
|
70
62
|
success: value.success === true,
|
|
63
|
+
replayed: value.replayed === true,
|
|
71
64
|
mediaKind: value.mediaKind,
|
|
72
65
|
publishes,
|
|
73
66
|
logId: value.logId,
|
|
74
67
|
};
|
|
75
68
|
}
|
|
76
69
|
export async function publishExisting(client, input) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
throw new Error(`provider must be one of: ${VALID_PROVIDERS.join(', ')}.`);
|
|
82
|
-
}
|
|
83
|
-
if (input.accountIds.length === 0) {
|
|
84
|
-
throw new Error('At least one account ID is required.');
|
|
85
|
-
}
|
|
86
|
-
if (input.title.trim().length === 0) {
|
|
87
|
-
throw new Error('title is required.');
|
|
88
|
-
}
|
|
89
|
-
if (input.description.trim().length === 0) {
|
|
90
|
-
throw new Error('description is required.');
|
|
91
|
-
}
|
|
92
|
-
if (input.mediaKind === 'task' && (input.taskId === undefined || input.taskId.trim().length === 0)) {
|
|
93
|
-
throw new Error('taskId is required when mediaKind is task.');
|
|
94
|
-
}
|
|
95
|
-
if (input.mediaKind === 'upload' && (input.uploadId === undefined || input.uploadId.trim().length === 0)) {
|
|
96
|
-
throw new Error('uploadId is required when mediaKind is upload.');
|
|
97
|
-
}
|
|
98
|
-
let media;
|
|
99
|
-
if (input.mediaKind === 'task') {
|
|
100
|
-
media = { kind: 'task', taskId: input.taskId };
|
|
101
|
-
}
|
|
102
|
-
else if (input.mediaKind === 'upload') {
|
|
103
|
-
media = { kind: 'upload', uploadId: input.uploadId };
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
if (input.provider !== 'instagram') {
|
|
107
|
-
throw new Error('Images can only be published to instagram for now.');
|
|
108
|
-
}
|
|
109
|
-
if (input.imageData === undefined || input.imageContentType === undefined) {
|
|
110
|
-
throw new Error('imageData and imageContentType are required when mediaKind is image.');
|
|
111
|
-
}
|
|
112
|
-
const bytes = decodedImageBytes(input.imageData);
|
|
113
|
-
if (bytes === null) {
|
|
114
|
-
throw new Error('imageData must be base64-encoded bytes.');
|
|
115
|
-
}
|
|
116
|
-
if (bytes.length > MAX_SEGMENT_MEDIA_BYTES) {
|
|
117
|
-
throw new Error(`Image is too large. Maximum is ${MAX_SEGMENT_MEDIA_MB} MB.`);
|
|
118
|
-
}
|
|
119
|
-
media = { kind: 'image', imageData: input.imageData, contentType: input.imageContentType };
|
|
120
|
-
}
|
|
121
|
-
const mode = input.mode ?? 'scheduled';
|
|
122
|
-
if (mode === 'scheduled' && (input.startAt === undefined || input.times === undefined)) {
|
|
123
|
-
throw new Error('startAt and times are required when mode is scheduled.');
|
|
124
|
-
}
|
|
125
|
-
if (mode === 'asap' && (input.startAt !== undefined || input.times !== undefined)) {
|
|
126
|
-
throw new Error('startAt and times must not be set when mode is asap.');
|
|
127
|
-
}
|
|
128
|
-
const publishing = {
|
|
129
|
-
mode,
|
|
130
|
-
providers: [input.provider],
|
|
131
|
-
accounts: { [input.provider]: input.accountIds },
|
|
132
|
-
};
|
|
133
|
-
if (mode === 'scheduled') {
|
|
134
|
-
publishing.schedule = { startAt: input.startAt, times: input.times, timezone: input.timezone ?? 'UTC' };
|
|
70
|
+
const providers = Object.keys(input.accounts);
|
|
71
|
+
const publishing = { mode: input.mode, providers, accounts: input.accounts };
|
|
72
|
+
if (input.mode === 'scheduled') {
|
|
73
|
+
publishing.schedule = { publishAt: input.publishAt, timezone: input.timezone };
|
|
135
74
|
}
|
|
136
75
|
if (input.boardId !== undefined)
|
|
137
76
|
publishing.pinterestBoardId = input.boardId;
|
|
138
77
|
const body = {
|
|
139
|
-
media,
|
|
78
|
+
media: input.media,
|
|
140
79
|
title: input.title,
|
|
141
80
|
description: input.description,
|
|
142
81
|
publishing,
|
|
82
|
+
idempotencyKey: input.idempotencyKey,
|
|
143
83
|
};
|
|
144
84
|
if (input.personaId !== undefined)
|
|
145
85
|
body.personaId = input.personaId;
|
|
@@ -149,8 +89,6 @@ export async function publishExisting(client, input) {
|
|
|
149
89
|
body.privacyStatus = input.privacyStatus;
|
|
150
90
|
if (input.caption !== undefined)
|
|
151
91
|
body.caption = input.caption;
|
|
152
|
-
if (input.idempotencyKey !== undefined)
|
|
153
|
-
body.idempotencyKey = input.idempotencyKey;
|
|
154
92
|
const result = await client.request('/api/media/publish-existing', { method: 'POST', headers: client.getHeaders(), body: JSON.stringify(body) }, 'publish existing media', PUBLISH_EXISTING_TIMEOUT_MS);
|
|
155
93
|
return narrowPublishExistingResult(result);
|
|
156
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-publish-existing.js","sourceRoot":"","sources":["../src/client-publish-existing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"client-publish-existing.js","sourceRoot":"","sources":["../src/client-publish-existing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAE3F,iBAAiB;AACjB,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AAK,SAAS;QAAE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACrD,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS;QAAE,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IAChF,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAE9D,MAAM,MAAM,GAAY,MAAM,MAAM,CAAC,OAAO,CAC1C,6BAA6B,EAC7B,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAC5E,wBAAwB,EACxB,2BAA2B,CAC5B,CAAC;IACF,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -2,11 +2,12 @@ import { readFile, stat } from 'node:fs/promises';
|
|
|
2
2
|
import { basename, extname } from 'node:path';
|
|
3
3
|
import { parseContractResponse } from './contract-response.js';
|
|
4
4
|
import { uploadContent as uploadContentContract } from './contracts/media.js';
|
|
5
|
-
import {
|
|
5
|
+
import { MintVideoUploadBodySchema, completeVideoUpload as completeVideoUploadContract, mintVideoUpload as mintVideoUploadContract, publishUploadedVideo as publishUploadedVideoContract, } from './contracts/videos.js';
|
|
6
6
|
import { buildDirectPublishForm, requireDirectPublishFields } from './direct-publish-form.js';
|
|
7
7
|
import { narrowDirectPublishAccountResult } from './direct-publish-narrowing.js';
|
|
8
8
|
import { getErrorMessage, VideoTooLargeError } from './errors.js';
|
|
9
9
|
import { DIRECT_PUBLISH_TIMEOUT_MS, MAX_UPLOAD_VIDEO_BYTES } from './limits.js';
|
|
10
|
+
import { isSocialProvider, SOCIAL_PROVIDERS } from './contracts/providers.js';
|
|
10
11
|
//---------------
|
|
11
12
|
// Signed-upload publish client calls (issue #561). Standalone functions
|
|
12
13
|
// (not client methods) because client.ts is grandfathered over the
|
|
@@ -19,11 +20,11 @@ import { DIRECT_PUBLISH_TIMEOUT_MS, MAX_UPLOAD_VIDEO_BYTES } from './limits.js';
|
|
|
19
20
|
//---------------
|
|
20
21
|
const UPLOAD_TIMEOUT_MS = 120_000;
|
|
21
22
|
export async function createVideoUpload(client, input) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!
|
|
26
|
-
throw new Error(
|
|
23
|
+
// The contract body schema carries the per-type ceiling (8 MB for an
|
|
24
|
+
// image, 2GB for a video): fail fast with the route's own message.
|
|
25
|
+
const body = MintVideoUploadBodySchema.safeParse(input);
|
|
26
|
+
if (!body.success) {
|
|
27
|
+
throw new Error(body.error.issues[0]?.message ?? 'Invalid upload request.');
|
|
27
28
|
}
|
|
28
29
|
const raw = await client.request('/api/videos/upload-url', {
|
|
29
30
|
method: 'POST',
|
|
@@ -49,9 +50,8 @@ export async function completeVideoUpload(client, uploadId) {
|
|
|
49
50
|
export async function publishUploadedVideo(client, input) {
|
|
50
51
|
// Mirrors the server-side 400s before any fetch: provider-specific
|
|
51
52
|
// required fields fail fast here, exactly like publishVideoDirect.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
throw new Error(`provider must be one of: ${validProviders.join(', ')}.`);
|
|
53
|
+
if (!isSocialProvider(input.provider)) {
|
|
54
|
+
throw new Error(`provider must be one of: ${SOCIAL_PROVIDERS.join(', ')}.`);
|
|
55
55
|
}
|
|
56
56
|
if (input.uploadId.trim().length === 0) {
|
|
57
57
|
throw new Error('uploadId is required.');
|
|
@@ -155,9 +155,8 @@ export async function publishVideoDirect(client, input) {
|
|
|
155
155
|
// Direct publish of a user-provided video — no generation, no schedule.
|
|
156
156
|
// Mirrors the server-side 400s: provider-specific required fields and
|
|
157
157
|
// per-provider account-id field names fail fast here, before any fetch.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
throw new Error(`provider must be one of: ${validProviders.join(', ')}.`);
|
|
158
|
+
if (!isSocialProvider(input.provider)) {
|
|
159
|
+
throw new Error(`provider must be one of: ${SOCIAL_PROVIDERS.join(', ')}.`);
|
|
161
160
|
}
|
|
162
161
|
if (input.accountIds.length === 0) {
|
|
163
162
|
throw new Error('At least one account ID is required.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-publish-uploaded.js","sourceRoot":"","sources":["../src/client-publish-uploaded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAS9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"client-publish-uploaded.js","sourceRoot":"","sources":["../src/client-publish-uploaded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAS9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EACL,yBAAyB,EACzB,mBAAmB,IAAI,2BAA2B,EAClD,eAAe,IAAI,uBAAuB,EAC1C,oBAAoB,IAAI,4BAA4B,GACrD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MA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AAS,EAAE,QAAQ,CAAC,CAAC;IAE5E,MAAM,MAAM,GAAY,MAAM,MAAM,CAAC,OAAO,CAC1C,qBAAqB,EACrB,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EACrE,sBAAsB,EACtB,yBAAyB,CAC1B,CAAC;IACF,uEAAuE;IACvE,iEAAiE;IACjE,qEAAqE;IACrE,qEAAqE;IACrE,MAAM,MAAM,GAAG,qBAAqB,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACpE,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,SAAS;QACtC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC;QAC7D,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,CAAC;QACtC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;KAC1B,CAAC;AACJ,CAAC"}
|
package/dist/client-types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VIDEO_LAYOUTS } from './limits.js';
|
|
2
2
|
import type { FaceQuality, VideoAspect } from './contracts/personas.js';
|
|
3
3
|
import type { VideoType } from './video-type.js';
|
|
4
|
+
import type { SocialProvider } from './contracts/providers.js';
|
|
4
5
|
export type { VideoType } from './video-type.js';
|
|
5
6
|
export interface PostEngineerClientOptions {
|
|
6
7
|
apiKey?: string;
|
|
@@ -73,7 +74,7 @@ export interface GeneratePersonaVideoInput {
|
|
|
73
74
|
variantId: string;
|
|
74
75
|
pair: number;
|
|
75
76
|
};
|
|
76
|
-
providers:
|
|
77
|
+
providers: SocialProvider[];
|
|
77
78
|
youtubeAccountIds?: string[];
|
|
78
79
|
instagramAccountIds?: string[];
|
|
79
80
|
linkedinAccountIds?: string[];
|
|
@@ -146,7 +147,7 @@ export interface UpdatePersonaInput {
|
|
|
146
147
|
}
|
|
147
148
|
/** Input for publishing a user-provided video directly, without generation. */
|
|
148
149
|
export interface PublishVideoDirectInput {
|
|
149
|
-
provider:
|
|
150
|
+
provider: SocialProvider;
|
|
150
151
|
/** Local path to the video file (.mp4 or .mov, max 2GB). */
|
|
151
152
|
videoPath: string;
|
|
152
153
|
/** Target accounts (channel IDs / IG user IDs / DIDs / LinkedIn member IDs or org URNs / Threads user IDs / Facebook Page IDs / Pinterest user IDs / Fanvue account IDs / Hive usernames / Rumble Channel IDs). */
|
|
@@ -174,7 +175,7 @@ export interface PublishVideoDirectInput {
|
|
|
174
175
|
}
|
|
175
176
|
/** Input for publishing a signed-upload video by id, without generation. */
|
|
176
177
|
export interface PublishUploadedVideoInput {
|
|
177
|
-
provider:
|
|
178
|
+
provider: SocialProvider;
|
|
178
179
|
/** The uploadId of a completed signed upload (create + complete). Single-use. */
|
|
179
180
|
uploadId: string;
|
|
180
181
|
/** Target accounts (same IDs as PublishVideoDirectInput). */
|
|
@@ -207,53 +208,35 @@ export interface CompletedVideoUpload {
|
|
|
207
208
|
contentType: string;
|
|
208
209
|
sizeBytes: number;
|
|
209
210
|
}
|
|
210
|
-
/**
|
|
211
|
+
/** POST /api/media/publish-existing body fields, built by the publish_existing handler once every reference is resolved. */
|
|
211
212
|
export interface PublishExistingInput {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
213
|
+
media: {
|
|
214
|
+
kind: 'task';
|
|
215
|
+
taskId: string;
|
|
216
|
+
} | {
|
|
217
|
+
kind: 'upload';
|
|
218
|
+
uploadId: string;
|
|
219
|
+
} | {
|
|
220
|
+
kind: 'image';
|
|
221
|
+
imageData: string;
|
|
222
|
+
contentType: 'image/jpeg' | 'image/png';
|
|
223
|
+
};
|
|
224
|
+
/** Resolved account ids per network; the networks are its keys. */
|
|
225
|
+
accounts: Partial<Record<SocialProvider, string[]>>;
|
|
225
226
|
title: string;
|
|
226
|
-
/** Required: the publish copy, at most 5000 characters. */
|
|
227
227
|
description: string;
|
|
228
|
-
/**
|
|
228
|
+
/** Caption-network text override; the server falls back to description. */
|
|
229
|
+
caption?: string;
|
|
229
230
|
personaId?: string;
|
|
230
|
-
|
|
231
|
-
mode
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/** Daily publish times (HH:MM, 24h). Required unless mode is 'asap'. */
|
|
235
|
-
times?: string[];
|
|
236
|
-
/** IANA timezone for a naive startAt and the times. Defaults to UTC. */
|
|
237
|
-
timezone?: string;
|
|
238
|
-
/** YouTube only: required for ASAP, optional when scheduled (derived from the title). */
|
|
231
|
+
mode: 'asap' | 'scheduled';
|
|
232
|
+
/** mode scheduled: the one publish moment (wall-clock in timezone, or with an offset). */
|
|
233
|
+
publishAt?: string;
|
|
234
|
+
timezone: string;
|
|
239
235
|
tags?: string[];
|
|
240
|
-
/** YouTube only: required for ASAP, optional when scheduled. */
|
|
241
236
|
privacyStatus?: 'public' | 'private' | 'unlisted';
|
|
242
|
-
/** Instagram/Bluesky/LinkedIn/Threads/Facebook/3Speak: required. Pinterest: pin description when description is omitted. */
|
|
243
|
-
caption?: string;
|
|
244
|
-
/** Pinterest only: required. The board the pin goes to (the id from accounts (action: list_boards)). */
|
|
245
237
|
boardId?: string;
|
|
246
|
-
/**
|
|
247
|
-
|
|
248
|
-
* a timed-out SCHEDULED call so the server replays the original result
|
|
249
|
-
* instead of scheduling the media again. ASAP calls are NOT replayed:
|
|
250
|
-
* retrying one publishes the media again (task/image) or fails as
|
|
251
|
-
* already consumed (upload) — check the provider account before
|
|
252
|
-
* retrying. Exception: a result with errorCode publish_unknown means
|
|
253
|
-
* the post may already be live but its record was lost — do not retry
|
|
254
|
-
* it, check the provider account first.
|
|
255
|
-
*/
|
|
256
|
-
idempotencyKey?: string;
|
|
238
|
+
/** Sent on every call: a retry with the same key replays the original result (schedule or recorded posts). */
|
|
239
|
+
idempotencyKey: string;
|
|
257
240
|
}
|
|
258
241
|
/** One scheduled slot from POST /api/media/publish-existing. */
|
|
259
242
|
export interface PublishExistingSlot {
|
|
@@ -272,6 +255,8 @@ export type PublishExistingResult = {
|
|
|
272
255
|
} | {
|
|
273
256
|
mode: 'asap';
|
|
274
257
|
success: boolean;
|
|
258
|
+
/** True when every account answered from the publish ledger: nothing was posted again. */
|
|
259
|
+
replayed: boolean;
|
|
275
260
|
mediaKind: 'task' | 'upload' | 'image';
|
|
276
261
|
publishes: Array<{
|
|
277
262
|
provider: string;
|
|
@@ -10,12 +10,20 @@ export type { CheckMediaCode } from './contracts/media.js';
|
|
|
10
10
|
* a bad file through.
|
|
11
11
|
*/
|
|
12
12
|
export declare function detectSegmentImageMimeType(buffer: Buffer): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Read one local image with the stat-before-read, size-guard-before-and-
|
|
15
|
+
* after-read pattern of the persona library uploads (8MB engine photo
|
|
16
|
+
* limit) and sniff its real type. Shared by the segment upload and the
|
|
17
|
+
* publish_existing image path, so both read local files the same way.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readLocalImage(path: string): Promise<{
|
|
20
|
+
buffer: Buffer;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
}>;
|
|
13
23
|
/**
|
|
14
24
|
* Upload one local image for a segment and return its mediaId.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* limit instead of the 10MB library limit. Only the mediaId reaches
|
|
18
|
-
* tool output: the local path and the temp asset URL never do.
|
|
25
|
+
* Only the mediaId reaches tool output: the local path and the temp
|
|
26
|
+
* asset URL never do.
|
|
19
27
|
*/
|
|
20
28
|
export declare function uploadSegmentMedia(client: PostEngineerClient, path: string): Promise<{
|
|
21
29
|
mediaId: string;
|
|
@@ -42,13 +42,12 @@ function assertSegmentMediaSize(sizeBytes, path) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* tool output: the local path and the temp asset URL never do.
|
|
45
|
+
* Read one local image with the stat-before-read, size-guard-before-and-
|
|
46
|
+
* after-read pattern of the persona library uploads (8MB engine photo
|
|
47
|
+
* limit) and sniff its real type. Shared by the segment upload and the
|
|
48
|
+
* publish_existing image path, so both read local files the same way.
|
|
50
49
|
*/
|
|
51
|
-
export async function
|
|
50
|
+
export async function readLocalImage(path) {
|
|
52
51
|
let fileStat;
|
|
53
52
|
try {
|
|
54
53
|
fileStat = await stat(path);
|
|
@@ -72,6 +71,15 @@ export async function uploadSegmentMedia(client, path) {
|
|
|
72
71
|
if (mimeType === null) {
|
|
73
72
|
throw new Error(`Image "${basename(path)}" is not a JPG, PNG, or WebP image (real content, not extension).`);
|
|
74
73
|
}
|
|
74
|
+
return { buffer, mimeType };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Upload one local image for a segment and return its mediaId.
|
|
78
|
+
* Only the mediaId reaches tool output: the local path and the temp
|
|
79
|
+
* asset URL never do.
|
|
80
|
+
*/
|
|
81
|
+
export async function uploadSegmentMedia(client, path) {
|
|
82
|
+
const { buffer, mimeType } = await readLocalImage(path);
|
|
75
83
|
const formData = new FormData();
|
|
76
84
|
formData.append('file', new Blob([buffer], { type: mimeType }), basename(path));
|
|
77
85
|
const result = await client.request('/api/media/upload', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-user-media.js","sourceRoot":"","sources":["../src/client-user-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,WAAW,IAAI,mBAAmB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,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -11,6 +11,7 @@ import { connectBlueskyAccount as connectBlueskyAccountContract, connectRumbleAc
|
|
|
11
11
|
import { cancelSchedule as cancelScheduleContract, deleteSlot as deleteSlotContract, getSlot as getSlotContract, listPosts as listPostsContract, listSchedules as listSchedulesContract, updateSlotTitle as updateSlotTitleContract, } from './contracts/schedule.js';
|
|
12
12
|
import { VIDEO_GENERATIONS_MAX_LIMIT, getVideoGeneration as getVideoGenerationContract, getVideoStatus as getVideoStatusContract, listVideoGenerations as listVideoGenerationsContract, } from './contracts/video-tasks.js';
|
|
13
13
|
import { listVoices as listVoicesContract, } from './contracts/voices.js';
|
|
14
|
+
import { isSocialProvider, SOCIAL_PROVIDERS } from './contracts/providers.js';
|
|
14
15
|
import { generateAndSchedule as generateAndScheduleContract, validateScript as validateScriptContract, } from './contracts/videos.js';
|
|
15
16
|
import { MAX_DESCRIPTION_LENGTH as MAX_LIBRARY_DESCRIPTION_LENGTH, MAX_LIBRARY_IMAGES, MAX_TAG_LENGTH as MAX_LIBRARY_TAG_LENGTH, addPersonaImage as addPersonaImageContract, createPersona as createPersonaContract, deletePersona as deletePersonaContract, deletePersonaImage as deletePersonaImageContract, getPersonaDeletePreview as getPersonaDeletePreviewContract, listFaces as listFacesContract, listPersonaImages as listPersonaImagesContract, listPersonas as listPersonasContract, updatePersona as updatePersonaContract, updatePersonaImage as updatePersonaImageContract, } from './contracts/personas.js';
|
|
16
17
|
import { requireTitle } from './require-title.js';
|
|
@@ -332,9 +333,8 @@ export class PostEngineerClient {
|
|
|
332
333
|
async disconnectAccount(provider, providerAccountId) {
|
|
333
334
|
// The route 400s INVALID_PROVIDER / INVALID_PARAMS — fail fast with the
|
|
334
335
|
// field named before any fetch goes out.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
throw new Error(`provider must be one of: ${validProviders.join(', ')}.`);
|
|
336
|
+
if (!isSocialProvider(provider)) {
|
|
337
|
+
throw new Error(`provider must be one of: ${SOCIAL_PROVIDERS.join(', ')}.`);
|
|
338
338
|
}
|
|
339
339
|
if (providerAccountId.trim().length === 0) {
|
|
340
340
|
throw new Error('providerAccountId must be a non-empty string.');
|