@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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,196 @@
1
+ # pi-video-gen
2
+
3
+ Pi extension for agentic video generation. Ships the single-clip primitive
4
+ (`video_generate`), the multi-shot render pipeline (`video_render`), local
5
+ lossless clip composing and mixed-media promo timelines with overlays, TTS,
6
+ soft or burned subtitles, source-video audio, and BGM (`video_compose`), the read-only
7
+ `video_capabilities` query, a `/video-gen` command, and the `video-gen` skill
8
+ that orchestrates the full shot-book workflow together with
9
+ [pi-image-gen](../pi-image-gen) (all image work).
10
+
11
+ ## Providers
12
+
13
+ | Wire format | Models | Status |
14
+ |---|---|---|
15
+ | `ark` (Volcengine Ark) | Seedance 2.0 standard / fast / mini | ✅ built-in |
16
+ | `dashscope` (Alibaba) | HappyHorse 1.1 / 1.0 (t2v/i2v/r2v auto-routed) | ✅ built-in |
17
+ | `kling` (Kuaishou) | Kling 3.0 Turbo / 3.0 Omni (API 2.0) | ✅ built-in |
18
+ | `openrouter` | google/veo-3.1 (+ custom models) | ✅ built-in |
19
+ | `newapi` | self-hosted NewAPI relay (Kling / Jimeng / Vidu / Gemini channels) | ✅ via `customProviders` — `baseUrl` **required** |
20
+ | custom | your own endpoints | ✅ via `customProviders` |
21
+
22
+ Registry entries are written against provider documentation (each adapter's
23
+ header notes the source) and are pending live smoke tests against real
24
+ accounts — verify with `/video-gen doctor` + one small paid clip before heavy
25
+ use. Seedance 2.5 stays on the roadmap until its official API ID and parameter
26
+ contract are published.
27
+
28
+ ## Setup
29
+
30
+ Global settings (`~/.pi/agent/settings.json`):
31
+
32
+ ```jsonc
33
+ {
34
+ "pi-video-gen": {
35
+ "defaultModel": "seedance", // alias of doubao-seedance-2-0-260128
36
+ "providers": {
37
+ "ark": { "apiKey": "${ARK_API_KEY}" } // Volcengine Ark key
38
+ },
39
+ "rateLimit": { "maxRequestsPerMinute": 2, "maxRequestsPerDay": 20 },
40
+ "concurrency": { "clips": 2 }
41
+ }
42
+ }
43
+ ```
44
+
45
+ **Custom providers** (same idea as pi-image-gen's — point any Ark-compatible
46
+ endpoint at your own models; string models get conservative capabilities,
47
+ object models declare them):
48
+
49
+ ```jsonc
50
+ {
51
+ "pi-video-gen": {
52
+ "defaultModel": "fast9",
53
+ "customProviders": {
54
+ "myproxy": {
55
+ "api": "ark",
56
+ "baseUrl": "https://proxy.example/api/v3",
57
+ "apiKey": "${MY_PROXY_KEY}",
58
+ "models": [
59
+ "seedance-lite-x",
60
+ { "id": "remote-model-9", "alias": "fast9",
61
+ "capabilities": { "maxReferenceImages": 2, "durations": [2, 30],
62
+ "resolutions": ["480p", "720p", "1080p"], "aspectRatios": ["16:9", "9:16"],
63
+ "nativeAudio": true, "supportsFirstLastFrame": true } }
64
+ ]
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ **NewAPI notes** ([video format docs](https://www.newapi.ai/zh/docs/api/ai-model/videos/createvideogeneration)):
72
+ NewAPI is a self-hosted relay, so the `newapi` wire format has NO default
73
+ endpoint — `baseUrl` is mandatory and resolution fails with the exact
74
+ settings path to fix when it is absent. Both the server root
75
+ (`"https://newapi.example.com"`) and the OpenAI-style `"…/v1"` form are
76
+ accepted. Channel-specific parameters ride in `metadata` following the
77
+ upstream doc examples: `aspect_ratio` + `resolution` (Jimeng/Vidu style),
78
+ `image_tail` for the last frame (Kling style) and `image_urls` for extra
79
+ reference images (Jimeng style); the first frame goes in the top-level
80
+ `image` field. There is no documented audio toggle or idempotency key, so
81
+ ambiguous submits are parked for manual resolution rather than auto-retried:
82
+
83
+ ```jsonc
84
+ {
85
+ "pi-video-gen": {
86
+ "defaultModel": "kling-v1",
87
+ "customProviders": {
88
+ "newapi": {
89
+ "api": "newapi",
90
+ "baseUrl": "https://newapi.example.com", // REQUIRED
91
+ "apiKey": "${NEWAPI_API_KEY}",
92
+ "models": ["kling-v1", "jimeng_vgfm_t2v_l20", "viduq1"]
93
+ }
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ **Kling notes** (verified against kling.ai/document-api via browser, 2026-07):
100
+ current Kling API 2.0 uses a plain API key (`providers.kling.apiKey`, env
101
+ `KLING_API_KEY`) — the JWT ak/sk scheme is legacy. The model lives in the URL
102
+ path (`kling-3.0-turbo` / `kling-3.0`); default base is
103
+ `api-singapore.klingai.com` (regional endpoints via `baseUrl`). Kling 3.0 Omni
104
+ supports last-frame, native audio and 4k; Turbo is first-frame-only and
105
+ silent. Submits carry `external_task_id` (our request fingerprint), so
106
+ ambiguous failures are looked up first; an inconclusive lookup is parked for
107
+ manual resolution rather than blindly resubmitted.
108
+
109
+ **HappyHorse notes**: no native audio and no last-frame interpolation
110
+ (`nativeAudio: false`, `supportsFirstLastFrame: false` in the capability table,
111
+ so the tools hide/reject those options). One call takes either a first frame
112
+ (i2v) OR reference images (r2v, prompt them as `[Image 1]`, `[Image 2]`, …),
113
+ not both. The default endpoint is the classic `dashscope.aliyuncs.com` (no
114
+ workspace id needed); if you use a new Bailian workspace, set
115
+ `providers.dashscope.baseUrl` to `https://{workspaceId}.cn-beijing.maas.aliyuncs.com`.
116
+ Video/task URLs expire after 24h — clips are downloaded immediately.
117
+
118
+ **Trust boundary**: `providers.*`, `customProviders.*` and `ffmpegPath` are
119
+ honored ONLY from global / agent-dir settings — project-level
120
+ `.pi/settings.json` can set `outputDir`, `defaultModel`, `rateLimit`,
121
+ `concurrency` only (and only when the project is trusted). A malicious repo
122
+ cannot redirect your API key or swap binaries.
123
+
124
+ **ffmpeg**: required for multi-shot concat and installed automatically with
125
+ the plugin through a platform-specific optional npm package. The main plugin
126
+ stays small, while `pi install npm:@amaster.ai/pi-video-gen` downloads only
127
+ the platform payload matching the current OS and CPU. That payload contains a
128
+ default LGPL build plus separately named GPL `ffmpeg-gpl`/`ffprobe-gpl`
129
+ binaries with libx264 for requested H.264 timeline output. Supported bundled
130
+ targets are macOS 11+ arm64/x64, glibc Linux arm64/x64 (built on Ubuntu 22.04),
131
+ and Windows x64; musl Linux uses a system FFmpeg through PATH. Resolution order:
132
+ `ffmpegPath` setting → `FFMPEG_PATH` env → installed platform package →
133
+ ffmpeg-static (development only) → PATH. An automatic bundled candidate that
134
+ is present but not runnable is skipped so it cannot mask a working PATH
135
+ installation. Check with `/video-gen doctor`.
136
+ Release CI builds every platform package from the pinned official FFmpeg
137
+ source with external-library autodetection disabled; the exact FFmpeg, zlib,
138
+ and x264 source archives, build script, licenses, and provenance ship beside
139
+ the binaries.
140
+
141
+ ## Tools
142
+
143
+ | Tool | What it does |
144
+ |---|---|
145
+ | `video_compose` | **Local video assembly, no paid models.** C0 (`compose-input.json`): lossless concat of existing compatible mp4 clips with ordered, all-track ffprobe stream precheck. Timeline (`timeline-input.json`): promo from mixed images/video clips + text overlays + Edge TTS narration + image motion + xfade transitions + soft or burned subtitles + source-video audio + optional BGM — local render, near-zero cost. Video segments use a fixed numeric `durationSec`, optional `trimStartSec`, `fit`, and `sourceAudio`; narration that does not fit the selected video window is rejected. Image segments also support `durationSec: "auto"` and kenburns/pan/zoom motion. Timeline TTS failures stop by default; set `ttsFailureMode: "silent-subtitles"` only for an explicit silent-audio degradation that preserves subtitles. An accepted degradation stays cached for that immutable job; the C0 final video and all reusable Timeline artifacts are regular job-local files bound to manifest hashes. |
146
+ | `video_generate` | One short clip from a prompt (+ optional first/last frame images). Paid, minutes per clip. Interrupted after receiving a task id? Resume with the returned `jobId`; an ambiguous submit is parked and never resubmitted automatically. |
147
+ | `video_render` | Multi-shot film from `<jobDir>/render-input.json`: snapshots + hashes all frames, submits one paid task per shot (resume-aware, finished shots never re-bill), downloads clips, ffmpeg-concats into `final_video.mp4`. |
148
+ | `video_capabilities` | Read-only: active model's capability table + registered models. Call before composing prompts or shot books. |
149
+
150
+ ## Commands
151
+
152
+ | Command | What it does |
153
+ |---|---|
154
+ | `/video-gen compose <spec>` | Same as the `video_compose` tool |
155
+ | `/video-gen generate <prompt>` | Same as the `video_generate` tool |
156
+ | `/video-gen render <spec>` | Same as the `video_render` tool |
157
+ | `/video-gen recover <jobId>` | List ambiguous render shots; explicitly `reset` a confirmed-absent task or `adopt <taskId>` found in the provider console |
158
+ | `/video-gen models` | List registered models + key readiness |
159
+ | `/video-gen reload` | Reload settings |
160
+ | `/video-gen doctor` | Environment check (key, ffmpeg+ffprobe, libx264, CJK fonts, `image_generate`, output dir, trust) |
161
+
162
+ ## The shot-book workflow (multi-shot films)
163
+
164
+ Driven by the `video-gen` skill in conversation:
165
+
166
+ 1. **Shot book** — the agent authors a shot book (characters + shots with
167
+ first/last-frame descriptions, motion, audio, continuity) and you review it
168
+ in chat. Default small: 1 scene, 3–5 shots.
169
+ 2. **Frames** — the agent generates character portraits and per-shot frames via
170
+ `image_generate` (pi-image-gen), tracking real returned paths in
171
+ `assets.json`.
172
+ 3. **Render** — after explicit confirmation, ONE `video_render` call pays for
173
+ and stitches everything.
174
+
175
+ ## Jobs on disk
176
+
177
+ ```
178
+ <cwd>/.video-gen/<jobId>/
179
+ ├── render-input.json # immutable spec (revisions = new job dir)
180
+ ├── assets.json # semantic assets ↔ image_generate's real returned paths
181
+ ├── manifest.json # state + per-shot remote handles + frame SHA-256 (atomic, single writer)
182
+ ├── shots/<shotId>/first_frame.png|last_frame.png|video.mp4
183
+ └── final_video.mp4
184
+ ```
185
+
186
+ Crash or cancel mid-render? Rerun the same spec path — the input fingerprint
187
+ (spec + frame hashes + model/provider) is verified, then persisted handles
188
+ resume via `inspect` without re-billing. NOTE: cancelling stops local polling
189
+ only; the remote task may keep running and billable (Ark cancellation support
190
+ is unverified). If submit completion is ambiguous, rerun is blocked until
191
+ `/video-gen recover <jobId>` explicitly resets or adopts the affected shot.
192
+ Single-clip ambiguous submits are also persisted and blocked; check the provider
193
+ console before starting another generation. Single-job resume independently
194
+ recomputes the request fingerprint from its frozen `input.json`; an inspect 404
195
+ keeps the remote handle and parks the job as ambiguous instead of declaring it
196
+ safe to resubmit.
@@ -0,0 +1,43 @@
1
+ import { type ActiveJobs } from './jobs/store.js';
2
+ import type { VideoGenSettings } from './types.js';
3
+ /**
4
+ * C0 compose pipeline (`video_compose`): lossless concat of EXISTING local
5
+ * clips. No paid models, no re-encode, no filters — strict-copy only.
6
+ *
7
+ * Contract (design doc §4.1):
8
+ * - input is `<jobDir>/compose-input.json`; the parent directory IS the job
9
+ * and must live under the video-gen output dir;
10
+ * - the spec is immutable per job: fingerprint covers spec content + every
11
+ * clip's SHA-256 — drift means "start a new job directory";
12
+ * - stream compatibility (codec/resolution/fps/timebase/pix_fmt/audio
13
+ * layout) is verified via ffprobe BEFORE concat; incompatibility reports
14
+ * exact per-clip differences — never a silent transcode, never a paid
15
+ * fallback;
16
+ * - foreground execution, ctx.signal cancellation, exclusive temp files,
17
+ * atomic rename.
18
+ */
19
+ export type ClipComposeClip = {
20
+ id: string;
21
+ path: string;
22
+ };
23
+ export type ClipComposeSpec = {
24
+ clips: ClipComposeClip[];
25
+ output?: {
26
+ mode?: string | undefined;
27
+ } | undefined;
28
+ };
29
+ export type ComposeRunResult = {
30
+ jobId: string;
31
+ finalVideoPath: string;
32
+ clipCount: number;
33
+ resumed: boolean;
34
+ };
35
+ export declare function runCompose(opts: {
36
+ composeSpecPath: string;
37
+ cwd: string;
38
+ settings: VideoGenSettings;
39
+ activeJobs: ActiveJobs;
40
+ signal?: AbortSignal | undefined;
41
+ onUpdate?: ((msg: string) => void) | undefined;
42
+ }): Promise<ComposeRunResult>;
43
+ //# sourceMappingURL=compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,UAAU,EAOhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AA+GF,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAChD,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsR5B"}