vidspotai-shared 1.0.55 → 1.0.57

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 (222) hide show
  1. package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
  2. package/lib/services/aiGen/providers/google/google.service.js +35 -0
  3. package/lib/utils/errors.d.ts +24 -2
  4. package/lib/utils/errors.d.ts.map +1 -1
  5. package/lib/utils/errors.js +23 -3
  6. package/package.json +1 -1
  7. package/lib/globals/aiModels/providers/alibaba.d.ts +0 -4
  8. package/lib/globals/aiModels/providers/alibaba.d.ts.map +0 -1
  9. package/lib/globals/aiModels/providers/alibaba.js +0 -183
  10. package/lib/globals/aiModels/providers/elevenlabs.d.ts +0 -13
  11. package/lib/globals/aiModels/providers/elevenlabs.d.ts.map +0 -1
  12. package/lib/globals/aiModels/providers/elevenlabs.js +0 -25
  13. package/lib/globals/aiModels/providers/pixverseTemplates.d.ts +0 -36
  14. package/lib/globals/aiModels/providers/pixverseTemplates.d.ts.map +0 -1
  15. package/lib/globals/aiModels/providers/pixverseTemplates.js +0 -42
  16. package/lib/globals/aiModels/tierHelpers.d.ts +0 -27
  17. package/lib/globals/aiModels/tierHelpers.d.ts.map +0 -1
  18. package/lib/globals/aiModels/tierHelpers.js +0 -73
  19. package/lib/globals/ttsModels/providers/minimax.d.ts +0 -8
  20. package/lib/globals/ttsModels/providers/minimax.d.ts.map +0 -1
  21. package/lib/globals/ttsModels/providers/minimax.js +0 -18
  22. package/lib/globals/ttsModels/providers/openai.d.ts +0 -8
  23. package/lib/globals/ttsModels/providers/openai.d.ts.map +0 -1
  24. package/lib/globals/ttsModels/providers/openai.js +0 -18
  25. package/lib/models/agent.model.d.ts +0 -117
  26. package/lib/models/agent.model.d.ts.map +0 -1
  27. package/lib/models/agent.model.js +0 -13
  28. package/lib/models/cachedAsset.model.d.ts +0 -18
  29. package/lib/models/cachedAsset.model.d.ts.map +0 -1
  30. package/lib/models/cachedAsset.model.js +0 -2
  31. package/lib/models/cachedRawAsset.model.d.ts +0 -20
  32. package/lib/models/cachedRawAsset.model.d.ts.map +0 -1
  33. package/lib/models/cachedRawAsset.model.js +0 -2
  34. package/lib/schemas/agentPersona.schema.d.ts +0 -10
  35. package/lib/schemas/agentPersona.schema.d.ts.map +0 -1
  36. package/lib/schemas/agentPersona.schema.js +0 -11
  37. package/lib/schemas/brandKit.schema.d.ts +0 -101
  38. package/lib/schemas/brandKit.schema.d.ts.map +0 -1
  39. package/lib/schemas/brandKit.schema.js +0 -46
  40. package/lib/schemas/brief.schema.d.ts +0 -216
  41. package/lib/schemas/brief.schema.d.ts.map +0 -1
  42. package/lib/schemas/brief.schema.js +0 -118
  43. package/lib/schemas/index.d.ts +0 -6
  44. package/lib/schemas/index.d.ts.map +0 -1
  45. package/lib/schemas/index.js +0 -21
  46. package/lib/schemas/project.schema.d.ts +0 -1005
  47. package/lib/schemas/project.schema.d.ts.map +0 -1
  48. package/lib/schemas/project.schema.js +0 -238
  49. package/lib/schemas/videoPlan.schema.d.ts +0 -145
  50. package/lib/schemas/videoPlan.schema.d.ts.map +0 -1
  51. package/lib/schemas/videoPlan.schema.js +0 -109
  52. package/lib/services/agent/beatSnap.d.ts +0 -10
  53. package/lib/services/agent/beatSnap.d.ts.map +0 -1
  54. package/lib/services/agent/beatSnap.js +0 -128
  55. package/lib/services/agent/costPreflight.d.ts +0 -22
  56. package/lib/services/agent/costPreflight.d.ts.map +0 -1
  57. package/lib/services/agent/costPreflight.js +0 -75
  58. package/lib/services/agent/critic.d.ts +0 -103
  59. package/lib/services/agent/critic.d.ts.map +0 -1
  60. package/lib/services/agent/critic.js +0 -132
  61. package/lib/services/agent/eval/index.d.ts +0 -5
  62. package/lib/services/agent/eval/index.d.ts.map +0 -1
  63. package/lib/services/agent/eval/index.js +0 -20
  64. package/lib/services/agent/eval/judge.d.ts +0 -14
  65. package/lib/services/agent/eval/judge.d.ts.map +0 -1
  66. package/lib/services/agent/eval/judge.js +0 -95
  67. package/lib/services/agent/eval/recorder.d.ts +0 -17
  68. package/lib/services/agent/eval/recorder.d.ts.map +0 -1
  69. package/lib/services/agent/eval/recorder.js +0 -65
  70. package/lib/services/agent/eval/seedBriefs.d.ts +0 -16
  71. package/lib/services/agent/eval/seedBriefs.d.ts.map +0 -1
  72. package/lib/services/agent/eval/seedBriefs.js +0 -1188
  73. package/lib/services/agent/eval/types.d.ts +0 -196
  74. package/lib/services/agent/eval/types.d.ts.map +0 -1
  75. package/lib/services/agent/eval/types.js +0 -65
  76. package/lib/services/agent/executor.d.ts +0 -50
  77. package/lib/services/agent/executor.d.ts.map +0 -1
  78. package/lib/services/agent/executor.js +0 -188
  79. package/lib/services/agent/index.d.ts +0 -15
  80. package/lib/services/agent/index.d.ts.map +0 -1
  81. package/lib/services/agent/index.js +0 -30
  82. package/lib/services/agent/llmCaller.d.ts +0 -77
  83. package/lib/services/agent/llmCaller.d.ts.map +0 -1
  84. package/lib/services/agent/llmCaller.js +0 -16
  85. package/lib/services/agent/llmCallerGateway.d.ts +0 -39
  86. package/lib/services/agent/llmCallerGateway.d.ts.map +0 -1
  87. package/lib/services/agent/llmCallerGateway.js +0 -246
  88. package/lib/services/agent/llmCallerRegistry.d.ts +0 -4
  89. package/lib/services/agent/llmCallerRegistry.d.ts.map +0 -1
  90. package/lib/services/agent/llmCallerRegistry.js +0 -19
  91. package/lib/services/agent/modelRouter.d.ts +0 -41
  92. package/lib/services/agent/modelRouter.d.ts.map +0 -1
  93. package/lib/services/agent/modelRouter.js +0 -57
  94. package/lib/services/agent/musicSelect.d.ts +0 -23
  95. package/lib/services/agent/musicSelect.d.ts.map +0 -1
  96. package/lib/services/agent/musicSelect.js +0 -65
  97. package/lib/services/agent/personas.d.ts +0 -60
  98. package/lib/services/agent/personas.d.ts.map +0 -1
  99. package/lib/services/agent/personas.js +0 -156
  100. package/lib/services/agent/planner.d.ts +0 -56
  101. package/lib/services/agent/planner.d.ts.map +0 -1
  102. package/lib/services/agent/planner.js +0 -237
  103. package/lib/services/agent/toolRegistry.d.ts +0 -64
  104. package/lib/services/agent/toolRegistry.d.ts.map +0 -1
  105. package/lib/services/agent/toolRegistry.js +0 -78
  106. package/lib/services/agent/tools/analyzeReference.tool.d.ts +0 -36
  107. package/lib/services/agent/tools/analyzeReference.tool.d.ts.map +0 -1
  108. package/lib/services/agent/tools/analyzeReference.tool.js +0 -44
  109. package/lib/services/agent/tools/animateImage.tool.d.ts +0 -23
  110. package/lib/services/agent/tools/animateImage.tool.d.ts.map +0 -1
  111. package/lib/services/agent/tools/animateImage.tool.js +0 -58
  112. package/lib/services/agent/tools/animateImageWithMotionBrush.tool.d.ts +0 -30
  113. package/lib/services/agent/tools/animateImageWithMotionBrush.tool.d.ts.map +0 -1
  114. package/lib/services/agent/tools/animateImageWithMotionBrush.tool.js +0 -90
  115. package/lib/services/agent/tools/composeScene.tool.d.ts +0 -948
  116. package/lib/services/agent/tools/composeScene.tool.d.ts.map +0 -1
  117. package/lib/services/agent/tools/composeScene.tool.js +0 -90
  118. package/lib/services/agent/tools/estimateCost.tool.d.ts +0 -342
  119. package/lib/services/agent/tools/estimateCost.tool.d.ts.map +0 -1
  120. package/lib/services/agent/tools/estimateCost.tool.js +0 -62
  121. package/lib/services/agent/tools/generateAvatarVideo.tool.d.ts +0 -32
  122. package/lib/services/agent/tools/generateAvatarVideo.tool.d.ts.map +0 -1
  123. package/lib/services/agent/tools/generateAvatarVideo.tool.js +0 -112
  124. package/lib/services/agent/tools/generateImage.tool.d.ts +0 -28
  125. package/lib/services/agent/tools/generateImage.tool.d.ts.map +0 -1
  126. package/lib/services/agent/tools/generateImage.tool.js +0 -97
  127. package/lib/services/agent/tools/generateVideo.tool.d.ts +0 -30
  128. package/lib/services/agent/tools/generateVideo.tool.d.ts.map +0 -1
  129. package/lib/services/agent/tools/generateVideo.tool.js +0 -84
  130. package/lib/services/agent/tools/generateVoiceover.tool.d.ts +0 -18
  131. package/lib/services/agent/tools/generateVoiceover.tool.d.ts.map +0 -1
  132. package/lib/services/agent/tools/generateVoiceover.tool.js +0 -72
  133. package/lib/services/agent/tools/index.d.ts +0 -19
  134. package/lib/services/agent/tools/index.d.ts.map +0 -1
  135. package/lib/services/agent/tools/index.js +0 -34
  136. package/lib/services/agent/tools/planVideo.tool.d.ts +0 -191
  137. package/lib/services/agent/tools/planVideo.tool.d.ts.map +0 -1
  138. package/lib/services/agent/tools/planVideo.tool.js +0 -46
  139. package/lib/services/agent/tools/render.tool.d.ts +0 -357
  140. package/lib/services/agent/tools/render.tool.d.ts.map +0 -1
  141. package/lib/services/agent/tools/render.tool.js +0 -48
  142. package/lib/services/agent/tools/searchMusic.tool.d.ts +0 -49
  143. package/lib/services/agent/tools/searchMusic.tool.d.ts.map +0 -1
  144. package/lib/services/agent/tools/searchMusic.tool.js +0 -74
  145. package/lib/services/agent/tools/searchStock.tool.d.ts +0 -37
  146. package/lib/services/agent/tools/searchStock.tool.d.ts.map +0 -1
  147. package/lib/services/agent/tools/searchStock.tool.js +0 -101
  148. package/lib/services/agent/tools/searchUserLibrary.tool.d.ts +0 -59
  149. package/lib/services/agent/tools/searchUserLibrary.tool.d.ts.map +0 -1
  150. package/lib/services/agent/tools/searchUserLibrary.tool.js +0 -58
  151. package/lib/services/aiGen/canonicalAdapters/cameraControl.types.d.ts +0 -31
  152. package/lib/services/aiGen/canonicalAdapters/cameraControl.types.d.ts.map +0 -1
  153. package/lib/services/aiGen/canonicalAdapters/cameraControl.types.js +0 -2
  154. package/lib/services/aiGen/canonicalAdapters/index.d.ts +0 -3
  155. package/lib/services/aiGen/canonicalAdapters/index.d.ts.map +0 -1
  156. package/lib/services/aiGen/canonicalAdapters/index.js +0 -18
  157. package/lib/services/aiGen/canonicalAdapters/multiShot.types.d.ts +0 -23
  158. package/lib/services/aiGen/canonicalAdapters/multiShot.types.d.ts.map +0 -1
  159. package/lib/services/aiGen/canonicalAdapters/multiShot.types.js +0 -12
  160. package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.d.ts +0 -18
  161. package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.d.ts.map +0 -1
  162. package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.js +0 -100
  163. package/lib/services/aiGen/providers/fal/falImage.service.d.ts +0 -9
  164. package/lib/services/aiGen/providers/fal/falImage.service.d.ts.map +0 -1
  165. package/lib/services/aiGen/providers/fal/falImage.service.js +0 -102
  166. package/lib/services/aiGen/providers/fal/index.d.ts +0 -2
  167. package/lib/services/aiGen/providers/fal/index.d.ts.map +0 -1
  168. package/lib/services/aiGen/providers/fal/index.js +0 -17
  169. package/lib/services/aiGen/providers/kling/cameraAdapter.d.ts +0 -4
  170. package/lib/services/aiGen/providers/kling/cameraAdapter.d.ts.map +0 -1
  171. package/lib/services/aiGen/providers/kling/cameraAdapter.js +0 -53
  172. package/lib/services/aiGen/providers/pexels/index.d.ts +0 -2
  173. package/lib/services/aiGen/providers/pexels/index.d.ts.map +0 -1
  174. package/lib/services/aiGen/providers/pexels/index.js +0 -17
  175. package/lib/services/aiGen/providers/pexels/pexels.service.d.ts +0 -11
  176. package/lib/services/aiGen/providers/pexels/pexels.service.d.ts.map +0 -1
  177. package/lib/services/aiGen/providers/pexels/pexels.service.js +0 -118
  178. package/lib/services/aiGen/providers/runway/cameraAdapter.d.ts +0 -3
  179. package/lib/services/aiGen/providers/runway/cameraAdapter.d.ts.map +0 -1
  180. package/lib/services/aiGen/providers/runway/cameraAdapter.js +0 -46
  181. package/lib/services/asr/assemblyai.service.d.ts +0 -72
  182. package/lib/services/asr/assemblyai.service.d.ts.map +0 -1
  183. package/lib/services/asr/assemblyai.service.js +0 -89
  184. package/lib/services/asr/index.d.ts +0 -2
  185. package/lib/services/asr/index.d.ts.map +0 -1
  186. package/lib/services/asr/index.js +0 -17
  187. package/lib/services/assetCache.service.d.ts +0 -54
  188. package/lib/services/assetCache.service.d.ts.map +0 -1
  189. package/lib/services/assetCache.service.js +0 -96
  190. package/lib/services/audioAnalysis/index.d.ts +0 -2
  191. package/lib/services/audioAnalysis/index.d.ts.map +0 -1
  192. package/lib/services/audioAnalysis/index.js +0 -17
  193. package/lib/services/audioAnalysis/onsetDetection.service.d.ts +0 -50
  194. package/lib/services/audioAnalysis/onsetDetection.service.d.ts.map +0 -1
  195. package/lib/services/audioAnalysis/onsetDetection.service.js +0 -136
  196. package/lib/services/editor/designToProject.d.ts +0 -60
  197. package/lib/services/editor/designToProject.d.ts.map +0 -1
  198. package/lib/services/editor/designToProject.js +0 -194
  199. package/lib/services/musicGen/index.d.ts +0 -6
  200. package/lib/services/musicGen/index.d.ts.map +0 -1
  201. package/lib/services/musicGen/index.js +0 -26
  202. package/lib/services/musicGen/musicSearchFactory.service.d.ts +0 -14
  203. package/lib/services/musicGen/musicSearchFactory.service.d.ts.map +0 -1
  204. package/lib/services/musicGen/musicSearchFactory.service.js +0 -59
  205. package/lib/services/musicGen/providers/curated.service.d.ts +0 -22
  206. package/lib/services/musicGen/providers/curated.service.d.ts.map +0 -1
  207. package/lib/services/musicGen/providers/curated.service.js +0 -171
  208. package/lib/services/musicGen/providers/jamendo.service.d.ts +0 -8
  209. package/lib/services/musicGen/providers/jamendo.service.d.ts.map +0 -1
  210. package/lib/services/musicGen/providers/jamendo.service.js +0 -93
  211. package/lib/services/musicGen/providers/mubert.service.d.ts +0 -9
  212. package/lib/services/musicGen/providers/mubert.service.d.ts.map +0 -1
  213. package/lib/services/musicGen/providers/mubert.service.js +0 -113
  214. package/lib/services/musicGen/types.d.ts +0 -42
  215. package/lib/services/musicGen/types.d.ts.map +0 -1
  216. package/lib/services/musicGen/types.js +0 -10
  217. package/lib/services/tts/providers/minimax.service.d.ts +0 -14
  218. package/lib/services/tts/providers/minimax.service.d.ts.map +0 -1
  219. package/lib/services/tts/providers/minimax.service.js +0 -78
  220. package/lib/services/tts/providers/openai.service.d.ts +0 -14
  221. package/lib/services/tts/providers/openai.service.d.ts.map +0 -1
  222. package/lib/services/tts/providers/openai.service.js +0 -71
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.estimateProjectCost = estimateProjectCost;
4
- exports.estimatePlanCost = estimatePlanCost;
5
- /**
6
- * Cost preflight — sums credits over a Project JSON's clips by their
7
- * provenance.creditsSpent. For clips not yet generated, falls back to a
8
- * conservative tier estimate so the user sees an upper bound BEFORE
9
- * committing spend.
10
- *
11
- * Used by:
12
- * - the `estimate_cost` agent tool (offered to the planner so it can
13
- * stay within tierBudget),
14
- * - the /v1/agent/cost preview endpoint (storyboard preview before render).
15
- */
16
- const TIER_FALLBACK_PER_SECOND = {
17
- T0: 0.5,
18
- T1: 2,
19
- T2: 6,
20
- T3: 14,
21
- };
22
- const clipDurationMs = (c) => Math.max(0, c.display.to - c.display.from);
23
- function estimateProjectCost(project) {
24
- const byTier = { T0: 0, T1: 0, T2: 0, T3: 0 };
25
- const perClip = [];
26
- for (const clip of project.clips) {
27
- const tier = clip.provenance?.tier;
28
- let credits = clip.provenance?.creditsSpent;
29
- let estimated = false;
30
- if (credits === undefined) {
31
- if (tier) {
32
- credits =
33
- (clipDurationMs(clip) / 1000) * TIER_FALLBACK_PER_SECOND[tier];
34
- estimated = true;
35
- }
36
- else {
37
- credits = 0;
38
- }
39
- }
40
- if (tier)
41
- byTier[tier] += credits;
42
- perClip.push({ clipId: clip.id, tier, credits, estimated });
43
- }
44
- const totalCredits = perClip.reduce((s, x) => s + x.credits, 0);
45
- return { totalCredits, byTier, perClip };
46
- }
47
- /**
48
- * Plan-side estimate (pre-execution). The planner already writes
49
- * `estimatedCredits` per scene + a `totalEstimatedCredits` rollup, so this
50
- * mostly trusts those values and re-aggregates by tier for the UI chip.
51
- * Falls back to the same per-second tier curve as `estimateProjectCost`
52
- * when a scene omits its own estimate.
53
- */
54
- function estimatePlanCost(plan) {
55
- const byTier = { T0: 0, T1: 0, T2: 0, T3: 0 };
56
- const perClip = [];
57
- for (const scene of plan.scenes) {
58
- const tier = scene.tier;
59
- let credits = scene.estimatedCredits;
60
- let estimated = false;
61
- if (credits === undefined || credits === 0) {
62
- credits = (scene.durationMs / 1000) * TIER_FALLBACK_PER_SECOND[tier];
63
- estimated = true;
64
- }
65
- byTier[tier] += credits;
66
- perClip.push({
67
- clipId: `scene-${scene.sceneIndex}`,
68
- tier,
69
- credits,
70
- estimated,
71
- });
72
- }
73
- const totalCredits = perClip.reduce((s, x) => s + x.credits, 0);
74
- return { totalCredits, byTier, perClip };
75
- }
@@ -1,103 +0,0 @@
1
- import { z } from "zod";
2
- import { AgentPersona } from "../../schemas/agentPersona.schema";
3
- import { Project } from "../../schemas/project.schema";
4
- import { VideoBrief } from "../../schemas/brief.schema";
5
- import { VideoPlan } from "../../schemas/videoPlan.schema";
6
- import { LlmCaller } from "./llmCaller";
7
- import { ModelRouter } from "./modelRouter";
8
- /**
9
- * Critic — runs after assets land and BEFORE render. Catches off-brief assets
10
- * so the agent can self-heal (regenerate / replace with stock) without burning
11
- * a full render cycle.
12
- *
13
- * Rubric (V1):
14
- * - continuity : do consecutive scenes match in style / lighting?
15
- * - voSync : does on-screen text align with the VO line?
16
- * - brandSafety : are any blocked claims present?
17
- * - consistency : same product / face across scenes (vision check)
18
- * - costVsTier : did total spend stay within the tier budget?
19
- *
20
- * Each rubric item returns pass/warn/fail with a one-line rationale. The
21
- * agent self-heals up to one pass on the worst-scoring item.
22
- */
23
- export declare const CriticSeveritySchema: z.ZodEnum<{
24
- pass: "pass";
25
- warn: "warn";
26
- fail: "fail";
27
- }>;
28
- export type CriticSeverity = z.infer<typeof CriticSeveritySchema>;
29
- export declare const CriticFindingSchema: z.ZodObject<{
30
- rubric: z.ZodEnum<{
31
- continuity: "continuity";
32
- voSync: "voSync";
33
- brandSafety: "brandSafety";
34
- consistency: "consistency";
35
- costVsTier: "costVsTier";
36
- }>;
37
- severity: z.ZodEnum<{
38
- pass: "pass";
39
- warn: "warn";
40
- fail: "fail";
41
- }>;
42
- clipId: z.ZodOptional<z.ZodString>;
43
- message: z.ZodString;
44
- suggestedAction: z.ZodOptional<z.ZodObject<{
45
- kind: z.ZodEnum<{
46
- trim: "trim";
47
- regenerate: "regenerate";
48
- replace_with_stock: "replace_with_stock";
49
- swap_voice: "swap_voice";
50
- }>;
51
- detail: z.ZodOptional<z.ZodString>;
52
- }, z.core.$strip>>;
53
- }, z.core.$strip>;
54
- export type CriticFinding = z.infer<typeof CriticFindingSchema>;
55
- export declare const CriticReportSchema: z.ZodObject<{
56
- overall: z.ZodEnum<{
57
- pass: "pass";
58
- warn: "warn";
59
- fail: "fail";
60
- }>;
61
- findings: z.ZodArray<z.ZodObject<{
62
- rubric: z.ZodEnum<{
63
- continuity: "continuity";
64
- voSync: "voSync";
65
- brandSafety: "brandSafety";
66
- consistency: "consistency";
67
- costVsTier: "costVsTier";
68
- }>;
69
- severity: z.ZodEnum<{
70
- pass: "pass";
71
- warn: "warn";
72
- fail: "fail";
73
- }>;
74
- clipId: z.ZodOptional<z.ZodString>;
75
- message: z.ZodString;
76
- suggestedAction: z.ZodOptional<z.ZodObject<{
77
- kind: z.ZodEnum<{
78
- trim: "trim";
79
- regenerate: "regenerate";
80
- replace_with_stock: "replace_with_stock";
81
- swap_voice: "swap_voice";
82
- }>;
83
- detail: z.ZodOptional<z.ZodString>;
84
- }, z.core.$strip>>;
85
- }, z.core.$strip>>;
86
- }, z.core.$strip>;
87
- export type CriticReport = z.infer<typeof CriticReportSchema>;
88
- export interface CriticOptions {
89
- llm: LlmCaller;
90
- router?: ModelRouter;
91
- }
92
- export declare class Critic {
93
- private readonly opts;
94
- private readonly router;
95
- constructor(opts: CriticOptions);
96
- review(project: Project, brief: VideoBrief, opts?: {
97
- persona?: AgentPersona;
98
- plan?: VideoPlan;
99
- }): Promise<CriticReport>;
100
- private formatEmphasis;
101
- private formatTierMix;
102
- }
103
- //# sourceMappingURL=critic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"critic.d.ts","sourceRoot":"","sources":["../../../src/services/agent/critic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,oBAAoB;;;;EAAmC,CAAC;AACrE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;iBAmB9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,SAAS,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,qBAAa,MAAM;IAGL,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAER,IAAI,EAAE,aAAa;IAI1C,MAAM,CACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE;QAAE,OAAO,CAAC,EAAE,YAAY,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAO,GACtD,OAAO,CAAC,YAAY,CAAC;IAiExB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,aAAa;CAKtB"}
@@ -1,132 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Critic = exports.CriticReportSchema = exports.CriticFindingSchema = exports.CriticSeveritySchema = void 0;
4
- const zod_1 = require("zod");
5
- const modelRouter_1 = require("./modelRouter");
6
- const personas_1 = require("./personas");
7
- /**
8
- * Critic — runs after assets land and BEFORE render. Catches off-brief assets
9
- * so the agent can self-heal (regenerate / replace with stock) without burning
10
- * a full render cycle.
11
- *
12
- * Rubric (V1):
13
- * - continuity : do consecutive scenes match in style / lighting?
14
- * - voSync : does on-screen text align with the VO line?
15
- * - brandSafety : are any blocked claims present?
16
- * - consistency : same product / face across scenes (vision check)
17
- * - costVsTier : did total spend stay within the tier budget?
18
- *
19
- * Each rubric item returns pass/warn/fail with a one-line rationale. The
20
- * agent self-heals up to one pass on the worst-scoring item.
21
- */
22
- exports.CriticSeveritySchema = zod_1.z.enum(["pass", "warn", "fail"]);
23
- exports.CriticFindingSchema = zod_1.z.object({
24
- rubric: zod_1.z.enum([
25
- "continuity",
26
- "voSync",
27
- "brandSafety",
28
- "consistency",
29
- "costVsTier",
30
- ]),
31
- severity: exports.CriticSeveritySchema,
32
- /** Which clip / scene the finding refers to, if any. */
33
- clipId: zod_1.z.string().optional(),
34
- message: zod_1.z.string(),
35
- /** Optional self-heal hint the executor can act on. */
36
- suggestedAction: zod_1.z
37
- .object({
38
- kind: zod_1.z.enum(["regenerate", "replace_with_stock", "trim", "swap_voice"]),
39
- detail: zod_1.z.string().optional(),
40
- })
41
- .optional(),
42
- });
43
- exports.CriticReportSchema = zod_1.z.object({
44
- overall: exports.CriticSeveritySchema,
45
- findings: zod_1.z.array(exports.CriticFindingSchema),
46
- });
47
- class Critic {
48
- constructor(opts) {
49
- this.opts = opts;
50
- this.router = opts.router ?? new modelRouter_1.ModelRouter();
51
- }
52
- async review(project, brief, opts = {}) {
53
- const model = this.router.pickFor("critic");
54
- // Vision-mode QA: feed clip thumbnails into the critic for continuity check.
55
- const thumbnails = project.clips
56
- .map((c) => (c.type === "video" || c.type === "image" ? c.src : null))
57
- .filter((u) => Boolean(u))
58
- .slice(0, 12); // bound vision token spend
59
- const personaEmphasis = opts.persona
60
- ? this.formatEmphasis(opts.persona)
61
- : "";
62
- const tierMix = opts.plan
63
- ? this.formatTierMix(opts.plan)
64
- : "(plan not provided — judge continuity defensively across all scenes)";
65
- const result = await this.opts.llm.structured({
66
- model,
67
- schema: exports.CriticReportSchema,
68
- schemaName: "CriticReport",
69
- temperature: 0.2,
70
- messages: [
71
- {
72
- role: "system",
73
- content: [
74
- "You are a quality critic for AI-generated short-form videos.",
75
- "Score the project against the rubric.",
76
- "",
77
- "Continuity rule (tier-aware):",
78
- "- T0/T1 scenes use stock or single AI stills + motion. Do NOT flag",
79
- " continuity unless lighting / colour palette / subject identity",
80
- " shifts so hard it breaks comprehension. Mood drift is acceptable.",
81
- "- T2/T3 scenes are AI-generated motion the user paid a premium for.",
82
- " Flag continuity for any visible character / product identity drift,",
83
- " lighting jumps, or style mismatches with adjacent scenes.",
84
- "",
85
- "Brand-safety rules (strict):",
86
- "- Any phrase in brief.claims.block → fail immediately.",
87
- "- Any unsubstantiated quantitative claim (\"3x faster\", \"99% of users\",",
88
- " \"clinically proven\", numeric efficacy without a cited source) → warn",
89
- " with suggestedAction.kind=\"regenerate\" + a corrective rewrite.",
90
- "- Medical / financial / legal claims default to fail unless brief",
91
- " explicitly allows them.",
92
- "",
93
- "Per-scene tier reference (use to apply the continuity rule):",
94
- tierMix,
95
- personaEmphasis,
96
- ]
97
- .filter(Boolean)
98
- .join("\n"),
99
- },
100
- {
101
- role: "user",
102
- content: [
103
- `Brief:\n${JSON.stringify(brief, null, 2)}`,
104
- `\nProject:\n${JSON.stringify(project, null, 2)}`,
105
- ].join("\n"),
106
- imageUrls: thumbnails,
107
- },
108
- ],
109
- });
110
- return result.data;
111
- }
112
- formatEmphasis(persona) {
113
- const emphasis = personas_1.PERSONA_PACKS[persona].criticEmphasis;
114
- const entries = Object.entries(emphasis);
115
- if (!entries.length)
116
- return "";
117
- const lines = entries
118
- .map(([axis, weight]) => ` - ${axis}: extra weight ${weight}`)
119
- .join("\n");
120
- return [
121
- "",
122
- `Persona "${persona}" — apply extra scrutiny to:`,
123
- lines,
124
- ].join("\n");
125
- }
126
- formatTierMix(plan) {
127
- return plan.scenes
128
- .map((s) => ` scene ${s.sceneIndex}: tier=${s.tier} (${s.strategy})`)
129
- .join("\n");
130
- }
131
- }
132
- exports.Critic = Critic;
@@ -1,5 +0,0 @@
1
- export * from "./types";
2
- export * from "./recorder";
3
- export * from "./judge";
4
- export * from "./seedBriefs";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/eval/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./recorder"), exports);
19
- __exportStar(require("./judge"), exports);
20
- __exportStar(require("./seedBriefs"), exports);
@@ -1,14 +0,0 @@
1
- import { AgentPersona } from "../../../schemas/agentPersona.schema";
2
- import { Project } from "../../../schemas/project.schema";
3
- import { LlmCaller } from "../llmCaller";
4
- import { ModelRouter } from "../modelRouter";
5
- import { EvalBrief, EvalScore } from "./types";
6
- export declare class EvalJudge {
7
- private readonly llm;
8
- private readonly router;
9
- constructor(llm: LlmCaller, router?: ModelRouter);
10
- judge(brief: EvalBrief, project: Project, agentRunId: string, opts?: {
11
- persona?: AgentPersona;
12
- }): Promise<EvalScore>;
13
- }
14
- //# sourceMappingURL=judge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/eval/judge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAgC,SAAS,EAAE,MAAM,SAAS,CAAC;AAgD7E,qBAAa,SAAS;IAGR,OAAO,CAAC,QAAQ,CAAC,GAAG;IAFhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAER,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,WAAW;IAI3D,KAAK,CACT,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE;QAAE,OAAO,CAAC,EAAE,YAAY,CAAA;KAAO,GACpC,OAAO,CAAC,SAAS,CAAC;CA8CtB"}
@@ -1,95 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EvalJudge = void 0;
4
- const zod_1 = require("zod");
5
- const modelRouter_1 = require("../modelRouter");
6
- const personas_1 = require("../personas");
7
- const types_1 = require("./types");
8
- /**
9
- * LLM-as-judge — scores a finalized Project against an EvalBrief's rubric.
10
- *
11
- * Uses the critic-tier model (vision-capable Sonnet) with a strict structured
12
- * output. Independent from the live Critic that runs during a real agent run;
13
- * the judge is allowed to be slower / more expensive because it runs offline.
14
- */
15
- const RUBRIC_WEIGHTS = {
16
- hookStrength: 0.2,
17
- voVisualSync: 0.2,
18
- pacingFit: 0.15,
19
- brandSafety: 0.15,
20
- costVsTier: 0.1,
21
- intentMatch: 0.2,
22
- };
23
- /**
24
- * Apply persona criticEmphasis as additive deltas to the base weights, then
25
- * renormalise so the weight set still sums to 1. Keeps scores comparable
26
- * across personas while letting each persona's "what matters most" lean
27
- * the aggregate score.
28
- */
29
- function weightsForPersona(persona) {
30
- if (!persona)
31
- return RUBRIC_WEIGHTS;
32
- const emphasis = personas_1.PERSONA_PACKS[persona].criticEmphasis;
33
- const adjusted = { ...RUBRIC_WEIGHTS };
34
- for (const [axis, delta] of Object.entries(emphasis)) {
35
- const key = axis;
36
- adjusted[key] = Math.max(0, adjusted[key] + (delta ?? 0));
37
- }
38
- const total = Object.values(adjusted).reduce((s, v) => s + v, 0);
39
- if (total <= 0)
40
- return RUBRIC_WEIGHTS;
41
- for (const k of Object.keys(adjusted)) {
42
- adjusted[k] = adjusted[k] / total;
43
- }
44
- return adjusted;
45
- }
46
- const JudgeOutputSchema = zod_1.z.object({
47
- rubric: types_1.EvalRubricSchema,
48
- notes: zod_1.z.string(),
49
- });
50
- class EvalJudge {
51
- constructor(llm, router) {
52
- this.llm = llm;
53
- this.router = router ?? new modelRouter_1.ModelRouter();
54
- }
55
- async judge(brief, project, agentRunId, opts = {}) {
56
- const model = this.router.pickFor("critic");
57
- const weights = weightsForPersona(opts.persona);
58
- const messages = [
59
- {
60
- role: "system",
61
- content: [
62
- "You are an offline quality judge for AI-generated short videos.",
63
- "Score the project against the rubric on each axis (0-1, two decimals).",
64
- "Be harsh: 1.0 means publish-without-edit; 0.7 is good but with one fixable issue;",
65
- "0.4 means a re-roll is needed. Cite concrete clip ids in `notes`.",
66
- ].join(" "),
67
- },
68
- {
69
- role: "user",
70
- content: [
71
- `Brief id: ${brief.id} (niche: ${brief.niche})`,
72
- `What "good" looks like:\n${brief.goodOutputNotes}`,
73
- `\nProject JSON:\n${JSON.stringify(project, null, 2)}`,
74
- ].join("\n\n"),
75
- },
76
- ];
77
- const result = await this.llm.structured({
78
- model,
79
- messages,
80
- schema: JudgeOutputSchema,
81
- schemaName: "EvalJudgeResult",
82
- temperature: 0,
83
- });
84
- const aggregate = Object.keys(weights).reduce((sum, key) => sum + result.data.rubric[key] * weights[key], 0);
85
- return {
86
- briefId: brief.id,
87
- agentRunId,
88
- rubric: result.data.rubric,
89
- score: Number(aggregate.toFixed(3)),
90
- judgeNotes: result.data.notes,
91
- scoredAt: new Date().toISOString(),
92
- };
93
- }
94
- }
95
- exports.EvalJudge = EvalJudge;
@@ -1,17 +0,0 @@
1
- import { ToolContext, ToolOutcome } from "../toolRegistry";
2
- import { AgentRunTrace } from "./types";
3
- export declare function setTracePersistence(fn: (trace: AgentRunTrace) => Promise<void>): void;
4
- export declare function startTrace(opts: {
5
- agentRunId: string;
6
- briefId?: string;
7
- modelRouting: Record<string, string>;
8
- rngSeed: string;
9
- }): AgentRunTrace;
10
- export declare function getTrace(agentRunId: string): AgentRunTrace | undefined;
11
- export declare function endTrace(agentRunId: string): Promise<AgentRunTrace | undefined>;
12
- /**
13
- * Drop-in replacement for runTool that records the call in the active trace.
14
- * Use this in eval mode; production code can keep calling runTool directly.
15
- */
16
- export declare function runToolRecorded<O = unknown>(name: string, input: unknown, ctx: ToolContext): Promise<ToolOutcome<O>>;
17
- //# sourceMappingURL=recorder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/eval/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAiB,MAAM,SAAS,CAAC;AAcvD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAErF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,aAAa,CAWhB;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEtE;AAED,wBAAsB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAYrF;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,CAAC,GAAG,OAAO,EAC/C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CASzB"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setTracePersistence = setTracePersistence;
4
- exports.startTrace = startTrace;
5
- exports.getTrace = getTrace;
6
- exports.endTrace = endTrace;
7
- exports.runToolRecorded = runToolRecorded;
8
- const toolRegistry_1 = require("../toolRegistry");
9
- /**
10
- * Recording wrapper around runTool — every tool call is appended to a trace
11
- * buffer keyed by agentRunId. Replay reads this buffer back; offline eval
12
- * compares two recordings against the same brief.
13
- *
14
- * Storage is in-memory by default; the host swaps in a Firestore-backed
15
- * implementation by setting the persistence callback.
16
- */
17
- const traces = new Map();
18
- let persistFn = null;
19
- function setTracePersistence(fn) {
20
- persistFn = fn;
21
- }
22
- function startTrace(opts) {
23
- const trace = {
24
- agentRunId: opts.agentRunId,
25
- briefId: opts.briefId,
26
- startedAt: new Date().toISOString(),
27
- modelRouting: opts.modelRouting,
28
- rngSeed: opts.rngSeed,
29
- toolCalls: [],
30
- };
31
- traces.set(opts.agentRunId, trace);
32
- return trace;
33
- }
34
- function getTrace(agentRunId) {
35
- return traces.get(agentRunId);
36
- }
37
- async function endTrace(agentRunId) {
38
- const trace = traces.get(agentRunId);
39
- if (!trace)
40
- return undefined;
41
- trace.endedAt = new Date().toISOString();
42
- if (persistFn) {
43
- try {
44
- await persistFn(trace);
45
- }
46
- catch {
47
- // Persistence failure must not poison the agent run.
48
- }
49
- }
50
- return trace;
51
- }
52
- /**
53
- * Drop-in replacement for runTool that records the call in the active trace.
54
- * Use this in eval mode; production code can keep calling runTool directly.
55
- */
56
- async function runToolRecorded(name, input, ctx) {
57
- const ts = Date.now();
58
- const outcome = await (0, toolRegistry_1.runTool)(name, input, ctx);
59
- const trace = traces.get(ctx.agentRunId);
60
- if (trace) {
61
- const entry = { ts, tool: name, input, outcome };
62
- trace.toolCalls.push(entry);
63
- }
64
- return outcome;
65
- }
@@ -1,16 +0,0 @@
1
- import { EvalBrief } from "./types";
2
- /**
3
- * Eval set — 50 hand-curated briefs covering the 5 launch personas plus
4
- * adjacent niches that should route to the closest persona (e.g. recipe →
5
- * faceless-yt, real-estate → product-demo).
6
- *
7
- * Use these to:
8
- * 1. Catch routing regressions (router persona !== expected niche).
9
- * 2. Catch planner regressions (tier mix, schema validity, scene count).
10
- * 3. Score quality drift after prompt / model / rubric changes.
11
- *
12
- * Add new briefs alongside the change that needs them; do not bulk-grow
13
- * without a reason — every brief costs 4 LLM calls per run.
14
- */
15
- export declare const SEED_EVAL_BRIEFS: EvalBrief[];
16
- //# sourceMappingURL=seedBriefs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"seedBriefs.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/eval/seedBriefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,EA4pCvC,CAAC"}