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.
Files changed (114) hide show
  1. package/README.md +1 -1
  2. package/dist/client-batch.d.ts +3 -1
  3. package/dist/client-batch.js +4 -1
  4. package/dist/client-batch.js.map +1 -1
  5. package/dist/client-billing.d.ts +5 -0
  6. package/dist/client-billing.js +34 -0
  7. package/dist/client-billing.js.map +1 -0
  8. package/dist/client-experiments.d.ts +5 -14
  9. package/dist/client-experiments.js +17 -3
  10. package/dist/client-experiments.js.map +1 -1
  11. package/dist/client-posts.d.ts +12 -6
  12. package/dist/client-posts.js +22 -11
  13. package/dist/client-posts.js.map +1 -1
  14. package/dist/client-prompts.d.ts +4 -8
  15. package/dist/client-prompts.js +7 -24
  16. package/dist/client-prompts.js.map +1 -1
  17. package/dist/client-publish-uploaded.d.ts +8 -1
  18. package/dist/client-publish-uploaded.js +121 -49
  19. package/dist/client-publish-uploaded.js.map +1 -1
  20. package/dist/client-publishing-accounts.d.ts +4 -2
  21. package/dist/client-publishing-accounts.js +6 -2
  22. package/dist/client-publishing-accounts.js.map +1 -1
  23. package/dist/client-types.d.ts +5 -4
  24. package/dist/client-user-media.d.ts +4 -3
  25. package/dist/client-user-media.js +17 -47
  26. package/dist/client-user-media.js.map +1 -1
  27. package/dist/client-video-task.d.ts +3 -1
  28. package/dist/client-video-task.js +4 -1
  29. package/dist/client-video-task.js.map +1 -1
  30. package/dist/client.d.ts +40 -39
  31. package/dist/client.js +80 -148
  32. package/dist/client.js.map +1 -1
  33. package/dist/cloned-voice-client.d.ts +7 -5
  34. package/dist/cloned-voice-client.js +10 -4
  35. package/dist/cloned-voice-client.js.map +1 -1
  36. package/dist/connect-account.js +14 -6
  37. package/dist/connect-account.js.map +1 -1
  38. package/dist/contract-response.d.ts +8 -0
  39. package/dist/contract-response.js +24 -0
  40. package/dist/contract-response.js.map +1 -0
  41. package/dist/contracts/accounts.d.ts +844 -0
  42. package/dist/contracts/accounts.js +346 -0
  43. package/dist/contracts/accounts.js.map +1 -0
  44. package/dist/contracts/billing.d.ts +109 -0
  45. package/dist/contracts/billing.js +88 -0
  46. package/dist/contracts/billing.js.map +1 -0
  47. package/dist/contracts/endpoint.d.ts +45 -0
  48. package/dist/contracts/endpoint.js +8 -0
  49. package/dist/contracts/endpoint.js.map +1 -0
  50. package/dist/contracts/experiments.d.ts +271 -0
  51. package/dist/contracts/experiments.js +170 -0
  52. package/dist/contracts/experiments.js.map +1 -0
  53. package/dist/contracts/media.d.ts +165 -0
  54. package/dist/contracts/media.js +139 -0
  55. package/dist/contracts/media.js.map +1 -0
  56. package/dist/contracts/metrics.d.ts +351 -0
  57. package/dist/contracts/metrics.js +256 -0
  58. package/dist/contracts/metrics.js.map +1 -0
  59. package/dist/contracts/personas.d.ts +560 -0
  60. package/dist/contracts/personas.js +346 -0
  61. package/dist/contracts/personas.js.map +1 -0
  62. package/dist/contracts/posts.d.ts +485 -0
  63. package/dist/contracts/posts.js +153 -0
  64. package/dist/contracts/posts.js.map +1 -0
  65. package/dist/contracts/prompts.d.ts +90 -0
  66. package/dist/contracts/prompts.js +48 -0
  67. package/dist/contracts/prompts.js.map +1 -0
  68. package/dist/contracts/schedule.d.ts +691 -0
  69. package/dist/contracts/schedule.js +264 -0
  70. package/dist/contracts/schedule.js.map +1 -0
  71. package/dist/contracts/video-tasks.d.ts +181 -0
  72. package/dist/contracts/video-tasks.js +121 -0
  73. package/dist/contracts/video-tasks.js.map +1 -0
  74. package/dist/contracts/videos.d.ts +693 -0
  75. package/dist/contracts/videos.js +443 -0
  76. package/dist/contracts/videos.js.map +1 -0
  77. package/dist/contracts/voices.d.ts +237 -0
  78. package/dist/contracts/voices.js +118 -0
  79. package/dist/contracts/voices.js.map +1 -0
  80. package/dist/generate-video.d.ts +34 -34
  81. package/dist/generate-video.js +14 -2
  82. package/dist/generate-video.js.map +1 -1
  83. package/dist/intent-content.js +1 -1
  84. package/dist/intent-personas.js +17 -7
  85. package/dist/intent-personas.js.map +1 -1
  86. package/dist/limits.d.ts +27 -44
  87. package/dist/limits.js +27 -45
  88. package/dist/limits.js.map +1 -1
  89. package/dist/persona-delete.js +9 -9
  90. package/dist/persona-delete.js.map +1 -1
  91. package/dist/persona-update.js +3 -2
  92. package/dist/persona-update.js.map +1 -1
  93. package/dist/script-segments.d.ts +1 -1
  94. package/dist/script-segments.js +1 -1
  95. package/dist/single-video-shape.d.ts +5 -5
  96. package/dist/single-video-shape.js +1 -1
  97. package/dist/tools-batch.d.ts +42 -42
  98. package/dist/tools-batch.js +12 -36
  99. package/dist/tools-batch.js.map +1 -1
  100. package/dist/tools-experiments.d.ts +11 -11
  101. package/dist/tools-experiments.js +17 -9
  102. package/dist/tools-experiments.js.map +1 -1
  103. package/dist/tools-pinterest.js +5 -15
  104. package/dist/tools-pinterest.js.map +1 -1
  105. package/dist/tools-single-video.js +14 -51
  106. package/dist/tools-single-video.js.map +1 -1
  107. package/dist/tools-user-media.js +3 -1
  108. package/dist/tools-user-media.js.map +1 -1
  109. package/dist/tools.d.ts +0 -25
  110. package/dist/tools.js +56 -96
  111. package/dist/tools.js.map +1 -1
  112. package/dist/voice-filters.js +2 -1
  113. package/dist/voice-filters.js.map +1 -1
  114. package/package.json +1 -1
@@ -0,0 +1,271 @@
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
+ /** Script variables an experiment may test. v1: the hook segment only. */
47
+ export declare const EXPERIMENT_VARIABLES: readonly ["hook"];
48
+ export type ExperimentVariable = (typeof EXPERIMENT_VARIABLES)[number];
49
+ /** Pairs per experiment: below 3 there is no signal at all. */
50
+ export declare const EXPERIMENT_TARGET_PAIRS_MIN = 3;
51
+ export declare const EXPERIMENT_TARGET_PAIRS_MAX = 20;
52
+ /** An experiment compares exactly two variants (positions 0 and 1). */
53
+ export declare const EXPERIMENT_VARIANT_COUNT = 2;
54
+ export declare const EXPERIMENT_NAME_MAX_LENGTH = 120;
55
+ export declare const EXPERIMENT_VARIANT_NAME_MAX_LENGTH = 80;
56
+ export declare const EXPERIMENT_VARIANT_DESCRIPTION_MAX_LENGTH = 500;
57
+ /** Variant slug, e.g. `hook-aggressive`. Never a visible "A"/"B" label. */
58
+ export declare const EXPERIMENT_VARIANT_ID_PATTERN: RegExp;
59
+ /** Results windows for GET /api/experiments/:id (`?window=`). Mirrors
60
+ * apps/web/lib/metrics/metrics-query.ts (METRICS_WINDOWS). */
61
+ export declare const METRICS_WINDOWS: readonly ["24h", "7d", "28d"];
62
+ export type MetricsWindow = (typeof METRICS_WINDOWS)[number];
63
+ export declare const CreateExperimentSchema: z.ZodObject<{
64
+ name: z.ZodString;
65
+ variable: z.ZodEnum<{
66
+ hook: "hook";
67
+ }>;
68
+ personaId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ targetPairs: z.ZodNumber;
70
+ variants: z.ZodArray<z.ZodObject<{
71
+ variantId: z.ZodString;
72
+ name: z.ZodString;
73
+ description: z.ZodString;
74
+ }, z.core.$strict>>;
75
+ }, z.core.$strict>;
76
+ export type CreateExperimentInput = z.infer<typeof CreateExperimentSchema>;
77
+ export declare const DEFAULT_RESULTS_WINDOW: MetricsWindow;
78
+ /** `?window=` for the results read: absent -> 7d; anything unknown -> error. */
79
+ export declare function parseResultsWindow(params: URLSearchParams): MetricsWindow | {
80
+ error: string;
81
+ };
82
+ export interface ExperimentDetailQuery {
83
+ window: MetricsWindow;
84
+ /** Live provider counters instead of snapshots (issue #532). */
85
+ live: boolean;
86
+ }
87
+ /** `?window=&live=` for the detail read: `live` is absent or `0`/`1` only. */
88
+ export declare function parseExperimentDetailQuery(params: URLSearchParams): ExperimentDetailQuery | {
89
+ error: string;
90
+ };
91
+ export declare const ExperimentVariantViewSchema: z.ZodObject<{
92
+ variantId: z.ZodString;
93
+ name: z.ZodString;
94
+ description: z.ZodString;
95
+ }, z.core.$strip>;
96
+ export declare const ExperimentViewSchema: z.ZodObject<{
97
+ id: z.ZodString;
98
+ name: z.ZodString;
99
+ variable: z.ZodString;
100
+ personaId: z.ZodNullable<z.ZodString>;
101
+ targetPairs: z.ZodNumber;
102
+ createdAt: z.ZodString;
103
+ variants: z.ZodArray<z.ZodObject<{
104
+ variantId: z.ZodString;
105
+ name: z.ZodString;
106
+ description: z.ZodString;
107
+ }, z.core.$strip>>;
108
+ }, z.core.$strip>;
109
+ export declare const CreateExperimentResponseSchema: z.ZodObject<{
110
+ success: z.ZodBoolean;
111
+ experiment: z.ZodObject<{
112
+ id: z.ZodString;
113
+ name: z.ZodString;
114
+ variable: z.ZodString;
115
+ personaId: z.ZodNullable<z.ZodString>;
116
+ targetPairs: z.ZodNumber;
117
+ variants: z.ZodArray<z.ZodObject<{
118
+ variantId: z.ZodString;
119
+ name: z.ZodString;
120
+ description: z.ZodString;
121
+ }, z.core.$strip>>;
122
+ }, z.core.$strip>;
123
+ }, z.core.$strip>;
124
+ export declare const ListExperimentsResponseSchema: z.ZodObject<{
125
+ success: z.ZodBoolean;
126
+ experiments: z.ZodArray<z.ZodObject<{
127
+ id: z.ZodString;
128
+ name: z.ZodString;
129
+ variable: z.ZodString;
130
+ personaId: z.ZodNullable<z.ZodString>;
131
+ targetPairs: z.ZodNumber;
132
+ createdAt: z.ZodString;
133
+ variants: z.ZodArray<z.ZodObject<{
134
+ variantId: z.ZodString;
135
+ name: z.ZodString;
136
+ description: z.ZodString;
137
+ }, z.core.$strip>>;
138
+ }, z.core.$strip>>;
139
+ truncated: z.ZodBoolean;
140
+ }, z.core.$strip>;
141
+ export declare const ExperimentVideoViewSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
142
+ export declare const ExperimentResultsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
143
+ export declare const GetExperimentResultsResponseSchema: z.ZodObject<{
144
+ success: z.ZodBoolean;
145
+ experiment: z.ZodObject<{
146
+ id: z.ZodString;
147
+ name: z.ZodString;
148
+ variable: z.ZodString;
149
+ personaId: z.ZodNullable<z.ZodString>;
150
+ targetPairs: z.ZodNumber;
151
+ createdAt: z.ZodString;
152
+ variants: z.ZodArray<z.ZodObject<{
153
+ variantId: z.ZodString;
154
+ name: z.ZodString;
155
+ description: z.ZodString;
156
+ }, z.core.$strip>>;
157
+ }, z.core.$strip>;
158
+ window: z.ZodEnum<{
159
+ "24h": "24h";
160
+ "7d": "7d";
161
+ "28d": "28d";
162
+ }>;
163
+ videos: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
164
+ results: z.ZodRecord<z.ZodString, z.ZodUnknown>;
165
+ truncated: z.ZodBoolean;
166
+ source: z.ZodOptional<z.ZodEnum<{
167
+ live: "live";
168
+ partial: "partial";
169
+ snapshot: "snapshot";
170
+ }>>;
171
+ liveAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ liveFailures: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
173
+ frozen: z.ZodOptional<z.ZodBoolean>;
174
+ }, z.core.$strip>;
175
+ export declare const GetExperimentResultsQuerySchema: z.ZodObject<{
176
+ window: z.ZodOptional<z.ZodEnum<{
177
+ "24h": "24h";
178
+ "7d": "7d";
179
+ "28d": "28d";
180
+ }>>;
181
+ live: z.ZodOptional<z.ZodEnum<{
182
+ 0: "0";
183
+ 1: "1";
184
+ }>>;
185
+ }, z.core.$strict>;
186
+ export declare const createExperiment: EndpointDefinition<z.ZodObject<{
187
+ name: z.ZodString;
188
+ variable: z.ZodEnum<{
189
+ hook: "hook";
190
+ }>;
191
+ personaId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
192
+ targetPairs: z.ZodNumber;
193
+ variants: z.ZodArray<z.ZodObject<{
194
+ variantId: z.ZodString;
195
+ name: z.ZodString;
196
+ description: z.ZodString;
197
+ }, z.core.$strict>>;
198
+ }, z.core.$strict>, undefined, z.ZodObject<{
199
+ success: z.ZodBoolean;
200
+ experiment: z.ZodObject<{
201
+ id: z.ZodString;
202
+ name: z.ZodString;
203
+ variable: z.ZodString;
204
+ personaId: z.ZodNullable<z.ZodString>;
205
+ targetPairs: z.ZodNumber;
206
+ variants: z.ZodArray<z.ZodObject<{
207
+ variantId: z.ZodString;
208
+ name: z.ZodString;
209
+ description: z.ZodString;
210
+ }, z.core.$strip>>;
211
+ }, z.core.$strip>;
212
+ }, z.core.$strip>, "/api/experiments">;
213
+ export declare const listExperiments: EndpointDefinition<undefined, undefined, z.ZodObject<{
214
+ success: z.ZodBoolean;
215
+ experiments: z.ZodArray<z.ZodObject<{
216
+ id: z.ZodString;
217
+ name: z.ZodString;
218
+ variable: z.ZodString;
219
+ personaId: z.ZodNullable<z.ZodString>;
220
+ targetPairs: z.ZodNumber;
221
+ createdAt: z.ZodString;
222
+ variants: z.ZodArray<z.ZodObject<{
223
+ variantId: z.ZodString;
224
+ name: z.ZodString;
225
+ description: z.ZodString;
226
+ }, z.core.$strip>>;
227
+ }, z.core.$strip>>;
228
+ truncated: z.ZodBoolean;
229
+ }, z.core.$strip>, "/api/experiments">;
230
+ export declare const getExperimentResults: EndpointDefinition<undefined, z.ZodObject<{
231
+ window: z.ZodOptional<z.ZodEnum<{
232
+ "24h": "24h";
233
+ "7d": "7d";
234
+ "28d": "28d";
235
+ }>>;
236
+ live: z.ZodOptional<z.ZodEnum<{
237
+ 0: "0";
238
+ 1: "1";
239
+ }>>;
240
+ }, z.core.$strict>, z.ZodObject<{
241
+ success: z.ZodBoolean;
242
+ experiment: z.ZodObject<{
243
+ id: z.ZodString;
244
+ name: z.ZodString;
245
+ variable: z.ZodString;
246
+ personaId: z.ZodNullable<z.ZodString>;
247
+ targetPairs: z.ZodNumber;
248
+ createdAt: z.ZodString;
249
+ variants: z.ZodArray<z.ZodObject<{
250
+ variantId: z.ZodString;
251
+ name: z.ZodString;
252
+ description: z.ZodString;
253
+ }, z.core.$strip>>;
254
+ }, z.core.$strip>;
255
+ window: z.ZodEnum<{
256
+ "24h": "24h";
257
+ "7d": "7d";
258
+ "28d": "28d";
259
+ }>;
260
+ videos: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
261
+ results: z.ZodRecord<z.ZodString, z.ZodUnknown>;
262
+ truncated: z.ZodBoolean;
263
+ source: z.ZodOptional<z.ZodEnum<{
264
+ live: "live";
265
+ partial: "partial";
266
+ snapshot: "snapshot";
267
+ }>>;
268
+ liveAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ liveFailures: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
270
+ frozen: z.ZodOptional<z.ZodBoolean>;
271
+ }, z.core.$strip>, "/api/experiments/:id">;
@@ -0,0 +1,170 @@
1
+ // GENERATED from shared/contracts — do not edit.
2
+ // Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
3
+ // Paired content A/B experiments contract (issue #476): the single source
4
+ // of truth for POST /api/experiments, GET /api/experiments and
5
+ // GET /api/experiments/:id. Both apps generate a copy of this file (see
6
+ // scripts/sync-contracts.mjs); never edit a generated copy by hand.
7
+ //
8
+ // Request bodies are strict (an unknown key, an over-length value or a
9
+ // blank string is a 400, never trimmed or dropped). Response schemas are
10
+ // plain objects (extra fields ignored) so live-read fields added by the
11
+ // route do not fail parsing. Limits mirror the CHECK constraints of
12
+ // supabase/migrations/041_experiments.sql and are pinned to the snapshot
13
+ // by apps/web/lib/__tests__/experiments-migration.test.ts.
14
+ import { z } from 'zod';
15
+ /** Define one endpoint contract. The literal path is preserved in the type
16
+ * so ParamsOf can read its `:param` segments. `Body`/`Query` default to
17
+ * `undefined` so an omitted optional schema stays `undefined` (not the
18
+ * bare `ZodType`) in the returned definition. */
19
+ export function defineEndpoint(config) {
20
+ return config;
21
+ }
22
+ /** Script variables an experiment may test. v1: the hook segment only. */
23
+ export const EXPERIMENT_VARIABLES = ['hook'];
24
+ /** Pairs per experiment: below 3 there is no signal at all. */
25
+ export const EXPERIMENT_TARGET_PAIRS_MIN = 3;
26
+ export const EXPERIMENT_TARGET_PAIRS_MAX = 20;
27
+ /** An experiment compares exactly two variants (positions 0 and 1). */
28
+ export const EXPERIMENT_VARIANT_COUNT = 2;
29
+ export const EXPERIMENT_NAME_MAX_LENGTH = 120;
30
+ export const EXPERIMENT_VARIANT_NAME_MAX_LENGTH = 80;
31
+ export const EXPERIMENT_VARIANT_DESCRIPTION_MAX_LENGTH = 500;
32
+ /** Variant slug, e.g. `hook-aggressive`. Never a visible "A"/"B" label. */
33
+ export const EXPERIMENT_VARIANT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,47}$/;
34
+ /** Results windows for GET /api/experiments/:id (`?window=`). Mirrors
35
+ * apps/web/lib/metrics/metrics-query.ts (METRICS_WINDOWS). */
36
+ export const METRICS_WINDOWS = ['24h', '7d', '28d'];
37
+ function text(max) {
38
+ return z
39
+ .string()
40
+ .min(1)
41
+ .max(max)
42
+ .refine((value) => value.trim().length > 0, { message: 'must not be blank' });
43
+ }
44
+ export const CreateExperimentSchema = z
45
+ .object({
46
+ name: text(EXPERIMENT_NAME_MAX_LENGTH),
47
+ variable: z.enum(EXPERIMENT_VARIABLES),
48
+ // null / absent: a faceless experiment with no persona.
49
+ personaId: z.string().uuid().nullable().optional(),
50
+ targetPairs: z.number().int().min(EXPERIMENT_TARGET_PAIRS_MIN).max(EXPERIMENT_TARGET_PAIRS_MAX),
51
+ variants: z
52
+ .array(z
53
+ .object({
54
+ variantId: z.string().regex(EXPERIMENT_VARIANT_ID_PATTERN, 'variantId must be a lowercase slug, e.g. hook-aggressive'),
55
+ name: text(EXPERIMENT_VARIANT_NAME_MAX_LENGTH),
56
+ description: text(EXPERIMENT_VARIANT_DESCRIPTION_MAX_LENGTH),
57
+ })
58
+ .strict())
59
+ .length(EXPERIMENT_VARIANT_COUNT)
60
+ .refine((variants) => new Set(variants.map((variant) => variant.variantId)).size === variants.length, {
61
+ message: 'variantId values must differ',
62
+ }),
63
+ })
64
+ .strict();
65
+ export const DEFAULT_RESULTS_WINDOW = '7d';
66
+ /** `?window=` for the results read: absent -> 7d; anything unknown -> error. */
67
+ export function parseResultsWindow(params) {
68
+ const unknown = [...params.keys()].filter((key) => key !== 'window');
69
+ if (unknown.length > 0)
70
+ return { error: 'Unknown query parameter.' };
71
+ const raw = params.get('window');
72
+ if (raw === null)
73
+ return DEFAULT_RESULTS_WINDOW;
74
+ const match = METRICS_WINDOWS.find((window) => window === raw);
75
+ return match ?? { error: `window must be one of ${METRICS_WINDOWS.join(', ')}.` };
76
+ }
77
+ /** `?window=&live=` for the detail read: `live` is absent or `0`/`1` only. */
78
+ export function parseExperimentDetailQuery(params) {
79
+ const unknown = [...params.keys()].filter((key) => key !== 'window' && key !== 'live');
80
+ if (unknown.length > 0)
81
+ return { error: 'Unknown query parameter.' };
82
+ const rawLive = params.get('live');
83
+ if (rawLive !== null && rawLive !== '0' && rawLive !== '1') {
84
+ return { error: 'live must be 0 or 1.' };
85
+ }
86
+ const windowParams = new URLSearchParams();
87
+ const rawWindow = params.get('window');
88
+ if (rawWindow !== null)
89
+ windowParams.set('window', rawWindow);
90
+ const window = parseResultsWindow(windowParams);
91
+ if (typeof window !== 'string')
92
+ return window;
93
+ return { window, live: rawLive === '1' };
94
+ }
95
+ //---------------
96
+ // Response views, mirroring apps/web/lib/experiments/read.ts and
97
+ // results.ts (the MCP reads experiment/videos/results; app field names
98
+ // are the contract one rename away from breaking both typechecks).
99
+ //---------------
100
+ export const ExperimentVariantViewSchema = z.object({
101
+ variantId: z.string(),
102
+ name: z.string(),
103
+ description: z.string(),
104
+ });
105
+ export const ExperimentViewSchema = z.object({
106
+ id: z.string(),
107
+ name: z.string(),
108
+ variable: z.string(),
109
+ personaId: z.string().nullable(),
110
+ targetPairs: z.number(),
111
+ createdAt: z.string(),
112
+ variants: z.array(ExperimentVariantViewSchema),
113
+ });
114
+ export const CreateExperimentResponseSchema = z.object({
115
+ success: z.boolean(),
116
+ experiment: z.object({
117
+ id: z.string(),
118
+ name: z.string(),
119
+ variable: z.string(),
120
+ personaId: z.string().nullable(),
121
+ targetPairs: z.number(),
122
+ variants: z.array(ExperimentVariantViewSchema),
123
+ }),
124
+ });
125
+ export const ListExperimentsResponseSchema = z.object({
126
+ success: z.boolean(),
127
+ experiments: z.array(ExperimentViewSchema),
128
+ truncated: z.boolean(),
129
+ });
130
+ // The detail videos/results payloads (lib/experiments/read.ts and
131
+ // results.ts) are large and the MCP only forwards them as JSON, so the
132
+ // contract keeps them as loose records and types the experiment view
133
+ // the MCP reads (name/variants) strictly.
134
+ export const ExperimentVideoViewSchema = z.record(z.string(), z.unknown());
135
+ export const ExperimentResultsSchema = z.record(z.string(), z.unknown());
136
+ export const GetExperimentResultsResponseSchema = z.object({
137
+ success: z.boolean(),
138
+ experiment: ExperimentViewSchema,
139
+ window: z.enum(METRICS_WINDOWS),
140
+ videos: z.array(z.record(z.string(), z.unknown())),
141
+ results: z.record(z.string(), z.unknown()),
142
+ truncated: z.boolean(),
143
+ // Live-read shape (issue #532): present only with `?live=1`.
144
+ source: z.enum(['live', 'partial', 'snapshot']).optional(),
145
+ liveAt: z.string().nullable().optional(),
146
+ liveFailures: z.array(z.record(z.string(), z.unknown())).optional(),
147
+ frozen: z.boolean().optional(),
148
+ });
149
+ export const GetExperimentResultsQuerySchema = z.strictObject({
150
+ window: z.enum(METRICS_WINDOWS).optional(),
151
+ live: z.enum(['0', '1']).optional(),
152
+ });
153
+ export const createExperiment = defineEndpoint({
154
+ method: 'POST',
155
+ path: '/api/experiments',
156
+ body: CreateExperimentSchema,
157
+ response: CreateExperimentResponseSchema,
158
+ });
159
+ export const listExperiments = defineEndpoint({
160
+ method: 'GET',
161
+ path: '/api/experiments',
162
+ response: ListExperimentsResponseSchema,
163
+ });
164
+ export const getExperimentResults = defineEndpoint({
165
+ method: 'GET',
166
+ path: '/api/experiments/:id',
167
+ query: GetExperimentResultsQuerySchema,
168
+ response: GetExperimentResultsResponseSchema,
169
+ });
170
+ //# sourceMappingURL=experiments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experiments.js","sourceRoot":"","sources":["../../src/contracts/experiments.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,0EAA0E;AAC1E,+DAA+D;AAC/D,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,oEAAoE;AACpE,yEAAyE;AACzE,2DAA2D;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB;;;iDAGiD;AACjD,MAAM,UAAU,cAAc,CAK5B,MAMD;IACC,OAAO,MAAM,CAAC;AAChB,CAAC;AAiCD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAM,CAAU,CAAC;AAGtD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAE9C,uEAAuE;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC;AACrD,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAAG,CAAC;AAE7D,2EAA2E;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAEzE;8DAC8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAG7D,SAAS,IAAI,CAAC,GAAW;IACvB,OAAO,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC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CH' | '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
+ /** The engine-minted temp-asset filename: 32 hex chars + an image
47
+ * extension. Mirrors apps/web/app/api/media/upload/route.ts
48
+ * (MEDIA_ID_PATTERN): the full URL is never returned, only this id. */
49
+ export declare const MEDIA_ID_PATTERN: RegExp;
50
+ /** Mechanical check outcomes from the engine. Mirrors
51
+ * apps/web/app/api/media/check/route.ts (CHECK_CODES). */
52
+ export declare const CHECK_MEDIA_CODES: readonly ["ok", "blocked_403", "not_image", "too_small", "too_large", "timeout", "wrong_aspect", "media_expired"];
53
+ export type CheckMediaCode = (typeof CHECK_MEDIA_CODES)[number];
54
+ /** Video aspects a photo can be checked against. Mirrors
55
+ * apps/web/app/api/media/check/route.ts (VIDEO_ASPECTS) and the engine
56
+ * VideoAspect enum. */
57
+ export declare const VIDEO_ASPECTS: readonly ["9:16", "16:9", "1:1"];
58
+ export type VideoAspect = (typeof VIDEO_ASPECTS)[number];
59
+ export declare function isHttpUrl(value: string): boolean;
60
+ export declare const MediaCheckBodySchema: z.ZodObject<{
61
+ url: z.ZodString;
62
+ videoAspect: z.ZodOptional<z.ZodEnum<{
63
+ "9:16": "9:16";
64
+ "16:9": "16:9";
65
+ "1:1": "1:1";
66
+ }>>;
67
+ }, z.core.$strip>;
68
+ export type MediaCheckBody = z.infer<typeof MediaCheckBodySchema>;
69
+ export declare const MediaCheckResponseSchema: z.ZodObject<{
70
+ success: z.ZodLiteral<true>;
71
+ code: z.ZodEnum<{
72
+ ok: "ok";
73
+ blocked_403: "blocked_403";
74
+ not_image: "not_image";
75
+ too_small: "too_small";
76
+ too_large: "too_large";
77
+ timeout: "timeout";
78
+ wrong_aspect: "wrong_aspect";
79
+ media_expired: "media_expired";
80
+ }>;
81
+ width: z.ZodOptional<z.ZodNumber>;
82
+ height: z.ZodOptional<z.ZodNumber>;
83
+ has_face: z.ZodOptional<z.ZodUnknown>;
84
+ }, z.core.$strip>;
85
+ export type MediaCheckResponse = z.infer<typeof MediaCheckResponseSchema>;
86
+ export declare const UploadMediaResponseSchema: z.ZodObject<{
87
+ success: z.ZodLiteral<true>;
88
+ mediaId: z.ZodString;
89
+ expiresInSeconds: z.ZodNumber;
90
+ }, z.core.$strip>;
91
+ export type UploadMediaResponse = z.infer<typeof UploadMediaResponseSchema>;
92
+ export declare const DirectPublishAccountResultSchema: z.ZodObject<{
93
+ accountId: z.ZodString;
94
+ success: z.ZodBoolean;
95
+ videoId: z.ZodOptional<z.ZodString>;
96
+ videoUrl: z.ZodOptional<z.ZodString>;
97
+ postId: z.ZodOptional<z.ZodString>;
98
+ permalink: z.ZodOptional<z.ZodString>;
99
+ error: z.ZodOptional<z.ZodString>;
100
+ errorCode: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strip>;
102
+ export type DirectPublishAccountResult = z.infer<typeof DirectPublishAccountResultSchema>;
103
+ export declare const UploadContentResponseSchema: z.ZodObject<{
104
+ success: z.ZodBoolean;
105
+ provider: z.ZodOptional<z.ZodString>;
106
+ results: z.ZodArray<z.ZodObject<{
107
+ accountId: z.ZodString;
108
+ success: z.ZodBoolean;
109
+ videoId: z.ZodOptional<z.ZodString>;
110
+ videoUrl: z.ZodOptional<z.ZodString>;
111
+ postId: z.ZodOptional<z.ZodString>;
112
+ permalink: z.ZodOptional<z.ZodString>;
113
+ error: z.ZodOptional<z.ZodString>;
114
+ errorCode: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>>;
116
+ successCount: z.ZodOptional<z.ZodNumber>;
117
+ logId: z.ZodOptional<z.ZodString>;
118
+ error: z.ZodOptional<z.ZodString>;
119
+ }, z.core.$strip>;
120
+ export type UploadContentResponse = z.infer<typeof UploadContentResponseSchema>;
121
+ export declare const uploadMedia: EndpointDefinition<undefined, undefined, z.ZodObject<{
122
+ success: z.ZodLiteral<true>;
123
+ mediaId: z.ZodString;
124
+ expiresInSeconds: z.ZodNumber;
125
+ }, z.core.$strip>, "/api/media/upload">;
126
+ export declare const checkMedia: EndpointDefinition<z.ZodObject<{
127
+ url: z.ZodString;
128
+ videoAspect: z.ZodOptional<z.ZodEnum<{
129
+ "9:16": "9:16";
130
+ "16:9": "16:9";
131
+ "1:1": "1:1";
132
+ }>>;
133
+ }, z.core.$strip>, undefined, z.ZodObject<{
134
+ success: z.ZodLiteral<true>;
135
+ code: z.ZodEnum<{
136
+ ok: "ok";
137
+ blocked_403: "blocked_403";
138
+ not_image: "not_image";
139
+ too_small: "too_small";
140
+ too_large: "too_large";
141
+ timeout: "timeout";
142
+ wrong_aspect: "wrong_aspect";
143
+ media_expired: "media_expired";
144
+ }>;
145
+ width: z.ZodOptional<z.ZodNumber>;
146
+ height: z.ZodOptional<z.ZodNumber>;
147
+ has_face: z.ZodOptional<z.ZodUnknown>;
148
+ }, z.core.$strip>, "/api/media/check">;
149
+ export declare const uploadContent: EndpointDefinition<undefined, undefined, z.ZodObject<{
150
+ success: z.ZodBoolean;
151
+ provider: z.ZodOptional<z.ZodString>;
152
+ results: z.ZodArray<z.ZodObject<{
153
+ accountId: z.ZodString;
154
+ success: z.ZodBoolean;
155
+ videoId: z.ZodOptional<z.ZodString>;
156
+ videoUrl: z.ZodOptional<z.ZodString>;
157
+ postId: z.ZodOptional<z.ZodString>;
158
+ permalink: z.ZodOptional<z.ZodString>;
159
+ error: z.ZodOptional<z.ZodString>;
160
+ errorCode: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>>;
162
+ successCount: z.ZodOptional<z.ZodNumber>;
163
+ logId: z.ZodOptional<z.ZodString>;
164
+ error: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>, "/api/upload-content">;