vidspotai-shared 1.0.85 → 1.0.87
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/lib/globals/aiModels/providers/runway.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/runway.js +12 -7
- package/lib/globals/types.d.ts +10 -0
- package/lib/globals/types.d.ts.map +1 -1
- package/lib/globals/types.js +11 -0
- package/lib/models/agent.model.d.ts +129 -1
- package/lib/models/agent.model.d.ts.map +1 -1
- package/lib/schemas/agentRunJob.schema.d.ts +21 -0
- package/lib/schemas/agentRunJob.schema.d.ts.map +1 -1
- package/lib/schemas/agentRunJob.schema.js +35 -3
- package/lib/schemas/videoPlan.schema.d.ts +1 -0
- package/lib/schemas/videoPlan.schema.d.ts.map +1 -1
- package/lib/schemas/videoPlan.schema.js +8 -0
- package/lib/services/agent/executor/core.d.ts.map +1 -1
- package/lib/services/agent/executor/core.js +21 -1
- package/lib/services/agent/executor/types.d.ts +10 -0
- package/lib/services/agent/executor/types.d.ts.map +1 -1
- package/lib/services/agent/index.d.ts +3 -0
- package/lib/services/agent/index.d.ts.map +1 -1
- package/lib/services/agent/index.js +3 -0
- package/lib/services/agent/planner/plannerMessages.d.ts.map +1 -1
- package/lib/services/agent/planner/plannerMessages.js +7 -0
- package/lib/services/agent/providerFallback/chains.d.ts +2 -0
- package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
- package/lib/services/agent/providerFallback/chains.js +1 -0
- package/lib/services/agent/recovery/degradeLadder.d.ts +74 -0
- package/lib/services/agent/recovery/degradeLadder.d.ts.map +1 -0
- package/lib/services/agent/recovery/degradeLadder.js +133 -0
- package/lib/services/agent/repair/engine.d.ts +38 -0
- package/lib/services/agent/repair/engine.d.ts.map +1 -0
- package/lib/services/agent/repair/engine.js +175 -0
- package/lib/services/agent/repair/index.d.ts +20 -0
- package/lib/services/agent/repair/index.d.ts.map +1 -0
- package/lib/services/agent/repair/index.js +49 -0
- package/lib/services/agent/repair/strategies/llmRepair.strategy.d.ts +6 -0
- package/lib/services/agent/repair/strategies/llmRepair.strategy.d.ts.map +1 -0
- package/lib/services/agent/repair/strategies/llmRepair.strategy.js +210 -0
- package/lib/services/agent/repair/strategies/paramRepair.strategy.d.ts +3 -0
- package/lib/services/agent/repair/strategies/paramRepair.strategy.d.ts.map +1 -0
- package/lib/services/agent/repair/strategies/paramRepair.strategy.js +151 -0
- package/lib/services/agent/repair/types.d.ts +92 -0
- package/lib/services/agent/repair/types.d.ts.map +1 -0
- package/lib/services/agent/repair/types.js +2 -0
- package/lib/services/agent/runPlanning.d.ts +96 -0
- package/lib/services/agent/runPlanning.d.ts.map +1 -0
- package/lib/services/agent/runPlanning.js +233 -0
- package/lib/services/agent/tools/planVideo.tool.d.ts +1 -0
- package/lib/services/agent/tools/planVideo.tool.d.ts.map +1 -1
- package/lib/services/aiGen/providers/runway/types.d.ts +14 -0
- package/lib/services/aiGen/providers/runway/types.d.ts.map +1 -1
- package/lib/services/aiGen/providers/runway/types.js +22 -1
- package/lib/services/firestore.service.d.ts +7 -1
- package/lib/services/firestore.service.d.ts.map +1 -1
- package/lib/services/firestore.service.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeBibleCacheKey = computeBibleCacheKey;
|
|
4
|
+
exports.getBibleWithCache = getBibleWithCache;
|
|
5
|
+
exports.recordPlanTimings = recordPlanTimings;
|
|
6
|
+
exports.runPlanning = runPlanning;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const logger_1 = require("../../utils/logger");
|
|
9
|
+
const firestore_service_1 = require("../firestore.service");
|
|
10
|
+
const brief_schema_1 = require("../../schemas/brief.schema");
|
|
11
|
+
const llmCallerRegistry_1 = require("./llmCallerRegistry");
|
|
12
|
+
const bibleBuilder_1 = require("./bibleBuilder");
|
|
13
|
+
const bibleImageVision_1 = require("./bibleImageVision");
|
|
14
|
+
const planner_1 = require("./planner");
|
|
15
|
+
const musicSelect_1 = require("./musicSelect");
|
|
16
|
+
const beatSnap_1 = require("./beatSnap");
|
|
17
|
+
/**
|
|
18
|
+
* plan-B — the single source of truth for "build a plan from a brief".
|
|
19
|
+
*
|
|
20
|
+
* Extracted out of the Cloud Function (plan.controller.ts) so BOTH the
|
|
21
|
+
* AGENT_PLAN_JOBS worker (the async primary path) and the blocking
|
|
22
|
+
* `planProject` Function call run the IDENTICAL bible→planner→music→snap
|
|
23
|
+
* pipeline + emit the IDENTICAL latency telemetry. Two callers, one routine,
|
|
24
|
+
* no drift.
|
|
25
|
+
*
|
|
26
|
+
* The caller owns persistence (writing `.plan` / `previewPlan` / `bibleCache`);
|
|
27
|
+
* this routine is pure compute + telemetry. Progress is surfaced through the
|
|
28
|
+
* optional `onStage` callback so the worker can mirror each sub-step onto
|
|
29
|
+
* `agentProjects.planRun.stage`.
|
|
30
|
+
*/
|
|
31
|
+
const isoNow = () => new Date().toISOString();
|
|
32
|
+
/**
|
|
33
|
+
* Stable cache key for the Visual Bible. Bible content is a pure function of
|
|
34
|
+
* (brief, brandKit) — same inputs ⇒ same bible. We key on the brief object
|
|
35
|
+
* plus `brandKit.updatedAt` (cheap version proxy) so any brand-kit edit
|
|
36
|
+
* invalidates without re-hashing the kit body. C0 (no bible) returns "" so
|
|
37
|
+
* we never cache nothing as something.
|
|
38
|
+
*/
|
|
39
|
+
function computeBibleCacheKey(brief, brandKit) {
|
|
40
|
+
if ((brief.consistencyTier ?? "C1") === "C0")
|
|
41
|
+
return "";
|
|
42
|
+
return (0, crypto_1.createHash)("sha256")
|
|
43
|
+
.update(JSON.stringify({
|
|
44
|
+
brief,
|
|
45
|
+
bku: brandKit?.updatedAt ?? null,
|
|
46
|
+
}))
|
|
47
|
+
.digest("hex");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* AG-12 — soft-fail wrapper around BibleBuilder. A bible LLM failure must not
|
|
51
|
+
* block planning; the planner degrades to AG-11's per-scene re-state when no
|
|
52
|
+
* bible is passed. C0 briefs skip the builder entirely.
|
|
53
|
+
*/
|
|
54
|
+
async function safeBuildBible(llm, args) {
|
|
55
|
+
const tier = args.brief.consistencyTier ?? "C1";
|
|
56
|
+
if (tier === "C0")
|
|
57
|
+
return undefined;
|
|
58
|
+
try {
|
|
59
|
+
const builder = new bibleBuilder_1.BibleBuilder({ llm });
|
|
60
|
+
return await builder.build({
|
|
61
|
+
brief: args.brief,
|
|
62
|
+
persona: args.persona,
|
|
63
|
+
brandKit: args.brandKit,
|
|
64
|
+
consistencyTier: tier === "C2" ? "C2" : "C1",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
logger_1.logger.warn("agent.bibleBuilder failed — degrading to AG-11", {
|
|
69
|
+
err: err.message,
|
|
70
|
+
});
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* OD-T6 — image-vision pass that rewrites bible.entity.description from the
|
|
76
|
+
* entity's referenceImageUrl. Runs between bible-build and planner so the
|
|
77
|
+
* planner composes scene prompts from what the IMAGE shows (color, material,
|
|
78
|
+
* finish, label text) rather than what the brief text invented. Skips
|
|
79
|
+
* entities without a referenceImageUrl. Per-entity soft-fail; vision outage
|
|
80
|
+
* leaves descriptions intact. Cost ~$0.0001/entity.
|
|
81
|
+
*/
|
|
82
|
+
async function safeBibleImageVision(bible) {
|
|
83
|
+
if (!bible)
|
|
84
|
+
return bible;
|
|
85
|
+
const apiKey = process.env.GOOGLE_API_KEY;
|
|
86
|
+
if (!apiKey) {
|
|
87
|
+
logger_1.logger.warn("agent.bibleImageVision skipped — no GOOGLE_API_KEY");
|
|
88
|
+
return bible;
|
|
89
|
+
}
|
|
90
|
+
const haveRefs = bible.characters.some((e) => e.referenceImageUrl) ||
|
|
91
|
+
bible.objects.some((e) => e.referenceImageUrl) ||
|
|
92
|
+
bible.environments.some((e) => e.referenceImageUrl);
|
|
93
|
+
if (!haveRefs)
|
|
94
|
+
return bible;
|
|
95
|
+
try {
|
|
96
|
+
return await (0, bibleImageVision_1.runBibleImageVision)(bible, { apiKey });
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
logger_1.logger.warn("agent.bibleImageVision failed — keeping text descriptions", {
|
|
100
|
+
err: err.message,
|
|
101
|
+
});
|
|
102
|
+
return bible;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returns the bible to thread into the planner, using the project-level cache
|
|
107
|
+
* when the key matches. On miss runs the full BibleBuilder + image-vision
|
|
108
|
+
* pipeline (both soft-fail per their wrappers). Returns the bible and a
|
|
109
|
+
* `fresh` flag so the caller can decide to persist on cache miss only.
|
|
110
|
+
*/
|
|
111
|
+
async function getBibleWithCache(args) {
|
|
112
|
+
const key = computeBibleCacheKey(args.brief, args.brandKit);
|
|
113
|
+
const cached = args.project.bibleCache;
|
|
114
|
+
if (key && cached?.key === key) {
|
|
115
|
+
args.onStage?.("bible_cached");
|
|
116
|
+
logger_1.logger.info("agent.bibleCache hit", {
|
|
117
|
+
projectId: args.project.id,
|
|
118
|
+
builtAt: cached.builtAt,
|
|
119
|
+
});
|
|
120
|
+
return { bible: cached.bible, fresh: false, key };
|
|
121
|
+
}
|
|
122
|
+
args.onStage?.("building_bible");
|
|
123
|
+
const built = await safeBuildBible(args.llm, {
|
|
124
|
+
brief: args.brief,
|
|
125
|
+
persona: args.persona,
|
|
126
|
+
brandKit: args.brandKit,
|
|
127
|
+
});
|
|
128
|
+
args.onStage?.("aligning_bible_with_images");
|
|
129
|
+
const bible = await safeBibleImageVision(built);
|
|
130
|
+
return { bible, fresh: true, key };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Latency telemetry — emits ONE structured record per planning run, two ways:
|
|
134
|
+
* 1) `logger.info("agent.planTimings", …)` → Console + Grafana Loki (the
|
|
135
|
+
* existing winston pipeline; no parallel reporter).
|
|
136
|
+
* 2) a durable doc in the `agentPlanTimings` Firestore collection → queryable
|
|
137
|
+
* for aggregate analysis (p50/p95 per stage, web-research/cache incidence)
|
|
138
|
+
* via scripts/analyze-plan-timings.mjs — no per-run guesswork.
|
|
139
|
+
*
|
|
140
|
+
* Fire-and-forget: never on the critical path, and a write failure is swallowed
|
|
141
|
+
* (warn only) so telemetry can't break planning.
|
|
142
|
+
*/
|
|
143
|
+
function recordPlanTimings(args) {
|
|
144
|
+
const meta = (args.plan.meta ?? {});
|
|
145
|
+
const record = {
|
|
146
|
+
projectId: args.projectId,
|
|
147
|
+
userId: args.userId,
|
|
148
|
+
createdAt: isoNow(),
|
|
149
|
+
streaming: args.streaming,
|
|
150
|
+
dryRun: args.dryRun,
|
|
151
|
+
// shape signals — what makes a plan slow varies by these
|
|
152
|
+
durationSec: args.brief.durationSec ?? null,
|
|
153
|
+
lengthTier: args.brief.lengthTier ?? (0, brief_schema_1.deriveLengthTier)(args.brief.durationSec),
|
|
154
|
+
tierBudget: args.brief.tierBudget ?? null,
|
|
155
|
+
consistencyTier: args.brief.consistencyTier ?? null,
|
|
156
|
+
sceneCount: Array.isArray(args.plan.scenes) ? args.plan.scenes.length : null,
|
|
157
|
+
// cost-path flags (the prime suspects for short-form latency)
|
|
158
|
+
bibleCacheHit: args.bibleCacheHit,
|
|
159
|
+
bibleBuilt: meta.bibleBuilt ?? null,
|
|
160
|
+
usedWebResearch: meta.usedWebResearch ?? null,
|
|
161
|
+
usedThinking: meta.usedThinking ?? null,
|
|
162
|
+
// per-stage wall-clock
|
|
163
|
+
...args.timings,
|
|
164
|
+
};
|
|
165
|
+
logger_1.logger.info("agent.planTimings", record);
|
|
166
|
+
// Durable, queryable copy. `.firestore` off any CollectionReference yields
|
|
167
|
+
// the admin Firestore instance, so we can write a new collection without a
|
|
168
|
+
// typed accessor in the shared package.
|
|
169
|
+
void firestore_service_1.FirestoreService.agentProjectsCol.firestore
|
|
170
|
+
.collection("agentPlanTimings")
|
|
171
|
+
.add(record)
|
|
172
|
+
.catch((err) => logger_1.logger.warn("agent.planTimings: firestore write failed", {
|
|
173
|
+
err: err.message,
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Run the full planning pipeline: bible (cache-or-build) → planner →
|
|
178
|
+
* music-select → beat-snap, stamping `plan.meta.bibleBuilt` and emitting
|
|
179
|
+
* latency telemetry. Pure compute — does NOT write the plan to Firestore;
|
|
180
|
+
* the caller decides where it lands (`.plan` for a live plan, `previewPlan`
|
|
181
|
+
* for a dry-run).
|
|
182
|
+
*/
|
|
183
|
+
async function runPlanning(args) {
|
|
184
|
+
const llm = (0, llmCallerRegistry_1.getLlmCaller)();
|
|
185
|
+
const tStart = Date.now();
|
|
186
|
+
const { bible, fresh: bibleFresh, key: bibleKey } = await getBibleWithCache({
|
|
187
|
+
project: args.project,
|
|
188
|
+
brief: args.brief,
|
|
189
|
+
persona: args.persona,
|
|
190
|
+
brandKit: args.brandKit,
|
|
191
|
+
llm,
|
|
192
|
+
onStage: args.onStage,
|
|
193
|
+
});
|
|
194
|
+
const tBible = Date.now();
|
|
195
|
+
args.onStage?.("planning");
|
|
196
|
+
const planner = new planner_1.Planner({ llm });
|
|
197
|
+
const rawPlan = await planner.plan(args.brief, {
|
|
198
|
+
persona: args.persona,
|
|
199
|
+
brandKit: args.brandKit,
|
|
200
|
+
styleMemory: args.styleMemory,
|
|
201
|
+
bible,
|
|
202
|
+
useWebResearch: args.useWebResearch ?? "auto",
|
|
203
|
+
});
|
|
204
|
+
const tPlanner = Date.now();
|
|
205
|
+
// Stamp the bible-build flag onto plan.meta so /execute charges the bible
|
|
206
|
+
// overhead only when this run actually built one (cache hits cost nothing).
|
|
207
|
+
// Planner already stamped usedWebResearch / usedThinking.
|
|
208
|
+
rawPlan.meta = { ...(rawPlan.meta ?? {}), bibleBuilt: bibleFresh && !!bible };
|
|
209
|
+
const planWithMusic = await (0, musicSelect_1.selectMusicForPlan)(rawPlan);
|
|
210
|
+
const tMusic = Date.now();
|
|
211
|
+
const plan = (0, beatSnap_1.snapPlanToBeats)(planWithMusic);
|
|
212
|
+
const tSnap = Date.now();
|
|
213
|
+
recordPlanTimings({
|
|
214
|
+
projectId: args.project.id,
|
|
215
|
+
userId: args.project.userId,
|
|
216
|
+
brief: args.brief,
|
|
217
|
+
plan,
|
|
218
|
+
// The async worker path is non-streaming (progress comes from `onStage`,
|
|
219
|
+
// not token deltas), so `streaming: false` here. The kept legacy SSE
|
|
220
|
+
// endpoint still records `streaming: true` itself.
|
|
221
|
+
streaming: false,
|
|
222
|
+
dryRun: args.dryRun ?? false,
|
|
223
|
+
bibleCacheHit: !bibleFresh,
|
|
224
|
+
timings: {
|
|
225
|
+
bibleMs: tBible - tStart,
|
|
226
|
+
plannerMs: tPlanner - tBible,
|
|
227
|
+
musicMs: tMusic - tPlanner,
|
|
228
|
+
beatSnapMs: tSnap - tMusic,
|
|
229
|
+
totalMs: tSnap - tStart,
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
return { plan, bible, bibleFresh, bibleKey };
|
|
233
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planVideo.tool.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/tools/planVideo.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAQ/D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAExD;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIf,CAAC;AAEH,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"planVideo.tool.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/tools/planVideo.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAQ/D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAExD;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEhB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,cAAc,CACxC,OAAO,WAAW,EAClB,OAAO,YAAY,CAuBpB,CAAC"}
|
|
@@ -10,5 +10,19 @@ export declare const GEN4_ALEPH_RATIOS: string[];
|
|
|
10
10
|
export declare const TGEN4_ALEPH_DURATIONS: readonly [5];
|
|
11
11
|
export type Gen4AlephDuration = (typeof TGEN4_ALEPH_DURATIONS)[number];
|
|
12
12
|
export declare const GEN4_ALEPH_DURATIONS: number[];
|
|
13
|
+
/**
|
|
14
|
+
* Canonical aspect ratios the Runway VIDEO models accept from the agent / UI
|
|
15
|
+
* layer. This is the CONTRACT `validateParams` checks the incoming canonical
|
|
16
|
+
* `aspectRatio` against — every other provider's config lists canonical ratios
|
|
17
|
+
* here too. The service then translates canonical → Runway pixel ratio at
|
|
18
|
+
* request time via `mapAspectToRunwayVideoRatio`. The pixel-ratio constants
|
|
19
|
+
* above (`GEN4_TURBO_RATIOS` / `GEN4_ALEPH_RATIOS`) describe the NATIVE values
|
|
20
|
+
* the Runway API accepts and back the `Gen4TurboRatio` / `Gen4AlephRatio` types
|
|
21
|
+
* used at that boundary — they are intentionally NOT the validation set.
|
|
22
|
+
*
|
|
23
|
+
* AG-16: keep this in lockstep with `mapAspectToRunwayVideoRatio`'s switch —
|
|
24
|
+
* every value listed here must map to a valid pixel ratio for all flavors.
|
|
25
|
+
*/
|
|
26
|
+
export declare const RUNWAY_VIDEO_CANONICAL_RATIOS: string[];
|
|
13
27
|
export {};
|
|
14
28
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/types.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,kFAOd,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAA4B,CAAC;AAEnE,eAAO,MAAM,qBAAqB,qBAAsB,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAA+B,CAAC;AAEzE,QAAA,MAAM,kBAAkB,wGASd,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAA4B,CAAC;AAEnE,eAAO,MAAM,qBAAqB,cAAe,CAAC;AAClD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/types.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,kFAOd,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAA4B,CAAC;AAEnE,eAAO,MAAM,qBAAqB,qBAAsB,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAA+B,CAAC;AAEzE,QAAA,MAAM,kBAAkB,wGASd,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAA4B,CAAC;AAEnE,eAAO,MAAM,qBAAqB,cAAe,CAAC;AAClD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAA+B,CAAC;AAEzE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,EAOjD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GEN4_ALEPH_DURATIONS = exports.TGEN4_ALEPH_DURATIONS = exports.GEN4_ALEPH_RATIOS = exports.GEN4_TURBO_DURATIONS = exports.TGEN4_TURBO_DURATIONS = exports.GEN4_TURBO_RATIOS = void 0;
|
|
3
|
+
exports.RUNWAY_VIDEO_CANONICAL_RATIOS = exports.GEN4_ALEPH_DURATIONS = exports.TGEN4_ALEPH_DURATIONS = exports.GEN4_ALEPH_RATIOS = exports.GEN4_TURBO_DURATIONS = exports.TGEN4_TURBO_DURATIONS = exports.GEN4_TURBO_RATIOS = void 0;
|
|
4
4
|
const TGEN4_TURBO_RATIOS = [
|
|
5
5
|
"1280:720", // default
|
|
6
6
|
"1584:672",
|
|
@@ -25,3 +25,24 @@ const TGEN4_ALEPH_RATIOS = [
|
|
|
25
25
|
exports.GEN4_ALEPH_RATIOS = [...TGEN4_ALEPH_RATIOS];
|
|
26
26
|
exports.TGEN4_ALEPH_DURATIONS = [5];
|
|
27
27
|
exports.GEN4_ALEPH_DURATIONS = [...exports.TGEN4_ALEPH_DURATIONS];
|
|
28
|
+
/**
|
|
29
|
+
* Canonical aspect ratios the Runway VIDEO models accept from the agent / UI
|
|
30
|
+
* layer. This is the CONTRACT `validateParams` checks the incoming canonical
|
|
31
|
+
* `aspectRatio` against — every other provider's config lists canonical ratios
|
|
32
|
+
* here too. The service then translates canonical → Runway pixel ratio at
|
|
33
|
+
* request time via `mapAspectToRunwayVideoRatio`. The pixel-ratio constants
|
|
34
|
+
* above (`GEN4_TURBO_RATIOS` / `GEN4_ALEPH_RATIOS`) describe the NATIVE values
|
|
35
|
+
* the Runway API accepts and back the `Gen4TurboRatio` / `Gen4AlephRatio` types
|
|
36
|
+
* used at that boundary — they are intentionally NOT the validation set.
|
|
37
|
+
*
|
|
38
|
+
* AG-16: keep this in lockstep with `mapAspectToRunwayVideoRatio`'s switch —
|
|
39
|
+
* every value listed here must map to a valid pixel ratio for all flavors.
|
|
40
|
+
*/
|
|
41
|
+
exports.RUNWAY_VIDEO_CANONICAL_RATIOS = [
|
|
42
|
+
"16:9",
|
|
43
|
+
"9:16",
|
|
44
|
+
"1:1",
|
|
45
|
+
"4:3",
|
|
46
|
+
"3:4",
|
|
47
|
+
"21:9",
|
|
48
|
+
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DocumentData, OrderByDirection, WhereFilterOp } from "@google-cloud/firestore";
|
|
2
|
-
import { CollectionReference, DocumentReference } from "firebase-admin/firestore";
|
|
2
|
+
import { CollectionReference, DocumentReference, FieldValue } from "firebase-admin/firestore";
|
|
3
3
|
import { DeepPartial } from "../globals/types";
|
|
4
4
|
import { IAgentProjectModel, IAgentRunModel, IBrandKitModel, IStyleMemoryModel } from "../models/agent.model";
|
|
5
5
|
import { ICachedAssetModel } from "../models/cachedAsset.model";
|
|
@@ -55,6 +55,12 @@ export declare class FirestoreService {
|
|
|
55
55
|
static socialPostsCol: CollectionReference<ISocialPostModel, DocumentData>;
|
|
56
56
|
static socialAnalyticsCol: CollectionReference<ISocialAnalyticsModel, DocumentData>;
|
|
57
57
|
static socialInboxCol: CollectionReference<ISocialInboxItemModel, DocumentData>;
|
|
58
|
+
/**
|
|
59
|
+
* Sentinel for `.update()` that removes a field from a doc (wraps
|
|
60
|
+
* `FieldValue.delete()`). Use to clear a transient field — e.g. plan-B's
|
|
61
|
+
* `planRun` once a live plan lands — without reading the doc first.
|
|
62
|
+
*/
|
|
63
|
+
static deleteField(): FieldValue;
|
|
58
64
|
/** Add new document with generated ID */
|
|
59
65
|
static appendNewRecord<T>(collectionRef: CollectionReference<T>, data: T): Promise<DocumentReference<T>>;
|
|
60
66
|
/** Add or overwrite a document with a specific ID */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.service.d.ts","sourceRoot":"","sources":["../../src/services/firestore.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,gBAAgB,EAEhB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"firestore.service.d.ts","sourceRoot":"","sources":["../../src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
|
23
23
|
class FirestoreService {
|
|
24
24
|
// 🔹 CRUD / Utility methods
|
|
25
|
+
/**
|
|
26
|
+
* Sentinel for `.update()` that removes a field from a doc (wraps
|
|
27
|
+
* `FieldValue.delete()`). Use to clear a transient field — e.g. plan-B's
|
|
28
|
+
* `planRun` once a live plan lands — without reading the doc first.
|
|
29
|
+
*/
|
|
30
|
+
static deleteField() {
|
|
31
|
+
return firestore_1.FieldValue.delete();
|
|
32
|
+
}
|
|
25
33
|
/** Add new document with generated ID */
|
|
26
34
|
static async appendNewRecord(collectionRef, data) {
|
|
27
35
|
const docRef = collectionRef.doc();
|