post-engineer-mcp 1.52.601 → 1.52.615
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client-batch.d.ts +3 -1
- package/dist/client-batch.js +4 -1
- package/dist/client-batch.js.map +1 -1
- package/dist/client-billing.d.ts +5 -0
- package/dist/client-billing.js +34 -0
- package/dist/client-billing.js.map +1 -0
- package/dist/client-experiments.d.ts +5 -14
- package/dist/client-experiments.js +17 -3
- package/dist/client-experiments.js.map +1 -1
- package/dist/client-posts.d.ts +12 -6
- package/dist/client-posts.js +22 -11
- package/dist/client-posts.js.map +1 -1
- package/dist/client-prompts.d.ts +4 -8
- package/dist/client-prompts.js +7 -24
- package/dist/client-prompts.js.map +1 -1
- package/dist/client-publish-uploaded.d.ts +8 -1
- package/dist/client-publish-uploaded.js +121 -49
- package/dist/client-publish-uploaded.js.map +1 -1
- package/dist/client-publishing-accounts.d.ts +4 -2
- package/dist/client-publishing-accounts.js +6 -2
- package/dist/client-publishing-accounts.js.map +1 -1
- package/dist/client-types.d.ts +5 -4
- package/dist/client-user-media.d.ts +4 -3
- package/dist/client-user-media.js +17 -47
- package/dist/client-user-media.js.map +1 -1
- package/dist/client-video-task.d.ts +3 -1
- package/dist/client-video-task.js +4 -1
- package/dist/client-video-task.js.map +1 -1
- package/dist/client.d.ts +40 -39
- package/dist/client.js +80 -148
- package/dist/client.js.map +1 -1
- package/dist/cloned-voice-client.d.ts +7 -5
- package/dist/cloned-voice-client.js +10 -4
- package/dist/cloned-voice-client.js.map +1 -1
- package/dist/connect-account.js +14 -6
- package/dist/connect-account.js.map +1 -1
- package/dist/contract-response.d.ts +8 -0
- package/dist/contract-response.js +24 -0
- package/dist/contract-response.js.map +1 -0
- package/dist/contracts/accounts.d.ts +844 -0
- package/dist/contracts/accounts.js +346 -0
- package/dist/contracts/accounts.js.map +1 -0
- package/dist/contracts/billing.d.ts +109 -0
- package/dist/contracts/billing.js +88 -0
- package/dist/contracts/billing.js.map +1 -0
- package/dist/contracts/endpoint.d.ts +45 -0
- package/dist/contracts/endpoint.js +8 -0
- package/dist/contracts/endpoint.js.map +1 -0
- package/dist/contracts/experiments.d.ts +271 -0
- package/dist/contracts/experiments.js +170 -0
- package/dist/contracts/experiments.js.map +1 -0
- package/dist/contracts/media.d.ts +165 -0
- package/dist/contracts/media.js +139 -0
- package/dist/contracts/media.js.map +1 -0
- package/dist/contracts/metrics.d.ts +351 -0
- package/dist/contracts/metrics.js +256 -0
- package/dist/contracts/metrics.js.map +1 -0
- package/dist/contracts/personas.d.ts +560 -0
- package/dist/contracts/personas.js +346 -0
- package/dist/contracts/personas.js.map +1 -0
- package/dist/contracts/posts.d.ts +485 -0
- package/dist/contracts/posts.js +153 -0
- package/dist/contracts/posts.js.map +1 -0
- package/dist/contracts/prompts.d.ts +90 -0
- package/dist/contracts/prompts.js +48 -0
- package/dist/contracts/prompts.js.map +1 -0
- package/dist/contracts/schedule.d.ts +691 -0
- package/dist/contracts/schedule.js +264 -0
- package/dist/contracts/schedule.js.map +1 -0
- package/dist/contracts/video-tasks.d.ts +181 -0
- package/dist/contracts/video-tasks.js +121 -0
- package/dist/contracts/video-tasks.js.map +1 -0
- package/dist/contracts/videos.d.ts +693 -0
- package/dist/contracts/videos.js +443 -0
- package/dist/contracts/videos.js.map +1 -0
- package/dist/contracts/voices.d.ts +237 -0
- package/dist/contracts/voices.js +118 -0
- package/dist/contracts/voices.js.map +1 -0
- package/dist/generate-video.d.ts +34 -34
- package/dist/generate-video.js +14 -2
- package/dist/generate-video.js.map +1 -1
- package/dist/intent-content.js +1 -1
- package/dist/intent-personas.js +17 -7
- package/dist/intent-personas.js.map +1 -1
- package/dist/limits.d.ts +27 -44
- package/dist/limits.js +27 -45
- package/dist/limits.js.map +1 -1
- package/dist/persona-delete.js +9 -9
- package/dist/persona-delete.js.map +1 -1
- package/dist/persona-update.js +3 -2
- package/dist/persona-update.js.map +1 -1
- package/dist/script-segments.d.ts +1 -1
- package/dist/script-segments.js +1 -1
- package/dist/single-video-shape.d.ts +5 -5
- package/dist/single-video-shape.js +1 -1
- package/dist/tools-batch.d.ts +42 -42
- package/dist/tools-batch.js +12 -36
- package/dist/tools-batch.js.map +1 -1
- package/dist/tools-experiments.d.ts +11 -11
- package/dist/tools-experiments.js +17 -9
- package/dist/tools-experiments.js.map +1 -1
- package/dist/tools-pinterest.js +5 -15
- package/dist/tools-pinterest.js.map +1 -1
- package/dist/tools-single-video.js +14 -51
- package/dist/tools-single-video.js.map +1 -1
- package/dist/tools-user-media.js +3 -1
- package/dist/tools-user-media.js.map +1 -1
- package/dist/tools.d.ts +0 -25
- package/dist/tools.js +56 -96
- package/dist/tools.js.map +1 -1
- package/dist/voice-filters.js +2 -1
- package/dist/voice-filters.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// GENERATED from shared/contracts — do not edit.
|
|
2
|
+
// Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
|
|
3
|
+
// Schedule contract: the single source of truth for the schedule reads and
|
|
4
|
+
// slot mutations (GET/DELETE /api/schedule, GET /api/schedule/status,
|
|
5
|
+
// GET/PATCH/DELETE /api/schedule/slots/[slotId]). Both apps generate a copy
|
|
6
|
+
// of this file (see scripts/sync-contracts.mjs); never edit a generated
|
|
7
|
+
// copy by hand.
|
|
8
|
+
//
|
|
9
|
+
// Shapes mirror the routes, not a cleaned-up ideal:
|
|
10
|
+
// - GET /api/schedule returns the raw Supabase rows, so the schedule row
|
|
11
|
+
// keeps its snake_case keys and DB nullability (persona_id is nullable
|
|
12
|
+
// for faceless schedules, migration 012; publish_mode is pinned to the
|
|
13
|
+
// 'scheduled'/'asap' CHECK of migration 015).
|
|
14
|
+
// - GET /api/schedule/status returns the presented slots: the snake_case
|
|
15
|
+
// row fields (RESULT_SELECT) plus the camelCase enrichment
|
|
16
|
+
// (apps/web/lib/schedule-slot-presentation.ts) and the publish rows
|
|
17
|
+
// (apps/web/lib/publish-user-notice.ts). `status` is the PRESENTED
|
|
18
|
+
// status: pending shows as 'awaiting', a failed slot with published
|
|
19
|
+
// outcomes shows as 'completed'.
|
|
20
|
+
// - PATCH /api/schedule/slots/[slotId] does not use readBody (its coded
|
|
21
|
+
// error envelope would change), so the body schema below mirrors the
|
|
22
|
+
// route's messages and the equivalence test pins them; the 3h/30d
|
|
23
|
+
// window rule stays server-side (apps/web/lib/schedule-window.ts).
|
|
24
|
+
// `success` is a literal `true`: the routes never return success:false
|
|
25
|
+
// with a 200.
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
/** Define one endpoint contract. The literal path is preserved in the type
|
|
28
|
+
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
29
|
+
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
30
|
+
* bare `ZodType`) in the returned definition. */
|
|
31
|
+
export function defineEndpoint(config) {
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
import { PublishProviderFailureSchema, PublishUserNoticeSchema, SlotDetailSchema, } from './posts.js';
|
|
35
|
+
/** A row of the schedules table, as GET /api/schedule returns it. */
|
|
36
|
+
export const ScheduleRowSchema = z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
persona_id: z.string().nullable(),
|
|
39
|
+
providers: z.array(z.string()),
|
|
40
|
+
youtube_account_ids: z.array(z.string()),
|
|
41
|
+
instagram_account_ids: z.array(z.string()),
|
|
42
|
+
linkedin_account_ids: z.array(z.string()),
|
|
43
|
+
bluesky_account_ids: z.array(z.string()),
|
|
44
|
+
threads_account_ids: z.array(z.string()),
|
|
45
|
+
facebook_account_ids: z.array(z.string()),
|
|
46
|
+
pinterest_account_ids: z.array(z.string()),
|
|
47
|
+
pinterest_board_id: z.string().nullable(),
|
|
48
|
+
threespeak_account_ids: z.array(z.string()),
|
|
49
|
+
rumble_account_ids: z.array(z.string()),
|
|
50
|
+
days_of_week: z.array(z.number()).nullable(),
|
|
51
|
+
start_hour: z.number().nullable(),
|
|
52
|
+
end_hour: z.number().nullable(),
|
|
53
|
+
posts_per_day: z.number(),
|
|
54
|
+
timezone: z.string(),
|
|
55
|
+
active: z.boolean(),
|
|
56
|
+
created_at: z.string(),
|
|
57
|
+
publish_mode: z.enum(['scheduled', 'asap']),
|
|
58
|
+
});
|
|
59
|
+
export const ListSchedulesResponseSchema = z.object({
|
|
60
|
+
success: z.literal(true),
|
|
61
|
+
schedules: z.array(ScheduleRowSchema),
|
|
62
|
+
});
|
|
63
|
+
//---------------
|
|
64
|
+
// DELETE /api/schedule?id= — the id check, as a parser so the MCP side
|
|
65
|
+
// can pin it. The route returns the same 400 message as before.
|
|
66
|
+
//---------------
|
|
67
|
+
export function parseCancelScheduleQuery(params) {
|
|
68
|
+
const id = params.get('id');
|
|
69
|
+
if (!id) {
|
|
70
|
+
return { ok: false, error: 'id query param is required.' };
|
|
71
|
+
}
|
|
72
|
+
return { ok: true, query: { id } };
|
|
73
|
+
}
|
|
74
|
+
export const CancelRefundSchema = z.object({
|
|
75
|
+
slotId: z.string(),
|
|
76
|
+
refunded: z.boolean(),
|
|
77
|
+
alreadyRefunded: z.boolean(),
|
|
78
|
+
reason: z.enum([
|
|
79
|
+
'not_generated',
|
|
80
|
+
'already_generated',
|
|
81
|
+
'already_refunded',
|
|
82
|
+
'not_charged',
|
|
83
|
+
'refund_failed',
|
|
84
|
+
'discount_withheld',
|
|
85
|
+
]),
|
|
86
|
+
});
|
|
87
|
+
export const CancelScheduleResponseSchema = z.object({
|
|
88
|
+
success: z.literal(true),
|
|
89
|
+
cancelledSlotIds: z.array(z.string()),
|
|
90
|
+
refunds: z.array(CancelRefundSchema),
|
|
91
|
+
batchDiscountWithheld: z.number(),
|
|
92
|
+
});
|
|
93
|
+
//---------------
|
|
94
|
+
// GET /api/schedule/status — the limit and range parsers, moved verbatim
|
|
95
|
+
// from apps/web/app/api/schedule/status/route.ts and range.ts.
|
|
96
|
+
//---------------
|
|
97
|
+
export const STATUS_LIMIT_DEFAULT = 10;
|
|
98
|
+
export const STATUS_LIMIT_MAX = 500;
|
|
99
|
+
export function parseStatusLimit(value) {
|
|
100
|
+
if (value === null || !/^\d+$/.test(value))
|
|
101
|
+
return STATUS_LIMIT_DEFAULT;
|
|
102
|
+
const parsed = Number.parseInt(value, 10);
|
|
103
|
+
if (!Number.isInteger(parsed) || parsed < 1)
|
|
104
|
+
return STATUS_LIMIT_DEFAULT;
|
|
105
|
+
return Math.min(parsed, STATUS_LIMIT_MAX);
|
|
106
|
+
}
|
|
107
|
+
export const RANGE_MAX_SPAN_DAYS = 62;
|
|
108
|
+
export const RANGE_MAX_SLOTS = 1000;
|
|
109
|
+
export const RANGE_STATUSES = [
|
|
110
|
+
'pending',
|
|
111
|
+
'generating',
|
|
112
|
+
'ready',
|
|
113
|
+
'publishing',
|
|
114
|
+
'published',
|
|
115
|
+
'failed',
|
|
116
|
+
];
|
|
117
|
+
const ISO_INSTANT = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
118
|
+
function parseInstant(value) {
|
|
119
|
+
if (!ISO_INSTANT.test(value))
|
|
120
|
+
return null;
|
|
121
|
+
const date = new Date(value);
|
|
122
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
123
|
+
}
|
|
124
|
+
export function parseStatusRange(params) {
|
|
125
|
+
const from = params.get('from');
|
|
126
|
+
const to = params.get('to');
|
|
127
|
+
if (from === null && to === null)
|
|
128
|
+
return { kind: 'none' };
|
|
129
|
+
if (from === null || to === null) {
|
|
130
|
+
return { kind: 'error', message: 'from and to must be provided together.' };
|
|
131
|
+
}
|
|
132
|
+
if (params.has('limit')) {
|
|
133
|
+
return { kind: 'error', message: 'limit cannot be combined with from/to.' };
|
|
134
|
+
}
|
|
135
|
+
const fromDate = parseInstant(from);
|
|
136
|
+
const toDate = parseInstant(to);
|
|
137
|
+
if (fromDate === null || toDate === null) {
|
|
138
|
+
return {
|
|
139
|
+
kind: 'error',
|
|
140
|
+
message: 'from and to must be ISO-8601 timestamps with a UTC offset.',
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (fromDate.getTime() >= toDate.getTime()) {
|
|
144
|
+
return { kind: 'error', message: 'from must be before to.' };
|
|
145
|
+
}
|
|
146
|
+
if (toDate.getTime() - fromDate.getTime() > RANGE_MAX_SPAN_DAYS * 86_400_000) {
|
|
147
|
+
return { kind: 'error', message: `The range cannot exceed ${RANGE_MAX_SPAN_DAYS} days.` };
|
|
148
|
+
}
|
|
149
|
+
return { kind: 'range', from: fromDate.toISOString(), to: toDate.toISOString() };
|
|
150
|
+
}
|
|
151
|
+
/** Mirrors apps/web/lib/timezone.ts hasExplicitOffset (Z or ±hh:mm / ±hhmm). */
|
|
152
|
+
export function hasExplicitOffset(value) {
|
|
153
|
+
return /(?:Z|[+-]\d{2}:?\d{2})$/.test(value.trim());
|
|
154
|
+
}
|
|
155
|
+
/** A presented slot: the row fields plus the enrichment spread over them. */
|
|
156
|
+
export const StatusSlotSchema = z.object({
|
|
157
|
+
id: z.string(),
|
|
158
|
+
slot_at: z.string(),
|
|
159
|
+
status: z.enum([
|
|
160
|
+
'awaiting',
|
|
161
|
+
'generating',
|
|
162
|
+
'ready',
|
|
163
|
+
'publishing',
|
|
164
|
+
'published',
|
|
165
|
+
'failed',
|
|
166
|
+
'completed',
|
|
167
|
+
]),
|
|
168
|
+
title: z.string().nullable(),
|
|
169
|
+
error: z.string().nullable(),
|
|
170
|
+
published_at: z.string().nullable(),
|
|
171
|
+
schedule_id: z.string(),
|
|
172
|
+
task_id: z.string().nullable(),
|
|
173
|
+
progress: z.number(),
|
|
174
|
+
stage: z.string().nullable(),
|
|
175
|
+
queuePosition: z.number().nullable(),
|
|
176
|
+
queueTotal: z.number().nullable(),
|
|
177
|
+
retryable: z.boolean().nullable(),
|
|
178
|
+
postUrl: z.string().nullable(),
|
|
179
|
+
userNotices: z.array(PublishUserNoticeSchema).optional(),
|
|
180
|
+
providerFailures: z.array(PublishProviderFailureSchema).optional(),
|
|
181
|
+
});
|
|
182
|
+
export const ListPostsResponseSchema = z.object({
|
|
183
|
+
success: z.literal(true),
|
|
184
|
+
upcoming: z.array(StatusSlotSchema),
|
|
185
|
+
recent: z.array(StatusSlotSchema),
|
|
186
|
+
hasAnyPost: z.boolean(),
|
|
187
|
+
});
|
|
188
|
+
export const ListPostsInRangeResponseSchema = z.object({
|
|
189
|
+
success: z.literal(true),
|
|
190
|
+
slots: z.array(StatusSlotSchema),
|
|
191
|
+
truncated: z.boolean(),
|
|
192
|
+
});
|
|
193
|
+
//---------------
|
|
194
|
+
// GET /api/schedule/slots/[slotId] — the same detail as GET /api/posts/[id]
|
|
195
|
+
// returns for a slot, without the `kind` wrapper the posts route adds.
|
|
196
|
+
//---------------
|
|
197
|
+
export const GetSlotResponseSchema = SlotDetailSchema.extend({
|
|
198
|
+
success: z.literal(true),
|
|
199
|
+
});
|
|
200
|
+
//---------------
|
|
201
|
+
// PATCH /api/schedule/slots/[slotId] — mirrors the route's validation
|
|
202
|
+
// messages; the 3h/30d window rule stays server-side.
|
|
203
|
+
//---------------
|
|
204
|
+
function nonBlank(message) {
|
|
205
|
+
return z.string().min(1, message).refine((value) => value.trim().length > 0, message);
|
|
206
|
+
}
|
|
207
|
+
export const UpdateSlotBodySchema = z
|
|
208
|
+
.object({
|
|
209
|
+
title: nonBlank('title must be a non-empty string.').optional(),
|
|
210
|
+
slotAt: z
|
|
211
|
+
.string()
|
|
212
|
+
.refine((value) => hasExplicitOffset(value), {
|
|
213
|
+
message: 'slotAt must carry an explicit timezone offset (Z or ±hh:mm).',
|
|
214
|
+
})
|
|
215
|
+
.optional(),
|
|
216
|
+
})
|
|
217
|
+
.refine((value) => value.title !== undefined || value.slotAt !== undefined, {
|
|
218
|
+
message: 'Provide title or slotAt to update.',
|
|
219
|
+
});
|
|
220
|
+
export const UpdateSlotResponseSchema = z.object({
|
|
221
|
+
success: z.literal(true),
|
|
222
|
+
title: z.string().optional(),
|
|
223
|
+
slotAt: z.string().optional(),
|
|
224
|
+
});
|
|
225
|
+
export const DeleteSlotResponseSchema = z.object({
|
|
226
|
+
success: z.literal(true),
|
|
227
|
+
});
|
|
228
|
+
export const listSchedules = defineEndpoint({
|
|
229
|
+
method: 'GET',
|
|
230
|
+
path: '/api/schedule',
|
|
231
|
+
response: ListSchedulesResponseSchema,
|
|
232
|
+
});
|
|
233
|
+
export const cancelSchedule = defineEndpoint({
|
|
234
|
+
method: 'DELETE',
|
|
235
|
+
path: '/api/schedule',
|
|
236
|
+
response: CancelScheduleResponseSchema,
|
|
237
|
+
});
|
|
238
|
+
export const listPosts = defineEndpoint({
|
|
239
|
+
method: 'GET',
|
|
240
|
+
path: '/api/schedule/status',
|
|
241
|
+
response: ListPostsResponseSchema,
|
|
242
|
+
});
|
|
243
|
+
export const listPostsInRange = defineEndpoint({
|
|
244
|
+
method: 'GET',
|
|
245
|
+
path: '/api/schedule/status',
|
|
246
|
+
response: ListPostsInRangeResponseSchema,
|
|
247
|
+
});
|
|
248
|
+
export const getSlot = defineEndpoint({
|
|
249
|
+
method: 'GET',
|
|
250
|
+
path: '/api/schedule/slots/:slotId',
|
|
251
|
+
response: GetSlotResponseSchema,
|
|
252
|
+
});
|
|
253
|
+
export const updateSlotTitle = defineEndpoint({
|
|
254
|
+
method: 'PATCH',
|
|
255
|
+
path: '/api/schedule/slots/:slotId',
|
|
256
|
+
body: UpdateSlotBodySchema,
|
|
257
|
+
response: UpdateSlotResponseSchema,
|
|
258
|
+
});
|
|
259
|
+
export const deleteSlot = defineEndpoint({
|
|
260
|
+
method: 'DELETE',
|
|
261
|
+
path: '/api/schedule/slots/:slotId',
|
|
262
|
+
response: DeleteSlotResponseSchema,
|
|
263
|
+
});
|
|
264
|
+
//# sourceMappingURL=schedule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/contracts/schedule.ts"],"names":[],"mappings":"AAAA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,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,6BAA6B;IACnC,QAAQ,EAAE,wBAAwB;CACnC,CAAC,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type EndpointMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
3
|
+
export interface EndpointDefinition<Body extends z.ZodType | undefined, Query extends z.ZodType | undefined, Response extends z.ZodType, Path extends string> {
|
|
4
|
+
method: EndpointMethod;
|
|
5
|
+
path: Path;
|
|
6
|
+
body?: Body;
|
|
7
|
+
query?: Query;
|
|
8
|
+
response: Response;
|
|
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
|
+
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
|
+
method: EndpointMethod;
|
|
16
|
+
path: Path;
|
|
17
|
+
body?: Body;
|
|
18
|
+
query?: Query;
|
|
19
|
+
response: Response;
|
|
20
|
+
}): 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
|
+
export type BodyOf<Endpoint extends {
|
|
25
|
+
body?: z.ZodType | undefined;
|
|
26
|
+
}> = [
|
|
27
|
+
Exclude<Endpoint['body'], undefined>
|
|
28
|
+
] 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
|
+
export type QueryOf<Endpoint extends {
|
|
31
|
+
query?: z.ZodType | undefined;
|
|
32
|
+
}> = [
|
|
33
|
+
Exclude<Endpoint['query'], undefined>
|
|
34
|
+
] 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
|
+
export type ResponseOf<Endpoint extends {
|
|
37
|
+
response: z.ZodType;
|
|
38
|
+
}> = 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
|
+
export type ParamsOf<Path extends string> = Path extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer After}` ? {
|
|
42
|
+
[Key in Name]: string;
|
|
43
|
+
} & ParamsOf<`/${After}`> : {
|
|
44
|
+
[Key in Rest]: string;
|
|
45
|
+
} : Record<never, never>;
|
|
46
|
+
/** Generation-history paging defaults (also the MCP client's fail-fast bound). */
|
|
47
|
+
export declare const VIDEO_GENERATIONS_DEFAULT_LIMIT = 50;
|
|
48
|
+
export declare const VIDEO_GENERATIONS_MAX_LIMIT = 200;
|
|
49
|
+
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
|
+
export declare const VideoGenerationRowSchema: z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
generationId: z.ZodString;
|
|
57
|
+
engineTaskId: z.ZodNullable<z.ZodString>;
|
|
58
|
+
personaName: z.ZodNullable<z.ZodString>;
|
|
59
|
+
videoSubject: z.ZodNullable<z.ZodString>;
|
|
60
|
+
status: z.ZodString;
|
|
61
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
62
|
+
tokensRefunded: z.ZodBoolean;
|
|
63
|
+
createdAt: z.ZodString;
|
|
64
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
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
|
+
export declare const ListVideoGenerationsQuerySchema: z.ZodObject<{
|
|
70
|
+
limit: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const ListVideoGenerationsResponseSchema: z.ZodObject<{
|
|
73
|
+
success: z.ZodLiteral<true>;
|
|
74
|
+
generations: z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
generationId: z.ZodString;
|
|
77
|
+
engineTaskId: z.ZodNullable<z.ZodString>;
|
|
78
|
+
personaName: z.ZodNullable<z.ZodString>;
|
|
79
|
+
videoSubject: z.ZodNullable<z.ZodString>;
|
|
80
|
+
status: z.ZodString;
|
|
81
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
82
|
+
tokensRefunded: z.ZodBoolean;
|
|
83
|
+
createdAt: z.ZodString;
|
|
84
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export declare const GetVideoGenerationResponseSchema: z.ZodObject<{
|
|
88
|
+
success: z.ZodLiteral<true>;
|
|
89
|
+
generation: z.ZodObject<{
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
generationId: z.ZodString;
|
|
92
|
+
engineTaskId: z.ZodNullable<z.ZodString>;
|
|
93
|
+
personaName: z.ZodNullable<z.ZodString>;
|
|
94
|
+
videoSubject: z.ZodNullable<z.ZodString>;
|
|
95
|
+
status: z.ZodString;
|
|
96
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
97
|
+
tokensRefunded: z.ZodBoolean;
|
|
98
|
+
createdAt: z.ZodString;
|
|
99
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
}, 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
|
+
export declare const VideoTaskProgressBodySchema: z.ZodObject<{
|
|
108
|
+
task_id: z.ZodString;
|
|
109
|
+
state: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
progress: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
stage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
postUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
export type VideoTaskProgressBody = z.infer<typeof VideoTaskProgressBodySchema>;
|
|
116
|
+
export declare const GetVideoStatusResponseSchema: z.ZodObject<{
|
|
117
|
+
status: z.ZodNumber;
|
|
118
|
+
message: z.ZodNullable<z.ZodString>;
|
|
119
|
+
body: z.ZodObject<{
|
|
120
|
+
task_id: z.ZodString;
|
|
121
|
+
state: z.ZodOptional<z.ZodNumber>;
|
|
122
|
+
progress: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
stage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
|
+
postUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export declare const CancelVideoTaskResponseSchema: z.ZodObject<{
|
|
129
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
131
|
+
body: z.ZodOptional<z.ZodUnknown>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export declare const listVideoGenerations: EndpointDefinition<undefined, z.ZodObject<{
|
|
134
|
+
limit: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
136
|
+
success: z.ZodLiteral<true>;
|
|
137
|
+
generations: z.ZodArray<z.ZodObject<{
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
generationId: z.ZodString;
|
|
140
|
+
engineTaskId: z.ZodNullable<z.ZodString>;
|
|
141
|
+
personaName: z.ZodNullable<z.ZodString>;
|
|
142
|
+
videoSubject: z.ZodNullable<z.ZodString>;
|
|
143
|
+
status: z.ZodString;
|
|
144
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
145
|
+
tokensRefunded: z.ZodBoolean;
|
|
146
|
+
createdAt: z.ZodString;
|
|
147
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
}, z.core.$strip>, "/api/persona/video-generations">;
|
|
150
|
+
export declare const getVideoGeneration: EndpointDefinition<undefined, undefined, z.ZodObject<{
|
|
151
|
+
success: z.ZodLiteral<true>;
|
|
152
|
+
generation: z.ZodObject<{
|
|
153
|
+
id: z.ZodString;
|
|
154
|
+
generationId: z.ZodString;
|
|
155
|
+
engineTaskId: z.ZodNullable<z.ZodString>;
|
|
156
|
+
personaName: z.ZodNullable<z.ZodString>;
|
|
157
|
+
videoSubject: z.ZodNullable<z.ZodString>;
|
|
158
|
+
status: z.ZodString;
|
|
159
|
+
errorCode: z.ZodNullable<z.ZodString>;
|
|
160
|
+
tokensRefunded: z.ZodBoolean;
|
|
161
|
+
createdAt: z.ZodString;
|
|
162
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
}, z.core.$strip>, "/api/persona/video-generations/:generationId">;
|
|
165
|
+
export declare const getVideoStatus: EndpointDefinition<undefined, undefined, z.ZodObject<{
|
|
166
|
+
status: z.ZodNumber;
|
|
167
|
+
message: z.ZodNullable<z.ZodString>;
|
|
168
|
+
body: z.ZodObject<{
|
|
169
|
+
task_id: z.ZodString;
|
|
170
|
+
state: z.ZodOptional<z.ZodNumber>;
|
|
171
|
+
progress: z.ZodOptional<z.ZodNumber>;
|
|
172
|
+
stage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
173
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
174
|
+
postUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
}, z.core.$strip>, "/api/persona/video-status/:taskId">;
|
|
177
|
+
export declare const cancelVideoTask: EndpointDefinition<undefined, undefined, z.ZodObject<{
|
|
178
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
|
+
body: z.ZodOptional<z.ZodUnknown>;
|
|
181
|
+
}, z.core.$strip>, "/api/persona/video-task/:taskId">;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// GENERATED from shared/contracts — do not edit.
|
|
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
|
+
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
|
+
export function defineEndpoint(config) {
|
|
31
|
+
return config;
|
|
32
|
+
}
|
|
33
|
+
/** Generation-history paging defaults (also the MCP client's fail-fast bound). */
|
|
34
|
+
export const VIDEO_GENERATIONS_DEFAULT_LIMIT = 50;
|
|
35
|
+
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
|
+
export function parseGenerationsLimit(value) {
|
|
41
|
+
if (value === null || !/^\d+$/.test(value))
|
|
42
|
+
return VIDEO_GENERATIONS_DEFAULT_LIMIT;
|
|
43
|
+
const parsed = Number.parseInt(value, 10);
|
|
44
|
+
if (!Number.isInteger(parsed) || parsed < 1)
|
|
45
|
+
return VIDEO_GENERATIONS_DEFAULT_LIMIT;
|
|
46
|
+
return Math.min(parsed, VIDEO_GENERATIONS_MAX_LIMIT);
|
|
47
|
+
}
|
|
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
|
+
export const VideoGenerationRowSchema = z.object({
|
|
53
|
+
id: z.string(),
|
|
54
|
+
generationId: z.string(),
|
|
55
|
+
engineTaskId: z.string().nullable(),
|
|
56
|
+
personaName: z.string().nullable(),
|
|
57
|
+
videoSubject: z.string().nullable(),
|
|
58
|
+
status: z.string(),
|
|
59
|
+
errorCode: z.string().nullable(),
|
|
60
|
+
tokensRefunded: z.boolean(),
|
|
61
|
+
createdAt: z.string(),
|
|
62
|
+
completedAt: z.string().nullable(),
|
|
63
|
+
});
|
|
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
|
+
export const ListVideoGenerationsQuerySchema = z.object({
|
|
67
|
+
limit: z.string().optional(),
|
|
68
|
+
});
|
|
69
|
+
export const ListVideoGenerationsResponseSchema = z.object({
|
|
70
|
+
success: z.literal(true),
|
|
71
|
+
generations: z.array(VideoGenerationRowSchema),
|
|
72
|
+
});
|
|
73
|
+
export const GetVideoGenerationResponseSchema = z.object({
|
|
74
|
+
success: z.literal(true),
|
|
75
|
+
generation: VideoGenerationRowSchema,
|
|
76
|
+
});
|
|
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
|
+
export const VideoTaskProgressBodySchema = z.object({
|
|
83
|
+
task_id: z.string(),
|
|
84
|
+
state: z.number().optional(),
|
|
85
|
+
progress: z.number().optional(),
|
|
86
|
+
stage: z.string().nullable().optional(),
|
|
87
|
+
error: z.string().nullable().optional(),
|
|
88
|
+
postUrl: z.string().nullable().optional(),
|
|
89
|
+
});
|
|
90
|
+
export const GetVideoStatusResponseSchema = z.object({
|
|
91
|
+
status: z.number(),
|
|
92
|
+
message: z.string().nullable(),
|
|
93
|
+
body: VideoTaskProgressBodySchema,
|
|
94
|
+
});
|
|
95
|
+
export const CancelVideoTaskResponseSchema = z.object({
|
|
96
|
+
status: z.number().optional(),
|
|
97
|
+
message: z.string().nullable().optional(),
|
|
98
|
+
body: z.unknown().optional(),
|
|
99
|
+
});
|
|
100
|
+
export const listVideoGenerations = defineEndpoint({
|
|
101
|
+
method: 'GET',
|
|
102
|
+
path: '/api/persona/video-generations',
|
|
103
|
+
query: ListVideoGenerationsQuerySchema,
|
|
104
|
+
response: ListVideoGenerationsResponseSchema,
|
|
105
|
+
});
|
|
106
|
+
export const getVideoGeneration = defineEndpoint({
|
|
107
|
+
method: 'GET',
|
|
108
|
+
path: '/api/persona/video-generations/:generationId',
|
|
109
|
+
response: GetVideoGenerationResponseSchema,
|
|
110
|
+
});
|
|
111
|
+
export const getVideoStatus = defineEndpoint({
|
|
112
|
+
method: 'GET',
|
|
113
|
+
path: '/api/persona/video-status/:taskId',
|
|
114
|
+
response: GetVideoStatusResponseSchema,
|
|
115
|
+
});
|
|
116
|
+
export const cancelVideoTask = defineEndpoint({
|
|
117
|
+
method: 'DELETE',
|
|
118
|
+
path: '/api/persona/video-task/:taskId',
|
|
119
|
+
response: CancelVideoTaskResponseSchema,
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=video-tasks.js.map
|
|
@@ -0,0 +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,EAA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