@amaster.ai/pi-video-gen 0.1.2-beta.48

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 (85) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +196 -0
  3. package/dist/compose.d.ts +43 -0
  4. package/dist/compose.d.ts.map +1 -0
  5. package/dist/compose.js +308 -0
  6. package/dist/compose.js.map +1 -0
  7. package/dist/config.d.ts +29 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +305 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/errors.d.ts +50 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/errors.js +99 -0
  14. package/dist/errors.js.map +1 -0
  15. package/dist/ffmpeg.d.ts +64 -0
  16. package/dist/ffmpeg.d.ts.map +1 -0
  17. package/dist/ffmpeg.js +292 -0
  18. package/dist/ffmpeg.js.map +1 -0
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +837 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/jobs/store.d.ts +124 -0
  24. package/dist/jobs/store.d.ts.map +1 -0
  25. package/dist/jobs/store.js +386 -0
  26. package/dist/jobs/store.js.map +1 -0
  27. package/dist/providers/ark.d.ts +26 -0
  28. package/dist/providers/ark.d.ts.map +1 -0
  29. package/dist/providers/ark.js +178 -0
  30. package/dist/providers/ark.js.map +1 -0
  31. package/dist/providers/dashscope.d.ts +28 -0
  32. package/dist/providers/dashscope.d.ts.map +1 -0
  33. package/dist/providers/dashscope.js +200 -0
  34. package/dist/providers/dashscope.js.map +1 -0
  35. package/dist/providers/kling.d.ts +46 -0
  36. package/dist/providers/kling.d.ts.map +1 -0
  37. package/dist/providers/kling.js +245 -0
  38. package/dist/providers/kling.js.map +1 -0
  39. package/dist/providers/models.d.ts +16 -0
  40. package/dist/providers/models.d.ts.map +1 -0
  41. package/dist/providers/models.js +152 -0
  42. package/dist/providers/models.js.map +1 -0
  43. package/dist/providers/newapi.d.ts +3 -0
  44. package/dist/providers/newapi.d.ts.map +1 -0
  45. package/dist/providers/newapi.js +203 -0
  46. package/dist/providers/newapi.js.map +1 -0
  47. package/dist/providers/openrouter.d.ts +21 -0
  48. package/dist/providers/openrouter.d.ts.map +1 -0
  49. package/dist/providers/openrouter.js +169 -0
  50. package/dist/providers/openrouter.js.map +1 -0
  51. package/dist/providers/request.d.ts +4 -0
  52. package/dist/providers/request.d.ts.map +1 -0
  53. package/dist/providers/request.js +20 -0
  54. package/dist/providers/request.js.map +1 -0
  55. package/dist/providers/task.d.ts +53 -0
  56. package/dist/providers/task.d.ts.map +1 -0
  57. package/dist/providers/task.js +209 -0
  58. package/dist/providers/task.js.map +1 -0
  59. package/dist/render.d.ts +53 -0
  60. package/dist/render.d.ts.map +1 -0
  61. package/dist/render.js +480 -0
  62. package/dist/render.js.map +1 -0
  63. package/dist/text-layer.d.ts +18 -0
  64. package/dist/text-layer.d.ts.map +1 -0
  65. package/dist/text-layer.js +168 -0
  66. package/dist/text-layer.js.map +1 -0
  67. package/dist/timeline-render.d.ts +33 -0
  68. package/dist/timeline-render.d.ts.map +1 -0
  69. package/dist/timeline-render.js +1051 -0
  70. package/dist/timeline-render.js.map +1 -0
  71. package/dist/timeline.d.ts +64 -0
  72. package/dist/timeline.d.ts.map +1 -0
  73. package/dist/timeline.js +246 -0
  74. package/dist/timeline.js.map +1 -0
  75. package/dist/tts/edge-tts.d.ts +22 -0
  76. package/dist/tts/edge-tts.d.ts.map +1 -0
  77. package/dist/tts/edge-tts.js +55 -0
  78. package/dist/tts/edge-tts.js.map +1 -0
  79. package/dist/types.d.ts +161 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +13 -0
  82. package/dist/types.js.map +1 -0
  83. package/package.json +93 -0
  84. package/preview.png +0 -0
  85. package/skills/video-gen/SKILL.md +284 -0
package/dist/config.js ADDED
@@ -0,0 +1,305 @@
1
+ import { resolve } from 'node:path';
2
+ import { loadPiSettings } from '@amaster.ai/pi-shared/settings';
3
+ import { providerLabel, VideoGenError } from './errors.js';
4
+ import { ARK_DEFAULT_BASE_URL } from './providers/ark.js';
5
+ import { DASHSCOPE_DEFAULT_BASE_URL } from './providers/dashscope.js';
6
+ import { KLING_DEFAULT_BASE_URL } from './providers/kling.js';
7
+ import { BUILT_IN_VIDEO_MODELS, findBuiltInModel } from './providers/models.js';
8
+ import { OPENROUTER_DEFAULT_BASE_URL } from './providers/openrouter.js';
9
+ const SETTINGS_KEY = 'pi-video-gen';
10
+ /**
11
+ * Keys a project-level settings file may set. Everything else — notably
12
+ * `providers.*.baseUrl/apiKey` and `ffmpegPath` — is accepted ONLY from the
13
+ * global and agent-dir layers, even when the project is trusted: a malicious
14
+ * repo must not be able to redirect paid API traffic (and the key that comes
15
+ * with it) to an attacker endpoint, or swap the ffmpeg binary.
16
+ */
17
+ const PROJECT_ALLOWED_KEYS = new Set(['outputDir', 'defaultModel', 'rateLimit', 'concurrency']);
18
+ // Single source of truth: each adapter owns its default endpoint. `newapi`
19
+ // is absent ON PURPOSE — it is a self-hosted relay with no public default, so
20
+ // a missing baseUrl is a configuration error (see requireBaseUrl).
21
+ const PROVIDER_DEFAULT_BASE_URLS = {
22
+ ark: ARK_DEFAULT_BASE_URL,
23
+ kling: KLING_DEFAULT_BASE_URL,
24
+ dashscope: DASHSCOPE_DEFAULT_BASE_URL,
25
+ openrouter: OPENROUTER_DEFAULT_BASE_URL,
26
+ };
27
+ /** Resolve the effective base URL, failing clearly when the style mandates one. */
28
+ function requireBaseUrl(style, configured, settingsPath) {
29
+ const baseUrl = configured ?? PROVIDER_DEFAULT_BASE_URLS[style];
30
+ if (!baseUrl) {
31
+ throw new VideoGenError(`${providerLabel(style)} is a self-hosted relay with no default endpoint. Set "${settingsPath}" to your server address (e.g. "https://newapi.example.com") in global or agent-dir Pi settings, then retry.`, `config: ${style} requires baseUrl`);
32
+ }
33
+ return baseUrl;
34
+ }
35
+ function settingsSection(value, path) {
36
+ if (value === undefined)
37
+ return undefined;
38
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
39
+ throw new VideoGenError(`${path} must be an object in pi-video-gen settings.`, `config: invalid ${path}`);
40
+ }
41
+ return value;
42
+ }
43
+ function positiveInteger(value, path) {
44
+ if (value !== undefined &&
45
+ (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0)) {
46
+ throw new VideoGenError(`${path} must be a positive integer in pi-video-gen settings.`, `config: invalid ${path}`);
47
+ }
48
+ }
49
+ function nonNegativeInteger(value, path) {
50
+ if (value !== undefined &&
51
+ (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0)) {
52
+ throw new VideoGenError(`${path} must be a non-negative integer in pi-video-gen settings.`, `config: invalid ${path}`);
53
+ }
54
+ }
55
+ function optionalString(value, path) {
56
+ if (value !== undefined && (typeof value !== 'string' || value.trim() === '')) {
57
+ throw new VideoGenError(`${path} must be a non-empty string in pi-video-gen settings.`, `config: invalid ${path}`);
58
+ }
59
+ }
60
+ function stringArray(value, path) {
61
+ if (!Array.isArray(value) ||
62
+ value.length === 0 ||
63
+ value.some((item) => typeof item !== 'string' || item.trim() === '')) {
64
+ throw new VideoGenError(`${path} must be a non-empty array of strings in pi-video-gen settings.`, `config: invalid ${path}`);
65
+ }
66
+ }
67
+ function optionalHttpUrl(value, path) {
68
+ optionalString(value, path);
69
+ if (value === undefined)
70
+ return;
71
+ try {
72
+ const url = new URL(value);
73
+ if (url.protocol !== 'http:' && url.protocol !== 'https:')
74
+ throw new Error();
75
+ }
76
+ catch {
77
+ throw new VideoGenError(`${path} must be an http(s) URL in pi-video-gen settings.`, `config: invalid ${path}`);
78
+ }
79
+ }
80
+ function validateCapabilities(value, path) {
81
+ if (value === undefined)
82
+ return;
83
+ const caps = settingsSection(value, path);
84
+ nonNegativeInteger(caps.maxReferenceImages, `${path}.maxReferenceImages`);
85
+ if (caps.durations !== undefined) {
86
+ if (!Array.isArray(caps.durations) ||
87
+ caps.durations.length !== 2 ||
88
+ caps.durations.some((item) => typeof item !== 'number' || !Number.isSafeInteger(item)) ||
89
+ caps.durations[0] <= 0 ||
90
+ caps.durations[1] < caps.durations[0]) {
91
+ throw new VideoGenError(`${path}.durations must be an increasing [min, max] pair of positive integers.`, `config: invalid ${path}.durations`);
92
+ }
93
+ }
94
+ if (caps.resolutions !== undefined)
95
+ stringArray(caps.resolutions, `${path}.resolutions`);
96
+ if (caps.aspectRatios !== undefined)
97
+ stringArray(caps.aspectRatios, `${path}.aspectRatios`);
98
+ for (const key of ['nativeAudio', 'supportsFirstLastFrame']) {
99
+ if (caps[key] !== undefined && typeof caps[key] !== 'boolean') {
100
+ throw new VideoGenError(`${path}.${key} must be a boolean in pi-video-gen settings.`, `config: invalid ${path}.${key}`);
101
+ }
102
+ }
103
+ }
104
+ const WIRE_FORMATS = ['ark', 'kling', 'dashscope', 'openrouter', 'newapi'];
105
+ function validateCustomProviders(value) {
106
+ if (value === undefined)
107
+ return;
108
+ const cps = settingsSection(value, 'customProviders');
109
+ for (const [name, cp] of Object.entries(cps)) {
110
+ const section = settingsSection(cp, `customProviders.${name}`);
111
+ const api = section.api;
112
+ if (typeof api !== 'string' || !WIRE_FORMATS.includes(api)) {
113
+ throw new VideoGenError(`customProviders.${name}.api must be one of ${WIRE_FORMATS.join(', ')} in pi-video-gen settings.`, `config: invalid customProviders.${name}.api`);
114
+ }
115
+ if (section.models !== undefined && !Array.isArray(section.models)) {
116
+ throw new VideoGenError(`customProviders.${name}.models must be an array in pi-video-gen settings.`, `config: invalid customProviders.${name}.models`);
117
+ }
118
+ optionalHttpUrl(section.baseUrl, `customProviders.${name}.baseUrl`);
119
+ optionalString(section.apiKey, `customProviders.${name}.apiKey`);
120
+ optionalString(section.name, `customProviders.${name}.name`);
121
+ for (const [index, rawModel] of section.models?.entries() ?? []) {
122
+ const path = `customProviders.${name}.models[${index}]`;
123
+ if (typeof rawModel === 'string') {
124
+ optionalString(rawModel, path);
125
+ continue;
126
+ }
127
+ const model = settingsSection(rawModel, path);
128
+ optionalString(model.id, `${path}.id`);
129
+ if (typeof model.id !== 'string') {
130
+ throw new VideoGenError(`${path}.id must be a non-empty string.`, `config: invalid ${path}.id`);
131
+ }
132
+ optionalString(model.alias, `${path}.alias`);
133
+ optionalString(model.name, `${path}.name`);
134
+ optionalString(model.defaultResolution, `${path}.defaultResolution`);
135
+ optionalString(model.defaultAspectRatio, `${path}.defaultAspectRatio`);
136
+ positiveInteger(model.defaultDurationSec, `${path}.defaultDurationSec`);
137
+ validateCapabilities(model.capabilities, `${path}.capabilities`);
138
+ const caps = model.capabilities;
139
+ if (model.defaultResolution !== undefined &&
140
+ Array.isArray(caps?.resolutions) &&
141
+ !caps.resolutions.includes(model.defaultResolution)) {
142
+ throw new VideoGenError(`${path}.defaultResolution must appear in capabilities.resolutions.`, `config: invalid ${path}.defaultResolution`);
143
+ }
144
+ if (model.defaultAspectRatio !== undefined &&
145
+ Array.isArray(caps?.aspectRatios) &&
146
+ !caps.aspectRatios.includes(model.defaultAspectRatio)) {
147
+ throw new VideoGenError(`${path}.defaultAspectRatio must appear in capabilities.aspectRatios.`, `config: invalid ${path}.defaultAspectRatio`);
148
+ }
149
+ if (typeof model.defaultDurationSec === 'number' &&
150
+ Array.isArray(caps?.durations) &&
151
+ (model.defaultDurationSec < caps.durations[0] ||
152
+ model.defaultDurationSec > caps.durations[1])) {
153
+ throw new VideoGenError(`${path}.defaultDurationSec must be within capabilities.durations.`, `config: invalid ${path}.defaultDurationSec`);
154
+ }
155
+ }
156
+ }
157
+ }
158
+ function validateRuntimeSettings(settings) {
159
+ settingsSection(settings, 'pi-video-gen');
160
+ optionalString(settings.defaultModel, 'defaultModel');
161
+ optionalString(settings.outputDir, 'outputDir');
162
+ optionalString(settings.ffmpegPath, 'ffmpegPath');
163
+ const providers = settingsSection(settings.providers, 'providers');
164
+ for (const style of WIRE_FORMATS) {
165
+ const provider = settingsSection(providers?.[style], `providers.${style}`);
166
+ optionalString(provider?.apiKey, `providers.${style}.apiKey`);
167
+ optionalHttpUrl(provider?.baseUrl, `providers.${style}.baseUrl`);
168
+ }
169
+ const rateLimit = settingsSection(settings.rateLimit, 'rateLimit');
170
+ const concurrency = settingsSection(settings.concurrency, 'concurrency');
171
+ positiveInteger(rateLimit?.maxRequestsPerMinute, 'rateLimit.maxRequestsPerMinute');
172
+ positiveInteger(rateLimit?.maxRequestsPerDay, 'rateLimit.maxRequestsPerDay');
173
+ positiveInteger(concurrency?.clips, 'concurrency.clips');
174
+ validateCustomProviders(settings.customProviders);
175
+ return settings;
176
+ }
177
+ /**
178
+ * Load `pi-video-gen` settings with the trust boundary applied:
179
+ * - untrusted project ⇒ the project layer is ignored entirely;
180
+ * - trusted project ⇒ only PROJECT_ALLOWED_KEYS are honored from the project
181
+ * layer; sensitive keys there are stripped (and reported once to stderr).
182
+ */
183
+ export function loadVideoGenSettings(cwd, projectTrusted) {
184
+ const base = loadPiSettings(SETTINGS_KEY, {
185
+ cwd,
186
+ projectTrusted: false,
187
+ });
188
+ if (!projectTrusted)
189
+ return validateRuntimeSettings(base);
190
+ const merged = loadPiSettings(SETTINGS_KEY, {
191
+ cwd,
192
+ projectTrusted: true,
193
+ strictProjectSettings: true,
194
+ });
195
+ const allowed = {};
196
+ for (const key of PROJECT_ALLOWED_KEYS) {
197
+ if (merged[key] !== base[key]) {
198
+ allowed[key] = merged[key];
199
+ }
200
+ }
201
+ return validateRuntimeSettings({ ...base, ...allowed });
202
+ }
203
+ /** Resolve the provider section for a wire format against built-in defaults. */
204
+ export function resolveProvider(settings, style) {
205
+ const section = settings.providers?.[style] ?? {};
206
+ return {
207
+ style,
208
+ apiKey: section.apiKey,
209
+ apiKeyPath: `pi-video-gen.providers.${style}.apiKey`,
210
+ baseUrl: requireBaseUrl(style, section.baseUrl, `pi-video-gen.providers.${style}.baseUrl`),
211
+ };
212
+ }
213
+ /**
214
+ * Conservative capabilities for custom models declared as a bare string (or
215
+ * with a partial capabilities object): text-to-video + first frame only, no
216
+ * audio, no last-frame interpolation, 720p/16:9. Declare full capabilities in
217
+ * the custom model object to lift these.
218
+ */
219
+ const CONSERVATIVE_CUSTOM_CAPABILITIES = {
220
+ maxReferenceImages: 1,
221
+ durations: [4, 15],
222
+ resolutions: ['720p'],
223
+ aspectRatios: ['16:9'],
224
+ nativeAudio: false,
225
+ supportsFirstLastFrame: false,
226
+ };
227
+ function resolveCustomModel(settings, wanted) {
228
+ const needle = wanted.trim().toLowerCase();
229
+ for (const [providerName, cp] of Object.entries(settings.customProviders ?? {})) {
230
+ for (const m of cp.models ?? []) {
231
+ const model = typeof m === 'string' ? { id: m } : m;
232
+ const matches = model.id.toLowerCase() === needle ||
233
+ (model.alias != null && model.alias.toLowerCase() === needle);
234
+ if (!matches)
235
+ continue;
236
+ const capabilities = { ...CONSERVATIVE_CUSTOM_CAPABILITIES, ...(model.capabilities ?? {}) };
237
+ return {
238
+ entry: {
239
+ id: model.id,
240
+ aliases: model.alias ? [model.alias] : [],
241
+ provider: cp.api,
242
+ capabilities,
243
+ defaultResolution: model.defaultResolution ?? capabilities.resolutions[0],
244
+ defaultAspectRatio: model.defaultAspectRatio ?? capabilities.aspectRatios[0],
245
+ defaultDurationSec: model.defaultDurationSec ?? capabilities.durations[0],
246
+ },
247
+ remoteId: model.id,
248
+ provider: {
249
+ style: cp.api,
250
+ apiKey: cp.apiKey,
251
+ apiKeyPath: `pi-video-gen.customProviders.${providerName}.apiKey`,
252
+ baseUrl: requireBaseUrl(cp.api, cp.baseUrl, `pi-video-gen.customProviders.${providerName}.baseUrl`),
253
+ },
254
+ };
255
+ }
256
+ }
257
+ return null;
258
+ }
259
+ /**
260
+ * Resolve a model id/alias (defaulting to settings.defaultModel, then
261
+ * 'seedance'). Built-in registry wins over custom provider models on conflict.
262
+ */
263
+ export function resolveModel(settings, modelId) {
264
+ const wanted = modelId ?? settings.defaultModel ?? 'seedance';
265
+ const entry = findBuiltInModel(wanted);
266
+ if (entry) {
267
+ return {
268
+ entry,
269
+ remoteId: entry.remoteId ?? entry.id,
270
+ provider: resolveProvider(settings, entry.provider),
271
+ };
272
+ }
273
+ return resolveCustomModel(settings, wanted);
274
+ }
275
+ /** Registry view for the video_capabilities tool / `/video-gen models`. */
276
+ export function listModelRegistry(settings) {
277
+ const wanted = settings.defaultModel ?? 'seedance';
278
+ const active = resolveModel(settings, wanted);
279
+ return {
280
+ activeId: active?.entry.id ?? wanted,
281
+ activeResolved: active != null,
282
+ models: [
283
+ ...BUILT_IN_VIDEO_MODELS.map((m) => ({
284
+ id: m.id,
285
+ aliases: m.aliases,
286
+ provider: m.provider,
287
+ keyReady: resolveProvider(settings, m.provider).apiKey != null,
288
+ })),
289
+ ...Object.entries(settings.customProviders ?? {}).flatMap(([providerName, cp]) => (cp.models ?? []).map((m) => {
290
+ const model = typeof m === 'string' ? { id: m } : m;
291
+ return {
292
+ id: model.id,
293
+ aliases: model.alias ? [model.alias] : [],
294
+ provider: `${providerName}(${cp.api})`,
295
+ keyReady: cp.apiKey != null,
296
+ };
297
+ })),
298
+ ],
299
+ };
300
+ }
301
+ /** Job root directory (absolute). */
302
+ export function resolveOutputDir(settings, cwd) {
303
+ return resolve(cwd, settings.outputDir ?? '.video-gen');
304
+ }
305
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;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+ import type { VideoApiStyle } from './types.js';
2
+ /**
3
+ * Trust boundary for the whole extension, modeled on pi-image-gen's errors.ts.
4
+ * Raw provider bodies — and plain `fs`/`fetch` errors, which embed absolute
5
+ * paths, errno strings, or signed `?token=…` URLs — must reach NEITHER the
6
+ * user/LLM surface NOR a log. Every EXPECTED failure is thrown as a
7
+ * `VideoGenError`, the only value whose text is vetted body-free, carrying two
8
+ * curated views: `message` (LLM-facing) and `logSummary` (stderr-facing).
9
+ */
10
+ export declare class VideoGenError extends Error {
11
+ readonly logSummary: string;
12
+ constructor(message: string, logSummary: string);
13
+ }
14
+ /**
15
+ * Marker for "the submit may (or may not) have created a paid remote task".
16
+ * Render orchestration must NOT auto-resubmit on this — the shot is parked in
17
+ * an `ambiguous` state until the user confirms the provider side is clean.
18
+ */
19
+ export declare class AmbiguousSubmitError extends VideoGenError {
20
+ }
21
+ /** Marker for inspect failures that are safe and useful to retry locally. */
22
+ export declare class RetryableProviderError extends VideoGenError {
23
+ }
24
+ /** Marker for a remote task that reached a definitive terminal failure. */
25
+ export declare class RemoteTaskFailedError extends VideoGenError {
26
+ readonly providerMessage: string;
27
+ constructor(message: string, logSummary: string, providerMessage: string);
28
+ }
29
+ /** Marker for a persisted task handle the provider definitively cannot find. */
30
+ export declare class RemoteTaskNotFoundError extends VideoGenError {
31
+ }
32
+ /** stderr sink: a VideoGenError's curated summary, else a fixed label. */
33
+ export declare function toLogSummary(error: unknown): string;
34
+ /** user/LLM sink: a VideoGenError's vetted message, else a fixed sentence. */
35
+ export declare function errorMessageForUser(error: unknown): string;
36
+ /**
37
+ * Reduce a URL to `scheme://host/path`, dropping the query (where signed
38
+ * credentials live), the fragment, and any userinfo.
39
+ */
40
+ export declare function redactUrl(raw: string): string;
41
+ /** Return a filename without leaking POSIX or Windows parent directories. */
42
+ export declare function safeBasename(path: string): string;
43
+ export declare function providerLabel(style: VideoApiStyle): string;
44
+ /** Missing-API-key error naming the exact settings path / env var to fix. */
45
+ export declare function missingKeyError(style: VideoApiStyle, envVar: string, apiKeyPath?: string): VideoGenError;
46
+ /** HTTP status error with NO response body attached (bodies may carry secrets). */
47
+ export declare function httpStatusError(style: VideoApiStyle, action: string, status: number): VideoGenError;
48
+ /** Network-level failure (no HTTP status). Message stays free of error.message paths. */
49
+ export declare function networkError(style: VideoApiStyle, action: string): VideoGenError;
50
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAChB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;CAAG;AAE1D,6EAA6E;AAC7E,qBAAa,sBAAuB,SAAQ,aAAa;CAAG;AAE5D,2EAA2E;AAC3E,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBACrB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;CAIzE;AAED,gFAAgF;AAChF,qBAAa,uBAAwB,SAAQ,aAAa;CAAG;AAE7D,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGnD;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAG1D;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO7C;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAUD,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,MAAM,EACd,UAAU,SAA2C,GACpD,aAAa,CAKf;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,aAAa,CAiBf;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAKhF"}
package/dist/errors.js ADDED
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Trust boundary for the whole extension, modeled on pi-image-gen's errors.ts.
3
+ * Raw provider bodies — and plain `fs`/`fetch` errors, which embed absolute
4
+ * paths, errno strings, or signed `?token=…` URLs — must reach NEITHER the
5
+ * user/LLM surface NOR a log. Every EXPECTED failure is thrown as a
6
+ * `VideoGenError`, the only value whose text is vetted body-free, carrying two
7
+ * curated views: `message` (LLM-facing) and `logSummary` (stderr-facing).
8
+ */
9
+ export class VideoGenError extends Error {
10
+ logSummary;
11
+ constructor(message, logSummary) {
12
+ super(message);
13
+ this.name = 'VideoGenError';
14
+ this.logSummary = logSummary.split(/[\r\n]/, 1)[0] || 'video generation failed';
15
+ }
16
+ }
17
+ /**
18
+ * Marker for "the submit may (or may not) have created a paid remote task".
19
+ * Render orchestration must NOT auto-resubmit on this — the shot is parked in
20
+ * an `ambiguous` state until the user confirms the provider side is clean.
21
+ */
22
+ export class AmbiguousSubmitError extends VideoGenError {
23
+ }
24
+ /** Marker for inspect failures that are safe and useful to retry locally. */
25
+ export class RetryableProviderError extends VideoGenError {
26
+ }
27
+ /** Marker for a remote task that reached a definitive terminal failure. */
28
+ export class RemoteTaskFailedError extends VideoGenError {
29
+ providerMessage;
30
+ constructor(message, logSummary, providerMessage) {
31
+ super(message, logSummary);
32
+ this.providerMessage = providerMessage;
33
+ }
34
+ }
35
+ /** Marker for a persisted task handle the provider definitively cannot find. */
36
+ export class RemoteTaskNotFoundError extends VideoGenError {
37
+ }
38
+ /** stderr sink: a VideoGenError's curated summary, else a fixed label. */
39
+ export function toLogSummary(error) {
40
+ if (error instanceof VideoGenError)
41
+ return error.logSummary;
42
+ return error instanceof Error ? 'unexpected error' : 'unexpected non-error throw';
43
+ }
44
+ /** user/LLM sink: a VideoGenError's vetted message, else a fixed sentence. */
45
+ export function errorMessageForUser(error) {
46
+ if (error instanceof VideoGenError)
47
+ return error.message;
48
+ return 'Video generation failed unexpectedly. Retry once; if it persists, report a pi-video-gen bug.';
49
+ }
50
+ /**
51
+ * Reduce a URL to `scheme://host/path`, dropping the query (where signed
52
+ * credentials live), the fragment, and any userinfo.
53
+ */
54
+ export function redactUrl(raw) {
55
+ try {
56
+ const u = new URL(raw);
57
+ return `${u.protocol}//${u.host}${u.pathname}`;
58
+ }
59
+ catch {
60
+ return '<url>';
61
+ }
62
+ }
63
+ /** Return a filename without leaking POSIX or Windows parent directories. */
64
+ export function safeBasename(path) {
65
+ return path.split(/[\\/]/).pop() || 'file';
66
+ }
67
+ const PROVIDER_LABELS = {
68
+ ark: 'Volcengine Ark',
69
+ kling: 'Kling',
70
+ dashscope: 'DashScope',
71
+ openrouter: 'OpenRouter',
72
+ newapi: 'NewAPI',
73
+ };
74
+ export function providerLabel(style) {
75
+ return PROVIDER_LABELS[style];
76
+ }
77
+ /** Missing-API-key error naming the exact settings path / env var to fix. */
78
+ export function missingKeyError(style, envVar, apiKeyPath = `pi-video-gen.providers.${style}.apiKey`) {
79
+ return new VideoGenError(`No API key configured for ${providerLabel(style)}. Set "${apiKeyPath}" in global or agent-dir Pi settings — "${`$\{${envVar}}`}" interpolation is supported — then retry.`, `${providerLabel(style)}: missing api key`);
80
+ }
81
+ /** HTTP status error with NO response body attached (bodies may carry secrets). */
82
+ export function httpStatusError(style, action, status) {
83
+ const hint = status === 401 || status === 403
84
+ ? ' Check the API key.'
85
+ : status === 429
86
+ ? ' Rate limited — lower concurrency or wait.'
87
+ : '';
88
+ const ErrorType = action === 'inspect' && status === 404
89
+ ? RemoteTaskNotFoundError
90
+ : status === 429 || status >= 500
91
+ ? RetryableProviderError
92
+ : VideoGenError;
93
+ return new ErrorType(`${providerLabel(style)} ${action} failed with HTTP ${status}.${hint}`, `${providerLabel(style)} ${action} HTTP ${status}`);
94
+ }
95
+ /** Network-level failure (no HTTP status). Message stays free of error.message paths. */
96
+ export function networkError(style, action) {
97
+ return new RetryableProviderError(`${providerLabel(style)} ${action} failed: network error. Check connectivity and retry.`, `${providerLabel(style)} ${action} network error`);
98
+ }
99
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,UAAU,CAAS;IAC5B,YAAY,OAAe,EAAE,UAAkB;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,yBAAyB,CAAC;IAClF,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;CAAG;AAE1D,6EAA6E;AAC7E,MAAM,OAAO,sBAAuB,SAAQ,aAAa;CAAG;AAE5D,2EAA2E;AAC3E,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IAC7C,eAAe,CAAS;IACjC,YAAY,OAAe,EAAE,UAAkB,EAAE,eAAuB;QACtE,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;CACF;AAED,gFAAgF;AAChF,MAAM,OAAO,uBAAwB,SAAQ,aAAa;CAAG;AAE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CAAC,UAAU,UAAU,2CAA2C,MAAM,MAAM,GAAG,4CAA4C,EAC3K,GAAG,aAAa,CAAC,KAAK,CAAC,mBAAmB,CAC3C,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,eAAe,CAC7B,KAAoB,EACpB,MAAc,EACd,MAAc;IAEd,MAAM,IAAI,GACR,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG;QAC9B,CAAC,CAAC,qBAAqB;QACvB,CAAC,CAAC,MAAM,KAAK,GAAG;YACd,CAAC,CAAC,4CAA4C;YAC9C,CAAC,CAAC,EAAE,CAAC;IACX,MAAM,SAAS,GACb,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,GAAG;QACpC,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,MAAM,KAAK,GAAG,IAAI,MAAM,IAAI,GAAG;YAC/B,CAAC,CAAC,sBAAsB;YACxB,CAAC,CAAC,aAAa,CAAC;IACtB,OAAO,IAAI,SAAS,CAClB,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,MAAM,qBAAqB,MAAM,IAAI,IAAI,EAAE,EACtE,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,MAAM,SAAS,MAAM,EAAE,CACnD,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,MAAc;IAC/D,OAAO,IAAI,sBAAsB,CAC/B,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,MAAM,uDAAuD,EACxF,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,MAAM,gBAAgB,CAClD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * ffmpeg resolution and video assembly.
3
+ *
4
+ * Resolution order: `pi-video-gen.ffmpegPath` (sensitive — global / agent-dir
5
+ * settings only) → `FFMPEG_PATH` env → platform-specific optional npm package
6
+ * → `ffmpeg-static` in node_modules (dev fallback) → `ffmpeg` on PATH. The
7
+ * doctor reports which source resolved.
8
+ */
9
+ export type FfmpegSource = 'settings' | 'env' | 'bundled' | 'path';
10
+ export type FfmpegResolution = {
11
+ path: string;
12
+ source: FfmpegSource;
13
+ runnable: boolean;
14
+ };
15
+ /**
16
+ * Resolve ffprobe as the SIBLING of the resolved ffmpeg (same directory),
17
+ * falling back to `ffprobe` on PATH. Platform packages ship both binaries.
18
+ */
19
+ /**
20
+ * Resolve the GPL ffmpeg variant (with libx264) as the sibling of the
21
+ * resolved ffmpeg named `ffmpeg-gpl`. Required for h264 output — the LGPL
22
+ * build intentionally has no x264 encoder.
23
+ */
24
+ export declare function resolveGplFfmpeg(settingsPath?: string | undefined): FfmpegResolution;
25
+ export declare function resolveFfprobe(settingsPath?: string | undefined): FfmpegResolution;
26
+ export declare function resolveFfmpeg(settingsPath?: string | undefined): FfmpegResolution;
27
+ export type StreamInfo = {
28
+ videoCodec: string;
29
+ width: number;
30
+ height: number;
31
+ fps: string;
32
+ timebase: string;
33
+ pixFmt: string;
34
+ audioLayout: string;
35
+ /** Extra incompatibility vectors beyond the first video track. */
36
+ streamCount: number;
37
+ audioSampleRate: string;
38
+ audioTimebase: string;
39
+ subtitleCodec: string;
40
+ streamSignatures: string[];
41
+ };
42
+ /** Probe a media file's stream signature for strict-copy compatibility checks. */
43
+ export declare function probeStreams(ffprobePath: string, filePath: string, signal?: AbortSignal): Promise<StreamInfo>;
44
+ /** ffprobe the container duration of a media file, in seconds. */
45
+ export declare function probeDuration(ffprobePath: string, filePath: string, signal?: AbortSignal): Promise<number>;
46
+ /** Probe the first video stream's duration (container audio may be longer). */
47
+ export declare function probeVideoDuration(ffprobePath: string, filePath: string, signal?: AbortSignal): Promise<number>;
48
+ /** Public ffmpeg runner used by the timeline pipeline (arbitrary arg lists). */
49
+ export declare function runFfmpegCommand(ffmpegPath: string, args: string[], signal?: AbortSignal): Promise<void>;
50
+ /**
51
+ * Concatenate shot clips into the final video. Tries the lossless concat
52
+ * demuxer (`-c copy`) first — same-codec clips join in seconds without
53
+ * re-encoding; falls back to an mpeg4 re-encode when codecs/params differ
54
+ * (mpeg4 is LGPL-clean — libx264 would REQUIRE a GPL build of ffmpeg).
55
+ */
56
+ export declare function concatVideos(opts: {
57
+ inputs: string[];
58
+ outputPath: string;
59
+ ffmpegPath: string;
60
+ signal?: AbortSignal | undefined;
61
+ /** C0 compose: copy ONLY — report failure instead of re-encoding. */
62
+ strictCopy?: boolean | undefined;
63
+ }): Promise<void>;
64
+ //# sourceMappingURL=ffmpeg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ffmpeg.d.ts","sourceRoot":"","sources":["../src/ffmpeg.ts"],"names":[],"mappings":"AAiCA;;;;;;;GAOG;AAEH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAYpF;AAED,wBAAgB,cAAc,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAYlF;AAED,wBAAgB,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAejF;AAwBD,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAA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