post-engineer-mcp 1.52.672 → 1.53.662
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/dist/account-shapes.js +0 -12
- package/dist/account-shapes.js.map +1 -1
- package/dist/action-tool.d.ts +0 -15
- package/dist/action-tool.js +0 -15
- package/dist/action-tool.js.map +1 -1
- package/dist/analytics.js +0 -39
- package/dist/analytics.js.map +1 -1
- package/dist/client-base-url.d.ts +2 -0
- package/dist/client-base-url.js +23 -0
- package/dist/client-base-url.js.map +1 -0
- package/dist/client-batch.js.map +1 -1
- package/dist/client-billing.js +0 -11
- package/dist/client-billing.js.map +1 -1
- package/dist/client-experiments.js +0 -9
- package/dist/client-experiments.js.map +1 -1
- package/dist/client-posts.js +0 -7
- package/dist/client-posts.js.map +1 -1
- package/dist/client-prompts.js +0 -2
- package/dist/client-prompts.js.map +1 -1
- package/dist/client-publish-existing.js +0 -13
- package/dist/client-publish-existing.js.map +1 -1
- package/dist/client-publish-uploaded.d.ts +0 -5
- package/dist/client-publish-uploaded.js +0 -48
- package/dist/client-publish-uploaded.js.map +1 -1
- package/dist/client-publishing-accounts.js +0 -7
- package/dist/client-publishing-accounts.js.map +1 -1
- package/dist/client-telegram.js +0 -7
- package/dist/client-telegram.js.map +1 -1
- package/dist/client-tool-config.js +0 -7
- package/dist/client-tool-config.js.map +1 -1
- package/dist/client-types.d.ts +10 -87
- package/dist/client-user-media.d.ts +0 -28
- package/dist/client-user-media.js +0 -42
- package/dist/client-user-media.js.map +1 -1
- package/dist/client-video-task.js +0 -5
- package/dist/client-video-task.js.map +1 -1
- package/dist/client.js +5 -118
- package/dist/client.js.map +1 -1
- package/dist/cloned-voice-client.d.ts +0 -8
- package/dist/cloned-voice-client.js +0 -49
- package/dist/cloned-voice-client.js.map +1 -1
- package/dist/cloned-voice-tools.d.ts +0 -5
- package/dist/cloned-voice-tools.js +0 -7
- package/dist/cloned-voice-tools.js.map +1 -1
- package/dist/connect-account.js +0 -23
- package/dist/connect-account.js.map +1 -1
- package/dist/contract-response.js +0 -12
- package/dist/contract-response.js.map +1 -1
- package/dist/contracts/accounts.d.ts +0 -11
- package/dist/contracts/accounts.js +0 -60
- package/dist/contracts/accounts.js.map +1 -1
- package/dist/contracts/billing.d.ts +0 -14
- package/dist/contracts/billing.js +0 -26
- package/dist/contracts/billing.js.map +1 -1
- package/dist/contracts/endpoint.d.ts +0 -11
- package/dist/contracts/endpoint.js +0 -4
- package/dist/contracts/endpoint.js.map +1 -1
- package/dist/contracts/experiments.d.ts +0 -20
- package/dist/contracts/experiments.js +0 -34
- package/dist/contracts/experiments.js.map +1 -1
- package/dist/contracts/media.d.ts +0 -19
- package/dist/contracts/media.js +0 -58
- package/dist/contracts/media.js.map +1 -1
- package/dist/contracts/metrics.d.ts +0 -15
- package/dist/contracts/metrics.js +0 -74
- package/dist/contracts/metrics.js.map +1 -1
- package/dist/contracts/personas.d.ts +95 -19
- package/dist/contracts/personas.js +24 -93
- package/dist/contracts/personas.js.map +1 -1
- package/dist/contracts/posts.d.ts +0 -11
- package/dist/contracts/posts.js +0 -17
- package/dist/contracts/posts.js.map +1 -1
- package/dist/contracts/prompts.d.ts +0 -11
- package/dist/contracts/prompts.js +0 -15
- package/dist/contracts/prompts.js.map +1 -1
- package/dist/contracts/providers.d.ts +0 -16
- package/dist/contracts/providers.js +0 -30
- package/dist/contracts/providers.js.map +1 -1
- package/dist/contracts/schedule-warnings.js +0 -3
- package/dist/contracts/schedule-warnings.js.map +1 -1
- package/dist/contracts/schedule.d.ts +0 -14
- package/dist/contracts/schedule.js +0 -46
- package/dist/contracts/schedule.js.map +1 -1
- package/dist/contracts/tool-config.d.ts +0 -11
- package/dist/contracts/tool-config.js +0 -26
- package/dist/contracts/tool-config.js.map +1 -1
- package/dist/contracts/upload-types.d.ts +0 -3
- package/dist/contracts/upload-types.js +0 -10
- package/dist/contracts/upload-types.js.map +1 -1
- package/dist/contracts/video-tasks.d.ts +0 -23
- package/dist/contracts/video-tasks.js +0 -42
- package/dist/contracts/video-tasks.js.map +1 -1
- package/dist/contracts/videos.d.ts +29 -37
- package/dist/contracts/videos.js +3 -137
- package/dist/contracts/videos.js.map +1 -1
- package/dist/contracts/voices.d.ts +0 -24
- package/dist/contracts/voices.js +0 -34
- package/dist/contracts/voices.js.map +1 -1
- package/dist/direct-publish-form.js +0 -15
- package/dist/direct-publish-form.js.map +1 -1
- package/dist/direct-publish-narrowing.js +0 -5
- package/dist/direct-publish-narrowing.js.map +1 -1
- package/dist/errors.d.ts +0 -35
- package/dist/errors.js +0 -48
- package/dist/errors.js.map +1 -1
- package/dist/generate-video.d.ts +45 -4
- package/dist/generate-video.js +0 -6
- package/dist/generate-video.js.map +1 -1
- package/dist/http-auth.d.ts +0 -1
- package/dist/http-auth.js +0 -37
- package/dist/http-auth.js.map +1 -1
- package/dist/http-rate-limit.d.ts +0 -1
- package/dist/http-rate-limit.js +0 -18
- package/dist/http-rate-limit.js.map +1 -1
- package/dist/http-transport.js +0 -95
- package/dist/http-transport.js.map +1 -1
- package/dist/http-web.js +0 -16
- package/dist/http-web.js.map +1 -1
- package/dist/image-guards.d.ts +0 -4
- package/dist/image-guards.js +0 -11
- package/dist/image-guards.js.map +1 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +1 -1
- package/dist/intent-accounts.js +0 -5
- package/dist/intent-accounts.js.map +1 -1
- package/dist/intent-content.js +0 -7
- package/dist/intent-content.js.map +1 -1
- package/dist/intent-library.js +0 -4
- package/dist/intent-library.js.map +1 -1
- package/dist/intent-personas.js +0 -10
- package/dist/intent-personas.js.map +1 -1
- package/dist/intent-tool-config.js +0 -5
- package/dist/intent-tool-config.js.map +1 -1
- package/dist/intent-video.js +0 -5
- package/dist/intent-video.js.map +1 -1
- package/dist/intent-voices.js +0 -6
- package/dist/intent-voices.js.map +1 -1
- package/dist/language.d.ts +0 -8
- package/dist/language.js +0 -11
- package/dist/language.js.map +1 -1
- package/dist/limits.d.ts +1 -79
- package/dist/limits.js +1 -79
- package/dist/limits.js.map +1 -1
- package/dist/music-mood-field.js +0 -25
- package/dist/music-mood-field.js.map +1 -1
- package/dist/persona-avatar.d.ts +0 -13
- package/dist/persona-avatar.js +0 -40
- package/dist/persona-avatar.js.map +1 -1
- package/dist/persona-create.d.ts +96 -0
- package/dist/persona-create.js +39 -0
- package/dist/persona-create.js.map +1 -0
- package/dist/persona-cta-shape.d.ts +16 -0
- package/dist/persona-cta-shape.js +45 -0
- package/dist/persona-cta-shape.js.map +1 -0
- package/dist/persona-delete.js +0 -1
- package/dist/persona-delete.js.map +1 -1
- package/dist/persona-update.d.ts +26 -0
- package/dist/persona-update.js +2 -6
- package/dist/persona-update.js.map +1 -1
- package/dist/progress-poll-hint.d.ts +0 -6
- package/dist/progress-poll-hint.js +0 -15
- package/dist/progress-poll-hint.js.map +1 -1
- package/dist/prompts.js +0 -12
- package/dist/prompts.js.map +1 -1
- package/dist/public-ip.js +25 -58
- package/dist/public-ip.js.map +1 -1
- package/dist/publish-direct-shape.js +0 -4
- package/dist/publish-direct-shape.js.map +1 -1
- package/dist/publish-existing-shape.d.ts +0 -7
- package/dist/publish-existing-shape.js +0 -26
- package/dist/publish-existing-shape.js.map +1 -1
- package/dist/publish-notices.js +0 -2
- package/dist/publish-notices.js.map +1 -1
- package/dist/publish-uploaded-shape.js +0 -7
- package/dist/publish-uploaded-shape.js.map +1 -1
- package/dist/recipe-session.d.ts +0 -4
- package/dist/recipe-session.js +0 -17
- package/dist/recipe-session.js.map +1 -1
- package/dist/refs.d.ts +0 -11
- package/dist/refs.js +0 -15
- package/dist/refs.js.map +1 -1
- package/dist/remote-shapes.d.ts +52 -2
- package/dist/remote-shapes.js +2 -16
- package/dist/remote-shapes.js.map +1 -1
- package/dist/require-api-key.js +0 -2
- package/dist/require-api-key.js.map +1 -1
- package/dist/require-publishing-accounts.js +0 -7
- package/dist/require-publishing-accounts.js.map +1 -1
- package/dist/require-title.js +0 -4
- package/dist/require-title.js.map +1 -1
- package/dist/schedule-shapes.js +0 -19
- package/dist/schedule-shapes.js.map +1 -1
- package/dist/script-segments.d.ts +1 -5
- package/dist/script-segments.js +1 -54
- package/dist/script-segments.js.map +1 -1
- package/dist/secret-redaction.js +0 -4
- package/dist/secret-redaction.js.map +1 -1
- package/dist/segment-media.js +0 -22
- package/dist/segment-media.js.map +1 -1
- package/dist/segment-text.js +0 -18
- package/dist/segment-text.js.map +1 -1
- package/dist/single-video-shape.d.ts +31 -1
- package/dist/single-video-shape.js +6 -18
- package/dist/single-video-shape.js.map +1 -1
- package/dist/slot-detail-present.d.ts +0 -4
- package/dist/slot-detail-present.js +0 -9
- package/dist/slot-detail-present.js.map +1 -1
- package/dist/tool-annotations.js.map +1 -1
- package/dist/tools-batch.d.ts +45 -3
- package/dist/tools-batch.js +0 -17
- package/dist/tools-batch.js.map +1 -1
- package/dist/tools-call.d.ts +0 -1
- package/dist/tools-call.js +0 -1
- package/dist/tools-call.js.map +1 -1
- package/dist/tools-experiments.d.ts +4 -3
- package/dist/tools-experiments.js +1 -31
- package/dist/tools-experiments.js.map +1 -1
- package/dist/tools-list-stats.d.ts +0 -4
- package/dist/tools-list-stats.js +0 -5
- package/dist/tools-list-stats.js.map +1 -1
- package/dist/tools-pinterest.js +0 -10
- package/dist/tools-pinterest.js.map +1 -1
- package/dist/tools-posts.js +0 -9
- package/dist/tools-posts.js.map +1 -1
- package/dist/tools-prompts.js +0 -23
- package/dist/tools-prompts.js.map +1 -1
- package/dist/tools-publish-existing.js +0 -17
- package/dist/tools-publish-existing.js.map +1 -1
- package/dist/tools-publish-uploaded.js +0 -8
- package/dist/tools-publish-uploaded.js.map +1 -1
- package/dist/tools-publishing-accounts.js +0 -10
- package/dist/tools-publishing-accounts.js.map +1 -1
- package/dist/tools-single-video.d.ts +0 -4
- package/dist/tools-single-video.js +1 -55
- package/dist/tools-single-video.js.map +1 -1
- package/dist/tools-tool-config.js +0 -13
- package/dist/tools-tool-config.js.map +1 -1
- package/dist/tools-user-media.js +0 -5
- package/dist/tools-user-media.js.map +1 -1
- package/dist/tools.d.ts +2 -76
- package/dist/tools.js +4 -82
- package/dist/tools.js.map +1 -1
- package/dist/video-task-tools.d.ts +0 -2
- package/dist/video-task-tools.js +0 -43
- package/dist/video-task-tools.js.map +1 -1
- package/dist/video-type.d.ts +0 -10
- package/dist/video-type.js +0 -17
- package/dist/video-type.js.map +1 -1
- package/dist/voice-filters.d.ts +0 -27
- package/dist/voice-filters.js +0 -62
- package/dist/voice-filters.js.map +1 -1
- 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,46 +14,33 @@ 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
|
-
/** Script variables an experiment may test. v1: the hook segment only. */
|
|
47
35
|
export declare const EXPERIMENT_VARIABLES: readonly ["hook"];
|
|
48
36
|
export type ExperimentVariable = (typeof EXPERIMENT_VARIABLES)[number];
|
|
49
|
-
/** Pairs per experiment: below 3 there is no signal at all. */
|
|
50
37
|
export declare const EXPERIMENT_TARGET_PAIRS_MIN = 3;
|
|
51
38
|
export declare const EXPERIMENT_TARGET_PAIRS_MAX = 20;
|
|
52
|
-
/** An experiment compares exactly two variants (positions 0 and 1). */
|
|
53
39
|
export declare const EXPERIMENT_VARIANT_COUNT = 2;
|
|
54
40
|
export declare const EXPERIMENT_NAME_MAX_LENGTH = 120;
|
|
55
41
|
export declare const EXPERIMENT_VARIANT_NAME_MAX_LENGTH = 80;
|
|
56
42
|
export declare const EXPERIMENT_VARIANT_DESCRIPTION_MAX_LENGTH = 500;
|
|
57
|
-
/** Variant slug, e.g. `hook-aggressive`. Never a visible "A"/"B" label. */
|
|
58
43
|
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
44
|
export declare const METRICS_WINDOWS: readonly ["24h", "7d", "28d"];
|
|
62
45
|
export type MetricsWindow = (typeof METRICS_WINDOWS)[number];
|
|
63
46
|
export declare const CreateExperimentSchema: z.ZodObject<{
|
|
@@ -75,16 +58,13 @@ export declare const CreateExperimentSchema: z.ZodObject<{
|
|
|
75
58
|
}, z.core.$strict>;
|
|
76
59
|
export type CreateExperimentInput = z.infer<typeof CreateExperimentSchema>;
|
|
77
60
|
export declare const DEFAULT_RESULTS_WINDOW: MetricsWindow;
|
|
78
|
-
/** `?window=` for the results read: absent -> 7d; anything unknown -> error. */
|
|
79
61
|
export declare function parseResultsWindow(params: URLSearchParams): MetricsWindow | {
|
|
80
62
|
error: string;
|
|
81
63
|
};
|
|
82
64
|
export interface ExperimentDetailQuery {
|
|
83
65
|
window: MetricsWindow;
|
|
84
|
-
/** Live provider counters instead of snapshots (issue #532). */
|
|
85
66
|
live: boolean;
|
|
86
67
|
}
|
|
87
|
-
/** `?window=&live=` for the detail read: `live` is absent or `0`/`1` only. */
|
|
88
68
|
export declare function parseExperimentDetailQuery(params: URLSearchParams): ExperimentDetailQuery | {
|
|
89
69
|
error: string;
|
|
90
70
|
};
|
|
@@ -1,38 +1,17 @@
|
|
|
1
1
|
// GENERATED from shared/contracts — do not edit.
|
|
2
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
3
|
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
4
|
export function defineEndpoint(config) {
|
|
20
5
|
return config;
|
|
21
6
|
}
|
|
22
|
-
/** Script variables an experiment may test. v1: the hook segment only. */
|
|
23
7
|
export const EXPERIMENT_VARIABLES = ['hook'];
|
|
24
|
-
/** Pairs per experiment: below 3 there is no signal at all. */
|
|
25
8
|
export const EXPERIMENT_TARGET_PAIRS_MIN = 3;
|
|
26
9
|
export const EXPERIMENT_TARGET_PAIRS_MAX = 20;
|
|
27
|
-
/** An experiment compares exactly two variants (positions 0 and 1). */
|
|
28
10
|
export const EXPERIMENT_VARIANT_COUNT = 2;
|
|
29
11
|
export const EXPERIMENT_NAME_MAX_LENGTH = 120;
|
|
30
12
|
export const EXPERIMENT_VARIANT_NAME_MAX_LENGTH = 80;
|
|
31
13
|
export const EXPERIMENT_VARIANT_DESCRIPTION_MAX_LENGTH = 500;
|
|
32
|
-
/** Variant slug, e.g. `hook-aggressive`. Never a visible "A"/"B" label. */
|
|
33
14
|
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
15
|
export const METRICS_WINDOWS = ['24h', '7d', '28d'];
|
|
37
16
|
function text(max) {
|
|
38
17
|
return z
|
|
@@ -45,7 +24,6 @@ export const CreateExperimentSchema = z
|
|
|
45
24
|
.object({
|
|
46
25
|
name: text(EXPERIMENT_NAME_MAX_LENGTH),
|
|
47
26
|
variable: z.enum(EXPERIMENT_VARIABLES),
|
|
48
|
-
// null / absent: a faceless experiment with no persona.
|
|
49
27
|
personaId: z.string().uuid().nullable().optional(),
|
|
50
28
|
targetPairs: z.number().int().min(EXPERIMENT_TARGET_PAIRS_MIN).max(EXPERIMENT_TARGET_PAIRS_MAX),
|
|
51
29
|
variants: z
|
|
@@ -63,7 +41,6 @@ export const CreateExperimentSchema = z
|
|
|
63
41
|
})
|
|
64
42
|
.strict();
|
|
65
43
|
export const DEFAULT_RESULTS_WINDOW = '7d';
|
|
66
|
-
/** `?window=` for the results read: absent -> 7d; anything unknown -> error. */
|
|
67
44
|
export function parseResultsWindow(params) {
|
|
68
45
|
const unknown = [...params.keys()].filter((key) => key !== 'window');
|
|
69
46
|
if (unknown.length > 0)
|
|
@@ -74,7 +51,6 @@ export function parseResultsWindow(params) {
|
|
|
74
51
|
const match = METRICS_WINDOWS.find((window) => window === raw);
|
|
75
52
|
return match ?? { error: `window must be one of ${METRICS_WINDOWS.join(', ')}.` };
|
|
76
53
|
}
|
|
77
|
-
/** `?window=&live=` for the detail read: `live` is absent or `0`/`1` only. */
|
|
78
54
|
export function parseExperimentDetailQuery(params) {
|
|
79
55
|
const unknown = [...params.keys()].filter((key) => key !== 'window' && key !== 'live');
|
|
80
56
|
if (unknown.length > 0)
|
|
@@ -92,11 +68,6 @@ export function parseExperimentDetailQuery(params) {
|
|
|
92
68
|
return window;
|
|
93
69
|
return { window, live: rawLive === '1' };
|
|
94
70
|
}
|
|
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
71
|
export const ExperimentVariantViewSchema = z.object({
|
|
101
72
|
variantId: z.string(),
|
|
102
73
|
name: z.string(),
|
|
@@ -127,10 +98,6 @@ export const ListExperimentsResponseSchema = z.object({
|
|
|
127
98
|
experiments: z.array(ExperimentViewSchema),
|
|
128
99
|
truncated: z.boolean(),
|
|
129
100
|
});
|
|
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
101
|
export const ExperimentVideoViewSchema = z.record(z.string(), z.unknown());
|
|
135
102
|
export const ExperimentResultsSchema = z.record(z.string(), z.unknown());
|
|
136
103
|
export const GetExperimentResultsResponseSchema = z.object({
|
|
@@ -140,7 +107,6 @@ export const GetExperimentResultsResponseSchema = z.object({
|
|
|
140
107
|
videos: z.array(z.record(z.string(), z.unknown())),
|
|
141
108
|
results: z.record(z.string(), z.unknown()),
|
|
142
109
|
truncated: z.boolean(),
|
|
143
|
-
// Live-read shape (issue #532): present only with `?live=1`.
|
|
144
110
|
source: z.enum(['live', 'partial', 'snapshot']).optional(),
|
|
145
111
|
liveAt: z.string().nullable().optional(),
|
|
146
112
|
liveFailures: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.js","sourceRoot":"","sources":["../../src/contracts/experiments.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"experiments.js","sourceRoot":"","sources":["../../src/contracts/experiments.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,MAAM,UAAU,cAAc,CAK5B,MAMD;IACC,OAAO,MAAM,CA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AAM,EAAE,MAAM;IACd,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,sBAAsB;IAC5B,QAAQ,EAAE,8BAA8B;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;IAC5C,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,6BAA6B;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC;IACjD,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE,+BAA+B;IACtC,QAAQ,EAAE,kCAAkC;CAC7C,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,42 +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
|
-
/** 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
35
|
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
36
|
export declare const CHECK_MEDIA_CODES: readonly ["ok", "blocked_403", "not_image", "too_small", "too_large", "timeout", "wrong_aspect", "media_expired"];
|
|
53
37
|
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
38
|
export declare const VIDEO_ASPECTS: readonly ["9:16", "16:9", "1:1"];
|
|
58
39
|
export type VideoAspect = (typeof VIDEO_ASPECTS)[number];
|
|
59
40
|
export declare function isHttpUrl(value: string): boolean;
|
package/dist/contracts/media.js
CHANGED
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
// GENERATED from shared/contracts — do not edit.
|
|
2
2
|
// Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
|
|
3
|
-
//---------------
|
|
4
|
-
// media — the segment-media and direct-publish contract, shared by the
|
|
5
|
-
// web routes and the MCP media / direct-publish calls.
|
|
6
|
-
//
|
|
7
|
-
// POST /api/media/upload is multipart (FormData with a `file`): the
|
|
8
|
-
// contract owns only its response. POST /api/media/check takes JSON;
|
|
9
|
-
// its route validation stays hand-rolled (the 400 messages are part of
|
|
10
|
-
// the route's behaviour — see below) and the contract body schema
|
|
11
|
-
// mirrors it, pinned by the MCP tool-schema equivalence test.
|
|
12
|
-
// POST /api/upload-content is multipart FormData dispatched per
|
|
13
|
-
// provider; its response is the direct-publish result shared with
|
|
14
|
-
// POST /api/videos/publish-by-id (which reuses the same response
|
|
15
|
-
// schema from here).
|
|
16
|
-
//---------------
|
|
17
3
|
import { z } from 'zod';
|
|
18
|
-
/** Define one endpoint contract. The literal path is preserved in the type
|
|
19
|
-
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
20
|
-
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
21
|
-
* bare `ZodType`) in the returned definition. */
|
|
22
4
|
export function defineEndpoint(config) {
|
|
23
5
|
return config;
|
|
24
6
|
}
|
|
25
|
-
/** The engine-minted temp-asset filename: 32 hex chars + an image
|
|
26
|
-
* extension. Mirrors apps/web/app/api/media/upload/route.ts
|
|
27
|
-
* (MEDIA_ID_PATTERN): the full URL is never returned, only this id. */
|
|
28
7
|
export const MEDIA_ID_PATTERN = /^[0-9a-f]{32}\.(jpg|jpeg|png|webp)$/;
|
|
29
|
-
/** Mechanical check outcomes from the engine. Mirrors
|
|
30
|
-
* apps/web/app/api/media/check/route.ts (CHECK_CODES). */
|
|
31
8
|
export const CHECK_MEDIA_CODES = [
|
|
32
9
|
'ok',
|
|
33
10
|
'blocked_403',
|
|
@@ -38,9 +15,6 @@ export const CHECK_MEDIA_CODES = [
|
|
|
38
15
|
'wrong_aspect',
|
|
39
16
|
'media_expired',
|
|
40
17
|
];
|
|
41
|
-
/** Video aspects a photo can be checked against. Mirrors
|
|
42
|
-
* apps/web/app/api/media/check/route.ts (VIDEO_ASPECTS) and the engine
|
|
43
|
-
* VideoAspect enum. */
|
|
44
18
|
export const VIDEO_ASPECTS = ['9:16', '16:9', '1:1'];
|
|
45
19
|
export function isHttpUrl(value) {
|
|
46
20
|
try {
|
|
@@ -51,13 +25,6 @@ export function isHttpUrl(value) {
|
|
|
51
25
|
return false;
|
|
52
26
|
}
|
|
53
27
|
}
|
|
54
|
-
//---------------
|
|
55
|
-
// POST /api/media/check body — mirrors the route's hand-rolled
|
|
56
|
-
// validation exactly: url is required (empty counts as missing), must
|
|
57
|
-
// be an http(s) URL, and videoAspect is one of the three aspects when
|
|
58
|
-
// given. The route ignores unknown fields, so the schema is a plain
|
|
59
|
-
// object, not strict.
|
|
60
|
-
//---------------
|
|
61
28
|
export const MediaCheckBodySchema = z.object({
|
|
62
29
|
url: z
|
|
63
30
|
.string()
|
|
@@ -65,20 +32,11 @@ export const MediaCheckBodySchema = z.object({
|
|
|
65
32
|
.refine((value) => isHttpUrl(value), { message: 'url must be an http(s) URL.' }),
|
|
66
33
|
videoAspect: z.enum(VIDEO_ASPECTS).optional(),
|
|
67
34
|
});
|
|
68
|
-
//---------------
|
|
69
|
-
// Response views.
|
|
70
|
-
//---------------
|
|
71
35
|
export const MediaCheckResponseSchema = z.object({
|
|
72
36
|
success: z.literal(true),
|
|
73
37
|
code: z.enum(CHECK_MEDIA_CODES),
|
|
74
38
|
width: z.number().optional(),
|
|
75
39
|
height: z.number().optional(),
|
|
76
|
-
// The engine's face verdict (issue #589, hook photo): true when a face
|
|
77
|
-
// is detectable, false when not, null when there is no file to check or
|
|
78
|
-
// the detector is unavailable. Deliberately `unknown`: a non-boolean
|
|
79
|
-
// value is dropped by the projection (older engines omit the key
|
|
80
|
-
// entirely), never a malformed-response error — the route does the same
|
|
81
|
-
// drop on its side.
|
|
82
40
|
has_face: z.unknown().optional(),
|
|
83
41
|
});
|
|
84
42
|
export const UploadMediaResponseSchema = z.object({
|
|
@@ -86,28 +44,16 @@ export const UploadMediaResponseSchema = z.object({
|
|
|
86
44
|
mediaId: z.string().regex(MEDIA_ID_PATTERN),
|
|
87
45
|
expiresInSeconds: z.number(),
|
|
88
46
|
});
|
|
89
|
-
// One per-account outcome of a direct publish — mirrors
|
|
90
|
-
// apps/web/lib/upload/content-upload-result.ts
|
|
91
|
-
// (ContentUploadAccountResult). The MCP drops uploadDuration/mediaId;
|
|
92
|
-
// the schema lists the fields the agent acts on (errorCode especially:
|
|
93
|
-
// publish_unknown means the post may already be live — do not retry).
|
|
94
47
|
export const DirectPublishAccountResultSchema = z.object({
|
|
95
48
|
accountId: z.string(),
|
|
96
49
|
success: z.boolean(),
|
|
97
50
|
videoId: z.string().optional(),
|
|
98
51
|
videoUrl: z.string().optional(),
|
|
99
52
|
postId: z.string().optional(),
|
|
100
|
-
// Ready-made post URL (Pinterest pin URL, Instagram/Threads/Facebook permalink).
|
|
101
53
|
permalink: z.string().optional(),
|
|
102
54
|
error: z.string().optional(),
|
|
103
|
-
// Stable per-account failure code from classifyUploadAccountError.
|
|
104
55
|
errorCode: z.string().optional(),
|
|
105
56
|
});
|
|
106
|
-
// The 200 body of POST /api/upload-content (and of
|
|
107
|
-
// POST /api/videos/publish-by-id, which dispatches to the same provider
|
|
108
|
-
// handlers). success is a plain boolean: a multi-account publish can
|
|
109
|
-
// succeed on some accounts and fail on others. provider/logId/error
|
|
110
|
-
// flow through from the handler responses when the handler sets them.
|
|
111
57
|
export const UploadContentResponseSchema = z.object({
|
|
112
58
|
success: z.boolean(),
|
|
113
59
|
provider: z.string().optional(),
|
|
@@ -116,10 +62,6 @@ export const UploadContentResponseSchema = z.object({
|
|
|
116
62
|
logId: z.string().optional(),
|
|
117
63
|
error: z.string().optional(),
|
|
118
64
|
});
|
|
119
|
-
//---------------
|
|
120
|
-
// Endpoints. upload and upload-content are multipart FormData, so they
|
|
121
|
-
// declare no JSON body schema.
|
|
122
|
-
//---------------
|
|
123
65
|
export const uploadMedia = defineEndpoint({
|
|
124
66
|
method: 'POST',
|
|
125
67
|
path: '/api/media/upload',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/contracts/media.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/contracts/media.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,0EAA0E;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,MAAM,UAAU,cAAc,CAK5B,MAMD;IACC,OAAO,MAAM,CAAC;AAChB,CAAC;AA0BD,MAAM,CAAC,MAAM,gBAAgB,GAAG,qCAAqC,CAAC;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI;IACJ,aAAa;IACb,WAAW;IACX,WAAW;IACX,WAAW;IACX,SAAS;IACT,cAAc;IACd,eAAe;CACP,CAAC;AAGX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAG9D,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC,QAAQ,KAAK,OAAO,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MAAM;IACd,IAAI,EAAE,qBAAqB;IAC3B,QAAQ,EAAE,2BAA2B;CACtC,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,26 +14,19 @@ 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}`> : {
|
|
@@ -48,8 +37,6 @@ import { METRICS_WINDOWS, type MetricsWindow } from './experiments.js';
|
|
|
48
37
|
export { METRICS_WINDOWS };
|
|
49
38
|
export declare const METRICS_NONE = "^@none";
|
|
50
39
|
export declare const METRICS_FILTER_MAX_LENGTH = 200;
|
|
51
|
-
/** YouTube video id (11 chars, base64url). Mirrors
|
|
52
|
-
* apps/web/lib/youtube-analytics.ts (VIDEO_ID). */
|
|
53
40
|
export declare const YOUTUBE_VIDEO_ID: RegExp;
|
|
54
41
|
export declare const ANALYTICS_STATUSES: readonly ["ok", "scope_missing", "not_owned", "no_data"];
|
|
55
42
|
export type AnalyticsStatus = (typeof ANALYTICS_STATUSES)[number];
|
|
@@ -75,8 +62,6 @@ type MetricsParseResult = {
|
|
|
75
62
|
};
|
|
76
63
|
export declare function parseMetricsQuery(params: URLSearchParams): MetricsParseResult;
|
|
77
64
|
export declare function metricsSearchParams(query: MetricsQuery): URLSearchParams;
|
|
78
|
-
/** `?account=&video=` for the retention-curve read: each exactly once,
|
|
79
|
-
* a non-empty account within the filter length, a YouTube video id. */
|
|
80
65
|
export declare function parseRetentionCurveQuery(params: URLSearchParams): {
|
|
81
66
|
account: string;
|
|
82
67
|
video: string;
|
|
@@ -1,53 +1,19 @@
|
|
|
1
1
|
// GENERATED from shared/contracts — do not edit.
|
|
2
2
|
// Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
|
|
3
|
-
//---------------
|
|
4
|
-
// metrics — the GET /api/metrics + GET /api/metrics/retention-curve
|
|
5
|
-
// contract, shared by the web routes and the MCP insights tools.
|
|
6
|
-
//
|
|
7
|
-
// The query parsing (parseMetricsQuery / parseRetentionCurveQuery) lives
|
|
8
|
-
// here, not in the routes: the MCP tools validate their arguments locally
|
|
9
|
-
// against the same rules, so a one-sided edit would make the MCP reject
|
|
10
|
-
// what the route accepts (or forward what it rejects). The route keeps
|
|
11
|
-
// the same 400 messages — the parsers moved verbatim out of
|
|
12
|
-
// apps/web/lib/metrics/metrics-query.ts and
|
|
13
|
-
// apps/web/app/api/metrics/retention-curve/route.ts.
|
|
14
|
-
//---------------
|
|
15
3
|
import { z } from 'zod';
|
|
16
|
-
/** Define one endpoint contract. The literal path is preserved in the type
|
|
17
|
-
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
18
|
-
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
19
|
-
* bare `ZodType`) in the returned definition. */
|
|
20
4
|
export function defineEndpoint(config) {
|
|
21
5
|
return config;
|
|
22
6
|
}
|
|
23
7
|
import { SOCIAL_PROVIDERS, isSocialProvider } from './providers.js';
|
|
24
8
|
import { METRICS_WINDOWS } from './experiments.js';
|
|
25
|
-
// The window values live in the experiments contract (its results read
|
|
26
|
-
// takes the same ?window=); re-exported so the metrics query contract
|
|
27
|
-
// is the one place the MCP and the web read them from.
|
|
28
9
|
export { METRICS_WINDOWS };
|
|
29
|
-
// Null-filter sentinel. Not a plain word: script angles are unvalidated
|
|
30
|
-
// engine-generated text, so a literal like 'none' could be a real angle
|
|
31
|
-
// and would become unfilterable (selecting it would filter for null rows
|
|
32
|
-
// instead). Persona ids are uuids, so the sentinel is safe for them too.
|
|
33
10
|
export const METRICS_NONE = '^@none';
|
|
34
11
|
export const METRICS_FILTER_MAX_LENGTH = 200;
|
|
35
|
-
/** YouTube video id (11 chars, base64url). Mirrors
|
|
36
|
-
* apps/web/lib/youtube-analytics.ts (VIDEO_ID). */
|
|
37
12
|
export const YOUTUBE_VIDEO_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
38
|
-
// post_metrics.analytics_status (migration 039 check, pinned by a sync test).
|
|
39
13
|
export const ANALYTICS_STATUSES = ['ok', 'scope_missing', 'not_owned', 'no_data'];
|
|
40
14
|
export function isAnalyticsStatus(value) {
|
|
41
15
|
return typeof value === 'string' && ANALYTICS_STATUSES.includes(value);
|
|
42
16
|
}
|
|
43
|
-
// Coverage reasons (issue #525): why a published video has no snapshot
|
|
44
|
-
// for the selected window. pending = the window has not opened yet;
|
|
45
|
-
// retrying = the window is open and the collector keeps trying; missed =
|
|
46
|
-
// the window closed while collection kept failing; no-target = the window
|
|
47
|
-
// closed and the collector finished the post without ever seeing this
|
|
48
|
-
// video (it was published late, after the post was marked done);
|
|
49
|
-
// publish-failed = the publish outcome is 'failed', so there is no video
|
|
50
|
-
// id to measure.
|
|
51
17
|
export const COVERAGE_REASONS = ['pending', 'retrying', 'missed', 'no-target', 'publish-failed'];
|
|
52
18
|
export function isCoverageReason(value) {
|
|
53
19
|
return typeof value === 'string' && COVERAGE_REASONS.includes(value);
|
|
@@ -55,9 +21,6 @@ export function isCoverageReason(value) {
|
|
|
55
21
|
export function isMetricsWindow(value) {
|
|
56
22
|
return typeof value === 'string' && METRICS_WINDOWS.includes(value);
|
|
57
23
|
}
|
|
58
|
-
// Exported for the metrics route, which validates stored API-key
|
|
59
|
-
// persona ids with the same pattern before interpolating them into a
|
|
60
|
-
// PostgREST filter string.
|
|
61
24
|
export const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
62
25
|
const KNOWN_PARAMS = new Set(['window', 'persona', 'account', 'provider', 'angle']);
|
|
63
26
|
function readOptional(params, key) {
|
|
@@ -73,10 +36,6 @@ function readOptional(params, key) {
|
|
|
73
36
|
return { error: `${key} is too long.` };
|
|
74
37
|
return value;
|
|
75
38
|
}
|
|
76
|
-
//---------------
|
|
77
|
-
// parseMetricsQuery — strict: unknown, duplicate, empty, over-length or
|
|
78
|
-
// malformed params are rejected (400), never ignored or coerced.
|
|
79
|
-
//---------------
|
|
80
39
|
export function parseMetricsQuery(params) {
|
|
81
40
|
for (const key of params.keys()) {
|
|
82
41
|
if (!KNOWN_PARAMS.has(key))
|
|
@@ -110,9 +69,6 @@ export function parseMetricsQuery(params) {
|
|
|
110
69
|
},
|
|
111
70
|
};
|
|
112
71
|
}
|
|
113
|
-
//---------------
|
|
114
|
-
// metricsSearchParams — the inverse, for the client fetch.
|
|
115
|
-
//---------------
|
|
116
72
|
export function metricsSearchParams(query) {
|
|
117
73
|
const params = new URLSearchParams({ window: query.window });
|
|
118
74
|
if (query.personaId !== null)
|
|
@@ -125,8 +81,6 @@ export function metricsSearchParams(query) {
|
|
|
125
81
|
params.set('angle', query.angle);
|
|
126
82
|
return params;
|
|
127
83
|
}
|
|
128
|
-
/** `?account=&video=` for the retention-curve read: each exactly once,
|
|
129
|
-
* a non-empty account within the filter length, a YouTube video id. */
|
|
130
84
|
export function parseRetentionCurveQuery(params) {
|
|
131
85
|
for (const key of params.keys()) {
|
|
132
86
|
if (key !== 'account' && key !== 'video')
|
|
@@ -142,11 +96,6 @@ export function parseRetentionCurveQuery(params) {
|
|
|
142
96
|
return { error: 'Invalid video.' };
|
|
143
97
|
return { account: account[0], video: video[0] };
|
|
144
98
|
}
|
|
145
|
-
//---------------
|
|
146
|
-
// Query params as the routes receive them (raw strings; the parsers
|
|
147
|
-
// above are the validators). The endpoints declare them so the MCP
|
|
148
|
-
// client and the route share one shape.
|
|
149
|
-
//---------------
|
|
150
99
|
export const MetricsQueryParamsSchema = z.strictObject({
|
|
151
100
|
window: z.string().optional(),
|
|
152
101
|
persona: z.string().optional(),
|
|
@@ -158,12 +107,6 @@ export const RetentionCurveQuerySchema = z.strictObject({
|
|
|
158
107
|
account: z.string(),
|
|
159
108
|
video: z.string(),
|
|
160
109
|
});
|
|
161
|
-
//---------------
|
|
162
|
-
// Response views, mirroring apps/web/lib/metrics/metrics-query.ts
|
|
163
|
-
// (MetricsRowView / CoverageItem) and apps/web/lib/youtube-analytics.ts
|
|
164
|
-
// (RetentionPoint). The MCP reads these rows; app field names are the
|
|
165
|
-
// contract one rename away from breaking both typechecks.
|
|
166
|
-
//---------------
|
|
167
110
|
export const MetricsRowSchema = z.object({
|
|
168
111
|
postId: z.string(),
|
|
169
112
|
personaId: z.string().nullable(),
|
|
@@ -171,22 +114,11 @@ export const MetricsRowSchema = z.object({
|
|
|
171
114
|
accountId: z.string(),
|
|
172
115
|
externalId: z.string(),
|
|
173
116
|
scriptAngle: z.string().nullable(),
|
|
174
|
-
// When the slot was published, from scheduled_posts.published_at (the
|
|
175
|
-
// publish date every date chart buckets by, #647). Required, not
|
|
176
|
-
// nullable: post_metrics rows are only ever created for published slots
|
|
177
|
-
// with a non-null published_at — find_post_metrics_due (migrations 025
|
|
178
|
-
// and 039) requires status 'published' plus published_at window
|
|
179
|
-
// comparisons that NULL never satisfies, the re-open scan requires a
|
|
180
|
-
// string published_at, and the engine sets published_at once on publish
|
|
181
|
-
// and never clears it. A missing parent at read time (a concurrent
|
|
182
|
-
// delete race) is a read failure (500), never a null row.
|
|
183
117
|
publishedAt: z.string(),
|
|
184
118
|
views: z.number().nullable(),
|
|
185
119
|
likes: z.number().nullable(),
|
|
186
120
|
comments: z.number().nullable(),
|
|
187
121
|
saves: z.number().nullable(),
|
|
188
|
-
// YouTube Analytics (own videos only); null on other providers or when
|
|
189
|
-
// not collected. analyticsStatus 'scope_missing' = reconnect YouTube.
|
|
190
122
|
analyticsViews: z.number().nullable(),
|
|
191
123
|
engagedViews: z.number().nullable(),
|
|
192
124
|
stayedToWatchPct: z.number().nullable(),
|
|
@@ -202,7 +134,6 @@ export const CoverageItemSchema = z.object({
|
|
|
202
134
|
personaId: z.string().nullable(),
|
|
203
135
|
provider: z.enum(SOCIAL_PROVIDERS),
|
|
204
136
|
accountId: z.string(),
|
|
205
|
-
// Null for publish-failed items: a failed publish records no video id.
|
|
206
137
|
externalId: z.string().nullable(),
|
|
207
138
|
scriptAngle: z.string().nullable(),
|
|
208
139
|
reason: z.enum(COVERAGE_REASONS),
|
|
@@ -216,11 +147,9 @@ export const MetricsResponseSchema = z.object({
|
|
|
216
147
|
truncated: z.boolean(),
|
|
217
148
|
coverage: z.array(CoverageItemSchema),
|
|
218
149
|
coverageTruncated: z.boolean(),
|
|
219
|
-
// The newest snapshot in the response: the page dates its data by it.
|
|
220
150
|
asOf: z.string().nullable(),
|
|
221
151
|
});
|
|
222
152
|
export const RetentionPointSchema = z.object({
|
|
223
|
-
// elapsedVideoTimeRatio: exclusive end of the interval, 0.01..1.0.
|
|
224
153
|
ratio: z.number(),
|
|
225
154
|
audienceWatchRatio: z.number(),
|
|
226
155
|
relativeRetentionPerformance: z.number().nullable(),
|
|
@@ -232,9 +161,6 @@ export const RetentionCurveResponseSchema = z.object({
|
|
|
232
161
|
endDate: z.string(),
|
|
233
162
|
provisional: z.boolean(),
|
|
234
163
|
});
|
|
235
|
-
//---------------
|
|
236
|
-
// Endpoints.
|
|
237
|
-
//---------------
|
|
238
164
|
export const listMetrics = defineEndpoint({
|
|
239
165
|
method: 'GET',
|
|
240
166
|
path: '/api/metrics',
|