post-engineer-mcp 1.52.672 → 1.53.668

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.
Files changed (254) hide show
  1. package/README.md +1 -1
  2. package/dist/account-shapes.js +0 -12
  3. package/dist/account-shapes.js.map +1 -1
  4. package/dist/action-tool.d.ts +0 -15
  5. package/dist/action-tool.js +0 -15
  6. package/dist/action-tool.js.map +1 -1
  7. package/dist/analytics.js +0 -39
  8. package/dist/analytics.js.map +1 -1
  9. package/dist/client-base-url.d.ts +2 -0
  10. package/dist/client-base-url.js +23 -0
  11. package/dist/client-base-url.js.map +1 -0
  12. package/dist/client-batch.js.map +1 -1
  13. package/dist/client-billing.js +0 -11
  14. package/dist/client-billing.js.map +1 -1
  15. package/dist/client-experiments.js +0 -9
  16. package/dist/client-experiments.js.map +1 -1
  17. package/dist/client-posts.js +0 -7
  18. package/dist/client-posts.js.map +1 -1
  19. package/dist/client-prompts.js +0 -2
  20. package/dist/client-prompts.js.map +1 -1
  21. package/dist/client-publish-existing.js +0 -13
  22. package/dist/client-publish-existing.js.map +1 -1
  23. package/dist/client-publish-uploaded.d.ts +0 -5
  24. package/dist/client-publish-uploaded.js +0 -48
  25. package/dist/client-publish-uploaded.js.map +1 -1
  26. package/dist/client-publishing-accounts.js +0 -7
  27. package/dist/client-publishing-accounts.js.map +1 -1
  28. package/dist/client-telegram.js +0 -7
  29. package/dist/client-telegram.js.map +1 -1
  30. package/dist/client-tool-config.js +0 -7
  31. package/dist/client-tool-config.js.map +1 -1
  32. package/dist/client-types.d.ts +10 -87
  33. package/dist/client-user-media.d.ts +0 -28
  34. package/dist/client-user-media.js +0 -42
  35. package/dist/client-user-media.js.map +1 -1
  36. package/dist/client-video-task.js +0 -5
  37. package/dist/client-video-task.js.map +1 -1
  38. package/dist/client.js +5 -118
  39. package/dist/client.js.map +1 -1
  40. package/dist/cloned-voice-client.d.ts +0 -8
  41. package/dist/cloned-voice-client.js +0 -49
  42. package/dist/cloned-voice-client.js.map +1 -1
  43. package/dist/cloned-voice-tools.d.ts +0 -5
  44. package/dist/cloned-voice-tools.js +0 -7
  45. package/dist/cloned-voice-tools.js.map +1 -1
  46. package/dist/connect-account.js +0 -23
  47. package/dist/connect-account.js.map +1 -1
  48. package/dist/contract-response.js +0 -12
  49. package/dist/contract-response.js.map +1 -1
  50. package/dist/contracts/accounts.d.ts +0 -11
  51. package/dist/contracts/accounts.js +0 -60
  52. package/dist/contracts/accounts.js.map +1 -1
  53. package/dist/contracts/billing.d.ts +0 -14
  54. package/dist/contracts/billing.js +0 -26
  55. package/dist/contracts/billing.js.map +1 -1
  56. package/dist/contracts/endpoint.d.ts +0 -11
  57. package/dist/contracts/endpoint.js +0 -4
  58. package/dist/contracts/endpoint.js.map +1 -1
  59. package/dist/contracts/experiments.d.ts +0 -20
  60. package/dist/contracts/experiments.js +0 -34
  61. package/dist/contracts/experiments.js.map +1 -1
  62. package/dist/contracts/media.d.ts +0 -19
  63. package/dist/contracts/media.js +0 -58
  64. package/dist/contracts/media.js.map +1 -1
  65. package/dist/contracts/metrics.d.ts +0 -15
  66. package/dist/contracts/metrics.js +0 -74
  67. package/dist/contracts/metrics.js.map +1 -1
  68. package/dist/contracts/personas.d.ts +95 -19
  69. package/dist/contracts/personas.js +24 -93
  70. package/dist/contracts/personas.js.map +1 -1
  71. package/dist/contracts/posts.d.ts +0 -11
  72. package/dist/contracts/posts.js +0 -17
  73. package/dist/contracts/posts.js.map +1 -1
  74. package/dist/contracts/prompts.d.ts +0 -11
  75. package/dist/contracts/prompts.js +0 -15
  76. package/dist/contracts/prompts.js.map +1 -1
  77. package/dist/contracts/providers.d.ts +0 -16
  78. package/dist/contracts/providers.js +0 -30
  79. package/dist/contracts/providers.js.map +1 -1
  80. package/dist/contracts/schedule-warnings.js +0 -3
  81. package/dist/contracts/schedule-warnings.js.map +1 -1
  82. package/dist/contracts/schedule.d.ts +0 -14
  83. package/dist/contracts/schedule.js +0 -46
  84. package/dist/contracts/schedule.js.map +1 -1
  85. package/dist/contracts/tool-config.d.ts +7 -11
  86. package/dist/contracts/tool-config.js +1 -27
  87. package/dist/contracts/tool-config.js.map +1 -1
  88. package/dist/contracts/upload-types.d.ts +0 -3
  89. package/dist/contracts/upload-types.js +0 -10
  90. package/dist/contracts/upload-types.js.map +1 -1
  91. package/dist/contracts/video-tasks.d.ts +0 -23
  92. package/dist/contracts/video-tasks.js +0 -42
  93. package/dist/contracts/video-tasks.js.map +1 -1
  94. package/dist/contracts/videos.d.ts +29 -37
  95. package/dist/contracts/videos.js +3 -137
  96. package/dist/contracts/videos.js.map +1 -1
  97. package/dist/contracts/voices.d.ts +0 -24
  98. package/dist/contracts/voices.js +0 -34
  99. package/dist/contracts/voices.js.map +1 -1
  100. package/dist/direct-publish-form.js +0 -15
  101. package/dist/direct-publish-form.js.map +1 -1
  102. package/dist/direct-publish-narrowing.js +0 -5
  103. package/dist/direct-publish-narrowing.js.map +1 -1
  104. package/dist/errors.d.ts +0 -35
  105. package/dist/errors.js +0 -48
  106. package/dist/errors.js.map +1 -1
  107. package/dist/generate-video.d.ts +45 -4
  108. package/dist/generate-video.js +0 -6
  109. package/dist/generate-video.js.map +1 -1
  110. package/dist/http-auth.d.ts +0 -1
  111. package/dist/http-auth.js +0 -37
  112. package/dist/http-auth.js.map +1 -1
  113. package/dist/http-rate-limit.d.ts +0 -1
  114. package/dist/http-rate-limit.js +0 -18
  115. package/dist/http-rate-limit.js.map +1 -1
  116. package/dist/http-transport.js +0 -95
  117. package/dist/http-transport.js.map +1 -1
  118. package/dist/http-web.js +0 -16
  119. package/dist/http-web.js.map +1 -1
  120. package/dist/image-guards.d.ts +0 -4
  121. package/dist/image-guards.js +0 -11
  122. package/dist/image-guards.js.map +1 -1
  123. package/dist/index.js +0 -20
  124. package/dist/index.js.map +1 -1
  125. package/dist/intent-accounts.js +0 -5
  126. package/dist/intent-accounts.js.map +1 -1
  127. package/dist/intent-content.js +0 -7
  128. package/dist/intent-content.js.map +1 -1
  129. package/dist/intent-library.js +0 -4
  130. package/dist/intent-library.js.map +1 -1
  131. package/dist/intent-personas.js +0 -10
  132. package/dist/intent-personas.js.map +1 -1
  133. package/dist/intent-tool-config.js +1 -6
  134. package/dist/intent-tool-config.js.map +1 -1
  135. package/dist/intent-video.js +0 -5
  136. package/dist/intent-video.js.map +1 -1
  137. package/dist/intent-voices.js +0 -6
  138. package/dist/intent-voices.js.map +1 -1
  139. package/dist/language.d.ts +0 -8
  140. package/dist/language.js +0 -11
  141. package/dist/language.js.map +1 -1
  142. package/dist/limits.d.ts +1 -79
  143. package/dist/limits.js +1 -79
  144. package/dist/limits.js.map +1 -1
  145. package/dist/music-mood-field.js +0 -25
  146. package/dist/music-mood-field.js.map +1 -1
  147. package/dist/persona-avatar.d.ts +0 -13
  148. package/dist/persona-avatar.js +0 -40
  149. package/dist/persona-avatar.js.map +1 -1
  150. package/dist/persona-create.d.ts +96 -0
  151. package/dist/persona-create.js +39 -0
  152. package/dist/persona-create.js.map +1 -0
  153. package/dist/persona-cta-shape.d.ts +16 -0
  154. package/dist/persona-cta-shape.js +45 -0
  155. package/dist/persona-cta-shape.js.map +1 -0
  156. package/dist/persona-delete.js +0 -1
  157. package/dist/persona-delete.js.map +1 -1
  158. package/dist/persona-update.d.ts +26 -0
  159. package/dist/persona-update.js +2 -6
  160. package/dist/persona-update.js.map +1 -1
  161. package/dist/progress-poll-hint.d.ts +0 -6
  162. package/dist/progress-poll-hint.js +0 -15
  163. package/dist/progress-poll-hint.js.map +1 -1
  164. package/dist/prompts.js +0 -12
  165. package/dist/prompts.js.map +1 -1
  166. package/dist/public-ip.js +25 -58
  167. package/dist/public-ip.js.map +1 -1
  168. package/dist/publish-direct-shape.js +0 -4
  169. package/dist/publish-direct-shape.js.map +1 -1
  170. package/dist/publish-existing-shape.d.ts +0 -7
  171. package/dist/publish-existing-shape.js +0 -26
  172. package/dist/publish-existing-shape.js.map +1 -1
  173. package/dist/publish-notices.js +0 -2
  174. package/dist/publish-notices.js.map +1 -1
  175. package/dist/publish-uploaded-shape.js +0 -7
  176. package/dist/publish-uploaded-shape.js.map +1 -1
  177. package/dist/recipe-session.d.ts +0 -4
  178. package/dist/recipe-session.js +0 -17
  179. package/dist/recipe-session.js.map +1 -1
  180. package/dist/refs.d.ts +0 -11
  181. package/dist/refs.js +0 -15
  182. package/dist/refs.js.map +1 -1
  183. package/dist/remote-shapes.d.ts +52 -2
  184. package/dist/remote-shapes.js +2 -16
  185. package/dist/remote-shapes.js.map +1 -1
  186. package/dist/require-api-key.js +0 -2
  187. package/dist/require-api-key.js.map +1 -1
  188. package/dist/require-publishing-accounts.js +0 -7
  189. package/dist/require-publishing-accounts.js.map +1 -1
  190. package/dist/require-title.js +0 -4
  191. package/dist/require-title.js.map +1 -1
  192. package/dist/schedule-shapes.js +0 -19
  193. package/dist/schedule-shapes.js.map +1 -1
  194. package/dist/script-segments.d.ts +1 -5
  195. package/dist/script-segments.js +1 -54
  196. package/dist/script-segments.js.map +1 -1
  197. package/dist/secret-redaction.js +0 -4
  198. package/dist/secret-redaction.js.map +1 -1
  199. package/dist/segment-media.js +0 -22
  200. package/dist/segment-media.js.map +1 -1
  201. package/dist/segment-text.js +0 -18
  202. package/dist/segment-text.js.map +1 -1
  203. package/dist/single-video-shape.d.ts +31 -1
  204. package/dist/single-video-shape.js +6 -18
  205. package/dist/single-video-shape.js.map +1 -1
  206. package/dist/slot-detail-present.d.ts +0 -4
  207. package/dist/slot-detail-present.js +0 -9
  208. package/dist/slot-detail-present.js.map +1 -1
  209. package/dist/tool-annotations.js.map +1 -1
  210. package/dist/tools-batch.d.ts +45 -3
  211. package/dist/tools-batch.js +0 -17
  212. package/dist/tools-batch.js.map +1 -1
  213. package/dist/tools-call.d.ts +0 -1
  214. package/dist/tools-call.js +0 -1
  215. package/dist/tools-call.js.map +1 -1
  216. package/dist/tools-experiments.d.ts +4 -3
  217. package/dist/tools-experiments.js +1 -31
  218. package/dist/tools-experiments.js.map +1 -1
  219. package/dist/tools-list-stats.d.ts +0 -4
  220. package/dist/tools-list-stats.js +0 -5
  221. package/dist/tools-list-stats.js.map +1 -1
  222. package/dist/tools-pinterest.js +0 -10
  223. package/dist/tools-pinterest.js.map +1 -1
  224. package/dist/tools-posts.js +0 -9
  225. package/dist/tools-posts.js.map +1 -1
  226. package/dist/tools-prompts.js +0 -23
  227. package/dist/tools-prompts.js.map +1 -1
  228. package/dist/tools-publish-existing.js +0 -17
  229. package/dist/tools-publish-existing.js.map +1 -1
  230. package/dist/tools-publish-uploaded.js +0 -8
  231. package/dist/tools-publish-uploaded.js.map +1 -1
  232. package/dist/tools-publishing-accounts.js +0 -10
  233. package/dist/tools-publishing-accounts.js.map +1 -1
  234. package/dist/tools-single-video.d.ts +0 -4
  235. package/dist/tools-single-video.js +1 -55
  236. package/dist/tools-single-video.js.map +1 -1
  237. package/dist/tools-tool-config.d.ts +2 -0
  238. package/dist/tools-tool-config.js +2 -15
  239. package/dist/tools-tool-config.js.map +1 -1
  240. package/dist/tools-user-media.js +0 -5
  241. package/dist/tools-user-media.js.map +1 -1
  242. package/dist/tools.d.ts +2 -76
  243. package/dist/tools.js +4 -82
  244. package/dist/tools.js.map +1 -1
  245. package/dist/video-task-tools.d.ts +0 -2
  246. package/dist/video-task-tools.js +0 -43
  247. package/dist/video-task-tools.js.map +1 -1
  248. package/dist/video-type.d.ts +0 -10
  249. package/dist/video-type.js +0 -17
  250. package/dist/video-type.js.map +1 -1
  251. package/dist/voice-filters.d.ts +0 -27
  252. package/dist/voice-filters.js +0 -62
  253. package/dist/voice-filters.js.map +1 -1
  254. package/package.json +1 -1
@@ -7,10 +7,6 @@ export interface EndpointDefinition<Body extends z.ZodType | undefined, Query ex
7
7
  query?: Query;
8
8
  response: Response;
9
9
  }
10
- /** Define one endpoint contract. The literal path is preserved in the type
11
- * so ParamsOf can read its `:param` segments. `Body`/`Query` default to
12
- * `undefined` so an omitted optional schema stays `undefined` (not the
13
- * bare `ZodType`) in the returned definition. */
14
10
  export declare function defineEndpoint<Body extends z.ZodType | undefined = undefined, Query extends z.ZodType | undefined = undefined, Response extends z.ZodType = z.ZodType, Path extends string = string>(config: {
15
11
  method: EndpointMethod;
16
12
  path: Path;
@@ -18,39 +14,27 @@ export declare function defineEndpoint<Body extends z.ZodType | undefined = unde
18
14
  query?: Query;
19
15
  response: Response;
20
16
  }): EndpointDefinition<Body, Query, Response, Path>;
21
- /** Request body input type (`z.input` of the `body` schema). Indexed
22
- * access is used (not infer) so an optional `body?` property keeps its
23
- * schema type instead of widening to `unknown`. */
24
17
  export type BodyOf<Endpoint extends {
25
18
  body?: z.ZodType | undefined;
26
19
  }> = [
27
20
  Exclude<Endpoint['body'], undefined>
28
21
  ] extends [never] ? never : Exclude<Endpoint['body'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['body'], undefined>> : never;
29
- /** Query input type (`z.input` of the `query` schema). */
30
22
  export type QueryOf<Endpoint extends {
31
23
  query?: z.ZodType | undefined;
32
24
  }> = [
33
25
  Exclude<Endpoint['query'], undefined>
34
26
  ] extends [never] ? never : Exclude<Endpoint['query'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['query'], undefined>> : never;
35
- /** Response output type (`z.output` of the `response` schema). */
36
27
  export type ResponseOf<Endpoint extends {
37
28
  response: z.ZodType;
38
29
  }> = Endpoint['response'] extends z.ZodType ? z.output<Endpoint['response']> : never;
39
- /** Path params from a path template: each `:name` segment becomes a
40
- * `string` field. A path without segments is an empty record. */
41
30
  export type ParamsOf<Path extends string> = Path extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer After}` ? {
42
31
  [Key in Name]: string;
43
32
  } & ParamsOf<`/${After}`> : {
44
33
  [Key in Rest]: string;
45
34
  } : Record<never, never>;
46
- /** Generation-history paging defaults (also the MCP client's fail-fast bound). */
47
35
  export declare const VIDEO_GENERATIONS_DEFAULT_LIMIT = 50;
48
36
  export declare const VIDEO_GENERATIONS_MAX_LIMIT = 200;
49
37
  export declare function parseGenerationsLimit(value: string | null): number;
50
- /** One video_generations row, camelCase. No errorMessage: the raw
51
- * engine/upstream text may contain paths or upstream bodies and is kept
52
- * server-side (DB) for support only — the UI renders the categorized
53
- * errorCode. */
54
38
  export declare const VideoGenerationRowSchema: z.ZodObject<{
55
39
  id: z.ZodString;
56
40
  generationId: z.ZodString;
@@ -64,8 +48,6 @@ export declare const VideoGenerationRowSchema: z.ZodObject<{
64
48
  completedAt: z.ZodNullable<z.ZodString>;
65
49
  }, z.core.$strip>;
66
50
  export type VideoGenerationRow = z.infer<typeof VideoGenerationRowSchema>;
67
- /** Raw paging params as the MCP sends them (strings in the query). Plain
68
- * object, not strict: the route ignores unknown query params. */
69
51
  export declare const ListVideoGenerationsQuerySchema: z.ZodObject<{
70
52
  limit: z.ZodOptional<z.ZodString>;
71
53
  }, z.core.$strip>;
@@ -99,11 +81,6 @@ export declare const GetVideoGenerationResponseSchema: z.ZodObject<{
99
81
  completedAt: z.ZodNullable<z.ZodString>;
100
82
  }, z.core.$strip>;
101
83
  }, z.core.$strip>;
102
- /** The engine task record as the MCP wait tool reads it. `state` is the
103
- * numeric progress state (-1 failed, 1 complete, 3 queued, 4 processing);
104
- * `stage` is the engine's current step (null once finished); `error`
105
- * carries the engine failure reason; `postUrl` is the slot detail link
106
- * the web route attaches (null for direct generations). */
107
84
  export declare const VideoTaskProgressBodySchema: z.ZodObject<{
108
85
  task_id: z.ZodString;
109
86
  state: z.ZodOptional<z.ZodNumber>;
@@ -1,42 +1,11 @@
1
1
  // GENERATED from shared/contracts — do not edit.
2
2
  // Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
3
- // Video-tasks contract: the single source of truth for the video generation
4
- // history and task-status exchanges. Both apps generate a copy of this file
5
- // (see scripts/sync-contracts.mjs); never edit a generated copy by hand.
6
- //
7
- // GET /api/persona/video-generations returns the user's generation history,
8
- // newest first, paginated. The ?limit= query is LENIENT by design
9
- // (long-standing route behavior): an invalid or out-of-range limit falls
10
- // back to the default instead of failing, so the query schema below only
11
- // names the param and the parse helper carries the fallback. `success` is
12
- // a literal `true`: the routes never return success:false with a 200.
13
- //
14
- // GET /api/persona/video-status/[taskId] proxies the engine's task record
15
- // inside the engine BaseResponse envelope {status, message, body},
16
- // attaching postUrl to the task body (issue #555). The MCP wait tool reads
17
- // task_id/state/progress/stage/error/postUrl from the body; anything else
18
- // the engine adds rides through unparsed (plain object, extras ignored).
19
- // A 410 Gone (engine lost the task) is a transport error, not a 200, so
20
- // it is not modelled here — the MCP maps it to a terminal verdict.
21
- //
22
- // DELETE /api/persona/video-task/[taskId] passes the engine's
23
- // TaskDeletionResponse through verbatim; the engine model leaves every
24
- // field optional, so the contract does too.
25
3
  import { z } from 'zod';
26
- /** Define one endpoint contract. The literal path is preserved in the type
27
- * so ParamsOf can read its `:param` segments. `Body`/`Query` default to
28
- * `undefined` so an omitted optional schema stays `undefined` (not the
29
- * bare `ZodType`) in the returned definition. */
30
4
  export function defineEndpoint(config) {
31
5
  return config;
32
6
  }
33
- /** Generation-history paging defaults (also the MCP client's fail-fast bound). */
34
7
  export const VIDEO_GENERATIONS_DEFAULT_LIMIT = 50;
35
8
  export const VIDEO_GENERATIONS_MAX_LIMIT = 200;
36
- //---------------
37
- // parseGenerationsLimit — validates the ?limit= query param; invalid or
38
- // out-of-range values fall back to the default instead of failing.
39
- //---------------
40
9
  export function parseGenerationsLimit(value) {
41
10
  if (value === null || !/^\d+$/.test(value))
42
11
  return VIDEO_GENERATIONS_DEFAULT_LIMIT;
@@ -45,10 +14,6 @@ export function parseGenerationsLimit(value) {
45
14
  return VIDEO_GENERATIONS_DEFAULT_LIMIT;
46
15
  return Math.min(parsed, VIDEO_GENERATIONS_MAX_LIMIT);
47
16
  }
48
- /** One video_generations row, camelCase. No errorMessage: the raw
49
- * engine/upstream text may contain paths or upstream bodies and is kept
50
- * server-side (DB) for support only — the UI renders the categorized
51
- * errorCode. */
52
17
  export const VideoGenerationRowSchema = z.object({
53
18
  id: z.string(),
54
19
  generationId: z.string(),
@@ -61,8 +26,6 @@ export const VideoGenerationRowSchema = z.object({
61
26
  createdAt: z.string(),
62
27
  completedAt: z.string().nullable(),
63
28
  });
64
- /** Raw paging params as the MCP sends them (strings in the query). Plain
65
- * object, not strict: the route ignores unknown query params. */
66
29
  export const ListVideoGenerationsQuerySchema = z.object({
67
30
  limit: z.string().optional(),
68
31
  });
@@ -74,11 +37,6 @@ export const GetVideoGenerationResponseSchema = z.object({
74
37
  success: z.literal(true),
75
38
  generation: VideoGenerationRowSchema,
76
39
  });
77
- /** The engine task record as the MCP wait tool reads it. `state` is the
78
- * numeric progress state (-1 failed, 1 complete, 3 queued, 4 processing);
79
- * `stage` is the engine's current step (null once finished); `error`
80
- * carries the engine failure reason; `postUrl` is the slot detail link
81
- * the web route attaches (null for direct generations). */
82
40
  export const VideoTaskProgressBodySchema = z.object({
83
41
  task_id: z.string(),
84
42
  state: z.number().optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"video-tasks.js","sourceRoot":"","sources":["../../src/contracts/video-tasks.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,kEAAkE;AAClE,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,mEAAmE;AACnE,2EAA2E;AAC3E,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,mEAAmE;AACnE,EAAE;AACF,8DAA8D;AAC9D,uEAAuE;AACvE,4CAA4C;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB;;;iDAGiD;AACjD,MAAM,UAAU,cAAc,CAK5B,MAMD;IACC,OAAO,MAAM,CAAC;AAChB,CAAC;AAiCD,kFAAkF;AAClF,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAClD,MAAM,CAAC,MAAM,2BAA2B,GAAG,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ACtC,KAAK,EAAE,+BAA+B;IACtC,QAAQ,EAAE,kCAAkC;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;IAC/C,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,8CAA8C;IACpD,QAAQ,EAAE,gCAAgC;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,mCAAmC;IACzC,QAAQ,EAAE,4BAA4B;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;IAC5C,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,iCAAiC;IACvC,QAAQ,EAAE,6BAA6B;CACxC,CAAC,CAAC"}
@@ -7,10 +7,6 @@ export interface EndpointDefinition<Body extends z.ZodType | undefined, Query ex
7
7
  query?: Query;
8
8
  response: Response;
9
9
  }
10
- /** Define one endpoint contract. The literal path is preserved in the type
11
- * so ParamsOf can read its `:param` segments. `Body`/`Query` default to
12
- * `undefined` so an omitted optional schema stays `undefined` (not the
13
- * bare `ZodType`) in the returned definition. */
14
10
  export declare function defineEndpoint<Body extends z.ZodType | undefined = undefined, Query extends z.ZodType | undefined = undefined, Response extends z.ZodType = z.ZodType, Path extends string = string>(config: {
15
11
  method: EndpointMethod;
16
12
  path: Path;
@@ -18,75 +14,43 @@ export declare function defineEndpoint<Body extends z.ZodType | undefined = unde
18
14
  query?: Query;
19
15
  response: Response;
20
16
  }): EndpointDefinition<Body, Query, Response, Path>;
21
- /** Request body input type (`z.input` of the `body` schema). Indexed
22
- * access is used (not infer) so an optional `body?` property keeps its
23
- * schema type instead of widening to `unknown`. */
24
17
  export type BodyOf<Endpoint extends {
25
18
  body?: z.ZodType | undefined;
26
19
  }> = [
27
20
  Exclude<Endpoint['body'], undefined>
28
21
  ] extends [never] ? never : Exclude<Endpoint['body'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['body'], undefined>> : never;
29
- /** Query input type (`z.input` of the `query` schema). */
30
22
  export type QueryOf<Endpoint extends {
31
23
  query?: z.ZodType | undefined;
32
24
  }> = [
33
25
  Exclude<Endpoint['query'], undefined>
34
26
  ] extends [never] ? never : Exclude<Endpoint['query'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['query'], undefined>> : never;
35
- /** Response output type (`z.output` of the `response` schema). */
36
27
  export type ResponseOf<Endpoint extends {
37
28
  response: z.ZodType;
38
29
  }> = Endpoint['response'] extends z.ZodType ? z.output<Endpoint['response']> : never;
39
- /** Path params from a path template: each `:name` segment becomes a
40
- * `string` field. A path without segments is an empty record. */
41
30
  export type ParamsOf<Path extends string> = Path extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer After}` ? {
42
31
  [Key in Name]: string;
43
32
  } & ParamsOf<`/${After}`> : {
44
33
  [Key in Rest]: string;
45
34
  } : Record<never, never>;
46
- /** The one video mode (issue #542): it decides render path + price. */
47
35
  export declare const VIDEO_TYPES: readonly ["full_lipsync", "hook_lipsync", "faceless"];
48
36
  export type VideoType = (typeof VIDEO_TYPES)[number];
49
- /**
50
- * The invalid-video_type message suffix: every valid type WITH its token
51
- * cost, so the agent can choose knowing the price. Must stay identical to
52
- * the engine's VIDEO_TYPE_ERROR_SUFFIX (apps/engine/app/models/schema.py)
53
- * and to lib/tokens.ts / apps/mcp/src/video-type.ts.
54
- */
55
37
  export declare const VIDEO_TYPE_ERROR_SUFFIX = "use full_lipsync (8/15), hook_lipsync (2/3) or faceless (1)";
56
- /** Short invalid-video_type error, costs included, under 200 chars. */
57
38
  export declare function unknownVideoTypeMessage(value: unknown): string;
58
- /** Missing-video_type error: same suffix, so the agent sees values + costs. */
59
39
  export declare const VIDEO_TYPE_REQUIRED_MESSAGE = "videoType is required; use full_lipsync (8/15), hook_lipsync (2/3) or faceless (1)";
60
- /** Segments per video: the shape cap, before the content rules run. */
61
40
  export declare const MAX_SEGMENTS = 12;
62
- /** Photos per segment in images mode (full lip sync allows at most 6 in total). */
63
41
  export declare const MAX_IMAGES_MODE_MEDIAS = 30;
64
- /** Spoken hook window, seconds: reported by validate-script. */
65
42
  export declare const HOOK_MIN_SECONDS = 8;
66
43
  export declare const HOOK_MAX_SECONDS = 12;
67
- /** Requested on-screen seconds for one full-frame photo (segment pacing). */
68
44
  export declare const MIN_REQUESTED_PHOTO_SECONDS = 0.5;
69
45
  export declare const MAX_REQUESTED_PHOTO_SECONDS = 6;
70
- /**
71
- * How many problems a pre-auth 400 will echo. The route runs before session
72
- * and rate-limit checks, and a caller can send a huge array, so at most this
73
- * many problems are echoed. Each field path and each message is also
74
- * length-capped where the response is built. The event's errorCount is the
75
- * real total.
76
- */
77
46
  export declare const MAX_REPORTED_ISSUES = 20;
78
- /** Videos per batch (issue #487): the cheapest face video of every 6 is free. */
79
47
  export declare const MAX_BATCH_VIDEOS = 12;
80
- /** Batch key: letters, digits, "-" and "_" only, at most 100 chars. */
81
48
  export declare const BATCH_KEY_MAX_LENGTH = 100;
82
49
  export declare const BATCH_KEY_PATTERN: RegExp;
83
- /** What the scored text is: a post body, or a video script. */
84
50
  export declare const DRAFT_KINDS: readonly ["post", "script"];
85
51
  export type DraftKind = (typeof DRAFT_KINDS)[number];
86
- /** The networks score-draft can publish-check: every network. */
87
52
  export declare const PUBLISH_NETWORKS: readonly ["youtube", "instagram", "bluesky", "linkedin", "threads", "facebook", "pinterest", "3speak", "rumble", "fanvue", "telegram"];
88
53
  export type PublishNetwork = (typeof PUBLISH_NETWORKS)[number];
89
- /** Drafts over this input cap are a 400, never silently truncated. */
90
54
  export declare const DRAFT_MAX_INPUT_CHARS = 10000;
91
55
  export * from './upload-types.js';
92
56
  export declare const segmentOverlaySchema: z.ZodObject<{
@@ -100,6 +64,7 @@ export declare const segmentsRequestSchema: z.ZodArray<z.ZodObject<{
100
64
  content: "content";
101
65
  }>;
102
66
  text: z.ZodString;
67
+ cta: z.ZodOptional<z.ZodBoolean>;
103
68
  media: z.ZodOptional<z.ZodArray<z.ZodObject<{
104
69
  mediaId: z.ZodOptional<z.ZodString>;
105
70
  url: z.ZodOptional<z.ZodString>;
@@ -111,7 +76,6 @@ export declare const segmentsRequestSchema: z.ZodArray<z.ZodObject<{
111
76
  duration: z.ZodOptional<z.ZodNumber>;
112
77
  }, z.core.$strict>>>;
113
78
  }, z.core.$strict>>;
114
- /** Paired A/B experiment link (issue #476): one variant of one pair. */
115
79
  export declare const ExperimentLinkSchema: z.ZodObject<{
116
80
  experimentId: z.ZodString;
117
81
  variantId: z.ZodString;
@@ -152,6 +116,7 @@ export declare const GenerateAndScheduleBodySchema: z.ZodObject<{
152
116
  content: "content";
153
117
  }>;
154
118
  text: z.ZodString;
119
+ cta: z.ZodOptional<z.ZodBoolean>;
155
120
  media: z.ZodOptional<z.ZodArray<z.ZodObject<{
156
121
  mediaId: z.ZodOptional<z.ZodString>;
157
122
  url: z.ZodOptional<z.ZodString>;
@@ -184,6 +149,19 @@ export declare const GenerateAndScheduleBodySchema: z.ZodObject<{
184
149
  variantId: z.ZodString;
185
150
  pair: z.ZodNumber;
186
151
  }, z.core.$strict>>;
152
+ cta: z.ZodOptional<z.ZodNullable<z.ZodObject<{
153
+ type: z.ZodEnum<{
154
+ link: "link";
155
+ follow: "follow";
156
+ comment: "comment";
157
+ share: "share";
158
+ save: "save";
159
+ buy: "buy";
160
+ other: "other";
161
+ }>;
162
+ url: z.ZodOptional<z.ZodString>;
163
+ instruction: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strip>>>;
187
165
  }, z.core.$strip>;
188
166
  export type GenerateAndScheduleBody = z.infer<typeof GenerateAndScheduleBodySchema>;
189
167
  export declare const GenerateSlotResultSchema: z.ZodObject<{
@@ -512,6 +490,7 @@ export declare const generateAndSchedule: EndpointDefinition<z.ZodObject<{
512
490
  content: "content";
513
491
  }>;
514
492
  text: z.ZodString;
493
+ cta: z.ZodOptional<z.ZodBoolean>;
515
494
  media: z.ZodOptional<z.ZodArray<z.ZodObject<{
516
495
  mediaId: z.ZodOptional<z.ZodString>;
517
496
  url: z.ZodOptional<z.ZodString>;
@@ -544,6 +523,19 @@ export declare const generateAndSchedule: EndpointDefinition<z.ZodObject<{
544
523
  variantId: z.ZodString;
545
524
  pair: z.ZodNumber;
546
525
  }, z.core.$strict>>;
526
+ cta: z.ZodOptional<z.ZodNullable<z.ZodObject<{
527
+ type: z.ZodEnum<{
528
+ link: "link";
529
+ follow: "follow";
530
+ comment: "comment";
531
+ share: "share";
532
+ save: "save";
533
+ buy: "buy";
534
+ other: "other";
535
+ }>;
536
+ url: z.ZodOptional<z.ZodString>;
537
+ instruction: z.ZodOptional<z.ZodString>;
538
+ }, z.core.$strip>>>;
547
539
  }, z.core.$strip>, undefined, z.ZodObject<{
548
540
  success: z.ZodLiteral<true>;
549
541
  schedule: z.ZodObject<{
@@ -1,95 +1,37 @@
1
1
  // GENERATED from shared/contracts — do not edit.
2
2
  // Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
3
- // Video generation and publish-by-id contract: the single source of truth
4
- // for POST /api/videos/generate-and-schedule, validate-script, score-draft,
5
- // batch-discount, upload-url, uploads/:uploadId/complete and publish-by-id.
6
- // Both apps generate a copy of this file (see scripts/sync-contracts.mjs);
7
- // never edit a generated copy by hand.
8
- //
9
- // The web routes keep their own parsers where the 400 carries more than the
10
- // shape (generate-and-schedule collects every issue, validate-script and
11
- // score-draft report semantic failures with stable codes, mint/publish-by-id
12
- // answer with coded errors): the contract mirrors the shape those parsers
13
- // accept, and the equivalence tests pin the two together. Response schemas
14
- // are plain objects (extra fields ignored).
15
- //
16
- // Duplicated literals, each pinned by a file-parsing sync test because the
17
- // owning module cannot import this contract: VIDEO_TYPES /
18
- // VIDEO_TYPE_ERROR_SUFFIX / unknownVideoTypeMessage mirror lib/tokens.ts,
19
- // apps/mcp/src/video-type.ts and the engine's VIDEO_TYPE_ERROR_SUFFIX;
20
- // MAX_SEGMENTS / MAX_IMAGES_MODE_MEDIAS / HOOK_MIN_SECONDS / HOOK_MAX_SECONDS
21
- // / MIN_REQUESTED_PHOTO_SECONDS / MAX_REQUESTED_PHOTO_SECONDS
22
- // mirror shared/script-segments/script-segments.ts, the source of the
23
- // generated copies in both apps (a relative import from a synced contract
24
- // cannot reach it: the two apps keep it at different depths).
25
3
  import { z } from 'zod';
26
- /** Define one endpoint contract. The literal path is preserved in the type
27
- * so ParamsOf can read its `:param` segments. `Body`/`Query` default to
28
- * `undefined` so an omitted optional schema stays `undefined` (not the
29
- * bare `ZodType`) in the returned definition. */
30
4
  export function defineEndpoint(config) {
31
5
  return config;
32
6
  }
33
7
  import { EXPERIMENT_TARGET_PAIRS_MAX, EXPERIMENT_VARIANT_ID_PATTERN } from './experiments.js';
34
8
  import { UploadContentResponseSchema } from './media.js';
35
9
  import { UUID } from './metrics.js';
10
+ import { PersonaCtaSchema } from './personas.js';
36
11
  import { SOCIAL_PROVIDERS } from './providers.js';
37
12
  import { ScheduleWarningSchema } from './schedule-warnings.js';
38
13
  import { MAX_IMAGE_UPLOAD_BYTES, MAX_VIDEO_UPLOAD_BYTES, UPLOAD_CONTENT_TYPES, UPLOAD_CONTENT_TYPE_MESSAGE, isImageUploadContentType } from './upload-types.js';
39
- /** The one video mode (issue #542): it decides render path + price. */
40
14
  export const VIDEO_TYPES = ['full_lipsync', 'hook_lipsync', 'faceless'];
41
- /**
42
- * The invalid-video_type message suffix: every valid type WITH its token
43
- * cost, so the agent can choose knowing the price. Must stay identical to
44
- * the engine's VIDEO_TYPE_ERROR_SUFFIX (apps/engine/app/models/schema.py)
45
- * and to lib/tokens.ts / apps/mcp/src/video-type.ts.
46
- */
47
15
  export const VIDEO_TYPE_ERROR_SUFFIX = 'use full_lipsync (8/15), hook_lipsync (2/3) or faceless (1)';
48
- /** Short invalid-video_type error, costs included, under 200 chars. */
49
16
  export function unknownVideoTypeMessage(value) {
50
17
  const shown = value === null || value === undefined ? '' : String(value).slice(0, 32);
51
18
  return `unknown video_type '${shown}'; ${VIDEO_TYPE_ERROR_SUFFIX}`;
52
19
  }
53
- /** Missing-video_type error: same suffix, so the agent sees values + costs. */
54
20
  export const VIDEO_TYPE_REQUIRED_MESSAGE = `videoType is required; ${VIDEO_TYPE_ERROR_SUFFIX}`;
55
- /** Segments per video: the shape cap, before the content rules run. */
56
21
  export const MAX_SEGMENTS = 12;
57
- /** Photos per segment in images mode (full lip sync allows at most 6 in total). */
58
22
  export const MAX_IMAGES_MODE_MEDIAS = 30;
59
- /** Spoken hook window, seconds: reported by validate-script. */
60
23
  export const HOOK_MIN_SECONDS = 8;
61
24
  export const HOOK_MAX_SECONDS = 12;
62
- /** Requested on-screen seconds for one full-frame photo (segment pacing). */
63
25
  export const MIN_REQUESTED_PHOTO_SECONDS = 0.5;
64
26
  export const MAX_REQUESTED_PHOTO_SECONDS = 6;
65
- /**
66
- * How many problems a pre-auth 400 will echo. The route runs before session
67
- * and rate-limit checks, and a caller can send a huge array, so at most this
68
- * many problems are echoed. Each field path and each message is also
69
- * length-capped where the response is built. The event's errorCount is the
70
- * real total.
71
- */
72
27
  export const MAX_REPORTED_ISSUES = 20;
73
- /** Videos per batch (issue #487): the cheapest face video of every 6 is free. */
74
28
  export const MAX_BATCH_VIDEOS = 12;
75
- /** Batch key: letters, digits, "-" and "_" only, at most 100 chars. */
76
29
  export const BATCH_KEY_MAX_LENGTH = 100;
77
30
  export const BATCH_KEY_PATTERN = /^[A-Za-z0-9_-]+$/;
78
- /** What the scored text is: a post body, or a video script. */
79
31
  export const DRAFT_KINDS = ['post', 'script'];
80
- /** The networks score-draft can publish-check: every network. */
81
32
  export const PUBLISH_NETWORKS = SOCIAL_PROVIDERS;
82
- /** Drafts over this input cap are a 400, never silently truncated. */
83
33
  export const DRAFT_MAX_INPUT_CHARS = 10000;
84
- // Signed-upload media types and ceilings: upload-types.ts (import-free, read by the OpenAPI generator).
85
34
  export * from './upload-types.js';
86
- //---------------
87
- // Segments script (moved verbatim from
88
- // app/api/videos/generate-and-schedule/segments-schema.ts): strict at
89
- // every level so an unknown key is a 400, never silently dropped.
90
- // Content rules (word counts) live in the shared validator; this pins
91
- // the shape plus the segment-count cap.
92
- //---------------
93
35
  export const segmentOverlaySchema = z
94
36
  .object({
95
37
  title: z.string(),
@@ -101,6 +43,7 @@ export const segmentsRequestSchema = z.array(z
101
43
  .object({
102
44
  kind: z.enum(['hook', 'content']),
103
45
  text: z.string(),
46
+ cta: z.boolean().optional(),
104
47
  media: z
105
48
  .array(z
106
49
  .object({
@@ -118,7 +61,6 @@ export const segmentsRequestSchema = z.array(z
118
61
  .optional(),
119
62
  })
120
63
  .strict()).max(MAX_SEGMENTS);
121
- /** Paired A/B experiment link (issue #476): one variant of one pair. */
122
64
  export const ExperimentLinkSchema = z
123
65
  .object({
124
66
  experimentId: z.string().uuid(),
@@ -126,55 +68,30 @@ export const ExperimentLinkSchema = z
126
68
  pair: z.number().int().min(1).max(EXPERIMENT_TARGET_PAIRS_MAX),
127
69
  })
128
70
  .strict();
129
- //---------------
130
- // POST /api/videos/generate-and-schedule — moved verbatim from the route
131
- // (BodySchema). Plain object, not strict: the route rejects unknown keys
132
- // itself (rawKeyIssues — a `topics` key is a 400 naming the field, never
133
- // stripped silently), and the semantic checks (mode/schedule coupling,
134
- // segments required per mode, providers vs persona) run after the shape
135
- // parse in request-validation.ts, never here.
136
- //---------------
137
71
  const PublishingScheduleSchema = z.object({
138
72
  startAt: z.string(),
139
73
  times: z.array(z.string()),
140
74
  timezone: z.string(),
141
75
  });
142
76
  const PublishingSchema = z.object({
143
- // 'scheduled' (default): publish at the slot times. 'asap': publish each
144
- // video the moment generation finishes, with no scheduled time.
145
77
  mode: z.enum(['scheduled', 'asap']).optional(),
146
78
  providers: z.array(z.string()).max(MAX_REPORTED_ISSUES),
147
79
  accounts: z.record(z.string(), z.array(z.string())).optional(),
148
80
  pinterestBoardId: z.string().max(100).optional(),
149
- // Required in scheduled mode, forbidden in asap mode (a stray plan would
150
- // be silently ignored, so it is a 400 instead).
151
81
  schedule: PublishingScheduleSchema.optional(),
152
- // ASAP-only: the user's IANA zone, kept for display. Optional because the
153
- // schedules.timezone column is NOT NULL DEFAULT 'UTC'.
154
82
  timezone: z.string().optional(),
155
83
  });
156
84
  const OptionsSchema = z
157
85
  .object({
158
- // The one video mode (issue #542 follow-up), required: it decides
159
- // render path + price. Zod v4 dropped errorMap, so the message lives
160
- // in `error` (missing -> required, else unknown-mode with costs).
161
86
  videoType: z.enum(VIDEO_TYPES, {
162
87
  error: (issue) => (issue.input === undefined ? `options.videoType is required; ${VIDEO_TYPE_ERROR_SUFFIX}` : unknownVideoTypeMessage(issue.input)),
163
88
  }),
164
- // Inlined from shared/music-mood-field/music-mood-field.ts: the
165
- // contract cannot import it (the two apps keep the generated copy at
166
- // different depths). The equivalence test pins the bounds + describe
167
- // text to the shared field.
168
89
  musicMood: z.string().min(1).max(64).optional().describe('Background-music mood for the video: a mood from the engine BGM catalog, or "none" for explicit no music. Omitted lets the engine pick the first catalogued mood; an unknown mood is rejected with a 400 naming the valid moods. Works with faceless videos too.'),
169
90
  audioUrl: z.string().optional(),
170
91
  imageId: z.string().optional(),
171
- // Segments contract (MCP first, Phase 1): one call = one video; the
172
- // joined script becomes the video script, no LLM expands it. The engine's persona script budget and duration trim still apply downstream.
173
92
  segments: segmentsRequestSchema.optional(),
174
93
  webhookUrl: z.string().optional(),
175
94
  voiceId: z.string().optional(),
176
- // The rest of a persona's editorial definition, for a post created
177
- // WITHOUT one (migration 012). With a persona these still override it.
178
95
  videoAspect: z.enum(['9:16', '16:9', '1:1']).optional(),
179
96
  videoLayout: z.enum(['standard', 'react']).optional(),
180
97
  paragraphNumber: z.number().int().min(1).max(10).optional(),
@@ -183,19 +100,13 @@ const OptionsSchema = z
183
100
  })
184
101
  .optional();
185
102
  export const GenerateAndScheduleBodySchema = z.object({
186
- // Optional: a post without a persona is faceless (options.videoType
187
- // 'faceless') and defined entirely by options + title + description.
188
103
  personaId: z.string().optional(),
189
- // The slot label. At most 100 chars (YouTube's cap): the engine rejects
190
- // longer titles at dispatch, so fail here, pre-charge.
191
104
  title: z.string().max(100, 'title must be at most 100 characters.'),
192
- // Agent-supplied video description (issue #542 follow-up), REQUIRED: the publish copy. Zod v4 dropped required_error, so the missing-value message lives in `error`.
193
105
  description: z.string({ error: (issue) => (issue.input === undefined ? 'description is required: the publish copy for this video.' : undefined) }).min(1, 'description must be a non-empty string: the publish copy for this video.').max(5000, 'description must be at most 5000 characters.'),
194
106
  publishing: PublishingSchema,
195
107
  options: OptionsSchema,
196
108
  idempotencyKey: z.string().optional(),
197
- // Paired A/B experiment link (issue #476), checked before the charge.
198
- experiment: ExperimentLinkSchema.optional(),
109
+ experiment: ExperimentLinkSchema.optional(), cta: PersonaCtaSchema.nullable().optional(),
199
110
  });
200
111
  export const GenerateSlotResultSchema = z.object({
201
112
  slotId: z.string(),
@@ -203,16 +114,10 @@ export const GenerateSlotResultSchema = z.object({
203
114
  title: z.string(),
204
115
  taskId: z.string().nullable(),
205
116
  status: z.string(),
206
- /** Machine code for a failed slot (image_sign_failed, engine_rejected, ...). */
207
117
  errorCode: z.string().optional(),
208
- /** Whether the prepaid cost was returned after a failed dispatch. */
209
118
  tokensRefunded: z.boolean().optional(),
210
119
  });
211
- // Warning objects, never a bare string. See schedule-warnings.ts.
212
120
  export const GenerateAndScheduleWarningSchema = ScheduleWarningSchema;
213
- // The all-failed 502 envelope ({ success: false, error, code, ... }) is
214
- // not modelled: the MCP throws on non-2xx before parsing, so only the
215
- // success shape reaches the client.
216
121
  export const GenerateAndScheduleResponseSchema = z.object({
217
122
  success: z.literal(true),
218
123
  schedule: z.object({
@@ -223,12 +128,6 @@ export const GenerateAndScheduleResponseSchema = z.object({
223
128
  replayed: z.boolean(),
224
129
  warnings: z.array(GenerateAndScheduleWarningSchema).optional(),
225
130
  });
226
- //---------------
227
- // POST /api/videos/validate-script — mechanical segments-script
228
- // validation only. The route runs validateSegments after the shape parse;
229
- // the body schema mirrors the fields it reads (segments is opaque here,
230
- // the validator owns its content rules).
231
- //---------------
232
131
  export const ValidateScriptBodySchema = z.object({
233
132
  segments: z.unknown().optional(),
234
133
  videoType: z
@@ -253,12 +152,6 @@ export const ValidateScriptResponseSchema = z.object({
253
152
  measured: z.literal('pending'),
254
153
  measuredReason: z.string(),
255
154
  });
256
- //---------------
257
- // POST /api/videos/score-draft — mechanical draft scoring. The route
258
- // keeps its hand-rolled parseBody (the non-object body message and the
259
- // per-field messages are part of its 400 contract); this schema mirrors
260
- // its rules, message for message.
261
- //---------------
262
155
  export const ScoreDraftBodySchema = z.object({
263
156
  draft: z
264
157
  .string({
@@ -289,8 +182,6 @@ export const DraftBaselineSchema = z.object({
289
182
  topAngles: z.array(TopAngleSchema),
290
183
  medianEngagement: z.number().nullable(),
291
184
  bestEngagement: z.number().nullable(),
292
- // True when the capped read left rows out, so the numbers above describe
293
- // only the most recent BASELINE_ROW_LIMIT snapshots.
294
185
  truncated: z.boolean(),
295
186
  });
296
187
  export const PublishCheckSchema = z.object({ network: z.enum(PUBLISH_NETWORKS), ok: z.boolean(), failures: z.array(z.string()), warnings: z.array(z.string()) });
@@ -301,14 +192,8 @@ export const ScoreDraftResponseSchema = z.object({
301
192
  reasons: z.array(DraftScoreReasonSchema),
302
193
  counts: DraftCountsSchema,
303
194
  baseline: DraftBaselineSchema,
304
- // Null for a script: caption limits do not apply to spoken text.
305
195
  publishCheck: PublishCheckSchema.nullable(),
306
196
  });
307
- //---------------
308
- // POST /api/videos/batch-discount — the "6 for 5" batch discount
309
- // (issue #487). The route keeps its local parse (first-issue message,
310
- // bare) plus the duplicate-scheduleIds check that runs after it.
311
- //---------------
312
197
  export const BatchDiscountBodySchema = z
313
198
  .object({
314
199
  batchKey: z.string().min(1).max(BATCH_KEY_MAX_LENGTH).regex(BATCH_KEY_PATTERN, 'batchKey may only contain letters, digits, "-" and "_".'),
@@ -327,12 +212,6 @@ export const BatchDiscountResponseSchema = z.object({
327
212
  chargedTokens: z.number(),
328
213
  warnings: z.array(z.string()),
329
214
  });
330
- //---------------
331
- // POST /api/videos/upload-url + POST /api/videos/uploads/:uploadId/complete
332
- // — signed video uploads (issue #561). The mint route keeps its coded
333
- // parseMintBody (VIDEO_UPLOAD_INVALID_* + the 413 for an oversize
334
- // declaration); this schema mirrors its accept/reject boundary.
335
- //---------------
336
215
  export const MintVideoUploadBodySchema = z.object({
337
216
  contentType: z.enum(UPLOAD_CONTENT_TYPES, {
338
217
  error: () => UPLOAD_CONTENT_TYPE_MESSAGE,
@@ -352,16 +231,6 @@ export const MintVideoUploadResponseSchema = z.object({
352
231
  maxBytes: z.number(),
353
232
  });
354
233
  export const CompleteVideoUploadResponseSchema = z.object({ success: z.literal(true), uploadId: z.string(), status: z.literal('ready'), contentType: z.enum(UPLOAD_CONTENT_TYPES), sizeBytes: z.number() });
355
- //---------------
356
- // POST /api/videos/publish-by-id — publish a signed-upload video by id
357
- // (issue #561). The route keeps its coded parsePublishBody (ValidationError
358
- // + field); this schema mirrors its shape rules. The provider-specific
359
- // required fields (title/description for youtube/rumble/fanvue, tags +
360
- // privacyStatus for youtube, boardId + description/caption for pinterest)
361
- // are semantic checks in validatePublishFields, not shape rules.
362
- // The response is the media contract's upload-content shape: the route
363
- // returns the normalized publish result plus the computed successCount.
364
- //---------------
365
234
  function optionalContractString(field) {
366
235
  return z.string({ error: () => `${field} must be a string.` }).optional();
367
236
  }
@@ -397,9 +266,6 @@ export const PublishByIdBodySchema = z.object({
397
266
  caption: optionalContractString('caption'),
398
267
  boardId: optionalContractString('boardId'),
399
268
  });
400
- //---------------
401
- // Endpoints.
402
- //---------------
403
269
  export const generateAndSchedule = defineEndpoint({
404
270
  method: 'POST',
405
271
  path: '/api/videos/generate-and-schedule',