@nativestudio/sdk 0.0.0-stage → 0.3.0-rc.11

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 (277) hide show
  1. package/COMPATIBILITY.json +14 -0
  2. package/LICENSE +201 -0
  3. package/dist/BUNDLED_DEPENDENCIES.json +1 -0
  4. package/dist/_chunks/chunk-34GRMUSM.js +1 -0
  5. package/dist/_chunks/chunk-3SWFHYZF.js +1 -0
  6. package/dist/_chunks/chunk-CJEQNH37.js +1 -0
  7. package/dist/_chunks/chunk-DIPWMH32.js +1 -0
  8. package/dist/_chunks/chunk-HTUTYIRU.js +1 -0
  9. package/dist/_chunks/chunk-RK3YLCZP.js +1 -0
  10. package/dist/_chunks/chunk-VPYAXWXY.js +1 -0
  11. package/dist/_types/contracts/accepted-shot.d.ts +27 -0
  12. package/dist/_types/contracts/accepted-visual-source.d.ts +120 -0
  13. package/dist/_types/contracts/agent-execution-lifecycle.d.ts +749 -0
  14. package/dist/_types/contracts/agent-execution-oauth.d.ts +71 -0
  15. package/dist/_types/contracts/agent-execution-registration.d.ts +240 -0
  16. package/dist/_types/contracts/agent-execution-selection.d.ts +107 -0
  17. package/dist/_types/contracts/agent-host-execution.d.ts +706 -0
  18. package/dist/_types/contracts/agent-host-generic-transport.d.ts +12 -0
  19. package/dist/_types/contracts/agent-host.d.ts +226 -0
  20. package/dist/_types/contracts/artifact-discovery.d.ts +242 -0
  21. package/dist/_types/contracts/artifact.d.ts +188 -0
  22. package/dist/_types/contracts/audio.d.ts +335 -0
  23. package/dist/_types/contracts/brief.d.ts +178 -0
  24. package/dist/_types/contracts/caption-render.d.ts +20 -0
  25. package/dist/_types/contracts/caption-transcript.d.ts +102 -0
  26. package/dist/_types/contracts/captions.d.ts +420 -0
  27. package/dist/_types/contracts/clip-framing.d.ts +14 -0
  28. package/dist/_types/contracts/clip-transition.d.ts +6 -0
  29. package/dist/_types/contracts/composition-authoring-guide.d.ts +160 -0
  30. package/dist/_types/contracts/composition-authoring.d.ts +744 -0
  31. package/dist/_types/contracts/composition-finding-locality.d.ts +24 -0
  32. package/dist/_types/contracts/composition-frame-render.d.ts +226 -0
  33. package/dist/_types/contracts/composition-making.d.ts +390 -0
  34. package/dist/_types/contracts/composition-observation.d.ts +239 -0
  35. package/dist/_types/contracts/composition-render-base.d.ts +293 -0
  36. package/dist/_types/contracts/composition-render-observation.d.ts +278 -0
  37. package/dist/_types/contracts/composition-render.d.ts +406 -0
  38. package/dist/_types/contracts/composition-repair.d.ts +451 -0
  39. package/dist/_types/contracts/composition-source-review.d.ts +1042 -0
  40. package/dist/_types/contracts/consistency-profile.d.ts +845 -0
  41. package/dist/_types/contracts/continuity-evaluation.d.ts +48 -0
  42. package/dist/_types/contracts/delivery-completion.d.ts +210 -0
  43. package/dist/_types/contracts/delivery-manifest.d.ts +72 -0
  44. package/dist/_types/contracts/delivery-operations.d.ts +1151 -0
  45. package/dist/_types/contracts/delivery-output-profile.d.ts +12 -0
  46. package/dist/_types/contracts/delivery-summary.d.ts +220 -0
  47. package/dist/_types/contracts/delivery-validation.d.ts +206 -0
  48. package/dist/_types/contracts/device-render.d.ts +77 -0
  49. package/dist/_types/contracts/director-proposal.d.ts +1067 -0
  50. package/dist/_types/contracts/editor-intelligence.d.ts +3374 -0
  51. package/dist/_types/contracts/exploration-recommendation.d.ts +519 -0
  52. package/dist/_types/contracts/external-agent-access.d.ts +93 -0
  53. package/dist/_types/contracts/final-ready.d.ts +301 -0
  54. package/dist/_types/contracts/final-render-profile.d.ts +59 -0
  55. package/dist/_types/contracts/final-render.d.ts +2810 -0
  56. package/dist/_types/contracts/foundation.d.ts +1 -0
  57. package/dist/_types/contracts/generation-contract.d.ts +268 -0
  58. package/dist/_types/contracts/generation-cost.d.ts +70 -0
  59. package/dist/_types/contracts/health.d.ts +6 -0
  60. package/dist/_types/contracts/human-identity.d.ts +162 -0
  61. package/dist/_types/contracts/hyperframe-profile.d.ts +5 -0
  62. package/dist/_types/contracts/ids.d.ts +41 -0
  63. package/dist/_types/contracts/index.d.ts +126 -0
  64. package/dist/_types/contracts/interface/common.d.ts +56 -0
  65. package/dist/_types/contracts/interface/execution-output.d.ts +99 -0
  66. package/dist/_types/contracts/interface/index.d.ts +7 -0
  67. package/dist/_types/contracts/interface/media-output.d.ts +90 -0
  68. package/dist/_types/contracts/interface/operation.d.ts +61 -0
  69. package/dist/_types/contracts/interface/output.d.ts +15 -0
  70. package/dist/_types/contracts/interface/production-snapshot.d.ts +654 -0
  71. package/dist/_types/contracts/interface/query.d.ts +315 -0
  72. package/dist/_types/contracts/keyframe-generation.d.ts +378 -0
  73. package/dist/_types/contracts/keyframe-reference.d.ts +31 -0
  74. package/dist/_types/contracts/keyframe-review.d.ts +753 -0
  75. package/dist/_types/contracts/lifecycle-event-projections.d.ts +191 -0
  76. package/dist/_types/contracts/lifecycle-events.d.ts +156 -0
  77. package/dist/_types/contracts/listening-evidence.d.ts +37 -0
  78. package/dist/_types/contracts/local-execution/agent-context.d.ts +365 -0
  79. package/dist/_types/contracts/local-execution/agent-evidence.d.ts +79 -0
  80. package/dist/_types/contracts/local-execution/agent-grant.d.ts +31 -0
  81. package/dist/_types/contracts/local-execution/agent-review.d.ts +992 -0
  82. package/dist/_types/contracts/local-execution/canonical.d.ts +2 -0
  83. package/dist/_types/contracts/local-execution/common.d.ts +49 -0
  84. package/dist/_types/contracts/local-execution/completion.d.ts +124 -0
  85. package/dist/_types/contracts/local-execution/components.d.ts +45 -0
  86. package/dist/_types/contracts/local-execution/descriptor.d.ts +38 -0
  87. package/dist/_types/contracts/local-execution/device-authority.d.ts +31 -0
  88. package/dist/_types/contracts/local-execution/device-inventory.d.ts +76 -0
  89. package/dist/_types/contracts/local-execution/device-workspace.d.ts +11 -0
  90. package/dist/_types/contracts/local-execution/device.d.ts +102 -0
  91. package/dist/_types/contracts/local-execution/external-generation.d.ts +199 -0
  92. package/dist/_types/contracts/local-execution/index.d.ts +37 -0
  93. package/dist/_types/contracts/local-execution/ipc.d.ts +3730 -0
  94. package/dist/_types/contracts/local-execution/library-command.d.ts +620 -0
  95. package/dist/_types/contracts/local-execution/library-result.d.ts +408 -0
  96. package/dist/_types/contracts/local-execution/library.d.ts +873 -0
  97. package/dist/_types/contracts/local-execution/lifecycle.d.ts +519 -0
  98. package/dist/_types/contracts/local-execution/local-navigation.d.ts +929 -0
  99. package/dist/_types/contracts/local-execution/management.d.ts +400 -0
  100. package/dist/_types/contracts/local-execution/media-recipe.d.ts +207 -0
  101. package/dist/_types/contracts/local-execution/media-validation-request.d.ts +232 -0
  102. package/dist/_types/contracts/local-execution/media-validation.d.ts +262 -0
  103. package/dist/_types/contracts/local-execution/object-transfer.d.ts +155 -0
  104. package/dist/_types/contracts/local-execution/offline.d.ts +59 -0
  105. package/dist/_types/contracts/local-execution/preview.d.ts +243 -0
  106. package/dist/_types/contracts/local-execution/processor-capability.d.ts +39 -0
  107. package/dist/_types/contracts/local-execution/processor-direct.d.ts +290 -0
  108. package/dist/_types/contracts/local-execution/processor-recipes.d.ts +1122 -0
  109. package/dist/_types/contracts/local-execution/processor.d.ts +6173 -0
  110. package/dist/_types/contracts/local-execution/project-source-direct.d.ts +201 -0
  111. package/dist/_types/contracts/local-execution/qwen-tts.d.ts +31 -0
  112. package/dist/_types/contracts/local-execution/recognition.d.ts +170 -0
  113. package/dist/_types/contracts/local-execution/speech.d.ts +95 -0
  114. package/dist/_types/contracts/local-execution/tool-selection.d.ts +55 -0
  115. package/dist/_types/contracts/local-execution/whisper.d.ts +24 -0
  116. package/dist/_types/contracts/local-execution/work.d.ts +149 -0
  117. package/dist/_types/contracts/local-execution/workspace.d.ts +141 -0
  118. package/dist/_types/contracts/matrix-parameter-rule.d.ts +23 -0
  119. package/dist/_types/contracts/media-category.d.ts +11 -0
  120. package/dist/_types/contracts/media-export.d.ts +23 -0
  121. package/dist/_types/contracts/media-observation.d.ts +2080 -0
  122. package/dist/_types/contracts/model-capability-matrix.d.ts +118 -0
  123. package/dist/_types/contracts/native-tool-authority-failure.d.ts +38 -0
  124. package/dist/_types/contracts/native-tool-authority.d.ts +110 -0
  125. package/dist/_types/contracts/native-tool-execution.d.ts +287 -0
  126. package/dist/_types/contracts/native-tool-gateway.d.ts +41 -0
  127. package/dist/_types/contracts/native-video-audio.d.ts +62 -0
  128. package/dist/_types/contracts/navigation-context.d.ts +253 -0
  129. package/dist/_types/contracts/navigation-groups.d.ts +51 -0
  130. package/dist/_types/contracts/navigation.d.ts +248 -0
  131. package/dist/_types/contracts/observation-profile.d.ts +99 -0
  132. package/dist/_types/contracts/planning-input.d.ts +177 -0
  133. package/dist/_types/contracts/principal.d.ts +26 -0
  134. package/dist/_types/contracts/production-creation.d.ts +66 -0
  135. package/dist/_types/contracts/production-termination.d.ts +51 -0
  136. package/dist/_types/contracts/production.d.ts +111 -0
  137. package/dist/_types/contracts/programmatic-composition.d.ts +762 -0
  138. package/dist/_types/contracts/programmatic-exploration.d.ts +1822 -0
  139. package/dist/_types/contracts/programmatic-video-review.d.ts +894 -0
  140. package/dist/_types/contracts/project-library.d.ts +173 -0
  141. package/dist/_types/contracts/project.d.ts +93 -0
  142. package/dist/_types/contracts/provider-catalog.d.ts +421 -0
  143. package/dist/_types/contracts/provider-models.d.ts +3388 -0
  144. package/dist/_types/contracts/provider.d.ts +207 -0
  145. package/dist/_types/contracts/reference-preview.d.ts +55 -0
  146. package/dist/_types/contracts/repair-lifecycle.d.ts +2564 -0
  147. package/dist/_types/contracts/repair-plan.d.ts +646 -0
  148. package/dist/_types/contracts/repair-strategy.d.ts +1432 -0
  149. package/dist/_types/contracts/review-intelligence-evidence.d.ts +136 -0
  150. package/dist/_types/contracts/review-intelligence-final-output.d.ts +883 -0
  151. package/dist/_types/contracts/review-intelligence.d.ts +573 -0
  152. package/dist/_types/contracts/review1-repair-source.d.ts +452 -0
  153. package/dist/_types/contracts/review1-repair-strategy.d.ts +491 -0
  154. package/dist/_types/contracts/review1-repair.d.ts +36 -0
  155. package/dist/_types/contracts/rough-cut-manifest.d.ts +352 -0
  156. package/dist/_types/contracts/rough-cut-profile.d.ts +46 -0
  157. package/dist/_types/contracts/rough-cut-review.d.ts +459 -0
  158. package/dist/_types/contracts/rough-cut.d.ts +1260 -0
  159. package/dist/_types/contracts/scene-shot-plan.d.ts +882 -0
  160. package/dist/_types/contracts/sdk-discovery.d.ts +66 -0
  161. package/dist/_types/contracts/shot-direction.d.ts +113 -0
  162. package/dist/_types/contracts/shot-preparation-basis.d.ts +356 -0
  163. package/dist/_types/contracts/shot-preparation.d.ts +2285 -0
  164. package/dist/_types/contracts/shot-sound-instruction.d.ts +58 -0
  165. package/dist/_types/contracts/sound-making-plan.d.ts +1586 -0
  166. package/dist/_types/contracts/source-sound-policy.d.ts +10 -0
  167. package/dist/_types/contracts/source-workspace.d.ts +62 -0
  168. package/dist/_types/contracts/speech-cost.d.ts +81 -0
  169. package/dist/_types/contracts/speech.d.ts +573 -0
  170. package/dist/_types/contracts/story.d.ts +98 -0
  171. package/dist/_types/contracts/temporal-evidence-operation.d.ts +380 -0
  172. package/dist/_types/contracts/temporal-evidence-reference.d.ts +18 -0
  173. package/dist/_types/contracts/temporal-evidence.d.ts +248 -0
  174. package/dist/_types/contracts/tenant.d.ts +7 -0
  175. package/dist/_types/contracts/timeline-audio.d.ts +98 -0
  176. package/dist/_types/contracts/timeline-graphics.d.ts +80 -0
  177. package/dist/_types/contracts/timeline-manifest.d.ts +704 -0
  178. package/dist/_types/contracts/timeline-source-sound.d.ts +353 -0
  179. package/dist/_types/contracts/timeline-v2.d.ts +1267 -0
  180. package/dist/_types/contracts/timeline-version-reader.d.ts +2955 -0
  181. package/dist/_types/contracts/timeline-visual-layers.d.ts +1249 -0
  182. package/dist/_types/contracts/timeline.d.ts +142 -0
  183. package/dist/_types/contracts/transcription.d.ts +80 -0
  184. package/dist/_types/contracts/video-generation.d.ts +676 -0
  185. package/dist/_types/contracts/video-review.d.ts +1871 -0
  186. package/dist/_types/contracts/visual-exploration.d.ts +1586 -0
  187. package/dist/_types/contracts/visual-layer-render.d.ts +2820 -0
  188. package/dist/_types/contracts/visual-layer.d.ts +112 -0
  189. package/dist/_types/contracts/visual-sequence.d.ts +143 -0
  190. package/dist/_types/contracts/workspace.d.ts +32 -0
  191. package/dist/_types/contracts/writer-proposal.d.ts +268 -0
  192. package/dist/_types/sdk/account.d.ts +109 -0
  193. package/dist/_types/sdk/auxiliary-media.d.ts +43 -0
  194. package/dist/_types/sdk/catalog/agent-host-execution.d.ts +1551 -0
  195. package/dist/_types/sdk/catalog/agent-host.d.ts +344 -0
  196. package/dist/_types/sdk/catalog/assembly.d.ts +32 -0
  197. package/dist/_types/sdk/catalog/audio-caption.d.ts +1382 -0
  198. package/dist/_types/sdk/catalog/canonical-repair.d.ts +4584 -0
  199. package/dist/_types/sdk/catalog/carriers.d.ts +31 -0
  200. package/dist/_types/sdk/catalog/composition-source.d.ts +1556 -0
  201. package/dist/_types/sdk/catalog/composition.d.ts +19 -0
  202. package/dist/_types/sdk/catalog/core.d.ts +3172 -0
  203. package/dist/_types/sdk/catalog/delivery.d.ts +14 -0
  204. package/dist/_types/sdk/catalog/device-library.d.ts +992 -0
  205. package/dist/_types/sdk/catalog/device-management.d.ts +462 -0
  206. package/dist/_types/sdk/catalog/discovery.d.ts +83 -0
  207. package/dist/_types/sdk/catalog/editor.d.ts +25 -0
  208. package/dist/_types/sdk/catalog/generation.d.ts +1218 -0
  209. package/dist/_types/sdk/catalog/imported-visual.d.ts +2541 -0
  210. package/dist/_types/sdk/catalog/keyframe-review.d.ts +859 -0
  211. package/dist/_types/sdk/catalog/lifecycle-events.d.ts +329 -0
  212. package/dist/_types/sdk/catalog/mcp.d.ts +269 -0
  213. package/dist/_types/sdk/catalog/media-descriptors.d.ts +264 -0
  214. package/dist/_types/sdk/catalog/media-observation.d.ts +1975 -0
  215. package/dist/_types/sdk/catalog/native-tool-authority.d.ts +281 -0
  216. package/dist/_types/sdk/catalog/navigation.d.ts +579 -0
  217. package/dist/_types/sdk/catalog/planning-intelligence.d.ts +2031 -0
  218. package/dist/_types/sdk/catalog/programmatic-exploration.d.ts +329 -0
  219. package/dist/_types/sdk/catalog/programmatic-review.d.ts +1106 -0
  220. package/dist/_types/sdk/catalog/provider.d.ts +4477 -0
  221. package/dist/_types/sdk/catalog/reference-preview.d.ts +180 -0
  222. package/dist/_types/sdk/catalog/repair-strategy.d.ts +182 -0
  223. package/dist/_types/sdk/catalog/reviewer.d.ts +278 -0
  224. package/dist/_types/sdk/catalog/shot-preparation.d.ts +53 -0
  225. package/dist/_types/sdk/catalog/sound-making-plan.d.ts +8 -0
  226. package/dist/_types/sdk/catalog/source-sync.d.ts +823 -0
  227. package/dist/_types/sdk/catalog/spec.d.ts +45 -0
  228. package/dist/_types/sdk/catalog/speech.d.ts +795 -0
  229. package/dist/_types/sdk/catalog/temporal-evidence.d.ts +393 -0
  230. package/dist/_types/sdk/catalog/video-review.d.ts +2149 -0
  231. package/dist/_types/sdk/catalog/visual-exploration.d.ts +10566 -0
  232. package/dist/_types/sdk/client.d.ts +96 -0
  233. package/dist/_types/sdk/desktop-catalogue.d.ts +25 -0
  234. package/dist/_types/sdk/desktop-previews.d.ts +118 -0
  235. package/dist/_types/sdk/desktop-releases.d.ts +75 -0
  236. package/dist/_types/sdk/device-renders.d.ts +3374 -0
  237. package/dist/_types/sdk/direct-source.d.ts +147 -0
  238. package/dist/_types/sdk/errors.d.ts +14 -0
  239. package/dist/_types/sdk/evidence-image.d.ts +22 -0
  240. package/dist/_types/sdk/image-media.d.ts +43 -0
  241. package/dist/_types/sdk/immutable-media.d.ts +24 -0
  242. package/dist/_types/sdk/index.d.ts +24 -0
  243. package/dist/_types/sdk/local-runtime/components.d.ts +2 -0
  244. package/dist/_types/sdk/local-runtime/device-client.d.ts +187 -0
  245. package/dist/_types/sdk/local-runtime/library.d.ts +268 -0
  246. package/dist/_types/sdk/local-runtime/workspace.d.ts +186 -0
  247. package/dist/_types/sdk/local-runtime-client.d.ts +2616 -0
  248. package/dist/_types/sdk/mcp-client.d.ts +57 -0
  249. package/dist/_types/sdk/mcp-image.d.ts +52 -0
  250. package/dist/_types/sdk/media.d.ts +104 -0
  251. package/dist/_types/sdk/navigation-client.d.ts +89 -0
  252. package/dist/_types/sdk/navigation-facade.d.ts +467 -0
  253. package/dist/_types/sdk/observe.d.ts +51 -0
  254. package/dist/_types/sdk/runtime-authority.d.ts +103 -0
  255. package/dist/_types/sdk/transport/http.d.ts +39 -0
  256. package/dist/account.d.ts +1 -0
  257. package/dist/account.js +1 -0
  258. package/dist/desktop-previews.d.ts +1 -0
  259. package/dist/desktop-previews.js +1 -0
  260. package/dist/desktop-releases.d.ts +1 -0
  261. package/dist/desktop-releases.js +1 -0
  262. package/dist/errors.d.ts +1 -0
  263. package/dist/errors.js +1 -0
  264. package/dist/index.d.ts +2 -0
  265. package/dist/index.js +1 -0
  266. package/dist/local-runtime.d.ts +1 -0
  267. package/dist/local-runtime.js +1 -0
  268. package/dist/native/Bootstrap.ps1 +90 -0
  269. package/dist/native/JobNative.cs +137 -0
  270. package/dist/native/JobRunner.cs +381 -0
  271. package/dist/native/NativeMain.cs +161 -0
  272. package/dist/native/PipeBridge.cs +260 -0
  273. package/dist/native/PrivateAccess.cs +152 -0
  274. package/dist/runtime-authority.d.ts +1 -0
  275. package/dist/runtime-authority.js +1 -0
  276. package/package.json +44 -3
  277. package/README.md +0 -3
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocol": "NVS_PRODUCT_COMPATIBILITY_V1",
3
+ "product": "@nativestudio/sdk",
4
+ "version": "0.3.0-rc.11",
5
+ "source": {
6
+ "head": "e5214407efc5896ff42c735382281b7827c22e2f",
7
+ "fileDigest": "f173df4faa5ffd63385d28e804b54264a0abc5e86ae8fbc5451ee689eb0c7f77",
8
+ "dirty": false,
9
+ "remoteMainHead": "e5214407efc5896ff42c735382281b7827c22e2f"
10
+ },
11
+ "node": ">=24.12 <25",
12
+ "discoveryProfile": "contextual-v1",
13
+ "accountProtocol": "NVS_CLI_ACCOUNT_V1"
14
+ }
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.
@@ -0,0 +1 @@
1
+ {"protocol":"NVS_BUNDLED_DEPENDENCIES_V1","dependencies":[]}
@@ -0,0 +1 @@
1
+ import{CreatedProjectResultSchema,HumanTenantSchema,ProductionSchema,ProductionStateSchema,ProjectSchema,SourceLibraryItemSchema,SourceLibraryMediaSchema,StudioInputContentSchema}from"./chunk-CJEQNH37.js";import{AcceptBriefRequestSchema,AcceptSceneShotPlanRequestSchema,AcceptStoryRequestSchema,AcceptedVisualSourceReferenceSchema,AgentHostBindingSchema,AgentHostScopeSchema,AgentHostSelectionSchema,AudioSnapshotSchema,AuthorCaptionsSchema,BoundaryRequirementSchema,BriefContentSchema,BuildTimelineSchema,BuildTimelineShapeSchema,CaptionContentSchema,CaptionSnapshotSchema,ClipTransitionSchema,CompositionBasisPinSchema,CompositionBindingSchema,CompositionContentSchema,CompositionDependencyLockSchema,CompositionDependencyManifestSchema,CompositionFindingLocalitySchema,CompositionGetSchema,CompositionInputFactSchema,CompositionPathSchema,CompositionRenderGetSchema,CompositionRenderViewSchema,CompositionScopeSchema,CompositionViewSchema,ConstraintSetSchema,ContentFingerprintSchema,DecideFinalReadySchema,DeliveryApprovalSchema,DeliveryCheckKeySchema,DeliveryManifestLinkSchema,DeliveryPolicyInputSchema,DeliveryPolicySchema,DeliveryTargetSchema,DeliveryValidationReviewSchema,DirectorBasisSchema,DirectorContextResultSchema,DirectorScopeSchema,ExactEvidenceReferenceSchema,FinalDeliveryReceiptSchema,FinalReadyViewSchema,FinalRenderManifestReaderSchema,FinalRenderSnapshotSchema,FinalRenderTechnicalSchema,GenerationContractIdSchema,GenerationCostQuoteSchema,KeyframeGenerationViewSchema,KeyframeMediaSchema,KeyframeObservationSchema,KeyframeProviderProfileSchema,KeyframeReviewScopeSchema,KeyframeReviewSummarySchema,KeyframeStartInputSchema,KeyframeSummarySchema,MediaBrowserContentTypeSchema,MediaBrowserReadTicketSchema,MediaCategorySchema,NativeRuntimeProofRequestSchema,NativeRuntimePublicKeySchema,NativeToolGrantViewSchema,PreparationBasisSchema,PreparationBlockerSchema,PreparationIdSchema,PreparationTargetSchema,ProgrammaticVideoReviewTargetSchema,ProviderSelectionSchema,ReferenceBindingInputSchema,ReferenceRoleSchema,ReferenceSetSchema,ReviewEvidenceKeySchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema,RoughCutFindingViewSchema,RoughCutReviewRecordSchema,RoughCutReviewSnapshotSchema,RoughCutReviewTargetSchema,RoughCutSnapshotSchema,SceneShotPlanVersionSchema,ShotIntentSchema,ShotPlanEntrySchema,SourceInputMetadataSchema,StoryContentSchema,StoryVersionSchema,SubmitCompositionSchema,TemporalEvidenceManifestSchema,TemporalEvidenceSourceSchema,TemporalSamplingProfileSchema,TimelineAudioInputSchema,TimelineBasisSchema,TimelineGraphicInputSchema,TimelineManifestReaderSchema,TimelineScopeSchema,TimelineSnapshotSchema,TimelineViewSchema,TimelineVisualLayerInputSchema,UploadSourceInputRequestSchema,ValidateReviewIntelligenceSchema,VideoGenerationViewSchema,VideoObservationSchema,VideoProviderProfileSchema,VideoReviewRequirementSchema,VideoReviewScopeSchema,VideoStartInputSchema,VideoSummarySchema,VisualRequirementSchema}from"./chunk-DIPWMH32.js";import{ArtifactIdSchema,ArtifactRepresentationIdSchema,ContinuationSchema,DeliveryOutputProfileSchema,InterfaceSemanticStatusSchema,NextActionSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,TenantIdSchema,WorkSummarySchema}from"./chunk-VPYAXWXY.js";import{NativeStudioSdkError,sdkInputError}from"./chunk-HTUTYIRU.js";import{z}from"zod";var OperationTargetSchema=z.object({type:z.string().min(1).max(120),id:z.string().min(1).max(2048),version:z.int().positive().nullable()});var OperationSummarySchema=z.object({id:OperationIdSchema,productionId:ProductionIdSchema,semanticStatus:InterfaceSemanticStatusSchema,targets:z.array(OperationTargetSchema).max(100),work:WorkSummarySchema,blockers:z.array(z.string().min(1).max(1e3)).max(100),nextActions:z.array(NextActionSchema).max(50),startedAt:z.iso.datetime({offset:true}),updatedAt:z.iso.datetime({offset:true})});import{z as z4}from"zod";import{z as z3}from"zod";import{z as z2}from"zod";var sha=z2.string().regex(/^[0-9a-f]{64}$/);var DeliveryManifestBasisSchema=z2.strictObject({schemaVersion:z2.literal(1),evaluatorVersion:z2.literal("DELIVERY_V1"),target:DeliveryTargetSchema,policyVersionId:z2.uuid(),policyVersion:z2.int().positive(),policy:DeliveryPolicySchema,policyFingerprint:sha,finalRenderRuntimeJobId:z2.uuid(),finalRenderManifest:FinalRenderManifestReaderSchema,finalRenderTechnical:FinalRenderTechnicalSchema,roughCutReview:RoughCutReviewRecordSchema,artifacts:z2.array(z2.strictObject({artifactId:z2.uuid(),family:z2.string().min(1).max(100),origin:z2.string().min(1).max(100),checksumSha256:sha})).min(1).max(2e3),relations:z2.array(z2.strictObject({id:z2.uuid(),sourceArtifactId:z2.uuid(),targetArtifactId:z2.uuid(),relationType:z2.string().min(1).max(100)})).max(4e3)}).superRefine((basis,ctx)=>{const t=basis.target,m=basis.finalRenderManifest;if(t.selectionId!==m.selection.id||t.selectionVersion!==m.selectionVersion||t.timelineVersionId!==m.timeline.id||t.timelineFingerprint!==m.timeline.fingerprint||t.tenantId!==m.timeline.tenantId||t.projectId!==m.timeline.projectId||t.productionId!==m.timeline.productionId||t.executionClass!==m.timeline.executionClass||t.checksumSha256!==basis.finalRenderTechnical.checksumSha256||t.byteSize!==basis.finalRenderTechnical.byteSize||basis.finalRenderTechnical.hasAudio!==m.profile.hasAudio||basis.roughCutReview.id!==m.selection.reviewId||basis.roughCutReview.basisFingerprint!==m.selection.basisFingerprint||!basis.artifacts.some(a=>a.artifactId===t.artifactId&&a.checksumSha256===t.checksumSha256)||new Set(basis.artifacts.map(a=>a.artifactId)).size!==basis.artifacts.length||new Set(basis.relations.map(r=>r.id)).size!==basis.relations.length||basis.relations.some(r=>!basis.artifacts.some(a=>a.artifactId===r.sourceArtifactId)||!basis.artifacts.some(a=>a.artifactId===r.targetArtifactId)))ctx.addIssue({code:"custom",message:"Manifest must identify exact render, Review-2 and provenance"})});var ProductionDeliveryManifestSchema=DeliveryManifestBasisSchema.safeExtend({reviewId:z2.uuid(),productionRevision:z2.int().positive(),completedAt:z2.iso.datetime({offset:true})});var DeliveryManifestGetSchema=TimelineScopeSchema.extend({manifestId:z2.uuid()});var RegisteredDeliveryManifestSchema=z2.strictObject({link:DeliveryManifestLinkSchema,body:ProductionDeliveryManifestSchema}).refine(v=>v.link.reviewId===v.body.reviewId&&v.link.policyFingerprint===v.body.policyFingerprint&&Object.keys(DeliveryTargetSchema.shape).every(key10=>v.link.target[key10]===v.body.target[key10]),"Manifest registration must match exact body");var sha2=z3.string().regex(/^[0-9a-f]{64}$/);var mutation=TimelineScopeSchema.extend({expectedProductionRevision:z3.int().positive(),idempotencyKey:z3.string().trim().min(1).max(200)});var ConfigureDeliveryPolicySchema=mutation.extend({expectedPolicyVersion:z3.int().nonnegative(),policy:DeliveryPolicyInputSchema});var DeliveryPolicyVersionSchema=TimelineScopeSchema.extend({id:z3.uuid(),projectId:z3.uuid(),version:z3.int().positive(),policy:DeliveryPolicySchema,policyFingerprint:sha2,createdByPrincipalId:z3.uuid(),createdAt:z3.iso.datetime({offset:true})});var DeliveryPolicyReceiptSchema=z3.strictObject({policy:DeliveryPolicyVersionSchema,productionRevision:z3.int().positive()});var LegacyStartDeliveryValidationSchema=mutation.extend({target:DeliveryTargetSchema,expectedPolicyVersion:z3.int().nonnegative()}).refine(v=>v.target.tenantId===v.tenantId&&v.target.productionId===v.productionId,"Exact delivery target must match command scope");var StartDeliveryValidationSchema=LegacyStartDeliveryValidationSchema.safeExtend({deviceId:z3.uuid().toLowerCase().optional()});var DeliveryValidationGetSchema=TimelineScopeSchema.extend({validationId:z3.uuid()});var DecideDeliveryApprovalSchema=mutation.extend({validationId:z3.uuid(),reviewId:z3.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha2,action:z3.enum(["APPROVE","REJECT"])}).refine(v=>v.target.tenantId===v.tenantId&&v.target.productionId===v.productionId,"Exact approval target must match command scope");var DeliveryAdmissionSchema=z3.strictObject({semanticStatus:z3.literal("ACCEPTED"),validationId:z3.uuid(),runtimeJobId:z3.uuid(),operationId:z3.string().min(1),target:DeliveryTargetSchema,policyVersionId:z3.uuid(),policyVersion:z3.int().positive(),policyFingerprint:sha2,manifestBasisFingerprint:sha2,evaluatorVersion:z3.literal("DELIVERY_V1"),productionRevision:z3.int().positive()});var DeliveryFindingSchema=z3.strictObject({id:z3.uuid(),reviewId:z3.uuid(),target:DeliveryTargetSchema,key:DeliveryCheckKeySchema,detail:z3.string().trim().min(1).max(1e3),blocking:z3.literal(true),createdAt:z3.iso.datetime({offset:true})});var DeliveryCompletionBlockerSchema=z3.enum(["VALIDATION_FAILED","EXACT_OUTPUT_CHANGED","DELIVERY_POLICY_CHANGED","FINAL_READY_STALE","ARTIFACT_UNAVAILABLE","PROVENANCE_INCOMPLETE","MANIFEST_NOT_REGISTERED","MANIFEST_BINDING_MISMATCH","BLOCKING_FINDINGS","TEST_EVIDENCE_DISABLED","APPROVAL_BINDING_MISMATCH","APPROVAL_REJECTED"]);var DeliveryReviewReceiptSchema=z3.strictObject({review:DeliveryValidationReviewSchema,action:z3.enum(["COMPLETE","WAITING_HUMAN","BLOCK"]),blockers:z3.array(DeliveryCompletionBlockerSchema).max(12),productionRevision:z3.int().positive()});var DeliveryDecisionReceiptSchema=z3.strictObject({approval:DeliveryApprovalSchema,finalDelivery:FinalDeliveryReceiptSchema.nullable(),productionRevision:z3.int().positive(),condition:z3.enum(["RUNNABLE","BLOCKED"])});var DeliveryValidationViewSchema=z3.strictObject({admission:DeliveryAdmissionSchema,policy:DeliveryPolicyVersionSchema,manifestBasis:DeliveryManifestBasisSchema,runtimeStatus:z3.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),current:z3.boolean(),reviewReceipt:DeliveryReviewReceiptSchema.nullable(),findings:z3.array(DeliveryFindingSchema).max(16),approval:DeliveryApprovalSchema.nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});var DeliverySnapshotSchema=TimelineScopeSchema.extend({productionRevision:z3.int().positive(),policy:DeliveryPolicyVersionSchema.nullable(),currentValidationId:z3.uuid().nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});var DeliverySummarySchema=z4.strictObject({policy:DeliveryPolicyVersionSchema.nullable(),validation:z4.strictObject({id:z4.uuid(),runtimeStatus:DeliveryValidationViewSchema.shape.runtimeStatus,current:z4.boolean(),reviewId:z4.uuid().nullable(),result:z4.enum(["PASS","FAIL"]).nullable(),action:z4.enum(["COMPLETE","WAITING_HUMAN","BLOCK"]).nullable(),blockingChecks:z4.array(DeliveryCheckKeySchema).max(16),approvalAction:z4.enum(["APPROVE","REJECT"]).nullable()}).nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});import{z as z8}from"zod";import{z as z7}from"zod";import{z as z6}from"zod";import{z as z5}from"zod";var ShotSoundContentSchema=z5.strictObject({model:z5.strictObject({modelProfileId:z5.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z5.int().positive(),connectionId:z5.uuid()}).optional(),nativeAudio:z5.boolean(),cues:z5.array(z5.strictObject({id:z5.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z5.enum(["DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT","NARRATION"]),startMs:z5.int().nonnegative().max(3e4),endMs:z5.int().positive().max(3e4),text:z5.string().trim().min(1).max(6e3).optional(),exactSpeech:z5.boolean(),lipSync:z5.enum(["REQUIRED","NONE"])}).refine(v=>v.endMs>v.startMs)).max(64)});var ShotSoundInstructionSchema=z5.strictObject({soundPlanVersionId:z5.uuid().toLowerCase(),fingerprint:z5.string().regex(/^[0-9a-f]{64}$/),content:ShotSoundContentSchema});var GenerationContractSchema=z6.strictObject({id:GenerationContractIdSchema,schemaVersion:z6.literal(1),preparationId:PreparationIdSchema,target:PreparationTargetSchema,basis:PreparationBasisSchema,mode:z6.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),creativeInstruction:z6.strictObject({sound:ShotSoundInstructionSchema.optional(),shot:ShotIntentSchema,scenePurpose:z6.string().min(1).max(800),locationContext:z6.string().max(300).optional(),timeContext:z6.string().max(300).optional(),productPresentationGoal:z6.string().min(1).max(1e3),styleTone:z6.string().max(300).optional(),entryBoundary:z6.array(BoundaryRequirementSchema).max(48),exitBoundary:z6.array(BoundaryRequirementSchema).max(48)}),acceptedShotReferences:z6.array(AcceptedVisualSourceReferenceSchema).max(24).default([]),constraintSetFingerprint:ContentFingerprintSchema,referenceSetFingerprint:ContentFingerprintSchema,output:z6.strictObject({aspectRatio:z6.enum(["16:9","9:16"]),targetDurationSeconds:z6.number().min(.5).max(30).nullable(),workingResolution:z6.null(),frameRate:z6.null(),finalDeliveryProfile:DeliveryOutputProfileSchema}),requiredCapabilities:z6.strictObject({referenceConditioning:z6.literal(true),referenceRoles:z6.array(ReferenceRoleSchema).min(1).max(8),startFrameControl:z6.boolean(),endFrameControl:z6.boolean(),nativeAudio:z6.boolean().optional()}),fingerprint:ContentFingerprintSchema}).superRefine((value,context)=>{const invalid=message=>context.addIssue({code:"custom",message});if(value.target.mediaType==="IMAGE"&&value.acceptedShotReferences.length)invalid("Image generation cannot depend on accepted video Shots");if(value.target.mediaType==="IMAGE"&&(value.mode!=="REFERENCE_TO_IMAGE"||value.output.targetDurationSeconds!==null||value.requiredCapabilities.startFrameControl||value.requiredCapabilities.endFrameControl))invalid("Image generation cannot claim video duration or frame-control semantics");if(value.target.mediaType==="VIDEO"&&(value.mode==="REFERENCE_TO_IMAGE"||value.output.targetDurationSeconds===null))invalid("Video generation requires video mode and duration");const roles=value.requiredCapabilities.referenceRoles;if(!roles.some(role=>role==="PRODUCT_IDENTITY"||role==="PRODUCT_PACKSHOT"))invalid("Product identity requires concrete reference conditioning");if(value.requiredCapabilities.startFrameControl&&!roles.includes("START_FRAME_ANCHOR"))invalid("Start-frame control requires an exact anchor role");if(value.requiredCapabilities.endFrameControl&&!roles.includes("END_FRAME_ANCHOR"))invalid("End-frame control requires an exact anchor role");if(value.mode==="FIRST_LAST_FRAME_TO_VIDEO"&&(!value.requiredCapabilities.startFrameControl||!value.requiredCapabilities.endFrameControl))invalid("First/last mode requires both anchor capabilities")});var PrepareShotRequestSchema=z7.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z7.int().positive(),expectedPlanVersionId:SceneShotPlanVersionIdSchema,expectedPlanVersion:z7.int().positive(),expectedShotPlanningRevision:z7.int().positive(),expectedPreparationVersion:z7.int().nonnegative(),idempotencyKey:z7.string().trim().min(1).max(200),target:PreparationTargetSchema,referenceBindings:z7.array(ReferenceBindingInputSchema).max(12).default([])});var PreparationVersionSchema=z7.strictObject({id:PreparationIdSchema,version:z7.int().positive(),basis:PreparationBasisSchema,target:PreparationTargetSchema,constraints:ConstraintSetSchema,referenceSet:ReferenceSetSchema,canonicalSources:z7.array(ExactEvidenceReferenceSchema).max(64),acceptedShotReferences:z7.array(AcceptedVisualSourceReferenceSchema).max(24).default([]),blockers:z7.array(PreparationBlockerSchema).max(2048),contract:GenerationContractSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z7.iso.datetime({offset:true})}).superRefine((value,context)=>{const invalid=message=>context.addIssue({code:"custom",message});if(value.constraints.preparationId!==value.id||value.referenceSet.preparationId!==value.id||value.constraints.version!==value.version||value.referenceSet.version!==value.version)invalid("Resolved snapshot identity must match preparation");if(value.contract!==null!==(value.blockers.length===0))invalid("A preparation contract exists only for an unblocked preflight");if(value.contract&&(value.contract.preparationId!==value.id||JSON.stringify(value.contract.basis)!==JSON.stringify(value.basis)||JSON.stringify(value.contract.target)!==JSON.stringify(value.target)||value.contract.constraintSetFingerprint!==value.constraints.fingerprint||value.contract.referenceSetFingerprint!==value.referenceSet.fingerprint||JSON.stringify(value.contract.acceptedShotReferences)!==JSON.stringify(value.acceptedShotReferences)))invalid("Generation Contract must freeze the exact preparation basis and snapshots")});var PrepareShotResultSchema=z7.strictObject({semanticStatus:z7.literal("SUCCESS"),preparation:PreparationVersionSchema,productionRevision:z7.int().positive()});var PreparationViewSchema=z7.strictObject({preparation:PreparationVersionSchema,freshness:z7.enum(["CURRENT_BASIS","STALE_BASIS"]),superseded:z7.boolean(),freshnessReasons:z7.array(z7.enum(["PLAN_CHANGED","SHOT_CHANGED","REFERENCE_UNAVAILABLE","CONSISTENCY_PROFILE_CHANGED","SOUND_PLAN_CHANGED","SUPERSEDED","KEYFRAME_SELECTION_CHANGED","PREDECESSOR_ACCEPTANCE_CHANGED"])).max(8),execution:z7.strictObject({eligibleVideoSelections:z7.array(ProviderSelectionSchema).max(1600).optional(),available:z7.boolean(),reasons:z7.array(z7.enum(["STALE_BASIS","PREPARATION_BLOCKED","PRODUCTION_NOT_RUNNABLE","PROVIDER_CAPABILITY_UNAVAILABLE","VIDEO_SELECTION_REQUIRED"])).min(0).max(4)})});var PreparationQueryInputSchema=z7.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),mediaType:z7.enum(["IMAGE","VIDEO"]).optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var PreparationQueryPageSchema=z7.strictObject({items:z7.array(PreparationViewSchema),page:QueryPageInfoSchema});var PreparationGetInputSchema=z7.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,preparationId:PreparationIdSchema});var PreparationActiveInputSchema=z7.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,mediaType:z7.enum(["IMAGE","VIDEO"])});var PreparationSummarySchema=z7.strictObject({latest:z7.int().nonnegative(),current:z7.int().nonnegative(),stale:z7.int().nonnegative(),contractValid:z7.int().nonnegative(),preflightBlocked:z7.int().nonnegative(),executionAvailable:z7.int().nonnegative()});var NullableVersionSchema=z8.int().positive().nullable();var ProductionBlockerSchema=z8.object({code:z8.string().min(1).max(120),summary:z8.string().min(1).max(1e3),targetType:z8.string().min(1).max(80),targetId:z8.string().min(1).max(2048)});var ProductionSnapshotSchema=z8.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,state:ProductionStateSchema,planning:z8.object({activeBriefVersion:NullableVersionSchema,activeStoryVersion:NullableVersionSchema,activeSceneShotPlanVersion:NullableVersionSchema}),preparation:PreparationSummarySchema.optional(),keyframes:KeyframeSummarySchema.optional(),keyframeReview:KeyframeReviewSummarySchema.optional(),videos:VideoSummarySchema.optional(),captions:CaptionSnapshotSchema.optional(),audio:AudioSnapshotSchema.optional(),shots:z8.object({planned:z8.int().nonnegative(),ready:z8.int().nonnegative(),generating:z8.int().nonnegative(),candidates:z8.int().nonnegative(),accepted:z8.int().nonnegative(),blocked:z8.int().nonnegative(),stale:z8.int().nonnegative()}),findings:z8.object({open:z8.int().nonnegative(),blocking:z8.int().nonnegative(),warnings:z8.int().nonnegative()}),timeline:z8.object({currentVersion:NullableVersionSchema,stale:z8.boolean(),...TimelineSnapshotSchema.omit({currentVersion:true,stale:true}).partial().shape}),roughCut:RoughCutSnapshotSchema.partial().required({latestVersion:true,reviewState:true}),review2:RoughCutReviewSnapshotSchema.optional(),final:z8.object({ready:FinalReadyViewSchema.optional(),render:FinalRenderSnapshotSchema.optional(),renderState:z8.string().min(1).max(120).nullable(),delivery:DeliverySummarySchema.optional(),deliveryValidationState:z8.string().min(1).max(120).nullable()}),work:WorkSummarySchema,activeOperations:z8.array(OperationSummarySchema).max(20),blockers:z8.array(ProductionBlockerSchema).max(100),latestDecisions:z8.array(z8.string().min(1).max(1e3)).max(50),nextActions:z8.array(NextActionSchema).max(50),generatedAt:z8.iso.datetime({offset:true})});import{z as z9}from"zod";var ProductionQueryInputSchema=z9.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema.optional(),search:z9.string().trim().min(1).max(200).optional(),attention:z9.enum(["NEEDS_YOU","WORKING","FINISHED"]).optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProductionQueryPageSchema=z9.object({items:z9.array(ProductionSchema),page:QueryPageInfoSchema});var OperationQueryInputSchema=z9.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var OperationQueryPageSchema=z9.object({items:z9.array(OperationSummarySchema),page:QueryPageInfoSchema});var StoryQueryInputSchema=z9.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var StoryQueryPageSchema=z9.object({items:z9.array(StoryVersionSchema),page:QueryPageInfoSchema});var SceneShotPlanQueryInputSchema=z9.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var SceneShotPlanQueryPageSchema=z9.object({items:z9.array(SceneShotPlanVersionSchema),page:QueryPageInfoSchema});import{z as z10}from"zod";var InterfaceCancellationDataSchema=z10.strictObject({cancellationAccepted:z10.boolean()});var InterfaceCancellationReceiptSchema=InterfaceCancellationDataSchema.extend({semanticStatus:z10.literal("SUCCESS")});import{z as z16}from"zod";import{z as z15}from"zod";import{z as z11}from"zod";var AgentExecutionContractDigest="834d35515b14007b7900b09bb8e2988169fe6400c77109dba0f793a628c32c90";var key=z11.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var AgentHostGenericInstallationTransportSchema=z11.strictObject({protocol:z11.literal("AGENT_STACK_GENERIC_INSTALLATION_V3"),installationId:key,installationRevisionId:key,slotKey:z11.string().regex(/^[a-z0-9_-]{1,64}$/),contractDigest:z11.literal(AgentExecutionContractDigest),capabilityDigest:z11.string().regex(/^[a-f0-9]{64}$/)});import{z as z12}from"zod";var id=z12.uuid();var sha3=z12.string().regex(/^[0-9a-f]{64}$/);var AgentHostExecutionScopeSchema=z12.strictObject({tenantId:id,projectId:id,productionId:id});var StartAgentHostExecutionSchema=AgentHostExecutionScopeSchema.extend({requestId:id,studioInputArtifactId:id,bindingId:id,expectedProductionRevision:z12.int().positive(),expectedBindingRevision:z12.int().positive(),expectedConfigurationVersion:z12.int().positive()});var AgentHostExecutionGetSchema=AgentHostExecutionScopeSchema.extend({executionId:id});var AgentHostExecutionQuerySchema=AgentHostExecutionScopeSchema.extend({limit:z12.int().min(1).max(100).default(20),beforeId:id.optional()});var AgentHostExecutionSourceSchema=z12.strictObject({artifactId:id,representationId:id,checksumSha256:sha3,byteSize:z12.int().positive().max(8388608),contentType:z12.string().min(1).max(100),kind:z12.enum(["PRODUCT_INFORMATION","REFERENCE_IMAGE","REFERENCE_VIDEO"])});var AgentHostExecutionInputSchema=AgentHostExecutionScopeSchema.extend({protocol:z12.literal("NATIVESTUDIO_PRODUCTION_V1"),executionId:id,hostRequestId:id,productionRevision:z12.int().positive(),studioInput:StudioInputContentSchema,intake:AgentHostExecutionSourceSchema,sources:z12.array(AgentHostExecutionSourceSchema).max(12)}).refine(v=>v.studioInput.productionId===v.productionId&&v.studioInput.sourceArtifactIds.length===v.sources.length&&new Set(v.sources.map(s=>s.artifactId)).size===v.sources.length&&v.sources.every((s,index)=>s.artifactId===v.studioInput.sourceArtifactIds[index])&&!v.sources.some(s=>s.artifactId===v.intake.artifactId));var NativeInstallationTransportSchema=z12.strictObject({protocol:z12.literal("AGENT_STACK_NATIVE_INSTALLATION_V2"),installationId:z12.string().regex(/^[A-Za-z0-9_-]{1,160}$/),installationRevisionId:z12.string().regex(/^[A-Za-z0-9_-]{1,160}$/),slotKey:z12.string().regex(/^[a-z0-9_-]{1,64}$/)});var AgentHostInstallationTransportSchema=z12.discriminatedUnion("protocol",[NativeInstallationTransportSchema,AgentHostGenericInstallationTransportSchema]);var AgentHostNativeToolAuthoritySchema=AgentHostExecutionScopeSchema.extend({protocol:z12.literal("NATIVESTUDIO_AGENT_TOOLS_V1"),authorityRef:id,executionId:id,hostRequestId:id,bindingId:id,configurationVersion:z12.int().positive(),inputFingerprint:sha3,capabilityDigest:sha3,expiresAt:z12.iso.datetime({offset:true}),executionClass:z12.enum(["LIVE","TEST_ONLY"]),transport:AgentHostInstallationTransportSchema.optional()});var AgentHostExecutionSnapshotSchema=z12.strictObject({binding:AgentHostBindingSchema,input:AgentHostExecutionInputSchema,authority:AgentHostNativeToolAuthoritySchema}).refine(v=>v.binding.tenantId===v.input.tenantId&&v.binding.projectId===v.input.projectId&&v.binding.enabled&&v.authority.tenantId===v.input.tenantId&&v.authority.projectId===v.input.projectId&&v.authority.productionId===v.input.productionId&&v.authority.executionId===v.input.executionId&&v.authority.hostRequestId===v.input.hostRequestId&&v.authority.bindingId===v.binding.bindingId&&v.authority.configurationVersion===v.binding.configurationVersion);var AgentHostTaskObservationSchema=z12.strictObject({requestId:id,runKey:z12.string().regex(/^[A-Za-z0-9_-]{1,160}$/),status:z12.enum(["accepted","running","succeeded","failed","cancelled","unknown"]),agentKey:z12.string().min(1).max(64),agentVersion:z12.int().positive(),modelOptionKey:z12.string().min(1).max(64),cancelRequested:z12.boolean(),createdAt:z12.iso.datetime({offset:true}),updatedAt:z12.iso.datetime({offset:true}),timing:z12.strictObject({acceptedAt:z12.iso.datetime({offset:true}),deadlineAt:z12.iso.datetime({offset:true}),limitSource:z12.literal("TASK_POLICY")}).nullable()});var AgentHostDispatchPhaseSchema=z12.enum(["ADMITTED","SENDING","OUTCOME_UNKNOWN","OBSERVING","REJECTED","CANCELLED_BEFORE_SUBMISSION"]);var AgentHostExecutionViewSchema=AgentHostExecutionScopeSchema.extend({executionId:id,requestId:id,requestedByPrincipalId:id,hostRequestId:id,revision:z12.int().positive(),snapshotFingerprint:sha3,snapshot:AgentHostExecutionSnapshotSchema,dispatchPhase:AgentHostDispatchPhaseSchema,active:z12.boolean(),observation:AgentHostTaskObservationSchema.nullable(),cancelRequestId:id.nullable(),errorCode:z12.string().regex(/^[A-Z_]{1,80}$/).nullable(),createdAt:z12.iso.datetime({offset:true}),updatedAt:z12.iso.datetime({offset:true})}).refine(v=>v.snapshot.input.executionId===v.executionId&&v.snapshot.input.hostRequestId===v.hostRequestId&&v.snapshot.input.tenantId===v.tenantId&&v.snapshot.input.projectId===v.projectId&&v.snapshot.input.productionId===v.productionId&&(!v.observation||v.observation.requestId===v.hostRequestId&&v.observation.agentKey===v.snapshot.binding.selection.agentKey&&v.observation.agentVersion===v.snapshot.binding.selection.agentVersion&&v.observation.modelOptionKey===v.snapshot.binding.selection.modelOptionKey));var AgentHostExecutionPageSchema=z12.strictObject({items:z12.array(AgentHostExecutionViewSchema).max(100),hasMore:z12.boolean(),nextBeforeId:id.nullable()}).refine(v=>v.hasMore===(v.nextBeforeId!==null)&&(!v.hasMore||v.nextBeforeId===v.items.at(-1)?.executionId)&&new Set(v.items.map(item=>item.executionId)).size===v.items.length);var AgentHostExecutionEventSchema=z12.strictObject({id,executionId:id,revision:z12.int().positive(),action:z12.enum(["ADMIT","CLAIM","RECOVER_UNKNOWN","OBSERVE","REJECT","CANCEL_REQUEST","CANCEL_UNSENT"]),createdByPrincipalId:id,observation:AgentHostTaskObservationSchema.nullable(),errorCode:z12.string().regex(/^[A-Z_]{1,80}$/).nullable(),createdAt:z12.iso.datetime({offset:true})});var AgentHostExecutionEventQuerySchema=AgentHostExecutionGetSchema.extend({limit:z12.int().min(1).max(100).default(20),beforeRevision:z12.int().positive().optional()});var AgentHostExecutionEventPageSchema=z12.strictObject({items:z12.array(AgentHostExecutionEventSchema).max(100),hasMore:z12.boolean(),nextBeforeRevision:z12.int().positive().nullable()}).refine(v=>v.hasMore===(v.nextBeforeRevision!==null)&&(!v.hasMore||v.nextBeforeRevision===v.items.at(-1)?.revision)&&v.items.every((item,index)=>!index||item.revision<v.items[index-1].revision));var AgentHostExecutionFailureSchema=z12.strictObject({semanticStatus:z12.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z12.strictObject({code:z12.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","REVISION_CONFLICT","REQUEST_CONFLICT","SOURCE_UNAVAILABLE","TOOL_AUTHORITY_UNAVAILABLE","ACTIVE_EXECUTION_EXISTS","LEASE_LOST","BINDING_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),message:z12.literal("Agent Host execution did not complete")})});import{z as z13}from"zod";var id2=z13.uuid().regex(/^[0-9a-f-]{36}$/);var key2=z13.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest=z13.string().regex(/^[a-f0-9]{64}$/);var https=z13.url().max(2048).refine(v=>{const u=new URL(v);return u.protocol==="https:"&&!u.username&&!u.password&&!u.search&&!u.hash});var AgentExecutionLimitsSchema=z13.strictObject({grantMaxSeconds:z13.int().positive().max(30*86400),executionMaxSeconds:z13.int().min(10).max(21600),leaseMaxSeconds:z13.int().positive(),renewWindowSeconds:z13.int().positive(),renewBeforeSeconds:z13.int().positive(),assertionSeconds:z13.literal(60),clockSkewSeconds:z13.literal(5)}).refine(v=>v.renewBeforeSeconds<=v.renewWindowSeconds&&v.renewWindowSeconds<v.leaseMaxSeconds&&v.leaseMaxSeconds<=v.executionMaxSeconds);var AgentExecutionCapabilitiesSchema=z13.strictObject({protocol:z13.literal("delegated-mcp-execution"),protocolVersion:z13.literal(1),contractDigest:z13.literal(AgentExecutionContractDigest),issuer:https.refine(v=>new URL(v).origin===v),resource:https,endpoints:z13.strictObject({capabilities:https,authorize:https,token:https,identity:https,bind:https,bindingQuery:https,access:https,accessQuery:https,leaseRenew:https,leaseQuery:https,close:https}),supportedProfiles:z13.tuple([z13.literal("stateless-json-v1")]),limits:AgentExecutionLimitsSchema}).refine(v=>new URL(v.resource).origin===v.issuer&&Object.values(v.endpoints).every(e=>new URL(e).origin===v.issuer));var AgentExecutionDescriptorSchema=z13.strictObject({schemaVersion:z13.literal(1),runtimeKey:key2,installationId:key2,displayName:z13.string().min(1).max(160),redirectUri:https,publicJwk:NativeRuntimePublicKeySchema});var AgentExecutionProfileSchema=z13.strictObject({schemaVersion:z13.literal(1),profileKey:key2,revision:z13.int().positive(),capabilities:AgentExecutionCapabilitiesSchema,capabilityDigest:digest,nativeToolCapabilityDigest:digest,redirectOrigins:z13.array(https.refine(v=>new URL(v).origin===v)).min(1).max(16),scopes:z13.array(z13.string().regex(/^[A-Za-z0-9:_-]{1,128}$/)).min(1).max(32),bootstrap:z13.strictObject({slotKey:z13.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),entryTool:z13.string().regex(/^[A-Za-z0-9_.-]{1,128}$/),argumentsMode:z13.literal("task-input")})});var AgentExecutionRegistrationSchema=AgentExecutionDescriptorSchema.extend({clientId:key2,registrationRevision:z13.int().positive(),issuer:https,resource:https,keyId:z13.string().regex(/^[A-Za-z0-9_-]{43}$/),protocol:z13.literal("delegated-mcp-execution"),protocolVersion:z13.literal(1),contractDigest:z13.literal(AgentExecutionContractDigest),capabilityDigest:digest});var ApproveAgentExecutionRegistrationSchema=AgentHostScopeSchema.extend({requestId:id2,bindingId:id2,expectedBindingRevision:z13.int().positive(),expectedConfigurationVersion:z13.int().positive(),profileKey:key2,expectedProfileRevision:z13.int().positive(),descriptor:AgentExecutionDescriptorSchema});var AgentExecutionRegistrationGetSchema=AgentHostScopeSchema.extend({clientId:id2});var RevokeAgentExecutionRegistrationSchema=AgentExecutionRegistrationGetSchema.extend({requestId:id2,expectedRevision:z13.int().positive()});var AgentExecutionRegistrationViewSchema=AgentExecutionRegistrationGetSchema.extend({schemaVersion:z13.literal(1),revision:z13.int().positive(),enabled:z13.boolean(),bindingId:id2,bindingRevision:z13.int().positive(),configurationVersion:z13.int().positive(),profile:AgentExecutionProfileSchema,registration:AgentExecutionRegistrationSchema,approvedByPrincipalId:id2,createdAt:z13.iso.datetime(),revokedAt:z13.iso.datetime().nullable()}).refine(v=>v.clientId===v.registration.clientId&&v.enabled===(v.revokedAt===null)&&v.registration.capabilityDigest===v.profile.capabilityDigest&&v.registration.resource===v.profile.capabilities.resource&&v.registration.issuer===v.profile.capabilities.issuer);import{z as z14}from"zod";var id3=z14.uuid();var opaque=z14.string().min(1).max(4096);var digest2=z14.string().regex(/^[a-f0-9]{64}$/);var AgentExecutionConsentSchema=z14.strictObject({response_type:z14.literal("code"),client_id:id3,redirect_uri:z14.url().max(2048),resource:z14.url().max(2048),scope:z14.string().min(1).max(4096),state:z14.string().min(1).max(512),code_challenge:z14.string().regex(/^[A-Za-z0-9_-]{43}$/),code_challenge_method:z14.literal("S256")});var ApproveAgentExecutionConsentSchema=AgentHostScopeSchema.extend({profileKey:z14.string().regex(/^[A-Za-z0-9_-]{1,160}$/),requestId:id3,consent:AgentExecutionConsentSchema,expiresInSeconds:z14.int().min(60).max(30*86400)});var AgentExecutionGrantSchema=z14.strictObject({protocolVersion:z14.literal(1),clientId:id3,registrationRevision:z14.int().positive(),resource:z14.url().max(2048),grantRef:id3,grantRevision:z14.int().positive(),expiresAt:z14.iso.datetime(),scopes:z14.array(z14.string().min(1).max(128)).min(1).max(32)});var AgentExecutionTokenFormSchema=z14.discriminatedUnion("grant_type",[z14.strictObject({grant_type:z14.literal("authorization_code"),client_id:id3,resource:z14.url().max(2048),registration_revision:z14.string().regex(/^[1-9][0-9]{0,14}$/),code:opaque,code_verifier:z14.string().regex(/^[A-Za-z0-9._~-]{43,128}$/),redirect_uri:z14.url().max(2048),client_assertion_type:z14.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque}),z14.strictObject({grant_type:z14.literal("refresh_token"),client_id:id3,resource:z14.url().max(2048),registration_revision:z14.string().regex(/^[1-9][0-9]{0,14}$/),refresh_token:opaque,client_assertion_type:z14.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque})]);var AgentExecutionAssertionSchema=z14.strictObject({iss:id3,sub:id3,aud:z14.url().max(2048),iat:z14.int().nonnegative(),exp:z14.int().positive(),jti:id3,requestDigest:digest2}).refine(v=>v.exp===v.iat+60);var id4=z15.uuid();var key3=z15.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest3=z15.string().regex(/^[a-f0-9]{64}$/);var time=z15.iso.datetime();var AgentExecutionIdentitySchema=z15.strictObject({authorityRef:key3,executionId:key3,installationId:key3,installationRevisionId:key3,invocationId:id4,inputDigest:digest3});var AgentExecutionLeaseSchema=z15.strictObject({protocolVersion:z15.literal(1),bindingId:key3,executionId:key3,leaseRevision:z15.int().positive(),expiresAt:time,hardExpiresAt:time,renewedAt:time,renewBeforeSeconds:z15.int().positive()});var AgentExecutionBindingReceiptSchema=AgentExecutionIdentitySchema.extend({protocolVersion:z15.literal(1),bindingId:key3,grantRef:key3,grantRevision:z15.int().positive(),hardExpiresAt:time,boundAt:time,lease:AgentExecutionLeaseSchema});var AgentExecutionAccessMetadataSchema=z15.strictObject({protocolVersion:z15.literal(1),bindingId:key3,executionId:key3,accessGeneration:z15.int().positive(),expiresAt:time});var AgentExecutionPayloadSchemas={identity:z15.strictObject({}),bind:AgentExecutionIdentitySchema.extend({deadlineAt:time}),bindingQuery:z15.strictObject({authorityRef:key3,executionId:key3,originalRequestId:id4}),access:z15.strictObject({bindingId:key3,executionId:key3,expectedAccessGeneration:z15.int().nonnegative()}),accessQuery:z15.strictObject({bindingId:key3,executionId:key3,originalRequestId:id4}),leaseRenew:z15.strictObject({bindingId:key3,executionId:key3,expectedLeaseRevision:z15.int().positive()}),leaseQuery:z15.strictObject({bindingId:key3,executionId:key3,originalRequestId:id4}),close:z15.strictObject({bindingId:key3,executionId:key3,reason:z15.enum(["FINISHED","CANCELLED","ABORTED"])})};var envelope=z15.strictObject({protocolVersion:z15.literal(1),contractDigest:z15.literal(AgentExecutionContractDigest),capabilityDigest:digest3,requestId:id4,clientId:id4,registrationRevision:z15.int().positive(),resource:z15.url().max(2048),grantRef:id4,grantRevision:z15.int().positive(),payload:z15.unknown(),clientAssertion:z15.string().min(1).max(4096)});var AgentExecutionRequestSchemas={identity:envelope.extend({payload:AgentExecutionPayloadSchemas.identity}),bind:envelope.extend({payload:AgentExecutionPayloadSchemas.bind}),bindingQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.bindingQuery}),access:envelope.extend({payload:AgentExecutionPayloadSchemas.access}),accessQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.accessQuery}),leaseRenew:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseRenew}),leaseQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseQuery}),close:envelope.extend({payload:AgentExecutionPayloadSchemas.close})};var AgentExecutionQualificationSchema=z15.strictObject({protocol:z15.literal("NVS_GENERIC_EXECUTION_QUALIFICATION_V1"),transport:AgentHostGenericInstallationTransportSchema,selection:AgentHostSelectionSchema,checkedAt:time,executionClass:z15.enum(["LIVE","TEST_ONLY"])});var AgentExecutionPermitSchema=z15.strictObject({schemaVersion:z15.literal(1),proof:AgentHostNativeToolAuthoritySchema,input:AgentHostExecutionInputSchema,inputDigest:digest3,guidance:z15.strictObject({version:z15.string().min(1).max(100),instructions:z15.string().min(1).max(2e4)}),registration:AgentExecutionRegistrationViewSchema,grant:AgentExecutionGrantSchema,qualification:AgentExecutionQualificationSchema,requestedByPrincipalId:id4,createdAt:time}).refine(v=>v.proof.transport?.protocol==="AGENT_STACK_GENERIC_INSTALLATION_V3"&&v.proof.tenantId===v.registration.tenantId&&v.proof.projectId===v.registration.projectId&&v.proof.productionId===v.input.productionId&&v.proof.executionId===v.input.executionId&&v.proof.hostRequestId===v.input.hostRequestId&&v.proof.bindingId===v.registration.bindingId&&v.proof.configurationVersion===v.registration.configurationVersion&&v.proof.capabilityDigest===v.registration.profile.nativeToolCapabilityDigest&&v.proof.transport.capabilityDigest===v.registration.profile.capabilityDigest&&v.grant.clientId===v.registration.clientId&&v.grant.resource===v.registration.registration.resource&&v.grant.registrationRevision===v.registration.registration.registrationRevision&&v.qualification.transport.installationId===v.proof.transport.installationId&&v.qualification.transport.installationRevisionId===v.proof.transport.installationRevisionId&&v.qualification.transport.capabilityDigest===v.proof.transport.capabilityDigest&&v.qualification.transport.slotKey===v.proof.transport.slotKey&&Date.parse(v.proof.expiresAt)<=Date.parse(v.grant.expiresAt)&&v.input.tenantId===v.proof.tenantId&&v.input.projectId===v.proof.projectId&&v.registration.enabled&&v.proof.transport.installationId===v.registration.registration.installationId&&v.proof.transport.slotKey===v.registration.profile.bootstrap.slotKey&&v.proof.executionClass===v.qualification.executionClass);var AgentExecutionBindingSchema=z15.strictObject({protocol:z15.literal("delegated-mcp-execution"),protocolVersion:z15.literal(1),contractDigest:z15.literal(AgentExecutionContractDigest),capabilityDigest:digest3,issuer:z15.url(),resource:z15.url(),slotKey:z15.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),registration:AgentExecutionRegistrationViewSchema.shape.registration,grant:AgentExecutionGrantSchema,endpoints:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.endpoints,limits:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.limits,bootstrap:AgentExecutionRegistrationViewSchema.shape.profile.shape.bootstrap,transportPolicy:z15.strictObject({profile:z15.literal("stateless-json-v1")}),runtimePolicy:z15.strictObject({sandbox:z15.literal("read-only"),webSearch:z15.literal("disabled"),localExecution:z15.literal("disabled"),toolExposure:z15.literal("direct"),maxTurns:z15.literal(1)})});var AgentExecutionInstallationObservationSchema=z15.strictObject({schemaVersion:z15.literal(3),installationId:key3,installationRevisionId:key3,slotKey:z15.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),binding:AgentExecutionBindingSchema,identity:AgentExecutionGrantSchema.extend({decision:z15.enum(["ALLOW","DRAIN","DENY","UNKNOWN"]),observedAt:time}),checkedAt:time});var AgentExecutionBootstrapInputSchema=z15.strictObject({nativeStudio:AgentHostExecutionInputSchema.safeExtend({nativeToolAuthority:AgentHostNativeToolAuthoritySchema})});var task=AgentExecutionBootstrapInputSchema.shape.nativeStudio;var AgentExecutionBootstrapResultSchema=z16.strictObject({schemaVersion:z16.literal(1),protocol:z16.literal("NVS_EXECUTION_CONTEXT_V1"),executionId:task.shape.executionId,hostRequestId:task.shape.hostRequestId,inputDigest:z16.string().regex(/^[a-f0-9]{64}$/),task,guidance:AgentExecutionPermitSchema.shape.guidance,outputContract:z16.strictObject({version:z16.literal("NVS_HOST_REPORT_V1"),authoritative:z16.literal(false),instructions:z16.string().min(1).max(2e4)})});import{z as z18}from"zod";import{z as z17}from"zod";var key4=z17.string().trim().min(1).max(200);var ScopedSourceInputSchema=SourceInputMetadataSchema.extend({projectId:ProjectIdSchema,idempotencyKey:key4});var ScopedSourceUploadSchema=UploadSourceInputRequestSchema.extend({projectId:ProjectIdSchema,idempotencyKey:key4});var SourceReadSchema=SourceLibraryMediaSchema.extend({offsetBytes:z17.int().min(0).max(8388608).default(0),maxTextBytes:z17.int().min(4).max(65536).default(16384)});var SourceTextWindowSchema=SourceLibraryMediaSchema.extend({contentType:z17.enum(["text/plain","application/json"]),checksumSha256:z17.string().regex(/^[0-9a-f]{64}$/),totalBytes:z17.int().positive().max(8388608),offsetBytes:z17.int().nonnegative(),byteLength:z17.int().nonnegative().max(65536),nextOffsetBytes:z17.int().nonnegative().nullable(),text:z17.string().max(65536)});var InterfaceImageMetadataSchema=KeyframeMediaSchema.omit({contentBase64:true});var InterfacePosterMetadataSchema=InterfaceImageMetadataSchema.extend({contentType:z18.literal("image/png")});var InterfaceDownloadDescriptorSchema=z18.strictObject({method:z18.literal("GET"),path:z18.string().min(1).max(2048),tenantId:TenantIdSchema,authentication:z18.literal("BEARER_AND_TENANT_HEADER"),contentType:z18.enum(["video/mp4","image/png","application/json"]),checksumSha256:z18.string().regex(/^[0-9a-f]{64}$/),byteSize:z18.int().positive().max(128*1024*1024)});var tenantMediaDownloadPath="/v1/local-execution/tenant-media/download";var InterfaceDeliveryDownloadDescriptorSchema=z18.discriminatedUnion("method",[InterfaceDownloadDescriptorSchema,InterfaceDownloadDescriptorSchema.extend({method:z18.literal("POST"),path:z18.literal(tenantMediaDownloadPath),productionId:ProductionIdSchema,contentType:z18.literal("video/mp4"),body:z18.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,representationId:ArtifactRepresentationIdSchema})})]);var SourceReadResultSchema=z18.union([SourceTextWindowSchema,SourceLibraryMediaSchema.extend(InterfaceImageMetadataSchema.shape).strict(),SourceLibraryMediaSchema.extend({contentType:z18.literal("video/mp4"),checksumSha256:z18.string().regex(/^[0-9a-f]{64}$/),byteSize:z18.int().positive().max(8388608),importOperation:z18.literal("imported-visual.register-source")}).strict()]);import{z as z19}from"zod";var StartReferencePreviewSchema=z19.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sourceArtifactId:ArtifactIdSchema,expectedBriefVersion:z19.int().positive(),idempotencyKey:z19.string().regex(/^[A-Za-z0-9_-]{8,80}$/)});var ReferencePreviewAdmissionSchema=z19.strictObject({semanticStatus:z19.literal("ACCEPTED"),operationId:OperationIdSchema,productionId:ProductionIdSchema,sourceArtifactId:ArtifactIdSchema,briefVersion:z19.int().positive()});var ReferencePreviewResultSchema=z19.strictObject({semanticStatus:z19.literal("SUCCESS"),sourceArtifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,contentType:z19.literal("image/png"),checksumSha256:z19.string().regex(/^[0-9a-f]{64}$/),width:z19.int().positive(),height:z19.int().positive(),byteSize:z19.int().positive(),contentBase64:z19.string().min(4)});var ReferencePreviewOperationInputSchema=z19.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,operationId:OperationIdSchema});var ReferencePreviewReadResultSchema=z19.union([ReferencePreviewResultSchema,z19.strictObject({semanticStatus:z19.literal("ACCEPTED")})]);var ReferencePreviewCancelResultSchema=z19.union([z19.strictObject({semanticStatus:z19.literal("ACCEPTED")}),z19.strictObject({semanticStatus:z19.literal("NOT_FOUND")})]);import{z as z20}from"zod";var StudioCapabilitiesInputSchema=z20.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema.optional()});var StudioCapabilitiesSchema=z20.strictObject({semanticStatus:z20.literal("SUCCESS"),capabilities:z20.array(z20.strictObject({capability:z20.string().min(1).max(120),tool:z20.string().min(1).max(120).optional(),availability:z20.enum(["AVAILABLE","UNAVAILABLE"]),reason:z20.string().min(1).max(1e3).nullable()})).max(512)});var VideoOptionsSchema=z20.array(z20.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600);import{z as z21}from"zod";var WorkspaceHealthSchema=z21.object({service:z21.string().min(1),status:z21.literal("ok")});import{z as z22}from"zod";var PrincipalKindSchema=z22.enum(["HUMAN","AGENT","SERVICE","WORKER"]);var PrincipalSchema=z22.object({id:PrincipalIdSchema,kind:PrincipalKindSchema,issuer:z22.string().trim().min(1),subject:z22.string().trim().min(1),displayName:z22.string().trim().min(1).nullable()});var TenantMembershipSchema=z22.object({tenantId:TenantIdSchema,principalId:PrincipalIdSchema});import{z as z23}from"zod";var TenantSchema=z23.object({id:TenantIdSchema,displayName:z23.string().trim().min(1).nullable(),createdAt:z23.iso.datetime({offset:true})});import{z as z24}from"zod";var Key=z24.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var Intent=z24.string().trim().min(1).max(600);var ExplorationScopeSchema=DirectorScopeSchema.extend({shotId:ShotIdSchema});var ExplorationBasisSchema=DirectorBasisSchema.safeExtend({shotId:ShotIdSchema,shotPlanningRevision:z24.int().positive()});var ExplorationContextInputSchema=z24.strictObject({scope:ExplorationScopeSchema,preparationIds:z24.array(PreparationIdSchema).max(6).default([])}).refine(v=>new Set(v.preparationIds).size===v.preparationIds.length,"Preparation IDs must be distinct");var ExplorationProfileIdentitySchema=KeyframeProviderProfileSchema.pick({id:true,adapterVersion:true,model:true,executionClass:true});var ExplorationOptionSchema=z24.strictObject({selection:ProviderSelectionSchema.nullable(),profile:z24.discriminatedUnion("mediaType",[KeyframeProviderProfileSchema,VideoProviderProfileSchema])});var Missing=z24.strictObject({semanticStatus:z24.literal("NEEDS_INPUT"),missingPrerequisites:z24.array(z24.enum(["ACTIVE_BRIEF","ACTIVE_STORY","ACTIVE_SCENE_SHOT_PLAN"])).min(1).max(3)});var ExplorationContextResultSchema=z24.discriminatedUnion("semanticStatus",[z24.strictObject({semanticStatus:z24.literal("SUCCESS"),advisory:z24.literal(true),basis:ExplorationBasisSchema,owner:DirectorContextResultSchema.options[0],preparations:z24.array(z24.strictObject({view:PreparationViewSchema,eligibleOptions:z24.array(ExplorationOptionSchema).max(24),eligibleOptionCount:z24.int().nonnegative(),optionsTruncated:z24.boolean()})).max(6)}),Missing]);var ImageDraft=KeyframeStartInputSchema.omit({idempotencyKey:true});var VideoDraft=VideoStartInputSchema.omit({idempotencyKey:true});var ExplorationCommandSchema=z24.strictObject({commandKey:Key,purpose:Intent,mediaType:z24.enum(["IMAGE","VIDEO"]),preparationId:PreparationIdSchema,contractId:ImageDraft.shape.contractId,contractFingerprint:ImageDraft.shape.contractFingerprint,selection:ProviderSelectionSchema.nullable(),profile:ExplorationProfileIdentitySchema});var ValidateExplorationPlanSchema=z24.strictObject({basis:ExplorationBasisSchema,plan:z24.strictObject({origin:z24.strictObject({kind:z24.literal("EXTERNAL_AGENT_HOST"),label:z24.string().trim().min(1).max(100)}),objective:Intent,comparisonCriteria:z24.array(Intent).min(1).max(8),unknowns:z24.array(z24.string().trim().min(1).max(300)).max(8),maximumGenerationCommands:z24.int().min(1).max(6),commands:z24.array(ExplorationCommandSchema).min(1).max(6)})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Exploration input exceeds the 1 MiB JSON budget");var ExplorationDraftSchema=z24.discriminatedUnion("mediaType",[z24.strictObject({commandKey:Key,mediaType:z24.literal("IMAGE"),request:ImageDraft}),z24.strictObject({commandKey:Key,mediaType:z24.literal("VIDEO"),request:VideoDraft})]);var ExplorationValidationResultSchema=z24.discriminatedUnion("semanticStatus",[z24.strictObject({semanticStatus:z24.literal("SUCCESS"),advisory:z24.literal(true),basis:ExplorationBasisSchema,plan:ValidateExplorationPlanSchema.shape.plan,generationDrafts:z24.array(ExplorationDraftSchema).min(1).max(6),limitations:z24.array(z24.enum(["ADMISSION_RECHECKS_BASIS_AND_PROVIDER","COMMAND_COUNT_IS_NOT_MONETARY_BUDGET","NO_AUTOMATIC_EXECUTION_OR_ACCEPTANCE","QUALITY_REQUIRES_EXACT_MEDIA_INSPECTION"])).length(4)}),Missing]);var ExplorationCompareInputSchema=z24.strictObject({scope:ExplorationScopeSchema,items:z24.array(z24.strictObject({label:Key,mediaType:z24.enum(["IMAGE","VIDEO"]),generationId:z24.uuid()})).min(2).max(6)});var ExplorationComparisonResultSchema=z24.strictObject({semanticStatus:z24.literal("SUCCESS"),advisory:z24.literal(true),scope:ExplorationScopeSchema,items:z24.array(z24.discriminatedUnion("mediaType",[z24.strictObject({label:Key,mediaType:z24.literal("IMAGE"),generation:KeyframeGenerationViewSchema,handoff:z24.strictObject({mediaRead:KeyframeReviewScopeSchema,reviewTarget:KeyframeReviewScopeSchema}).nullable()}),z24.strictObject({label:Key,mediaType:z24.literal("VIDEO"),generation:VideoGenerationViewSchema,handoff:z24.strictObject({mediaRead:VideoReviewScopeSchema,reviewTarget:VideoReviewScopeSchema}).nullable()})])).min(2).max(6),limitations:z24.tuple([z24.literal("OWNER_STATES_ARE_NOT_VISUAL_SCORES"),z24.literal("REVIEW_AND_ACCEPTANCE_REMAIN_EXPLICIT")])});import{z as z25}from"zod";var sha4=z25.string().regex(/^[0-9a-f]{64}$/);var FinalOutputReviewContextInputSchema=z25.strictObject({scope:DirectorScopeSchema,renderId:z25.uuid()});var FinalOutputReviewBasisSchema=FinalOutputReviewContextInputSchema.extend({contextFingerprint:sha4});var FinalOutputReviewContextResultSchema=z25.strictObject({semanticStatus:z25.literal("SUCCESS"),advisory:z25.literal(true),basis:FinalOutputReviewBasisSchema,ownerContext:DirectorContextResultSchema,deliveryTarget:DeliveryTargetSchema,deliverySnapshot:DeliverySnapshotSchema,validation:DeliveryValidationViewSchema.nullable(),manifest:RegisteredDeliveryManifestSchema.nullable(),limitations:z25.array(z25.enum(["OWNER_REVIEW_3_REMAINS_AUTHORITATIVE","NO_CALLER_SUPPLIED_DELIVERY_CHECKS","NO_IMPLICIT_MEDIA_OR_MODEL_CALL","READS_ARE_NOT_ATOMIC_OR_RESERVED"])).length(4)});import{z as z30}from"zod";import{z as z29}from"zod";import{z as z28}from"zod";import{z as z26}from"zod";var Text=z26.string().trim().min(1).max(600);var Method=z26.enum(["HUMAN","AI","CODE"]);var Key2=z26.string().regex(/^[a-z][a-z0-9_.:-]{0,99}$/);var CompositionAuthoringObligationsSchema=z26.strictObject({schemaVersion:z26.literal(1),basis:CompositionBasisPinSchema,productionRevision:z26.int().positive(),output:BriefContentSchema.pick({targetDurationSeconds:true,aspectRatio:true,outputProfile:true}),objective:BriefContentSchema.shape.objective,productPresentationGoal:BriefContentSchema.shape.productPresentationGoal,audience:BriefContentSchema.shape.audience,styleTone:BriefContentSchema.shape.styleTone,callToAction:BriefContentSchema.shape.callToAction,narrativeIntent:StoryContentSchema.shape.narrativeIntent,canonicalFacts:BriefContentSchema.shape.canonicalFacts,storyBeats:StoryContentSchema.shape.beats,storyFactualClaims:StoryContentSchema.shape.factualClaims,shot:ShotPlanEntrySchema.nullable(),obligationKeys:z26.array(Key2).min(1).max(384).refine(v=>new Set(v).size===v.length,"Obligation keys must be unique"),semantics:z26.literal("ACCEPTED_INTENT_NOT_OBSERVED_MEDIA")}).refine(v=>v.basis.shotId===null===(v.shot===null)&&(!v.shot||v.shot.shotId===v.basis.shotId),"Authoring Shot must match the exact planning basis");var MakingAlternativeSchema=z26.strictObject({alternativeId:z26.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z26.string().trim().min(1).max(120),method:z26.enum(["HUMAN","AI","CODE","HYBRID"]),contributions:z26.array(z26.strictObject({method:Method,role:z26.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),intent:Text})).min(1).max(6),rationale:Text,tradeoffs:z26.array(Text).max(6),obligationKeys:z26.array(Key2).min(1).max(384)}).superRefine((v,ctx)=>{const methods=new Set(v.contributions.map(c=>c.method));if(v.method==="HYBRID"?methods.size<2:methods.size!==1||!methods.has(v.method))ctx.addIssue({code:"custom",path:["contributions"],message:"Contributions must match the advisory making method"});if(new Set(v.contributions.map(c=>c.method+":"+c.role)).size!==v.contributions.length)ctx.addIssue({code:"custom",path:["contributions"],message:"Method/role contributions must be unique"});if(new Set(v.obligationKeys).size!==v.obligationKeys.length)ctx.addIssue({code:"custom",path:["obligationKeys"],message:"Obligation references must be unique"})});var ValidateCompositionMakingSchema=CompositionScopeSchema.extend({projectId:z26.uuid(),expectedProductionRevision:z26.int().positive(),basis:CompositionBasisPinSchema,proposal:z26.strictObject({origin:z26.strictObject({kind:z26.literal("EXTERNAL_AGENT_HOST"),label:z26.string().trim().min(1).max(100)}),makingIntent:z26.enum(["REAL_WORLD_CAPTURE","GENERATED_SCENE","PROGRAMMATIC_EXPLANATION"]),unknowns:z26.array(z26.string().trim().min(1).max(300)).max(8),alternatives:z26.array(MakingAlternativeSchema).min(1).max(3)})}).superRefine((v,ctx)=>{if(new Set(v.proposal.alternatives.map(a=>a.alternativeId)).size!==v.proposal.alternatives.length)ctx.addIssue({code:"custom",message:"Alternative IDs must be unique"});if(new TextEncoder().encode(JSON.stringify(v)).byteLength>131072)ctx.addIssue({code:"custom",message:"Making proposal exceeds the 128 KiB UTF-8 JSON budget"})});var CompositionMakingValidationSchema=CompositionScopeSchema.extend({semanticStatus:z26.literal("SUCCESS"),advisory:z26.literal(true),projectId:z26.uuid(),authoring:CompositionAuthoringObligationsSchema,proposal:ValidateCompositionMakingSchema.shape.proposal,limitations:z26.tuple([z26.literal("STRATEGY_IS_AGENT_ADVICE_NOT_CANONICAL_SELECTION"),z26.literal("SOURCE_METHOD_IS_NOT_PROVENANCE_OR_PROVIDER_ELIGIBILITY"),z26.literal("AUTHORING_AND_RENDER_RECHECK_CURRENT_BASIS"),z26.literal("INDEPENDENT_REVIEW_AND_DELIVERY_REMAIN_REQUIRED")])}).superRefine((v,ctx)=>{const required=new Set(v.authoring.obligationKeys);if(new Set(v.proposal.alternatives.map(a=>a.alternativeId)).size!==v.proposal.alternatives.length||v.proposal.alternatives.some(a=>a.obligationKeys.length!==required.size||a.obligationKeys.some(k=>!required.has(k))))ctx.addIssue({code:"custom",message:"Making result must retain unique alternatives and exact native obligation coverage"})});import{z as z27}from"zod";var CompositionAuthoringRequirementsSchema=z27.strictObject({videoFrameCache:z27.strictObject({profileId:z27.literal("HYPERFRAME_1080P30_FRAME_CACHE_V2"),media:z27.literal("MANAGED_MP4_H264_CFR30_SDR_YUV420P"),maxVideos:z27.literal(4),maxDimension:z27.literal(1920),maxPixels:z27.literal(2073600),maxSourceSeconds:z27.literal(60),playbackRate:z27.literal(1),loop:z27.literal(false),sourceOffset:z27.literal("ZERO_BASED_FRAME_ALIGNED"),srcPattern:z27.literal("/inputs/{inputName}.mp4"),attributes:z27.tuple([z27.literal("id"),z27.literal("src"),z27.literal("data-start"),z27.literal("data-duration")]),dynamicVideoSupported:z27.literal(false),nativePlaybackAndCanvasSamplingSupported:z27.literal(false)}).optional(),semantics:z27.literal("REQUIREMENTS_NOT_RUNTIME_OR_REVIEW_EVIDENCE"),dependencies:CompositionContentSchema.shape.dependencies,html:z27.strictObject({entrypoint:z27.literal("index.html"),stageSelector:z27.literal("#stage"),timelineRegistry:z27.literal("window.__timelines"),readinessPromise:z27.literal("window.__nativeReady"),gsapScript:z27.literal("/_native/gsap.min.js"),managedInputsScript:z27.literal("/native-inputs.js"),rootAttributes:z27.tuple([z27.literal("data-composition-id"),z27.literal("data-width"),z27.literal("data-height"),z27.literal("data-duration")]),timing:z27.literal("PAUSED_GSAP_TIMELINE_WITH_DURATION_MATCHING_LOCAL_CLOCK")})});var jsonSchema=z27.record(z27.string().max(120),z27.json());var CompositionAuthoringGuideSchema=z27.strictObject({inputTool:z27.literal("composition_put_input"),inputField:z27.literal("contentUtf8"),encoding:z27.literal("UTF8_JSON"),schemas:z27.strictObject({SOURCE:jsonSchema,DEPENDENCY_MANIFEST:jsonSchema,DEPENDENCY_LOCK:jsonSchema}),rendererRequirements:CompositionAuthoringRequirementsSchema.nullable(),dependencyInputs:z27.strictObject({dependencies:CompositionContentSchema.shape.dependencies,manifest:CompositionDependencyManifestSchema,lock:CompositionDependencyLockSchema}).nullable().optional(),validation:z27.literal("NATIVE_OWNER_RECHECKS_BYTES_BASIS_AND_SEMANTIC_REFINEMENTS")}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=65536);var CreateCompositionSchema=SubmitCompositionSchema.safeExtend({compositionId:z28.null(),expectedVersion:z28.literal(0),previousVersionId:z28.null()});var ReviseCompositionSchema=SubmitCompositionSchema.safeExtend({compositionId:z28.uuid(),expectedVersion:z28.int().positive(),previousVersionId:z28.uuid()});var CompositionBriefQuerySchema=CompositionScopeSchema.extend({shotId:z28.uuid().nullable().default(null)});var CompositionAuthoringBriefSchema=CompositionScopeSchema.extend({projectId:z28.uuid(),productionRevision:z28.int().positive(),planningStatus:z28.enum(["READY","MISSING_PLANNING","STALE_PLANNING","INACTIVE"]),basis:CompositionBasisPinSchema.nullable(),briefContent:BriefContentSchema.nullable(),storyContent:StoryContentSchema.nullable(),shot:ShotPlanEntrySchema.nullable(),authoring:CompositionAuthoringObligationsSchema.nullable().optional()});var ValidateCompositionSchema=CompositionScopeSchema.extend({expectedProductionRevision:z28.int().positive(),basis:CompositionBasisPinSchema,content:CompositionContentSchema}).superRefine((v,ctx)=>{if(v.content.role==="PRIMARY_VISUAL"&&!v.basis.shotId)ctx.addIssue({code:"custom",path:["basis","shotId"],message:"Primary visual requires a planned Shot"})});var CompositionValidationReceiptSchema=z28.strictObject({authoringValidation:z28.literal("PASS"),basis:CompositionBasisPinSchema,productionRevision:z28.int().positive(),contentFingerprint:z28.string().regex(/^[0-9a-f]{64}$/),inputCount:z28.int().min(3).max(64),byteReadback:z28.literal("VERIFIED"),rendererValidation:z28.literal("NOT_EXECUTED"),renderAvailability:z28.enum(["AVAILABLE","UNAVAILABLE"]),nextActions:z28.array(z28.enum(["CREATE_COMPOSITION","REVISE_COMPOSITION"])).max(2)});var PutCompositionInputSchema=CompositionScopeSchema.extend({name:CompositionBindingSchema.shape.name,purpose:z28.enum(["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK","DATA"]),declaredOrigin:CompositionBindingSchema.shape.declaredOrigin,executionClass:z28.enum(["LIVE","TEST_ONLY"]),contentUtf8:z28.string().min(1).max(8388608),idempotencyKey:z28.string().trim().min(1).max(200)}).superRefine((v,ctx)=>{if(v.purpose==="SOURCE"&&v.declaredOrigin!=="CODE")ctx.addIssue({code:"custom",path:["declaredOrigin"],message:"Programmatic source must retain CODE provenance"})});var CompositionInputReceiptSchema=z28.strictObject({binding:CompositionBindingSchema,projectId:z28.uuid(),contentType:z28.literal("application/json"),byteSize:z28.int().positive().max(8388608),executionClass:z28.enum(["LIVE","TEST_ONLY"]),inputStatus:z28.enum(["AVAILABLE","UNAVAILABLE"]),byteReadback:z28.literal("VERIFIED_AT_REGISTRATION")});var CompositionCapabilitySchema=z28.strictObject({capability:z28.string().min(1).max(80),tool:z28.string().nullable(),availability:z28.enum(["AVAILABLE","UNAVAILABLE"]),reason:z28.string().nullable()});var CompositionCapabilitiesSchema=z28.strictObject({provider:z28.literal("HYPERFRAME"),dialect:z28.literal("HYPERFRAME_HTML_GSAP_V1"),planningStatus:CompositionAuthoringBriefSchema.shape.planningStatus,capabilities:z28.array(CompositionCapabilitySchema).max(18),inputLimitsMiB:z28.strictObject({SOURCE:z28.literal(8),DEPENDENCY_MANIFEST:z28.literal(8),DEPENDENCY_LOCK:z28.literal(8),DATA:z28.literal(8),FONT:z28.literal(32),IMAGE:z28.literal(8),VIDEO:z28.literal(64)}),clockSemantics:z28.literal("RATIONAL_FPS_HALF_OPEN_FRAMES"),rendererValidation:z28.enum(["C3_PENDING","PER_REQUEST_CONFORMANCE"]),authoringGuide:CompositionAuthoringGuideSchema.optional()});var CompositionFailureSchema=z28.strictObject({semanticStatus:z28.enum(["INVALID_INPUT","NOT_FOUND","REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z28.strictObject({code:z28.string().max(80),message:z28.string().max(2e3)}),retryable:z28.boolean(),nextActions:z28.array(z28.string().max(80)).max(4),diagnostics:z28.array(z28.strictObject({code:z28.string().max(80),message:z28.string().max(2e3)})).max(32)});var ParameterValue=z29.strictObject({kind:z29.literal("PARAMETER_VALUE"),name:CompositionBindingSchema.shape.name,value:z29.union([z29.string().max(4e3),z29.number().finite(),z29.boolean()])});var Binding=CompositionBindingSchema.extend({purpose:z29.enum(["SOURCE","DATA","FONT","IMAGE","VIDEO"])});var CompositionRepairConsumerSchema=z29.discriminatedUnion("role",[z29.strictObject({role:z29.literal("PRIMARY_VISUAL"),clipOrdinal:z29.int().min(1).max(200)}),z29.strictObject({role:z29.literal("VISUAL_LAYER"),visualLayerId:z29.uuid()})]);var Consumers=z29.array(CompositionRepairConsumerSchema).min(1).max(208).refine(items=>new Set(items.map(i=>i.role==="PRIMARY_VISUAL"?i.role+i.clipOrdinal:i.role+i.visualLayerId)).size===items.length,"Coordinated consumers must be unique exact occurrences");var CompositionRepairPatchSchema=z29.discriminatedUnion("kind",[ParameterValue,z29.strictObject({kind:z29.literal("BINDING_REPLACE"),binding:Binding})]);var ReviseCompositionRepairActionSchema=z29.strictObject({kind:z29.literal("REVISE_COMPOSITION"),localityIndex:z29.int().min(0).max(207),patches:z29.array(CompositionRepairPatchSchema).min(1).max(16),coordinatedConsumers:Consumers.optional()}).superRefine((v,ctx)=>{const names=v.patches.map(p=>p.kind+":"+(p.kind==="PARAMETER_VALUE"?p.name:p.binding.name));if(new Set(names).size!==names.length)ctx.addIssue({code:"custom",message:"Local Composition patch targets must be unique"})});var CompositionRepairSubjectSchema=z29.strictObject({locality:CompositionFindingLocalitySchema,composition:CompositionViewSchema,render:CompositionRenderViewSchema});var{idempotencyKey,...revisionShape}=ReviseCompositionSchema.shape;var RevisionDraft=z29.strictObject(revisionShape).refine(v=>v.content.role!=="PRIMARY_VISUAL"||v.basis.shotId!==null,"Primary repair retains an exact planned Shot");var CompositionRepairHandoffSchema=z29.strictObject({kind:z29.literal("COMPOSITION_REVISE"),locality:CompositionFindingLocalitySchema,input:RevisionDraft,renderProfileId:z29.enum(["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2","HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"]),sourceReviewRequired:z29.boolean(),coordinatedConsumers:Consumers.optional()}).superRefine((v,ctx)=>{if(v.input.compositionId!==v.locality.compositionId||v.input.previousVersionId!==v.locality.compositionVersionId||v.input.expectedVersion!==v.locality.compositionVersion||v.input.content.role!==v.locality.role||v.coordinatedConsumers?.some(i=>i.role!==v.locality.role)||v.sourceReviewRequired!==(v.locality.role==="PRIMARY_VISUAL")||!(v.locality.role==="PRIMARY_VISUAL"?["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2"].includes(v.renderProfileId):v.renderProfileId==="HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"))ctx.addIssue({code:"custom",message:"Composition repair handoff must retain exact locality identity, role and original output profile"})});var text=z30.string().trim().min(1).max(2e3);var key5=z30.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var RepairStrategyContextInputSchema=z30.strictObject({scope:DirectorScopeSchema,findingId:z30.uuid()});var RepairStrategyBasisSchema=RepairStrategyContextInputSchema.extend({contextFingerprint:z30.string().regex(/^[0-9a-f]{64}$/)});var RepairStrategyActionSchema=z30.discriminatedUnion("kind",[ReviseCompositionRepairActionSchema,z30.strictObject({kind:z30.literal("TRIM_CLIP"),ordinal:z30.int().min(1).max(200),sourceInMs:z30.int().nonnegative().max(30150),sourceOutMs:z30.int().positive().max(30150)}),z30.strictObject({kind:z30.literal("REVISE_CAPTIONS"),content:CaptionContentSchema}),z30.strictObject({kind:z30.literal("ADJUST_TRANSITION"),ordinal:z30.int().min(2).max(200),transition:ClipTransitionSchema}),z30.strictObject({kind:z30.literal("ADJUST_AUDIO_COMPOSITION"),audio:TimelineAudioInputSchema}),z30.strictObject({kind:z30.literal("ACKNOWLEDGE_WARNINGS"),acknowledgements:z30.array(z30.strictObject({key:z30.string().min(1).max(220),reason:text})).min(1).max(300)}),z30.strictObject({kind:z30.literal("REGENERATE_SHOT"),shotId:z30.uuid()}),z30.strictObject({kind:z30.literal("REQUEST_HUMAN_INPUT"),question:text}),z30.strictObject({kind:z30.literal("REQUEST_CANONICAL_CHANGE"),requestedChange:text})]);var RepairStrategyAlternativeSchema=z30.strictObject({id:key5,rationale:text,whySmallerChangeInsufficient:text,action:RepairStrategyActionSchema});var ValidateRepairStrategySchema=z30.strictObject({basis:RepairStrategyBasisSchema,proposal:z30.strictObject({origin:z30.strictObject({kind:z30.literal("EXTERNAL_AGENT_HOST"),label:z30.string().trim().min(1).max(100)}),summary:text,alternatives:z30.array(RepairStrategyAlternativeSchema).min(1).max(6),selectedAlternativeId:key5})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Repair Strategy input exceeds the 1 MiB JSON budget");var RepairStrategyContextResultSchema=z30.strictObject({compositionRepairAvailable:z30.boolean().optional(),semanticStatus:z30.literal("SUCCESS"),advisory:z30.literal(true),basis:RepairStrategyBasisSchema,ownerContext:DirectorContextResultSchema,finding:RoughCutFindingViewSchema,reviewTarget:RoughCutReviewTargetSchema,finalReady:FinalReadyViewSchema,eligibility:z30.strictObject({ready:z30.boolean(),reasons:z30.array(z30.enum(["FINDING_NOT_OPEN","TARGET_STALE","MEDIA_UNAVAILABLE","PRODUCTION_UNAVAILABLE","REVIEW_CHANGED","FINDING_BASIS_CHANGED"])).max(6)})});var RepairStrategyHandoffSchema=z30.discriminatedUnion("kind",[CompositionRepairHandoffSchema,z30.strictObject({kind:z30.literal("TIMELINE_BUILD"),input:BuildTimelineShapeSchema.omit({idempotencyKey:true})}),z30.strictObject({kind:z30.literal("CAPTION_AUTHOR"),input:AuthorCaptionsSchema.omit({idempotencyKey:true})}),z30.strictObject({kind:z30.literal("FINAL_READY_DECIDE"),input:DecideFinalReadySchema.omit({idempotencyKey:true})}),z30.strictObject({kind:z30.literal("REGENERATION_INTENT"),preparationQuery:PreparationActiveInputSchema,admission:z30.literal("EXPLICIT_NATIVE_PREPARATION_AND_SELECTION_REQUIRED")}),z30.strictObject({kind:z30.literal("HUMAN_INPUT_INTENT"),question:text}),z30.strictObject({kind:z30.literal("CANONICAL_CHANGE_INTENT"),requestedChange:text})]);var RepairStrategyValidationResultSchema=z30.strictObject({semanticStatus:z30.literal("SUCCESS"),advisory:z30.literal(true),basis:RepairStrategyBasisSchema,proposal:ValidateRepairStrategySchema.shape.proposal,finding:RoughCutFindingViewSchema,alternatives:z30.array(z30.strictObject({alternativeId:key5,affectedScope:RoughCutFindingViewSchema.shape.affectedScope,handoff:RepairStrategyHandoffSchema,materialChange:z30.boolean(),preservedAcceptanceIds:z30.array(z30.uuid()).max(200),followUp:z30.array(z30.enum(["REVOKE_FINAL_READY_AND_REFRESH","REFRESH_TIMELINE_BASIS","ATTACH_NEW_CAPTION","REFRESH_AND_PREPARE_SHOT","EXPLICIT_VIDEO_GENERATION","REVIEW_1","SHOT_ACCEPTANCE","REBUILD_TIMELINE","ROUGH_CUT_RENDER","REVIEW_2","FINAL_READY_DECISION","AUTHORIZED_PLANNING_DECISION","COMPOSITION_REVISE","COMPOSITION_RENDER"])).max(10)})).min(1).max(6),selectedAlternativeId:key5,limitations:z30.tuple([z30.literal("NO_CANONICAL_REPAIR_LIFECYCLE_OR_WRITE"),z30.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z30.literal("CREATIVE_RATIONALE_IS_NOT_VERIFIED"),z30.literal("OWNER_RECHECKS_CAS_IDEMPOTENCY_AND_EXECUTION_CLASS"),z30.literal("MATERIAL_REPAIR_REQUIRES_NEW_OBSERVATION_AND_REVIEW")])}).superRefine((v,ctx)=>{const ids=v.alternatives.map(a=>a.alternativeId);const proposed=v.proposal.alternatives.map(a=>a.id);if(v.finding.id!==v.basis.findingId||v.finding.tenantId!==v.basis.scope.tenantId||v.finding.projectId!==v.basis.scope.projectId||v.finding.productionId!==v.basis.scope.productionId||v.selectedAlternativeId!==v.proposal.selectedAlternativeId||!ids.includes(v.selectedAlternativeId)||new Set(ids).size!==ids.length||ids.length!==proposed.length||ids.some(id7=>!proposed.includes(id7)))ctx.addIssue({code:"custom",message:"Repair validation must retain exact Finding and proposal selection"});for(const alternative of v.alternatives){const h=alternative.handoff;if("input"in h&&(h.input.tenantId!==v.basis.scope.tenantId||h.input.productionId!==v.basis.scope.productionId))ctx.addIssue({code:"custom",message:"Repair handoff must retain the exact native Tenant/Production scope"})}});import{z as z31}from"zod";var text2=z31.string().trim().min(1).max(2e3);var key6=z31.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var EditorContextInputSchema=z31.strictObject({scope:DirectorScopeSchema,timelineVersionId:z31.uuid()});var EditorBasisSchema=EditorContextInputSchema.extend({contextFingerprint:z31.string().regex(/^[0-9a-f]{64}$/)});var EditorAlternativeSchema=z31.strictObject({id:key6,rationale:text2,pacingIntent:text2,action:z31.discriminatedUnion("kind",[z31.strictObject({kind:z31.literal("BUILD_TIMELINE"),clips:BuildTimelineSchema.shape.clips}),z31.strictObject({kind:z31.literal("EDIT_GRAPHICS"),graphics:z31.array(TimelineGraphicInputSchema).min(1).max(8)}),z31.strictObject({kind:z31.literal("EDIT_VISUAL_LAYERS"),visualLayers:z31.array(TimelineVisualLayerInputSchema).min(1).max(8)}),z31.strictObject({kind:z31.literal("EDIT_AUDIO_COMPOSITION"),audio:TimelineAudioInputSchema}),z31.strictObject({kind:z31.literal("REVISE_CAPTIONS"),content:CaptionContentSchema}),z31.strictObject({kind:z31.literal("REQUEST_COMPOSITION_CAPABILITY"),concern:z31.enum(["TRANSITION","AUDIO_VISUAL_ALIGNMENT","VOICE_TIMING","CAPTION_RETIMING"]),requestedChange:text2}),z31.strictObject({kind:z31.literal("REQUEST_HUMAN_INPUT"),question:text2})])});var ValidateEditorProposalSchema=z31.strictObject({basis:EditorBasisSchema,proposal:z31.strictObject({origin:z31.strictObject({kind:z31.literal("EXTERNAL_AGENT_HOST"),label:z31.string().trim().min(1).max(100)}),summary:text2,alternatives:z31.array(EditorAlternativeSchema).min(1).max(6),selectedAlternativeId:key6})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Editor Intelligence input exceeds the 1 MiB JSON budget");var EditorContextResultSchema=z31.strictObject({semanticStatus:z31.literal("SUCCESS"),advisory:z31.literal(true),basis:EditorBasisSchema,ownerContext:DirectorContextResultSchema,timeline:TimelineViewSchema,timelineBasis:TimelineBasisSchema,finalReady:FinalReadyViewSchema,eligibility:z31.strictObject({ready:z31.boolean(),reasons:z31.array(z31.enum(["TIMELINE_NOT_CURRENT","TIMELINE_STALE","PRODUCTION_UNAVAILABLE","PLANNING_NOT_READY","CREATIVE_BASIS_CHANGED","NO_CURRENT_ACCEPTED_MEDIA","COMPOSITION_VERSION_UNSUPPORTED"])).max(7)})});var ReviewScope=z31.strictObject({kind:z31.literal("PRODUCTION"),interval:z31.strictObject({startMs:z31.literal(0),endMs:z31.int().positive().max(603e4)}),shotIds:z31.array(z31.uuid()).min(1).max(200),dimensions:z31.array(z31.enum(["PACING","ORDERING","CUT_CONTINUITY","PRODUCT_PRESENTATION","CAPTION_TIMING_VISIBILITY","AUDIO_VISUAL_ALIGNMENT","BASIC_MIX"])).min(4).max(7),requirement:z31.literal("COMPLETE_NEW_OUTPUT_INSPECTION")});var EditorHandoffSchema=z31.discriminatedUnion("kind",[z31.strictObject({kind:z31.literal("TIMELINE_BUILD"),input:BuildTimelineShapeSchema.omit({idempotencyKey:true}),preview:TimelineManifestReaderSchema,assemblyStatus:z31.enum(["DRAFT","ASSEMBLY_READY"]),changedOrdinals:z31.array(z31.int().positive().max(200)).max(200),changedGraphicArtifactIds:z31.array(z31.uuid()).max(8),changedAudioPurposes:z31.array(z31.enum(["VOICEOVER","MUSIC"])).max(2),preservedAcceptanceIds:z31.array(z31.uuid()).max(200),reviewScope:ReviewScope,followUp:z31.array(z31.enum(["NATIVE_TIMELINE_BUILD","COMPLETE_TIMELINE","ROUGH_CUT_RENDER","REVIEW_2","FINAL_READY_DECISION"])).min(4).max(5)}),z31.strictObject({kind:z31.literal("CAPTION_AUTHOR"),input:AuthorCaptionsSchema.omit({idempotencyKey:true}),attachment:z31.strictObject({expectedTimelineVersion:z31.int().positive(),preserveCurrentComposition:z31.literal(true),composition:z31.strictObject({schemaVersion:BuildTimelineShapeSchema.shape.schemaVersion,clips:BuildTimelineSchema.shape.clips,audio:BuildTimelineSchema.shape.audio.optional(),sourceSound:BuildTimelineShapeSchema.shape.sourceSound,graphics:BuildTimelineSchema.shape.graphics.optional(),visualLayers:BuildTimelineShapeSchema.shape.visualLayers})}),followUp:z31.tuple([z31.literal("NATIVE_CAPTION_AUTHOR"),z31.literal("ATTACH_NEW_CAPTION_TO_TIMELINE"),z31.literal("ROUGH_CUT_RENDER"),z31.literal("REVIEW_2"),z31.literal("FINAL_READY_DECISION")])}),z31.strictObject({kind:z31.literal("COMPOSITION_CAPABILITY_INTENT"),concern:z31.enum(["TRANSITION","AUDIO_VISUAL_ALIGNMENT","VOICE_TIMING","CAPTION_RETIMING"]),requestedChange:text2,admission:z31.literal("EXPLICIT_CANONICAL_CAPABILITY_REQUIRED")}),z31.strictObject({kind:z31.literal("HUMAN_INPUT_INTENT"),question:text2})]);var EditorValidationResultSchema=z31.strictObject({semanticStatus:z31.literal("SUCCESS"),advisory:z31.literal(true),basis:EditorBasisSchema,proposal:ValidateEditorProposalSchema.shape.proposal,alternatives:z31.array(z31.strictObject({alternativeId:key6,handoff:EditorHandoffSchema})).min(1).max(6),selectedAlternativeId:key6,limitations:z31.tuple([z31.literal("NO_TIMELINE_WRITE_RENDER_OR_PROVIDER_CALL"),z31.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z31.literal("CREATIVE_RATIONALE_IS_NOT_VERIFIED"),z31.literal("OWNER_RECHECKS_CAS_IDEMPOTENCY_AND_EXECUTION_CLASS"),z31.literal("EDIT_REQUIRES_NEW_OUTPUT_INSPECTION_AND_REVIEW")])});import{z as z32}from"zod";var scope={tenantId:z32.uuid(),productionId:z32.uuid()};var TemporalEvidenceTargetSchema=z32.strictObject({...scope,artifactId:z32.uuid(),representationId:z32.uuid(),checksumSha256:z32.string().regex(/^[0-9a-f]{64}$/)});var OriginalVideoReadSchema=TemporalEvidenceTargetSchema;var OriginalVideoResultSchema=z32.strictObject({source:TemporalEvidenceSourceSchema,contentType:z32.literal("video/mp4"),dataBase64:z32.string().min(4).max(4*Math.ceil(8*1024*1024/3)).regex(/^[A-Za-z0-9+/]+={0,2}$/)}).refine(v=>{const padding=v.dataBase64.endsWith("==")?2:v.dataBase64.endsWith("=")?1:0;return v.dataBase64.length%4===0&&v.source.byteSize<=8*1024*1024&&v.dataBase64.length/4*3-padding===v.source.byteSize},"Original video must match its exact bounded byte size");var TemporalEvidenceStartSchema=TemporalEvidenceTargetSchema.extend({profile:TemporalSamplingProfileSchema,expectedProductionRevision:z32.int().positive(),idempotencyKey:z32.string().trim().min(1).max(128),deviceId:z32.uuid().toLowerCase().optional()});var TemporalEvidenceGetSchema=z32.strictObject({...scope,evidenceId:z32.uuid()});var TemporalEvidenceAdmissionSchema=z32.strictObject({semanticStatus:z32.literal("ACCEPTED"),evidenceId:z32.uuid(),runtimeJobId:z32.uuid(),operationId:z32.string().min(1),source:TemporalEvidenceSourceSchema,planFingerprint:z32.string().regex(/^[0-9a-f]{64}$/),productionRevision:z32.int().positive()});var TemporalEvidenceOutputSchema=z32.strictObject({frameSetArtifactId:z32.uuid(),manifestRepresentationId:z32.uuid(),frameRepresentationIds:z32.array(z32.uuid()).min(1).max(64),contactSheetArtifactId:z32.uuid(),sheetRepresentationId:z32.uuid(),manifest:TemporalEvidenceManifestSchema,createdAt:z32.iso.datetime({offset:true})}).refine(v=>v.frameRepresentationIds.length===v.manifest.frames.length&&new Set(v.frameRepresentationIds).size===v.frameRepresentationIds.length,"Exact frame representations must be complete and unique");var TemporalEvidenceViewSchema=z32.strictObject({evidenceId:z32.uuid(),runtimeJobId:z32.uuid(),operationId:z32.string().min(1),source:TemporalEvidenceSourceSchema,planFingerprint:z32.string().regex(/^[0-9a-f]{64}$/),runtimeState:z32.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),output:TemporalEvidenceOutputSchema.nullable()});var TemporalEvidenceMediaSchema=TemporalEvidenceGetSchema.extend({kind:z32.enum(["FRAME","SHEET","MANIFEST"]),ordinal:z32.int().nonnegative().max(63).optional()}).refine(v=>v.kind==="FRAME"?v.ordinal!==void 0:v.ordinal===void 0,"Only individual frames require an ordinal");var TemporalEvidenceImageSchema=TemporalEvidenceMediaSchema.safeExtend({kind:z32.enum(["FRAME","SHEET"])});var TemporalEvidenceImageMetadataSchema=TemporalEvidenceImageSchema.safeExtend({contentType:z32.literal("image/png"),checksumSha256:z32.string().regex(/^[0-9a-f]{64}$/),byteSize:z32.int().positive().max(16*1024*1024)});import{z as z33}from"zod";var Text2=z33.string().trim().min(1).max(1e3);var bounded=(value,bytes)=>new TextEncoder().encode(JSON.stringify(value)).byteLength<=bytes;var ExplorationComparisonCriterionSchema=z33.strictObject({key:ReviewEvidenceKeySchema,description:Text2,modality:z33.enum(["VISUAL","TEMPORAL"])});var ExplorationRecommendationContextInputSchema=ExplorationCompareInputSchema.extend({criteria:z33.array(ExplorationComparisonCriterionSchema).min(1).max(8)}).superRefine((v,c)=>{if(new Set(v.items.map(i=>i.mediaType)).size!==1)c.addIssue({code:"custom",message:"Recommendation compares one media type"});if(new Set(v.items.map(i=>i.label)).size!==v.items.length||new Set(v.items.map(i=>i.generationId.toLowerCase())).size!==v.items.length)c.addIssue({code:"custom",message:"Labels and generation identities must be distinct"});if(new Set(v.criteria.map(i=>i.key)).size!==v.criteria.length)c.addIssue({code:"custom",message:"Comparison criterion keys must be distinct"});if(v.items[0].mediaType==="IMAGE"&&v.criteria.some(i=>i.modality==="TEMPORAL"))c.addIssue({code:"custom",message:"Temporal comparison requires VIDEO"});if(!bounded(v,1024*1024))c.addIssue({code:"custom",message:"Recommendation input exceeds 1 MiB"})});var ExplorationRecommendationBasisSchema=z33.strictObject({input:ExplorationRecommendationContextInputSchema,contextFingerprint:z33.string().regex(/^[0-9a-f]{64}$/)});var ExplorationRecommendationCandidateSchema=z33.strictObject({label:ReviewEvidenceKeySchema,readiness:z33.enum(["REVIEWABLE","UNAVAILABLE"]),reasons:z33.array(z33.enum(["NO_CANDIDATE","STALE_BASIS","PRODUCTION_NOT_RUNNABLE","OUTPUT_NOT_INSPECTABLE"])).max(4),reviewContext:ReviewIntelligenceContextResultSchema.nullable()});var ExplorationRecommendationContextResultSchema=z33.strictObject({semanticStatus:z33.literal("SUCCESS"),advisory:z33.literal(true),basis:ExplorationRecommendationBasisSchema,comparison:ExplorationComparisonResultSchema,candidates:z33.array(ExplorationRecommendationCandidateSchema).min(2).max(6),limitations:z33.tuple([z33.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z33.literal("NO_IMPLICIT_MEDIA_OR_MODEL_CALL")])}).refine(v=>bounded(v,2*1024*1024),"Recommendation context exceeds 2 MiB");var ExplorationComparisonJudgmentSchema=z33.strictObject({label:ReviewEvidenceKeySchema,criterionKey:ReviewEvidenceKeySchema,judgment:z33.enum(["FAVORABLE","UNFAVORABLE","UNCERTAIN","NOT_OBSERVABLE"]),rationale:Text2,evidenceIds:z33.array(ReviewEvidenceKeySchema).max(16)});var ExplorationRecommendationDecisionSchema=z33.discriminatedUnion("kind",[z33.strictObject({kind:z33.literal("RECOMMEND"),label:ReviewEvidenceKeySchema,rationale:Text2,notSelected:z33.array(z33.strictObject({label:ReviewEvidenceKeySchema,reason:Text2})).min(1).max(5)}),z33.strictObject({kind:z33.literal("NO_RECOMMENDATION"),reason:Text2})]);var ValidateExplorationRecommendationSchema=z33.strictObject({basis:ExplorationRecommendationBasisSchema,proposal:z33.strictObject({origin:z33.strictObject({kind:z33.literal("EXTERNAL_AGENT_HOST"),label:z33.string().trim().min(1).max(100)}),summary:z33.string().trim().min(1).max(2e3),assessments:z33.array(z33.strictObject({label:ReviewEvidenceKeySchema,reviewProposal:ValidateReviewIntelligenceSchema.shape.proposal})).max(6),judgments:z33.array(ExplorationComparisonJudgmentSchema).max(48),decision:ExplorationRecommendationDecisionSchema,unknowns:z33.array(z33.string().trim().min(1).max(300)).max(8)})}).refine(v=>bounded(v,1024*1024),"Recommendation input exceeds 1 MiB");var ExplorationRecommendationValidationResultSchema=z33.strictObject({semanticStatus:z33.literal("SUCCESS"),advisory:z33.literal(true),basis:ExplorationRecommendationBasisSchema,origin:ValidateExplorationRecommendationSchema.shape.proposal.shape.origin,summary:z33.string(),judgments:z33.array(ExplorationComparisonJudgmentSchema).max(48),decision:ExplorationRecommendationDecisionSchema,unknowns:z33.array(z33.string()).max(8),reviews:z33.array(z33.strictObject({label:ReviewEvidenceKeySchema,validation:ReviewIntelligenceValidationResultSchema})).max(6),limitations:z33.tuple([z33.literal("HOST_PREFERENCE_IS_NOT_CANONICAL_SELECTION"),z33.literal("EVIDENCE_DECLARATIONS_ARE_NOT_ATTESTED_INSPECTION"),z33.literal("RULE_PREVIEWS_ARE_NOT_CANONICAL_REVIEWS"),z33.literal("EXPLICIT_RECORD_AND_SEPARATE_ACCEPTANCE_REQUIRED"),z33.literal("OWNER_RECHECKS_CURRENTNESS_CAS_AND_EXECUTION_CLASS")])}).refine(v=>bounded(v,4*1024*1024),"Recommendation result exceeds 4 MiB");import{z as z35}from"zod";import{z as z34}from"zod";var Review1FindingSchema=z34.strictObject({id:z34.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,mediaType:z34.enum(["IMAGE","VIDEO"]),framePurpose:z34.string().max(40).optional(),generationId:z34.uuid(),candidateId:z34.uuid(),reviewId:z34.uuid(),artifactId:z34.uuid(),representationId:z34.uuid(),checksumSha256:z34.string().regex(/^[0-9a-f]{64}$/),preparationId:z34.uuid(),contractId:z34.uuid(),contractFingerprint:z34.string().regex(/^[0-9a-f]{64}$/),executionClass:z34.enum(["LIVE","TEST_ONLY"]),requirement:z34.union([VideoReviewRequirementSchema,VisualRequirementSchema]),observation:z34.union([VideoObservationSchema,KeyframeObservationSchema]),blocking:z34.boolean(),severity:z34.enum(["BLOCKING","WARNING"]),basisFingerprint:z34.string().regex(/^[0-9a-f]{64}$/),createdAt:z34.iso.datetime({offset:true})}).superRefine((v,c)=>{if(v.requirement.key!==v.observation.key||v.blocking!==(v.severity==="BLOCKING"))c.addIssue({code:"custom",message:"Finding must bind its exact native obligation"})});var Review1FindingViewSchema=Review1FindingSchema.safeExtend({lifecycle:z34.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","SUPERSEDED"]),proofReviewId:z34.uuid().nullable()});var Review1RepairSourceSchema=z34.strictObject(Review1FindingSchema.shape).omit({id:true,createdAt:true}).superRefine((v,c)=>{if(v.requirement.key!==v.observation.key||v.blocking!==(v.severity==="BLOCKING"))c.addIssue({code:"custom",message:"Source must bind its exact native obligation"})});var Review1RepairSourceQuerySchema=z34.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,mediaType:z34.enum(["IMAGE","VIDEO"]),generationId:z34.uuid(),reviewId:z34.uuid(),requirementKey:z34.string().min(1).max(220)});var sha5=z35.string().regex(/^[0-9a-f]{64}$/);var handoffs={REVISE_COMPOSITION:"COMPOSITION_REVISE",TRIM_CLIP:"TIMELINE_BUILD",ADJUST_TRANSITION:"TIMELINE_BUILD",ADJUST_AUDIO_COMPOSITION:"TIMELINE_BUILD",REVISE_CAPTIONS:"CAPTION_AUTHOR",ACKNOWLEDGE_WARNINGS:"FINAL_READY_DECIDE",REGENERATE_SHOT:"REGENERATION_INTENT",REQUEST_HUMAN_INPUT:"HUMAN_INPUT_INTENT",REQUEST_CANONICAL_CHANGE:"CANONICAL_CHANGE_INTENT"};var SemanticRepairBudgetSchema=z35.strictObject({maxSemanticAttempts:z35.int().min(1).max(20),maxElapsedMs:z35.int().min(1).max(864e5),currency:z35.literal("USD"),maxCostMicros:z35.int().min(0).max(1e9),maxConsecutiveNoImprovement:z35.int().min(1).max(20)});var RepairPlanScopeSchema=z35.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,planId:z35.uuid()});var AuthorRepairPlanSchema=z35.strictObject({strategy:ValidateRepairStrategySchema,expectedProductionRevision:z35.int().positive(),expectedCaseVersion:z35.int().nonnegative(),budget:SemanticRepairBudgetSchema,idempotencyKey:z35.string().trim().min(1).max(200)}).superRefine((v,c)=>{const p=v.strategy.proposal;if(new Set(p.alternatives.map(a=>a.id)).size!==p.alternatives.length||!p.alternatives.some(a=>a.id===p.selectedAlternativeId))c.addIssue({code:"custom",message:"Repair authoring requires unique alternatives and an explicit selection"})});var RepairDecisionSchema=z35.strictObject({id:z35.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,caseId:z35.uuid(),caseVersion:z35.int().positive(),basis:RepairStrategyBasisSchema,sourceReviewId:z35.uuid(),sourceRenderId:z35.uuid().nullable(),review1Source:Review1FindingSchema.optional(),sourceBasisFingerprint:sha5,affectedScopeFingerprint:sha5,obligationFingerprint:sha5,proposal:ValidateRepairStrategySchema.shape.proposal,selectedAlternativeId:z35.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),handoff:RepairStrategyHandoffSchema,budget:SemanticRepairBudgetSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z35.iso.datetime({offset:true})}).superRefine((d,c)=>{if(d.sourceRenderId===null!==!!d.review1Source||d.review1Source&&(d.review1Source.id!==d.basis.findingId||d.review1Source.reviewId!==d.sourceReviewId||d.review1Source.tenantId!==d.tenantId||d.review1Source.projectId!==d.projectId||d.review1Source.productionId!==d.productionId||d.handoff.kind!=="REGENERATION_INTENT"))c.addIssue({code:"custom",message:"Repair must retain its native Review layer and source"});if(d.basis.scope.tenantId!==d.tenantId||d.basis.scope.productionId!==d.productionId||d.basis.scope.projectId!==d.projectId)c.addIssue({code:"custom",message:"Repair Decision scope must be exactly owned"});if(d.selectedAlternativeId!==d.proposal.selectedAlternativeId||new Set(d.proposal.alternatives.map(a=>a.id)).size!==d.proposal.alternatives.length||!d.proposal.alternatives.some(a=>a.id===d.selectedAlternativeId&&handoffs[a.action.kind]===d.handoff.kind))c.addIssue({code:"custom",message:"Repair Decision must bind the explicit selected alternative"})});var SemanticRepairAttemptSchema=z35.strictObject({id:z35.uuid(),planId:z35.uuid(),caseId:z35.uuid(),ordinal:z35.int().min(1).max(20),executionIdentity:z35.string().trim().min(1).max(200),strategyFingerprint:sha5,startedAt:z35.iso.datetime({offset:true}),reservedCostMicros:z35.int().min(0).max(1e9),chargedCostMicros:z35.int().min(0).max(1e9).nullable(),currency:z35.literal("USD"),outcome:z35.enum(["IN_FLIGHT","AWAITING_REVIEW","IMPROVED","NO_IMPROVEMENT","OPERATIONAL_FAILURE","WAIVED"])});var RecordRepairProofSchema=RepairPlanScopeSchema.extend({attemptId:z35.uuid(),renderId:z35.uuid(),reviewId:z35.uuid(),expectedProductionRevision:z35.int().positive(),idempotencyKey:z35.string().trim().min(1).max(200)});import{z as z36}from"zod";var AuthorReview1RepairSchema=z36.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,mediaType:z36.enum(["IMAGE","VIDEO"]),generationId:z36.uuid(),reviewId:z36.uuid(),requirementKey:z36.string().min(1).max(220),reason:z36.string().trim().min(1).max(2e3),expectedProductionRevision:z36.int().positive(),expectedCaseVersion:z36.int().nonnegative(),budget:SemanticRepairBudgetSchema,idempotencyKey:z36.string().trim().min(1).max(200)});var RecordReview1RepairProofSchema=RepairPlanScopeSchema.extend({attemptId:z36.uuid(),generationId:z36.uuid(),reviewId:z36.uuid(),expectedProductionRevision:z36.int().positive(),idempotencyKey:z36.string().trim().min(1).max(200)});import{z as z37}from"zod";var ExecuteRepairSchema=RepairPlanScopeSchema.extend({expectedProductionRevision:z37.int().positive(),expectedCaseVersion:z37.int().positive(),idempotencyKey:z37.string().trim().min(1).max(200),generation:VideoStartInputSchema.omit({idempotencyKey:true}).optional(),keyframeGeneration:KeyframeStartInputSchema.omit({idempotencyKey:true}).optional()});var RepairAttemptEventSchema=z37.strictObject({id:z37.uuid(),attemptId:z37.uuid(),version:z37.int().positive(),outcome:SemanticRepairAttemptSchema.shape.outcome.exclude(["IN_FLIGHT"]),renderId:z37.uuid().nullable(),reviewId:z37.uuid().nullable(),generationId:z37.uuid().optional(),recordedAt:z37.iso.datetime({offset:true})});var RepairAttemptViewSchema=SemanticRepairAttemptSchema.extend({costQuote:GenerationCostQuoteSchema.optional(),events:z37.array(RepairAttemptEventSchema).max(40)});var RepairCaseViewSchema=z37.strictObject({id:z37.uuid(),version:z37.int().positive(),issueKey:z37.string().regex(/^[0-9a-f]{64}$/),budget:SemanticRepairBudgetSchema,openedAt:z37.iso.datetime({offset:true})});var RepairPlanViewSchema=z37.strictObject({review1Finding:Review1FindingViewSchema.optional(),decision:RepairDecisionSchema,repairCase:RepairCaseViewSchema,attempts:z37.array(RepairAttemptViewSchema).max(20)});var RepairAuthorReceiptSchema=z37.strictObject({semanticStatus:z37.literal("SUCCESS"),decision:RepairDecisionSchema,productionRevision:z37.int().positive()});var RepairExecutionReceiptSchema=z37.strictObject({costQuote:GenerationCostQuoteSchema.optional(),semanticStatus:z37.literal("ACCEPTED"),attempt:SemanticRepairAttemptSchema,decision:RepairDecisionSchema,productionRevision:z37.int().positive(),generation:ExecuteRepairSchema.shape.generation.nullable(),keyframeGeneration:ExecuteRepairSchema.shape.keyframeGeneration.nullable().optional()});var RepairProgressSchema=z37.strictObject({view:RepairPlanViewSchema,stage:z37.enum(["WAITING_INPUT","WAITING_GENERATION","WAITING_COMPOSITION_RENDER","WAITING_SOURCE_ACCEPTANCE","WAITING_RENDER","AWAITING_REVIEW","WAIVED","OPERATIONAL_FAILURE","IMPROVED","NO_IMPROVEMENT"]),renderId:z37.uuid().nullable(),generationId:z37.uuid().nullable()});var RepairProofReceiptSchema=z37.strictObject({semanticStatus:z37.literal("SUCCESS"),event:RepairAttemptEventSchema,productionRevision:z37.int().positive()});import{z as z38}from"zod";var EXTERNAL_EVENT_TYPES=["production.started","production.failed","production.cancelled","finding.opened","artifact.created","shot.candidate_ready","shot.accepted","review.completed","rough_cut.ready","final_render.ready","approval.required","production.completed","delivery.validation_failed"];var ExternalEventTypeSchema=z38.enum(EXTERNAL_EVENT_TYPES);var LifecycleEventScopeSchema=z38.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema}).strict();var ExternalLifecycleEventSchema=z38.object({schemaVersion:z38.literal(1),eventId:z38.uuid(),tenantId:TenantIdSchema,productionId:ProductionIdSchema,projectId:z38.uuid(),type:ExternalEventTypeSchema,target:z38.object({type:z38.string().min(1).max(60),id:z38.uuid()}).strict(),occurredAt:z38.iso.datetime(),basis:z38.object({productionRevision:z38.number().int().positive()}).strict(),payload:z38.object({sourceEventType:z38.string().min(1).max(100),artifactId:z38.uuid().optional(),candidateId:z38.uuid().optional(),reviewId:z38.uuid().optional(),findingId:z38.uuid().optional(),shotId:z38.uuid().optional(),manifestId:z38.uuid().optional(),validationId:z38.uuid().optional(),action:z38.string().max(40).optional(),result:z38.string().max(40).optional(),executionClass:z38.enum(["LIVE","TEST_ONLY"]).optional()}).strict()}).strict();var WebhookEndpointSchema=z38.url().max(2048).refine(value=>{const u=new URL(value);return u.protocol==="https:"&&!u.username&&!u.password&&!u.hash&&(!u.port||u.port==="443")&&!u.hostname.startsWith("[")});var ConfigureWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z38.uuid(),expectedRevision:z38.number().int().nonnegative(),idempotencyKey:z38.string().min(1).max(128),endpoint:WebhookEndpointSchema,eventTypes:z38.array(ExternalEventTypeSchema).min(1).max(EXTERNAL_EVENT_TYPES.length).refine(v=>new Set(v).size===v.length),signingSecret:z38.string().min(32).max(256)}).strict();var DisableWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z38.uuid(),expectedRevision:z38.number().int().positive(),idempotencyKey:z38.string().min(1).max(128)}).strict();var ReplayWebhookSchema=DisableWebhookSchema.extend({eventId:z38.uuid()}).strict();var QueryLifecycleEventsSchema=LifecycleEventScopeSchema.extend({kind:z38.enum(["subscriptions","events","deliveries","attempts"]),subscriptionId:z38.uuid().optional(),deliveryId:z38.uuid().optional(),after:z38.uuid().optional(),limit:z38.number().int().min(1).max(50).default(20)}).strict().refine(v=>v.kind!=="attempts"||!!v.deliveryId);var WebhookSubscriptionSchema=LifecycleEventScopeSchema.extend({subscriptionId:z38.uuid(),version:z38.number().int().positive(),revision:z38.number().int().positive(),state:z38.enum(["ACTIVE","DISABLED","DEGRADED"]),endpoint:WebhookEndpointSchema,eventTypes:z38.array(ExternalEventTypeSchema),updatedAt:z38.iso.datetime()}).strict();import{z as z39}from"zod";var WebhookReplayReceiptSchema=z39.strictObject({deliveryId:z39.uuid(),eventId:z39.uuid(),runtimeJobId:z39.uuid()});var WebhookDeliveryViewSchema=z39.strictObject({deliveryId:z39.uuid(),eventId:z39.uuid(),subscriptionId:z39.uuid(),subscriptionVersion:z39.int().positive(),replayNumber:z39.int().nonnegative(),runtimeJobId:z39.uuid(),lifecycle:z39.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),runtimeAttempts:z39.int().nonnegative(),wakeAt:z39.iso.datetime({offset:true}).nullable()});var WebhookAttemptViewSchema=z39.strictObject({attemptId:z39.uuid(),runtimeAttemptId:z39.uuid(),outcome:z39.enum(["STARTED","ACKNOWLEDGED","TRANSIENT","PERMANENT","SKIPPED"]),responseStatus:z39.int().min(100).max(599).nullable(),startedAt:z39.iso.datetime({offset:true}),endedAt:z39.iso.datetime({offset:true}).nullable()});var page={next:z39.uuid().nullable()};var WebhookSubscriptionPageSchema=z39.strictObject({...page,items:z39.array(WebhookSubscriptionSchema).max(50)});var ExternalLifecycleEventPageSchema=z39.strictObject({...page,items:z39.array(ExternalLifecycleEventSchema).max(50)});var WebhookDeliveryPageSchema=z39.strictObject({...page,items:z39.array(WebhookDeliveryViewSchema).max(50)});var WebhookAttemptPageSchema=z39.strictObject({...page,items:z39.array(WebhookAttemptViewSchema).max(50)});var LifecycleEventCapabilitiesSchema=z39.strictObject({eventTypes:z39.array(ExternalEventTypeSchema).max(13),unavailableNativeEvents:z39.array(z39.enum(["production.failed","production.cancelled","finding.opened"])).max(3),delivery:z39.literal("AT_LEAST_ONCE"),payload:z39.literal("QUERY_NOTIFICATION"),scope:z39.literal("PRODUCTION"),automaticOutboundAttempts:z39.literal(3),manualReplaysPerEvent:z39.literal(3),projectOnlyArtifacts:z39.literal("UNAVAILABLE"),orderingGuaranteed:z39.literal(false),signature:z39.literal("HMAC_SHA256_TIMESTAMP_DOT_EXACT_BODY")});import{z as z40}from"zod";var sha6=z40.string().regex(/^[0-9a-f]{64}$/);var CompositionSourceInspectSchema=CompositionGetSchema.extend({versionId:z40.uuid(),fingerprint:sha6,file:CompositionPathSchema.optional(),startLine:z40.int().min(1).max(8388609).default(1),lineLimit:z40.int().min(1).max(200).default(80)});var CompositionSourceInspectionSchema=z40.strictObject({composition:CompositionViewSchema,source:CompositionInputFactSchema,byteReadback:z40.literal("VERIFIED"),selection:z40.strictObject({file:CompositionPathSchema.nullable(),startLine:z40.int().positive(),lineLimit:z40.int().min(1).max(200)}),files:z40.array(z40.strictObject({path:CompositionPathSchema,contentType:z40.string().max(80),byteSize:z40.int().nonnegative().max(8388608),lineCount:z40.int().positive().max(8388609)})).min(1).max(128),window:z40.strictObject({file:CompositionPathSchema,startLine:z40.int().positive(),lines:z40.array(z40.strictObject({number:z40.int().positive(),text:z40.string().max(65536)})).max(200),hasMore:z40.boolean(),nextLine:z40.int().positive().nullable()}).nullable(),limitations:z40.tuple([z40.literal("SOURCE_INSPECTION_IS_NOT_OUTPUT_REVIEW"),z40.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED")])});var SourceReviewContextInputSchema=z40.strictObject({scope:DirectorScopeSchema,source:CompositionSourceInspectSchema,renderId:z40.uuid().optional()}).refine(i=>i.scope.tenantId===i.source.tenantId&&i.scope.productionId===i.source.productionId,"Source Review retains exact Tenant/Production scope");var SourceReviewContextSchema=z40.strictObject({semanticStatus:z40.literal("SUCCESS"),advisory:z40.literal(true),basis:z40.strictObject({input:SourceReviewContextInputSchema,contextFingerprint:sha6}),ownerContext:DirectorContextResultSchema,source:CompositionSourceInspectionSchema,render:CompositionRenderViewSchema.nullable(),outputReviewTarget:ProgrammaticVideoReviewTargetSchema.nullable(),limitations:z40.tuple([z40.literal("SOURCE_REASONING_DOES_NOT_CERTIFY_OUTPUT_QUALITY"),z40.literal("INDEPENDENT_OUTPUT_REVIEW_AND_ACCEPTANCE_REQUIRED"),z40.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED")])});import{z as z41}from"zod";var key7=z41.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ProgrammaticCompareSchema=z41.strictObject({scope:ExplorationScopeSchema,items:z41.array(z41.strictObject({label:key7,renderId:z41.uuid()})).min(2).max(6)}).superRefine((i,c)=>{if(new Set(i.items.map(v=>v.label)).size!==i.items.length||new Set(i.items.map(v=>v.renderId.toLowerCase())).size!==i.items.length)c.addIssue({code:"custom",message:"Programmatic labels and exact renders must be distinct"})});var ProgrammaticComparisonSchema=z41.strictObject({semanticStatus:z41.literal("SUCCESS"),advisory:z41.literal(true),scope:ExplorationScopeSchema,selection:ProgrammaticCompareSchema.shape.items,items:z41.array(z41.strictObject({label:key7,sourceKind:z41.literal("PROGRAMMATIC"),composition:CompositionViewSchema,render:CompositionRenderViewSchema,reviewTarget:ProgrammaticVideoReviewTargetSchema.nullable()})).min(2).max(6),limitations:z41.tuple([z41.literal("OWNER_STATES_ARE_NOT_VISUAL_SCORES"),z41.literal("REVIEW_AND_ACCEPTANCE_REMAIN_EXPLICIT")])}).superRefine((v,c)=>{if(v.items.length!==v.selection.length||v.items.some((item,i)=>item.label!==v.selection[i].label||item.render.receipt.renderId!==v.selection[i].renderId))c.addIssue({code:"custom",message:"Programmatic comparison retains every exact selected label/render"});for(const item of v.items){const owner=item.composition.version,target=item.reviewTarget;if(owner.tenantId!==v.scope.tenantId||owner.projectId!==v.scope.projectId||owner.productionId!==v.scope.productionId||owner.basis.shotId!==v.scope.shotId||owner.content.role!=="PRIMARY_VISUAL"||owner.id!==item.render.receipt.compositionVersionId||target&&(target.renderId!==item.render.receipt.renderId||target.compositionVersionId!==owner.id||target.tenantId!==v.scope.tenantId||target.projectId!==v.scope.projectId||target.productionId!==v.scope.productionId||target.shotId!==v.scope.shotId))c.addIssue({code:"custom",message:"Programmatic comparison retains exact native source/output scope"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=2*1024*1024,"Programmatic comparison exceeds2MiB");var ProgrammaticRecommendationContextInputSchema=ProgrammaticCompareSchema.safeExtend({criteria:z41.array(ExplorationComparisonCriterionSchema).min(1).max(8)}).refine(i=>new Set(i.criteria.map(v=>v.key)).size===i.criteria.length,"Criteria must be distinct");var ProgrammaticRecommendationBasisSchema=z41.strictObject({input:ProgrammaticRecommendationContextInputSchema,contextFingerprint:z41.string().regex(/^[0-9a-f]{64}$/)});var ProgrammaticRecommendationContextSchema=z41.strictObject({semanticStatus:z41.literal("SUCCESS"),advisory:z41.literal(true),basis:ProgrammaticRecommendationBasisSchema,comparison:ProgrammaticComparisonSchema,candidates:z41.array(ExplorationRecommendationCandidateSchema).min(2).max(6),limitations:z41.tuple([z41.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z41.literal("NO_IMPLICIT_MEDIA_OR_MODEL_CALL")])}).superRefine((v,c)=>{if(JSON.stringify(v.basis.input.scope)!==JSON.stringify(v.comparison.scope)||JSON.stringify(v.basis.input.items)!==JSON.stringify(v.comparison.selection)||v.candidates.length!==v.comparison.items.length||v.candidates.some((candidate,i)=>candidate.label!==v.comparison.items[i].label))c.addIssue({code:"custom",message:"Programmatic Recommendation keeps exact comparison scope/selection"});for(const candidate of v.candidates){const target=candidate.reviewContext?.reviewTarget;const item=v.comparison.items.find(i=>i.label===candidate.label);if(target&&(target.kind!=="PROGRAMMATIC"||target.target.renderId!==item?.render.receipt.renderId||target.target.compositionVersionId!==item.composition.version.id))c.addIssue({code:"custom",message:"Candidate assessment binds the exact native CODE output"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=2*1024*1024,"Programmatic recommendation context exceeds2MiB");var ValidateProgrammaticRecommendationSchema=z41.strictObject({basis:ProgrammaticRecommendationBasisSchema,proposal:ValidateExplorationRecommendationSchema.shape.proposal}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=1024*1024,"Programmatic recommendation input exceeds1MiB");var ProgrammaticRecommendationValidationSchema=z41.strictObject({...ExplorationRecommendationValidationResultSchema.shape,basis:ProgrammaticRecommendationBasisSchema}).superRefine((v,c)=>{const s=v.basis.input.scope;for(const assessment of v.reviews){const item=v.basis.input.items.find(i=>i.label===assessment.label),draft=assessment.validation.recordDraft;if(!item||draft.kind!=="PROGRAMMATIC"||draft.input.renderId!==item.renderId||draft.input.tenantId!==s.tenantId||draft.input.productionId!==s.productionId||assessment.validation.basis.scope.projectId!==s.projectId)c.addIssue({code:"custom",message:"Recommendation review draft binds exact CODE output and scope"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=4*1024*1024,"Programmatic recommendation result exceeds4MiB");import{z as z42}from"zod";var CompositionRenderQuerySchema=CompositionScopeSchema.extend({limit:z42.int().min(1).max(24).default(12),next:ContinuationSchema.optional(),shotId:z42.uuid().optional(),role:z42.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]).default("PRIMARY_VISUAL")});var CompositionRenderObservationSchema=z42.strictObject({render:CompositionRenderViewSchema,createdAt:z42.iso.datetime({offset:true}),version:z42.int().positive(),executionClass:z42.enum(["LIVE","TEST_ONLY"]),freshness:z42.enum(["CURRENT_BASIS","STALE_BASIS"]),available:z42.boolean(),review:z42.strictObject({result:z42.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),reviewId:z42.uuid().nullable(),acceptanceId:z42.uuid().nullable(),accepted:z42.boolean()})}).superRefine((v,ctx)=>{if(!v.render.sourceIdentity||v.review.result==="UNREVIEWED"!==(v.review.reviewId===null)||v.review.accepted!==(v.review.acceptanceId!==null)||v.review.accepted&&(!v.review.acceptanceId||!v.review.reviewId||!v.available||v.freshness!=="CURRENT_BASIS"||!["PASS","WARNING"].includes(v.review.result)))ctx.addIssue({code:"custom",message:"Observation requires exact native source/Review/acceptance identity"})});var CompositionRenderPageSchema=z42.strictObject({items:z42.array(CompositionRenderObservationSchema).max(24),page:QueryPageInfoSchema}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=4194304,"Render observation page exceeds 4 MiB");var CompositionRenderMediaDescriptorSchema=z42.strictObject({path:z42.string().regex(/^\/v1\/productions\/[0-9a-f-]{36}\/compositions\/renders\/[0-9a-f-]{36}\/media$/i),contentType:z42.literal("video/mp4"),checksumSha256:z42.string().regex(/^[0-9a-f]{64}$/),byteSize:z42.int().positive().max(134217728),authentication:z42.literal("BEARER_AND_TENANT_HEADER")});import{z as z43}from"zod";var CompositionSampleStartSchema=CompositionRenderGetSchema.extend({expectedProductionRevision:z43.int().positive(),profile:TemporalSamplingProfileSchema,idempotencyKey:z43.string().trim().min(1).max(128)});var CompositionObserveGetSchema=CompositionRenderGetSchema.extend({evidenceId:z43.uuid()});var RenderObservationIdentitySchema=z43.strictObject({renderId:z43.uuid(),compositionVersionId:z43.uuid(),artifactId:z43.uuid(),representationId:z43.uuid(),checksumSha256:z43.string().regex(/^[0-9a-f]{64}$/)});var CompositionSampleReceiptSchema=RenderObservationIdentitySchema.extend({evidence:TemporalEvidenceAdmissionSchema,nextActions:z43.tuple([z43.literal("READ_OBSERVATION")])});var CompositionFrameObservationSchema=z43.strictObject({ordinal:z43.int().nonnegative().max(63),frameIndex:z43.int().nonnegative().max(3599),timestampMs:z43.number().nonnegative().max(6e4),checksumSha256:z43.string().regex(/^[0-9a-f]{64}$/),representationId:z43.uuid(),diagnostic:z43.literal("FRAME_EVIDENCE_READY")});var CompositionObservationViewSchema=RenderObservationIdentitySchema.extend({evidence:TemporalEvidenceViewSchema,frames:z43.array(CompositionFrameObservationSchema).max(64),contactSheetArtifactId:z43.uuid().nullable(),nextActions:z43.array(z43.enum(["READ_OBSERVATION","READ_FRAME_MEDIA","REVISE_COMPOSITION","RENDER_REVISION"])).min(1).max(4)});var scope2={projectId:ProjectIdSchema,productionId:ProductionIdSchema};var ScopedAcceptBriefSchema=AcceptBriefRequestSchema.extend(scope2);var ScopedAcceptStorySchema=AcceptStoryRequestSchema.extend(scope2);var ScopedAcceptSceneShotPlanSchema=AcceptSceneShotPlanRequestSchema.extend(scope2);import{z as z44}from"zod";var id5=z44.uuid();var ActivateAgentExecutionSchema=AgentHostScopeSchema.extend({profileKey:z44.string().regex(/^[A-Za-z0-9_-]{1,160}$/),requestId:id5,bindingId:id5,expectedBindingRevision:z44.int().positive(),expectedConfigurationVersion:z44.int().positive(),clientId:id5,grantRef:id5,installationRevisionId:z44.string().regex(/^[A-Za-z0-9_-]{1,160}$/)});var AgentExecutionSelectionSchema=z44.strictObject({registration:AgentExecutionRegistrationViewSchema,grant:AgentExecutionGrantSchema,installationRevisionId:z44.string().regex(/^[A-Za-z0-9_-]{1,160}$/)}).refine(v=>v.grant.clientId===v.registration.clientId&&v.grant.registrationRevision===v.registration.registration.registrationRevision&&v.grant.resource===v.registration.registration.resource);import{z as z45}from"zod";var NativeToolAuthorityFailureSchema=z45.strictObject({semanticStatus:z45.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z45.strictObject({code:z45.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","BINDING_UNAVAILABLE","REQUEST_CONFLICT","REVISION_CONFLICT","GRANT_CONFLICT","GRANT_EXPIRED","GRANT_REVOKED","PROOF_INVALID","PROOF_REPLAY","CHALLENGE_EXPIRED","PERMIT_UNAVAILABLE","QUALIFICATION_UNAVAILABLE","CREDENTIAL_INVALID","CREDENTIAL_EXPIRED","CREDENTIAL_UNAVAILABLE","CREDENTIAL_LIMIT","HOST_RUN_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),message:z45.literal("Native tool authority operation did not complete")})});import{z as z46}from"zod";var NativeToolGatewayDescriptorSchema=z46.strictObject({name:z46.string().regex(/^[a-z][a-z0-9_]{0,99}$/),inputSchemaFingerprint:z46.string().regex(/^[a-f0-9]{64}$/),scope:z46.enum(["PRODUCTION","PROJECT_READ"]),readOnly:z46.boolean()});var NativeToolGatewayManifestSchema=z46.strictObject({protocol:z46.literal("NATIVESTUDIO_NATIVE_MCP_V1"),policy:z46.literal("NVS_PROJECT_READ_PRODUCTION_WRITE_V1"),tools:z46.array(NativeToolGatewayDescriptorSchema).min(1).max(256)}).refine(v=>v.tools.every((tool,index)=>index===0||v.tools[index-1].name<tool.name));var NativeToolGatewayContractSchema=z46.strictObject({manifest:NativeToolGatewayManifestSchema,capabilityDigest:z46.string().regex(/^[a-f0-9]{64}$/)});import{z as z47}from"zod";var id6=z47.uuid().regex(/^[0-9a-f-]{36}$/);var sha7=z47.string().regex(/^[a-f0-9]{64}$/);var key8=z47.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var NativeRuntimeQualificationSchema=z47.strictObject({protocol:z47.literal("NATIVESTUDIO_RUNTIME_TOOLS_V1"),runtimeKey:key8,installationId:key8,installationRevisionId:key8,resource:z47.url().max(2048),publicKeyFingerprint:sha7,bindingId:id6,configurationVersion:z47.int().positive(),selection:AgentHostSelectionSchema,capabilityDigest:sha7,executionClass:z47.enum(["LIVE","TEST_ONLY"]),transport:AgentHostInstallationTransportSchema.optional()});var NativeToolPermitSchema=z47.strictObject({proof:AgentHostNativeToolAuthoritySchema,input:AgentHostExecutionInputSchema,grant:NativeToolGrantViewSchema,qualification:NativeRuntimeQualificationSchema,requestedByPrincipalId:id6,createdAt:z47.iso.datetime({offset:true})}).refine(v=>v.proof.tenantId===v.input.tenantId&&v.proof.projectId===v.input.projectId&&v.proof.productionId===v.input.productionId&&v.proof.executionId===v.input.executionId&&v.proof.hostRequestId===v.input.hostRequestId&&v.grant.tenantId===v.input.tenantId&&v.grant.projectId===v.input.projectId&&v.grant.enabled&&v.grant.verifiedAt!==null&&v.proof.bindingId===v.grant.bindingId&&v.proof.configurationVersion===v.grant.configurationVersion&&v.qualification.runtimeKey===v.grant.runtimeKey&&v.qualification.installationId===v.grant.installationId&&v.qualification.installationRevisionId===v.grant.installationRevisionId&&v.qualification.resource===v.grant.resource&&v.qualification.bindingId===v.grant.bindingId&&v.qualification.configurationVersion===v.grant.configurationVersion&&v.qualification.capabilityDigest===v.proof.capabilityDigest&&v.qualification.executionClass===v.proof.executionClass&&(v.proof.transport===void 0?v.qualification.transport===void 0:v.qualification.transport?.protocol===v.proof.transport.protocol&&v.qualification.transport.installationId===v.proof.transport.installationId&&v.qualification.transport.installationRevisionId===v.proof.transport.installationRevisionId&&v.qualification.transport.slotKey===v.proof.transport.slotKey&&(v.proof.transport.protocol!=="AGENT_STACK_GENERIC_INSTALLATION_V3"||v.qualification.transport.protocol==="AGENT_STACK_GENERIC_INSTALLATION_V3"&&v.qualification.transport.contractDigest===v.proof.transport.contractDigest&&v.qualification.transport.capabilityDigest===v.proof.transport.capabilityDigest)&&v.proof.transport.installationId===v.grant.installationId&&v.proof.transport.installationRevisionId===v.grant.installationRevisionId)&&Date.parse(v.proof.expiresAt)<=Date.parse(v.grant.expiresAt));var NativeToolPermitGetSchema=AgentHostExecutionScopeSchema.extend({authorityRef:id6});var NativeExecutionProofClaimsSchema=AgentHostExecutionScopeSchema.extend({iss:key8,sub:key8,aud:z47.url().max(2048),grantId:id6,grantRevision:z47.int().positive(),installationRevisionId:key8,authorityRef:id6,executionId:id6,hostRequestId:id6,inputFingerprint:sha7,runKey:key8,jti:id6,iat:z47.int().nonnegative(),exp:z47.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeToolCredentialExchangeSchema=NativeToolPermitGetSchema.extend({assertion:z47.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).max(8192).meta({writeOnly:true})});var NativeToolCredentialMetadataSchema=NativeToolPermitGetSchema.extend({protocol:z47.literal("NATIVESTUDIO_NATIVE_CREDENTIAL_V1"),tokenId:id6,grantId:id6,grantRevision:z47.int().positive(),executionId:id6,hostRequestId:id6,runKey:key8,jti:id6,assertionFingerprint:sha7,tokenFingerprint:sha7,issuedAt:z47.iso.datetime({offset:true}),expiresAt:z47.iso.datetime({offset:true})});var NativeToolCredentialReplySchema=z47.strictObject({tokenType:z47.literal("Bearer"),accessToken:z47.string().regex(/^nvst_[0-9a-f-]{36}\.[A-Za-z0-9_-]{43}$/).meta({readOnly:true}),tokenId:id6,resource:z47.url().max(2048),expiresAt:z47.iso.datetime({offset:true})}).refine(v=>v.accessToken.startsWith(`nvst_${v.tokenId}.`));var NativeToolSessionSchema=NativeToolPermitGetSchema.extend({authorityProtocol:z47.literal("NVS_GENERIC_EXECUTION_V1").optional(),tokenId:id6,executionId:id6,hostRequestId:id6,grantId:id6,grantRevision:z47.int().positive(),runKey:key8,runtimePrincipalId:id6,approvedByPrincipalId:id6,requestedByPrincipalId:id6,capabilityDigest:sha7,resource:z47.url().max(2048),issuer:z47.url().max(2048),subject:z47.string().max(200),executionClass:z47.enum(["LIVE","TEST_ONLY"]),expiresAt:z47.iso.datetime({offset:true})});import{z as z48}from"zod";var CreateProductionRequestSchema=z48.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,idempotencyKey:z48.string().trim().min(1).max(200)});var CreatedProductionResultSchema=CreatedProjectResultSchema;import{z as z49}from"zod";var sha8=z49.string().regex(/^[0-9a-f]{64}$/);var WavExportResultSchema=z49.strictObject({contentType:z49.literal("audio/wav"),checksumSha256:sha8,byteSize:z49.int().min(44).max(12582912),contentBase64:z49.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]+={0,2}$/)});var AudioExportResultSchema=WavExportResultSchema.extend({representationId:z49.uuid()});var CaptionExportResultSchema=z49.strictObject({contentType:z49.enum(["application/json","application/x-subrip"]),checksumSha256:sha8,representationId:z49.uuid(),text:z49.string().min(1).max(131072)});import{z as z50}from"zod";var tenant=TenantIdSchema.transform(v=>v.toLowerCase());var project=ProjectIdSchema.transform(v=>v.toLowerCase());var production=ProductionIdSchema.transform(v=>v.toLowerCase());var artifact=ArtifactIdSchema.transform(v=>v.toLowerCase());var representation=ArtifactRepresentationIdSchema.transform(v=>v.toLowerCase());var DiscoverableArtifactFamilySchema=z50.enum(["SOURCE","KEYFRAME_CANDIDATE","SHOT_CANDIDATE","COMPOSITION_RENDER_OUTPUT","ROUGH_CUT","FINAL_RENDER_OUTPUT","IMPORTED_VISUAL_ORIGINAL","IMPORTED_VISUAL_NORMALIZED","IMPORTED_VISUAL_POSTER","AUDIO","AUDIO_SOURCE_SYNC","CAPTION","CONTACT_SHEET"]);var DiscoveryContentTypeSchema=MediaBrowserContentTypeSchema;var ArtifactDiscoveryQuerySchema=z50.strictObject({tenantId:tenant,projectId:project.optional(),productionId:production.optional(),artifactId:artifact.optional(),mediaCategory:MediaCategorySchema.optional(),family:DiscoverableArtifactFamilySchema.optional(),search:z50.string().trim().min(1).max(200).optional(),lifecycle:z50.enum(["READY","ARCHIVED"]).default("READY"),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ArtifactDiscoveryMediaSchema=z50.strictObject({tenantId:tenant,projectId:project,artifactId:artifact,representationId:representation});var ArtifactMediaTicketRequestSchema=ArtifactDiscoveryMediaSchema.extend({download:z50.boolean().optional()});var ArtifactMediaTicketSchema=ArtifactDiscoveryMediaSchema.extend(MediaBrowserReadTicketSchema.shape);var ArtifactDiscoveryItemSchema=z50.strictObject({artifactId:ArtifactIdSchema,projectId:ProjectIdSchema,projectName:z50.string().min(1).max(500),projectLifecycle:ProjectSchema.shape.lifecycle.nullable().default(null),productionId:ProductionIdSchema.nullable(),representationId:ArtifactRepresentationIdSchema,family:DiscoverableArtifactFamilySchema,lifecycle:z50.enum(["READY","ARCHIVED"]),origin:z50.string().min(1).max(120),contentType:DiscoveryContentTypeSchema,checksumSha256:z50.string().regex(/^[a-f0-9]{64}$/),byteSize:z50.int().positive(),width:z50.int().positive().nullable(),height:z50.int().positive().nullable(),durationMs:z50.int().nonnegative().nullable(),createdAt:z50.iso.datetime({offset:true}),originalName:z50.string().max(255).nullable(),sourceKind:SourceLibraryItemSchema.shape.kind.nullable().default(null),executionClass:z50.enum(["LIVE","TEST_ONLY","UNKNOWN"]),mediaAvailable:z50.boolean(),sourceVersionId:z50.uuid().nullable(),normalizationId:z50.uuid().nullable()});var ArtifactDiscoveryPageSchema=z50.strictObject({items:z50.array(ArtifactDiscoveryItemSchema).max(100),page:QueryPageInfoSchema});import{z as z51}from"zod";var ExternalGrantQuerySchema=z51.strictObject({tenantId:z51.uuid()});var ExternalGrantPageSchema=z51.strictObject({items:z51.array(z51.strictObject({grantId:z51.uuid(),displayName:z51.string().max(100),scopes:z51.array(z51.enum(["nvs:read","nvs:write"])).min(1).max(2),expiresAt:z51.iso.datetime()})).max(100),possiblyTruncated:z51.boolean()});var ExternalAccessScopeSchema=z51.enum(["nvs:read","nvs:write"]);var ExternalAgentScopeSchema=z51.strictObject({tenantId:z51.uuid()});var redirect=z51.string().min(1).max(2048).superRefine((value,ctx)=>{try{const u=new URL(value);if(u.username||u.password||u.hash||!(u.protocol==="https:"||u.protocol==="http:"&&["127.0.0.1","[::1]"].includes(u.hostname)||u.protocol==="workbuddy:"))throw Error()}catch{ctx.addIssue({code:"custom",message:"Invalid registered callback"})}});var RegisterExternalClientSchema=ExternalAgentScopeSchema.extend({displayName:z51.string().trim().min(1).max(100),redirectUris:z51.array(redirect).min(1).max(16).refine(v=>new Set(v).size===v.length)});var DynamicExternalClientSchema=z51.object({client_name:z51.string().trim().min(1).max(100).default("External MCP client"),redirect_uris:z51.array(redirect).min(1).max(16).refine(v=>new Set(v).size===v.length),token_endpoint_auth_method:z51.literal("none").default("none"),grant_types:z51.array(z51.enum(["authorization_code","refresh_token"])).min(1).max(2).optional(),response_types:z51.array(z51.literal("code")).length(1).optional(),application_type:z51.enum(["native","web"]).optional()});var ExternalAuthorizationSchema=z51.strictObject({response_type:z51.literal("code"),client_id:z51.uuid(),redirect_uri:redirect,resource:z51.url().max(2048),scope:z51.string().max(100).refine(value=>{const scopes=value.split(" ");return scopes.includes("nvs:read")&&new Set(scopes).size===scopes.length&&scopes.every(s=>ExternalAccessScopeSchema.safeParse(s).success)}),state:z51.string().min(16).max(1024),code_challenge:z51.string().regex(/^[A-Za-z0-9_-]{43}$/),code_challenge_method:z51.literal("S256")});var commonToken={client_id:z51.uuid(),resource:z51.url().max(2048)};var ExternalTokenRequestSchema=z51.discriminatedUnion("grant_type",[z51.strictObject({...commonToken,grant_type:z51.literal("authorization_code"),code:z51.string().regex(/^nvsc_[A-Za-z0-9_-]{43}$/),redirect_uri:redirect,code_verifier:z51.string().regex(/^[A-Za-z0-9._~-]{43,128}$/)}),z51.strictObject({...commonToken,grant_type:z51.literal("refresh_token"),refresh_token:z51.string().regex(/^nvsr_[A-Za-z0-9_-]{43}$/)})]);var ExternalRevocationSchema=z51.strictObject({client_id:z51.uuid(),token:z51.string().regex(/^(nvsa_|nvsr_)[A-Za-z0-9_-]{43}$/),token_type_hint:z51.enum(["access_token","refresh_token"]).optional()});import{z as z52}from"zod";var WorkspaceScopeSchema=z52.strictObject({tenantId:TenantIdSchema});var WorkspaceViewSchema=HumanTenantSchema;var skillUrl=z52.url().max(4096).refine(value=>{try{const u=new URL(value);return value===value.trim()&&![...value].some(c=>c.charCodeAt(0)<=32||c.charCodeAt(0)===127)&&!u.username&&!u.password&&!/[?#]/.test(value)&&(u.protocol==="https:"||u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname))}catch{return false}});var WorkspaceCallerSchema=z52.strictObject({tenantId:z52.uuid(),principalId:z52.uuid(),serverOrigin:z52.url().refine(value=>{const u=new URL(value);return u.origin===value&&!u.username&&!u.password&&!u.search&&!u.hash&&u.pathname==="/"&&(u.protocol==="https:"||u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname))}),skill:z52.discriminatedUnion("status",[z52.strictObject({status:z52.literal("AVAILABLE"),url:skillUrl}),z52.strictObject({status:z52.enum(["UNCONFIGURED","UNAVAILABLE"]),url:z52.null()})])});var WorkspacePageSchema=z52.strictObject({items:z52.array(WorkspaceViewSchema).max(100),possiblyTruncated:z52.boolean()});import{z as z53}from"zod";var TerminateProductionSchema=z53.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,outcome:z53.enum(["FAILED","CANCELLED"]),expectedProductionRevision:z53.int().positive(),reason:z53.string().trim().min(1).max(1e3),idempotencyKey:z53.string().trim().min(1).max(200)});var ProductionTerminationReceiptSchema=z53.strictObject({decisionId:z53.uuid(),productionId:ProductionIdSchema,projectId:ProjectIdSchema,state:ProductionStateSchema});import{z as z54}from"zod";var text3=z54.string().trim().min(1).max(600);var key9=z54.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var Review1RepairSourceResultSchema=z54.strictObject({input:Review1RepairSourceQuerySchema,source:Review1RepairSourceSchema,productionRevision:z54.int().positive(),caseVersion:z54.int().nonnegative(),budget:SemanticRepairBudgetSchema.nullable()}).superRefine((v,c)=>{const fields=["tenantId","projectId","productionId","mediaType","generationId","reviewId"];if(fields.some(key10=>v.input[key10]!==v.source[key10])||v.input.requirementKey!==v.source.requirement.key)c.addIssue({code:"custom",message:"Native source must match the exact scoped Review obligation"})});var Review1RepairStrategyBasisSchema=z54.strictObject({input:Review1RepairSourceQuerySchema,contextFingerprint:z54.string().regex(/^[0-9a-f]{64}$/)});var Review1RepairStrategyContextSchema=z54.strictObject({semanticStatus:z54.literal("SUCCESS"),advisory:z54.literal(true),basis:Review1RepairStrategyBasisSchema,owner:Review1RepairSourceResultSchema});var ValidateReview1RepairStrategySchema=z54.strictObject({basis:Review1RepairStrategyBasisSchema,budget:SemanticRepairBudgetSchema.optional(),proposal:z54.strictObject({origin:z54.strictObject({kind:z54.literal("EXTERNAL_AGENT_HOST"),label:z54.string().trim().min(1).max(100)}),summary:text3,alternatives:z54.array(z54.strictObject({id:key9,rationale:text3,whySmallerChangeInsufficient:text3,action:z54.discriminatedUnion("kind",[z54.strictObject({kind:z54.literal("REGENERATE_SHOT")}),z54.strictObject({kind:z54.literal("REQUEST_HUMAN_INPUT"),question:text3}),z54.strictObject({kind:z54.literal("REQUEST_CANONICAL_CHANGE"),requestedChange:text3})])})).min(1).max(6),selectedAlternativeId:key9})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Review-1 strategy exceeds 1 MiB");var Review1RepairStrategyValidationSchema=z54.strictObject({semanticStatus:z54.literal("SUCCESS"),advisory:z54.literal(true),basis:Review1RepairStrategyBasisSchema,proposal:ValidateReview1RepairStrategySchema.shape.proposal,alternatives:z54.array(z54.strictObject({alternativeId:key9,handoff:z54.discriminatedUnion("kind",[z54.strictObject({kind:z54.literal("AUTHOR_REVIEW1_REPAIR"),input:AuthorReview1RepairSchema.omit({idempotencyKey:true})}),z54.strictObject({kind:z54.literal("HUMAN_INPUT_INTENT"),question:text3}),z54.strictObject({kind:z54.literal("CANONICAL_CHANGE_INTENT"),requestedChange:text3})])})).min(1).max(6),selectedAlternativeId:key9,followUp:z54.union([z54.tuple([]),z54.tuple([z54.literal("EXPLICIT_NATIVE_AUTHORING"),z54.literal("OWNER_BUDGET_AND_COST_ADMISSION"),z54.literal("EXPLICIT_NATIVE_EXECUTION"),z54.literal("INDEPENDENT_REVIEW_1_AND_NATIVE_PROOF")])])});import{z as z56}from"zod";import{z as z55}from"zod";var NavigationGroupIdSchema=z55.enum(["navigation","materials","planning","execution","review","delivery","local","administration","unclassified"]);var NavigationGroups=Object.freeze([{id:"navigation",title:"\u5BFC\u822A\u4E0E\u6062\u590D",description:"Locate Productions, inspect state and reconcile original Operations"},{id:"materials",title:"\u9879\u76EE\u4E0E\u7D20\u6750",description:"Projects, source material, references and Artifact discovery"},{id:"planning",title:"\u521B\u4F5C\u4E0E\u8BA1\u5212",description:"Brief, Story, Scenes, Shots and creative plans"},{id:"execution",title:"\u6267\u884C\u4E0E\u8FDB\u5EA6",description:"Generation, runtime Jobs, observation and cancellation"},{id:"review",title:"\u5BA1\u67E5\u4E0E\u4FEE\u590D",description:"Review targets, Findings, evidence and repair"},{id:"delivery",title:"\u88C5\u914D\u4E0E\u4EA4\u4ED8",description:"Timeline, composition, preview, rendering and delivery"},{id:"local",title:"\u672C\u5730\u6267\u884C",description:"Authorized local Runtime, media tools and Agent connections"},{id:"administration",title:"\u7BA1\u7406\u4E0E\u96C6\u6210",description:"Tenant integration, Providers and native authority configuration"},{id:"unclassified",title:"\u5F85\u5206\u7C7B\u80FD\u529B",description:"Registered capabilities awaiting explicit semantic classification"}]);var namespaces=[["navigation",/^nvs_open_execution$/],["local",/^(?:local_|device_|list_devices$)/],["administration",/^(?:provider_|tenant_|oauth_|credential_|native_tool_|agent_host_|webhook_)/],["review",/(?:^|_)(?:review|reviewer|finding|repair)(?:_|$)/],["navigation",/^(?:workspace_|studio_|operation_|production_(?:query|snapshot)|job_(?:get|query)|production_guidance_)/],["materials",/^(?:project_|source_|artifact_|reference_|visual_sequence_|imported_visual_|source_sync_)/],["planning",/^(?:brief_|story_|scene_|shot_|writer_|director_|exploration_|consistency_|making_|sound_plan_|planning_|editor_)/],["delivery",/^(?:timeline_|composition_|rough_cut_|final_|delivery_|caption_|audio_)/],["execution",/^(?:production_|keyframe_|video_|generation_|speech_|media_observation_|temporal_evidence_|lifecycle_)/]];function navigationGroup(tool){return namespaces.find(([,pattern])=>pattern.test(tool))?.[0]??"unclassified"}var NavigationProfile="contextual-v1";var NavigationProfileKey="io.nativestudio/discovery-profile";var NavigationToolNames=["studio_start","studio_capability_search","studio_capability_describe","studio_capability_groups","studio_navigate"];var Scope=z56.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema.optional()});var ToolName=z56.string().regex(/^[a-zA-Z0-9_-]{1,120}$/);var StudioStartInputSchema=ProductionQueryInputSchema.extend({limit:z56.int().min(1).max(5).default(5)}).strict();var StudioStartSchema=z56.object({tenantId:TenantIdSchema,choices:ProductionQueryPageSchema.shape.items.max(5),page:ProductionQueryPageSchema.shape.page,selection:z56.enum(["NONE","ONE","CHOOSE"]),guidance:z56.literal("Select an explicit Production ID, then call studio_navigate. Never infer an ID.")}).strict();var CapabilitySummarySchema=z56.object({tool:ToolName,title:z56.string().max(500),description:z56.string().max(6e3),family:z56.string().min(1).max(120),group:NavigationGroupIdSchema.optional(),readOnly:z56.boolean(),registration:z56.literal("REGISTERED")}).strict();var CapabilitySearchInputSchema=Scope.extend({query:z56.string().trim().min(1).max(240),family:z56.string().regex(/^[a-z0-9_-]{1,120}$/).optional(),group:NavigationGroupIdSchema.optional(),limit:z56.int().min(1).max(8).default(5),next:z56.string().min(1).max(2048).optional()}).strict();var CapabilitySearchSchema=z56.object({tenantId:TenantIdSchema,catalogVersion:z56.string().regex(/^[a-f0-9]{64}$/),outcome:z56.enum(["MATCHES","AMBIGUOUS","NO_MATCH"]),candidates:z56.array(CapabilitySummarySchema.extend({matchedTerms:z56.array(z56.string().max(120)).max(24)})).max(8),page:z56.object({hasMore:z56.boolean(),next:z56.string().max(2048).nullable()}).strict(),guidance:z56.literal("Registration is not availability or authorization. Inspect the selected schema and native context before invoking its typed command.")}).strict();var CapabilityDescribeInputSchema=Scope.extend({tool:ToolName,schemaCursor:z56.string().min(1).max(2048).optional()}).strict();var JsonSchema=z56.record(z56.string(),z56.unknown());var PublicToolDefinitionSchema=z56.object({name:ToolName,title:z56.string().optional(),description:z56.string().optional(),inputSchema:JsonSchema,outputSchema:JsonSchema.optional(),annotations:JsonSchema.optional(),execution:JsonSchema.optional(),_meta:JsonSchema.optional(),icons:z56.array(JsonSchema).optional()}).strict();var CapabilityGroupsInputSchema=Scope.extend({includeDefinitions:z56.boolean().optional()}).strict();var CapabilityGroupsSchema=z56.object({tenantId:TenantIdSchema,catalogVersion:z56.string().regex(/^[a-f0-9]{64}$/),definitions:z56.array(PublicToolDefinitionSchema).max(6).optional(),groups:z56.array(z56.object({id:NavigationGroupIdSchema,title:z56.string().max(120),description:z56.string().max(500),count:z56.int().nonnegative(),readOnlyCount:z56.int().nonnegative()}).strict()).max(9)}).strict();var CapabilityDescribeSchema=CapabilitySummarySchema.extend({tenantId:TenantIdSchema,catalogVersion:z56.string().regex(/^[a-f0-9]{64}$/),outputContract:z56.enum(["DECLARED","NOT_DECLARED"]),schemaCursor:z56.string().min(1).max(2048),definition:PublicToolDefinitionSchema,guidance:z56.literal("Use this bounded definition as client-local schema metadata. Standard tools/list stays stable; commands revalidate authority and current state.")}).strict();var StudioNavigateInputSchema=Scope.extend({productionId:ProductionIdSchema,goal:z56.string().trim().min(1).max(240).optional(),actionLimit:z56.int().min(1).max(8).default(8).describe("Native action page size: 1\u20138 (default 8). Omit this field unless a smaller page is needed."),actionNext:z56.string().min(1).max(2048).optional().describe("Opaque actions.page.next; keep the same goal and actionLimit. Changed native state requires a fresh first page.")}).strict();import{z as z57}from"zod";var Evidence=z57.object({path:z57.string().min(1).max(120)}).strict();var StudioNavigationSchema=z57.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,evidence:z57.object({source:z57.literal("production_snapshot"),revision:z57.int().positive(),generatedAt:z57.iso.datetime({offset:true})}).strict(),state:ProductionSnapshotSchema.shape.state.extend({blockingReason:z57.string().max(1e3).nullable(),waitingReason:z57.string().max(1e3).nullable()}),stateReasonsTruncated:z57.object({blockingReason:z57.boolean(),waitingReason:z57.boolean()}).strict(),planning:ProductionSnapshotSchema.shape.planning,shots:ProductionSnapshotSchema.shape.shots,work:ProductionSnapshotSchema.shape.work,findings:ProductionSnapshotSchema.shape.findings,timeline:ProductionSnapshotSchema.shape.timeline.pick({currentVersion:true,stale:true}),final:ProductionSnapshotSchema.shape.final.pick({renderState:true,deliveryValidationState:true}),blockers:z57.object({total:z57.int().nonnegative(),truncated:z57.boolean(),items:z57.array(ProductionSnapshotSchema.shape.blockers.element.extend({evidence:Evidence})).max(10)}).strict(),actions:z57.object({total:z57.int().nonnegative(),truncated:z57.boolean(),items:z57.array(NextActionSchema.extend({tool:z57.string().min(1).max(120).nullable(),registration:z57.enum(["REGISTERED","NOT_ON_SURFACE"]),readOnly:z57.boolean().nullable(),purpose:z57.string().max(500).nullable(),group:NavigationGroupIdSchema.nullable(),context:z57.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,revision:z57.int().positive()}).strict(),inputHints:z57.object({knownInputs:z57.partialRecord(z57.enum(["tenantId","projectId","productionId","shotId","sceneId","findingId","operationId","artifactId"]),z57.string().min(1).max(2048)),schemaFingerprint:z57.string().regex(/^[a-f0-9]{64}$/).nullable(),requiredInputs:z57.array(z57.string()).max(128),missingInputs:z57.array(z57.string()).max(128),schemaInspectionRequired:z57.literal(true)}).strict().nullable(),recommendation:z57.array(z57.enum(["NATIVE_AVAILABLE","NATIVE_UNAVAILABLE","GOAL_MATCH","INSPECT_SCHEMA","NOT_ON_SURFACE"])).max(4),inspect:z57.object({tool:z57.literal("studio_capability_describe"),arguments:CapabilityDescribeInputSchema}).strict().nullable(),evidence:Evidence})).max(8),page:z57.object({hasMore:z57.boolean(),next:z57.string().max(2048).nullable()}).strict()}).strict(),operations:z57.object({total:z57.int().nonnegative(),truncated:z57.boolean(),items:z57.array(OperationSummarySchema.pick({id:true,productionId:true,semanticStatus:true,startedAt:true,updatedAt:true}).extend({inspect:z57.object({tool:z57.literal("operation_get"),arguments:z57.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,operationId:OperationSummarySchema.shape.id}).strict()}).strict().nullable(),targetCount:z57.int().nonnegative(),blockerCount:z57.int().nonnegative(),evidence:Evidence})).max(5)}).strict(),related:CapabilitySearchSchema.nullable(),guidance:z57.literal("Use native IDs and revision from this snapshot. An outstanding or unacknowledged write must be reconciled through its Operation; never replay it automatically. Commands revalidate current authority, prerequisites, revision and idempotency.")}).strict();function abortable(promise,signal){if(signal.aborted){void promise.catch(()=>{});return Promise.reject(signal.reason)}return new Promise((resolve,reject)=>{const abort=()=>reject(signal.reason);signal.addEventListener("abort",abort,{once:true});promise.then(resolve,reject).finally(()=>signal.removeEventListener("abort",abort))})}async function boundedResponseBytes(response,limit,signal){const length=response.headers.get("content-length");if(length!==null&&(!/^\d+$/.test(length)||Number(length)>limit)){void response.body?.cancel().catch(()=>{});throw new NativeStudioSdkError("RESPONSE_TOO_LARGE","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}if(!response.body)return new Uint8Array;const reader=response.body.getReader();const chunks=[];let size=0;try{while(true){const next=await abortable(reader.read(),signal);if(next.done)break;size+=next.value.byteLength;if(size>limit)throw new NativeStudioSdkError("RESPONSE_TOO_LARGE","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN");chunks.push(next.value)}const result=new Uint8Array(size);let offset=0;for(const chunk of chunks){result.set(chunk,offset);offset+=chunk.byteLength}return result}finally{void reader.cancel().catch(()=>{});reader.releaseLock()}}var nativeFailureCodes=new Set([...NativeToolAuthorityFailureSchema.shape.error.shape.code.options,"REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","INVALID_INPUT","REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","PROVIDER_UNAVAILABLE","BUDGET_BLOCKED","CANCELLED","SUPERSEDED","INTERNAL_OPERATIONAL_FAILURE","IDEMPOTENCY_CONFLICT","INPUT_UNAVAILABLE","AUDIO_UNAVAILABLE","CAPTION_UNAVAILABLE","TEST_EVIDENCE_DENIED","CONFLICT","INVALID_MEDIA","LEASE_LOST","SOURCE_UNAVAILABLE","TOOL_AUTHORITY_UNAVAILABLE","ACTIVE_EXECUTION_EXISTS","BINDING_UNAVAILABLE","PROVIDER_CAPABILITY_UNAVAILABLE","REPLAY_EXHAUSTED"]);var statuses={400:["INVALID_INPUT"],413:["INVALID_INPUT"],415:["INVALID_INPUT"],401:["BLOCKED"],403:["BLOCKED"],404:["NOT_FOUND"],409:["REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","BUDGET_BLOCKED","CANCELLED","SUPERSEDED"],422:["INVALID_INPUT"],429:["BUDGET_BLOCKED","PROVIDER_UNAVAILABLE"]};function failureOutcome(write,status,declared){if(!write)return"NO_WRITE";if(declared==="NO_WRITE"||declared==="UNKNOWN"||declared==="REJECTED")return declared;return["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","STALE_BASIS","BUDGET_BLOCKED"].includes(status)?"REJECTED":"UNKNOWN"}async function nativeFailure(response,signal){try{if(response.headers.get("content-type")?.split(";")[0]?.trim()!=="application/json")return null;const bytes=await boundedResponseBytes(response,64*1024,signal);const raw=JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes));if(!raw||typeof raw!=="object"||Array.isArray(raw))return null;const record=raw;const status=InterfaceSemanticStatusSchema.safeParse(record.semanticStatus);if(!status.success||!(statuses[response.status]??(response.status>=500?["INTERNAL_OPERATIONAL_FAILURE","PROVIDER_UNAVAILABLE","CAPABILITY_UNAVAILABLE"]:[])).includes(status.data))return null;const error=record.error;const code=error&&typeof error==="object"?error.code:void 0;const known=typeof code==="string"&&nativeFailureCodes.has(code);return{semanticStatus:status.data,code:known?code:status.data,outcome:error&&typeof error==="object"&&!Array.isArray(error)&&(known||error.outcome==="UNKNOWN")?error.outcome:void 0}}catch{return null}finally{void response.body?.cancel().catch(()=>{})}}var NativeStudioHttpTransport=class{constructor(config){this.config=config;try{this.origin=new URL(config.baseUrl);if(this.origin.username||this.origin.password||this.origin.search||this.origin.hash||this.origin.pathname!=="/"||this.origin.protocol!=="https:"&&!(this.origin.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(this.origin.hostname)))sdkInputError()}catch{sdkInputError()}this.timeout=config.timeoutMs??3e4;this.jsonLimit=config.maxJsonBytes??18*1024*1024;if(!Number.isSafeInteger(this.timeout)||this.timeout<1||this.timeout>3e5||!Number.isSafeInteger(this.jsonLimit)||this.jsonLimit<1024||this.jsonLimit>32*1024*1024)sdkInputError()}config;origin;timeout;jsonLimit;async response(request,options){const write=request.method==="POST"&&!request.readOnly;if(!request.path.startsWith("/v1/")||request.path.includes("?")||request.path.includes("#")||request.path.includes(".."))sdkInputError();const url=new URL(request.path,this.origin);if(url.origin!==this.origin.origin||!url.pathname.startsWith("/v1/")||!["GET","POST"].includes(request.method)||!TenantIdSchema.safeParse(request.tenantId).success)sdkInputError();for(const[key10,value]of Object.entries(request.query??{}))if(value!==void 0)url.searchParams.set(key10,String(value));let body;try{if(request.importedVideo){const v=request.importedVideo;if(request.method!=="POST"||request.body!==void 0||!/^\/v1\/productions\/[a-f0-9-]{36}\/imported-visuals\/originals\/bytes$/i.test(request.path)||!(v.bytes instanceof Uint8Array)||v.bytes.length<32||v.bytes.length>128*1024*1024||!/^[A-Za-z0-9_-]+$/.test(v.metadata)||v.metadata.length>8192)sdkInputError();body=new Uint8Array(v.bytes)}else body=request.body===void 0?void 0:JSON.stringify(request.body);if(typeof body==="string"&&new TextEncoder().encode(body).byteLength>18*1024*1024)sdkInputError()}catch{sdkInputError()}const timeout=AbortSignal.timeout(this.timeout);const signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let authorization;if(request.authentication==="runtime-proof"){if(request.method!=="POST"||!/^\/v1\/projects\/[0-9a-f-]{36}\/(?:native-tool-grants\/[0-9a-f-]{36}\/(?:proof|status)|productions\/[0-9a-f-]{36}\/native-tool-credentials\/exchange)$/.test(request.path))sdkInputError()}else{try{authorization=await abortable(Promise.resolve().then(()=>this.config.authorization(signal)),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"UNAUTHENTICATED","BLOCKED","NO_WRITE")}if(typeof authorization!=="string"||!/^Bearer [A-Za-z0-9._~+/-]+={0,2}$/.test(authorization)||authorization.length>16384)throw new NativeStudioSdkError("UNAUTHENTICATED","BLOCKED","NO_WRITE")}if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");try{const pending=Promise.resolve().then(()=>(this.config.fetch??fetch)(url,{method:request.method,redirect:"error",cache:"no-store",signal,headers:{...authorization===void 0?{}:{authorization},"x-native-tenant-id":request.tenantId,accept:"application/json",...request.body===void 0?{}:{"content-type":"application/json"},...request.importedVideo?{"content-type":"video/mp4","x-native-import-metadata":request.importedVideo.metadata}:{}},...body===void 0?{}:{body}}));void pending.then(late=>{if(signal.aborted)void late.body?.cancel().catch(()=>{})},()=>{});const response=await abortable(pending,signal);if(!response.ok){const status=response.status;const native=await nativeFailure(response,signal);const code=status===401?"UNAUTHENTICATED":status===403?"FORBIDDEN":status===404?"NOT_FOUND":status===400||status===413||status===415||status===422?"INVALID_INPUT":status===409?"REVISION_CONFLICT":"HTTP_FAILURE";const semanticStatus=status===401||status===403?"BLOCKED":status===404?"NOT_FOUND":status===400||status===413||status===415||status===422?"INVALID_INPUT":status===409?"REVISION_CONFLICT":"INTERNAL_OPERATIONAL_FAILURE";throw new NativeStudioSdkError(native?.code??code,native?.semanticStatus??semanticStatus,failureOutcome(write,native?.semanticStatus??semanticStatus,native?.outcome),status)}return{response,signal}}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError(write?"OUTCOME_UNKNOWN":signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE",write?"UNKNOWN":"NO_WRITE")}}async json(request,schema,options={}){const{response,signal}=await this.response(request,options);try{const contentType=response.headers.get("content-type")?.split(";")[0]?.trim();if(contentType!=="application/json"){void response.body?.cancel().catch(()=>{});throw new Error}const bytes=await boundedResponseBytes(response,this.jsonLimit,signal);return schema.parse(JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes)))}catch(error){if(error instanceof NativeStudioSdkError)throw new NativeStudioSdkError(error.code,error.semanticStatus,request.method==="POST"&&!request.readOnly?"UNKNOWN":"NO_WRITE",error.status);throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",request.method==="POST"&&!request.readOnly?"UNKNOWN":"NO_WRITE")}}async binary(request,contentTypes,limit,options={}){if(request.method!=="GET"||!Number.isSafeInteger(limit)||limit<1||limit>128*1024*1024)sdkInputError();const{response,signal}=await this.response(request,options);const contentType=response.headers.get("content-type")?.split(";")[0]?.trim()??"";if(!contentTypes.includes(contentType)){await response.body?.cancel().catch(()=>{});throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{return{bytes:await boundedResponseBytes(response,limit,signal),contentType,etag:response.headers.get("etag")}}catch(error){throw new NativeStudioSdkError(error instanceof NativeStudioSdkError?error.code:signal.aborted?"REQUEST_ABORTED":"RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}};function descriptorOperation(input,output,request,expectedPath){return Object.freeze({...operation(input,output,request,[],{readOnly:true}),expectedPath})}function operation(input,output,request,identity=[],options={}){return Object.freeze({input,output,request,identity,readOnly:options.readOnly,expectedPath:void 0,identityWhenPresent:options.identityWhenPresent??[]})}function path(...parts){return"/v1/"+parts.map(value=>encodeURIComponent(value)).join("/")}function pageQuery(input){return{limit:input.limit,next:input.next}}function mcpOperation(input,output,readOnly,identity=[],expectedPath){return Object.freeze({input,output,request:null,readOnly,identity,expectedPath,identityWhenPresent:[]})}var scopeKeys=["tenantId","projectId","productionId"];function navigationResponseMatches(value){if(!value||typeof value!=="object")return true;const result=value;if(result.evidence?.source!=="production_snapshot")return true;if(!result.actions?.items||!result.operations?.items)return false;const same2=(a,b)=>typeof a==="string"&&typeof b==="string"&&a.toLowerCase()===b.toLowerCase();const hintsMatch=input=>!input||scopeKeys.every(key10=>input[key10]===void 0||same2(input[key10],result[key10]));return result.actions.items.every(action=>scopeKeys.every(key10=>same2(action.context[key10],result[key10]))&&action.context.revision===result.evidence.revision&&hintsMatch(action.inputHints?.knownInputs)&&hintsMatch(action.inspect?.arguments))&&result.operations.items.every(operation2=>hintsMatch(operation2.inspect?.arguments)&&(!operation2.inspect||operation2.inspect.arguments.operationId===operation2.id))}var envelopes=new Set(["choices","related","operations","items","project","production","productions","artifact","primaryRepresentation","relations","storyVersion","planVersion","version","manifest","timeline","basis","review","selection","decision","target","admission","policy","finalDelivery","receipt","render","evidence","source","sourceIdentity","preparation","link","body","latestReview","finalReady","approval","binding","snapshot","sequence","frames","frameOutput","acceptance","reference","candidate","connection","scope","profile","current","ownerContext","comparison","candidates","reviewContext","input","recordDraft","owner","output","result","briefVersion","deliveryTarget","deliverySnapshot","validation","preparations","view","generationDrafts","request","generation","handoff","mediaRead","reviewTarget","reviews"]);var uuid=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function same(left,right){if(Array.isArray(left)||Array.isArray(right))return Array.isArray(left)&&Array.isArray(right)&&left.length===right.length&&left.every((item,i)=>same(item,right[i]));if(left&&right&&typeof left==="object"&&typeof right==="object"){const a=left,b=right;const keys=Object.keys(a);return keys.length===Object.keys(b).length&&keys.every(key10=>Object.hasOwn(b,key10)&&same(a[key10],b[key10]))}return typeof left==="string"&&typeof right==="string"&&uuid.test(left)&&uuid.test(right)?left.toLowerCase()===right.toLowerCase():left===right}function scopeMatches(value,scope3,depth=0){if(!value||typeof value!=="object")return true;if(depth>12)return false;if(Array.isArray(value))return value.every(item=>scopeMatches(item,scope3,depth+1));const record=value;for(const key10 of["tenantId","projectId","productionId"])if(scope3[key10]!==void 0&&record[key10]!==void 0&&record[key10]!==null&&!same(record[key10],scope3[key10]))return false;return Object.entries(record).every(([key10,item])=>!envelopes.has(key10)||scopeMatches(item,scope3,depth+1))}function targetsMatch(value,parts,expected){if(!parts.length)return same(value,expected);const[part,...rest]=parts;if(part==="*")return Array.isArray(value)&&value.every(item=>targetsMatch(item,rest,expected));return!!value&&typeof value==="object"&&targetsMatch(value[part],rest,expected)}function deviceBound(request,result){const target=request;const receipt=result?.deviceExecution;if(target.mode===void 0)return receipt?.target==="TENANT_DEVICE"&&typeof result?.runtimeJobId==="string"&&(!target.deviceId||same(target.deviceId,receipt.deviceId));return!!receipt&&receipt.mode===target.mode&&!!receipt.runtimeJobId&&(!target.validationMode||target.validationMode===receipt.validationMode)&&(!target.deviceId||same(target.deviceId,receipt.deviceId))}function deviceJobMatches(result){const value=result;return value?.runtimeJobId===void 0||value.deviceExecution?.runtimeJobId===void 0||same(value.runtimeJobId,value.deviceExecution.runtimeJobId)}function assertResponseBindings(result,input,identity,method,pathOrBindings,additionalBindings=[]){if(result===null)return;const expectedPath=typeof pathOrBindings==="string"?pathOrBindings:void 0;const identityWhenPresent=typeof pathOrBindings==="string"||pathOrBindings===void 0?additionalBindings:pathOrBindings;const record=result;const basis=input.basis;const basisInput=basis?.input;const nested=input.scope??basis?.scope??basisInput?.scope??basis;if(input.deviceExecution!==void 0&&!deviceBound(input.deviceExecution,result)||!deviceJobMatches(result)||!scopeMatches(result,input)||!navigationResponseMatches(result)||nested!==void 0&&!scopeMatches(result,nested)||expectedPath!==void 0&&(typeof record?.path!=="string"||record.path.replace(/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}/gi,id7=>id7.toLowerCase())!==expectedPath.replace(/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}/gi,id7=>id7.toLowerCase()))||[...identity,...identityWhenPresent.filter(([,target])=>!!record&&Object.hasOwn(record,target))].some(([key10,target,whenStatus])=>{if(whenStatus!==void 0&&record?.semanticStatus!==whenStatus)return false;const expected=key10.split(".").reduce((value,field)=>value&&typeof value==="object"?value[field]:void 0,input);return expected!==void 0&&!targetsMatch(result,target.split("."),expected)})||Array.isArray(record?.items)&&typeof input.limit==="number"&&record.items.length>input.limit)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE",method==="POST"?"UNKNOWN":"NO_WRITE")}var NativeStudioRuntimeAuthorityClient=class{tenantId;origin;transport;constructor(config){const tenant2=TenantIdSchema.safeParse(config.tenantId);if(!tenant2.success)sdkInputError();this.tenantId=tenant2.data.toLowerCase();if(config.maxJsonBytes!==void 0&&config.maxJsonBytes>65536)sdkInputError();try{this.origin=new URL(config.baseUrl);if(this.origin.protocol!=="https:")sdkInputError()}catch{sdkInputError()}this.transport=new NativeStudioHttpTransport({...config,maxJsonBytes:config.maxJsonBytes??65536,authorization:()=>{throw new Error("Runtime proof has no bearer credential")}})}input(schema,raw){if(!raw||typeof raw!=="object"||Array.isArray(raw))sdkInputError();const record=raw;if(record.tenantId!==void 0&&(typeof record.tenantId!=="string"||record.tenantId.toLowerCase()!==this.tenantId))sdkInputError();const parsed=schema.safeParse({...record,tenantId:this.tenantId});if(!parsed.success)sdkInputError();return parsed.data}resource(projectId,resource){if(resource!==new URL(`/mcp/native/v1/projects/${projectId}`,this.origin).href)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}async prove(raw,options={}){const value=this.input(NativeRuntimeProofRequestSchema,raw),result=await this.transport.json({method:"POST",tenantId:this.tenantId,path:path("projects",value.projectId,"native-tool-grants",value.grantId,"proof"),body:{assertion:value.assertion},authentication:"runtime-proof"},NativeToolGrantViewSchema,options);assertResponseBindings(result,value,[["grantId","grantId"]],"POST");this.resource(value.projectId,result.resource);return result}async status(raw,options={}){const value=this.input(NativeRuntimeProofRequestSchema,raw);try{const result=await this.transport.json({method:"POST",tenantId:this.tenantId,path:path("projects",value.projectId,"native-tool-grants",value.grantId,"status"),body:{assertion:value.assertion},authentication:"runtime-proof"},NativeToolGrantViewSchema,options);assertResponseBindings(result,value,[["grantId","grantId"]],"POST");this.resource(value.projectId,result.resource);return result}catch(error){if(error instanceof NativeStudioSdkError)throw new NativeStudioSdkError(error.code,error.semanticStatus,"NO_WRITE",error.status);throw error}}async exchange(raw,options={}){const value=this.input(NativeToolCredentialExchangeSchema,raw),result=await this.transport.json({method:"POST",tenantId:this.tenantId,path:path("projects",value.projectId,"productions",value.productionId,"native-tool-credentials","exchange"),body:{authorityRef:value.authorityRef,assertion:value.assertion},authentication:"runtime-proof"},NativeToolCredentialReplySchema,options);this.resource(value.projectId,result.resource);if(!result.accessToken.startsWith(`nvst_${result.tokenId}.`))throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN");return result}};export{abortable,boundedResponseBytes,OperationSummarySchema,DeliveryManifestGetSchema,RegisteredDeliveryManifestSchema,ConfigureDeliveryPolicySchema,DeliveryPolicyVersionSchema,DeliveryPolicyReceiptSchema,StartDeliveryValidationSchema,DeliveryValidationGetSchema,DecideDeliveryApprovalSchema,DeliveryAdmissionSchema,DeliveryDecisionReceiptSchema,DeliveryValidationViewSchema,DeliverySnapshotSchema,PrepareShotRequestSchema,PrepareShotResultSchema,PreparationViewSchema,PreparationQueryInputSchema,PreparationQueryPageSchema,PreparationGetInputSchema,PreparationActiveInputSchema,ProductionSnapshotSchema,ProductionQueryInputSchema,ProductionQueryPageSchema,OperationQueryInputSchema,OperationQueryPageSchema,StoryQueryInputSchema,StoryQueryPageSchema,SceneShotPlanQueryInputSchema,SceneShotPlanQueryPageSchema,InterfaceCancellationReceiptSchema,StartAgentHostExecutionSchema,AgentHostExecutionGetSchema,AgentHostExecutionQuerySchema,AgentHostExecutionViewSchema,AgentHostExecutionPageSchema,AgentHostExecutionEventQuerySchema,AgentHostExecutionEventPageSchema,SourceReadSchema,SourceTextWindowSchema,InterfaceDownloadDescriptorSchema,tenantMediaDownloadPath,InterfaceDeliveryDownloadDescriptorSchema,StartReferencePreviewSchema,ReferencePreviewAdmissionSchema,ReferencePreviewResultSchema,ReferencePreviewOperationInputSchema,ReferencePreviewReadResultSchema,ReferencePreviewCancelResultSchema,StudioCapabilitiesInputSchema,StudioCapabilitiesSchema,VideoOptionsSchema,ExplorationContextInputSchema,ExplorationContextResultSchema,ValidateExplorationPlanSchema,ExplorationValidationResultSchema,ExplorationCompareInputSchema,ExplorationComparisonResultSchema,FinalOutputReviewContextInputSchema,FinalOutputReviewContextResultSchema,ValidateCompositionMakingSchema,CompositionMakingValidationSchema,CreateCompositionSchema,ReviseCompositionSchema,CompositionBriefQuerySchema,CompositionAuthoringBriefSchema,ValidateCompositionSchema,CompositionValidationReceiptSchema,PutCompositionInputSchema,CompositionInputReceiptSchema,CompositionCapabilitiesSchema,RepairStrategyContextInputSchema,ValidateRepairStrategySchema,RepairStrategyContextResultSchema,RepairStrategyValidationResultSchema,EditorContextInputSchema,ValidateEditorProposalSchema,EditorContextResultSchema,EditorValidationResultSchema,TemporalEvidenceTargetSchema,OriginalVideoReadSchema,OriginalVideoResultSchema,TemporalEvidenceStartSchema,TemporalEvidenceGetSchema,TemporalEvidenceAdmissionSchema,TemporalEvidenceViewSchema,TemporalEvidenceMediaSchema,TemporalEvidenceImageSchema,TemporalEvidenceImageMetadataSchema,ExplorationRecommendationContextInputSchema,ExplorationRecommendationContextResultSchema,ValidateExplorationRecommendationSchema,ExplorationRecommendationValidationResultSchema,Review1RepairSourceQuerySchema,RepairPlanScopeSchema,AuthorRepairPlanSchema,RecordRepairProofSchema,AuthorReview1RepairSchema,RecordReview1RepairProofSchema,ExecuteRepairSchema,RepairPlanViewSchema,RepairAuthorReceiptSchema,RepairProgressSchema,RepairProofReceiptSchema,LifecycleEventScopeSchema,ConfigureWebhookSchema,DisableWebhookSchema,ReplayWebhookSchema,QueryLifecycleEventsSchema,WebhookSubscriptionSchema,WebhookReplayReceiptSchema,WebhookSubscriptionPageSchema,ExternalLifecycleEventPageSchema,WebhookDeliveryPageSchema,WebhookAttemptPageSchema,LifecycleEventCapabilitiesSchema,CompositionSourceInspectSchema,CompositionSourceInspectionSchema,SourceReviewContextInputSchema,SourceReviewContextSchema,ProgrammaticCompareSchema,ProgrammaticComparisonSchema,ProgrammaticRecommendationContextInputSchema,ProgrammaticRecommendationContextSchema,ValidateProgrammaticRecommendationSchema,ProgrammaticRecommendationValidationSchema,CompositionRenderQuerySchema,CompositionRenderPageSchema,CompositionRenderMediaDescriptorSchema,CompositionSampleStartSchema,CompositionObserveGetSchema,CompositionSampleReceiptSchema,CompositionObservationViewSchema,ScopedAcceptBriefSchema,ScopedAcceptStorySchema,ScopedAcceptSceneShotPlanSchema,CreateProductionRequestSchema,CreatedProductionResultSchema,WavExportResultSchema,AudioExportResultSchema,CaptionExportResultSchema,DiscoveryContentTypeSchema,ArtifactDiscoveryQuerySchema,ArtifactDiscoveryMediaSchema,ArtifactDiscoveryPageSchema,WorkspaceScopeSchema,WorkspaceViewSchema,WorkspaceCallerSchema,WorkspacePageSchema,TerminateProductionSchema,ProductionTerminationReceiptSchema,Review1RepairStrategyContextSchema,ValidateReview1RepairStrategySchema,Review1RepairStrategyValidationSchema,NavigationGroupIdSchema,NavigationGroups,navigationGroup,NavigationProfile,NavigationProfileKey,NavigationToolNames,StudioStartInputSchema,StudioStartSchema,CapabilitySearchInputSchema,CapabilitySearchSchema,CapabilityDescribeInputSchema,PublicToolDefinitionSchema,CapabilityGroupsInputSchema,CapabilityGroupsSchema,CapabilityDescribeSchema,StudioNavigateInputSchema,StudioNavigationSchema,descriptorOperation,operation,path,pageQuery,mcpOperation,assertResponseBindings,nativeFailureCodes,failureOutcome,NativeStudioHttpTransport,NativeStudioRuntimeAuthorityClient};