post-engineer-mcp 1.31.0 → 1.33.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/README.md +51 -9
- package/dist/analytics.d.ts +1 -0
- package/dist/analytics.js +23 -1
- package/dist/analytics.js.map +1 -1
- package/dist/client-posts.d.ts +10 -0
- package/dist/client-posts.js +15 -0
- package/dist/client-posts.js.map +1 -0
- package/dist/client-publishing-accounts.d.ts +3 -0
- package/dist/client-publishing-accounts.js +18 -0
- package/dist/client-publishing-accounts.js.map +1 -0
- package/dist/client-types.d.ts +140 -0
- package/dist/client-types.js +2 -0
- package/dist/client-types.js.map +1 -0
- package/dist/client-user-media.d.ts +29 -0
- package/dist/client-user-media.js +135 -0
- package/dist/client-user-media.js.map +1 -0
- package/dist/client-video-task.d.ts +2 -0
- package/dist/client-video-task.js +9 -0
- package/dist/client-video-task.js.map +1 -0
- package/dist/client.d.ts +11 -134
- package/dist/client.js +32 -40
- package/dist/client.js.map +1 -1
- package/dist/cloned-voice-client.d.ts +11 -0
- package/dist/cloned-voice-client.js +134 -0
- package/dist/cloned-voice-client.js.map +1 -0
- package/dist/cloned-voice-tools.d.ts +70 -0
- package/dist/cloned-voice-tools.js +60 -0
- package/dist/cloned-voice-tools.js.map +1 -0
- package/dist/http-auth.d.ts +27 -0
- package/dist/http-auth.js +148 -0
- package/dist/http-auth.js.map +1 -0
- package/dist/http-rate-limit.d.ts +14 -0
- package/dist/http-rate-limit.js +28 -0
- package/dist/http-rate-limit.js.map +1 -0
- package/dist/http-transport.d.ts +13 -0
- package/dist/http-transport.js +311 -0
- package/dist/http-transport.js.map +1 -0
- package/dist/image-guards.d.ts +6 -0
- package/dist/image-guards.js +30 -0
- package/dist/image-guards.js.map +1 -0
- package/dist/index.js +69 -29
- package/dist/index.js.map +1 -1
- package/dist/language.d.ts +11 -0
- package/dist/language.js +19 -0
- package/dist/language.js.map +1 -0
- package/dist/limits.d.ts +39 -0
- package/dist/limits.js +39 -0
- package/dist/limits.js.map +1 -1
- package/dist/prompts.d.ts +9 -0
- package/dist/prompts.js +125 -0
- package/dist/prompts.js.map +1 -0
- package/dist/require-title.d.ts +1 -0
- package/dist/require-title.js +12 -0
- package/dist/require-title.js.map +1 -0
- package/dist/schedule-shapes.d.ts +70 -0
- package/dist/schedule-shapes.js +98 -0
- package/dist/schedule-shapes.js.map +1 -0
- package/dist/script-segments.d.ts +49 -0
- package/dist/script-segments.js +222 -0
- package/dist/script-segments.js.map +1 -0
- package/dist/single-video-shape.d.ts +340 -0
- package/dist/single-video-shape.js +74 -0
- package/dist/single-video-shape.js.map +1 -0
- package/dist/tools-call.d.ts +4 -0
- package/dist/tools-call.js +25 -0
- package/dist/tools-call.js.map +1 -0
- package/dist/tools-posts.d.ts +41 -0
- package/dist/tools-posts.js +45 -0
- package/dist/tools-posts.js.map +1 -0
- package/dist/tools-publishing-accounts.d.ts +29 -0
- package/dist/tools-publishing-accounts.js +38 -0
- package/dist/tools-publishing-accounts.js.map +1 -0
- package/dist/tools-single-video.d.ts +10 -0
- package/dist/tools-single-video.js +143 -0
- package/dist/tools-single-video.js.map +1 -0
- package/dist/tools-user-media.d.ts +27 -0
- package/dist/tools-user-media.js +38 -0
- package/dist/tools-user-media.js.map +1 -0
- package/dist/tools.d.ts +32 -230
- package/dist/tools.js +42 -295
- package/dist/tools.js.map +1 -1
- package/dist/video-task-tools.d.ts +14 -0
- package/dist/video-task-tools.js +20 -0
- package/dist/video-task-tools.js.map +1 -0
- package/dist/voice-filters.d.ts +21 -0
- package/dist/voice-filters.js +76 -0
- package/dist/voice-filters.js.map +1 -0
- package/package.json +6 -2
package/dist/language.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English-only launch gate — the single place the MCP server decides
|
|
3
|
+
* whether a language argument is allowed. Voice cloning only ever
|
|
4
|
+
* worked well in English and the non-English preset catalogs are not
|
|
5
|
+
* ready, so the tool schemas reject any other language until the
|
|
6
|
+
* launch lock lifts. Regional variants of English (en-US, en-GB, ...)
|
|
7
|
+
* count as English.
|
|
8
|
+
*/
|
|
9
|
+
export const ONLY_ENGLISH_VIDEOS_MESSAGE = 'Only English videos are supported for now';
|
|
10
|
+
export const ONLY_ENGLISH_CLONE_MESSAGE = 'Voice cloning is only available in English for now';
|
|
11
|
+
// Personas may store a language name instead of a code ("English"); the
|
|
12
|
+
// engine gate accepts that form, so the MCP gate must too, or legacy
|
|
13
|
+
// personas get rejected for being English.
|
|
14
|
+
const ENGLISH_LANGUAGE_NAMES = new Set(['english', 'inglês', 'ingles']);
|
|
15
|
+
export function isEnglishLanguage(language) {
|
|
16
|
+
const base = language.trim().toLowerCase().replace('_', '-').split('-')[0];
|
|
17
|
+
return base === 'en' || ENGLISH_LANGUAGE_NAMES.has(base);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../src/language.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,2CAA2C,CAAC;AAEvF,MAAM,CAAC,MAAM,0BAA0B,GAAG,oDAAoD,CAAC;AAE/F,wEAAwE;AACxE,qEAAqE;AACrE,2CAA2C;AAC3C,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExE,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,IAAI,KAAK,IAAI,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC"}
|
package/dist/limits.d.ts
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* `errors.ts` (user-facing messages) can use the derived MB value without
|
|
6
6
|
* a client<->errors import cycle.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* Max caller text for preview_cloned_voice, in characters after trimming.
|
|
10
|
+
* Same literal as the engine (app/services/cloned_voices/preview_text.py)
|
|
11
|
+
* and the web preview route (preview/preview-text.ts), pinned by
|
|
12
|
+
* __tests__/clone-preview-text-sync.test.ts.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CLONE_PREVIEW_TEXT_MAX_CHARS = 300;
|
|
8
15
|
/** Max library image size in bytes (10MB). */
|
|
9
16
|
export declare const MAX_LIBRARY_IMAGE_BYTES: number;
|
|
10
17
|
/**
|
|
@@ -12,6 +19,15 @@ export declare const MAX_LIBRARY_IMAGE_BYTES: number;
|
|
|
12
19
|
* (tool descriptions, error messages) can't drift from the enforced bound.
|
|
13
20
|
*/
|
|
14
21
|
export declare const MAX_LIBRARY_IMAGE_MB: number;
|
|
22
|
+
/**
|
|
23
|
+
* Max segment media size in bytes (8MB). This is the engine photo
|
|
24
|
+
* bottleneck (place_photos MAX_PHOTO_BYTES), NOT the persona library
|
|
25
|
+
* limit: a larger segment upload could never render. The server
|
|
26
|
+
* re-validates the same bound; this local guard only fails fast.
|
|
27
|
+
*/
|
|
28
|
+
export declare const MAX_SEGMENT_MEDIA_BYTES: number;
|
|
29
|
+
/** Same limit in whole MB, derived from the byte limit. */
|
|
30
|
+
export declare const MAX_SEGMENT_MEDIA_MB: number;
|
|
15
31
|
/**
|
|
16
32
|
* Max direct-publish video size in bytes (2GB). Mirrors the server-side
|
|
17
33
|
* limit in POST /api/upload-content (youtube handler): the MCP fails fast
|
|
@@ -23,3 +39,26 @@ export declare const MAX_UPLOAD_VIDEO_BYTES: number;
|
|
|
23
39
|
* can't drift from the enforced bound.
|
|
24
40
|
*/
|
|
25
41
|
export declare const MAX_UPLOAD_VIDEO_GB: number;
|
|
42
|
+
/**
|
|
43
|
+
* Persona-hook layouts the server accepts, as an inline literal rather than
|
|
44
|
+
* an enum: it feeds `z.enum(...)`, whose generic argument is a tuple.
|
|
45
|
+
*
|
|
46
|
+
* This list is duplicated in `apps/web/lib/persona-schema.ts` (the web zod
|
|
47
|
+
* enum), in `supabase/migrations/019_personas-video-layout.sql` (the CHECK)
|
|
48
|
+
* and in the engine's `VideoLayout` (apps/engine/app/models/schema.py).
|
|
49
|
+
* Nothing shares a module across those four runtimes, so a one-sided edit
|
|
50
|
+
* would silently teach agents a layout the database rejects at write time --
|
|
51
|
+
* pinned by `persona-video-layout-sync.test.ts`.
|
|
52
|
+
*/
|
|
53
|
+
export declare const VIDEO_LAYOUTS: readonly ["standard", "react"];
|
|
54
|
+
/**
|
|
55
|
+
* GET /api/metrics query contract, mirrored from
|
|
56
|
+
* `apps/web/lib/metrics/metrics-query.ts` (METRICS_FILTER_MAX_LENGTH,
|
|
57
|
+
* METRICS_NONE, the window values) and `apps/web/lib/providers/registry.ts`
|
|
58
|
+
* (SOCIAL_PROVIDERS). The MCP rejects what the route would 400 on before
|
|
59
|
+
* the request goes out. Pinned by `metrics-query-sync.test.ts`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const METRICS_FILTER_MAX_LENGTH = 200;
|
|
62
|
+
export declare const METRICS_NONE = "^@none";
|
|
63
|
+
export declare const METRICS_WINDOWS: readonly ["24h", "7d"];
|
|
64
|
+
export declare const METRICS_PROVIDERS: readonly ["youtube", "instagram", "bluesky", "linkedin"];
|
package/dist/limits.js
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* `errors.ts` (user-facing messages) can use the derived MB value without
|
|
6
6
|
* a client<->errors import cycle.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* Max caller text for preview_cloned_voice, in characters after trimming.
|
|
10
|
+
* Same literal as the engine (app/services/cloned_voices/preview_text.py)
|
|
11
|
+
* and the web preview route (preview/preview-text.ts), pinned by
|
|
12
|
+
* __tests__/clone-preview-text-sync.test.ts.
|
|
13
|
+
*/
|
|
14
|
+
export const CLONE_PREVIEW_TEXT_MAX_CHARS = 300;
|
|
8
15
|
/** Max library image size in bytes (10MB). */
|
|
9
16
|
export const MAX_LIBRARY_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
10
17
|
/**
|
|
@@ -12,6 +19,15 @@ export const MAX_LIBRARY_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
|
12
19
|
* (tool descriptions, error messages) can't drift from the enforced bound.
|
|
13
20
|
*/
|
|
14
21
|
export const MAX_LIBRARY_IMAGE_MB = MAX_LIBRARY_IMAGE_BYTES / (1024 * 1024);
|
|
22
|
+
/**
|
|
23
|
+
* Max segment media size in bytes (8MB). This is the engine photo
|
|
24
|
+
* bottleneck (place_photos MAX_PHOTO_BYTES), NOT the persona library
|
|
25
|
+
* limit: a larger segment upload could never render. The server
|
|
26
|
+
* re-validates the same bound; this local guard only fails fast.
|
|
27
|
+
*/
|
|
28
|
+
export const MAX_SEGMENT_MEDIA_BYTES = 8 * 1024 * 1024;
|
|
29
|
+
/** Same limit in whole MB, derived from the byte limit. */
|
|
30
|
+
export const MAX_SEGMENT_MEDIA_MB = MAX_SEGMENT_MEDIA_BYTES / (1024 * 1024);
|
|
15
31
|
/**
|
|
16
32
|
* Max direct-publish video size in bytes (2GB). Mirrors the server-side
|
|
17
33
|
* limit in POST /api/upload-content (youtube handler): the MCP fails fast
|
|
@@ -23,4 +39,27 @@ export const MAX_UPLOAD_VIDEO_BYTES = 2 * 1024 * 1024 * 1024;
|
|
|
23
39
|
* can't drift from the enforced bound.
|
|
24
40
|
*/
|
|
25
41
|
export const MAX_UPLOAD_VIDEO_GB = MAX_UPLOAD_VIDEO_BYTES / (1024 * 1024 * 1024);
|
|
42
|
+
/**
|
|
43
|
+
* Persona-hook layouts the server accepts, as an inline literal rather than
|
|
44
|
+
* an enum: it feeds `z.enum(...)`, whose generic argument is a tuple.
|
|
45
|
+
*
|
|
46
|
+
* This list is duplicated in `apps/web/lib/persona-schema.ts` (the web zod
|
|
47
|
+
* enum), in `supabase/migrations/019_personas-video-layout.sql` (the CHECK)
|
|
48
|
+
* and in the engine's `VideoLayout` (apps/engine/app/models/schema.py).
|
|
49
|
+
* Nothing shares a module across those four runtimes, so a one-sided edit
|
|
50
|
+
* would silently teach agents a layout the database rejects at write time --
|
|
51
|
+
* pinned by `persona-video-layout-sync.test.ts`.
|
|
52
|
+
*/
|
|
53
|
+
export const VIDEO_LAYOUTS = ['standard', 'react'];
|
|
54
|
+
/**
|
|
55
|
+
* GET /api/metrics query contract, mirrored from
|
|
56
|
+
* `apps/web/lib/metrics/metrics-query.ts` (METRICS_FILTER_MAX_LENGTH,
|
|
57
|
+
* METRICS_NONE, the window values) and `apps/web/lib/providers/registry.ts`
|
|
58
|
+
* (SOCIAL_PROVIDERS). The MCP rejects what the route would 400 on before
|
|
59
|
+
* the request goes out. Pinned by `metrics-query-sync.test.ts`.
|
|
60
|
+
*/
|
|
61
|
+
export const METRICS_FILTER_MAX_LENGTH = 200;
|
|
62
|
+
export const METRICS_NONE = '^@none';
|
|
63
|
+
export const METRICS_WINDOWS = ['24h', '7d'];
|
|
64
|
+
export const METRICS_PROVIDERS = ['youtube', 'instagram', 'bluesky', 'linkedin'];
|
|
26
65
|
//# sourceMappingURL=limits.js.map
|
package/dist/limits.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,G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AS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
export interface HubPrompt {
|
|
3
|
+
slug: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
prompt: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const HUB_PROMPTS: HubPrompt[];
|
|
9
|
+
export declare function registerPrompts(server: McpServer): void;
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//---------------
|
|
2
|
+
// MCP prompts hub — slash commands for the recipes prompts. This file
|
|
3
|
+
// is a self-contained COPY of the web hub (apps/web/): the published
|
|
4
|
+
// tarball cannot import apps/web at runtime (see
|
|
5
|
+
// scripts/sync-script-segments.mjs and prompts-sync.test.ts). Adding a
|
|
6
|
+
// prompt to the web hub means copying its slug, title, description,
|
|
7
|
+
// and exact prompt text here; prompts-sync.test.ts fails loudly when
|
|
8
|
+
// the two drift. Prompts are zero-arg: placeholders stay in the text.
|
|
9
|
+
//---------------
|
|
10
|
+
export const HUB_PROMPTS = [
|
|
11
|
+
{
|
|
12
|
+
slug: "daily-news",
|
|
13
|
+
title: "Daily news becomes a video",
|
|
14
|
+
description: [
|
|
15
|
+
"Turn one news story of the day into one persona video, validated before any token is spent.",
|
|
16
|
+
].join("\n"),
|
|
17
|
+
prompt: [
|
|
18
|
+
"Turn one top story from today's GNews headlines (lang=en, country=us) into",
|
|
19
|
+
"one Post Engineer video. My GNews key is in your own environment as",
|
|
20
|
+
"YOUR_GNEWS_KEY — never print it, never paste it anywhere else.",
|
|
21
|
+
"",
|
|
22
|
+
"Rules:",
|
|
23
|
+
"1. Pick one clear single event with a named place. Skip round-ups, opinion",
|
|
24
|
+
" pieces, and stories sourced only from a social post.",
|
|
25
|
+
"2. Write the script as segments: first hook (aim 20-30 words, end with",
|
|
26
|
+
" terminal punctuation), then body segments (at least 30 words total),",
|
|
27
|
+
" last CTA (5-20 words). Total 60–200 words, spoken English only, no",
|
|
28
|
+
" links, hashtags, markdown, emoji, or stage directions. Only facts the",
|
|
29
|
+
" source supports; attribute single-sourced claims.",
|
|
30
|
+
"3. Call validate_script with those segments. Fix any named error and",
|
|
31
|
+
" re-validate until it passes. Do not generate before it passes.",
|
|
32
|
+
"4. For media, prefer a photo of the actual place in the story. Check a",
|
|
33
|
+
" public URL with check_media first and attach it only on ok; or upload",
|
|
34
|
+
" a local file with upload_media shortly before generating and use the",
|
|
35
|
+
" mediaId. At most 6 medias. Skip a failed photo, never force it.",
|
|
36
|
+
"5. Call generate_persona_video with personaId [PERSONA_ID], the validated",
|
|
37
|
+
" segments unchanged, title [STORY_TITLE], language \"en\", providers",
|
|
38
|
+
" [PROVIDERS] with account IDs from list_social_accounts, mode",
|
|
39
|
+
" [scheduled|asap] (scheduled needs startAt [ISO_DATETIME] + times",
|
|
40
|
+
" [HH:MM] in timezone [TIMEZONE]; asap needs no startAt/times).",
|
|
41
|
+
"6. Poll get_video_task_progress on the taskId until done, then share the",
|
|
42
|
+
" final video URL from get_video_status.",
|
|
43
|
+
].join("\n"),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
slug: "github-prs",
|
|
47
|
+
title: "GitHub PRs become videos",
|
|
48
|
+
description: [
|
|
49
|
+
"Turn your GitHub pull requests into persona videos.",
|
|
50
|
+
].join("\n"),
|
|
51
|
+
prompt: [
|
|
52
|
+
"Turn this GitHub pull request into one persona video.",
|
|
53
|
+
"",
|
|
54
|
+
"PR to use (paste the PR title, description, and a short change summary, plus any linked issues):",
|
|
55
|
+
"- Title: ...",
|
|
56
|
+
"- Description: ...",
|
|
57
|
+
"- What changed: ...",
|
|
58
|
+
"- Linked issues: ...",
|
|
59
|
+
"",
|
|
60
|
+
"Rules:",
|
|
61
|
+
"- Use the Post Engineer MCP server and the singular video tool, generate_persona_video.",
|
|
62
|
+
"- First, call validate_script with your script and only proceed when it is valid — validate before any token is debited.",
|
|
63
|
+
"- Script: spoken text only, no links, hashtags, markdown, emojis, or stage directions.",
|
|
64
|
+
"- Structure: first segment is the hook, last segment is the CTA, exactly one of each.",
|
|
65
|
+
"- Length: 60–200 words total, hook 20–30 words (8–12 seconds), body at least 30 words, CTA 5–20 words, at most 12 segments.",
|
|
66
|
+
"- Language: en only.",
|
|
67
|
+
"- Media: at most 6, only if they match the PR (screenshots, diagrams, or repo visuals); otherwise generate without media.",
|
|
68
|
+
"- Then generate one video for this PR and publish it where the user asked, scheduled or asap.",
|
|
69
|
+
"- Never invent PR details: if the title, description, or change summary is missing, ask for it instead of guessing.",
|
|
70
|
+
].join("\n"),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
slug: "full-setup",
|
|
74
|
+
title: "Full setup becomes videos",
|
|
75
|
+
description: [
|
|
76
|
+
"Connect accounts, create a persona, validate the script, and publish your first video without skipping a step.",
|
|
77
|
+
].join("\n"),
|
|
78
|
+
prompt: [
|
|
79
|
+
"Set up Post Engineer end to end and publish your first video. Follow the",
|
|
80
|
+
"steps in order; do not skip ahead of validation or the publish confirmation.",
|
|
81
|
+
"",
|
|
82
|
+
"1. Call list_social_accounts. Ask which of youtube, instagram, linkedin",
|
|
83
|
+
" the user wants; for each one that is missing, call connect_account with",
|
|
84
|
+
" that provider and hand the returned https OAuth link to the user to",
|
|
85
|
+
" finish in the browser, then re-check with list_social_accounts.",
|
|
86
|
+
"2. Bluesky is optional. If the user wants it, ask for the handle and the",
|
|
87
|
+
" app password (never the main password); use the app password only in",
|
|
88
|
+
" connect_account and never repeat, print, or log it.",
|
|
89
|
+
"3. Call list_faces and list_voices, let the user pick a face and a voice,",
|
|
90
|
+
" then call create_persona with name, avatarUrl, voiceId,",
|
|
91
|
+
" language \"en-US\" (English only for now) and niche. Remember the personaId.",
|
|
92
|
+
"4. Call get_token_balance first. Then write the script as segments: hook",
|
|
93
|
+
" first, CTA last, 60–200 words total, spoken English only, no links,",
|
|
94
|
+
" hashtags, markdown, emoji, or stage directions. Call validate_script",
|
|
95
|
+
" and fix any named error until it passes — validate before any token is",
|
|
96
|
+
" spent.",
|
|
97
|
+
"5. Before generating, tell the user the video IS published as a",
|
|
98
|
+
" real post, and confirm the providers/accounts and the mode (scheduled|asap)",
|
|
99
|
+
" with the user. Warning: Bluesky video publishing is",
|
|
100
|
+
" currently being fixed (issue #327); Bluesky is optional and can be",
|
|
101
|
+
" skipped.",
|
|
102
|
+
"6. Call generate_persona_video once with that personaId, the validated",
|
|
103
|
+
" segments unchanged, title [VIDEO_TITLE], language \"en\", the confirmed",
|
|
104
|
+
" providers with their account IDs from list_social_accounts, and the",
|
|
105
|
+
" confirmed mode (scheduled needs startAt [ISO_DATETIME, 3h-30d ahead] +",
|
|
106
|
+
" times [HH:MM] in timezone [TIMEZONE]; asap needs no startAt/times).",
|
|
107
|
+
" Then call get_video_task_progress until done and share the",
|
|
108
|
+
" get_video_status URL.",
|
|
109
|
+
].join("\n"),
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
export function registerPrompts(server) {
|
|
113
|
+
for (const prompt of HUB_PROMPTS) {
|
|
114
|
+
server.registerPrompt(prompt.slug, {
|
|
115
|
+
title: prompt.title,
|
|
116
|
+
description: prompt.description,
|
|
117
|
+
}, async () => ({
|
|
118
|
+
messages: [{
|
|
119
|
+
role: 'user',
|
|
120
|
+
content: { type: 'text', text: prompt.prompt },
|
|
121
|
+
}],
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,sEAAsE;AACtE,qEAAqE;AACrE,iDAAiD;AACjD,uEAAuE;AACvE,oEAAoE;AACpE,qEAAqE;AACrE,sEAAsE;AACtE,iBAAiB;AAWjB,MAAM,CAAC,MAA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ACpE,0EAA0E;YAC1E,yEAAyE;YACzE,wDAAwD;YACxD,2EAA2E;YAC3E,4DAA4D;YAC5D,iFAAiF;YACjF,0EAA0E;YAC1E,wEAAwE;YACxE,yEAAyE;YACzE,2EAA2E;YAC3E,WAAW;YACX,iEAAiE;YACjE,gFAAgF;YAChF,wDAAwD;YACxD,uEAAuE;YACvE,aAAa;YACb,wEAAwE;YACxE,4EAA4E;YAC5E,wEAAwE;YACxE,2EAA2E;YAC3E,wEAAwE;YACxE,+DAA+D;YAC/D,0BAA0B;SAC3B,CAAC,IAAI,CAAC,IAAI,CAAC;KACb;CACF,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE;YACjC,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YACd,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;iBAC/C,CAAC;SACH,CAAC,CAAC,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function requireTitle(title: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Fail-fast for title inputs: the route 400s on an empty title, so trim
|
|
2
|
+
// and reject here, before any fetch goes out. Returns the trimmed title:
|
|
3
|
+
// the server stores the trimmed value, so the payload carries exactly
|
|
4
|
+
// what lands.
|
|
5
|
+
export function requireTitle(title) {
|
|
6
|
+
const trimmed = title.trim();
|
|
7
|
+
if (trimmed.length === 0) {
|
|
8
|
+
throw new Error('title must be a non-empty string.');
|
|
9
|
+
}
|
|
10
|
+
return trimmed;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=require-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-title.js","sourceRoot":"","sources":["../src/require-title.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,yEAAyE;AACzE,sEAAsE;AACtE,cAAc;AACd,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ListSchedulesShape: {};
|
|
3
|
+
export declare const ListSchedulesSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
4
|
+
export declare const ListPostsShape: {
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
};
|
|
7
|
+
export declare const ListPostsSchema: z.ZodObject<{
|
|
8
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
limit: number;
|
|
11
|
+
}, {
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const CancelScheduleShape: {
|
|
15
|
+
scheduleId: z.ZodString;
|
|
16
|
+
};
|
|
17
|
+
export declare const CancelScheduleSchema: z.ZodObject<{
|
|
18
|
+
scheduleId: z.ZodString;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
scheduleId: string;
|
|
21
|
+
}, {
|
|
22
|
+
scheduleId: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const GetSlotShape: {
|
|
25
|
+
slotId: z.ZodString;
|
|
26
|
+
};
|
|
27
|
+
export declare const GetSlotSchema: z.ZodObject<{
|
|
28
|
+
slotId: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
slotId: string;
|
|
31
|
+
}, {
|
|
32
|
+
slotId: string;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const UpdateSlotTitleShape: {
|
|
35
|
+
slotId: z.ZodString;
|
|
36
|
+
title: z.ZodString;
|
|
37
|
+
};
|
|
38
|
+
export declare const UpdateSlotTitleSchema: z.ZodObject<{
|
|
39
|
+
slotId: z.ZodString;
|
|
40
|
+
title: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
title: string;
|
|
43
|
+
slotId: string;
|
|
44
|
+
}, {
|
|
45
|
+
title: string;
|
|
46
|
+
slotId: string;
|
|
47
|
+
}>;
|
|
48
|
+
export declare const DeleteSlotShape: {
|
|
49
|
+
slotId: z.ZodString;
|
|
50
|
+
};
|
|
51
|
+
export declare const DeleteSlotSchema: z.ZodObject<{
|
|
52
|
+
slotId: z.ZodString;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
slotId: string;
|
|
55
|
+
}, {
|
|
56
|
+
slotId: string;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const GeneratePersonaVideoOptionsShape: {
|
|
59
|
+
faceless: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
facelessMaterial: z.ZodOptional<z.ZodEnum<["broll", "svg"]>>;
|
|
61
|
+
audioUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
62
|
+
imageId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
voiceId: z.ZodOptional<z.ZodString>;
|
|
64
|
+
webhookUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
65
|
+
videoAspect: z.ZodOptional<z.ZodEnum<["9:16", "16:9"]>>;
|
|
66
|
+
videoLayout: z.ZodOptional<z.ZodEnum<["standard", "react"]>>;
|
|
67
|
+
paragraphNumber: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
language: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
69
|
+
niche: z.ZodOptional<z.ZodString>;
|
|
70
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Schedule/slot tool shapes, plus the generate_persona_video options
|
|
2
|
+
// shape and the URL-field helpers only it uses.
|
|
3
|
+
//
|
|
4
|
+
// Extracted from tools.ts so the tools module stays under the file-size
|
|
5
|
+
// ratchet. tools.ts re-exports every name here, so existing import sites
|
|
6
|
+
// keep working.
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { isEnglishLanguage, ONLY_ENGLISH_VIDEOS_MESSAGE } from './language.js';
|
|
9
|
+
import { VIDEO_LAYOUTS } from './limits.js';
|
|
10
|
+
export const ListSchedulesShape = {};
|
|
11
|
+
export const ListSchedulesSchema = z.object(ListSchedulesShape);
|
|
12
|
+
export const ListPostsShape = {
|
|
13
|
+
limit: z.number().int().min(1).max(500).default(20).describe('Max number of upcoming and past posts to return (each list). Default 20, max 500.'),
|
|
14
|
+
};
|
|
15
|
+
export const ListPostsSchema = z.object(ListPostsShape);
|
|
16
|
+
export const CancelScheduleShape = {
|
|
17
|
+
scheduleId: z
|
|
18
|
+
.string()
|
|
19
|
+
.min(1, 'scheduleId is required')
|
|
20
|
+
.describe('The ID of the schedule to cancel. Unpublished slots (pending, generating, or ready) are removed and their prepaid tokens are refunded. A post already publishing or published is not recalled.'),
|
|
21
|
+
};
|
|
22
|
+
export const CancelScheduleSchema = z.object(CancelScheduleShape);
|
|
23
|
+
export const GetSlotShape = {
|
|
24
|
+
slotId: z
|
|
25
|
+
.string()
|
|
26
|
+
.min(1, 'slotId is required')
|
|
27
|
+
.describe('The slot ID (the slotId field from list_posts or generate_persona_video).'),
|
|
28
|
+
};
|
|
29
|
+
export const GetSlotSchema = z.object(GetSlotShape);
|
|
30
|
+
export const UpdateSlotTitleShape = {
|
|
31
|
+
slotId: z
|
|
32
|
+
.string()
|
|
33
|
+
.min(1, 'slotId is required')
|
|
34
|
+
.describe('The slot ID (the slotId field from list_posts or generate_persona_video).'),
|
|
35
|
+
title: z
|
|
36
|
+
.string()
|
|
37
|
+
.min(1, 'title is required')
|
|
38
|
+
.describe('The new title text for the slot. Only a slot that has not started generating (status pending/awaiting) can be edited; published or mid-flight slots are rejected.'),
|
|
39
|
+
};
|
|
40
|
+
export const UpdateSlotTitleSchema = z.object(UpdateSlotTitleShape);
|
|
41
|
+
export const DeleteSlotShape = {
|
|
42
|
+
slotId: z
|
|
43
|
+
.string()
|
|
44
|
+
.min(1, 'slotId is required')
|
|
45
|
+
.describe('The slot ID to delete. Only pending (awaiting) or failed slots can be deleted; published or mid-flight slots are rejected. The schedule\'s last slot cannot be deleted — delete the whole schedule with cancel_schedule instead.'),
|
|
46
|
+
};
|
|
47
|
+
export const DeleteSlotSchema = z.object(DeleteSlotShape);
|
|
48
|
+
// Loopback hosts for which a plain http: media/webhook URL is tolerated
|
|
49
|
+
// (local dev callbacks). Anything else must be https so the URL's content
|
|
50
|
+
// never travels in cleartext.
|
|
51
|
+
const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '::1', '[::1]']);
|
|
52
|
+
function isHttpsOrLoopbackHttp(url) {
|
|
53
|
+
let parsed;
|
|
54
|
+
try {
|
|
55
|
+
parsed = new URL(url);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (parsed.protocol === 'https:')
|
|
61
|
+
return true;
|
|
62
|
+
return parsed.protocol === 'http:' && LOOPBACK_HOSTS.has(parsed.hostname);
|
|
63
|
+
}
|
|
64
|
+
/** URL field for user-supplied media/webhook URLs: https, or http on loopback only. */
|
|
65
|
+
function httpsUrlField(fieldName) {
|
|
66
|
+
return z
|
|
67
|
+
.string()
|
|
68
|
+
.url(`${fieldName} must be a valid URL`)
|
|
69
|
+
.refine(isHttpsOrLoopbackHttp, {
|
|
70
|
+
message: `${fieldName} must be an https URL (http is allowed only for loopback hosts like localhost)`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export const GeneratePersonaVideoOptionsShape = {
|
|
74
|
+
faceless: z.boolean().optional().describe('Generate faceless (no face). With a persona this drops only the face — the persona voice and niche still apply. Without a persona it is REQUIRED.'),
|
|
75
|
+
facelessMaterial: z
|
|
76
|
+
.enum(['broll', 'svg'])
|
|
77
|
+
.optional()
|
|
78
|
+
.describe('What fills the video, with or without a face: "broll" = real stock footage only, "svg" = drawn illustrations only. The two never mix. Defaults to "broll".'),
|
|
79
|
+
audioUrl: httpsUrlField('audioUrl').optional().describe('Public URL of custom audio for the videos (overrides the persona voice).'),
|
|
80
|
+
imageId: z.string().min(1, 'imageId must be a non-empty string').optional().describe('Library image ID to use for every video (overrides the deterministic per-video selection; see list_persona_images).'),
|
|
81
|
+
voiceId: z.string().min(1, 'voiceId must be a non-empty string').optional().describe('Voice ID override (see list_voices).'),
|
|
82
|
+
webhookUrl: httpsUrlField('webhookUrl').optional().describe('Callback URL the server POSTs to when each video reaches a terminal state (completed/failed).'),
|
|
83
|
+
videoAspect: z.enum(['9:16', '16:9']).optional().describe('Frame shape. Overrides the persona when one is given; a post without a persona defaults to 9:16.'),
|
|
84
|
+
videoLayout: z
|
|
85
|
+
.enum(VIDEO_LAYOUTS)
|
|
86
|
+
.optional()
|
|
87
|
+
.describe('How the persona hook is composed with the video material (facelessMaterial: real clips or drawings). Overrides the persona when one is given; a post without a persona defaults to "standard". Same render cost either way.'),
|
|
88
|
+
paragraphNumber: z.number().int().min(1).max(10).optional().describe('Paragraph count (1-10). Overrides the persona when one is given.'),
|
|
89
|
+
language: z
|
|
90
|
+
.string()
|
|
91
|
+
.min(1)
|
|
92
|
+
.max(32)
|
|
93
|
+
.refine(isEnglishLanguage, { message: ONLY_ENGLISH_VIDEOS_MESSAGE })
|
|
94
|
+
.optional()
|
|
95
|
+
.describe('Spoken language code — English only for now, e.g. en-US. Overrides the persona when one is given.'),
|
|
96
|
+
niche: z.string().min(1).max(300).optional().describe('Content niche. Overrides the persona when one is given.'),
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=schedule-shapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-shapes.js","sourceRoot":"","sources":["../src/schedule-shapes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,gDAAgD;AAChD,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,gBAAgB;AAChB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,mFAAmF,CAAC;CAClJ,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,wBAAwB,CAAC;SAChC,QAAQ,CACP,gMAAgM,CACjM;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAA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AAQ,EAAE;SACV,QAAQ,CAAC,6NAA6N,CAAC;IAC1O,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC;IACxI,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,MAAM,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;SACnE,QAAQ,EAAE;SACV,QAAQ,CAAC,mGAAmG,CAAC;IAChH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;CACjH,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const MAX_SEGMENTS = 12;
|
|
2
|
+
export declare const MAX_MEDIAS = 6;
|
|
3
|
+
export declare const MIN_TOTAL_WORDS = 60;
|
|
4
|
+
export declare const MAX_TOTAL_WORDS = 200;
|
|
5
|
+
export declare const MIN_BODY_WORDS = 30;
|
|
6
|
+
export declare const MIN_CTA_WORDS = 5;
|
|
7
|
+
export declare const MAX_CTA_WORDS = 20;
|
|
8
|
+
export declare const MIN_HOOK_WORDS = 15;
|
|
9
|
+
export declare const MAX_HOOK_WORDS = 40;
|
|
10
|
+
export declare const MAX_TERMS_PER_SEGMENT = 10;
|
|
11
|
+
export declare const HOOK_MIN_SECONDS = 8;
|
|
12
|
+
export declare const HOOK_MAX_SECONDS = 12;
|
|
13
|
+
export type SegmentKind = 'hook' | 'body' | 'cta';
|
|
14
|
+
export type SegmentMedia = {
|
|
15
|
+
mediaId?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ScriptSegment = {
|
|
19
|
+
kind: SegmentKind;
|
|
20
|
+
text: string;
|
|
21
|
+
media?: SegmentMedia;
|
|
22
|
+
terms?: string[];
|
|
23
|
+
};
|
|
24
|
+
export type SegmentsError = {
|
|
25
|
+
field: string;
|
|
26
|
+
rule: string;
|
|
27
|
+
fix: string;
|
|
28
|
+
};
|
|
29
|
+
export type ValidatedSegments = {
|
|
30
|
+
hookText: string;
|
|
31
|
+
bodyTexts: string[];
|
|
32
|
+
ctaText: string;
|
|
33
|
+
totalWords: number;
|
|
34
|
+
bodyWords: number;
|
|
35
|
+
hookWords: number;
|
|
36
|
+
ctaWords: number;
|
|
37
|
+
segmentCount: number;
|
|
38
|
+
mediaCount: number;
|
|
39
|
+
};
|
|
40
|
+
export type SegmentsResult = {
|
|
41
|
+
ok: true;
|
|
42
|
+
value: ValidatedSegments;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
error: SegmentsError;
|
|
46
|
+
};
|
|
47
|
+
export declare function countWords(text: string): number;
|
|
48
|
+
export declare function validateSegments(input: unknown): SegmentsResult;
|
|
49
|
+
export declare function joinSegments(input: unknown): string;
|