@nativestudio/cli 0.3.0-rc.1 → 0.3.0-rc.14

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 (217) hide show
  1. package/COMPATIBILITY.json +37 -8
  2. package/LICENSE +201 -21
  3. package/components/runtime.json +33 -4
  4. package/components/runtime.tgz +0 -0
  5. package/dist/_chunks/chunk-2AI3WF2O.js +1 -0
  6. package/dist/_chunks/{chunk-G42IS5JF.js → chunk-3AVC742O.js} +1 -1
  7. package/dist/_chunks/chunk-5DY7LSZZ.js +1 -0
  8. package/dist/_chunks/{chunk-25EDDZQA.js → chunk-6LU6GJKW.js} +1 -1
  9. package/dist/_chunks/chunk-6LY4JYSG.js +1 -0
  10. package/dist/_chunks/chunk-6UYY5KHI.js +1 -0
  11. package/dist/_chunks/chunk-77IAHNM2.js +1 -0
  12. package/dist/_chunks/chunk-C62JAWRQ.js +1 -0
  13. package/dist/_chunks/{chunk-MSOMVWKN.js → chunk-FU3524Z6.js} +1 -1
  14. package/dist/_chunks/chunk-HTUTYIRU.js +1 -0
  15. package/dist/_chunks/chunk-HY7NXJYX.js +1 -0
  16. package/dist/_chunks/chunk-KB2GVAN7.js +1 -0
  17. package/dist/_chunks/chunk-PDQYFIQQ.js +1 -0
  18. package/dist/_chunks/chunk-RDIMORUT.js +1 -0
  19. package/dist/_chunks/chunk-RK2P3UVF.js +1 -0
  20. package/dist/_chunks/chunk-ROBBF33U.js +1 -0
  21. package/dist/_chunks/chunk-S74X4KIC.js +1 -0
  22. package/dist/_chunks/chunk-SV3NF7GO.js +1 -0
  23. package/dist/_chunks/chunk-TLPI6P7L.js +1 -0
  24. package/dist/_chunks/chunk-U7ECMITP.js +1 -0
  25. package/dist/_chunks/chunk-VD3OQ743.js +1 -0
  26. package/dist/_chunks/chunk-VKLS4QK5.js +1 -0
  27. package/dist/_chunks/chunk-W6C63ZN7.js +1 -0
  28. package/dist/_chunks/chunk-ZRSYOFMX.js +1 -0
  29. package/dist/_chunks/connect-6UH7ZFAC.js +1 -0
  30. package/dist/_chunks/device-management-H3NIDIPY.js +1 -0
  31. package/dist/_chunks/device-preflight-LHFLPVAB.js +1 -0
  32. package/dist/_chunks/devices-inventory-I2E3Q4DA.js +1 -0
  33. package/dist/_chunks/devices-main-VV2VYU4T.js +1 -0
  34. package/dist/_chunks/{files-TBJVDQWU.js → files-TTIQ7LYJ.js} +1 -1
  35. package/dist/_chunks/host-main-3JFGVU5P.js +1 -0
  36. package/dist/_chunks/http-profile-NIQDCFPU.js +1 -0
  37. package/dist/_chunks/library-main-CTBW7DAI.js +1 -0
  38. package/dist/_chunks/local-main-227MNGEC.js +1 -0
  39. package/dist/_chunks/local-mcp-XB6E3V2W.js +1 -0
  40. package/dist/_chunks/main-W6NNZFLK.js +2 -0
  41. package/dist/_chunks/mcp-EXQ5UAHB.js +1 -0
  42. package/dist/_chunks/oauth-HC6TI7HB.js +1 -0
  43. package/dist/_chunks/render-main-VTM6WGFP.js +1 -0
  44. package/dist/_chunks/source-import-KKV2UWJO.js +1 -0
  45. package/dist/_chunks/src-OIY5TBQT.js +1 -0
  46. package/dist/_chunks/{stdio-main-JEADWO7U.js → stdio-main-Y7N4NVKU.js} +1 -1
  47. package/dist/_chunks/workspace-main-Y7ZVBRJJ.js +1 -0
  48. package/dist/_types/cli/local/desktop-contract.d.ts +2027 -1
  49. package/dist/_types/cli/local/desktop-device-contract.d.ts +792 -0
  50. package/dist/_types/cli/local/desktop-device-navigation.d.ts +3 -0
  51. package/dist/_types/cli/local/desktop-device-owner.d.ts +270 -0
  52. package/dist/_types/cli/local/desktop-device-state.d.ts +449 -0
  53. package/dist/_types/cli/local/desktop-library.d.ts +853 -0
  54. package/dist/_types/cli/local/desktop-owner.d.ts +784 -1
  55. package/dist/_types/cli/local/ledger.d.ts +74 -20
  56. package/dist/_types/cli/local/manager.d.ts +1255 -49
  57. package/dist/_types/cli/local/mcp-tools.d.ts +296 -54
  58. package/dist/_types/cli/local/releases.d.ts +30 -7
  59. package/dist/_types/cli/local-management.d.ts +8 -0
  60. package/dist/_types/cli/local-navigation.d.ts +1 -0
  61. package/dist/_types/contracts/artifact-discovery.d.ts +136 -4
  62. package/dist/_types/contracts/audio.d.ts +166 -0
  63. package/dist/_types/contracts/composition-authoring.d.ts +8 -8
  64. package/dist/_types/contracts/composition-frame-render.d.ts +4 -4
  65. package/dist/_types/contracts/composition-render-base.d.ts +5 -4
  66. package/dist/_types/contracts/composition-render.d.ts +8 -8
  67. package/dist/_types/contracts/composition-repair.d.ts +10 -10
  68. package/dist/_types/contracts/composition-source-review.d.ts +12 -12
  69. package/dist/_types/contracts/consistency-profile.d.ts +102 -6
  70. package/dist/_types/contracts/continuity-evaluation.d.ts +1 -1
  71. package/dist/_types/contracts/delivery-manifest.d.ts +25 -11729
  72. package/dist/_types/contracts/delivery-operations.d.ts +201 -3909
  73. package/dist/_types/contracts/delivery-summary.d.ts +2 -2
  74. package/dist/_types/contracts/delivery-validation.d.ts +23 -0
  75. package/dist/_types/contracts/device-render.d.ts +79 -0
  76. package/dist/_types/contracts/editor-intelligence.d.ts +392 -2531
  77. package/dist/_types/contracts/exploration-recommendation.d.ts +263 -11607
  78. package/dist/_types/contracts/external-agent-access.d.ts +4 -6
  79. package/dist/_types/contracts/final-ready.d.ts +22 -22
  80. package/dist/_types/contracts/final-render.d.ts +1742 -6949
  81. package/dist/_types/contracts/human-identity.d.ts +13 -0
  82. package/dist/_types/contracts/human-links.d.ts +58 -0
  83. package/dist/_types/contracts/index.d.ts +10 -0
  84. package/dist/_types/contracts/interface/media-output.d.ts +118 -0
  85. package/dist/_types/contracts/interface/operation.d.ts +30 -0
  86. package/dist/_types/contracts/interface/production-snapshot.d.ts +75 -193
  87. package/dist/_types/contracts/interface/query.d.ts +60 -0
  88. package/dist/_types/contracts/keyframe-generation.d.ts +29 -0
  89. package/dist/_types/contracts/local-execution/agent-context.d.ts +385 -0
  90. package/dist/_types/contracts/local-execution/agent-evidence.d.ts +79 -0
  91. package/dist/_types/contracts/local-execution/agent-grant.d.ts +31 -0
  92. package/dist/_types/contracts/local-execution/agent-review.d.ts +522 -64
  93. package/dist/_types/contracts/local-execution/audio-profile.d.ts +6 -0
  94. package/dist/_types/contracts/local-execution/common.d.ts +12 -11
  95. package/dist/_types/contracts/local-execution/completion.d.ts +41 -45
  96. package/dist/_types/contracts/local-execution/components.d.ts +45 -0
  97. package/dist/_types/contracts/local-execution/cpu-preparation.d.ts +46 -0
  98. package/dist/_types/contracts/local-execution/cpu-resources.d.ts +55 -0
  99. package/dist/_types/contracts/local-execution/cpu-speech-job.d.ts +70 -0
  100. package/dist/_types/contracts/local-execution/cpu-speech.d.ts +161 -0
  101. package/dist/_types/contracts/local-execution/descriptor.d.ts +38 -0
  102. package/dist/_types/contracts/local-execution/device-authority.d.ts +31 -0
  103. package/dist/_types/contracts/local-execution/device-inventory.d.ts +76 -0
  104. package/dist/_types/contracts/local-execution/device-workspace.d.ts +11 -0
  105. package/dist/_types/contracts/local-execution/device.d.ts +22 -54
  106. package/dist/_types/contracts/local-execution/external-generation.d.ts +199 -0
  107. package/dist/_types/contracts/local-execution/index.d.ts +32 -0
  108. package/dist/_types/contracts/local-execution/ipc.d.ts +2774 -230
  109. package/dist/_types/contracts/local-execution/library-command.d.ts +620 -0
  110. package/dist/_types/contracts/local-execution/library-result.d.ts +424 -0
  111. package/dist/_types/contracts/local-execution/library.d.ts +873 -0
  112. package/dist/_types/contracts/local-execution/lifecycle.d.ts +289 -47
  113. package/dist/_types/contracts/local-execution/local-navigation.d.ts +285 -65
  114. package/dist/_types/contracts/local-execution/management.d.ts +404 -0
  115. package/dist/_types/contracts/local-execution/media-recipe.d.ts +207 -0
  116. package/dist/_types/contracts/local-execution/media-validation-request.d.ts +232 -0
  117. package/dist/_types/contracts/local-execution/media-validation.d.ts +262 -0
  118. package/dist/_types/contracts/local-execution/object-transfer.d.ts +155 -0
  119. package/dist/_types/contracts/local-execution/offline.d.ts +59 -0
  120. package/dist/_types/contracts/local-execution/preview.d.ts +176 -3561
  121. package/dist/_types/contracts/local-execution/processor-capability.d.ts +41 -0
  122. package/dist/_types/contracts/local-execution/processor-direct.d.ts +290 -0
  123. package/dist/_types/contracts/local-execution/processor-recipes.d.ts +1165 -0
  124. package/dist/_types/contracts/local-execution/processor-toolchain.d.ts +47 -0
  125. package/dist/_types/contracts/local-execution/processor.d.ts +6354 -0
  126. package/dist/_types/contracts/local-execution/project-source-direct.d.ts +201 -0
  127. package/dist/_types/contracts/local-execution/qwen-tts.d.ts +31 -0
  128. package/dist/_types/contracts/local-execution/recognition.d.ts +170 -0
  129. package/dist/_types/contracts/local-execution/speech.d.ts +95 -0
  130. package/dist/_types/contracts/local-execution/tool-selection.d.ts +71 -5
  131. package/dist/_types/contracts/local-execution/whisper.d.ts +24 -0
  132. package/dist/_types/contracts/local-execution/work.d.ts +124 -3402
  133. package/dist/_types/contracts/local-execution/workspace.d.ts +141 -0
  134. package/dist/_types/contracts/media-category.d.ts +11 -0
  135. package/dist/_types/contracts/media-observation.d.ts +929 -8
  136. package/dist/_types/contracts/native-speech-model.d.ts +53 -0
  137. package/dist/_types/contracts/native-speech-options.d.ts +25 -0
  138. package/dist/_types/contracts/navigation-context.d.ts +2 -2
  139. package/dist/_types/contracts/navigation-groups.d.ts +1 -1
  140. package/dist/_types/contracts/navigation.d.ts +60 -20
  141. package/dist/_types/contracts/observation-profile.d.ts +3 -3
  142. package/dist/_types/contracts/production-creation.d.ts +30 -0
  143. package/dist/_types/contracts/production.d.ts +30 -0
  144. package/dist/_types/contracts/programmatic-composition.d.ts +24 -24
  145. package/dist/_types/contracts/programmatic-exploration.d.ts +348 -5985
  146. package/dist/_types/contracts/project-library.d.ts +30 -0
  147. package/dist/_types/contracts/project.d.ts +30 -0
  148. package/dist/_types/contracts/provider-catalog.d.ts +3 -3
  149. package/dist/_types/contracts/provider-models.d.ts +209 -8
  150. package/dist/_types/contracts/provider.d.ts +66 -1
  151. package/dist/_types/contracts/reference-preview.d.ts +19 -0
  152. package/dist/_types/contracts/repair-lifecycle.d.ts +52 -384
  153. package/dist/_types/contracts/repair-plan.d.ts +16 -98
  154. package/dist/_types/contracts/repair-strategy.d.ts +164 -4479
  155. package/dist/_types/contracts/review-intelligence-final-output.d.ts +417 -8149
  156. package/dist/_types/contracts/review-intelligence.d.ts +452 -11420
  157. package/dist/_types/contracts/rough-cut-manifest.d.ts +27 -7
  158. package/dist/_types/contracts/rough-cut-profile.d.ts +12 -3
  159. package/dist/_types/contracts/rough-cut-review.d.ts +144 -12495
  160. package/dist/_types/contracts/rough-cut.d.ts +1170 -5673
  161. package/dist/_types/contracts/shot-preparation-basis.d.ts +2 -2
  162. package/dist/_types/contracts/shot-preparation.d.ts +4 -4
  163. package/dist/_types/contracts/sound-making-plan.d.ts +210 -2
  164. package/dist/_types/contracts/speech-cost.d.ts +96 -0
  165. package/dist/_types/contracts/speech-parameters.d.ts +39 -0
  166. package/dist/_types/contracts/speech.d.ts +602 -22
  167. package/dist/_types/contracts/temporal-evidence-operation.d.ts +1 -0
  168. package/dist/_types/contracts/timeline-audio.d.ts +20 -4
  169. package/dist/_types/contracts/timeline-manifest.d.ts +40 -8
  170. package/dist/_types/contracts/timeline-source-sound.d.ts +42 -4
  171. package/dist/_types/contracts/timeline-v2.d.ts +124 -16
  172. package/dist/_types/contracts/timeline-version-reader.d.ts +288 -40
  173. package/dist/_types/contracts/timeline-visual-layers.d.ts +124 -16
  174. package/dist/_types/contracts/timeline.d.ts +50 -4850
  175. package/dist/_types/contracts/transcription.d.ts +1 -1
  176. package/dist/_types/contracts/video-generation.d.ts +33 -0
  177. package/dist/_types/contracts/visual-exploration.d.ts +1 -1
  178. package/dist/_types/contracts/visual-layer-render.d.ts +298 -47
  179. package/dist/_types/contracts/visual-sequence.d.ts +22 -0
  180. package/dist/_types/contracts/voice-consistency.d.ts +183 -0
  181. package/dist/_types/contracts/voice-profile/contracts.d.ts +821 -0
  182. package/dist/_types/contracts/voice-profile/identity.d.ts +27 -0
  183. package/dist/_types/contracts/voice-profile/interface.d.ts +89 -0
  184. package/dist/_types/contracts/voice-profile/reference.d.ts +106 -0
  185. package/dist/_types/contracts/voice-review.d.ts +1194 -0
  186. package/dist/_types/contracts/workspace.d.ts +62 -0
  187. package/dist/_types/sdk/errors.d.ts +8 -3
  188. package/dist/_types/sdk/local-runtime/components.d.ts +2 -0
  189. package/dist/_types/sdk/local-runtime/device-client.d.ts +180 -18
  190. package/dist/_types/sdk/local-runtime/library.d.ts +268 -0
  191. package/dist/_types/sdk/local-runtime/workspace.d.ts +186 -0
  192. package/dist/_types/sdk/local-runtime-client.d.ts +1917 -92
  193. package/dist/entry.js +1 -1
  194. package/dist/local-management.js +1 -1
  195. package/dist/local-navigation.js +1 -1
  196. package/dist/native/JobNative.cs +10 -0
  197. package/dist/native/JobRunner.cs +24 -3
  198. package/dist/native/NativeMain.cs +15 -0
  199. package/package.json +2 -8
  200. package/README.md +0 -78
  201. package/dist/_chunks/chunk-6NVIN2NI.js +0 -1
  202. package/dist/_chunks/chunk-E57YVMQ4.js +0 -1
  203. package/dist/_chunks/chunk-EAZKDCLD.js +0 -1
  204. package/dist/_chunks/chunk-GIEYSDCG.js +0 -1
  205. package/dist/_chunks/chunk-GJ7BZJLW.js +0 -1
  206. package/dist/_chunks/chunk-HLKERZIE.js +0 -1
  207. package/dist/_chunks/chunk-QC7RLTGU.js +0 -1
  208. package/dist/_chunks/chunk-RUMDDTON.js +0 -1
  209. package/dist/_chunks/chunk-U2UKGYGF.js +0 -1
  210. package/dist/_chunks/chunk-VPYAXWXY.js +0 -1
  211. package/dist/_chunks/local-main-SOERK22D.js +0 -1
  212. package/dist/_chunks/local-mcp-JLPXXIDW.js +0 -1
  213. package/dist/_chunks/main-4SNF5EKE.js +0 -2
  214. package/dist/_chunks/mcp-EIMXNRH3.js +0 -1
  215. package/dist/_chunks/oauth-257CEUQH.js +0 -1
  216. package/dist/_chunks/project-connect-6MH2QG6G.js +0 -1
  217. package/dist/_chunks/src-7F6ZEU3U.js +0 -1
@@ -0,0 +1 @@
1
+ import{ArtifactIdSchema,ArtifactRelationIdSchema,ArtifactRepresentationIdSchema,BriefIdSchema,BriefVersionIdSchema,ContinuationSchema,ContinuityEdgeIdSchema,DeliveryOutputProfileSchema,HumanLinksSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneIdSchema,SceneShotPlanIdSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,StoryIdSchema,StoryVersionIdSchema,TenantIdSchema,finalProfileIds}from"./chunk-6UYY5KHI.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";import{z as z4}from"zod";import{z as z2}from"zod";import{z}from"zod";var Id=z.uuid().transform(value2=>value2.toLowerCase());var ReadId=z.uuid().regex(/^[0-9a-f-]{36}$/);var Key=z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);var Revision=z.int().min(0).max(999999999);var AgentHostScopeSchema=z.strictObject({tenantId:Id,projectId:Id});var ReadScope=z.strictObject({tenantId:ReadId,projectId:ReadId});var AgentHostSelectionSchema=z.strictObject({hostKey:Key,tenantKey:Key,workspaceKey:Key,projectKey:Key,agentKey:Key,agentVersion:z.int().positive().max(1e9),modelOptionKey:Key});var ConfigureAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z.int().min(0).max(999999998),selection:AgentHostSelectionSchema,apiCredential:z.string().regex(/^agxk_[A-Za-z0-9_-]{43}$/).meta({writeOnly:true})});var RevokeAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z.int().min(1).max(999999998)});var AgentHostBindingSchema=ReadScope.extend({bindingId:ReadId,revision:Revision.refine(value2=>value2>0),configurationVersion:Revision.refine(value2=>value2>0),enabled:z.boolean(),selection:AgentHostSelectionSchema,updatedAt:z.iso.datetime({offset:true})}).refine(value2=>value2.configurationVersion<=value2.revision);var UpdateAgentHostSelectionSchema=ConfigureAgentHostSchema.omit({apiCredential:true}).extend({expectedRevision:z.int().min(1).max(999999998),expectedConfigurationVersion:z.int().positive().max(999999998)});var AgentHostCurrentSchema=z.strictObject({binding:AgentHostBindingSchema.nullable()});var AgentHostHistoryQuerySchema=AgentHostScopeSchema.extend({limit:z.int().min(1).max(100).default(20),beforeVersion:z.int().positive().max(999999999).optional()});var AgentHostConfigurationVersionSchema=ReadScope.extend({bindingId:ReadId,version:z.int().positive().max(999999999),selection:AgentHostSelectionSchema,createdByPrincipalId:ReadId,createdAt:z.iso.datetime({offset:true}),revokedAt:z.iso.datetime({offset:true}).nullable()});var AgentHostHistoryPageSchema=z.strictObject({items:z.array(AgentHostConfigurationVersionSchema).max(100),hasMore:z.boolean(),nextBeforeVersion:z.int().positive().max(999999999).nullable()}).refine(page=>page.hasMore===(page.nextBeforeVersion!==null)&&(!page.hasMore||page.items.length>0));var AgentHostReadinessSchema=ReadScope.extend({binding:AgentHostBindingSchema.nullable(),registeredHostKeys:z.array(Key).max(16),configurationStatus:z.enum(["NOT_CONFIGURED","REVOKED","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CONFIGURATION_CHANGED","CONFIGURED"]),remoteCredentialVerification:z.enum(["NOT_CHECKED","VERIFIED"]),nativeToolAuthority:z.enum(["NOT_CONNECTED","UNVERIFIED","VERIFIED"]),executionAvailability:z.enum(["UNAVAILABLE","AVAILABLE"]),reason:z.enum(["NATIVE_TOOL_AUTHORITY_NOT_CONNECTED","NATIVE_TOOL_AUTHORITY_NOT_QUALIFIED","CONFIGURATION_CHANGED"]).nullable(),checkedAt:z.iso.datetime({offset:true})}).refine(v=>{const verified=v.nativeToolAuthority==="VERIFIED";return(v.binding===null||v.binding.tenantId===v.tenantId&&v.binding.projectId===v.projectId)&&verified===(v.remoteCredentialVerification==="VERIFIED")&&verified===(v.executionAvailability==="AVAILABLE")&&verified===(v.reason===null)&&(!verified||v.configurationStatus==="CONFIGURED"&&v.binding?.enabled===true)});var AgentHostFailureSchema=z.strictObject({semanticStatus:z.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z.strictObject({code:z.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","REVISION_CONFLICT","REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","INTERNAL_OPERATIONAL_FAILURE"]),message:z.literal("Agent Host operation did not complete")})});var id=z2.uuid().regex(/^[0-9a-f-]{36}$/);var requestId=z2.uuid().transform(v=>v.toLowerCase());var key=z2.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var NativeRuntimePublicKeySchema=z2.strictObject({kty:z2.literal("EC"),crv:z2.literal("P-256"),x:z2.string().regex(/^[A-Za-z0-9_-]{43}$/),y:z2.string().regex(/^[A-Za-z0-9_-]{43}$/)});var ConfigureNativeToolGrantSchema=AgentHostScopeSchema.extend({requestId,bindingId:requestId,expectedBindingRevision:z2.int().positive(),expectedConfigurationVersion:z2.int().positive(),runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,expiresAt:z2.iso.datetime({offset:true})});var NativeToolGrantGetSchema=AgentHostScopeSchema.extend({grantId:requestId});var RevokeNativeToolGrantSchema=NativeToolGrantGetSchema.extend({requestId,expectedRevision:z2.int().positive()});var NativeRuntimeProofRequestSchema=NativeToolGrantGetSchema.extend({assertion:z2.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).max(4096).meta({writeOnly:true})});var NativeRuntimeStatusClaimsSchema=z2.strictObject({iss:key,sub:key,aud:z2.url().max(2048),grantId:id,installationRevisionId:key,jti:id,iat:z2.int().nonnegative(),exp:z2.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeRuntimeProofClaimsSchema=z2.strictObject({iss:key,sub:key,aud:z2.url().max(2048),grantId:id,grantRevision:z2.int().positive(),installationRevisionId:key,challengeId:id,jti:id,iat:z2.int().nonnegative(),exp:z2.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeToolGrantViewSchema=z2.strictObject({tenantId:id,projectId:id}).extend({protocol:z2.literal("NATIVESTUDIO_RUNTIME_REGISTRATION_V1"),grantId:id,bindingId:id,bindingRevision:z2.int().positive(),configurationVersion:z2.int().positive(),selection:AgentHostSelectionSchema,runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,resource:z2.url().max(2048),revision:z2.int().positive(),enabled:z2.boolean(),createdByPrincipalId:id,runtimePrincipalId:id,createdAt:z2.iso.datetime({offset:true}),expiresAt:z2.iso.datetime({offset:true}),challengeId:id,challengeExpiresAt:z2.iso.datetime({offset:true}),verifiedAt:z2.iso.datetime({offset:true}).nullable(),revokedAt:z2.iso.datetime({offset:true}).nullable()}).refine(v=>{const resource=new URL(v.resource);return resource.protocol==="https:"&&!resource.username&&!resource.password&&!resource.search&&!resource.hash&&resource.pathname===`/mcp/native/v1/projects/${v.projectId}`&&v.enabled===(v.revokedAt===null)&&Date.parse(v.challengeExpiresAt)<=Date.parse(v.expiresAt)});import{z as z3}from"zod";var LocalIdSchema=z3.uuid().overwrite(v=>v.toLowerCase());var LocalDigestSchema=z3.string().length(64).regex(/^[0-9a-f]{64}$/);var LocalRevisionSchema=z3.int().positive();var LocalTimeSchema=z3.iso.datetime({offset:true});var LocalPackageVersionSchema=z3.string().max(120).regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/).refine(v=>v===v.trim());var LocalProjectScopeSchema=z3.strictObject({tenantId:LocalIdSchema,projectId:LocalIdSchema});var LocalWorkScopeSchema=LocalProjectScopeSchema.extend({productionId:LocalIdSchema,runtimeJobId:LocalIdSchema});var LocalPlacementPolicySchema=z3.discriminatedUnion("mode",[z3.strictObject({mode:z3.literal("local-only"),deviceId:LocalIdSchema}),z3.strictObject({mode:z3.literal("local-preferred"),deviceId:LocalIdSchema}),z3.strictObject({mode:z3.literal("cloud-only")})]);var LocalPlacementAvailabilitySchema=z3.discriminatedUnion("status",[z3.strictObject({status:z3.literal("AVAILABLE"),deviceId:LocalIdSchema}),z3.strictObject({status:z3.literal("UNAVAILABLE"),deviceId:LocalIdSchema,reason:z3.enum(["OFFLINE","UNQUALIFIED","BUSY"])}),z3.strictObject({status:z3.literal("DENIED"),reason:z3.enum(["FORBIDDEN","APPROVAL_REQUIRED","INVALID_INPUT"])})]);var LocalDevicePlatformSchema=z4.strictObject({os:z4.enum(["darwin","linux","win32"]),architecture:z4.enum(["x64","arm64"])});var EnrollLocalDeviceSchema=z4.strictObject({tenantId:LocalIdSchema,requestId:LocalIdSchema,label:z4.string().trim().min(1).max(120),platform:LocalDevicePlatformSchema,runtimeVersion:LocalPackageVersionSchema,publicKey:NativeRuntimePublicKeySchema});var LocalDeviceViewSchema=EnrollLocalDeviceSchema.omit({requestId:true}).extend({deviceId:LocalIdSchema,revision:LocalRevisionSchema,enrolledByPrincipalId:LocalIdSchema,createdAt:LocalTimeSchema,verifiedAt:LocalTimeSchema.nullable(),revokedAt:LocalTimeSchema.nullable()}).refine(v=>[v.verifiedAt,v.revokedAt].every(time=>time===null||Date.parse(time)>=Date.parse(v.createdAt)));var LocalDeviceChallengeSchema=z4.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z4.string().min(1).max(2048),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema}).refine(v=>{const ttl=Date.parse(v.expiresAt)-Date.parse(v.issuedAt);return ttl>0&&ttl<=3e5});var LocalDeviceProofClaimsSchema=z4.strictObject({protocol:z4.literal("NVS_LOCAL_DEVICE_PROOF_V1"),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z4.string().min(1).max(2048),jti:LocalIdSchema,iat:z4.int().nonnegative(),exp:z4.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var ProveLocalDeviceSchema=z4.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,assertion:z4.string().max(4096).regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var RevokeLocalDeviceSchema=z4.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,requestId:LocalIdSchema,expectedRevision:LocalRevisionSchema});import{z as z5}from"zod";var WorkspaceDeviceListInputSchema=z5.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema.optional(),after:LocalIdSchema.optional(),limit:z5.int().min(1).max(50).default(25)});var WorkspaceDeviceInventoryItemSchema=z5.strictObject({deviceId:LocalIdSchema,label:z5.string().trim().min(1).max(120),platform:LocalDevicePlatformSchema,runtimeVersion:LocalPackageVersionSchema.nullable(),runtimeVersionObservedAt:LocalTimeSchema.nullable(),revision:LocalRevisionSchema,createdAt:LocalTimeSchema,verifiedAt:LocalTimeSchema.nullable(),revokedAt:LocalTimeSchema.nullable(),lastSeenAt:LocalTimeSchema.nullable(),connection:z5.enum(["UNVERIFIED","REVOKED","OWNER_UNAVAILABLE","CONNECTED","DISCONNECTED"])}).refine(value2=>value2.runtimeVersion===null===(value2.runtimeVersionObservedAt===null),{message:"Runtime version and observation time must be present together"});var WorkspaceDeviceListSchema=z5.strictObject({tenantId:LocalIdSchema,observedAt:LocalTimeSchema,items:z5.array(WorkspaceDeviceInventoryItemSchema).max(50),nextCursor:LocalIdSchema.nullable()});import{z as z7}from"zod";import{z as z6}from"zod";var processorFamilies={IMPORTED_VISUAL_NORMALIZE:"ARTIFACT_INGEST",SOURCE_SYNC_AUDIO:"ARTIFACT_INGEST",TEMPORAL_SAMPLE:"TEMPORAL_SAMPLE",DELIVERY_VALIDATE:"DELIVERY_VALIDATE",COMPOSITION_RENDER:"COMPOSITION_RENDER",IMPORT_ORIGINAL:"ARTIFACT_INGEST",LOCAL_MEDIA_INSPECT:"OBSERVE",LOCAL_MEDIA_PUBLISH:"ARTIFACT_INGEST",IMPORT_PROJECT_SOURCE:"ARTIFACT_INGEST",REGISTER_VISUAL_SEQUENCE:"ARTIFACT_INGEST",SPEECH_SYNTHESIZE:"AUDIO_GENERATE",SPEECH_SYNTHESIZE_CPU:"AUDIO_GENERATE",SPEECH_EXTERNAL_QWEN:"AUDIO_GENERATE",TRANSCRIBE_AUDIO:"OBSERVE",TRANSCRIBE_EXTERNAL_QWEN:"OBSERVE",KEYFRAME_GENERATE:"KEYFRAME_GENERATE",VIDEO_GENERATE:"VIDEO_GENERATE"};var TenantProcessorKindSchema=z6.enum(Object.keys(processorFamilies));var validationMode=z7.literal("TENANT_TRUSTED_VALIDATOR").optional();var DeviceRenderTargetSchema=z7.strictObject({mode:z7.literal("tenant-device-only"),deviceId:z7.uuid().optional(),validationMode});var DeviceRenderReceiptSchema=z7.strictObject({mode:z7.literal("tenant-device-only"),deviceId:z7.uuid(),runtimeJobId:z7.uuid(),validationMode});var projectDeviceScope=z7.strictObject({tenantId:z7.uuid(),projectId:z7.uuid(),kind:z7.enum(["preview","final","library",...TenantProcessorKindSchema.options])});var ProjectDeviceListInputSchema=projectDeviceScope.extend({deviceId:z7.uuid().optional()});var ProjectDeviceListSchema=projectDeviceScope.extend({items:z7.array(z7.strictObject({deviceId:z7.uuid(),label:z7.string().trim().min(1).max(120),availability:z7.enum(["AVAILABLE","BUSY","OFFLINE","UNQUALIFIED"])})).max(50),truncated:z7.boolean(),validationMode:z7.literal("TENANT_TRUSTED_VALIDATOR").nullable()});import{z as z27}from"zod";import{z as z25}from"zod";import{z as z8}from"zod";var offset=z8.int().min(0).max(4094).multipleOf(2);var dimension=z8.int().min(2).max(4096).multipleOf(2);var ClipFramingSchema=z8.strictObject({algorithm:z8.literal("CROP_PAD_V1"),crop:z8.strictObject({x:offset,y:offset,width:dimension,height:dimension}),anchorXPermille:z8.int().min(0).max(1e3),anchorYPermille:z8.int().min(0).max(1e3)});var PicturePolicySchema=z8.literal("CROP_PAD_V1");import{z as z9}from"zod";var ClipTransitionSchema=z9.union([z9.literal("CUT"),z9.strictObject({kind:z9.literal("CROSS_DISSOLVE_V1"),durationFrames:z9.int().min(2).max(30)})]);import{z as z10}from"zod";var sha=z10.string().regex(/^[0-9a-f]{64}$/);var GraphicPlacementSchema=z10.strictObject({startFrame:z10.int().nonnegative().max(1800),endFrame:z10.int().positive().max(1800),anchor:z10.enum(["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"]),widthPermille:z10.int().min(50).max(400),marginXPermille:z10.int().min(0).max(100),marginYPermille:z10.int().min(0).max(100),opacityPermille:z10.int().min(100).max(1e3)}).refine(v=>v.endFrame>v.startFrame,"Graphic frame interval must advance");var TimelineGraphicInputSchema=z10.strictObject({artifactId:ArtifactIdSchema,placement:GraphicPlacementSchema});var TimelineGraphicSourceSchema=z10.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha,contentType:z10.enum(["image/png","image/webp"]),byteSize:z10.int().positive().max(16*1024*1024),width:z10.int().positive().max(8192),height:z10.int().positive().max(8192)});var TimelineGraphicSchema=z10.strictObject({source:TimelineGraphicSourceSchema,placement:GraphicPlacementSchema});import{z as z12}from"zod";import{z as z11}from"zod";var id2=z11.uuid().toLowerCase();var hash=z11.string().regex(/^[0-9a-f]{64}$/);var CaptionTranscriptPlacementSchema=z11.discriminatedUnion("kind",[z11.strictObject({kind:z11.literal("AUDIO_TRACK"),purpose:z11.enum(["VOICEOVER","MUSIC"])}),z11.strictObject({kind:z11.literal("SPEECH_CUE"),cueId:z11.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}),z11.strictObject({kind:z11.literal("TIMELINE_OUTPUT")})]);var CaptionTranscriptPlanSchema=z11.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,timelineVersionId:id2,language:z11.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),sources:z11.array(z11.strictObject({observationId:id2,placement:CaptionTranscriptPlacementSchema,granularity:z11.enum(["word","segment"])})).min(1).max(64)});var AuthorTranscriptCaptionsSchema=CaptionTranscriptPlanSchema.extend({expectedProductionRevision:z11.int().positive(),expectedCaptionVersion:z11.int().nonnegative(),idempotencyKey:z11.string().trim().min(1).max(200)});var CaptionTranscriptProvenanceSchema=z11.strictObject({schemaVersion:z11.literal(1),advisory:z11.literal(true),timing:z11.literal("PROVIDER_REPORTED"),timelineVersionId:id2,timingFingerprint:hash,sources:z11.array(z11.strictObject({observationId:id2,artifactId:id2,representationId:id2,checksumSha256:hash,placement:CaptionTranscriptPlacementSchema,granularity:z11.enum(["word","segment"]),sourceInMs:z11.int().nonnegative(),sourceOutMs:z11.int().positive(),startMs:z11.int().nonnegative(),spanIndices:z11.array(z11.int().nonnegative().max(1199)).min(1).max(120),excludedSpans:z11.int().nonnegative().max(1200)})).min(1).max(64)});var sha2=z12.string().regex(/^[0-9a-f]{64}$/);var CaptionContentSchema=z12.strictObject({language:z12.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),durationMs:z12.int().min(3e4).max(6e4),cues:z12.array(z12.strictObject({startMs:z12.int().nonnegative().max(59999),endMs:z12.int().positive().max(6e4),text:z12.string().min(1).max(240)})).min(1).max(120)});var CaptionScopeSchema=z12.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AuthorCaptionsSchema=CaptionScopeSchema.extend({expectedProductionRevision:z12.int().positive(),expectedCaptionVersion:z12.int().nonnegative(),idempotencyKey:z12.string().trim().min(1).max(200),content:CaptionContentSchema});var CaptionGetSchema=CaptionScopeSchema.extend({versionId:z12.uuid()});var CaptionQuerySchema=CaptionScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var CaptionRepresentationSchema=z12.strictObject({id:z12.uuid(),checksumSha256:sha2,byteSize:z12.int().positive().max(131072)});var CaptionVersionSchema=CaptionScopeSchema.extend({transcriptProvenance:CaptionTranscriptProvenanceSchema.optional(),id:z12.uuid(),captionId:z12.uuid(),projectId:z12.uuid(),version:z12.int().positive(),artifactId:z12.uuid(),content:CaptionContentSchema,fingerprint:sha2,original:CaptionRepresentationSchema,subtitle:CaptionRepresentationSchema,previousVersionId:z12.uuid().nullable(),createdByPrincipalId:z12.uuid(),createdAt:z12.iso.datetime({offset:true})});var CaptionViewSchema=z12.strictObject({version:CaptionVersionSchema,isCurrent:z12.boolean(),availability:z12.enum(["AVAILABLE","UNAVAILABLE"])});var CaptionReceiptSchema=z12.strictObject({semanticStatus:z12.literal("SUCCESS"),version:CaptionVersionSchema,productionRevision:z12.int().positive()});var CaptionBasisSchema=CaptionScopeSchema.extend({productionRevision:z12.int().positive(),currentVersion:z12.int().nonnegative(),currentVersionId:z12.uuid().nullable(),authorable:z12.boolean()});var CaptionPageSchema=z12.strictObject({items:z12.array(CaptionViewSchema).max(200),page:QueryPageInfoSchema});var CaptionExportSchema=CaptionGetSchema.extend({format:z12.enum(["JSON","SRT"])});var CaptionSnapshotSchema=z12.strictObject({currentVersion:z12.int().positive().nullable(),currentVersionId:z12.uuid().nullable(),artifactId:z12.uuid().nullable(),availability:z12.enum(["NONE","AVAILABLE","UNAVAILABLE"]),cueCount:z12.int().nonnegative().max(120),durationMs:z12.int().min(3e4).max(6e4).nullable(),attachedToTimeline:z12.boolean(),attachedCaptionVersionId:z12.uuid().nullable().optional(),attachedTimelineVersionId:z12.uuid().nullable().optional()});var CaptionTranscriptDraftSchema=z12.strictObject({content:CaptionContentSchema,provenance:CaptionTranscriptProvenanceSchema});import{z as z13}from"zod";var LegacyCaptionRenderStyleSchema=z13.strictObject({id:z13.literal("PLAIN_TEXT_NOTO_SANS_SC_V1"),fontSha256:z13.literal("a3041811a78c361b1de50f953c805e0244951c21c5bd412f7232ef0d899af0da"),framePolicy:z13.literal("PTS_HALF_OPEN_CEIL_V1")});var RegularCaptionRenderStyleSchema=z13.strictObject({id:z13.literal("PLAIN_TEXT_NATIVE_SC_REGULAR_V2"),fontSha256:z13.literal("e5a51f41fc1b827da651afee3975e07a182ff4f8e04d9dfc0a3cecd6177a52b6"),framePolicy:z13.literal("PTS_HALF_OPEN_CEIL_V1")});var CaptionRenderStyleSchema=z13.discriminatedUnion("id",[LegacyCaptionRenderStyleSchema,RegularCaptionRenderStyleSchema]);import{z as z16}from"zod";import{z as z15}from"zod";import{z as z14}from"zod";var VoiceProfileRefSchema=z14.strictObject({ownerSystem:z14.string().regex(/^[a-z][a-z0-9-]{1,79}$/),ownerTenantRef:z14.string().trim().min(1).max(160),voiceProfileRef:z14.string().trim().min(1).max(160),version:z14.int().positive(),digest:z14.string().regex(/^[a-f0-9]{64}$/)});var VoiceLocaleSchema=z14.string().min(2).max(35).refine(value2=>{try{return value2.toLowerCase()!=="auto"&&Intl.getCanonicalLocales(value2).length===1}catch{return false}},"A concrete BCP 47 language is required").describe("Concrete BCP 47 tag, for example zh or en-US; auto is not a language");var VoiceProfileUseSchema=z14.strictObject({ref:VoiceProfileRefSchema,bindingKey:z14.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),language:VoiceLocaleSchema,usage:z14.enum(["AUDITION","PRODUCTION"])});var sha3=z15.string().regex(/^[0-9a-f]{64}$/);var AudioPurposeSchema=z15.enum(["VOICEOVER","MUSIC"]);var AudioProductionScopeSchema=z15.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AudioScopeSchema=AudioProductionScopeSchema.extend({purpose:AudioPurposeSchema});var AudioMaterialPurposeSchema=z15.enum(["VOICEOVER","MUSIC","VOICE_SAMPLE"]);var AudioReadScopeSchema=AudioScopeSchema.extend({purpose:AudioMaterialPurposeSchema});var AudioMediaSchema=z15.strictObject({profile:z15.literal("PCM_S16LE_48000_V1"),audioCodec:z15.literal("pcm_s16le"),sampleRateHz:z15.literal(48e3),audioChannels:z15.union([z15.literal(1),z15.literal(2)]),sampleCount:z15.int().min(4800).max(288e4),durationMs:z15.int().min(100).max(6e4)}).refine(m=>m.sampleCount*1e3===m.durationMs*m.sampleRateHz,{message:"Exact PCM sample count must match duration"});var AudioImportSchema=AudioScopeSchema.extend({expectedProductionRevision:z15.int().positive(),expectedAudioVersion:z15.int().nonnegative(),idempotencyKey:z15.string().trim().min(1).max(200),contentType:z15.literal("audio/wav"),originalName:z15.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).optional()});var AudioImportRequestSchema=AudioImportSchema.extend({contentBase64:z15.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var AudioPublicationSchema=AudioImportSchema.extend({purpose:AudioMaterialPurposeSchema});var AudioGetSchema=AudioReadScopeSchema.extend({versionId:z15.uuid()});var AudioQuerySchema=AudioReadScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var AudioRepresentationSchema=z15.strictObject({id:z15.uuid(),checksumSha256:sha3,byteSize:z15.int().min(44).max(12582912)});var AudioVersionSchema=AudioReadScopeSchema.extend({id:z15.uuid(),audioId:z15.uuid(),projectId:z15.uuid(),version:z15.int().positive(),artifactId:z15.uuid(),original:AudioRepresentationSchema,media:AudioMediaSchema,originalName:z15.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).nullable(),previousVersionId:z15.uuid().nullable(),createdByPrincipalId:z15.uuid(),createdAt:z15.iso.datetime({offset:true}),generation:z15.strictObject({generationId:z15.uuid(),voiceProfile:VoiceProfileUseSchema.optional(),executionClass:z15.enum(["LIVE","TEST_ONLY"]),executionTarget:z15.literal("TENANT_DEVICE").optional(),sourceArtifactId:z15.uuid(),sourceRepresentationId:z15.uuid(),sourceChecksumSha256:sha3,sourceByteSize:z15.int().min(44).max(12582912),sourceMedia:z15.strictObject({sampleRateHz:z15.int().positive().max(48e3),audioChannels:z15.union([z15.literal(1),z15.literal(2)]),sampleCount:z15.int().positive()}),normalizationVersion:z15.literal("SPEECH_PCM_V1"),padSamples:z15.int().min(0).max(47)}).optional()}).refine(v=>v.version===1===(v.previousVersionId===null),{message:"Audio replacement history must preserve exact preceding version"});var AudioViewSchema=z15.strictObject({version:AudioVersionSchema,isCurrent:z15.boolean(),availability:z15.enum(["AVAILABLE","UNAVAILABLE"])});var ProductionAudioVersionSchema=AudioVersionSchema.safeExtend({purpose:AudioPurposeSchema});var AudioReceiptSchema=z15.strictObject({semanticStatus:z15.literal("SUCCESS"),version:AudioVersionSchema,productionRevision:z15.int().positive()});var AudioBasisSchema=AudioReadScopeSchema.extend({productionRevision:z15.int().positive(),currentVersion:z15.int().nonnegative(),currentVersionId:z15.uuid().nullable(),importable:z15.boolean()});var AudioPageSchema=z15.strictObject({items:z15.array(AudioViewSchema).max(200),page:QueryPageInfoSchema});var AudioSnapshotSchema=z15.strictObject({tracks:z15.array(z15.strictObject({purpose:AudioPurposeSchema,currentVersion:z15.int().positive().nullable(),currentVersionId:z15.uuid().nullable(),artifactId:z15.uuid().nullable(),availability:z15.enum(["NONE","AVAILABLE","UNAVAILABLE"]),durationMs:z15.int().min(100).max(6e4).nullable(),audioChannels:z15.union([z15.literal(1),z15.literal(2)]).nullable(),attachedToTimeline:z15.boolean()})).length(2)});var placement={sourceInMs:z16.int().nonnegative().max(6e4),sourceOutMs:z16.int().positive().max(6e4),startMs:z16.int().nonnegative().max(6e4),gainPermille:z16.int().nonnegative().max(1e3)};var TimelineAudioInputSchema=z16.strictObject({tracks:z16.array(z16.strictObject({purpose:AudioPurposeSchema,versionId:z16.uuid(),...placement})).min(1).max(2),duckingMusicPermille:z16.int().nonnegative().max(1e3).default(1e3)}).superRefine((audio2,ctx)=>{if(new Set(audio2.tracks.map(t=>t.purpose)).size!==audio2.tracks.length||audio2.tracks.some(t=>t.sourceOutMs<=t.sourceInMs)||audio2.duckingMusicPermille<1e3&&audio2.tracks.length!==2)ctx.addIssue({code:"custom",message:"Distinct purposes, advancing trims and explicit ducking pair required"})});var AudioMixProfileSchema=z16.strictObject({id:z16.literal("PCM_WINDOW_MIX_AAC_V1"),sampleRateHz:z16.literal(48e3),audioChannels:z16.literal(2),audioCodec:z16.literal("aac"),bitrate:z16.literal(192e3),peakPermille:z16.literal(950),duckingMusicPermille:z16.int().nonnegative().max(1e3)});var TimelineAudioCompositionSchema=z16.strictObject({mix:AudioMixProfileSchema,tracks:z16.array(z16.strictObject({source:ProductionAudioVersionSchema,...placement})).min(1).max(2)}).superRefine((audio2,ctx)=>{if(new Set(audio2.tracks.map(t=>t.source.purpose)).size!==audio2.tracks.length||audio2.tracks.some(t=>t.sourceOutMs<=t.sourceInMs||t.sourceOutMs>t.source.media.durationMs)||audio2.mix.duckingMusicPermille<1e3&&audio2.tracks.length!==2)ctx.addIssue({code:"custom",message:"Invalid exact audio composition"})});var RenderedAudioSchema=z16.strictObject({audioCodec:z16.literal("aac"),sampleRateHz:z16.literal(48e3),audioChannels:z16.literal(2),sampleCount:z16.int().positive().max(288e4)});import{z as z17}from"zod";var Fingerprint=z17.string().regex(/^[0-9a-f]{64}$/);var AcceptedShotReferenceSchema=z17.strictObject({acceptanceId:z17.uuid(),reviewId:z17.uuid(),generationId:z17.uuid(),candidateId:z17.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint,artifactChecksumSha256:Fingerprint,preparationId:z17.uuid(),contractId:z17.uuid(),contractFingerprint:Fingerprint,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z17.int().positive(),shotPlanningRevision:z17.int().positive(),executionClass:z17.enum(["LIVE","TEST_ONLY"]),reviewResult:z17.enum(["PASS","WARNING"])});import{z as z19}from"zod";import{z as z18}from"zod";var ProviderIdSchema=z18.enum(["QWEN_CN","VOLCENGINE_CN","GEMINI","OPENAI","XAI"]);var ProviderConnectionIdSchema=z18.uuid().brand();var ModelProfileIdSchema=z18.string().regex(/^[a-z][a-z0-9-]{1,79}$/);var GeometryPolicySchema=z18.enum(["STRICT","PAD_TO_ASPECT"]);var ProviderSelectionSchema=z18.strictObject({connectionId:ProviderConnectionIdSchema,modelProfileId:ModelProfileIdSchema});var TenantProviderExecutionGrantSchema=z18.strictObject({projectId:z18.uuid(),modelProfileId:ModelProfileIdSchema,modelProfileVersion:z18.int().positive(),workload:z18.enum(["KEYFRAME_GENERATE","VIDEO_GENERATE","SPEECH_SYNTHESIS","TRANSCRIPTION","AUDIO_OBSERVATION","VIDEO_OBSERVATION"]),disclosure:z18.enum(["TEXT_ONLY","IMMUTABLE_PROJECT_INPUTS"]),expiresAt:z18.iso.datetime({offset:true}),maxPerRequestMicros:z18.int().min(0).max(1e9),maxTotalMicros:z18.int().min(0).max(1e9),maxSubmissions:z18.int().min(1).max(1e4)}).refine(v=>v.maxPerRequestMicros<=v.maxTotalMicros);var providerConfigurationFields={providerId:ProviderIdSchema,label:z18.string().trim().min(1).max(100),allowedModelProfileIds:z18.array(ModelProfileIdSchema).min(1).max(16),qwenEndpoint:z18.literal("QIANWEN_PLATFORM").optional(),credentialService:z18.enum(["ARK","DOUBAO_SPEECH"]).optional(),qwenWorkspaceId:z18.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/).optional(),geometryPolicy:GeometryPolicySchema.default("STRICT")};var ProviderConfigurationSchema=z18.strictObject({...providerConfigurationFields,tenantExecution:z18.array(TenantProviderExecutionGrantSchema).min(1).max(64).optional()}).superRefine((v,c)=>{if(new Set(v.allowedModelProfileIds).size!==v.allowedModelProfileIds.length)c.addIssue({code:"custom",message:"Duplicate model profile"});const grants=v.tenantExecution??[];const keys=new Set(grants.map(g=>[g.projectId.toLowerCase(),g.modelProfileId,g.workload].join(":")));if(keys.size!==grants.length||grants.some(g=>!v.allowedModelProfileIds.includes(g.modelProfileId)))c.addIssue({code:"custom",message:"Invalid tenant execution scope",path:["tenantExecution"]});if(v.qwenWorkspaceId&&v.providerId!=="QWEN_CN")c.addIssue({code:"custom",message:"Workspace only applies to Qwen China"});if(v.credentialService&&v.providerId!=="VOLCENGINE_CN")c.addIssue({code:"custom",message:"Credential service applies to Volcengine"});if(v.qwenEndpoint&&(v.providerId!=="QWEN_CN"||v.qwenWorkspaceId))c.addIssue({code:"custom",message:"Qianwen platform requires an exact Qwen route without a workspace"})});var ConfigureProviderInputSchema=z18.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z18.int().nonnegative(),configuration:ProviderConfigurationSchema,apiKey:z18.string().min(8).max(4096).regex(/^[!-~]+$/)});var ProviderConnectionViewSchema=z18.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z18.int().positive(),enabled:z18.boolean(),credentialConfigured:z18.boolean(),configuration:z18.object(providerConfigurationFields),createdByPrincipalId:PrincipalIdSchema,updatedAt:z18.iso.datetime({offset:true})});var ProviderConnectionCommandSchema=z18.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z18.int().positive()});var ProviderCredentialRevokeSchema=z18.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z18.int().positive()});var SetKeyframeDefaultSchema=z18.strictObject({tenantId:TenantIdSchema,selection:ProviderSelectionSchema,expectedRevision:z18.int().nonnegative()});var ProviderExecutionBindingSchema=z18.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,connectionVersion:z18.int().positive(),providerId:ProviderIdSchema,modelProfileId:ModelProfileIdSchema,modelProfileVersion:z18.int().positive(),modelId:z18.string().min(1).max(160),credentialRef:z18.uuid(),credentialVersion:z18.int().positive(),geometryPolicy:GeometryPolicySchema,qwenEndpoint:z18.literal("QIANWEN_PLATFORM").optional()}).refine(binding=>!binding.qwenEndpoint||binding.providerId==="QWEN_CN",{message:"Qianwen platform binding requires Qwen China"});var GenerationCostVariantSchema=z19.strictObject({mode:z19.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),aspectRatio:z19.enum(["16:9","9:16"]),workingWidth:z19.int().min(0).max(4096),workingHeight:z19.int().min(0).max(4096),hasAudio:z19.boolean(),references:z19.int().min(0).max(24),durationSeconds:z19.number().finite().min(0).max(30)});var GenerationCostPolicySchema=z19.strictObject({currency:z19.literal("USD"),sourceUrl:z19.url({protocol:/^https$/}).max(2e3),rationale:z19.string().trim().min(1).max(2e3),validUntil:z19.iso.datetime({offset:true}),rules:z19.array(z19.strictObject({id:z19.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),variant:GenerationCostVariantSchema,upperBoundMicros:z19.int().nonnegative().max(1e9)})).min(1).max(64)}).refine(p=>new Set(p.rules.map(r=>r.id)).size===p.rules.length,"Duplicate cost rule");var ExpectedGenerationExecutionSchema=z19.strictObject({connectionVersion:z19.int().positive(),modelProfileVersion:z19.int().positive(),quoteValidUntil:z19.iso.datetime({offset:true})});var GenerationCostQuoteSchema=z19.strictObject({currency:z19.literal("USD"),upperBoundMicros:z19.int().nonnegative().max(1e9),selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema,sourceUrl:z19.url({protocol:/^https$/}).max(2e3),ruleIds:z19.array(z19.string()).min(1).max(64),preparationId:z19.uuid(),contractFingerprint:z19.string().regex(/^[a-f0-9]{64}$/)});import{z as z24}from"zod";import{z as z20}from"zod";var id3=z20.uuid().toLowerCase();var hash2=z20.string().regex(/^[0-9a-f]{64}$/);var NativeVideoAudioMetadataSchema=z20.strictObject({normalizationVersion:z20.literal("VIDEO_AUDIO_PCM_V1"),sourceCodec:z20.literal("aac"),sourceSampleRateHz:z20.int().min(8e3).max(96e3),sourceChannels:z20.union([z20.literal(1),z20.literal(2)]),sourceFrameRateHz:z20.union([z20.literal(24),z20.literal(30)]),sourceFrameCount:z20.int().positive().max(905),sourceStartOffsetMs:z20.number().finite().min(-500).max(5e3),sourceDeclaredDurationMs:z20.number().positive().max(31e3),alignment:z20.literal("TRIM_PAD_PCM_TO_VIDEO_ZERO_V1"),media:z20.strictObject({profile:z20.literal("PCM_S16LE_48000_NATIVE_VIDEO_V1"),audioCodec:z20.literal("pcm_s16le"),sampleRateHz:z20.literal(48e3),audioChannels:z20.union([z20.literal(1),z20.literal(2)]),sampleCount:z20.int().positive().max(1448e3),durationMs:z20.number().positive().max(30200)}).refine(m=>m.durationMs===m.sampleCount/48),checksumSha256:hash2}).superRefine((v,ctx)=>{if(v.media.sampleCount!==v.sourceFrameCount*(48e3/v.sourceFrameRateHz)||v.media.audioChannels!==v.sourceChannels)ctx.addIssue({code:"custom",message:"Native PCM must follow the exact source video frame clock"})});var NativeVideoSoundReferenceSchema=z20.strictObject({id:id3,tenantId:id3,projectId:id3,productionId:id3,shotId:id3,generationId:id3,videoArtifactId:id3,videoRepresentationId:id3,videoChecksumSha256:hash2,artifactId:id3,representationId:id3,checksumSha256:hash2,byteSize:z20.int().min(44).max(12582912),metadata:NativeVideoAudioMetadataSchema,executionClass:z20.enum(["LIVE","TEST_ONLY"])});import{z as z21}from"zod";var KeyframePurposeSchema=z21.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"]);var AcceptedKeyframeReferenceSchema=z21.strictObject({acceptanceId:z21.uuid(),reviewId:z21.uuid(),generationId:z21.uuid(),candidateId:z21.uuid(),shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z21.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z21.string().regex(/^[0-9a-f]{64}$/),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z21.int().positive(),shotPlanningRevision:z21.int().positive(),executionClass:z21.enum(["LIVE","TEST_ONLY"])});import{z as z23}from"zod";import{z as z22}from"zod";var ConsistencyReviewScaleSchema=z22.enum(["INTRA_SHOT","INTER_SHOT","PRODUCTION"]);var State=z22.string().trim().min(1).max(300);var StoryTime=z22.int().nonnegative().max(31536e8);var position=z22.int().min(1).max(999);var StateChange=z22.strictObject({atPermille:position,from:State,to:State,reason:State});var TimeJump=z22.strictObject({atPermille:position,fromMs:StoryTime,toMs:StoryTime,reason:State});var ContinuityExpectationSchema=z22.discriminatedUnion("kind",[z22.strictObject({kind:z22.literal("STATE"),mode:z22.enum(["PRESERVE","PLANNED_TRANSITIONS"]),entry:State,exit:State,changes:z22.array(StateChange).min(1).max(16).optional()}).superRefine((v,c)=>{const changes=v.changes??[];if(v.mode==="PLANNED_TRANSITIONS"!==!!changes.length||!changes.length&&v.entry!==v.exit||changes.length&&(changes[0].from!==v.entry||changes.at(-1).to!==v.exit)||changes.some((x,i)=>x.from===x.to||i>0&&(x.atPermille<=changes[i-1].atPermille||x.from!==changes[i-1].to)))c.addIssue({code:"custom",message:"State changes require an ordered explicit plan with exact entry and exit"})}),z22.strictObject({kind:z22.literal("TIME"),mode:z22.enum(["MONOTONIC","PLANNED_JUMPS"]),entryMs:StoryTime,exitMs:StoryTime,jumps:z22.array(TimeJump).min(1).max(16).optional()}).superRefine((v,c)=>{const jumps=v.jumps??[];if(v.mode==="PLANNED_JUMPS"!==!!jumps.length||!jumps.length&&v.exitMs<v.entryMs||jumps.length&&(jumps[0].fromMs<v.entryMs||jumps.at(-1).toMs>v.exitMs)||jumps.some((x,i)=>x.fromMs===x.toMs||i>0&&(x.atPermille<=jumps[i-1].atPermille||x.fromMs<jumps[i-1].toMs)))c.addIssue({code:"custom",message:"Story time requires monotonic segments separated by exact planned jumps"})})]);var ContinuitySampleSchema=z22.strictObject({atMs:z22.int().nonnegative().max(6e4),state:State.optional(),storyTimeMs:StoryTime.optional()}).superRefine((v,c)=>{if(v.state!==void 0===(v.storyTimeMs!==void 0))c.addIssue({code:"custom",message:"A sample observes exactly one state or story-time value"})});var ContinuitySamplesSchema=z22.array(ContinuitySampleSchema).min(3).max(64);var PreparationIdSchema=z23.uuid().brand();var GenerationContractIdSchema=z23.uuid().brand();var ContentFingerprintSchema=z23.string().regex(/^[0-9a-f]{64}$/);var PreparationTargetSchema=z23.discriminatedUnion("mediaType",[z23.strictObject({mediaType:z23.literal("IMAGE"),purpose:z23.enum(["KEYFRAME","REFERENCE_FRAME"]),framePurpose:z23.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"])}),z23.strictObject({mediaType:z23.literal("VIDEO"),purpose:z23.literal("SHOT_CANDIDATE")})]);var PreparationBasisSchema=z23.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sceneId:SceneIdSchema,shotId:ShotIdSchema,productionRevision:z23.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z23.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z23.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z23.int().positive(),shotPlanningRevision:z23.int().positive(),resolverVersion:z23.literal("w7-product-preflight-v1"),consistencyProfile:z23.strictObject({id:z23.uuid(),version:z23.int().positive(),effectiveFingerprint:ContentFingerprintSchema}).optional()});var ReferenceRoleSchema=z23.enum(["PRODUCT_IDENTITY","PRODUCT_PACKSHOT","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","START_FRAME_ANCHOR","END_FRAME_ANCHOR"]);var ReferenceBindingInputSchema=z23.strictObject({keyframeAcceptanceId:z23.uuid().optional(),role:ReferenceRoleSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,reason:z23.string().trim().min(1).max(500)});var ExactEvidenceReferenceSchema=z23.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,artifactChecksumSha256:ContentFingerprintSchema});var ResolvedReferenceSchema=ReferenceBindingInputSchema.extend({artifactChecksumSha256:ContentFingerprintSchema,contentType:z23.enum(["image/png","image/jpeg","image/webp"]),acceptedKeyframe:AcceptedKeyframeReferenceSchema.optional(),consistencyRuleId:z23.uuid().optional(),subjectId:z23.uuid().optional(),authority:z23.enum(["BRIEF_SOURCE_AND_EXPLICIT_BINDING","EXPLICIT_SHOT_BINDING","CANONICAL_PROFILE_MASTER","ACCEPTED_KEYFRAME_AND_EXPLICIT_BINDING"])});var ResolvedConstraintSchema=z23.strictObject({continuity:ContinuityExpectationSchema.optional(),reviewScales:z23.array(ConsistencyReviewScaleSchema).min(1).max(3).optional(),key:z23.string().min(1).max(200),family:z23.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY"]),scope:z23.enum(["PROJECT","PRODUCTION","SCENE","SHOT","CONTINUITY_EDGE"]),subjectId:z23.uuid().optional(),dimension:z23.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).optional(),enforcement:z23.enum(["LOCKED","REQUIRED","PREFERRED"]),expected:z23.string().min(1).max(1e3),source:z23.strictObject({kind:z23.enum(["BRIEF","SCENE","SHOT","CONTINUITY_EDGE","CONSISTENCY_PROFILE"]),id:z23.uuid(),version:z23.int().positive()})});var PreparationBlockerSchema=z23.strictObject({code:z23.enum(["MISSING_PRODUCT_REFERENCE","CANONICAL_SOURCE_UNAVAILABLE","CONSTRAINT_CONFLICT","PREVIOUS_SHOT_EVIDENCE_UNAVAILABLE","GENERATED_KEYFRAME_REQUIRED"]),summary:z23.string().min(1).max(1e3),relatedShotId:ShotIdSchema.optional(),edgeId:ContinuityEdgeIdSchema.optional()});var ConstraintSetSchema=z23.strictObject({preparationId:PreparationIdSchema,version:z23.int().positive(),fingerprint:ContentFingerprintSchema,items:z23.array(ResolvedConstraintSchema).max(2048)});var ReferenceSetSchema=z23.strictObject({preparationId:PreparationIdSchema,version:z23.int().positive(),fingerprint:ContentFingerprintSchema,bindings:z23.array(ResolvedReferenceSchema).max(12)});var VideoGenerationIdSchema=z24.uuid().brand();var VideoProviderProfileSchema=z24.strictObject({id:z24.string().regex(/^[a-z][a-z0-9-]{1,79}$/),adapterVersion:z24.string().min(1).max(80),model:z24.string().min(1).max(160),executionClass:z24.enum(["LIVE","TEST_ONLY"]),mediaType:z24.literal("VIDEO"),modes:z24.array(z24.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"])).min(1).max(3),referenceRoles:z24.array(ReferenceRoleSchema).min(1).max(8),aspectRatios:z24.array(z24.enum(["16:9","9:16"])).min(1).max(2),minDurationSeconds:z24.int().min(1),maxDurationSeconds:z24.int().max(30),maxReferences:z24.int().min(1).max(10),combineAnchorsAndReferences:z24.boolean(),workingWidth:z24.int().positive().max(4096),workingHeight:z24.int().positive().max(4096),frameRate:z24.union([z24.literal(24),z24.literal(30)]),sourceFormat:z24.strictObject({videoCodec:z24.literal("hevc"),pixelFormat:z24.literal("yuv420p10le")}).optional(),hasAudio:z24.boolean(),nativeAudioChannels:z24.union([z24.literal(1),z24.literal(2)]).optional(),correlationStrategy:z24.literal("PROVIDER_TASK_ID")});var VideoOptionsInputSchema=z24.strictObject({tenantId:TenantIdSchema});var VideoStartInputSchema=z24.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,selection:ProviderSelectionSchema,idempotencyKey:z24.string().trim().min(1).max(200)});var VideoDeviceStartInputSchema=VideoStartInputSchema.omit({selection:true,expectedExecution:true}).extend({deviceId:z24.uuid(),approvedQuote:GenerationCostQuoteSchema});var VideoGetInputSchema=z24.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:VideoGenerationIdSchema});var VideoQueryInputSchema=z24.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoAdmissionSchema=z24.strictObject({semanticStatus:z24.literal("ACCEPTED"),generationId:VideoGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z24.enum(["LIVE","TEST_ONLY"])});var VideoTechnicalMetadataSchema=z24.strictObject({contentType:z24.literal("video/mp4"),checksumSha256:ContentFingerprintSchema,byteSize:z24.int().positive().max(128*1024*1024),width:z24.int().positive().max(4096),height:z24.int().positive().max(4096),durationMs:z24.int().min(1).max(30150),frameRate:z24.number().positive().max(120),videoCodec:z24.enum(["h264","hevc"]),pixelFormat:z24.literal("yuv420p10le").optional(),hasAudio:z24.boolean(),nativeAudio:NativeVideoAudioMetadataSchema.optional()});var VideoPosterSchema=z24.strictObject({representationId:ArtifactRepresentationIdSchema,contentType:z24.literal("image/png"),checksumSha256:ContentFingerprintSchema,byteSize:z24.int().positive().max(2*1024*1024),width:z24.int().positive().max(320),height:z24.int().positive().max(320)});var VideoCandidateSchema=VideoTechnicalMetadataSchema.extend({nativeSound:NativeVideoSoundReferenceSchema.optional(),id:z24.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,poster:VideoPosterSchema,availability:z24.enum(["AVAILABLE","INVALID"]),observation:z24.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z24.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z24.boolean(),reviewId:z24.uuid().optional(),reviewVersion:z24.int().positive().optional(),acceptanceDecisionId:z24.uuid().optional(),freshness:z24.enum(["CURRENT_BASIS","STALE_BASIS"])});var VideoGenerationViewSchema=z24.strictObject({generationId:VideoGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,connection:z24.strictObject({connectionId:z24.uuid(),connectionVersion:z24.int().positive(),modelProfileId:z24.string(),modelProfileVersion:z24.int().positive()}),operationId:OperationIdSchema,provider:VideoProviderProfileSchema,runtimeStatus:z24.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z24.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z24.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z24.boolean(),candidate:VideoCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z24.iso.datetime({offset:true})});var VideoQueryPageSchema=z24.strictObject({items:z24.array(VideoGenerationViewSchema),page:QueryPageInfoSchema});var VideoSummarySchema=z24.strictObject({generations:z24.int().nonnegative(),running:z24.int().nonnegative(),waiting:z24.int().nonnegative(),registeredCandidates:z24.int().nonnegative(),testCandidates:z24.int().nonnegative(),liveCandidates:z24.int().nonnegative()});var TimelineDurationSchema=z25.strictObject({totalMs:z25.int().positive().max(603e4),targetMs:z25.int().min(3e4).max(6e4),minMs:z25.literal(3e4),maxMs:z25.literal(6e4),deltaTargetMs:z25.int(),classification:z25.enum(["TOO_SHORT","WITHIN_TARGET","TOO_LONG"])});var TimelineClipSchema=z25.strictObject({ordinal:z25.int().positive().max(200),source:AcceptedShotReferenceSchema,technical:VideoTechnicalMetadataSchema,sourceInMs:z25.int().nonnegative(),sourceOutMs:z25.int().positive(),startMs:z25.int().nonnegative(),durationMs:z25.int().positive(),transition:ClipTransitionSchema,framing:ClipFramingSchema.optional()});var TimelineManifestSchema=z25.strictObject({schemaVersion:z25.literal(1),caption:CaptionVersionSchema.optional(),captionStyle:CaptionRenderStyleSchema.optional(),audio:TimelineAudioCompositionSchema.optional(),graphics:z25.array(TimelineGraphicSchema).max(8).optional(),basis:z25.strictObject({briefVersionId:BriefVersionIdSchema,briefVersion:z25.int().positive(),storyVersion:z25.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z25.int().positive()}),output:z25.strictObject({aspectRatio:z25.enum(["16:9","9:16"]),profile:DeliveryOutputProfileSchema}),clips:z25.array(TimelineClipSchema).min(1).max(200),duration:TimelineDurationSchema,missingPlannedShotIds:z25.array(ShotIdSchema).max(200),executionClass:z25.enum(["LIVE","TEST_ONLY"])});var TimelineVersionIdentityShape={id:z25.uuid(),timelineId:z25.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z25.int().positive(),fingerprint:z25.string().regex(/^[0-9a-f]{64}$/),createdByPrincipalId:PrincipalIdSchema,createdAt:z25.iso.datetime({offset:true})};function validateTimelineAttachments(timeline,context){if(timeline.audio?.tracks.some(t=>t.source.tenantId!==timeline.tenantId||t.source.projectId!==timeline.projectId||t.source.productionId!==timeline.productionId||t.startMs+t.sourceOutMs-t.sourceInMs>timeline.duration.totalMs||(t.startMs+t.sourceOutMs-t.sourceInMs)*48>Math.round(timeline.duration.totalMs*30/1e3)*1600))context.addIssue({code:"custom",message:"Timeline audio ownership or physical placement mismatch"});const caption=timeline.caption;if(timeline.captionStyle&&!caption)context.addIssue({code:"custom",message:"Timeline caption style requires an exact caption"});if(caption&&(caption.tenantId!==timeline.tenantId||caption.projectId!==timeline.projectId||caption.productionId!==timeline.productionId||caption.content.durationMs!==timeline.duration.totalMs))context.addIssue({code:"custom",message:"Timeline caption ownership or duration mismatch"})}var TimelineVersionSchema=TimelineManifestSchema.extend(TimelineVersionIdentityShape).superRefine(validateTimelineAttachments);import{z as z26}from"zod";var RoughCutProfileIdSchema=z26.enum(["PREVIEW_H264_480P_V1","PREVIEW_H264_720P_V1","PREVIEW_H264_1080P_V1"]);var RoughCutProfileSchema=z26.strictObject({captionPolicy:z26.literal("BURN_IN").optional(),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z26.literal("OVERLAY_V1").optional(),id:RoughCutProfileIdSchema,algorithm:z26.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z26.union([z26.literal(854),z26.literal(480),z26.literal(1280),z26.literal(720),z26.literal(1920),z26.literal(1080)]),height:z26.union([z26.literal(854),z26.literal(480),z26.literal(1280),z26.literal(720),z26.literal(1920),z26.literal(1080)]),frameRate:z26.literal(30),codec:z26.literal("h264"),pixelFormat:z26.literal("yuv420p"),fit:z26.literal("PAD"),hasAudio:z26.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z26.literal("CUMULATIVE_NEAREST_FRAME")}).superRefine((profile,context)=>{const pair=profile.id==="PREVIEW_H264_480P_V1"?[854,480]:profile.id==="PREVIEW_H264_720P_V1"?[1280,720]:[1920,1080];if(!(profile.width===pair[0]&&profile.height===pair[1]||profile.width===pair[1]&&profile.height===pair[0]))context.addIssue({code:"custom",message:"Exact preview profile geometry required"});if(profile.hasAudio!==!!profile.audioMix)context.addIssue({code:"custom",message:"Audio policy requires exact native mix"});if(!!profile.captionStyle!==!!profile.captionPolicy)context.addIssue({code:"custom",message:"Caption policy and style must agree"})});var RoughCutManifestSchema=z27.strictObject({schemaVersion:z27.literal(1),timeline:TimelineVersionSchema,profile:RoughCutProfileSchema,frames:z27.array(z27.strictObject({ordinal:z27.int().positive().max(200),startFrame:z27.int().nonnegative().max(1800),frameCount:z27.int().positive().max(1800),overlapFrames:z27.int().nonnegative().max(30).default(0)})).min(1).max(200),totalFrames:z27.int().min(900).max(1800)});import{z as z53}from"zod";import{z as z51}from"zod";import{z as z49}from"zod";import{z as z28}from"zod";var Fingerprint2=z28.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticAcceptedVisualSourceReferenceSchema=z28.strictObject({sourceKind:z28.literal("PROGRAMMATIC"),acceptanceId:z28.uuid(),reviewId:z28.uuid(),renderId:z28.uuid(),compositionId:z28.uuid(),compositionVersionId:z28.uuid(),compositionVersion:z28.int().positive(),compositionFingerprint:Fingerprint2,renderManifestFingerprint:Fingerprint2,shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,artifactChecksumSha256:Fingerprint2,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z28.int().positive(),shotPlanningRevision:z28.int().positive(),executionClass:z28.enum(["LIVE","TEST_ONLY"]),reviewResult:z28.enum(["PASS","WARNING"])});var ImportedAcceptedVisualSourceReferenceSchema=z28.strictObject({sourceKind:z28.literal("IMPORTED"),acceptanceId:z28.uuid(),reviewId:z28.uuid(),normalizationId:z28.uuid(),sourceId:z28.uuid(),sourceVersionId:z28.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,executionClass:z28.enum(["LIVE","TEST_ONLY"]),reviewResult:z28.enum(["PASS","WARNING"])});var AcceptedVisualSourceReferenceSchema=z28.union([AcceptedShotReferenceSchema,ProgrammaticAcceptedVisualSourceReferenceSchema,ImportedAcceptedVisualSourceReferenceSchema]);import{z as z48}from"zod";import{z as z30}from"zod";import{z as z29}from"zod";var id4=z29.uuid().toLowerCase();var hash3=z29.string().regex(/^[0-9a-f]{64}$/);var ImportedSynchronousAudioPurposeSchema=z29.literal("SOURCE_SYNC");var SourceSyncPcmMediaSchema=z29.strictObject({profile:z29.literal("PCM_S16LE_48000_SOURCE_SYNC_V1"),audioCodec:z29.literal("pcm_s16le"),sampleRateHz:z29.literal(48e3),audioChannels:z29.union([z29.literal(1),z29.literal(2)]),sampleCount:z29.int().min(1600).max(576e3),durationMs:z29.number().positive().max(12e3)}).refine(m=>m.sampleCount%1600===0&&m.durationMs===m.sampleCount/48);var ImportedSynchronousAudioExtractionSchema=z29.strictObject({schemaVersion:z29.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id4,projectId:id4,productionId:id4,shotId:id4,sourceId:id4,sourceVersionId:id4,normalizationId:id4,originalArtifactId:id4,originalRepresentationId:id4,originalChecksumSha256:hash3,sourceRange:z29.strictObject({clock:z29.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z29.int().nonnegative().max(1799),endFrame:z29.int().positive().max(1800)}),destinationStartSample:z29.literal(0)}).refine(v=>v.sourceRange.endFrame>v.sourceRange.startFrame&&v.sourceRange.endFrame-v.sourceRange.startFrame<=360);var ImportedSynchronousAudioSourceSchema=z29.strictObject({schemaVersion:z29.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id4,projectId:id4,productionId:id4,shotId:id4,sourceId:id4,sourceVersionId:id4,normalizationId:id4,originalArtifactId:id4,originalRepresentationId:id4,originalChecksumSha256:hash3,sourceRange:z29.strictObject({clock:z29.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z29.int().nonnegative(),endFrame:z29.int().positive()}),destinationStartSample:z29.int().nonnegative(),media:z29.union([AudioMediaSchema,SourceSyncPcmMediaSchema]),wavChecksumSha256:hash3,wavByteSize:z29.int().min(44).max(12582912)}).superRefine((v,ctx)=>{if(v.sourceRange.endFrame<=v.sourceRange.startFrame||(v.sourceRange.endFrame-v.sourceRange.startFrame)*1600!==v.media.sampleCount)ctx.addIssue({code:"custom",message:"Exact CFR30 interval and PCM48k sample mapping required"})});var id5=z30.uuid().toLowerCase();var key2=z30.string().trim().min(1).max(200);var SourceSyncAudioStartSchema=z30.strictObject({tenantId:id5,productionId:id5,normalizationId:id5,expectedProductionRevision:z30.int().positive(),expectedVersion:z30.int().nonnegative(),idempotencyKey:key2});var SourceSyncAudioGetSchema=z30.strictObject({tenantId:id5,productionId:id5,shotId:id5,versionId:id5});var SourceSyncAudioVersionSchema=z30.strictObject({schemaVersion:z30.literal(1),purpose:z30.literal("SOURCE_SYNC"),id:id5,audioId:id5,version:z30.int().positive(),tenantId:id5,projectId:id5,productionId:id5,shotId:id5,normalizationId:id5,artifactId:id5,representationId:id5,provenance:ImportedSynchronousAudioSourceSchema,previousVersionId:id5.nullable(),executionClass:z30.enum(["LIVE","TEST_ONLY"]),createdByPrincipalId:id5,createdAt:z30.iso.datetime({offset:true})});var SourceSyncAudioReceiptSchema=z30.strictObject({semanticStatus:z30.literal("SUCCESS"),version:SourceSyncAudioVersionSchema,productionRevision:z30.int().positive()});var SourceSyncAudioViewSchema=z30.strictObject({version:SourceSyncAudioVersionSchema,status:z30.enum(["CURRENT","STALE"]),availability:z30.enum(["AVAILABLE","UNAVAILABLE"])});import{z as z31}from"zod";var SourceSoundTreatmentSchema=z31.strictObject({policy:z31.enum(["KEEP","MUTE","DUCK"]),gainPermille:z31.int().min(0).max(1e3),duckingPermille:z31.int().min(0).max(1e3)}).superRefine((v,c)=>{if(v.policy==="MUTE"&&v.gainPermille!==0||v.policy!=="DUCK"&&v.duckingPermille!==1e3)c.addIssue({code:"custom",message:"Mute requires zero gain; ducking requires explicit DUCK"})});import{z as z34}from"zod";import{z as z32}from"zod";var SpeechParameterValueSchema=z32.union([z32.string().max(4096),z32.number().finite(),z32.boolean(),z32.array(z32.string().max(4096)).max(100),z32.record(z32.string().min(1).max(100),z32.string().max(4096)).refine(v=>Object.keys(v).length<=100)]);var SpeechParameterRuleSchema=z32.strictObject({label:z32.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),type:z32.enum(["NUMBER","INTEGER","STRING","BOOLEAN","STRING_ARRAY","STRING_MAP"]),required:z32.boolean().default(false),min:z32.number().optional(),max:z32.number().optional(),maxLength:z32.int().positive().max(4096).optional(),options:z32.array(z32.string().min(1).max(100)).max(100).optional(),default:SpeechParameterValueSchema.optional(),unit:z32.string().max(40).optional(),description:z32.string().max(500).optional(),maxItems:z32.int().positive().max(100).optional(),maxKeyLength:z32.int().positive().max(100).optional()});var SpeechParametersSchema=z32.record(z32.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterValueSchema).refine(p=>Object.keys(p).length<=24);var SpeechVoiceSchema=z32.strictObject({id:z32.string().min(1).max(100),label:z32.string().min(1).max(100),languages:z32.array(z32.string().min(2).max(20)).min(1).max(32).optional(),parameterDefaults:SpeechParametersSchema.optional(),parameterOptions:z32.record(z32.string(),z32.array(z32.string().min(1).max(100)).min(1).max(100)).optional(),unsupportedParameters:z32.array(z32.string()).max(24).optional()});import{z as z33}from"zod";var cpuSpeechResources={schemaVersion:1,wrapper:{name:"sherpa-onnx-node",url:"https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.12.33.tgz",byteSize:10289,sha256:"c56a08c884dcd3ec4b4d815edea4aabbff62fbcd1b0176e88480b5d9b920fa03"},engines:[{platform:"linux-x64",package:"sherpa-onnx-linux-x64",url:"https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.12.33.tgz",byteSize:10137208,sha256:"651f529869249628c3e304744ab21d658f880be3684e8ead93702f2055bfb5d1",engineDigest:"dbc8c7bcdcd9dc24183894eabb945001ae001fe69cd16c427f01cf41e598c33a",fileCount:25,unpackedBytes:30623890},{platform:"linux-arm64",package:"sherpa-onnx-linux-arm64",url:"https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.12.33.tgz",byteSize:12826691,sha256:"fec1be880a3e6a79e30db4075690759218a28923fafda51983649bcae3efdfbf",engineDigest:"447387941363150362e034f0e8bceb11922b95f11d8553882b7386ad24f1e92f",fileCount:25,unpackedBytes:37679333},{platform:"darwin-x64",package:"sherpa-onnx-darwin-x64",url:"https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.12.33.tgz",byteSize:25289549,sha256:"137082336fa9bf721385c85828b29766dd0d8e0ce67dcc8691d9a5daa7171ce9",engineDigest:"a298b1bd79b690a7cc26eed975980ff69262967627340525a9ef66a8ca45b091",fileCount:26,unpackedBytes:85413811},{platform:"darwin-arm64",package:"sherpa-onnx-darwin-arm64",url:"https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.12.33.tgz",byteSize:22164444,sha256:"c5d96d89deadb042f603a83dd0b93b9f147ca635ae3316e83718cd5566c0b61a",engineDigest:"f409d0ef9b864983c784b27369b40a20a988347ecfdbc27a34ea8a8533ccb589",fileCount:26,unpackedBytes:75969095}],model:{url:"https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-int8-multi-lang-v1_1.tar.bz2",byteSize:147052523,sha256:"259c9c8bc906d6078e4e0570421885dabb68b539c2f970fcbb890a58eeaf3e9c",directory:"kokoro-int8-multi-lang-v1_1",treeDigest:"ebd0959580940e20dbb10a55775ec94e47229c7c503f65932403fe0764667126",fileCount:377,unpackedBytes:215227172}};var kokoroCpuProfile=Object.freeze({id:"KOKORO_INT8_ZH_EN_V1",adapter:"KOKORO_ONNX_CPU_V1",engineVersion:"1.12.33",engineDigest:"f409d0ef9b864983c784b27369b40a20a988347ecfdbc27a34ea8a8533ccb589",modelDigest:"ebd0959580940e20dbb10a55775ec94e47229c7c503f65932403fe0764667126",modelArchiveSha256:"259c9c8bc906d6078e4e0570421885dabb68b539c2f970fcbb890a58eeaf3e9c",sampleRateHz:24e3,speakerCount:103,maxCharacters:600,maxDurationMs:6e4});var CpuSpeechToolSelectionSchema=z33.strictObject({engineDirectory:z33.string().min(1).max(4096),modelDirectory:z33.string().min(1).max(4096)});var CpuSpeechInputSchema=z33.strictObject({text:z33.string().min(1).max(kokoroCpuProfile.maxCharacters).refine(s=>s.trim().length>0&&!new RegExp("\\p{Cc}","u").test(s.replace(/[\t\n]/g,""))&&new TextEncoder().encode(s).length<=2400),voiceId:z33.int().min(0).max(kokoroCpuProfile.speakerCount-1),language:z33.enum(["zh","en"]),speed:z33.number().min(.5).max(2).default(1)});var SpeechDeliverySchema=z33.discriminatedUnion("mode",[z33.strictObject({mode:z33.literal("NON_STREAMING"),output:z33.literal("COMPLETE_AUDIO")}),z33.strictObject({mode:z33.literal("SENTENCE_CHUNKED"),output:z33.literal("ORDERED_SENTENCES")}),z33.strictObject({mode:z33.literal("TRUE_STREAMING"),output:z33.literal("CONTINUOUS_AUDIO")})]);var CpuSpeechIdentitySchema=z33.strictObject({profileId:z33.literal(kokoroCpuProfile.id),adapter:z33.literal(kokoroCpuProfile.adapter),platform:z33.strictObject({os:z33.enum(["darwin","linux"]),architecture:z33.enum(["arm64","x64"])}),engineVersion:z33.literal(kokoroCpuProfile.engineVersion),engineDigest:LocalDigestSchema,modelDigest:z33.literal(kokoroCpuProfile.modelDigest),bridgeSha256:LocalDigestSchema,nodeSha256:LocalDigestSchema}).refine(v=>cpuSpeechResources.engines.some(e=>e.platform===v.platform.os+"-"+v.platform.architecture&&e.engineDigest===v.engineDigest));var CpuSpeechObservationSchema=z33.strictObject({inputSha256:LocalDigestSchema,voiceId:CpuSpeechInputSchema.shape.voiceId,language:CpuSpeechInputSchema.shape.language,outputSha256:LocalDigestSchema,outputBytes:z33.int().min(4844).max(2880044),sampleRateHz:z33.literal(kokoroCpuProfile.sampleRateHz),sampleCount:z33.int().min(2400).max(144e4),durationMs:z33.number().min(100).max(kokoroCpuProfile.maxDurationMs),modelLoadMs:z33.number().nonnegative(),synthesisMs:z33.number().nonnegative(),outputReadyMs:z33.number().positive(),realTimeFactor:z33.number().nonnegative(),cpuMs:z33.number().nonnegative(),peakRssBytes:z33.int().positive()});var CpuSpeechQualificationSchema=z33.strictObject({identity:CpuSpeechIdentitySchema,delivery:z33.strictObject({mode:z33.literal("NON_STREAMING"),output:z33.literal("COMPLETE_AUDIO")}),cancellation:z33.literal("OWNED_PROCESS"),technicalStatus:z33.literal("TECHNICALLY_OBSERVED"),listeningStatus:z33.literal("NOT_PROVEN"),observations:z33.array(CpuSpeechObservationSchema).min(3).max(24),observedAt:z33.iso.datetime({offset:true})});var CpuSpeechCapabilitySchema=z33.strictObject({identity:CpuSpeechIdentitySchema,voices:z33.array(z33.strictObject({voiceId:CpuSpeechInputSchema.shape.voiceId,languages:z33.array(CpuSpeechInputSchema.shape.language).min(1).max(2).refine(v=>new Set(v).size===v.length)})).min(1).max(8).refine(v=>new Set(v.map(s=>s.voiceId)).size===v.length)});var CpuSpeechInstallationSchema=CpuSpeechToolSelectionSchema.extend({voiceIds:z33.array(CpuSpeechInputSchema.shape.voiceId).min(1).max(8).refine(v=>new Set(v).size===v.length)});var NativeSpeechExecutionSchema=z34.strictObject({schemaVersion:z34.literal(1),profileId:z34.literal(kokoroCpuProfile.id),modelDigest:z34.literal(kokoroCpuProfile.modelDigest)});var speed=SpeechParameterRuleSchema.safeExtend({type:z34.literal("NUMBER"),min:z34.number().min(.5).max(2),max:z34.number().min(.5).max(2),default:z34.number().min(.5).max(2).default(1)}).refine(r=>r.min<=r.max&&r.default>=r.min&&r.default<=r.max);var voice=SpeechVoiceSchema.safeExtend({id:z34.string().regex(/^(?:[0-9]|[1-9][0-9]|10[0-2])$/),languages:z34.array(z34.enum(["zh","en"])).min(1).max(2).optional()});var NativeSpeechModelProfileSchema=z34.strictObject({id:ModelProfileIdSchema,version:z34.int().positive(),label:z34.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),protocol:z34.literal(kokoroCpuProfile.adapter),execution:NativeSpeechExecutionSchema,textMaxCharacters:z34.int().min(1).max(kokoroCpuProfile.maxCharacters),languages:z34.array(z34.enum(["zh","en"])).min(1).max(2).refine(v=>new Set(v).size===v.length),voices:z34.array(voice).min(1).max(kokoroCpuProfile.speakerCount).refine(v=>new Set(v.map(voice2=>voice2.id)).size===v.length),parameters:z34.strictObject({speed}),sourceUrl:z34.literal("https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/kokoro.html"),output:z34.literal("PCM_S16LE_48000_V1"),normalizationVersion:z34.literal("SPEECH_PCM_V1")});import{z as z47}from"zod";import{z as z38}from"zod";import{z as z36}from"zod";import{z as z35}from"zod";var receiptId=z35.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/);var resultHost="dashscope-result-bj.oss-cn-beijing.aliyuncs.com";var maxQwenTtsAudioBytes=12*1024*1024;var QwenTtsReceiptSchema=z35.strictObject({providerRequestId:receiptId,audioId:receiptId,audioUrl:z35.url().max(8192).meta({writeOnly:true}),expiresAt:z35.iso.datetime(),usage:z35.strictObject({characters:z35.int().min(0).max(6e3)}).optional()}).refine(({audioUrl,expiresAt})=>{try{const url=new URL(audioUrl);const expires=url.searchParams.getAll("Expires");return url.href===audioUrl&&url.protocol==="https:"&&url.hostname===resultHost&&!url.username&&!url.password&&!url.port&&!url.hash&&url.pathname.endsWith(".wav")&&(expires.length===0||expires.length===1&&/^\d{1,12}$/.test(expires[0])&&Number(expires[0])*1e3===Date.parse(expiresAt))}catch{return false}},"Invalid Qwen TTS audio receipt");var QwenSpeechProviderStateSchema=z35.discriminatedUnion("state",[z35.strictObject({state:z35.literal("RECEIVED"),receipt:QwenTtsReceiptSchema}),z35.strictObject({state:z35.literal("UNKNOWN")}),z35.strictObject({state:z35.literal("REJECTED")})]);var MacSpeechIdentitySchema=z36.strictObject({adapter:z36.literal("MACOS_SAY_V1"),voiceId:z36.literal("com.apple.speech.synthesis.voice.Albert"),locale:z36.literal("en-US"),systemBuild:z36.string().regex(/^[A-Za-z0-9]{1,40}$/),saySha256:LocalDigestSchema,sandboxSha256:LocalDigestSchema,synthesizerSha256:LocalDigestSchema,voiceCatalogSha256:LocalDigestSchema,voiceProbeSha256:LocalDigestSchema});var MacSpeechInputSchema=z36.strictObject({text:z36.string().min(1).max(2e3).refine(text2=>text2.trim().length>0&&!text2.includes("[[")&&!new RegExp("\\p{Cc}","u").test(text2)&&new TextEncoder().encode(text2).length<=4096),rateWordsPerMinute:z36.int().min(80).max(240)});var SpeechSynthesisRecipeSchema=MacSpeechInputSchema.extend({processor:z36.literal("SPEECH_SYNTHESIZE"),identity:MacSpeechIdentitySchema});var audioObject=z36.strictObject({checksumSha256:LocalDigestSchema,byteSize:z36.int().min(44).max(12*1024*1024)});var SpeechSynthesisEvidenceSchema=z36.strictObject({processor:z36.literal("SPEECH_SYNTHESIZE"),source:audioObject,normalized:audioObject,sourceMedia:z36.strictObject({sampleRateHz:z36.literal(22050),audioChannels:z36.literal(1),sampleCount:z36.int().min(2205).max(1323e3)}),media:AudioMediaSchema.refine(value2=>value2.audioChannels===1),padSamples:z36.int().min(0).max(47)});var QwenSpeechRecipeSchema=z36.strictObject({processor:z36.literal("SPEECH_EXTERNAL_QWEN"),generationId:LocalIdSchema,quoteFingerprint:LocalDigestSchema});var QwenSpeechEvidenceSchema=SpeechSynthesisEvidenceSchema.extend({processor:z36.literal("SPEECH_EXTERNAL_QWEN"),providerRequestId:QwenTtsReceiptSchema.shape.providerRequestId,audioId:QwenTtsReceiptSchema.shape.audioId,sourceMedia:z36.strictObject({sampleRateHz:z36.literal([8e3,12e3,16e3,22050,24e3,32e3,44100,48e3]),audioChannels:z36.union([z36.literal(1),z36.literal(2)]),sampleCount:z36.int().min(800).max(288e4)}).refine(({sampleRateHz,sampleCount})=>sampleCount>=sampleRateHz/10&&sampleCount<=sampleRateHz*60)});import{z as z37}from"zod";var NativeSpeechOptionsSchema=z37.strictObject({schemaVersion:z37.literal(1),models:z37.array(z37.strictObject({modelProfileId:ModelProfileIdSchema,modelProfileVersion:z37.int().positive(),label:z37.string().min(1).max(100),profileId:z37.literal(kokoroCpuProfile.id),textMaxCharacters:z37.int().min(1).max(kokoroCpuProfile.maxCharacters)})).max(20),devices:z37.array(z37.strictObject({deviceId:z37.uuid(),label:z37.string().min(1).max(120),profileId:z37.literal(kokoroCpuProfile.id),voices:CpuSpeechCapabilitySchema.shape.voices})).max(50),possiblyTruncated:z37.boolean()});var SpeechModelProfileSchema=z38.strictObject({id:ModelProfileIdSchema,version:z38.int().positive(),providerId:ProviderIdSchema,modelId:z38.string().min(1).max(160).nullable(),protocol:z38.enum(["QWEN_TTS","QWEN_AUDIO_TTS","OPENAI_TTS","XAI_TTS","GEMINI_INTERACTIONS_TTS","VOLCENGINE_TTS"]),label:z38.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),textMaxCharacters:z38.int().positive().max(6e3),requestTimeoutMs:z38.int().positive().max(3e5),workspaceRequired:z38.boolean(),voices:z38.array(SpeechVoiceSchema).min(1).max(100),languages:z38.array(z38.string().min(2).max(20)).min(1).max(32),parameters:z38.record(z38.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterRuleSchema),sourceUrl:z38.url().max(2048),verifiedAt:z38.iso.date(),providerTextMaxCharacters:z38.int().positive().nullable(),resourceId:z38.string().min(1).max(100).nullable(),output:z38.literal("PCM_S16LE_48000_V1"),normalizationVersion:z38.literal("SPEECH_PCM_V1")});var SpeechScopeSchema=z38.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var SpeechExecutionBindingSchema=z38.strictObject({tenantId:TenantIdSchema,connectionId:z38.uuid(),connectionVersion:z38.int().positive(),credentialRef:z38.uuid(),credentialVersion:z38.int().positive(),profile:SpeechModelProfileSchema,executionClass:z38.enum(["LIVE","TEST_ONLY"])});var SpeechStartSchema=SpeechScopeSchema.extend({voiceProfile:VoiceProfileUseSchema.optional(),soundCue:z38.strictObject({soundPlanVersionId:z38.uuid(),cueId:z38.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}).optional(),expectedProductionRevision:z38.int().positive(),expectedAudioVersion:z38.int().nonnegative(),expectedModelProfileVersion:z38.int().positive(),idempotencyKey:z38.string().trim().min(1).max(200),selection:ProviderSelectionSchema,text:z38.string().min(1).max(6e3).refine(s=>s.trim().length>0&&!s.includes("\0")),voice:z38.string().min(1).max(100),parameters:SpeechParametersSchema.default({})});var SpeechGetSchema=SpeechScopeSchema.extend({generationId:z38.uuid()});var SpeechAdmissionSchema=z38.strictObject({humanLinks:HumanLinksSchema.optional(),semanticStatus:z38.literal("ACCEPTED"),generationId:z38.uuid(),runtimeJobId:z38.uuid(),productionRevision:z38.int().positive(),executionClass:z38.enum(["LIVE","TEST_ONLY"])});var SpeechGenerationViewSchema=SpeechAdmissionSchema.omit({semanticStatus:true}).extend({tenantId:TenantIdSchema,productionId:ProductionIdSchema,soundCue:SpeechStartSchema.shape.soundCue,voiceProfile:VoiceProfileUseSchema.optional(),text:z38.string().min(1).max(6e3),voice:z38.string().min(1).max(100),parameters:SpeechParametersSchema,profile:SpeechModelProfileSchema,connectionId:z38.uuid(),connectionVersion:z38.int().positive(),runtimeStatus:z38.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z38.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z38.boolean(),result:AudioReceiptSchema.nullable(),createdAt:z38.iso.datetime({offset:true})});var localSpeechBody=z38.strictObject({expectedProductionRevision:SpeechStartSchema.shape.expectedProductionRevision,expectedAudioVersion:SpeechStartSchema.shape.expectedAudioVersion,idempotencyKey:SpeechStartSchema.shape.idempotencyKey,text:SpeechStartSchema.shape.text,rateWordsPerMinute:MacSpeechInputSchema.shape.rateWordsPerMinute.optional(),voiceProfile:VoiceProfileUseSchema.optional(),soundCue:SpeechStartSchema.shape.soundCue,deviceExecution:z38.strictObject({deviceId:z38.uuid().optional()})});function refineLocalSpeech(v,ctx){const valid=v.voiceProfile?v.rateWordsPerMinute===void 0&&CpuSpeechInputSchema.shape.text.safeParse(v.text).success&&(v.voiceProfile.usage!=="AUDITION"||!v.soundCue):false;const systemValid=!v.voiceProfile&&!v.soundCue&&MacSpeechInputSchema.safeParse({text:v.text,rateWordsPerMinute:v.rateWordsPerMinute}).success;if(!(v.voiceProfile?valid:systemValid))ctx.addIssue({code:"custom",message:"Exact saved CPU voice or anonymous system voice required"})}var LocalSpeechBodySchema=localSpeechBody.superRefine(refineLocalSpeech);var LocalSpeechStartSchema=SpeechScopeSchema.extend(localSpeechBody.shape).superRefine(refineLocalSpeech);var NativeSpeechBindingSchema=z38.strictObject({profile:NativeSpeechModelProfileSchema,voice:z38.string().min(1).max(100),parameters:SpeechParametersSchema});var NativeSpeechBasisSchema=z38.strictObject({schemaVersion:z38.literal(1),modelProfileId:ModelProfileIdSchema,modelProfileVersion:z38.int().positive(),label:z38.string().min(1).max(100),voice:z38.string().min(1).max(100),parameters:SpeechParametersSchema,execution:NativeSpeechExecutionSchema});var LocalSpeechBindingSchema=z38.strictObject({target:z38.literal("TENANT_DEVICE"),tenantId:TenantIdSchema,deviceId:z38.uuid(),identity:z38.union([MacSpeechIdentitySchema,CpuSpeechIdentitySchema]),native:NativeSpeechBindingSchema.optional(),executionClass:z38.literal("LIVE")}).refine(v=>v.identity.adapter==="KOKORO_ONNX_CPU_V1"===!!v.native);var localSpeechExecution=z38.strictObject({target:z38.literal("TENANT_DEVICE"),deviceId:z38.uuid(),identity:LocalSpeechBindingSchema.shape.identity});var LocalSpeechAdmissionSchema=SpeechAdmissionSchema.extend({executionClass:z38.literal("LIVE"),deviceExecution:localSpeechExecution});var LocalSpeechGenerationViewSchema=SpeechGenerationViewSchema.omit({voiceProfile:true,soundCue:true,parameters:true,profile:true,voice:true,connectionId:true,connectionVersion:true,providerStatus:true}).extend({executionClass:z38.literal("LIVE"),deviceExecution:localSpeechExecution,rateWordsPerMinute:MacSpeechInputSchema.shape.rateWordsPerMinute.optional(),voiceProfile:VoiceProfileUseSchema.optional(),soundCue:SpeechStartSchema.shape.soundCue,nativeBasis:NativeSpeechBasisSchema.optional()});var SpeechOptionsSchema=SpeechScopeSchema.extend({native:NativeSpeechOptionsSchema.optional(),options:z38.array(z38.strictObject({selection:ProviderSelectionSchema,profile:SpeechModelProfileSchema,connectionLabel:z38.string().min(1).max(100),connectionVersion:z38.int().positive(),executionTarget:z38.literal("TENANT_DEVICE").optional()})).max(100),possiblyTruncated:z38.boolean()});import{z as z46}from"zod";import{z as z43}from"zod";import{z as z39}from"zod";var KeyframeGenerationIdSchema=z39.uuid().brand();var KeyframeProviderProfileSchema=z39.strictObject({id:z39.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,79}$/),adapterVersion:z39.string().min(1).max(80),model:z39.string().min(1).max(120),executionClass:z39.enum(["LIVE","TEST_ONLY"]),mediaType:z39.literal("IMAGE"),mode:z39.literal("REFERENCE_TO_IMAGE"),referenceRoles:z39.array(ReferenceRoleSchema).min(1).max(6),aspectRatios:z39.array(z39.enum(["16:9","9:16"])).min(1).max(2),maxReferences:z39.int().min(1).max(12),correlationLookup:z39.boolean()});var KeyframeStartInputSchema=z39.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),selection:ProviderSelectionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,idempotencyKey:z39.string().trim().min(1).max(200)});var KeyframeDeviceStartInputSchema=KeyframeStartInputSchema.omit({selection:true,expectedExecution:true}).extend({deviceId:z39.uuid(),approvedQuote:GenerationCostQuoteSchema});var KeyframeGetInputSchema=z39.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:KeyframeGenerationIdSchema});var KeyframeQueryInputSchema=z39.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeAdmissionSchema=z39.strictObject({semanticStatus:z39.literal("ACCEPTED"),generationId:KeyframeGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z39.enum(["LIVE","TEST_ONLY"])});var KeyframeCandidateSchema=z39.strictObject({id:z39.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z39.enum(["AVAILABLE","INVALID"]),observation:z39.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z39.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z39.boolean(),reviewId:z39.uuid().optional(),reviewVersion:z39.int().positive().optional(),acceptanceDecisionId:z39.uuid().optional(),freshness:z39.enum(["CURRENT_BASIS","STALE_BASIS"]),checksumSha256:ContentFingerprintSchema,contentType:z39.enum(["image/png","image/jpeg","image/webp"]),byteSize:z39.int().positive(),width:z39.int().positive(),height:z39.int().positive()});var KeyframeGenerationViewSchema=z39.strictObject({connection:z39.strictObject({connectionId:z39.uuid(),connectionVersion:z39.int().positive(),modelProfileId:z39.string(),modelProfileVersion:z39.int().positive()}).optional(),generationId:KeyframeGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,operationId:OperationIdSchema,provider:KeyframeProviderProfileSchema,runtimeStatus:z39.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z39.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z39.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z39.boolean(),candidate:KeyframeCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z39.iso.datetime({offset:true})});var KeyframeQueryPageSchema=z39.strictObject({items:z39.array(KeyframeGenerationViewSchema),page:QueryPageInfoSchema});var KeyframeMediaSchema=z39.strictObject({contentType:z39.enum(["image/png","image/jpeg","image/webp"]),checksumSha256:ContentFingerprintSchema,byteSize:z39.int().positive().max(8*1024*1024),contentBase64:z39.string().min(4).max(4*Math.ceil(8*1024*1024/3))});var KeyframeSummarySchema=z39.strictObject({generations:z39.int().nonnegative(),running:z39.int().nonnegative(),waiting:z39.int().nonnegative(),registeredCandidates:z39.int().nonnegative(),testCandidates:z39.int().nonnegative(),liveCandidates:z39.int().nonnegative()});import{z as z42}from"zod";import{z as z41}from"zod";import{z as z40}from"zod";var MatrixParameterRuleSchema=SpeechParameterRuleSchema.extend({numberOptions:z40.array(z40.number().finite()).min(1).max(32).optional()}).superRefine((r,ctx)=>{const numeric=r.type==="NUMBER"||r.type==="INTEGER";const stringValid=v=>typeof v==="string"&&v.length<=(r.maxLength??4096)&&(!r.options||r.options.includes(v));const valid=v=>numeric?typeof v==="number"&&Number.isFinite(v)&&(r.type!=="INTEGER"||Number.isInteger(v))&&(r.min===void 0||v>=r.min)&&(r.max===void 0||v<=r.max)&&(!r.numberOptions||r.numberOptions.includes(v)):r.type==="BOOLEAN"?typeof v==="boolean":r.type==="STRING"?stringValid(v):r.type==="STRING_ARRAY"?Array.isArray(v)&&v.length<=(r.maxItems??100)&&v.every(stringValid):!!v&&typeof v==="object"&&!Array.isArray(v)&&Object.keys(v).length<=(r.maxItems??100)&&Object.entries(v).every(([k,item])=>k.length>0&&k.length<=(r.maxKeyLength??100)&&stringValid(item));if(r.min!==void 0&&r.max!==void 0&&r.min>r.max||r.numberOptions&&(!numeric||new Set(r.numberOptions).size!==r.numberOptions.length||r.numberOptions.some(v=>!valid(v)))||r.default!==void 0&&!valid(r.default))ctx.addIssue({code:"custom",message:"Typed parameter range, choices and default must agree"})});var AsrProfileSchema=z41.strictObject({id:ModelProfileIdSchema,version:z41.int().positive(),providerId:ProviderIdSchema,sourceUrl:z41.url().max(2048),verifiedAt:z41.iso.date(),modelId:z41.string().min(1).max(160),label:z41.string().min(1).max(100),protocol:z41.enum(["OPENAI_TRANSCRIPTION_V1","OPENAI_WHISPER_TRANSCRIPTION_V1","QWEN_ASR_V1"]),modes:z41.tuple([z41.literal("TRANSCRIPTION")]),inputKinds:z41.array(z41.enum(["AUDIO","VIDEO"])).min(1).max(2),requestTimeoutMs:z41.int().min(1e3).max(18e4),maxBytes:z41.int().positive().max(12582912),maxDurationMs:z41.int().positive().max(6e4),parameters:z41.record(z41.string().regex(/^[a-z][a-z0-9_]{0,49}$/),MatrixParameterRuleSchema)}).superRefine((p,c)=>{const openai=p.providerId==="OPENAI";const whisper=p.protocol==="OPENAI_WHISPER_TRANSCRIPTION_V1";const fields=openai?whisper?{prompt:"STRING",language:"STRING",temperature:"NUMBER",timestamp_granularities:"STRING_ARRAY"}:{prompt:"STRING",languages:"STRING_ARRAY",keywords:"STRING_ARRAY"}:{context:"STRING",language:"STRING",enable_itn:"BOOLEAN"};if(p.providerId!==(p.protocol==="QWEN_ASR_V1"?"QWEN_CN":"OPENAI")||new Set(p.inputKinds).size!==p.inputKinds.length||!openai&&(p.maxBytes>7340032||p.inputKinds.includes("VIDEO"))||Object.entries(p.parameters).some(([key4,rule])=>fields[key4]!==rule.type))c.addIssue({code:"custom",message:"ASR protocol capability mismatch"});if(whisper){const rule=p.parameters.timestamp_granularities;if(!rule?.required||!rule.options?.length||rule.options.some(v=>!["word","segment"].includes(v)))c.addIssue({code:"custom",message:"Timed ASR requires explicit supported granularities"});const temperature=p.parameters.temperature;if(temperature&&(temperature.min===void 0||temperature.min<0||temperature.max===void 0||temperature.max>1))c.addIssue({code:"custom",message:"Whisper temperature must stay within 0\u20131"})}});var TranscriptText={schemaVersion:z41.literal(1),text:z41.string().max(6e4),languages:z41.array(z41.string().min(2).max(40)).max(32)};var TimedText=z41.strictObject({text:z41.string().min(1).max(2500),startMs:z41.int().nonnegative().max(6e4),endMs:z41.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Transcript interval must advance");var TranscriptSchema=z41.discriminatedUnion("timing",[z41.strictObject({...TranscriptText,timing:z41.literal("UNAVAILABLE")}),z41.strictObject({...TranscriptText,timing:z41.literal("PROVIDER_REPORTED"),timeBase:z41.literal("ORIGINAL_MEDIA_MS"),granularities:z41.array(z41.enum(["word","segment"])).min(1).max(2),words:z41.array(TimedText).max(1200),segments:z41.array(TimedText).max(240)}).superRefine((v,c)=>{if(new Set(v.granularities).size!==v.granularities.length)c.addIssue({code:"custom",message:"Duplicate timing granularity"});for(const[kind,items]of[["word",v.words],["segment",v.segments]]){if(!v.granularities.includes(kind)&&items.length>0||v.granularities.includes(kind)&&v.text.trim()&&!items.length||items.some((item,i)=>i>0&&item.startMs<items[i-1].endMs))c.addIssue({code:"custom",message:"Missing, unordered or overlapping Provider timing"})}})]);var ObservationModeSchema=z42.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES","TRANSCRIPTION"]);var ObservationParametersSchema=SpeechParametersSchema;var VisualObservationProfileSchema=z42.strictObject({id:ModelProfileIdSchema,version:z42.int().positive(),providerId:ProviderIdSchema,sourceUrl:z42.url().max(2048),modelId:z42.string().min(1).max(160),label:z42.string().min(1).max(100),protocol:z42.enum(["GEMINI_INTERACTIONS_V1","QIANWEN_VIDEO_V1"]),modes:z42.array(z42.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES"])).min(1).max(4),requestTimeoutMs:z42.int().min(1e3).max(18e4),maxBytes:z42.int().positive().max(12582912),maxDurationMs:z42.int().positive().max(6e4),parameters:z42.record(z42.string(),z42.strictObject({type:z42.enum(["NUMBER","INTEGER","BOOLEAN","STRING"]),min:z42.number().optional(),max:z42.number().optional(),options:z42.array(z42.string()).max(20).optional(),default:z42.union([z42.number().finite(),z42.boolean(),z42.string().max(200)])}))}).superRefine((p,c)=>{if(new Set(p.modes).size!==p.modes.length)c.addIssue({code:"custom",message:"Duplicate observation mode"});if((p.protocol==="QIANWEN_VIDEO_V1"||p.modes.includes("AUDIOVISUAL"))&&p.maxBytes>8388608)c.addIssue({code:"custom",message:"Video observation input exceeds supported bound"});const gemini=p.protocol==="GEMINI_INTERACTIONS_V1";const allowed=gemini?["max_output_tokens"]:["fps","max_tokens"];if(p.providerId!==(gemini?"GEMINI":"QWEN_CN")||p.modes.some(m=>!(gemini?["AUDIO","AUDIOVISUAL"]:["VIDEO","VIDEO_ALL_FRAMES"]).includes(m))||Object.keys(p.parameters).some(k=>!allowed.includes(k))||allowed.some(k=>!p.parameters[k]))c.addIssue({code:"custom",message:"Observation protocol/profile mismatch"});for(const[k,r]of Object.entries(p.parameters)){const n=r.default;const lo=k==="fps"?1:256,hi=k==="fps"?10:4096;if(typeof n!=="number"||!["NUMBER","INTEGER"].includes(r.type)||k!=="fps"&&r.type!=="INTEGER"||r.min===void 0||r.max===void 0||r.min<lo||r.max>hi||r.min>r.max||n<r.min||n>r.max||r.type==="INTEGER"&&!Number.isSafeInteger(n))c.addIssue({code:"custom",message:"Unsupported observation parameter rule"})}});var ObservationProfileSchema=z42.union([VisualObservationProfileSchema,AsrProfileSchema]);var ProviderTenantInputSchema=z43.strictObject({tenantId:TenantIdSchema});var ImageModelProfileSchema=z43.strictObject({referenceRoles:z43.array(ReferenceRoleSchema.exclude(["START_FRAME_ANCHOR","END_FRAME_ANCHOR"])).min(1).max(6).optional(),id:ModelProfileIdSchema,version:z43.int().positive(),providerId:ProviderIdSchema,modelId:z43.string().min(1).max(160),protocol:z43.enum(["QWEN_EDIT","ARK_IMAGE","GEMINI_IMAGE","OPENAI_IMAGE","XAI_IMAGE"]),maxReferences:z43.int().positive(),promptMaxUtf8Bytes:z43.int().positive(),requestTimeoutMs:z43.int().positive(),workingWidth:z43.int().nonnegative(),workingHeight:z43.int().nonnegative()});var VideoModelProfileSchema=z43.strictObject({id:ModelProfileIdSchema,version:z43.int().positive(),providerId:ProviderIdSchema,modelId:z43.string().min(1).max(160),protocol:z43.enum(["QWEN_VIDEO","VOLCENGINE_VIDEO"]),requestTimeoutMs:z43.int().positive(),promptMaxCharacters:z43.int().positive(),resolution:z43.enum(["720P","1080P"]),adapterVersion:z43.string().min(1).max(80),capabilities:VideoProviderProfileSchema.omit({id:true,adapterVersion:true,model:true,executionClass:true})});var ProviderDefaultViewSchema=z43.strictObject({selection:ProviderSelectionSchema,revision:z43.int().positive()});var scan=z43.strictObject({limit:z43.literal(100),possiblyTruncated:z43.boolean()});var ProviderConnectionPageSchema=scan.extend({items:z43.array(ProviderConnectionViewSchema).max(100)});var ProviderModelsViewSchema=z43.strictObject({catalog:z43.array(ImageModelProfileSchema).max(100),videoCatalog:z43.array(VideoModelProfileSchema).max(100),speechCatalog:z43.array(SpeechModelProfileSchema).max(100).default([]),observationCatalog:z43.array(ObservationProfileSchema).max(100).default([]),available:z43.array(z43.strictObject({selection:ProviderSelectionSchema,profile:KeyframeProviderProfileSchema})).max(1600),defaultSelection:ProviderDefaultViewSchema.nullable(),connectionScan:scan});import{z as z44}from"zod";var key3=z44.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,99}$/);var value=z44.union([z44.string().max(160),z44.number().finite(),z44.boolean()]);var ModelAudioCapabilitySchema=z44.enum(["SYNCHRONIZED_AUDIO","SPEECH_GENERATION","SPEECH_RECOGNITION","TRANSCRIPT_TIMESTAMPS","VOICE_REFERENCE","AUDIO_REFERENCE","AUDIO_DRIVEN_VIDEO","LIP_SYNCHRONIZATION","AUDIO_EDITING","SEPARATE_STEMS"]);var ModelCapabilityMatrixSchema=z44.strictObject({schemaVersion:z44.literal(1),service:key3,lifecycle:z44.enum(["ACTIVE","DEPRECATED","RETIRED"]),sources:z44.array(z44.strictObject({url:z44.url().max(2048),checkedAt:z44.iso.date()})).min(1).max(8),modes:z44.array(key3).min(1).max(16),claims:z44.array(z44.strictObject({capability:ModelAudioCapabilitySchema,modes:z44.array(key3).min(1).max(16),support:z44.enum(["SUPPORTED","UNSUPPORTED","UNKNOWN"]),control:z44.enum(["PARAMETER","PROMPT","ALWAYS_ON","MEDIA_INPUT","NONE"]),parameterPath:key3.optional(),access:z44.enum(["PUBLIC","QUALIFIED_ACCOUNT"]).default("PUBLIC"),description:z44.string().max(600).optional()})).max(64),parameters:z44.record(key3,MatrixParameterRuleSchema),constraints:z44.array(z44.strictObject({modes:z44.array(key3).min(1).max(16),when:z44.strictObject({parameter:key3,equals:value}).optional(),require:z44.array(key3).max(16).default([]),forbid:z44.array(key3).max(16).default([]),requireValues:z44.record(key3,value).default({}),reason:z44.string().min(1).max(300)})).max(32),references:z44.array(z44.strictObject({kind:z44.enum(["VOICE_ID","AUDIO_REFERENCE","DRIVING_AUDIO"]),modes:z44.array(key3).min(1).max(16),parameterPath:key3,maxItems:z44.int().min(1).max(10),minDurationMs:z44.int().positive().optional(),maxDurationMs:z44.int().positive().max(6e4).optional(),maxTotalDurationMs:z44.int().positive().max(6e4).optional(),maxBytes:z44.int().positive().max(67108864).optional(),formats:z44.array(z44.enum(["WAV","MP3"])).max(2),requiresVisual:z44.boolean(),access:z44.enum(["PUBLIC","QUALIFIED_ACCOUNT"])})).max(16),outputAudioChannels:z44.union([z44.literal(1),z44.literal(2)]).optional()}).superRefine((m,ctx)=>{const modes=new Set(m.modes);const claims=m.claims.flatMap(c=>c.modes.map(mode=>`${c.capability}:${mode}:${c.access}`));if(modes.size!==m.modes.length||new Set(claims).size!==claims.length||Object.keys(m.parameters).length>48||[...m.claims,...m.constraints,...m.references].some(r=>r.modes.some(mode=>!modes.has(mode)))||m.claims.some(r=>r.control==="PARAMETER"&&(!r.parameterPath||!Object.hasOwn(m.parameters,r.parameterPath)))||m.constraints.some(r=>r.when&&!Object.hasOwn(m.parameters,r.when.parameter)))ctx.addIssue({code:"custom",message:"Matrix modes and parameter references must resolve"});for(const rule of Object.values(m.parameters))if(rule.min!==void 0&&rule.max!==void 0&&rule.min>rule.max)ctx.addIssue({code:"custom",message:"Matrix parameter range must advance"})});import{z as z45}from"zod";var rate=z45.int().positive().max(1e9);var ruleId=z45.string().regex(/^[a-zA-Z0-9_-]{1,80}$/);var sourceUrl=z45.url({protocol:/^https$/}).max(2e3).refine(value2=>{const url=new URL(value2);return!url.username&&!url.password&&!url.search});function speechCostUpperBoundMicros(characters,microsPerMillion){return Math.ceil(characters*microsPerMillion/1e6)}var SpeechCostPolicySchema=z45.strictObject({currency:z45.literal("USD"),unit:z45.literal("INPUT_CHARACTER"),ruleId,upperBoundMicrosPerMillionCharacters:rate,sourceUrl,validUntil:z45.iso.datetime({offset:true})});var SpeechCostQuoteSchema=z45.strictObject({workload:z45.literal("SPEECH_SYNTHESIS"),currency:z45.literal("USD"),projectId:ProjectIdSchema,selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema.extend({credentialVersion:z45.int().positive()}),intentFingerprint:z45.string().regex(/^[a-f0-9]{64}$/),textCharacters:z45.int().min(1).max(600),billableCharactersUpperBound:z45.int().min(1).max(2400),upperBoundMicros:z45.int().positive().max(1e9),upperBoundMicrosPerMillionCharacters:rate,ruleId,sourceUrl}).refine(value2=>value2.billableCharactersUpperBound>=value2.textCharacters&&value2.billableCharactersUpperBound<=value2.textCharacters*4&&value2.upperBoundMicros===speechCostUpperBoundMicros(value2.billableCharactersUpperBound,value2.upperBoundMicrosPerMillionCharacters),"Speech quote must match its exact character bound and rate");var SpeechDeviceStartSchema=SpeechStartSchema.extend({deviceId:z45.uuid().optional(),approvedQuote:SpeechCostQuoteSchema});var cost={costPolicy:GenerationCostPolicySchema.optional()};var matrix={matrix:ModelCapabilityMatrixSchema.optional()};var ProviderModelDefinitionSchema=z46.discriminatedUnion("family",[z46.strictObject({family:z46.literal("NATIVE_SPEECH"),profile:NativeSpeechModelProfileSchema}),z46.strictObject({family:z46.literal("IMAGE"),profile:ImageModelProfileSchema,...matrix,...cost}),z46.strictObject({family:z46.literal("VIDEO"),profile:VideoModelProfileSchema,...matrix,...cost}),z46.strictObject({family:z46.literal("SPEECH"),profile:SpeechModelProfileSchema,...matrix}),z46.strictObject({family:z46.literal("OBSERVATION"),profile:ObservationProfileSchema,...matrix}),z46.strictObject({family:z46.literal("DECLARED"),profile:z46.strictObject({id:ModelProfileIdSchema,version:z46.int().positive(),providerId:ProviderIdSchema,modelId:z46.string().min(1).max(160),protocol:z46.literal("DOCUMENTED_ONLY")}),matrix:ModelCapabilityMatrixSchema})]);var ProviderModelViewSchema=z46.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z46.int().positive(),enabled:z46.boolean(),definition:ProviderModelDefinitionSchema}).refine(v=>v.id===v.definition.profile.id&&v.version===v.definition.profile.version,{message:"Model version identity mismatch"});var ConfigureProviderModelSchema=z46.strictObject({tenantId:TenantIdSchema,expectedVersion:z46.int().nonnegative(),definition:ProviderModelDefinitionSchema,speechCostPolicy:SpeechCostPolicySchema.optional()}).refine(v=>!v.speechCostPolicy||v.definition.family==="SPEECH",{message:"Speech cost policy requires a speech model"}).refine(v=>v.definition.profile.version===v.expectedVersion+1,{message:"Next model version required"}).refine(v=>new TextEncoder().encode(JSON.stringify(v.definition)).length<=65536,{message:"Model definition too large"});var DisableProviderModelSchema=z46.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,expectedVersion:z46.int().positive()});var ProviderModelPageSchema=z46.strictObject({items:z46.array(ProviderModelViewSchema).max(100),possiblyTruncated:z46.boolean()});var ProviderModelGetSchema=z46.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z46.int().positive().optional()});var id6=z47.uuid().toLowerCase();var SoundPlanScopeSchema=z47.strictObject({tenantId:id6,productionId:id6});var SoundPlanBasisSchema=z47.strictObject({briefVersionId:id6,briefVersion:z47.int().positive(),storyVersionId:id6,storyVersion:z47.int().positive(),planVersionId:id6,planVersion:z47.int().positive()});var SoundPlanModelSchema=z47.strictObject({modelProfileId:z47.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z47.int().positive(),connectionId:id6});var SoundPlanNativeSpeechSchema=SoundPlanModelSchema.omit({connectionId:true}).extend({schemaVersion:z47.literal(1),execution:NativeSpeechExecutionSchema});var SoundMakingPlanContentSchema=z47.strictObject({visuals:z47.array(z47.strictObject({shotId:id6,method:z47.enum(["CODE","GENERATED","IMPORTED"]),model:SoundPlanModelSchema.optional(),nativeAudio:z47.boolean().optional(),sourceSound:SourceSoundTreatmentSchema,rationale:z47.string().trim().min(1).max(600)})).min(1).max(200),cues:z47.array(z47.strictObject({id:z47.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z47.enum(["NARRATION","DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT"]),source:z47.enum(["TTS","NATIVE_VIDEO","IMPORTED_AUDIO","EXISTING_AUDIO"]),shotIds:z47.array(id6).min(1).max(200),startMs:z47.int().min(0).max(6e4),endMs:z47.int().positive().max(6e4),text:z47.string().trim().min(1).max(6e3).optional(),voice:z47.string().min(1).max(100).optional(),voiceProfile:VoiceProfileUseSchema.extend({usage:z47.literal("PRODUCTION")}).optional(),model:SoundPlanModelSchema.optional(),nativeModel:SoundPlanNativeSpeechSchema.optional(),parameters:SpeechParametersSchema.optional(),audio:z47.strictObject({purpose:z47.enum(["VOICEOVER","MUSIC"]),versionId:z47.uuid()}).optional(),lipSync:z47.enum(["REQUIRED","NONE"]),exactSpeech:z47.boolean()})).max(64),unknowns:z47.array(z47.string().trim().min(1).max(300)).max(16)}).superRefine((v,c)=>{if(new Set(v.visuals.map(s=>s.shotId)).size!==v.visuals.length||new Set(v.cues.map(s=>s.id)).size!==v.cues.length)c.addIssue({code:"custom",message:"Visual Shot and cue identities must be unique"});for(const s of v.visuals)if(s.method==="GENERATED"!==!!s.model||s.method==="GENERATED"&&s.nativeAudio===void 0||s.method!=="GENERATED"&&s.nativeAudio!==void 0||s.method==="CODE"&&s.sourceSound.policy!=="MUTE")c.addIssue({code:"custom",message:"Generated visuals require a model; CODE has no native sound"});for(const cue of v.cues)if(cue.endMs<=cue.startMs||new Set(cue.shotIds).size!==cue.shotIds.length||cue.source==="TTS"&&(!cue.text||!cue.voice||!!cue.model===!!cue.nativeModel||cue.nativeModel&&!cue.voiceProfile||!["NARRATION","DIALOGUE"].includes(cue.role))||cue.exactSpeech&&!cue.text||["NARRATION","DIALOGUE"].includes(cue.role)&&!cue.text||["IMPORTED_AUDIO","EXISTING_AUDIO"].includes(cue.source)!==!!cue.audio||cue.audio&&((["NARRATION","DIALOGUE"].includes(cue.role)?"VOICEOVER":"MUSIC")!==cue.audio.purpose||!["NARRATION","DIALOGUE","MUSIC"].includes(cue.role))||cue.source!=="TTS"&&(!!cue.voice||!!cue.model||!!cue.nativeModel||!!cue.parameters||!!cue.voiceProfile)||cue.source==="NATIVE_VIDEO"&&["NARRATION","DIALOGUE"].includes(cue.role)&&cue.shotIds.length!==1||cue.lipSync==="REQUIRED"&&(cue.source!=="NATIVE_VIDEO"||cue.shotIds.length!==1))c.addIssue({code:"custom",message:"Invalid speech, cue timing or synchronization intent"})});var SoundPlanVersionSchema=SoundPlanScopeSchema.extend({id:id6,soundPlanId:id6,projectId:id6,version:z47.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema,createdByPrincipalId:id6,createdAt:z47.iso.datetime({offset:true})});var SoundPlanValidateSchema=SoundPlanScopeSchema.extend({expectedProductionRevision:z47.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema});var SoundPlanAcceptSchema=SoundPlanValidateSchema.extend({expectedVersion:z47.int().nonnegative(),idempotencyKey:z47.string().trim().min(1).max(200)});var SoundPlanGetSchema=SoundPlanScopeSchema.extend({versionId:id6.optional()});var SoundPlanDiagnosticSchema=z47.strictObject({severity:z47.enum(["ERROR","WARNING"]),code:z47.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),shotId:id6.optional(),cueId:z47.string().max(64).optional(),message:z47.string().max(500)});var SoundPlanValidationSchema=z47.strictObject({executable:z47.boolean(),diagnostics:z47.array(SoundPlanDiagnosticSchema).max(256),semantics:z47.literal("PLAN_VALIDATION_NOT_CREATIVE_OR_LISTENING_APPROVAL")});var SoundPlanViewSchema=z47.strictObject({version:SoundPlanVersionSchema,current:z47.boolean(),freshness:z47.enum(["CURRENT_BASIS","STALE_BASIS"])});var SoundPlanReceiptSchema=z47.strictObject({semanticStatus:z47.literal("SUCCESS"),version:SoundPlanVersionSchema,productionRevision:z47.int().positive()});var SoundPlanContextSchema=SoundPlanScopeSchema.extend({projectId:id6,productionRevision:z47.int().positive(),runnable:z47.boolean(),basis:SoundPlanBasisSchema.nullable(),targetDurationMs:z47.int().positive().nullable(),shots:z47.array(z47.strictObject({shotId:id6,durationMs:z47.int().positive()})).max(200),currentVersion:z47.int().nonnegative(),currentVersionId:id6.nullable(),capabilities:z47.strictObject({models:z47.array(ProviderModelViewSchema).max(100),video:z47.array(z47.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600),speech:SpeechOptionsSchema.shape.options,audio:z47.array(AudioViewSchema).max(64)})});var TimelineSourceSoundInputSchema=z48.strictObject({duckingMusicPermille:z48.int().nonnegative().max(1e3).optional(),soundPlanVersionId:z48.uuid(),clips:z48.array(z48.strictObject({ordinal:z48.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,importedAudioVersionId:z48.uuid().optional()})).min(1).max(200),speechCues:z48.array(z48.strictObject({cueId:z48.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),audioVersionId:z48.uuid()})).max(64)});var TimelineSourceSoundSourceSchema=z48.discriminatedUnion("kind",[z48.strictObject({kind:z48.literal("NATIVE_GENERATED"),version:NativeVideoSoundReferenceSchema}),z48.strictObject({kind:z48.literal("IMPORTED_SYNC"),version:SourceSyncAudioVersionSchema})]);var TimelineSourceSoundCompositionSchema=z48.strictObject({schemaVersion:z48.literal(1),soundPlanVersionId:z48.uuid(),soundPlanFingerprint:z48.string().regex(/^[0-9a-f]{64}$/),plannedCues:SoundMakingPlanContentSchema.shape.cues,mix:AudioMixProfileSchema,clips:z48.array(z48.strictObject({ordinal:z48.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,source:TimelineSourceSoundSourceSchema.optional(),sourceInSample:z48.int().nonnegative().max(288e4),sourceOutSample:z48.int().nonnegative().max(288e4),startSample:z48.int().nonnegative().max(288e4),outputSampleCount:z48.int().positive().max(288e4)})).min(1).max(200),speechCues:z48.array(z48.strictObject({cueId:z48.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),source:ProductionAudioVersionSchema,sourceInMs:z48.literal(0),sourceOutMs:z48.int().positive().max(6e4),startMs:z48.int().nonnegative().max(6e4),gainPermille:z48.literal(1e3)})).max(64)}).superRefine((v,ctx)=>{if(new Set(v.clips.map(c=>c.ordinal)).size!==v.clips.length||new Set(v.speechCues.map(c=>c.cueId)).size!==v.speechCues.length||v.speechCues.some(c=>c.source.purpose!=="VOICEOVER"||c.sourceOutMs!==c.source.media.durationMs)||v.clips.some(c=>c.treatment.policy!=="MUTE"!==!!c.source||c.source&&c.sourceOutSample<=c.sourceInSample))ctx.addIssue({code:"custom",message:"Explicit distinct clip sound decisions and exact source required"})});var TimelineV2ClipSchema=TimelineManifestSchema.shape.clips.element.extend({source:AcceptedVisualSourceReferenceSchema});var TimelineV2ManifestSchema=TimelineManifestSchema.extend({schemaVersion:z49.literal(2),clips:z49.array(TimelineV2ClipSchema).min(1).max(200),sourceSound:TimelineSourceSoundCompositionSchema.optional()});var TimelineV2VersionSchema=TimelineV2ManifestSchema.extend(TimelineVersionIdentityShape).superRefine(validateTimelineAttachments);import{z as z50}from"zod";var sha4=z50.string().regex(/^[0-9a-f]{64}$/);var VisualFrameSequenceSchema=z50.strictObject({schemaVersion:z50.literal(1),profileId:z50.literal("RGBA_PNG_SEQUENCE_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,width:z50.int().min(1).max(1920),height:z50.int().min(1).max(1920),frameRate:z50.literal(30),frameCount:z50.int().min(1).max(360),alpha:z50.literal("STRAIGHT_RGBA"),frames:z50.array(z50.strictObject({ordinal:z50.int().min(0).max(359),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,byteSize:z50.int().min(1).max(16*1024*1024)})).min(1).max(360)}).superRefine((v,context)=>{if(v.width*v.height>1920*1080||v.frames.length!==v.frameCount||v.frames.some((f,i)=>f.ordinal!==i)||new Set(v.frames.map(f=>f.representationId)).size!==v.frames.length||v.frames.reduce((n,f)=>n+f.byteSize,0)>64*1024*1024)context.addIssue({code:"custom",message:"Frame sequence geometry/order/identity/byte budget mismatch"})});var VisualLayerPlacementSchema=z50.strictObject({xPermille:z50.int().min(0).max(1e3),yPermille:z50.int().min(0).max(1e3),widthPermille:z50.int().min(1).max(1e3),heightPermille:z50.int().min(1).max(1e3)}).refine(v=>v.xPermille+v.widthPermille<=1e3&&v.yPermille+v.heightPermille<=1e3,"Layer rectangle must fit the canvas");var VisualLayerSchema=z50.strictObject({id:z50.uuid(),source:VisualFrameSequenceSchema,sourceInFrame:z50.int().min(0).max(359),sourceOutFrame:z50.int().min(1).max(360),startFrame:z50.int().min(0).max(1799),zIndex:z50.int().min(0).max(7),opacityPermille:z50.int().min(0).max(1e3),placement:VisualLayerPlacementSchema}).superRefine((v,context)=>{if(v.sourceOutFrame<=v.sourceInFrame||v.sourceOutFrame>v.source.frameCount||v.startFrame+v.sourceOutFrame-v.sourceInFrame>1800)context.addIssue({code:"custom",message:"Layer source/output frame interval mismatch"})});var VisualLayerCompositionSchema=z50.strictObject({schemaVersion:z50.literal(1),profileId:z50.literal("STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,totalFrames:z50.int().min(1).max(1800),layers:z50.array(VisualLayerSchema).min(1).max(8)}).superRefine((v,context)=>{const sources=new Map;const frames=new Map;let bytes=0;for(const layer of v.layers){const source3=layer.source;const body=JSON.stringify(source3);for(const frame2 of source3.frames){const identity3=JSON.stringify({artifactId:frame2.artifactId,checksumSha256:frame2.checksumSha256,byteSize:frame2.byteSize,width:source3.width,height:source3.height});if(frames.has(frame2.representationId)&&frames.get(frame2.representationId)!==identity3)context.addIssue({code:"custom",message:"Shared frame representation has inconsistent facts"});frames.set(frame2.representationId,identity3)}if(source3.tenantId!==v.tenantId||source3.projectId!==v.projectId||source3.productionId!==null&&source3.productionId!==v.productionId||layer.startFrame+layer.sourceOutFrame-layer.sourceInFrame>v.totalFrames||sources.has(source3.representationId)&&sources.get(source3.representationId)!==body)context.addIssue({code:"custom",message:"Layer source scope/identity/output bounds mismatch"});if(!sources.has(source3.representationId))bytes+=source3.frames.reduce((n,f)=>n+f.byteSize,0);sources.set(source3.representationId,body)}if(new Set(v.layers.map(l=>l.id)).size!==v.layers.length||new Set(v.layers.map(l=>l.zIndex)).size!==v.layers.length||bytes>256*1024*1024)context.addIssue({code:"custom",message:"Layer instance/z-order/byte budget mismatch"})});var TimelineVisualLayerInputSchema=z51.strictObject({id:z51.uuid(),artifactId:ArtifactIdSchema,sourceInFrame:z51.int().min(0).max(359),sourceOutFrame:z51.int().min(1).max(360),startFrame:z51.int().min(0).max(1799),zIndex:z51.int().min(0).max(7),opacityPermille:z51.int().min(0).max(1e3),placement:VisualLayerPlacementSchema}).refine(layer=>layer.sourceOutFrame>layer.sourceInFrame&&layer.startFrame+layer.sourceOutFrame-layer.sourceInFrame<=1800,"Dynamic layer interval must advance and fit the output clock");var TimelineV3ManifestSchema=TimelineV2ManifestSchema.extend({schemaVersion:z51.literal(3),visualLayers:VisualLayerCompositionSchema});var TimelineV3VersionSchema=TimelineV3ManifestSchema.extend(TimelineVersionIdentityShape).superRefine((timeline,context)=>{validateTimelineAttachments(timeline,context);validateTimelineVisualLayerClock(timeline,context)});function validateTimelineVisualLayerClock(timeline,context){const composition2=timeline.visualLayers;let sourceMs=0;let totalFrames=0;let previousFrames=0;for(const[index,clip]of timeline.clips.entries()){const previousBoundary=Math.round(sourceMs*30/1e3);sourceMs+=clip.durationMs;const frames=Math.round(sourceMs*30/1e3)-previousBoundary;const overlap=clip.transition==="CUT"?0:clip.transition.durationFrames;if(clip.ordinal!==index+1||frames<1||overlap>0&&(index===0||overlap>=frames||overlap>=previousFrames))context.addIssue({code:"custom",message:"Dynamic Timeline clip frame plan mismatch"});totalFrames+=frames-overlap;previousFrames=frames}if(timeline.tenantId!==void 0&&composition2.tenantId!==timeline.tenantId||timeline.projectId!==void 0&&composition2.projectId!==timeline.projectId||timeline.productionId!==void 0&&composition2.productionId!==timeline.productionId||composition2.totalFrames!==totalFrames||Math.abs(totalFrames*1e3/30-timeline.duration.totalMs)>1e3/60+.001)context.addIssue({code:"custom",message:"Dynamic Timeline ownership or physical output clock mismatch"})}import{z as z52}from"zod";var FinalRenderProfileIdSchema=z52.enum(["FINAL_H264_720P_V1","FINAL_H264_1080P_V1","FINAL_H264_480P_V1"]);var FinalRenderProfileSchema=z52.strictObject({id:FinalRenderProfileIdSchema,algorithm:z52.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z52.union([z52.literal(1280),z52.literal(720),z52.literal(1920),z52.literal(1080),z52.literal(854),z52.literal(480)]),height:z52.union([z52.literal(1280),z52.literal(720),z52.literal(1920),z52.literal(1080),z52.literal(854),z52.literal(480)]),frameRate:z52.literal(30),codec:z52.literal("h264"),pixelFormat:z52.literal("yuv420p"),fit:z52.literal("PAD"),hasAudio:z52.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z52.literal("CUMULATIVE_NEAREST_FRAME"),encoder:z52.literal("libx264"),crf:z52.literal(18),preset:z52.literal("veryfast"),gopFrames:z52.literal(30),bFrames:z52.literal(0),audioPolicy:z52.enum(["SILENT","MIXED"]),captionPolicy:z52.enum(["NONE","BURN_IN"]),sourceQualityPolicy:z52.literal("NO_UPSCALE_V1"),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z52.literal("OVERLAY_V1").optional()}).superRefine((profile,context)=>{if(profile.hasAudio!==!!profile.audioMix||profile.hasAudio!==(profile.audioPolicy==="MIXED"))context.addIssue({code:"custom",message:"Exact native audio policy and mix must agree"});if(!!profile.captionStyle!==(profile.captionPolicy==="BURN_IN"))context.addIssue({code:"custom",message:"Caption burn-in requires exact native style"});const pair=profile.id==="FINAL_H264_720P_V1"?[1280,720]:profile.id==="FINAL_H264_480P_V1"?[854,480]:[1920,1080];if(!(profile.width===pair[0]&&profile.height===pair[1]||profile.width===pair[1]&&profile.height===pair[0]))context.addIssue({code:"custom",message:"Final profile geometry mismatch"})});var VisualLayerPolicySchema=z53.enum(["STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1","STRAIGHT_ALPHA_FRAME_OVERLAY_30_V2"]);var VisualLayerPreviewProfileSchema=RoughCutProfileSchema.safeExtend({visualLayerPolicy:VisualLayerPolicySchema});var VisualLayerFinalProfileSchema=FinalRenderProfileSchema.safeExtend({visualLayerPolicy:VisualLayerPolicySchema,visualLayerSourceQualityPolicy:z53.literal("NO_UPSCALE_V1")});var shape={schemaVersion:z53.literal(3),timeline:TimelineV3VersionSchema};var preview=RoughCutManifestSchema.extend({...shape,profile:VisualLayerPreviewProfileSchema});var final=RoughCutManifestSchema.extend({...shape,profile:VisualLayerFinalProfileSchema});function validateClock(value2,context){if(value2.totalFrames!==value2.timeline.visualLayers.totalFrames)context.addIssue({code:"custom",message:"Dynamic render must use the frozen layer clock"})}var VisualLayerPreviewManifestSchema=preview.superRefine(validateClock);var VisualLayerFinalManifestSchema=final.superRefine(validateClock);var VisualLayerRenderManifestSchema=z53.union([VisualLayerPreviewManifestSchema,VisualLayerFinalManifestSchema]);import{z as z56}from"zod";import{z as z55}from"zod";import{z as z54}from"zod";var TimelineVersionReaderSchema=z54.discriminatedUnion("schemaVersion",[TimelineVersionSchema,TimelineV2VersionSchema,TimelineV3VersionSchema]);var TimelineManifestReaderSchema=z54.discriminatedUnion("schemaVersion",[TimelineManifestSchema,TimelineV2ManifestSchema,TimelineV3ManifestSchema.superRefine(validateTimelineVisualLayerClock)]);var TimelineScopeSchema=z55.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var TimelineClipInputSchema=z55.strictObject({shotId:ShotIdSchema,acceptanceId:z55.uuid(),framing:ClipFramingSchema.optional(),transition:ClipTransitionSchema.optional(),sourceInMs:z55.int().nonnegative().max(30150),sourceOutMs:z55.int().positive().max(30150)}).refine(v=>v.sourceOutMs>v.sourceInMs,"Clip source range must advance");var BuildTimelineShapeSchema=TimelineScopeSchema.extend({schemaVersion:z55.union([z55.literal(2),z55.literal(3)]).optional(),expectedProductionRevision:z55.int().positive(),expectedTimelineVersion:z55.int().nonnegative(),idempotencyKey:z55.string().trim().min(1).max(200),clips:z55.array(TimelineClipInputSchema).min(1).max(200),captionVersionId:z55.uuid().optional(),audio:TimelineAudioInputSchema.optional(),sourceSound:TimelineSourceSoundInputSchema.optional(),graphics:z55.array(TimelineGraphicInputSchema).max(8).optional(),visualLayers:z55.array(TimelineVisualLayerInputSchema).min(1).max(8).optional()});var BuildTimelineSchema=BuildTimelineShapeSchema.superRefine((input,context)=>{if(input.sourceSound&&!input.schemaVersion)context.addIssue({code:"custom",message:"Source sound requires explicit Timeline2/3"});if(input.schemaVersion===3!==!!input.visualLayers?.length)context.addIssue({code:"custom",message:"Dynamic layers require explicit Timeline3"});if(input.visualLayers&&(new Set(input.visualLayers.map(layer=>layer.id)).size!==input.visualLayers.length||new Set(input.visualLayers.map(layer=>layer.zIndex)).size!==input.visualLayers.length))context.addIssue({code:"custom",message:"Dynamic layer IDs and z-order must be unique"})});var TimelineStaleReasonSchema=z55.enum(["BRIEF_CHANGED","STORY_CHANGED","PLAN_CHANGED","SHOT_ACCEPTANCE_CHANGED","PRODUCTION_UNAVAILABLE","CAPTION_VERSION_CHANGED","CAPTION_UNAVAILABLE","AUDIO_VERSION_CHANGED","AUDIO_UNAVAILABLE","GRAPHIC_UNAVAILABLE","VISUAL_LAYER_UNAVAILABLE","SOUND_PLAN_CHANGED","SOURCE_SOUND_UNAVAILABLE"]);var TimelineViewSchema=z55.strictObject({version:TimelineVersionReaderSchema,isCurrent:z55.boolean(),freshness:z55.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z55.array(TimelineStaleReasonSchema).max(13),assemblyStatus:z55.enum(["DRAFT","ASSEMBLY_READY"])});var TimelineGetSchema=TimelineScopeSchema.extend({versionId:z55.uuid()});var TimelineQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var TimelinePageSchema=z55.strictObject({items:z55.array(TimelineViewSchema),page:QueryPageInfoSchema});var TimelineBuildReceiptSchema=z55.strictObject({semanticStatus:z55.literal("SUCCESS"),version:TimelineVersionReaderSchema,productionRevision:z55.int().positive()});var TimelineBasisSchema=TimelineScopeSchema.extend({productionRevision:z55.int().positive(),currentTimelineVersion:z55.int().nonnegative(),runnable:z55.boolean(),planningReady:z55.boolean(),output:TimelineManifestSchema.shape.output.nullable(),targetDurationMs:z55.int().positive().nullable(),shots:z55.array(z55.strictObject({shotId:ShotIdSchema,ordinal:z55.int().positive(),acceptanceStatus:z55.enum(["NONE","CURRENT","STALE"]),source:AcceptedVisualSourceReferenceSchema.nullable(),technical:VideoTechnicalMetadataSchema.nullable()})).max(200)});var TimelineSnapshotSchema=z55.strictObject({currentVersion:z55.int().positive().nullable(),stale:z55.boolean(),timelineId:z55.uuid().nullable(),versionId:z55.uuid().nullable(),assemblyStatus:z55.enum(["DRAFT","ASSEMBLY_READY"]).nullable(),totalDurationMs:z55.int().positive().nullable(),durationClassification:TimelineDurationSchema.shape.classification.nullable(),missingPlannedShots:z55.int().nonnegative(),staleReasons:z55.array(TimelineStaleReasonSchema).max(13)});var sha5=z56.string().regex(/^[0-9a-f]{64}$/);var RoughCutStartSchema=TimelineScopeSchema.extend({deviceExecution:DeviceRenderTargetSchema.optional(),timelineVersionId:z56.uuid(),timelineFingerprint:sha5,expectedProductionRevision:z56.int().positive(),profileId:RoughCutProfileIdSchema,idempotencyKey:z56.string().trim().min(1).max(200)});var RoughCutGetSchema=TimelineScopeSchema.extend({renderId:z56.uuid()});var RoughCutQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutV2ManifestSchema=RoughCutManifestSchema.extend({schemaVersion:z56.literal(2),timeline:TimelineV2VersionSchema});var RoughCutManifestReaderSchema=z56.discriminatedUnion("schemaVersion",[RoughCutManifestSchema,RoughCutV2ManifestSchema,VisualLayerPreviewManifestSchema]);var RoughCutTechnicalSchema=VideoTechnicalMetadataSchema.extend({hasAudio:z56.boolean(),audio:RenderedAudioSchema.optional(),durationMs:z56.int().min(29983).max(60017),frameRate:z56.literal(30),frameCount:z56.int().min(900).max(1800),engineVersion:z56.string().min(1).max(200)}).superRefine((v,ctx)=>{if(v.hasAudio!==!!v.audio||v.audio&&v.audio.sampleCount!==v.frameCount*1600)ctx.addIssue({code:"custom",message:"Actual audio stream must match physical output samples"})});var RoughCutArtifactSchema=RoughCutTechnicalSchema.safeExtend({artifactId:z56.uuid(),representationId:z56.uuid(),version:z56.int().positive(),poster:VideoPosterSchema,availability:z56.enum(["AVAILABLE","INVALID"]),reviewState:z56.enum(["UNREVIEWED","PASS","WARNING","FAIL"])});var RoughCutAdmissionSchema=z56.strictObject({humanLinks:HumanLinksSchema.optional(),deviceExecution:DeviceRenderReceiptSchema.optional(),semanticStatus:z56.literal("ACCEPTED"),renderId:z56.uuid(),operationId:OperationIdSchema,productionId:z56.uuid(),timelineVersionId:z56.uuid(),timelineFingerprint:sha5,executionClass:z56.enum(["LIVE","TEST_ONLY"]),manifestFingerprint:sha5,productionRevision:z56.int().positive()});var RoughCutViewSchema=TimelineScopeSchema.extend({humanLinks:HumanLinksSchema.optional(),renderId:z56.uuid(),projectId:ProjectIdSchema,runtimeJobId:z56.uuid(),operationId:OperationIdSchema,manifest:RoughCutManifestReaderSchema,manifestFingerprint:sha5,runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus,cancellationRequested:z56.boolean(),isCurrentTimeline:z56.boolean(),freshness:z56.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z56.array(z56.string().min(1).max(120)).max(16),executionClass:z56.enum(["LIVE","TEST_ONLY"]),roughCut:RoughCutArtifactSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z56.iso.datetime({offset:true})});var RoughCutPageSchema=z56.strictObject({items:z56.array(RoughCutViewSchema),page:QueryPageInfoSchema});var RoughCutSnapshotSchema=z56.strictObject({latestVersion:z56.int().positive().nullable(),reviewState:z56.enum(["UNREVIEWED","PASS","WARNING","FAIL"]).nullable(),latestRenderId:z56.uuid().nullable(),runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z56.uuid().nullable(),currentArtifactId:z56.uuid().nullable(),currentTimelineVersionId:z56.uuid().nullable(),stale:z56.boolean()});import{z as z60}from"zod";import{z as z58}from"zod";import{z as z57}from"zod";var sha6=z57.string().regex(/^[0-9a-f]{64}$/);var DeliveryPolicySchema=z57.strictObject({schemaVersion:z57.literal(1),requiredAudio:z57.boolean(),requiredCaptions:z57.boolean(),requiredGraphics:z57.boolean(),finalApproval:z57.enum(["AUTOMATIC","HUMAN"])});var DeliveryPolicyInputSchema=DeliveryPolicySchema.extend({requiredAudio:z57.boolean().default(false),requiredCaptions:z57.boolean().default(false),requiredGraphics:z57.boolean().default(false),finalApproval:z57.enum(["AUTOMATIC","HUMAN"]).default("AUTOMATIC")});var DeliveryCompositionSchema=z57.strictObject({hasAudio:z57.boolean(),hasCaptions:z57.boolean(),hasGraphics:z57.boolean()});var DeliveryTargetSchema=z57.strictObject({tenantId:z57.uuid(),projectId:z57.uuid(),productionId:z57.uuid(),renderId:z57.uuid(),timelineVersionId:z57.uuid(),timelineFingerprint:sha6,selectionId:z57.uuid(),selectionVersion:z57.int().positive(),renderManifestFingerprint:sha6,artifactId:z57.uuid(),representationId:z57.uuid(),checksumSha256:sha6,byteSize:z57.int().positive().max(128*1024*1024),executionClass:z57.enum(["LIVE","TEST_ONLY"])});var deliveryPhysicalCheckKeys=["FILE_READABLE","CHECKSUM","CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","REQUIRED_AUDIO","REQUIRED_CAPTIONS","REQUIRED_GRAPHICS","MISSING_MEDIA","BLACK_FRAMES"];var DeliveryCheckKeySchema=z57.enum([...deliveryPhysicalCheckKeys,"ARTIFACT_REGISTRATION","PROVENANCE","MANIFEST_INTEGRITY","EXACT_BASIS","BLOCKING_FINDINGS"]);var DeliveryCheckSchema=z57.strictObject({key:DeliveryCheckKeySchema,status:z57.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"]),detail:z57.string().trim().min(1).max(1e3)});var DeliveryPhysicalChecksSchema=z57.array(DeliveryCheckSchema.extend({key:z57.enum(deliveryPhysicalCheckKeys)})).length(deliveryPhysicalCheckKeys.length).refine(checks=>new Set(checks.map(check=>check.key)).size===deliveryPhysicalCheckKeys.length,"Exact physical media checks required");var DeliveryValidationReviewSchema=z57.strictObject({id:z57.uuid(),target:DeliveryTargetSchema,policy:DeliveryPolicySchema,policyFingerprint:sha6,composition:DeliveryCompositionSchema,checks:z57.array(DeliveryCheckSchema).length(DeliveryCheckKeySchema.options.length),result:z57.enum(["PASS","FAIL"]),blockingChecks:z57.array(DeliveryCheckKeySchema).max(DeliveryCheckKeySchema.options.length),createdAt:z57.iso.datetime({offset:true})}).superRefine((review2,ctx)=>{const seen=new Set;const blocked=new Set;const{policy,composition:composition2}=review2;for(const check of review2.checks){if(seen.has(check.key))ctx.addIssue({code:"custom",message:"Duplicate deterministic delivery check"});seen.add(check.key);const mayOmit=check.key==="AUDIO_DECODE"&&!composition2.hasAudio||check.key==="REQUIRED_AUDIO"&&!policy.requiredAudio||check.key==="REQUIRED_CAPTIONS"&&!policy.requiredCaptions||check.key==="REQUIRED_GRAPHICS"&&!policy.requiredGraphics;if(check.status==="NOT_APPLICABLE"&&!mayOmit)ctx.addIssue({code:"custom",message:"Required delivery evidence cannot be omitted"});if(check.status==="FAIL"||check.status==="UNVERIFIED")blocked.add(check.key)}if(policy.requiredAudio&&!composition2.hasAudio)blocked.add("REQUIRED_AUDIO");if(policy.requiredCaptions&&!composition2.hasCaptions)blocked.add("REQUIRED_CAPTIONS");if(policy.requiredGraphics&&!composition2.hasGraphics)blocked.add("REQUIRED_GRAPHICS");const expected=DeliveryCheckKeySchema.options.filter(key4=>blocked.has(key4));if(review2.result!==(expected.length?"FAIL":"PASS")||JSON.stringify(review2.blockingChecks)!==JSON.stringify(expected))ctx.addIssue({code:"custom",message:"Review result and blockers must match complete owned evidence"})});var sha7=z58.string().regex(/^[0-9a-f]{64}$/);function sameTarget(a,b){return Object.keys(DeliveryTargetSchema.shape).every(key4=>a[key4]===b[key4])}var DeliveryApprovalSchema=z58.strictObject({id:z58.uuid(),reviewId:z58.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha7,authority:z58.literal("HUMAN"),action:z58.enum(["APPROVE","REJECT"]),principalId:z58.uuid(),createdAt:z58.iso.datetime({offset:true})});var DeliveryManifestLinkSchema=z58.strictObject({id:z58.uuid(),checksumSha256:sha7,target:DeliveryTargetSchema,policyFingerprint:sha7,reviewId:z58.uuid()});var FinalDeliveryReceiptSchema=z58.strictObject({id:z58.uuid(),deliveryRole:z58.literal("FINAL_ARTIFACT"),review:DeliveryValidationReviewSchema,manifest:DeliveryManifestLinkSchema,approval:DeliveryApprovalSchema.nullable(),productionRevision:z58.int().positive(),completedAt:z58.iso.datetime({offset:true})}).superRefine((receipt,ctx)=>{const{review:review2,manifest,approval}=receipt;if(review2.result!=="PASS"||!sameTarget(manifest.target,review2.target)||manifest.reviewId!==review2.id||manifest.policyFingerprint!==review2.policyFingerprint)ctx.addIssue({code:"custom",message:"Final delivery requires an exact PASS Review and Manifest"});if(review2.policy.finalApproval==="HUMAN"){if(!approval||approval.action!=="APPROVE"||approval.reviewId!==review2.id||approval.policyFingerprint!==review2.policyFingerprint||!sameTarget(approval.target,review2.target))ctx.addIssue({code:"custom",message:"Configured Human gate requires exact Human approval"})}else if(approval){ctx.addIssue({code:"custom",message:"Automatic delivery does not carry an unconfigured approval"})}});import{z as z59}from"zod";var sha8=z59.string().regex(/^[0-9a-f]{64}$/);var DecideFinalReadySchema=TimelineScopeSchema.extend({renderId:z59.uuid(),reviewId:z59.uuid(),basisFingerprint:sha8,action:z59.enum(["SELECT","REJECT"]),acknowledgeWarnings:z59.boolean().default(false),expectedProductionRevision:z59.int().positive(),expectedFinalReadyVersion:z59.int().nonnegative(),reason:z59.string().trim().min(1).max(2500),idempotencyKey:z59.string().trim().min(1).max(200)});var RevokeFinalReadySchema=TimelineScopeSchema.extend({selectionId:z59.uuid(),expectedFinalReadyVersion:z59.int().positive(),expectedProductionRevision:z59.int().positive(),reason:z59.string().trim().min(1).max(2500),idempotencyKey:z59.string().trim().min(1).max(200)});var FinalReadyDecisionSchema=TimelineScopeSchema.extend({id:z59.uuid(),projectId:ProjectIdSchema,version:z59.int().positive(),action:z59.enum(["SELECT","REJECT","REVOKE"]),renderId:z59.uuid(),reviewId:z59.uuid(),basisFingerprint:sha8,timelineVersionId:z59.uuid(),timelineFingerprint:sha8,artifactId:z59.uuid(),representationId:z59.uuid(),checksumSha256:sha8,outputProfile:DeliveryOutputProfileSchema,executionClass:z59.enum(["LIVE","TEST_ONLY"]),previousSelectionId:z59.uuid().nullable(),acknowledgeWarnings:z59.boolean(),warningKeys:z59.array(z59.string()).max(300),reason:z59.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z59.iso.datetime({offset:true})});var FinalReadyViewSchema=TimelineScopeSchema.extend({version:z59.int().nonnegative(),status:z59.enum(["NONE","CURRENT","STALE"]),selection:FinalReadyDecisionSchema.nullable(),staleReasons:z59.array(z59.string()).max(24)});var FinalReadyQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var FinalReadyPageSchema=z59.strictObject({items:z59.array(FinalReadyDecisionSchema),page:QueryPageInfoSchema});var FinalReadyReceiptSchema=z59.strictObject({semanticStatus:z59.literal("SUCCESS"),decision:FinalReadyDecisionSchema,productionRevision:z59.int().positive()});var RoughCutReviewSnapshotSchema=z59.strictObject({currentRenderId:z59.uuid().nullable(),latestReviewId:z59.uuid().nullable(),reviewVersion:z59.int().nonnegative(),result:z59.enum(["PASS","WARNING","FAIL"]).nullable(),current:z59.boolean(),inspectable:z59.boolean(),executionClass:z59.enum(["LIVE","TEST_ONLY"]).nullable(),findings:z59.strictObject({open:z59.int().nonnegative(),blocking:z59.int().nonnegative(),warnings:z59.int().nonnegative()}),finalReady:FinalReadyViewSchema,latestDecision:FinalReadyDecisionSchema.nullable()});var sha9=z60.string().regex(/^[0-9a-f]{64}$/);function hasTimelineAudio(timeline){return!!timeline.audio||!!timeline.sourceSound&&(timeline.sourceSound.clips.some(c=>!!c.source)||timeline.sourceSound.speechCues.length>0)}var FinalRenderStartSchema=TimelineScopeSchema.extend({deviceExecution:DeviceRenderTargetSchema.optional(),selectionId:z60.uuid(),expectedFinalReadyVersion:z60.int().positive(),timelineVersionId:z60.uuid(),timelineFingerprint:sha9,expectedProductionRevision:z60.int().positive(),profileId:FinalRenderProfileIdSchema,audioPolicy:z60.enum(["SILENT","MIXED"]),captionPolicy:z60.enum(["NONE","BURN_IN"]),idempotencyKey:z60.string().trim().min(1).max(200)});var FinalRenderGetSchema=RoughCutGetSchema;var FinalRenderQuerySchema=RoughCutQuerySchema;var finalManifestShape={selection:FinalReadyDecisionSchema.refine(v=>v.action==="SELECT"),selectionVersion:z60.int().positive(),profile:FinalRenderProfileSchema};var finalV1=RoughCutManifestSchema.extend(finalManifestShape);var finalV2=RoughCutV2ManifestSchema.extend(finalManifestShape);var finalV3=VisualLayerFinalManifestSchema.safeExtend({...finalManifestShape,profile:VisualLayerFinalProfileSchema});function validateFinalManifest(manifest,context){const{selection:selected,timeline,profile}=manifest;const expectedProfile=finalProfileIds[timeline.output.profile];const landscape=timeline.output.aspectRatio==="16:9";if(!!profile.picturePolicy!==timeline.clips.some(c=>!!c.framing)||profile.audioPolicy!==(hasTimelineAudio(timeline)?"MIXED":"SILENT")||!!profile.audioMix!==hasTimelineAudio(timeline)||profile.captionPolicy!==(timeline.caption?"BURN_IN":"NONE")||!!profile.captionStyle!==!!timeline.caption||!!profile.graphicsPolicy!==!!timeline.graphics?.length||selected.tenantId!==timeline.tenantId||selected.projectId!==timeline.projectId||selected.productionId!==timeline.productionId||selected.timelineVersionId!==timeline.id||selected.timelineFingerprint!==timeline.fingerprint||selected.version>manifest.selectionVersion||selected.outputProfile!==timeline.output.profile||selected.executionClass!==timeline.executionClass||profile.id!==expectedProfile||profile.width>profile.height!==landscape)context.addIssue({code:"custom",message:"Final selection, Timeline and profile mismatch"})}var FinalRenderManifestSchema=finalV1.superRefine(validateFinalManifest);var FinalRenderV2ManifestSchema=finalV2.superRefine(validateFinalManifest);var FinalRenderV3ManifestSchema=finalV3.superRefine(validateFinalManifest);var FinalRenderManifestReaderSchema=z60.discriminatedUnion("schemaVersion",[FinalRenderManifestSchema,FinalRenderV2ManifestSchema,FinalRenderV3ManifestSchema]);var FinalRenderTechnicalSchema=RoughCutTechnicalSchema;var FinalRenderArtifactSchema=RoughCutArtifactSchema.safeExtend({reviewState:z60.literal("UNREVIEWED"),deliveryRole:z60.literal("NONE")});var FinalRenderAdmissionSchema=RoughCutAdmissionSchema.extend({selectionId:z60.uuid(),selectionVersion:z60.int().positive(),profileId:FinalRenderProfileIdSchema});var FinalRenderViewSchema=RoughCutViewSchema.omit({roughCut:true,manifest:true,staleReasons:true}).extend({manifest:FinalRenderManifestReaderSchema,finalOutput:FinalRenderArtifactSchema.nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable().default(null),staleReasons:z60.array(z60.string().min(1).max(120)).max(24)});var FinalRenderPageSchema=z60.strictObject({items:z60.array(FinalRenderViewSchema).max(200),page:QueryPageInfoSchema});var FinalRenderSourceBlockerSchema=z60.strictObject({code:z60.enum(["SOURCE_RESOLUTION_INSUFFICIENT","SOURCE_MEDIA_UNSUPPORTED"]),shotId:z60.uuid(),ordinal:z60.int().positive().max(200),actualWidth:z60.int().positive().max(4096),actualHeight:z60.int().positive().max(4096),requiredWidth:z60.int().positive().max(4096),requiredHeight:z60.int().positive().max(4096)});var FinalRenderEligibilitySchema=TimelineScopeSchema.extend({productionRevision:z60.int().positive(),finalReady:FinalReadyViewSchema,profile:z60.union([FinalRenderProfileSchema,VisualLayerFinalProfileSchema]).nullable(),renderable:z60.boolean(),blockers:z60.array(z60.string().min(1).max(120)).max(24),sourceBlockers:z60.array(FinalRenderSourceBlockerSchema).max(200),supportedAudioPolicy:z60.enum(["SILENT","MIXED"]),supportedCaptionPolicy:z60.enum(["NONE","BURN_IN"])});var FinalRenderSnapshotSchema=z60.strictObject({latestRenderId:z60.uuid().nullable(),runtimeStatus:RoughCutViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z60.uuid().nullable(),currentArtifactId:z60.uuid().nullable(),stale:z60.boolean(),eligibility:FinalRenderEligibilitySchema});import{z as z62}from"zod";import{z as z61}from"zod";var MediaCategorySchema=z61.enum(["IMAGE","VIDEO","AUDIO","DOCUMENT"]);function mediaCategoryOf(contentType){if(contentType.startsWith("image/"))return"IMAGE";if(contentType.startsWith("video/"))return"VIDEO";if(contentType.startsWith("audio/"))return"AUDIO";return"DOCUMENT"}var localLibraryProfile={protocol:"NVS_LOCAL_LIBRARY_V1",inspection:"LOCAL_FILE_DECODE_V1",publication:"COMMITTED_SOURCE_READBACK_V1"};var LocalLibraryContentTypeSchema=z62.enum(["video/mp4","image/png","image/jpeg","image/webp","audio/wav","text/plain","application/json","application/pdf","application/octet-stream"]);var LocalLibraryVersionSchema=z62.strictObject({fileId:LocalIdSchema,versionId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z62.int().nonnegative().max(128*1024*1024),contentType:LocalLibraryContentTypeSchema});var LocalLibraryReferenceSchema=LocalProjectScopeSchema.extend({deviceId:LocalIdSchema,...LocalLibraryVersionSchema.shape});var LocalLibraryMetadataSchema=z62.strictObject({label:z62.string().trim().min(1).max(255)});var LocalLibraryAccessCommandSchema=z62.strictObject({reference:LocalLibraryReferenceSchema,requestId:LocalIdSchema,expectedRevision:z62.int().nonnegative(),metadata:LocalLibraryMetadataSchema.nullable(),allowInspect:z62.boolean(),allowPublish:z62.boolean(),expiresAt:LocalTimeSchema});var LocalLibraryAccessReceiptSchema=LocalLibraryAccessCommandSchema.extend({revision:z62.int().positive(),recordedAt:LocalTimeSchema});var LocalLibraryAccessQuerySchema=z62.strictObject({reference:LocalLibraryReferenceSchema,requestId:LocalIdSchema});var LocalLibraryAccessCurrentSchema=z62.strictObject({reference:LocalLibraryReferenceSchema});var LocalLibraryAccessStateSchema=z62.strictObject({state:z62.enum(["LOCAL_ONLY","PENDING","SYNCED","UNKNOWN","REJECTED"]),desired:LocalLibraryAccessCommandSchema.nullable(),confirmed:LocalLibraryAccessReceiptSchema.nullable()});var LocalLibraryItemSchema=z62.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema,title:z62.string().trim().min(1).max(255),createdAt:LocalTimeSchema,revision:z62.int().positive(),access:LocalLibraryAccessStateSchema});var pageFields={after:LocalDigestSchema.nullable().default(null),limit:z62.int().min(1).max(16).default(16)};var LocalLibraryQuerySchema=LocalProjectScopeSchema.extend({projectId:LocalIdSchema.optional(),deviceId:LocalIdSchema,ownerKey:LocalDigestSchema.optional(),search:z62.string().trim().min(1).max(200).optional(),mediaCategory:MediaCategorySchema.optional(),...pageFields});var LocalLibraryPageSchema=z62.strictObject({items:z62.array(LocalLibraryItemSchema).max(16),nextCursor:LocalDigestSchema.nullable()});var LocalLibraryProjectionSchema=z62.strictObject({reference:LocalLibraryReferenceSchema,metadata:LocalLibraryMetadataSchema.nullable(),accessRevision:z62.int().positive(),allowInspect:z62.boolean(),allowPublish:z62.boolean(),expiresAt:LocalTimeSchema});var LocalLibraryProjectionPageSchema=z62.strictObject({items:z62.array(LocalLibraryProjectionSchema).max(16),nextCursor:LocalDigestSchema.nullable()});var LocalLibraryProjectionQuerySchema=LocalLibraryQuerySchema.omit({ownerKey:true}).extend({projectId:LocalIdSchema});var LocalLibraryImportSchema=z62.strictObject({requestId:LocalIdSchema,reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema,title:z62.string().trim().min(1).max(255)});var LocalLibraryImportReceiptQuerySchema=LocalProjectScopeSchema.extend({deviceId:LocalIdSchema,requestId:LocalIdSchema,ownerKey:LocalDigestSchema.optional()});var LocalLibraryReadSchema=z62.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema.optional(),offset:z62.int().nonnegative(),length:z62.int().min(1).max(128*1024)});var LocalLibraryReadReplySchema=z62.strictObject({reference:LocalLibraryReferenceSchema,offset:z62.int().nonnegative(),contentBase64:z62.string().max(174764).regex(/^[A-Za-z0-9+/]*={0,2}$/),complete:z62.boolean()});var LocalLibraryGetSchema=z62.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema.optional()});var LocalLibraryAccessInputSchema=z62.strictObject({command:LocalLibraryAccessCommandSchema,expectedLocalRevision:z62.int().positive(),ownerKey:LocalDigestSchema.optional()});var LocalLibraryCallSchema=z62.discriminatedUnion("action",[LocalLibraryQuerySchema.extend({action:z62.literal("list")}),LocalLibraryGetSchema.extend({action:z62.literal("get")}),LocalLibraryProjectionQuerySchema.extend({action:z62.literal("scoped-list")}),z62.strictObject({action:z62.literal("scoped-get"),reference:LocalLibraryReferenceSchema}),z62.strictObject({action:z62.literal("usage"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryReadSchema.extend({action:z62.literal("read")}),LocalLibraryAccessInputSchema.extend({action:z62.literal("access")}),LocalLibraryAccessQuerySchema.extend({action:z62.literal("sync"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryAccessQuerySchema.extend({action:z62.literal("resume-access"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryImportReceiptQuerySchema.extend({action:z62.literal("import-receipt")})]);var LocalLibraryCapabilitySchema=z62.strictObject({protocol:z62.literal("NVS_LOCAL_LIBRARY_V1"),available:z62.boolean(),profileDigest:LocalDigestSchema});var LocalLibraryUsageSchema=z62.strictObject({fileCount:z62.int().nonnegative(),totalBytes:z62.int().nonnegative(),quotaBytes:z62.int().positive(),availableDiskBytes:z62.int().nonnegative()});import{z as z64}from"zod";var HYPERFRAME_RENDER_PROFILE={id:"HYPERFRAME_1080P30_FULL_PAINT_V1",adapter:"native-hyperframe-v1",engine:"0.8.134",producer:"0.8.134",gsap:"3.15.0",node:"v24.21.0",browser:"Google Chrome for Testing 154.0.8037.57",browserSha256:"60c03e8882f4bb47459a905ede1074e1e746c5b765e437c288e460320540a8a3",ffmpeg:"ffmpeg version 8.0.1-3ubuntu2 Copyright (c) 2000-2025 the FFmpeg developers",maxFrames:360,timeoutMs:6e5,maxRssBytes:3221225472,maxScratchBytes:3221225472,maxOutputBytes:134217728,maxCpuMs:6e5,capture:"PNG_SOFTWARE_SCREENSHOT_FULL_PAINT",encode:"H264_YUV420P_CRF18_THREADS2_NO_AUDIO"};var HYPERFRAME_ALPHA_RENDER_PROFILE={...HYPERFRAME_RENDER_PROFILE,id:"HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1",adapter:"native-hyperframe-alpha-v1",encode:"RGBA_PNG_SEQUENCE_30_V1",maxOutputBytes:67108864,maxDecodedBytes:536870912};var HYPERFRAME_CACHED_RENDER_PROFILE={...HYPERFRAME_RENDER_PROFILE,id:"HYPERFRAME_1080P30_FRAME_CACHE_V2",adapter:"native-hyperframe-cache-v2",encode:"H264_YUV420P_CRF18_VERYFAST_THREADS2_NO_AUDIO"};import{z as z63}from"zod";var whisperCppRecognitionProfile=Object.freeze({id:"WHISPER_CPP_TINY_EN_Q5_1_PCM16K_V1",sourceRevision:"2eeeba56e9edd762b4b38467bab96c2517163158",modelSha256:"c77c5766f1cef09b6b7d47f21b546cbddd4157886b3b5d6d4f709e91e66c7c2b",language:"en",sampleRateHz:16e3,maxDurationMs:6e4});var LocalWhisperIdentitySchema=z63.strictObject({profileId:z63.literal(whisperCppRecognitionProfile.id),binarySha256:LocalDigestSchema,modelSha256:z63.literal(whisperCppRecognitionProfile.modelSha256)});var LocalWhisperToolSelectionSchema=z63.strictObject({binaryPath:z63.string().min(1).max(4096),binarySha256:LocalDigestSchema,modelPath:z63.string().min(1).max(4096)});var executable=z64.strictObject({path:z64.string().min(1).max(4096),digest:LocalDigestSchema});var LocalManagedMediaReuseSchema=z64.strictObject({schemaVersion:z64.literal(1),ffmpeg:executable,ffprobe:executable});var mediaTools={ffmpeg:executable,ffprobe:executable};var LocalCompositionBrowserSelectionSchema=executable.extend({digest:z64.literal(HYPERFRAME_CACHED_RENDER_PROFILE.browserSha256)});var LocalInstalledToolSelectionSchema=z64.strictObject({mode:z64.literal("INSTALLED"),...mediaTools,compositionBrowser:LocalCompositionBrowserSelectionSchema.optional(),whisper:LocalWhisperToolSelectionSchema.optional(),cpuSpeech:CpuSpeechInstallationSchema.optional()});var LocalToolSelectionSchema=z64.discriminatedUnion("mode",[z64.strictObject({mode:z64.literal("MANAGED"),...mediaTools,cpuSpeech:CpuSpeechInstallationSchema.optional()}),LocalInstalledToolSelectionSchema]);import{z as z70}from"zod";import{z as z66}from"zod";function canonicalLocalJson(value2){if(value2===null||typeof value2==="string"||typeof value2==="boolean")return JSON.stringify(value2);if(typeof value2==="number"&&Number.isFinite(value2))return JSON.stringify(value2);if(Array.isArray(value2))return"["+value2.map(canonicalLocalJson).join(",")+"]";if(typeof value2==="object")return"{"+Object.entries(value2).filter(([,v])=>v!==void 0).sort(([a],[b])=>a<b?-1:a>b?1:0).map(([k,v])=>JSON.stringify(k)+":"+canonicalLocalJson(v)).join(",")+"}";throw new Error("Fingerprint input must be finite JSON data")}import{z as z65}from"zod";var maxMediaObjectBytes=128*1024*1024;var mediaObjectTransferPath="/v1/object-transfers";var mediaBrowserReadPath=mediaObjectTransferPath+"/browser-read";var MediaBrowserContentTypeSchema=z65.enum(["image/png","image/jpeg","image/webp","video/mp4","audio/wav","audio/mpeg","application/json","text/plain","application/x-subrip"]);var MediaObjectVersionSchema=LocalProjectScopeSchema.extend({versionId:LocalIdSchema,role:z65.enum(["SOURCE","VIDEO","POSTER","AUDIO","FRAME","SHEET","MANIFEST"]),byteSize:z65.int().min(1).max(maxMediaObjectBytes),checksumSha256:LocalDigestSchema});var MediaTransferGrantSchema=z65.strictObject({protocol:z65.literal("NVS_MEDIA_TRANSFER_V1"),storageId:z65.string().regex(/^[A-Za-z0-9_-]{1,100}$/),method:z65.enum(["GET","PUT","HEAD"]),object:MediaObjectVersionSchema,issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var MediaObjectTicketSchema=z65.strictObject({endpoint:z65.url().max(2048),credential:z65.string().regex(/^[A-Za-z0-9_-]{1,2048}\.[A-Za-z0-9_-]{43}$/).meta({writeOnly:true}),method:z65.enum(["GET","PUT"]),object:MediaObjectVersionSchema});var MediaBrowserReadGrantSchema=z65.strictObject({protocol:z65.literal("NVS_MEDIA_BROWSER_READ_V1"),storageId:z65.string().regex(/^[A-Za-z0-9_-]{1,100}$/),object:MediaObjectVersionSchema,contentType:MediaBrowserContentTypeSchema,representationId:LocalIdSchema,attachment:z65.boolean(),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var MediaBrowserReadTicketSchema=z65.strictObject({url:z65.url().max(4096).refine(value2=>{const url=new URL(value2);return(url.protocol==="https:"||url.protocol==="http:"&&url.hostname==="127.0.0.1")&&!url.username&&!url.password&&!url.hash&&url.pathname===mediaBrowserReadPath&&url.searchParams.size===1&&/^[A-Za-z0-9_-]{1,3072}\.[A-Za-z0-9_-]{43}$/.test(url.searchParams.get("ticket")??"")}),expiresAt:LocalTimeSchema,object:MediaObjectVersionSchema,contentType:MediaBrowserContentTypeSchema});var QwenDeviceCredentialScopeSchema=z66.strictObject({tenantId:LocalIdSchema,connectionId:LocalIdSchema,connectionVersion:z66.int().positive(),workspace:z66.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)});var QwenDeviceCredentialIdentitySchema=QwenDeviceCredentialScopeSchema.extend({proofSha256:LocalDigestSchema});var QwenDeviceCredentialSelectionSchema=QwenDeviceCredentialScopeSchema.extend({privateKeyFile:z66.string().min(1).max(4096)});var qwenSource=ResolvedReferenceSchema.pick({artifactId:true,representationId:true,checksumSha256:true,contentType:true,role:true}).extend({byteSize:MediaObjectVersionSchema.shape.byteSize.max(8*1024*1024)});var keyframeBytes=z66.strictObject({checksumSha256:LocalDigestSchema,byteSize:MediaObjectVersionSchema.shape.byteSize.max(8*1024*1024),width:z66.int().positive().max(4096),height:z66.int().positive().max(4096)});var externalKeyframe=z66.literal("KEYFRAME_GENERATE");var QwenKeyframeRecipeSchema=z66.strictObject({processor:externalKeyframe,generationId:LocalIdSchema,credential:QwenDeviceCredentialIdentitySchema,quoteFingerprint:LocalDigestSchema,prompt:z66.string().trim().min(1).refine(value2=>new TextEncoder().encode(value2).length<=1300),aspectRatio:z66.enum(["16:9","9:16"]),sources:z66.array(qwenSource).min(1).max(3)});var QwenKeyframeEvidenceSchema=z66.strictObject({processor:externalKeyframe,providerExecutionId:z66.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),providerResultId:LocalDigestSchema,image:keyframeBytes});var QwenVideoRecipeSchema=QwenKeyframeRecipeSchema.extend({processor:z66.literal("VIDEO_GENERATE"),prompt:z66.string().trim().min(1).max(2e4),mode:z66.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),durationSeconds:z66.int().min(2).max(30),sources:z66.array(qwenSource).min(1).max(10)});var QwenVideoTaskIdSchema=z66.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var QwenVideoEvidenceSchema=z66.strictObject({processor:z66.literal("VIDEO_GENERATE"),providerExecutionId:QwenVideoTaskIdSchema,providerResultId:QwenVideoTaskIdSchema,video:VideoTechnicalMetadataSchema.extend({videoCodec:z66.literal("h264"),frameRate:z66.literal(30),hasAudio:z66.literal(false),frameCount:z66.int().positive().max(902)}),poster:keyframeBytes});var ExternalGenerationReservationMarkerSchema=z66.strictObject({protocol:z66.literal("NVS_TENANT_EXTERNAL_GENERATION_V1"),tenantId:LocalIdSchema,projectId:LocalIdSchema,productionId:LocalIdSchema,runtimeJobId:LocalIdSchema,shotId:LocalIdSchema,preparationId:LocalIdSchema,contractId:LocalIdSchema,workload:z66.enum(["KEYFRAME_GENERATE","VIDEO_GENERATE"]),policyRevision:z66.int().positive(),contractFingerprint:LocalDigestSchema,originRequestFingerprint:LocalDigestSchema,bindingFingerprint:LocalDigestSchema,inputsFingerprint:LocalDigestSchema,quoteFingerprint:LocalDigestSchema});import{z as z69}from"zod";import{z as z67}from"zod";var pixel=z67.int().nonnegative().max(4096);var dimension2=z67.int().positive().max(4096);var frame=z67.int().nonnegative().max(1800);var sample=z67.int().nonnegative().max(288e4);var rectangle=z67.strictObject({x:pixel,y:pixel,width:dimension2,height:dimension2});var window=z67.strictObject({start:sample,count:sample});var source=z67.strictObject({representationId:z67.uuid(),checksum:LocalDigestSchema,byteSize:z67.int().positive().max(134217728)});var LocalMediaRecipeSchema=z67.strictObject({protocol:z67.literal("NVS_RESOLVED_MEDIA_RECIPE_V2"),family:z67.enum(["ROUGH_CUT_RENDER","FINAL_RENDER"]),width:dimension2,height:dimension2,totalFrames:z67.int().min(900).max(1800),crf:z67.union([z67.literal(18),z67.literal(23)]),algorithm:z67.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),clips:z67.array(z67.strictObject({representationId:z67.uuid(),technical:VideoTechnicalMetadataSchema,sourceInMs:z67.int().nonnegative().max(6e4),sourceOutMs:z67.int().positive().max(6e4),startFrame:frame,frameCount:z67.int().positive().max(1800),overlapFrames:frame,crop:rectangle.nullable(),viewport:rectangle})).min(1).max(32),caption:z67.strictObject({style:CaptionRenderStyleSchema,references:z67.array(z67.strictObject({representationId:z67.uuid(),expectedUtf8:z67.string().max(65536)})).length(2),cues:z67.array(z67.strictObject({ordinal:z67.int().nonnegative().max(512),startFrame:frame,endFrame:frame,fontSize:z67.int().min(16).max(256),margin:pixel,text:z67.string().min(1).max(2e3)})).min(1).max(512)}).nullable(),audio:z67.strictObject({algorithm:z67.literal("PCM_WINDOW_MIX_AAC_V1"),tracks:z67.array(source.extend({channels:z67.union([z67.literal(1),z67.literal(2)]),sampleCount:z67.int().positive().max(288e4),sourceIn:sample,sourceOut:sample,start:sample,count:sample,gain:z67.int().nonnegative().max(1e3),duck:z67.int().nonnegative().max(1e3),duckWindows:z67.array(window).max(512)})).min(1).max(266)}).nullable(),graphics:z67.array(source.extend({contentType:z67.enum(["image/png","image/webp"]),sourceWidth:dimension2,sourceHeight:dimension2,width:dimension2,height:dimension2,x:pixel,y:pixel,startFrame:frame,endFrame:frame,opacity:z67.number().min(.1).max(1)})).max(8),visual:z67.strictObject({policy:VisualLayerPolicySchema.optional(),composition:VisualLayerCompositionSchema,plans:z67.array(z67.strictObject({id:z67.uuid(),startFrame:frame,endFrame:frame,width:dimension2,height:dimension2,x:pixel,y:pixel,opacityPermille:z67.int().min(0).max(1e3)})).max(8)}).nullable()}).superRefine((r,ctx)=>{if(r.width%2||r.height%2||r.clips.some(c=>c.viewport.x+c.viewport.width>r.width||c.viewport.y+c.viewport.height>r.height||c.sourceOutMs<=c.sourceInMs)||r.audio?.tracks.some(t=>t.sourceIn>=t.sourceOut||t.sourceOut>t.sampleCount||t.start+t.count>r.totalFrames*1600))ctx.addIssue({code:"custom",message:"Invalid bounded execution geometry or sample window"})});import{z as z68}from"zod";var identity={deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema};var WorkspaceDeviceAuthoritySchema=z68.strictObject({...identity,authority:z68.literal("WORKSPACE_DEVICE_V1")});var LocalDeviceExecutionTargetSchema=z68.discriminatedUnion("kind",[WorkspaceDeviceAuthoritySchema.extend({kind:z68.literal("DEVICE")}),z68.strictObject({kind:z68.literal("SERVER")})]);var TenantDeviceTargetSchema=WorkspaceDeviceAuthoritySchema.extend({keyFingerprint:LocalDigestSchema});function sameDeviceAuthority(a,b){return a.deviceId===b.deviceId&&a.deviceRevision===b.deviceRevision&&a.authority===b.authority}var previewProfile=z69.strictObject({kind:z69.literal("ROUGH_CUT_PREVIEW_V1"),profileId:z69.literal("PREVIEW_H264_480P_V1"),contractDigest:LocalDigestSchema});var studioProfile=z69.strictObject({kind:z69.literal("STUDIO_MEDIA_V2"),profileId:z69.literal("STUDIO_MEDIA_V2"),contractDigest:LocalDigestSchema});var audioProfile=z69.strictObject({kind:z69.literal("AUDIO_MEDIA_V1"),profileId:z69.literal("AUDIO_MEDIA_V1"),contractDigest:LocalDigestSchema});var LocalExecutionProfileSchema=z69.discriminatedUnion("kind",[previewProfile,studioProfile,audioProfile]);var LocalToolchainSchema=z69.strictObject({platform:LocalDevicePlatformSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema,ffmpeg:z69.strictObject({version:z69.string().min(1).max(160),binaryDigest:LocalDigestSchema}),ffprobe:z69.strictObject({version:z69.string().min(1).max(160),binaryDigest:LocalDigestSchema}),profile:LocalExecutionProfileSchema,supported:z69.array(z69.strictObject({profile:LocalExecutionProfileSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema})).max(4).optional()});function selectLocalToolchain(raw,contractDigest){const parsed=LocalToolchainSchema.safeParse(raw);if(!parsed.success)return null;const value2=parsed.data;if(value2.profile.contractDigest===contractDigest){return value2.supported&&value2.profile.kind!=="AUDIO_MEDIA_V1"?{...value2,supported:value2.supported.filter(s=>s.profile.kind!=="AUDIO_MEDIA_V1")}:value2}const selected=value2.supported?.find(s=>s.profile.contractDigest===contractDigest);if(!selected)return null;const{supported,...base2}=value2;void supported;return LocalToolchainSchema.parse({...base2,...selected})}var frozen=LocalWorkScopeSchema.extend({protocol:z69.literal("NVS_LOCAL_WORK_V1"),operationId:OperationIdSchema,renderId:LocalIdSchema,productionRevision:LocalRevisionSchema,executionClass:z69.enum(["LIVE","TEST_ONLY"]),policy:LocalPlacementPolicySchema,profile:previewProfile,manifest:RoughCutManifestReaderSchema,manifestFingerprint:LocalDigestSchema,sources:z69.array(z69.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z69.int().positive(),contentType:z69.string().min(1).max(100)})).min(1).max(512)});var studio=frozen.extend({protocol:z69.literal("NVS_LOCAL_WORK_V2"),profile:studioProfile,manifest:z69.union([RoughCutManifestReaderSchema,FinalRenderManifestReaderSchema]),recipe:LocalMediaRecipeSchema,recipeFingerprint:LocalDigestSchema});var LocalFrozenWorkSchema=z69.discriminatedUnion("protocol",[frozen,studio]).superRefine((v,ctx)=>{const t=v.manifest.timeline;if(t.tenantId!==v.tenantId||t.projectId!==v.projectId||t.productionId!==v.productionId||t.executionClass!==v.executionClass)ctx.addIssue({code:"custom",message:"Frozen manifest scope/class mismatch"});if(v.protocol==="NVS_LOCAL_WORK_V2"&&(v.manifest.schemaVersion===3!==!!v.recipe.visual||v.manifest.schemaVersion===3&&v.manifest.profile.visualLayerPolicy!==(v.recipe.visual?.policy??"STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1")))ctx.addIssue({code:"custom",message:"Recipe must preserve the frozen visual policy"});if(new Set(v.sources.map(s=>s.representationId)).size!==v.sources.length)ctx.addIssue({code:"custom",message:"Duplicate source representation"});if(v.protocol==="NVS_LOCAL_WORK_V2"&&(v.recipe.width!==v.manifest.profile.width||v.recipe.height!==v.manifest.profile.height||v.recipe.totalFrames!==v.manifest.totalFrames||v.recipe.family==="FINAL_RENDER"!=="selection"in v.manifest))ctx.addIssue({code:"custom",message:"Recipe must match its native render family and geometry"})});var LocalLeaseBindingSchema=LocalWorkScopeSchema.extend({attemptId:LocalIdSchema,assignmentRevision:LocalRevisionSchema,workerId:z69.string().min(1).max(200),workFingerprint:LocalDigestSchema,toolchainFingerprint:LocalDigestSchema});var target=LocalDeviceExecutionTargetSchema;var LocalExecutionLeaseSchema=LocalLeaseBindingSchema.extend({target,issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema}).refine(v=>Date.parse(v.expiresAt)>Date.parse(v.issuedAt));var LocalWorkAssignmentSchema=z69.strictObject({work:LocalFrozenWorkSchema,lease:LocalExecutionLeaseSchema,toolchain:LocalToolchainSchema,tenantMediaValidation:z69.literal(true).optional()}).superRefine(({work,lease,toolchain,tenantMediaValidation},ctx)=>{if(["tenantId","projectId","productionId","runtimeJobId"].some(k=>work[k]!==lease[k]))ctx.addIssue({code:"custom",message:"Assignment work scope mismatch"});if(tenantMediaValidation&&(work.protocol!=="NVS_LOCAL_WORK_V2"||work.policy.mode!=="local-only"))ctx.addIssue({code:"custom",message:"Invalid tenant validation assignment"});const p=work.policy,t=lease.target;if(p.mode==="cloud-only"&&t.kind!=="SERVER"||p.mode==="local-only"&&t.kind!=="DEVICE"||t.kind==="DEVICE"&&(p.mode==="cloud-only"||p.deviceId!==t.deviceId))ctx.addIssue({code:"custom",message:"Assignment contradicts placement policy"});if(work.profile.contractDigest!==toolchain.profile.contractDigest)ctx.addIssue({code:"custom",message:"Unqualified execution profile"})});function checkProcessorDeclaration(enabled,kinds,context){if(enabled!==!!kinds?.length||kinds&&new Set(kinds).size!==kinds.length)context.addIssue({code:"custom",path:["processorCapabilities"],message:"Explicit unique processor capabilities must match processing enablement"})}var StartLocalPreviewSchema=RoughCutStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema,localProfile:z70.literal("STUDIO_MEDIA_V2").optional()});var LocalDeviceScopeSchema=z70.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema});var LocalDeviceSessionSchema=z70.strictObject({...LocalDeviceScopeSchema.shape,expiresAt:LocalTimeSchema,credential:z70.string().length(43).regex(/^[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var LocalDeviceHeartbeatSchema=LocalDeviceScopeSchema.extend({runtimeVersion:LocalPackageVersionSchema,toolchain:LocalToolchainSchema,available:z70.boolean(),maxConcurrentJobs:z70.int().min(1).max(2).optional(),validationProfileDigest:LocalDigestSchema.optional(),processorProfileDigest:LocalDigestSchema.optional(),localLibraryProfileDigest:LocalDigestSchema.optional(),macSpeechIdentity:MacSpeechIdentitySchema.optional(),cpuSpeech:CpuSpeechCapabilitySchema.optional(),whisperIdentity:LocalWhisperIdentitySchema.optional(),qwenIdentities:z70.array(QwenDeviceCredentialIdentitySchema).min(1).max(16).optional(),processorCapabilities:z70.array(TenantProcessorKindSchema).min(1).max(TenantProcessorKindSchema.options.length).optional()}).superRefine((value2,context)=>checkProcessorDeclaration(!!value2.processorProfileDigest,value2.processorCapabilities,context));var ClaimLocalPreviewSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema,deviceId:LocalIdSchema,tenantMediaValidation:z70.literal(true).optional()});var LocalOutputStageSchema=LocalLeaseBindingSchema.extend({uploadRequestId:LocalIdSchema,role:z70.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z70.int().positive().max(128*1024*1024)});var LocalOutputTicketSchema=z70.strictObject({receiptId:LocalIdSchema,role:z70.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z70.int().positive(),uploaded:z70.boolean()});var LocalSourceRequestSchema=LocalLeaseBindingSchema.extend({representationId:LocalIdSchema});var LocalProofChallengeRequestSchema=LocalDeviceScopeSchema.extend({deviceRevision:z70.int().positive()});var LocalPreviewPlacementViewSchema=z70.strictObject({target:z70.enum(["DEVICE","SERVER"]),reason:z70.enum(["LOCAL_AVAILABLE","CLOUD_ONLY","OFFLINE","UNQUALIFIED","BUSY","LEASE_RECOVERY"]),policy:LocalPlacementPolicySchema});var LocalDeviceTransportConfigurationSchema=z70.strictObject({endpoint:z70.string().url().max(2048),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:z70.int().positive(),privateKeyFile:z70.string().min(1).max(4096),platform:LocalDevicePlatformSchema,tenantMediaValidation:z70.literal(true).optional(),tenantMediaProcessing:z70.literal(true).optional(),processorCapabilities:z70.array(TenantProcessorKindSchema).min(1).max(TenantProcessorKindSchema.options.length).optional(),compositionBrowser:z70.string().min(1).max(4096).optional(),macSpeechIdentity:MacSpeechIdentitySchema.optional(),cpuSpeech:CpuSpeechCapabilitySchema.optional(),cpuSpeechTools:CpuSpeechToolSelectionSchema.optional(),whisperIdentity:LocalWhisperIdentitySchema.optional(),whisperTools:LocalWhisperToolSelectionSchema.optional(),qwenDeviceCredentials:z70.array(QwenDeviceCredentialSelectionSchema).max(16).optional(),qwenIdentities:LocalDeviceHeartbeatSchema.shape.qwenIdentities}).superRefine((value2,context)=>checkProcessorDeclaration(value2.tenantMediaProcessing===true,value2.processorCapabilities,context));var LocalPreviewAdmissionSchema=RoughCutAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var StartLocalFinalRenderSchema=FinalRenderStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema});var LocalFinalRenderAdmissionSchema=FinalRenderAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var LocalClaimReceiptSchema=z70.strictObject({found:z70.boolean(),assignment:LocalWorkAssignmentSchema.nullable()});var LocalWorkStateSchema=z70.strictObject({binding:LocalLeaseBindingSchema,status:z70.enum(["ACTIVE","FENCED","OUTCOME_UNKNOWN"]),assignment:LocalWorkAssignmentSchema.nullable()});import{z as z98}from"zod";import{z as z73}from"zod";import{z as z71}from"zod";var LocalRuntimeDescriptorSchema=z71.strictObject({protocol:z71.literal("NVS_RUNTIME_DESCRIPTOR_V1"),version:LocalPackageVersionSchema,node:z71.strictObject({major:z71.literal(24),minMinor:z71.literal(12)}),platform:LocalDevicePlatformSchema,ipcProtocol:z71.literal("NVS_LOCAL_IPC_V1"),workProtocol:z71.enum(["NVS_LOCAL_WORK_V1","NVS_LOCAL_WORK_V2"]),journalSchema:z71.literal(1),rendererDigest:LocalDigestSchema,profileDigest:LocalDigestSchema,compatibleRenderers:z71.array(z71.strictObject({rendererDigest:LocalDigestSchema,profileDigest:LocalDigestSchema})).max(4).optional()});var LocalReleaseAssetSchema=z71.strictObject({url:z71.string().url().max(2048),byteSize:z71.int().positive().max(256*1024*1024),sha512:z71.string().length(128).regex(/^[0-9a-f]{128}$/)});import{z as z72}from"zod";var RuntimeCaptionAssets={"NotoSansSC.ttf":LegacyCaptionRenderStyleSchema.shape.fontSha256.value,"NativeStudioSC-Regular.ttf":RegularCaptionRenderStyleSchema.shape.fontSha256.value,"OFL.txt":"092c580f54ee69841e94731e91f63f5d2d2a793550f4827cec485656e462f1bd"};var LocalComponentBytesSchema=z72.strictObject({byteSize:z72.int().positive().max(64*1024*1024),sha512:z72.string().length(128).regex(/^[0-9a-f]{128}$/)});var LocalRuntimeComponentSchema=LocalComponentBytesSchema.extend({protocol:z72.literal("NVS_PRODUCT_COMPONENT_V2"),version:LocalPackageVersionSchema,descriptor:LocalRuntimeDescriptorSchema.omit({platform:true}),resources:z72.strictObject({captions:LocalComponentBytesSchema})}).refine(v=>v.version===v.descriptor.version);var LocalSessionConnectorSchema=z73.strictObject({protocol:z73.literal("NVS_LOCAL_CONNECTOR_V1"),stateDirectory:z73.string().min(1).max(4096),credential:z73.string().length(43).regex(/^[A-Za-z0-9_-]{43}$/),expiresAt:LocalTimeSchema,tenantId:z73.uuid(),deviceId:z73.uuid()});var LocalManagementInventorySchema=z73.strictObject({runtimeRevision:z73.int().positive(),descriptor:LocalRuntimeDescriptorSchema,activeProcesses:z73.int().nonnegative(),pendingExecutions:z73.int().nonnegative(),pendingRequests:z73.int().nonnegative(),pendingRenderers:z73.array(LocalDigestSchema).max(64)});var LocalReleaseSchema=z73.strictObject({descriptor:LocalRuntimeDescriptorSchema,package:LocalReleaseAssetSchema,tools:z73.strictObject({ffmpeg:LocalReleaseAssetSchema.extend({sha256:LocalDigestSchema}),ffprobe:LocalReleaseAssetSchema.extend({sha256:LocalDigestSchema})}).nullable(),resources:z73.strictObject({captions:LocalReleaseAssetSchema.extend({byteSize:LocalComponentBytesSchema.shape.byteSize})}).optional()});var LocalBundledReleaseSchema=LocalReleaseSchema.extend({package:LocalComponentBytesSchema.extend({source:z73.literal("CLI")})});var LocalReleaseCatalogueSchema=z73.strictObject({protocol:z73.literal("NVS_LOCAL_RELEASE_CATALOGUE_V1"),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema,releases:z73.array(LocalReleaseSchema).min(1).max(32)}).refine(v=>Date.parse(v.expiresAt)>Date.parse(v.issuedAt)&&Date.parse(v.expiresAt)-Date.parse(v.issuedAt)<=7*864e5&&new Set(v.releases.map(r=>[r.descriptor.version,r.descriptor.platform.os,r.descriptor.platform.architecture].join(":"))).size===v.releases.length);var LocalSignedCatalogueSchema=z73.strictObject({catalogue:LocalReleaseCatalogueSchema,signature:z73.string().length(86).regex(/^[A-Za-z0-9_-]{85}[AQgw]$/)});var LocalToolChoiceSchema=z73.discriminatedUnion("mode",[z73.strictObject({mode:z73.literal("MANAGED"),cpuSpeech:CpuSpeechInstallationSchema.optional(),reuseMedia:LocalManagedMediaReuseSchema.optional()}),LocalInstalledToolSelectionSchema.extend({captionAssetsDirectory:z73.string().min(1).max(4096).optional()})]);var LocalUpdatePlanSchema=z73.strictObject({protocol:z73.literal("NVS_LOCAL_UPDATE_PLAN_V1"),planId:LocalIdSchema,installationRevision:z73.int().nonnegative(),runtimeRevision:z73.int().positive().nullable(),catalogueFingerprint:LocalDigestSchema.nullable(),trustFingerprint:LocalDigestSchema.optional(),release:z73.union([LocalReleaseSchema,LocalBundledReleaseSchema]),toolSelection:LocalToolChoiceSchema.optional(),fingerprint:LocalDigestSchema,createdAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var LocalClientNextActionSchema=z73.strictObject({surface:z73.enum(["CLI","LOCAL_IPC","REMOTE"]),operation:z73.enum(["runtime.status","local.configure","local.install","local.start","local.connect","local.grant","local.status","local.doctor","local.stop","local.update.check","local.update.prepare","local.update.apply","local.update.reconcile","execution.inspect","rough_cut_get","operation_get"]),availability:z73.enum(["AVAILABLE","BLOCKED"]),reason:z73.enum(["READY","INSTALL_REQUIRED","AUTHORIZATION_REQUIRED","VERSION_INCOMPATIBLE","UPDATE_AVAILABLE","RECOVERY_REQUIRED","USER_APPROVAL_REQUIRED","TRUST_REQUIRED","UNAVAILABLE"])});import{z as z97}from"zod";import{z as z74}from"zod";var LocalOfflineSnapshotSchema=z74.strictObject({projectId:z74.uuid(),title:z74.string().min(1).max(200),savedAt:LocalTimeSchema,expiresAt:LocalTimeSchema,productions:z74.array(z74.strictObject({id:z74.uuid(),title:z74.string().max(200)})).max(40),possiblyTruncated:z74.boolean()}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=8192);var text=z74.string().max(4e3).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=8192);var LocalOfflineCallSchema=z74.discriminatedUnion("action",[z74.strictObject({action:z74.enum(["list","forget"]),key:LocalDigestSchema}),z74.strictObject({action:z74.literal("retain"),key:LocalDigestSchema,snapshot:LocalOfflineSnapshotSchema}),z74.strictObject({action:z74.literal("draft"),key:LocalDigestSchema,projectId:z74.uuid(),text,expectedRevision:z74.int().nonnegative()})]);var LocalOfflinePageSchema=z74.strictObject({historical:z74.literal(true),items:z74.array(z74.strictObject({snapshot:LocalOfflineSnapshotSchema,draft:z74.strictObject({text,revision:z74.int().nonnegative()})})).max(3)});import{z as z85}from"zod";import{z as z83}from"zod";import{z as z75}from"zod";var TemporalEvidenceReferenceSchema=z75.strictObject({evidenceId:z75.uuid(),frameSetArtifactId:z75.uuid(),contactSheetArtifactId:z75.uuid(),manifestRepresentationId:z75.uuid(),sheetRepresentationId:z75.uuid(),planFingerprint:z75.string().regex(/^[0-9a-f]{64}$/),sourceArtifactId:z75.uuid(),sourceRepresentationId:z75.uuid(),sourceChecksumSha256:z75.string().regex(/^[0-9a-f]{64}$/),timestampsMs:z75.array(z75.number().nonnegative().max(6e4)).min(1).max(64),executionClass:z75.enum(["LIVE","TEST_ONLY"])});var TemporalEvidenceIdsSchema=z75.array(z75.uuid()).min(1).max(8).refine(v=>new Set(v).size===v.length,"Evidence references must be unique");import{z as z82}from"zod";import{z as z77}from"zod";import{z as z76}from"zod";var ListeningEvidenceIdsSchema=z76.array(z76.string().min(1).max(100)).max(64);var ListeningEvidenceSchema=z76.strictObject({id:z76.string().trim().min(1).max(100),kind:z76.enum(["AUDIO_LISTENING","VIDEO_WITH_AUDIO_PLAYBACK"]),media:z76.strictObject({artifactId:z76.uuid(),representationId:z76.uuid(),checksumSha256:z76.string().regex(/^[0-9a-f]{64}$/)}),coverage:z76.array(z76.strictObject({startMs:z76.int().nonnegative().max(6e4),endMs:z76.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs)).min(1).max(200),producer:z76.string().trim().min(1).max(200)});var ListeningEvidenceSetSchema=z76.array(ListeningEvidenceSchema).max(64).refine(v=>new Set(v.map(e=>e.id)).size===v.length);var sha10=z77.string().regex(/^[a-f0-9]{64}$/);var VoiceListeningIntervalSchema=ListeningEvidenceSchema.shape.coverage.element;var VoiceExpectationSchema=z77.strictObject({voiceProfile:VoiceProfileRefSchema,referenceId:z77.uuid()});var VoiceRuleTargetsSchema=z77.discriminatedUnion("kind",[z77.strictObject({kind:z77.literal("VOICEOVER")}),z77.strictObject({kind:z77.literal("SOUND_CUES"),cueIds:z77.array(z77.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)).min(1).max(64).refine(ids=>new Set(ids).size===ids.length)})]);var VoiceConsistencyReasonSchema=z77.enum(["NO_SOURCE","VOICE_UNAVAILABLE","REFERENCE_CHANGED","AUDIO_UNAVAILABLE","IDENTITY_MISMATCH","NO_COMPARISON","COMPARISON_NOT_MATCHED","COMPARISON_STALE","TEST_ONLY"]);var VoiceRequirementGateSchema=z77.strictObject({qualified:z77.boolean(),evidenceFingerprint:sha10,listeningIntervals:z77.array(VoiceListeningIntervalSchema).min(1).max(264),sourceAudioVersionIds:z77.array(z77.uuid()).max(65),reasons:z77.array(VoiceConsistencyReasonSchema).max(9)}).refine(v=>v.qualified===(v.reasons.length===0)&&(!v.qualified||v.sourceAudioVersionIds.length>0));var VoiceSourceEvidenceSchema=z77.strictObject({audioVersionId:z77.uuid(),voiceProfile:VoiceProfileRefSchema.nullable(),referenceId:z77.uuid().nullable(),comparisonId:z77.uuid().nullable(),comparisonVersion:z77.int().nonnegative(),comparisonFingerprint:sha10.nullable(),identityResult:z77.enum(["MATCH","DIFFERENT","UNDETERMINED"]).nullable(),current:z77.boolean(),executionClass:z77.enum(["LIVE","TEST_ONLY"]).nullable(),reasons:z77.array(VoiceConsistencyReasonSchema).max(9)});var VoiceExpectationEvidenceSchema=VoiceExpectationSchema.extend({current:z77.boolean(),executionClass:z77.enum(["LIVE","TEST_ONLY"]).nullable(),reasons:z77.array(VoiceConsistencyReasonSchema).max(9)});var ProductionVoiceEvidenceSchema=z77.strictObject({expectations:z77.array(VoiceExpectationEvidenceSchema).max(16),sources:z77.array(VoiceSourceEvidenceSchema).max(65)});import{z as z78}from"zod";var sha11=z78.string().regex(/^[0-9a-f]{64}$/);var CompositionFindingLocalitySchema=z78.strictObject({schemaVersion:z78.literal(1),sourceKind:z78.literal("CODE"),role:z78.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),compositionId:z78.uuid(),compositionVersionId:z78.uuid(),compositionVersion:z78.int().positive(),compositionFingerprint:sha11,renderId:z78.uuid(),renderManifestFingerprint:sha11,artifactId:z78.uuid(),representationId:z78.uuid(),checksumSha256:sha11,clipOrdinal:z78.int().min(1).max(200).nullable(),visualLayerId:z78.uuid().nullable(),sourceInFrame:z78.int().min(0).max(359),sourceOutFrame:z78.int().min(1).max(360),mapping:z78.literal("INTERSECTING_NATIVE_30FPS_FRAME_CELLS")}).superRefine((v,ctx)=>{if(v.sourceOutFrame<=v.sourceInFrame||(v.role==="PRIMARY_VISUAL"?v.clipOrdinal===null||v.visualLayerId!==null:v.visualLayerId===null||v.clipOrdinal!==null))ctx.addIssue({code:"custom",message:"CODE locality requires an exact occurrence and advancing local frame interval"})});import{z as z79}from"zod";var CanonicalFactSchema=z79.strictObject({key:z79.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/),value:z79.string().trim().min(1).max(300),sourceArtifactId:ArtifactIdSchema,evidence:z79.discriminatedUnion("kind",[z79.strictObject({kind:z79.literal("JSON_POINTER"),pointer:z79.string().startsWith("/").max(200)}),z79.strictObject({kind:z79.literal("EXACT_TEXT_LINE")})])});var BriefContentSchema=z79.strictObject({objective:z79.string().trim().min(1).max(1e3),productPresentationGoal:z79.string().trim().min(1).max(1e3),audience:z79.string().trim().min(1).max(300).optional(),styleTone:z79.string().trim().min(1).max(300).optional(),callToAction:z79.string().trim().min(1).max(300).optional(),targetDurationSeconds:z79.int().min(30).max(60),aspectRatio:z79.enum(["16:9","9:16"]),outputProfile:DeliveryOutputProfileSchema,canonicalFacts:z79.array(CanonicalFactSchema).max(32).default([])});var AcceptBriefRequestSchema=z79.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z79.int().positive(),revisionReason:z79.string().trim().min(1).max(1e3).optional(),sourceArtifactIds:z79.array(ArtifactIdSchema).max(20).default([]),content:BriefContentSchema});var BriefSourceReferenceSchema=z79.strictObject({artifactId:ArtifactIdSchema,checksumSha256:z79.string().regex(/^[0-9a-f]{64}$/)});var BriefVersionSchema=z79.strictObject({id:BriefVersionIdSchema,briefId:BriefIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z79.int().positive(),content:BriefContentSchema,sources:z79.array(BriefSourceReferenceSchema).min(1).max(20),createdByPrincipalId:PrincipalIdSchema,createdAt:z79.iso.datetime({offset:true})});var AcceptBriefResultSchema=z79.discriminatedUnion("semanticStatus",[z79.strictObject({semanticStatus:z79.literal("SUCCESS"),briefVersion:BriefVersionSchema,productionRevision:z79.int().positive(),activeBriefVersion:z79.int().positive()}),z79.strictObject({semanticStatus:z79.literal("NEEDS_INPUT"),missingFacts:z79.array(z79.enum(["PRODUCT_INFORMATION_SOURCE","PRODUCT_NAME"])).min(1)})]);import{z as z80}from"zod";var StoryFactKeySchema=z80.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/);var StoryFactClaimSchema=z80.strictObject({key:StoryFactKeySchema,value:z80.string().trim().min(1).max(300)});var StoryBeatSchema=z80.strictObject({summary:z80.string().trim().min(1).max(600),sceneRequirements:z80.array(z80.string().trim().min(1).max(300)).max(8).default([])});var StoryContentSchema=z80.strictObject({narrativeIntent:z80.string().trim().min(1).max(2e3),beats:z80.array(StoryBeatSchema).min(1).max(24),factualClaims:z80.array(StoryFactClaimSchema).max(32).default([])});var AcceptStoryRequestSchema=z80.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z80.int().positive(),expectedBriefVersion:z80.int().positive(),revisionReason:z80.string().trim().min(1).max(1e3).optional(),idempotencyKey:z80.string().trim().min(1).max(200),content:StoryContentSchema});var StoryVersionSchema=z80.strictObject({id:StoryVersionIdSchema,storyId:StoryIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z80.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z80.int().positive(),content:StoryContentSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z80.iso.datetime({offset:true})});var AcceptStoryResultSchema=z80.discriminatedUnion("semanticStatus",[z80.strictObject({semanticStatus:z80.literal("SUCCESS"),storyVersion:StoryVersionSchema,productionRevision:z80.int().positive(),activeStoryVersion:z80.int().positive()}),z80.strictObject({semanticStatus:z80.literal("NEEDS_INPUT"),missingPrerequisites:z80.array(z80.literal("ACTIVE_BRIEF")).min(1)})]);import{z as z81}from"zod";var ConsistencyFamilySchema=z81.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","BOUNDARY_CONTINUITY","STYLE","VOICE_IDENTITY"]);var ConsistencyEnforcementSchema=z81.enum(["LOCKED","REQUIRED","PREFERRED","FREE"]);var ConsistencyMasterReferenceSchema=z81.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z81.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z81.string().regex(/^[0-9a-f]{64}$/),contentType:z81.enum(["image/png","image/jpeg","image/webp","audio/wav"])});var Fact=z81.strictObject({dimension:z81.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),value:z81.string().trim().min(1).max(1e3)});var ConsistencySubjectSchema=z81.strictObject({id:z81.uuid(),kind:z81.enum(["CHARACTER","VOICE"]),displayName:z81.string().trim().min(1).max(200),facts:z81.array(Fact).min(1).max(32),master:ConsistencyMasterReferenceSchema,voiceExpectation:VoiceExpectationSchema.optional()}).superRefine((s,c)=>{if(new Set(s.facts.map(f=>f.dimension)).size!==s.facts.length)c.addIssue({code:"custom",message:"Canonical subject dimensions must be unique"});if(s.kind==="VOICE"!==(s.master.contentType==="audio/wav"))c.addIssue({code:"custom",message:"Character requires an image master; Voice requires audio"});if(s.voiceExpectation&&s.kind!=="VOICE")c.addIssue({code:"custom",message:"Only Voice subjects carry a voice expectation"})});var ConsistencyRuleScopeSchema=z81.discriminatedUnion("kind",[z81.strictObject({kind:z81.literal("PROJECT")}),z81.strictObject({kind:z81.literal("PRODUCTION")}),z81.strictObject({kind:z81.literal("SCENE"),id:z81.uuid()}),z81.strictObject({kind:z81.literal("SHOT"),id:z81.uuid()}),z81.strictObject({kind:z81.literal("CONTINUITY_EDGE"),id:z81.uuid()})]);var ConsistencyRuleSchema=z81.strictObject({voiceTargets:VoiceRuleTargetsSchema.optional(),reviewScales:z81.array(ConsistencyReviewScaleSchema).min(1).max(3).refine(s=>new Set(s).size===s.length,"Review scales must be unique").optional(),continuity:ContinuityExpectationSchema.optional(),id:z81.uuid(),family:ConsistencyFamilySchema,subjectId:z81.uuid().nullable(),dimension:z81.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),scope:ConsistencyRuleScopeSchema,enforcement:ConsistencyEnforcementSchema,expected:z81.string().trim().min(1).max(1e3).nullable(),referenceMode:z81.enum(["NONE","SUBJECT_MASTER","EXACT"]),reference:ConsistencyMasterReferenceSchema.optional(),override:z81.strictObject({priorRuleId:z81.uuid(),reason:z81.string().trim().min(1).max(1e3)}).optional(),transition:z81.strictObject({edgeId:z81.uuid(),from:z81.string().trim().min(1).max(1e3),to:z81.string().trim().min(1).max(1e3),reason:z81.string().trim().min(1).max(1e3)}).optional()}).superRefine((r,c)=>{const invalid=message=>c.addIssue({code:"custom",message});if(r.continuity&&(r.enforcement==="FREE"||r.family==="VOICE_IDENTITY"))invalid("FREE/Voice rules cannot create visual state/time obligations");if(r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE"&&(!r.voiceTargets||r.referenceMode!=="SUBJECT_MASTER"||r.reviewScales?.length!==1||r.reviewScales[0]!=="PRODUCTION"))invalid("Active Voice identity requires explicit audio targets, subject reference and full-production review");if(r.voiceTargets&&(r.family!=="VOICE_IDENTITY"||r.enforcement==="FREE"))invalid("Only active Voice rules select audio targets");if(r.enforcement==="FREE"!==(r.expected===null))invalid("FREE has no expected obligation; other enforcement requires an expectation");if(r.enforcement==="FREE"&&r.referenceMode!=="NONE")invalid("FREE cannot require reference conditioning");if(r.referenceMode==="EXACT"!==(r.reference!==void 0))invalid("Only EXACT reference mode carries an exact reference");if(r.referenceMode==="SUBJECT_MASTER"&&!r.subjectId)invalid("SUBJECT_MASTER requires an exact canonical subject");if(["CHARACTER_IDENTITY","WARDROBE","VOICE_IDENTITY"].includes(r.family)&&!r.subjectId)invalid("Character, Wardrobe and Voice obligations require an exact subject");if(r.family==="CHARACTER_IDENTITY"&&["LOCKED","REQUIRED"].includes(r.enforcement)&&r.referenceMode==="NONE")invalid("Mandatory Character identity requires concrete identity evidence");if(r.transition&&(r.family!=="WARDROBE"||r.transition.to!==r.expected||!r.override))invalid("A planned Wardrobe transition must name the changed inherited rule and new expectation")});var ConsistencyProfileContentSchema=z81.strictObject({subjects:z81.array(ConsistencySubjectSchema).max(32),rules:z81.array(ConsistencyRuleSchema).max(256)}).superRefine((p,c)=>{const invalid=message=>c.addIssue({code:"custom",message});if(new Set(p.subjects.map(s=>s.id)).size!==p.subjects.length||new Set(p.rules.map(r=>r.id)).size!==p.rules.length)invalid("Consistency subjects and rules require distinct stable IDs");if(p.rules.filter(r=>r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE").length>16)invalid("Voice obligations exceed their bounded rule budget");for(const r of p.rules){const s=p.subjects.find(s2=>s2.id===r.subjectId);if(r.subjectId&&!s)invalid("Rule names an unknown canonical subject");if(r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE"&&!s?.voiceExpectation)invalid("Active Voice identity requires an exact approved voice expectation");if(s&&r.family==="VOICE_IDENTITY"!==(s.kind==="VOICE")&&["CHARACTER_IDENTITY","WARDROBE","VOICE_IDENTITY"].includes(r.family))invalid("Rule family and canonical subject kind disagree");if(r.override&&!p.rules.some(prior=>prior.id===r.override.priorRuleId))invalid("An override must name an existing inherited rule");if(r.reference&&r.family==="VOICE_IDENTITY"!==(r.reference.contentType==="audio/wav"))invalid("Visual obligations cannot use audio and Voice obligations cannot use images")}});var ConsistencyProfileScopeSchema=z81.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var ConsistencyProfileVersionQuerySchema=ConsistencyProfileScopeSchema.extend({profileId:z81.uuid()});var ConfigureConsistencyProfileSchema=ConsistencyProfileScopeSchema.extend({expectedProductionRevision:z81.int().positive(),expectedProfileVersion:z81.int().nonnegative(),content:ConsistencyProfileContentSchema,reason:z81.string().trim().min(1).max(2e3),idempotencyKey:z81.string().trim().min(1).max(200)});var ConsistencyProfileVersionSchema=ConsistencyProfileScopeSchema.extend({id:z81.uuid(),projectId:ProjectIdSchema,version:z81.int().positive(),previousVersionId:z81.uuid().nullable(),content:ConsistencyProfileContentSchema,fingerprint:z81.string().regex(/^[0-9a-f]{64}$/),reason:z81.string().trim().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z81.iso.datetime({offset:true})});var ConsistencyProfileViewSchema=ConsistencyProfileScopeSchema.extend({productionRevision:z81.int().positive(),current:ConsistencyProfileVersionSchema.nullable()});var ConsistencyProfileReceiptSchema=z81.strictObject({semanticStatus:z81.literal("SUCCESS"),profile:ConsistencyProfileVersionSchema,productionRevision:z81.int().positive()});var sha12=z82.string().regex(/^[0-9a-f]{64}$/);var RoughCutReviewScopeSchema=TimelineScopeSchema.extend({renderId:z82.uuid()});var ReviewIntervalSchema=z82.strictObject({startMs:z82.int().nonnegative().max(6e4),endMs:z82.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Review interval must advance");var RoughCutRequirementSchema=z82.strictObject({voiceIdentity:VoiceRequirementGateSchema.optional(),continuity:ContinuityExpectationSchema.optional(),consistencyScale:ConsistencyReviewScaleSchema.optional(),consistencyFamily:z82.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","BOUNDARY_CONTINUITY","VOICE_IDENTITY"]).optional(),consistencySubject:ConsistencySubjectSchema.optional(),consistencyReference:ConsistencyMasterReferenceSchema.optional(),key:z82.string().min(1).max(220),dimension:z82.enum(["PRODUCT_PRESENTATION","CANONICAL_FACT","NARRATIVE","PACING","REPETITION","STYLE","TECHNICAL","TRANSITION"]),expected:z82.string().min(1).max(4e3),enforcement:z82.enum(["LOCKED","REQUIRED","PREFERRED"]),scope:z82.enum(["PRODUCTION","TRANSITION"]),interval:ReviewIntervalSchema,shotIds:z82.array(z82.uuid()).min(1).max(200)});var RoughCutObservationSchema=z82.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z82.string().min(1).max(220),status:z82.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z82.enum(["CLEAR","UNCERTAIN"]),observed:z82.string().trim().min(1).max(1800),interval:ReviewIntervalSchema,location:z82.strictObject({interval:ReviewIntervalSchema,shotIds:z82.array(z82.uuid()).min(1).max(200)}).optional()});var RoughCutInspectionSchema=z82.strictObject({actor:z82.enum(["HUMAN","EXTERNAL_AGENT"]),method:z82.literal("FULL_TEMPORAL_INSPECTION"),coverage:z82.array(ReviewIntervalSchema).min(1).max(200)});var RoughCutReviewBasisSchema=z82.strictObject({voiceEvidence:ProductionVoiceEvidenceSchema.optional(),consistencyRequirements:z82.array(RoughCutRequirementSchema).max(256).optional(),artifactId:z82.uuid(),representationId:z82.uuid(),checksumSha256:sha12,manifestFingerprint:sha12,manifest:RoughCutManifestReaderSchema,brief:BriefVersionSchema,story:StoryVersionSchema});var RecordRoughCutReviewSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),artifactId:z82.uuid(),representationId:z82.uuid(),checksumSha256:sha12,basisFingerprint:sha12,expectedProductionRevision:z82.int().positive(),expectedReviewVersion:z82.int().nonnegative(),idempotencyKey:z82.string().trim().min(1).max(200),inspection:RoughCutInspectionSchema,observations:z82.array(RoughCutObservationSchema).min(1).max(300),summary:z82.string().trim().min(1).max(2500)});var RoughCutReviewRecordSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z82.uuid(),projectId:ProjectIdSchema,version:z82.int().positive(),kind:z82.literal("PRODUCTION_REVIEW_2"),lifecycle:z82.literal("COMPLETED"),evaluatorVersion:z82.literal("production-review-v1"),basis:RoughCutReviewBasisSchema,basisFingerprint:sha12,executionClass:z82.enum(["LIVE","TEST_ONLY"]),technical:RoughCutTechnicalSchema,durationMs:z82.int().min(3e4).max(6e4),requirements:z82.array(RoughCutRequirementSchema).min(1).max(300),inspection:RoughCutInspectionSchema,observations:z82.array(RoughCutObservationSchema).min(1).max(300),result:z82.enum(["PASS","WARNING","FAIL"]),blockingKeys:z82.array(z82.string()).max(300),warningKeys:z82.array(z82.string()).max(300),summary:z82.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z82.iso.datetime({offset:true})});var RoughCutReviewTargetSchema=RoughCutReviewScopeSchema.extend({temporalEvidence:z82.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,productionRevision:z82.int().positive(),productionRunnable:z82.boolean(),executionClass:z82.enum(["LIVE","TEST_ONLY"]),freshness:z82.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z82.array(z82.string()).max(18),inspectable:z82.boolean(),durationMs:z82.int().min(3e4).max(6e4),basis:RoughCutReviewBasisSchema,basisFingerprint:sha12,technical:RoughCutTechnicalSchema,requirements:z82.array(RoughCutRequirementSchema).min(1).max(300),latestReview:RoughCutReviewRecordSchema.nullable(),reviewVersion:z82.int().nonnegative(),finalReadyVersion:z82.int().nonnegative()});var RoughCutFindingSchema=RoughCutReviewScopeSchema.extend({compositionLocality:z82.array(CompositionFindingLocalitySchema).min(1).max(208).optional(),id:z82.uuid(),projectId:ProjectIdSchema,reviewId:z82.uuid(),reviewVersion:z82.int().positive(),basisFingerprint:sha12,artifactId:z82.uuid(),timelineVersionId:z82.uuid(),requirement:RoughCutRequirementSchema,observation:RoughCutObservationSchema,blocking:z82.boolean(),severity:z82.enum(["BLOCKING","WARNING"]),remediation:z82.enum(["REVISE_PRODUCTION","REVISE_TRANSITION","CORRECT_CANONICAL_CONTRADICTION"]),affectedScope:z82.strictObject({kind:z82.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z82.array(z82.uuid()).min(1).max(200)}),initialLifecycle:z82.literal("OPEN"),createdAt:z82.iso.datetime({offset:true})});var RoughCutFindingViewSchema=RoughCutFindingSchema.extend({lifecycle:z82.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","WAIVED","SUPERSEDED"]),proofReviewId:z82.uuid().nullable(),proofDecisionId:z82.uuid().nullable()});var RoughCutReviewQuerySchema=RoughCutReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutReviewPageSchema=z82.strictObject({items:z82.array(RoughCutReviewRecordSchema),page:QueryPageInfoSchema});var RoughCutFindingQuerySchema=TimelineScopeSchema.extend({renderId:z82.uuid().optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutFindingGetSchema=TimelineScopeSchema.extend({findingId:z82.uuid()});var RoughCutFindingPageSchema=z82.strictObject({items:z82.array(RoughCutFindingViewSchema),page:QueryPageInfoSchema});var RoughCutReviewReceiptSchema=z82.strictObject({semanticStatus:z82.literal("SUCCESS"),review:RoughCutReviewRecordSchema,findingIds:z82.array(z82.uuid()).max(300),productionRevision:z82.int().positive()});var ReviewEvidenceKeySchema=z83.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ReviewEvidenceMediaSchema=z83.strictObject({artifactId:z83.uuid(),representationId:z83.uuid(),checksumSha256:z83.string().regex(/^[0-9a-f]{64}$/)});var common={id:ReviewEvidenceKeySchema,label:z83.string().trim().min(1).max(200),producer:z83.enum(["EXTERNAL_AGENT_HOST","HUMAN","VLM"]),media:ReviewEvidenceMediaSchema};var ReviewIntelligenceEvidenceSchema=z83.discriminatedUnion("kind",[z83.strictObject({...common,kind:z83.literal("METADATA")}),z83.strictObject({...common,kind:z83.literal("IMAGE_PIXELS")}),z83.strictObject({...common,kind:z83.literal("REGISTERED_TEMPORAL_FRAMES"),reference:TemporalEvidenceReferenceSchema}),z83.strictObject({...common,kind:z83.literal("VIDEO_PLAYBACK"),coverage:z83.array(ReviewIntervalSchema).min(1).max(200)}),z83.strictObject({...common,kind:z83.literal("AUDIO_LISTENING"),coverage:z83.array(ReviewIntervalSchema).min(1).max(200)}),z83.strictObject({...common,kind:z83.literal("VIDEO_WITH_AUDIO_PLAYBACK"),coverage:z83.array(ReviewIntervalSchema).min(1).max(200)}),z83.strictObject({...common,kind:z83.literal("VIDEO_FRAMES"),timestampsMs:z83.array(z83.number().nonnegative().max(6e4)).min(1).max(64)})]);import{z as z84}from"zod";var QualifiedLocalAgentVersionSchema=z84.enum(["0.164.0","0.165.0"]);var LocalAgentGrantSchema=z84.strictObject({protocol:z84.literal("NVS_CODEX_REVIEW_GRANT_V1"),binary:z84.string().min(1).max(4096).refine(v=>/^(?:\/|[A-Za-z]:[\\/])/.test(v)),binaryDigest:z84.string().regex(/^[a-f0-9]{64}$/),version:QualifiedLocalAgentVersionSchema,model:z84.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/),reasoningEffort:z84.enum(["low","medium","high","xhigh"]).optional(),reviewerLabel:z84.string().trim().min(1).max(100),inference:z84.literal("REMOTE_OPENAI"),remoteUseApproved:z84.literal(true),imageDisclosureApproved:z84.literal(true).optional(),mediaDisclosureApproved:z84.literal(true).optional(),projects:z84.array(LocalProjectScopeSchema).min(1).max(100),expiresAt:z84.iso.datetime({offset:true})});var LocalAgentMediaInputSchema=z85.strictObject({profile:z85.literal("NVS_AGENT_DERIVED_EVIDENCE_V1"),contentType:z85.enum(["image/png","image/jpeg","image/webp","video/mp4"]),byteSize:z85.int().positive().max(134217728),width:z85.int().positive().max(4096),height:z85.int().positive().max(4096),durationMs:z85.int().positive().max(6e4).optional(),frameRate:z85.union([z85.literal(24),z85.literal(30)]).optional(),hasAudio:z85.boolean().optional()}).refine(v=>v.contentType==="video/mp4"?!!v.durationMs&&!!v.frameRate:!v.durationMs&&!v.frameRate&&v.hasAudio===void 0);var sha13=z85.string().regex(/^[a-f0-9]{64}$/);var LocalAgentEvidenceReceiptSchema=z85.strictObject({protocol:z85.literal("NVS_AGENT_DERIVED_EVIDENCE_V1"),draftId:z85.uuid(),media:ReviewEvidenceMediaSchema,ffmpegDigest:sha13,ffprobeDigest:sha13,attachment:z85.strictObject({checksumSha256:sha13,byteSize:z85.int().positive().max(8388608),width:z85.int().positive().max(4096),height:z85.int().positive().max(4096)}),timestampsMs:z85.array(z85.number().nonnegative().max(6e4)).max(6),audio:z85.strictObject({sampleRateHz:z85.literal(48e3),channels:z85.literal(1),samples:z85.int().positive().max(2881024),peak:z85.number().min(0).max(1),rms:z85.number().min(0).max(1),clippedSamples:z85.int().nonnegative().max(2881024)}).nullable(),limitations:z85.tuple([z85.literal("SAMPLED_FRAMES_ARE_NOT_FULL_PLAYBACK"),z85.literal("AUDIO_STATISTICS_ARE_NOT_LISTENING_OR_TRANSCRIPTION")])});var LocalAgentDiscoverySchema=z85.strictObject({candidate:z85.strictObject({binary:z85.string().min(1).max(4096),binaryDigest:sha13,version:z85.string().regex(/^\d+\.\d+\.\d+$/),qualified:z85.boolean()}).nullable(),configured:LocalAgentGrantSchema.nullable()});import{z as z86}from"zod";var LocalResourcePolicySchema=z86.strictObject({acceptNewWork:z86.boolean().default(true),mode:z86.enum(["CONTINUOUS","IDLE_ONLY"]).default("CONTINUOUS"),idleAfterSeconds:z86.int().min(30).max(3600).default(300),maxConcurrentJobs:z86.int().min(1).max(2).default(1),cpuCores:z86.union([z86.literal(1),z86.literal(2)]).default(2),memoryMiB:z86.int().min(512).max(4096).default(4096),cacheQuotaBytes:z86.int().min(512*1024*1024).max(32*1024*1024*1024).default(1024*1024*1024)});var LocalResourceSettingsSchema=z86.strictObject({revision:z86.int().nonnegative(),policy:LocalResourcePolicySchema});var LocalExecutionProgressSchema=z86.strictObject({stage:z86.enum(["WAITING","DOWNLOADING","EXECUTING","UPLOADING","AWAITING_ACCEPTANCE","COMPLETE","RECOVERY_REQUIRED","FENCED"]),downloadedBytes:z86.int().nonnegative(),sourceBytes:z86.int().nonnegative(),uploadedBytes:z86.int().nonnegative(),outputBytes:z86.int().nonnegative(),lastError:z86.strictObject({code:z86.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),observedAt:LocalTimeSchema}).nullable()});var LocalStorageInspectionSchema=z86.strictObject({cacheBytes:z86.int().nonnegative(),protectedBytes:z86.int().nonnegative(),reclaimableBytes:z86.int().nonnegative(),transferBytes:z86.int().nonnegative(),journalBytes:z86.int().nonnegative(),reviewBytes:z86.int().nonnegative().optional(),ownerStagingBytes:z86.int().nonnegative().optional(),availableDiskBytes:z86.int().nonnegative(),quotaBytes:z86.int().positive(),overQuota:z86.boolean()});var LocalWorkspaceInspectionSchema=z86.strictObject({settings:LocalResourceSettingsSchema,storage:LocalStorageInspectionSchema,scheduling:z86.strictObject({state:z86.enum(["READY","PAUSED","WAITING_FOR_IDLE","AT_CAPACITY","DRAINING"]),activeJobs:z86.int().nonnegative(),idleObservationCurrent:z86.boolean()})});var LocalDiagnosticsSchema=z86.strictObject({protocol:z86.literal("NVS_LOCAL_DIAGNOSTICS_V1"),createdAt:LocalTimeSchema,runtimeVersion:z86.string().min(1).max(80),runtimeRevision:LocalRevisionSchema,settings:LocalResourceSettingsSchema,storage:LocalStorageInspectionSchema,recordCounts:z86.record(z86.string().regex(/^[A-Z_]{1,40}$/),z86.int().nonnegative()),failures:z86.array(z86.strictObject({taskFingerprint:z86.string().regex(/^[a-f0-9]{64}$/),code:z86.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),observedAt:LocalTimeSchema})).max(32)});import{z as z96}from"zod";var MAX_SHOT_REVIEW_REQUIREMENTS=2200;import{z as z87}from"zod";var ObservationScopeSchema=z87.strictObject({tenantId:z87.uuid(),productionId:z87.uuid()});var audioSourceRequest=z87.strictObject({kind:z87.literal("AUDIO"),media:ReviewEvidenceMediaSchema,versionId:z87.uuid(),purpose:z87.enum(["VOICEOVER","MUSIC"])});var ObservationSourceRequestSchema=z87.discriminatedUnion("kind",[audioSourceRequest,z87.strictObject({kind:z87.literal("VIDEO"),media:ReviewEvidenceMediaSchema})]);var ObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:z87.int().positive(),idempotencyKey:z87.string().min(1).max(200),source:ObservationSourceRequestSchema,mode:ObservationModeSchema,selection:ProviderSelectionSchema,expectedModelProfileVersion:z87.int().positive(),parameters:ObservationParametersSchema.default({})}).refine(q=>q.mode==="TRANSCRIPTION"||q.mode==="AUDIO"===(q.source.kind==="AUDIO"),{message:"Observation input/mode mismatch"});var ObservationGetSchema=ObservationScopeSchema.extend({observationId:z87.uuid()});var ObservationBindingSchema=z87.strictObject({tenantId:z87.uuid(),connectionId:z87.uuid(),connectionVersion:z87.int().positive(),credentialRef:z87.string(),credentialVersion:z87.int().positive(),profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),executionClass:z87.enum(["LIVE","TEST_ONLY"])}).refine(v=>!v.profile.modes.some(m=>m==="TRANSCRIPTION")||!!v.matrix,{message:"ASR requires its frozen capability matrix"});var ObservationSourceSchema=ReviewEvidenceMediaSchema.extend({tenantId:z87.uuid(),projectId:z87.uuid(),productionId:z87.uuid(),byteSize:z87.int().positive().max(12582912),durationMs:z87.number().positive().max(6e4),frameRate:z87.number().positive().max(60).optional(),executionClass:z87.enum(["LIVE","TEST_ONLY"])});var json=z87.record(z87.string(),z87.unknown());var ObservationResultSchema=z87.strictObject({schemaVersion:z87.int().positive(),advisory:z87.literal(true),producer:z87.enum(["VLM","ASR"]).optional(),source:ObservationSourceSchema,input:json,provider:json,observedAt:z87.iso.datetime(),report:json,transcript:TranscriptSchema.optional(),evidence:ReviewIntelligenceEvidenceSchema.optional(),limitations:z87.array(z87.string().max(200)).max(20)}).refine(v=>v.producer==="ASR"===!!v.transcript&&!(v.producer==="ASR"&&v.evidence),{message:"ASR transcript cannot provide listening or visual Review evidence"}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=131072,{message:"Observation report too large"}).refine(v=>v.transcript?.timing!=="PROVIDER_REPORTED"||v.provider.protocol==="OPENAI_WHISPER_TRANSCRIPTION_V1"&&[...v.transcript.words,...v.transcript.segments].every(item=>item.endMs<=v.source.durationMs),{message:"Transcript timing requires the exact supported protocol and media duration"});var ObservationAdmissionSchema=z87.strictObject({semanticStatus:z87.literal("ACCEPTED"),observationId:z87.uuid(),runtimeJobId:z87.uuid(),productionRevision:z87.int().positive(),executionClass:z87.enum(["LIVE","TEST_ONLY"])});var ObservationViewSchema=ObservationScopeSchema.extend({observationId:z87.uuid(),runtimeJobId:z87.uuid(),request:ObservationStartSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),parameters:ObservationParametersSchema,executionClass:z87.enum(["LIVE","TEST_ONLY"]),runtimeStatus:z87.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z87.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z87.boolean(),failure:z87.strictObject({classification:z87.string().min(1).max(100),summary:z87.string().min(1).max(1e3)}).nullable(),result:ObservationResultSchema.nullable(),createdAt:z87.iso.datetime()});var ObservationOptionsSchema=ObservationScopeSchema.extend({options:z87.array(z87.strictObject({selection:ProviderSelectionSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),connectionLabel:z87.string(),connectionVersion:z87.int().positive()})).max(100),possiblyTruncated:z87.boolean()});var LocalObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:ObservationStartSchema.shape.expectedProductionRevision,idempotencyKey:ObservationStartSchema.shape.idempotencyKey,source:audioSourceRequest,mode:z87.literal("TRANSCRIPTION"),deviceExecution:z87.strictObject({deviceId:z87.uuid().optional()})});var localObservationExecution=z87.strictObject({target:z87.literal("TENANT_DEVICE"),deviceId:z87.uuid(),identity:LocalWhisperIdentitySchema});var LocalObservationBindingSchema=localObservationExecution.extend({tenantId:z87.uuid(),executionClass:z87.literal("LIVE"),source:ObservationSourceSchema});var LocalObservationAdmissionSchema=ObservationAdmissionSchema.extend({executionClass:z87.literal("LIVE"),deviceExecution:localObservationExecution});var LocalObservationResultSchema=z87.strictObject({schemaVersion:z87.literal(1),advisory:z87.literal(true),producer:z87.literal("ASR"),source:ObservationSourceSchema,deviceExecution:localObservationExecution,observedAt:z87.iso.datetime(),transcript:TranscriptSchema.options[0],inputPcmSha256:z87.string().regex(/^[0-9a-f]{64}$/),inputPcmByteSize:z87.int().min(44).max(1920044)}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=131072,{message:"Observation report too large"});var LocalObservationViewSchema=ObservationViewSchema.omit({profile:true,matrix:true,parameters:true,providerStatus:true}).extend({request:LocalObservationStartSchema,executionClass:z87.literal("LIVE"),deviceExecution:localObservationExecution,result:LocalObservationResultSchema.nullable()});var qwenAsrModelId="qwen3-asr-flash-2026-02-10";var QwenAsrDeviceQuoteInputSchema=ObservationScopeSchema.extend({expectedProductionRevision:ObservationStartSchema.shape.expectedProductionRevision,idempotencyKey:ObservationStartSchema.shape.idempotencyKey,source:audioSourceRequest,mode:z87.literal("TRANSCRIPTION"),selection:ProviderSelectionSchema.extend({modelProfileId:z87.literal(qwenAsrModelId)}),expectedModelProfileVersion:z87.literal(1),parameters:ObservationParametersSchema.default({}),deviceId:z87.uuid()});var QwenAsrCostQuoteSchema=z87.strictObject({protocol:z87.literal("NVS_QWEN_ASR_COST_QUOTE_V1"),currency:z87.literal("USD"),ruleId:z87.string().min(1).max(100),sourceUrl:z87.url().max(2048),selection:QwenAsrDeviceQuoteInputSchema.shape.selection,connectionVersion:z87.int().positive(),modelProfileVersion:z87.literal(1),deviceId:z87.uuid(),intentFingerprint:z87.string().regex(/^[0-9a-f]{64}$/),inputDurationMs:z87.number().positive().max(6e4),reservedSeconds:z87.int().min(1).max(60),upperBoundMicrosPerSecond:z87.int().positive().max(1e6),upperBoundMicros:z87.int().positive().max(6e7),validUntil:z87.iso.datetime()});var QwenAsrDeviceStartSchema=QwenAsrDeviceQuoteInputSchema.extend({approvedQuote:QwenAsrCostQuoteSchema});var qwenAsrDeviceExecution=z87.strictObject({target:z87.literal("TENANT_EXTERNAL_PROVIDER"),deviceId:z87.uuid()});var QwenAsrDeviceAdmissionSchema=ObservationAdmissionSchema.extend({executionClass:z87.literal("LIVE"),deviceExecution:qwenAsrDeviceExecution});var qwenAsrTokenCount=z87.int().min(0).max(1e7).optional();var QwenAsrDeviceResultSchema=ObservationResultSchema.safeExtend({producer:z87.literal("ASR"),transcript:TranscriptSchema.options[0],input:z87.strictObject({kind:z87.literal("ORIGINAL_PCM_WAV_TRANSCRIPTION"),checksumSha256:ObservationSourceSchema.shape.checksumSha256,byteSize:ObservationSourceSchema.shape.byteSize,timeScaleFactor:z87.literal(1)}),provider:z87.strictObject({protocol:z87.literal("QWEN_ASR_V1"),requestedModel:z87.literal(qwenAsrModelId),model:z87.literal(qwenAsrModelId),requestId:z87.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),usage:z87.strictObject({seconds:z87.int().min(0).max(60).optional(),prompt_tokens:qwenAsrTokenCount,completion_tokens:qwenAsrTokenCount,total_tokens:qwenAsrTokenCount})}),report:z87.strictObject({task:z87.literal("SPEECH_RECOGNITION")})});var QwenAsrDeviceViewSchema=ObservationViewSchema.extend({request:QwenAsrDeviceQuoteInputSchema,executionClass:z87.literal("LIVE"),deviceExecution:qwenAsrDeviceExecution,result:QwenAsrDeviceResultSchema.nullable()});var ProductionGuidanceSchema=z87.strictObject({version:z87.enum(["NVS_PRODUCTION_GUIDANCE_V1","NVS_PRODUCTION_GUIDANCE_V2"]),instructions:z87.string().min(1).max(16e3)});var ProductionGuidanceContextSchema=ObservationScopeSchema.extend({projectId:z87.uuid(),revision:z87.int().positive(),guidance:ProductionGuidanceSchema});import{z as z95}from"zod";import{z as z89}from"zod";import{z as z88}from"zod";var Fingerprint3=z88.string().regex(/^[0-9a-f]{64}$/);var VideoReviewScopeSchema=z88.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z88.uuid()});var VideoReviewRequirementSchema=z88.strictObject({intentPath:z88.string().min(1).max(220).optional(),continuity:ContinuityExpectationSchema.optional(),interval:z88.strictObject({startMs:z88.int().nonnegative().max(6e4),endMs:z88.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Requirement interval must advance").optional(),key:z88.string().min(1).max(220),family:z88.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY","SOUND"]),expected:z88.string().min(1).max(2500),enforcement:z88.enum(["LOCKED","REQUIRED","PREFERRED"]),evidenceWindow:z88.enum(["WHOLE_VIDEO","START","END","TEMPORAL"])});var VideoObservationSchema=z88.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z88.string().min(1).max(220),status:z88.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z88.enum(["CLEAR","UNCERTAIN"]),observed:z88.string().trim().min(1).max(1800),interval:z88.strictObject({startMs:z88.int().nonnegative(),endMs:z88.int().positive()}).refine(v=>v.endMs>v.startMs,"Observation interval must advance").optional()});var RecordVideoReviewSchema=VideoReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),candidateId:z88.uuid(),representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,expectedReviewVersion:z88.int().nonnegative(),idempotencyKey:z88.string().trim().min(1).max(200),observations:z88.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z88.string().trim().min(1).max(2500)});var VideoReviewRecordSchema=z88.strictObject({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z88.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z88.uuid(),candidateId:z88.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,shotId:ShotIdSchema,version:z88.int().positive(),preparationId:z88.uuid(),contractId:z88.uuid(),contractFingerprint:Fingerprint3,executionClass:z88.enum(["LIVE","TEST_ONLY"]),kind:z88.literal("SHOT_REVIEW_1"),lifecycle:z88.literal("COMPLETED"),evaluatorVersion:z88.literal("shot-review-v1"),source:z88.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z88.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z88.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z88.enum(["PASS","WARNING","FAIL"]),blockingKeys:z88.array(z88.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z88.array(z88.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z88.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z88.iso.datetime({offset:true})});var DecideVideoShotSchema=VideoReviewScopeSchema.extend({candidateId:z88.uuid(),reviewId:z88.uuid(),expectedAcceptanceVersion:z88.int().nonnegative(),action:z88.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z88.boolean().default(false),reason:z88.string().trim().min(1).max(2500),idempotencyKey:z88.string().trim().min(1).max(200)});var ShotAcceptanceScopeSchema=z88.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema});var RevokeShotAcceptanceSchema=ShotAcceptanceScopeSchema.extend({acceptanceId:z88.uuid(),expectedAcceptanceVersion:z88.int().positive(),reason:z88.string().trim().min(1).max(2500),idempotencyKey:z88.string().trim().min(1).max(200)});var GeneratedShotAcceptanceDecisionSchema=z88.strictObject({id:z88.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z88.int().positive(),generationId:z88.uuid(),candidateId:z88.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z88.uuid(),action:z88.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedShotReferenceSchema.nullable(),previousAcceptanceId:z88.uuid().nullable(),warningKeys:z88.array(z88.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z88.boolean(),reason:z88.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z88.iso.datetime({offset:true})});var ProgrammaticShotAcceptanceDecisionSchema=z88.strictObject({sourceKind:z88.literal("PROGRAMMATIC"),id:z88.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z88.int().positive(),renderId:z88.uuid(),compositionId:z88.uuid(),compositionVersionId:z88.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z88.uuid(),action:z88.enum(["ACCEPT","REJECT","REVOKE"]),reference:ProgrammaticAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z88.uuid().nullable(),warningKeys:z88.array(z88.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z88.boolean(),reason:z88.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z88.iso.datetime({offset:true})});var ShotAcceptanceDecisionSchema=z88.union([GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,z88.strictObject({sourceKind:z88.literal("IMPORTED"),id:z88.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z88.int().positive(),normalizationId:z88.uuid(),sourceId:z88.uuid(),sourceVersionId:z88.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z88.uuid(),action:z88.enum(["ACCEPT","REJECT","REVOKE"]),reference:ImportedAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z88.uuid().nullable(),warningKeys:z88.array(z88.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z88.boolean(),reason:z88.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z88.iso.datetime({offset:true})})]);var VideoReviewTargetSchema=VideoReviewScopeSchema.extend({temporalEvidence:z88.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,preparationId:z88.uuid(),contractId:z88.uuid(),contractFingerprint:Fingerprint3,executionClass:z88.enum(["LIVE","TEST_ONLY"]),freshness:z88.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z88.boolean(),productionRunnable:z88.boolean(),candidate:VideoCandidateSchema,requirements:z88.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:VideoReviewRecordSchema.nullable(),reviewVersion:z88.int().nonnegative(),acceptanceVersion:z88.int().nonnegative(),activeAcceptanceId:z88.uuid().nullable()});var ShotAcceptanceViewSchema=ShotAcceptanceScopeSchema.extend({acceptanceVersion:z88.int().nonnegative(),status:z88.enum(["NONE","CURRENT","STALE"]),acceptance:ShotAcceptanceDecisionSchema.nullable(),reference:AcceptedVisualSourceReferenceSchema.nullable()});var VideoReviewQuerySchema=VideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoReviewPageSchema=z88.strictObject({items:z88.array(VideoReviewRecordSchema),page:QueryPageInfoSchema});var ShotDecisionQuerySchema=ShotAcceptanceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ShotDecisionPageSchema=z88.strictObject({items:z88.array(ShotAcceptanceDecisionSchema),page:QueryPageInfoSchema});var VideoReviewReceiptSchema=z88.strictObject({semanticStatus:z88.literal("SUCCESS"),review:VideoReviewRecordSchema,productionRevision:z88.int().positive()});var ShotDecisionReceiptSchema=z88.strictObject({semanticStatus:z88.literal("SUCCESS"),decision:ShotAcceptanceDecisionSchema,productionRevision:z88.int().positive()});var Fingerprint4=z89.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticVideoReviewScopeSchema=z89.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,renderId:z89.uuid()});var ProgrammaticReviewMediaSchema=VideoTechnicalMetadataSchema.extend({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z89.enum(["AVAILABLE","INVALID"])});var ProgrammaticVideoReviewRecordSchema=z89.strictObject({sourceKind:z89.literal("PROGRAMMATIC"),id:z89.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,renderId:z89.uuid(),compositionId:z89.uuid(),compositionVersionId:z89.uuid(),compositionVersion:z89.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,version:z89.int().positive(),planVersionId:z89.uuid(),planVersion:z89.int().positive(),shotPlanningRevision:z89.int().positive(),executionClass:z89.enum(["LIVE","TEST_ONLY"]),kind:z89.literal("SHOT_REVIEW_1"),lifecycle:z89.literal("COMPLETED"),evaluatorVersion:z89.literal("shot-review-v1"),source:z89.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z89.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z89.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z89.enum(["PASS","WARNING","FAIL"]),blockingKeys:z89.array(z89.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z89.array(z89.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z89.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z89.iso.datetime({offset:true})});var ProgrammaticVideoReviewTargetSchema=ProgrammaticVideoReviewScopeSchema.extend({sourceKind:z89.literal("PROGRAMMATIC"),temporalEvidence:z89.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,compositionId:z89.uuid(),compositionVersionId:z89.uuid(),compositionVersion:z89.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,executionClass:z89.enum(["LIVE","TEST_ONLY"]),freshness:z89.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z89.boolean(),productionRunnable:z89.boolean(),media:ProgrammaticReviewMediaSchema,requirements:z89.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:ProgrammaticVideoReviewRecordSchema.nullable(),reviewVersion:z89.int().nonnegative(),acceptanceVersion:z89.int().nonnegative(),activeAcceptanceId:z89.uuid().nullable()});var RecordProgrammaticVideoReviewSchema=ProgrammaticVideoReviewScopeSchema.extend({representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,expectedReviewVersion:z89.int().nonnegative(),idempotencyKey:z89.string().trim().min(1).max(200),observations:z89.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z89.string().trim().min(1).max(2500)});var DecideProgrammaticShotSchema=ProgrammaticVideoReviewScopeSchema.extend({reviewId:z89.uuid(),expectedAcceptanceVersion:z89.int().nonnegative(),action:z89.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z89.boolean().default(false),reason:z89.string().trim().min(1).max(2500),idempotencyKey:z89.string().trim().min(1).max(200)});var ProgrammaticVideoReviewQuerySchema=ProgrammaticVideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProgrammaticVideoReviewPageSchema=z89.strictObject({items:z89.array(ProgrammaticVideoReviewRecordSchema),page:QueryPageInfoSchema});var ProgrammaticVideoReviewReceiptSchema=z89.strictObject({semanticStatus:z89.literal("SUCCESS"),review:ProgrammaticVideoReviewRecordSchema,productionRevision:z89.int().positive()});import{z as z93}from"zod";import{z as z91}from"zod";import{z as z90}from"zod";var Intent=z90.string().trim().min(1).max(300);var CameraIntentSchema=z90.strictObject({scale:z90.enum(["EXTREME_CLOSE_UP","CLOSE_UP","MEDIUM","WIDE","EXTREME_WIDE"]),framing:z90.enum(["CENTERED","OFF_CENTER","SYMMETRICAL","OVER_SHOULDER"]),angle:z90.enum(["EYE_LEVEL","HIGH","LOW","TOP_DOWN"]),movement:z90.enum(["STATIC","PAN","TILT","DOLLY","TRACK","ORBIT","CRANE","ZOOM"]),stability:z90.enum(["LOCKED","STABILIZED","HANDHELD"]),direction:z90.enum(["LEFT","RIGHT","UP","DOWN","FORWARD","BACKWARD","CLOCKWISE","COUNTERCLOCKWISE"]).optional(),lensIntent:z90.string().trim().min(1).max(120).optional()});var ShotTemporalBeatSchema=z90.strictObject({startSeconds:z90.number().min(0).max(30),endSeconds:z90.number().positive().max(30),action:Intent});var ShotDirectionSchema=z90.strictObject({camera:CameraIntentSchema,temporalBeats:z90.array(ShotTemporalBeatSchema).min(1).max(8),environmentIntent:Intent.optional(),lightingIntent:Intent.optional(),styleIntent:Intent.optional(),audioIntent:Intent.optional()});function checkShotDirectionTiming(direction,duration){let cursor=0;for(const beat of direction.temporalBeats){if(Math.abs(beat.startSeconds-cursor)>1e-6||beat.endSeconds<=beat.startSeconds)return false;cursor=beat.endSeconds}return Math.abs(cursor-duration)<=1e-6}var PlanningClientKeySchema=z91.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/);var BoundaryRequirementSchema=z91.strictObject({attribute:z91.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),value:z91.string().trim().min(1).max(300)});var ShotIntentSchema=z91.strictObject({narrativePurpose:z91.string().trim().min(1).max(600),subjectAction:z91.string().trim().min(1).max(600),targetDurationSeconds:z91.number().min(.5).max(30),subjectRequirements:z91.array(z91.string().trim().min(1).max(300)).max(16).default([]),cameraComposition:z91.string().trim().min(1).max(500).optional(),factualClaims:z91.array(StoryFactClaimSchema).max(16).default([]),requiresGeneratedKeyframe:z91.boolean().default(false),sourceMediaAllowed:z91.boolean().default(false),direction:ShotDirectionSchema.optional()}).superRefine((value2,context)=>{if(value2.direction&&!checkShotDirectionTiming(value2.direction,value2.targetDurationSeconds))context.addIssue({code:"custom",path:["direction","temporalBeats"],message:"Temporal beats must be contiguous from zero and cover exactly the Shot duration"})});var ShotPlanInputSchema=z91.strictObject({clientKey:PlanningClientKeySchema,shotId:ShotIdSchema.optional(),intent:ShotIntentSchema,entryBoundary:z91.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z91.array(BoundaryRequirementSchema).max(24).default([])});var ScenePlanInputSchema=z91.strictObject({clientKey:PlanningClientKeySchema,sceneId:SceneIdSchema.optional(),purpose:z91.string().trim().min(1).max(800),locationContext:z91.string().trim().min(1).max(300).optional(),timeContext:z91.string().trim().min(1).max(300).optional(),entryBoundary:z91.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z91.array(BoundaryRequirementSchema).max(24).default([]),shots:z91.array(ShotPlanInputSchema).min(1).max(24)});var ContinuityRequirementSchema=z91.strictObject({mode:z91.enum(["PERSIST","TRANSITION","REESTABLISH","REVIEW"]),attribute:z91.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),description:z91.string().trim().min(1).max(500)});var ContinuityEdgeInputSchema=z91.strictObject({fromShotKey:PlanningClientKeySchema,toShotKey:PlanningClientKeySchema,requirements:z91.array(ContinuityRequirementSchema).min(1).max(24)});var AcceptSceneShotPlanRequestSchema=z91.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z91.int().positive(),expectedStoryVersion:z91.int().positive(),revisionReason:z91.string().trim().min(1).max(1e3).optional(),idempotencyKey:z91.string().trim().min(1).max(200),scenes:z91.array(ScenePlanInputSchema).min(1).max(12),continuityEdges:z91.array(ContinuityEdgeInputSchema).max(64).default([])});var ShotPlanEntrySchema=z91.strictObject({shotId:ShotIdSchema,clientKey:PlanningClientKeySchema,ordinal:z91.int().positive(),planningRevision:z91.int().positive(),intent:ShotIntentSchema,entryBoundary:z91.array(BoundaryRequirementSchema).max(24),exitBoundary:z91.array(BoundaryRequirementSchema).max(24)});var ScenePlanEntrySchema=z91.strictObject({sceneId:SceneIdSchema,clientKey:PlanningClientKeySchema,ordinal:z91.int().positive(),purpose:z91.string().trim().min(1).max(800),locationContext:z91.string().trim().min(1).max(300).optional(),timeContext:z91.string().trim().min(1).max(300).optional(),entryBoundary:z91.array(BoundaryRequirementSchema).max(24),exitBoundary:z91.array(BoundaryRequirementSchema).max(24),shots:z91.array(ShotPlanEntrySchema).min(1).max(24)});var ContinuityEdgeSchema=z91.strictObject({id:ContinuityEdgeIdSchema,fromShotId:ShotIdSchema,toShotId:ShotIdSchema,requirements:z91.array(ContinuityRequirementSchema).min(1).max(24)});var SceneShotPlanVersionSchema=z91.strictObject({id:SceneShotPlanVersionIdSchema,planId:SceneShotPlanIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z91.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z91.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z91.int().positive(),scenes:z91.array(ScenePlanEntrySchema).min(1).max(12),continuityEdges:z91.array(ContinuityEdgeSchema).max(64),createdByPrincipalId:PrincipalIdSchema,createdAt:z91.iso.datetime({offset:true})});var AcceptSceneShotPlanResultSchema=z91.discriminatedUnion("semanticStatus",[z91.strictObject({semanticStatus:z91.literal("SUCCESS"),planVersion:SceneShotPlanVersionSchema,productionRevision:z91.int().positive(),activeSceneShotPlanVersion:z91.int().positive()}),z91.strictObject({semanticStatus:z91.literal("NEEDS_INPUT"),missingPrerequisites:z91.array(z91.literal("ACTIVE_STORY")).min(1)})]);import{z as z92}from"zod";var WriterScopeSchema=z92.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema});var WriterBasisSchema=WriterScopeSchema.extend({productionRevision:z92.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z92.int().positive()});var IntentSchema=z92.string().trim().min(1).max(600);var WriterAlternativeSchema=z92.strictObject({alternativeId:z92.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z92.string().trim().min(1).max(120),story:StoryContentSchema,rationale:z92.strictObject({coreMessage:IntentSchema,hook:IntentSchema,audienceFit:IntentSchema,pacingIntent:IntentSchema,endingIntent:IntentSchema,tradeoffs:z92.array(IntentSchema).max(6)}),beatDurationsSeconds:z92.array(z92.int().positive().max(60)).min(1).max(24)});var WriterProposalSchema=z92.strictObject({origin:z92.strictObject({kind:z92.literal("EXTERNAL_AGENT_HOST"),label:z92.string().trim().min(1).max(100)}),unknowns:z92.array(z92.string().trim().min(1).max(300)).max(8),alternatives:z92.array(WriterAlternativeSchema).min(1).max(3)});var ValidateWriterProposalSchema=z92.strictObject({basis:WriterBasisSchema,revisionReason:AcceptStoryRequestSchema.shape.revisionReason,proposal:WriterProposalSchema});var MissingBriefSchema=z92.strictObject({semanticStatus:z92.literal("NEEDS_INPUT"),missingPrerequisites:z92.array(z92.literal("ACTIVE_BRIEF")).min(1).max(1)});var WriterBriefResultSchema=z92.discriminatedUnion("semanticStatus",[z92.strictObject({semanticStatus:z92.literal("SUCCESS"),basis:WriterBasisSchema,briefVersion:BriefVersionSchema}),MissingBriefSchema]);var WriterAcceptanceDraftSchema=z92.strictObject({alternativeId:WriterAlternativeSchema.shape.alternativeId,projectId:ProjectIdSchema,productionId:ProductionIdSchema,request:AcceptStoryRequestSchema.omit({idempotencyKey:true})});var WriterValidationResultSchema=z92.discriminatedUnion("semanticStatus",[z92.strictObject({semanticStatus:z92.literal("SUCCESS"),advisory:z92.literal(true),basis:WriterBasisSchema,proposal:WriterProposalSchema,acceptanceDrafts:z92.array(WriterAcceptanceDraftSchema).min(1).max(3),limitations:z92.array(z92.enum(["PROSE_IS_CREATIVE_INTENT_NOT_FACT_VERIFIED","PACING_IS_ADVISORY_NOT_TIMELINE_TRUTH","ACCEPTANCE_RECHECKS_CURRENT_BASIS"])).length(3)}),MissingBriefSchema]);var DirectorScopeSchema=WriterScopeSchema;var DirectorBasisSchema=WriterBasisSchema.extend({storyVersionId:StoryVersionIdSchema,storyVersion:z93.int().positive(),sceneShotPlanVersionId:SceneShotPlanVersionIdSchema.nullable(),sceneShotPlanVersion:z93.int().positive().nullable()}).refine(value2=>value2.sceneShotPlanVersionId===null===(value2.sceneShotPlanVersion===null),"Current plan ID and version must both be present or null");var Intent2=z93.string().trim().min(1).max(600);var Plan=AcceptSceneShotPlanRequestSchema.pick({scenes:true,continuityEdges:true});var DirectorAlternativeSchema=z93.strictObject({alternativeId:z93.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z93.string().trim().min(1).max(120),plan:Plan,rationale:z93.strictObject({storyInterpretation:Intent2,visualApproach:Intent2,pacingIntent:Intent2,tradeoffs:z93.array(Intent2).max(6)}),shotStoryBeats:z93.array(z93.strictObject({shotKey:PlanningClientKeySchema,beatOrdinals:z93.array(z93.int().positive().max(24)).min(1).max(4)})).min(1).max(48)}).refine(value2=>value2.plan.scenes.reduce((n,scene)=>n+scene.shots.length,0)<=48,"Director alternatives contain at most 48 Shots");var DirectorProposalSchema=z93.strictObject({origin:z93.strictObject({kind:z93.literal("EXTERNAL_AGENT_HOST"),label:z93.string().trim().min(1).max(100)}),unknowns:z93.array(z93.string().trim().min(1).max(300)).max(8),alternatives:z93.array(DirectorAlternativeSchema).min(1).max(3)});var ValidateDirectorProposalSchema=z93.strictObject({basis:DirectorBasisSchema,revisionReason:AcceptSceneShotPlanRequestSchema.shape.revisionReason,proposal:DirectorProposalSchema}).refine(value2=>new TextEncoder().encode(JSON.stringify(value2)).byteLength<=1024*1024,"Director validation input exceeds the 1 MiB JSON budget");var Missing=z93.strictObject({semanticStatus:z93.literal("NEEDS_INPUT"),missingPrerequisites:z93.array(z93.enum(["ACTIVE_BRIEF","ACTIVE_STORY"])).min(1).max(2)});var DirectorContextResultSchema=z93.discriminatedUnion("semanticStatus",[z93.strictObject({semanticStatus:z93.literal("SUCCESS"),basis:DirectorBasisSchema,briefVersion:BriefVersionSchema,storyVersion:StoryVersionSchema,sceneShotPlanVersion:SceneShotPlanVersionSchema.nullable(),stalePrerequisites:z93.array(z93.enum(["CURRENT_STORY","CURRENT_SCENE_SHOT_PLAN"])).min(1).max(2).optional()}),Missing]);var DirectorAcceptanceDraftSchema=z93.strictObject({alternativeId:DirectorAlternativeSchema.shape.alternativeId,projectId:DirectorScopeSchema.shape.projectId,productionId:DirectorScopeSchema.shape.productionId,request:AcceptSceneShotPlanRequestSchema.omit({idempotencyKey:true})});var DirectorValidationResultSchema=z93.discriminatedUnion("semanticStatus",[z93.strictObject({semanticStatus:z93.literal("SUCCESS"),advisory:z93.literal(true),basis:DirectorBasisSchema,proposal:DirectorProposalSchema,acceptanceDrafts:z93.array(DirectorAcceptanceDraftSchema).min(1).max(3),limitations:z93.array(z93.enum(["PROSE_IS_CREATIVE_INTENT_NOT_FACT_VERIFIED","DIRECTION_IS_INTENT_NOT_OBSERVED_MEDIA","ACCEPTANCE_RECHECKS_CURRENT_BASIS","PREPARATION_AND_GENERATION_REMAIN_SEPARATE"])).length(4)}),Missing]);import{z as z94}from"zod";var Fingerprint5=z94.string().regex(/^[0-9a-f]{64}$/);var KeyframeReviewScopeSchema=z94.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z94.uuid()});var VisualRequirementSchema=z94.strictObject({intentPath:z94.string().min(1).max(220).optional(),key:z94.string().min(1).max(200),expected:z94.string().min(1).max(2500),enforcement:z94.enum(["LOCKED","REQUIRED","PREFERRED"])});var Region=z94.strictObject({x:z94.number().min(0).max(1),y:z94.number().min(0).max(1),width:z94.number().positive().max(1),height:z94.number().positive().max(1)}).refine(r=>r.x+r.width<=1&&r.y+r.height<=1,"Evidence region must fit within the image");var KeyframeObservationSchema=z94.strictObject({key:z94.string().min(1).max(200),status:z94.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z94.enum(["CLEAR","UNCERTAIN"]),observed:z94.string().trim().min(1).max(1500),region:Region.optional()});var RecordKeyframeReviewSchema=KeyframeReviewScopeSchema.extend({candidateId:z94.uuid(),representationId:z94.uuid(),checksumSha256:Fingerprint5,expectedReviewVersion:z94.int().nonnegative(),idempotencyKey:z94.string().trim().min(1).max(200),observations:z94.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z94.string().trim().min(1).max(2e3)});var KeyframeReviewRecordSchema=z94.strictObject({id:z94.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z94.uuid(),candidateId:z94.uuid(),artifactId:z94.uuid(),representationId:z94.uuid(),checksumSha256:Fingerprint5,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,version:z94.int().positive(),preparationId:z94.uuid(),contractId:z94.uuid(),contractFingerprint:Fingerprint5,executionClass:z94.enum(["LIVE","TEST_ONLY"]),kind:z94.literal("KEYFRAME_REFERENCE"),lifecycle:z94.literal("COMPLETED"),evaluatorVersion:z94.literal("keyframe-reference-v1"),source:z94.literal("EXPLICIT_VISUAL_INSPECTION"),requirements:z94.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z94.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z94.enum(["PASS","WARNING","FAIL"]),blockingKeys:z94.array(z94.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z94.array(z94.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z94.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z94.iso.datetime({offset:true})});var DecideKeyframeSchema=KeyframeReviewScopeSchema.extend({candidateId:z94.uuid(),reviewId:z94.uuid(),expectedSelectionVersion:z94.int().nonnegative(),action:z94.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z94.boolean().default(false),reason:z94.string().trim().min(1).max(2e3),idempotencyKey:z94.string().trim().min(1).max(200)});var KeyframeReferenceScopeSchema=z94.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema});var RevokeKeyframeSchema=KeyframeReferenceScopeSchema.extend({acceptanceId:z94.uuid(),expectedSelectionVersion:z94.int().positive(),reason:z94.string().trim().min(1).max(2e3),idempotencyKey:z94.string().trim().min(1).max(200)});var KeyframeDecisionRecordSchema=z94.strictObject({id:z94.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,selectionVersion:z94.int().positive(),generationId:z94.uuid(),candidateId:z94.uuid(),reviewId:z94.uuid(),action:z94.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedKeyframeReferenceSchema.nullable(),previousAcceptanceId:z94.uuid().nullable(),warningKeys:z94.array(z94.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z94.boolean(),reason:z94.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z94.iso.datetime({offset:true})});var KeyframeReviewTargetSchema=KeyframeReviewScopeSchema.extend({projectId:ProjectIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,preparationId:z94.uuid(),contractId:z94.uuid(),contractFingerprint:Fingerprint5,executionClass:z94.enum(["LIVE","TEST_ONLY"]),freshness:z94.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z94.boolean(),productionRunnable:z94.boolean(),candidate:KeyframeCandidateSchema,requirements:z94.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:KeyframeReviewRecordSchema.nullable(),reviewVersion:z94.int().nonnegative(),selectionVersion:z94.int().nonnegative(),activeAcceptanceId:z94.uuid().nullable()});var KeyframeReferenceViewSchema=KeyframeReferenceScopeSchema.extend({selectionVersion:z94.int().nonnegative(),status:z94.enum(["NONE","CURRENT","STALE"]),acceptance:KeyframeDecisionRecordSchema.nullable(),reference:AcceptedKeyframeReferenceSchema.nullable()});var KeyframeReviewQuerySchema=KeyframeReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeReviewPageSchema=z94.strictObject({items:z94.array(KeyframeReviewRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewReceiptSchema=z94.strictObject({semanticStatus:z94.literal("SUCCESS"),review:KeyframeReviewRecordSchema,productionRevision:z94.int().positive()});var KeyframeDecisionReceiptSchema=z94.strictObject({semanticStatus:z94.literal("SUCCESS"),decision:KeyframeDecisionRecordSchema,productionRevision:z94.int().positive()});var KeyframeDecisionQuerySchema=KeyframeReferenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeDecisionPageSchema=z94.strictObject({items:z94.array(KeyframeDecisionRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewSummarySchema=z94.strictObject({reviewedCandidates:z94.int().nonnegative(),unreviewedCandidates:z94.int().nonnegative(),decisionCount:z94.int().nonnegative()});var sha14=z95.string().regex(/^[0-9a-f]{64}$/);var evidenceIds=z95.array(ReviewEvidenceKeySchema).max(16);var ReviewIntelligenceTargetSchema=z95.discriminatedUnion("kind",[z95.strictObject({kind:z95.literal("IMAGE"),generationId:z95.uuid()}),z95.strictObject({kind:z95.literal("VIDEO"),generationId:z95.uuid()}),z95.strictObject({kind:z95.literal("ROUGH_CUT"),renderId:z95.uuid()}),z95.strictObject({kind:z95.literal("PROGRAMMATIC"),renderId:z95.uuid()})]);var ReviewIntelligenceContextInputSchema=z95.strictObject({scope:DirectorScopeSchema,target:ReviewIntelligenceTargetSchema});var ReviewIntelligenceBasisSchema=ReviewIntelligenceContextInputSchema.extend({contextFingerprint:sha14});var ReviewIntelligenceOwnerTargetSchema=z95.discriminatedUnion("kind",[z95.strictObject({kind:z95.literal("IMAGE"),target:KeyframeReviewTargetSchema}),z95.strictObject({kind:z95.literal("VIDEO"),target:VideoReviewTargetSchema}),z95.strictObject({kind:z95.literal("ROUGH_CUT"),target:RoughCutReviewTargetSchema}),z95.strictObject({kind:z95.literal("PROGRAMMATIC"),target:ProgrammaticVideoReviewTargetSchema})]);var review=z95.discriminatedUnion("kind",[z95.strictObject({kind:z95.literal("IMAGE"),observations:z95.array(KeyframeObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z95.strictObject({kind:z95.literal("VIDEO"),observations:z95.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z95.strictObject({kind:z95.literal("PROGRAMMATIC"),observations:z95.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z95.strictObject({kind:z95.literal("ROUGH_CUT"),observations:z95.array(RoughCutObservationSchema.extend({evidenceIds})).min(1).max(300),inspection:RoughCutInspectionSchema})]);var ValidateReviewIntelligenceSchema=z95.strictObject({basis:ReviewIntelligenceBasisSchema,proposal:z95.strictObject({origin:z95.strictObject({kind:z95.literal("EXTERNAL_AGENT_HOST"),label:z95.string().trim().min(1).max(100)}),summary:z95.string().trim().min(1).max(2e3),evidence:z95.array(ReviewIntelligenceEvidenceSchema).max(256),review})}).refine(input=>new TextEncoder().encode(JSON.stringify(input)).byteLength<=1024*1024,"Review Intelligence input exceeds the 1 MiB JSON budget");var ReviewIntelligenceContextResultSchema=z95.strictObject({semanticStatus:z95.literal("SUCCESS"),advisory:z95.literal(true),basis:ReviewIntelligenceBasisSchema,productionGuidance:ProductionGuidanceSchema.optional(),ownerContext:DirectorContextResultSchema,reviewTarget:ReviewIntelligenceOwnerTargetSchema,limitations:z95.array(z95.enum(["NO_IMPLICIT_MEDIA_OR_MODEL_CALL","READS_ARE_NOT_ATOMIC_OR_RESERVED"])).length(2)});var ReviewIntelligenceRecordDraftSchema=z95.discriminatedUnion("kind",[z95.strictObject({kind:z95.literal("PROGRAMMATIC"),input:RecordProgrammaticVideoReviewSchema.omit({idempotencyKey:true})}),z95.strictObject({kind:z95.literal("IMAGE"),input:RecordKeyframeReviewSchema.omit({idempotencyKey:true})}),z95.strictObject({kind:z95.literal("VIDEO"),input:RecordVideoReviewSchema.omit({idempotencyKey:true})}),z95.strictObject({kind:z95.literal("ROUGH_CUT"),input:RecordRoughCutReviewSchema.omit({idempotencyKey:true})})]);var ReviewIntelligenceIssueSchema=z95.strictObject({requirement:z95.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema]),observation:z95.union([KeyframeObservationSchema,VideoObservationSchema,RoughCutObservationSchema]),evidenceIds,blocking:z95.boolean(),severity:z95.enum(["BLOCKING","WARNING"]),affectedScope:z95.strictObject({kind:z95.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z95.array(z95.uuid()).min(1).max(200)}).optional()});var ReviewIntelligenceValidationResultSchema=z95.strictObject({semanticStatus:z95.literal("SUCCESS"),advisory:z95.literal(true),basis:ReviewIntelligenceBasisSchema,proposal:ValidateReviewIntelligenceSchema.shape.proposal,canonicalRulePreview:z95.strictObject({source:z95.literal("EXISTING_CANONICAL_DOMAIN_RULES"),authoritative:z95.literal(false),evaluatorVersion:z95.enum(["keyframe-reference-v1","shot-review-v1","production-review-v1"]),result:z95.enum(["PASS","WARNING","FAIL"]),blockingKeys:z95.array(z95.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z95.array(z95.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),issueProposals:z95.array(ReviewIntelligenceIssueSchema).max(MAX_SHOT_REVIEW_REQUIREMENTS),recordDraft:ReviewIntelligenceRecordDraftSchema,limitations:z95.array(z95.enum(["EVIDENCE_DECLARATIONS_ARE_NOT_ATTESTED_PIXEL_READS","RULE_PREVIEW_IS_NOT_A_CANONICAL_REVIEW","RECORD_RECHECKS_CURRENTNESS_CAS_AND_EXECUTION_CLASS","ACCEPTANCE_REMAINS_A_SEPARATE_OWNER_DECISION"])).length(4)});var sha15=z96.string().regex(/^[a-f0-9]{64}$/);var qualifiedVersion=QualifiedLocalAgentVersionSchema;var LocalAgentSnapshotSchema=z96.strictObject({basis:ReviewIntelligenceBasisSchema,productionRevision:z96.int().positive(),reviewVersion:z96.int().nonnegative(),executionClass:z96.enum(["LIVE","TEST_ONLY"]),media:ReviewEvidenceMediaSchema,requirements:z96.array(z96.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema])).min(1).max(64),evidence:LocalAgentMediaInputSchema.optional(),image:z96.strictObject({contentType:z96.literal("image/png"),byteSize:z96.int().positive().max(8388608),width:z96.int().positive().max(4096),height:z96.int().positive().max(4096)}).optional()}).refine(v=>!v.image||!v.evidence&&v.basis.target.kind==="IMAGE").refine(v=>v.basis.target.kind==="IMAGE"||!v.evidence||v.evidence.contentType==="video/mp4").refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=32768).refine(v=>new Set(v.requirements.map(r=>r.key)).size===v.requirements.length);var LocalAgentProbeSchema=z96.strictObject({configured:z96.boolean(),available:z96.boolean(),reason:z96.enum(["GRANT_REQUIRED","READY","RUNTIME_UNAVAILABLE","GRANT_EXPIRED"]),grantFingerprint:sha15.nullable(),inference:z96.literal("REMOTE_OPENAI")});var LocalAgentPlanSchema=z96.strictObject({protocol:z96.enum(["NVS_LOCAL_AGENT_REVIEW_V1","NVS_LOCAL_AGENT_REVIEW_V2"]),id:z96.uuid(),grantFingerprint:sha15,snapshot:LocalAgentSnapshotSchema,expiresAt:z96.iso.datetime({offset:true}),fingerprint:sha15});var LocalAgentMetadataAnswerSchema=z96.strictObject({summary:z96.string().trim().min(1).max(1500),observations:z96.array(z96.strictObject({key:z96.string().min(1).max(220),observed:z96.string().trim().min(1).max(1e3)})).min(1).max(64)});var LocalAgentPixelAnswerSchema=z96.strictObject({summary:z96.string().trim().min(1).max(1500),imageReadback:z96.string().trim().min(1).max(800),observations:z96.array(KeyframeObservationSchema.omit({region:true}).extend({key:z96.string().min(1).max(220)})).min(1).max(64)});var LocalAgentAnswerSchema=z96.union([LocalAgentMetadataAnswerSchema,LocalAgentPixelAnswerSchema]).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=96*1024);var LocalAgentImageReceiptSchema=z96.strictObject({protocol:z96.literal("NVS_LOCAL_AGENT_IMAGE_V1"),draftId:z96.uuid(),media:ReviewEvidenceMediaSchema,byteSize:z96.int().positive().max(8388608),contentType:z96.literal("image/png"),width:z96.int().positive().max(4096),height:z96.int().positive().max(4096)});var LocalAgentReviewViewSchema=z96.strictObject({plan:LocalAgentPlanSchema,revision:z96.int().positive(),phase:z96.enum(["PREPARED","RUNNING","RESULT_PENDING","UNKNOWN"]),answer:LocalAgentAnswerSchema.nullable(),imageReceipt:LocalAgentImageReceiptSchema.optional(),evidenceReceipt:LocalAgentEvidenceReceiptSchema.optional(),provenance:z96.strictObject({adapter:z96.enum(["CODEX_METADATA_V1","CODEX_MEDIA_V2"]),binaryDigest:sha15,version:qualifiedVersion,model:z96.string().max(100),reasoningEffort:z96.enum(["low","medium","high","xhigh"]).optional(),reviewerLabel:z96.string().max(100),inference:z96.literal("REMOTE_OPENAI"),evidence:z96.enum(["METADATA_ONLY","IMAGE_PIXELS","VIDEO_FRAMES"])})}).refine(v=>{const image=v.plan.snapshot.image,receipt=v.imageReceipt;if(receipt&&(!image||receipt.draftId!==v.plan.id||canonicalLocalJson(receipt.media)!==canonicalLocalJson(v.plan.snapshot.media)||canonicalLocalJson({contentType:receipt.contentType,byteSize:receipt.byteSize,width:receipt.width,height:receipt.height})!==canonicalLocalJson(image)))return false;if(v.phase==="RESULT_PENDING"!==!!v.answer)return false;const derived=v.plan.snapshot.evidence,receipt2=v.evidenceReceipt;if(v.provenance.adapter!==(derived?"CODEX_MEDIA_V2":"CODEX_METADATA_V1"))return false;if(receipt2&&(!derived||receipt2.draftId!==v.plan.id||canonicalLocalJson(receipt2.media)!==canonicalLocalJson(v.plan.snapshot.media)))return false;if(v.answer&&!!(image||derived)!=="imageReadback"in v.answer)return false;const pixels=v.phase==="RESULT_PENDING"&&!!(image||derived);return v.provenance.evidence===(pixels?derived?.contentType==="video/mp4"?"VIDEO_FRAMES":"IMAGE_PIXELS":"METADATA_ONLY")&&(!pixels||(derived?!!receipt2:!!receipt))});function localAgentSnapshotFromContext(raw,includeImage=false){const c=ReviewIntelligenceContextResultSchema.parse(raw);if(c.reviewTarget.kind!=="IMAGE"||c.basis.target.kind!=="IMAGE"||c.ownerContext.semanticStatus!=="SUCCESS")throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");const t=c.reviewTarget.target,scope=c.basis.scope;if(!t.runtimeSucceeded||t.candidate.availability!=="AVAILABLE"||t.candidate.freshness!=="CURRENT_BASIS"||!t.productionRunnable||t.freshness!=="CURRENT_BASIS"||t.generationId!==c.basis.target.generationId||t.tenantId!==scope.tenantId||t.projectId!==scope.projectId||t.productionId!==scope.productionId||c.ownerContext.basis.tenantId!==scope.tenantId||c.ownerContext.basis.projectId!==scope.projectId||c.ownerContext.basis.productionId!==scope.productionId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");return LocalAgentSnapshotSchema.parse({basis:c.basis,productionRevision:c.ownerContext.basis.productionRevision,reviewVersion:t.reviewVersion,executionClass:t.executionClass,media:{artifactId:t.candidate.artifactId,representationId:t.candidate.representationId,checksumSha256:t.candidate.checksumSha256},requirements:t.requirements,...includeImage?{image:{contentType:t.candidate.contentType,byteSize:t.candidate.byteSize,width:t.candidate.width,height:t.candidate.height}}:{}})}function localAgentNativeProposal(raw){const v=LocalAgentReviewViewSchema.parse(raw);if(v.plan.snapshot.basis.target.kind!=="IMAGE"||v.plan.snapshot.evidence)throw Error("LOCAL_AGENT_MEDIA_PROPOSAL_REQUIRED");if(v.phase!=="RESULT_PENDING"||!v.answer)throw Error("LOCAL_AGENT_RESULT_UNAVAILABLE");const keys=new Set(v.answer.observations.map(o=>o.key));if(keys.size!==v.answer.observations.length||keys.size!==v.plan.snapshot.requirements.length||v.plan.snapshot.requirements.some(r=>!keys.has(r.key)))throw Error("LOCAL_AGENT_RESULT_UNAVAILABLE");const p=v.provenance;const pixels=p.evidence==="IMAGE_PIXELS";return ValidateReviewIntelligenceSchema.parse({basis:v.plan.snapshot.basis,proposal:{origin:{kind:"EXTERNAL_AGENT_HOST",label:p.reviewerLabel},summary:`${pixels?"IMAGE_PIXELS":"METADATA_ONLY; no visual inspection"}. Codex ${p.version}; model ${p.model}; effort ${p.reasoningEffort??"DEFAULT"}; binary ${p.binaryDigest}; draft ${v.plan.id}; plan ${v.plan.fingerprint}. ${v.answer.summary}`,evidence:pixels?[{id:"original_image",label:"Verified ORIGINAL PNG attachment",producer:"EXTERNAL_AGENT_HOST",kind:"IMAGE_PIXELS",media:v.plan.snapshot.media}]:[],review:{kind:"IMAGE",observations:v.answer.observations.map(o=>({...o,status:pixels&&"status"in o?o.status:"NOT_OBSERVABLE",confidence:pixels&&"confidence"in o?o.confidence:"UNCERTAIN",evidenceIds:pixels?["original_image"]:[]}))}}})}var LocalExecutionListInputSchema=LocalProjectScopeSchema.extend({after:z97.string().length(64).regex(/^[0-9a-f]{64}$/).nullable().default(null),limit:z97.int().min(1).max(16).default(8),includeCompleted:z97.boolean().optional(),includeProgress:z97.boolean().optional()});var LocalExecutionInspectInputSchema=LocalWorkScopeSchema.extend({includeProgress:z97.boolean().optional()});var LocalIpcCallSchema=z97.discriminatedUnion("operation",[z97.strictObject({operation:z97.literal("library.capability")}),z97.strictObject({operation:z97.literal("library.call"),input:LocalLibraryCallSchema}),z97.strictObject({operation:z97.literal("agent.discover"),binary:z97.string().min(1).max(4096).optional()}),z97.strictObject({operation:z97.literal("offline.workspace"),input:LocalOfflineCallSchema}),z97.strictObject({operation:z97.literal("workspace.inspect")}),z97.strictObject({operation:z97.literal("workspace.configure"),policy:LocalResourcePolicySchema,expectedRevision:z97.int().nonnegative()}),z97.strictObject({operation:z97.literal("workspace.activity"),idleSeconds:z97.int().min(0).max(86400),observedAt:z97.iso.datetime()}),z97.strictObject({operation:z97.literal("storage.clean")}),z97.strictObject({operation:z97.literal("diagnostics.read")}),z97.strictObject({operation:z97.literal("agent.grant"),grant:LocalAgentGrantSchema,approval:z97.string().regex(/^[a-f0-9]{64}$/)}),z97.strictObject({operation:z97.literal("agent.probe")}),z97.strictObject({operation:z97.literal("agent.revoke"),approval:z97.string().regex(/^[a-f0-9]{64}$/)}),z97.strictObject({operation:z97.literal("agent.prepare"),snapshot:LocalAgentSnapshotSchema}),z97.strictObject({operation:z97.literal("agent.start"),id:z97.uuid(),expectedRevision:LocalRevisionSchema,approval:z97.string().regex(/^[a-f0-9]{64}$/)}),z97.strictObject({operation:z97.literal("agent.inspect"),id:z97.uuid()}),z97.strictObject({operation:z97.literal("runtime.status"),includeDevice:z97.literal(true).optional()}),z97.strictObject({operation:z97.literal("runtime.doctor")}),z97.strictObject({operation:z97.literal("runtime.inventory")}),z97.strictObject({operation:z97.literal("session.issue"),tenantId:z97.uuid(),deviceId:z97.uuid(),expiresAt:z97.iso.datetime({offset:true})}),z97.strictObject({operation:z97.literal("runtime.stop"),expectedRuntimeRevision:LocalRevisionSchema}),z97.strictObject({operation:z97.literal("execution.inspect"),input:LocalExecutionInspectInputSchema}),z97.strictObject({operation:z97.literal("execution.list"),input:LocalExecutionListInputSchema}),z97.strictObject({operation:z97.literal("update.check")}),z97.strictObject({operation:z97.literal("update.prepare"),targetVersion:LocalPackageVersionSchema,expectedRuntimeRevision:LocalRevisionSchema}),z97.strictObject({operation:z97.literal("update.apply"),planId:LocalIdSchema,targetVersion:LocalPackageVersionSchema,expectedRuntimeRevision:LocalRevisionSchema})]);var LocalNextActionSchema=z97.strictObject({call:LocalIpcCallSchema,availability:z97.enum(["AVAILABLE","BLOCKED"]),reason:z97.enum(["READY","INSTALL_REQUIRED","AUTHORIZATION_REQUIRED","VERSION_INCOMPATIBLE","UPDATE_AVAILABLE","RECOVERY_REQUIRED"])});var LocalIpcRequestSchema=z97.strictObject({protocol:z97.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema,call:LocalIpcCallSchema});var LocalVersionReportSchema=z97.strictObject({component:z97.enum(["CLI","SDK","MCP","RUNTIME","MEDIA_TOOLS"]),installedVersion:LocalPackageVersionSchema.nullable(),runningVersion:LocalPackageVersionSchema.nullable(),availableVersion:LocalPackageVersionSchema.nullable(),executablePath:z97.string().min(1).max(4096).nullable(),installOwner:z97.enum(["NPM_GLOBAL","PROJECT","NPX","MANAGED","TARBALL","UNKNOWN"])});var LocalRuntimeStatusSchema=z97.strictObject({protocol:z97.literal("NVS_LOCAL_IPC_V1"),runtimeRevision:LocalRevisionSchema,state:z97.enum(["IDLE","EXECUTING","DRAINING","RECOVERY_REQUIRED"]),journalSchemaVersion:z97.literal(1),workProtocols:z97.array(z97.enum(["NVS_LOCAL_WORK_V1","NVS_LOCAL_WORK_V2"])).min(1).max(2),versions:z97.array(LocalVersionReportSchema).max(8),deviceAuthority:z97.strictObject({tenantId:z97.uuid(),deviceId:z97.uuid(),origin:z97.url()}).optional(),deviceCapabilities:z97.strictObject({deviceRevision:LocalRevisionSchema,tenantMediaValidation:z97.boolean(),tenantMediaProcessing:z97.boolean(),processorCapabilities:z97.array(TenantProcessorKindSchema).max(TenantProcessorKindSchema.options.length)}).optional(),nextActions:z97.array(LocalNextActionSchema).max(8)});var LocalDoctorReportSchema=z97.strictObject({mode:z97.enum(["MANAGED","INSTALLED"]),availability:z97.enum(["AVAILABLE","UNAVAILABLE"]),reason:z97.enum(["QUALIFIED_PROCESS_TOOLS","MANAGED_TOOLS_MISSING","TOOL_QUALIFICATION_FAILED"]),nativeExecutionReady:z97.boolean(),executionProfiles:z97.array(z97.enum(["ROUGH_CUT_PREVIEW_V1","STUDIO_MEDIA_V2","AUDIO_MEDIA_V1"])).max(3).optional(),tools:z97.array(z97.strictObject({name:z97.enum(["FFMPEG","FFPROBE"]),path:z97.string().min(1).max(4096),version:z97.string().min(1).max(200),digest:z97.string().regex(/^[0-9a-f]{64}$/)})).max(2)});var LocalExecutionInspectionSchema=z97.strictObject({binding:LocalLeaseBindingSchema,revision:LocalRevisionSchema,phase:z97.enum(["STAGED","RUNNING","RECOVERY_REQUIRED","OUTPUT_PENDING","RECEIPT_RECORDED","FENCED"]),checkpoint:z97.enum(["ADOPTED","SOURCES_READY","PROCESS_STARTED","OUTPUT_STAGED"]),progress:LocalExecutionProgressSchema.optional()});var LocalExecutionPageSchema=z97.strictObject({items:z97.array(LocalExecutionInspectionSchema).max(16),nextCursor:z97.string().length(64).regex(/^[0-9a-f]{64}$/).nullable()});var LocalIpcErrorCodeSchema=z97.enum(["FORBIDDEN","INVALID_INPUT","FRAME_LIMIT","BUSY","AUTHORIZATION_REQUIRED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","AGENT_APPROVAL_REQUIRED","AGENT_RUNTIME_UNAVAILABLE","AGENT_LOGIN_REQUIRED","AGENT_VERSION_UNQUALIFIED","AGENT_GRANT_REQUIRED","AGENT_OUTCOME_UNKNOWN","AGENT_IMAGE_REQUIRED","AGENT_IMAGE_INVALID","AGENT_IMAGE_BUDGET_EXCEEDED","AGENT_IMAGE_AUTHORIZATION_REQUIRED","CACHE_QUOTA_EXCEEDED","LIBRARY_NOT_FOUND","LIBRARY_CONFLICT","LIBRARY_BYTES_INVALID","LIBRARY_ACCESS_DENIED","LIBRARY_SYNC_REQUIRED","LIBRARY_SYNC_UNAVAILABLE","LIBRARY_QUOTA_EXCEEDED"]);var LocalIpcResponseSchema=z97.discriminatedUnion("semanticStatus",[z97.strictObject({protocol:z97.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema,semanticStatus:z97.literal("SUCCESS"),data:z97.union([LocalLibraryCapabilitySchema,LocalLibraryUsageSchema,LocalLibraryItemSchema,LocalLibraryPageSchema,LocalLibraryProjectionSchema,LocalLibraryProjectionPageSchema,LocalLibraryReadReplySchema,LocalWorkspaceInspectionSchema,LocalDiagnosticsSchema,LocalOfflinePageSchema,LocalRuntimeStatusSchema,LocalDoctorReportSchema,LocalExecutionInspectionSchema.nullable(),z97.strictObject({state:z97.literal("DRAINING"),inventory:LocalManagementInventorySchema.optional(),backupPath:z97.string().min(1).max(4096).optional()}),LocalSessionConnectorSchema,LocalManagementInventorySchema,LocalExecutionPageSchema,LocalAgentProbeSchema,LocalAgentDiscoverySchema,LocalAgentReviewViewSchema])}),z97.strictObject({protocol:z97.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema.nullable(),semanticStatus:z97.enum(["BLOCKED","INVALID_INPUT"]),error:z97.strictObject({code:LocalIpcErrorCodeSchema})})]);var LocalMcpToolNameSchema=z98.enum(["local_navigate","local_capability_describe","local_runtime_status","local_execution_list","local_execution_inspect","local_update_check","local_library_list","local_library_get"]);var LocalMcpActionSchema=z98.strictObject({tool:LocalMcpToolNameSchema,arguments:z98.record(z98.string(),z98.unknown()),availability:z98.enum(["AVAILABLE","BLOCKED"]).optional(),reason:z98.string().max(100).optional()});var LocalMcpNavigationSchema=z98.strictObject({location:z98.literal("LOCAL"),state:z98.enum(["UNAVAILABLE","IDLE","EXECUTING","DRAINING","RECOVERY_REQUIRED"]),deviceAuthority:LocalRuntimeStatusSchema.shape.deviceAuthority,groups:z98.array(z98.strictObject({id:z98.string().max(40),label:z98.string().max(100),tools:z98.array(LocalMcpToolNameSchema).max(6)})).max(4),nextActions:z98.array(z98.union([LocalMcpActionSchema,LocalClientNextActionSchema])).max(16)});var LocalMcpExecutionPageSchema=LocalExecutionPageSchema.extend({nextActions:z98.array(LocalMcpActionSchema).max(16)});var LocalMcpInspectionSchema=z98.strictObject({location:z98.literal("LOCAL"),execution:LocalExecutionInspectionSchema.nullable(),nextActions:z98.array(LocalMcpActionSchema).max(4)});var LocalMcpUpdateSchema=z98.strictObject({location:z98.literal("LOCAL"),running:z98.array(LocalVersionReportSchema).max(8),available:z98.array(LocalRuntimeDescriptorSchema).max(32),nextActions:z98.array(LocalClientNextActionSchema).max(4)});var LocalMcpDescriptionSchema=z98.strictObject({location:z98.literal("LOCAL"),tool:LocalMcpToolNameSchema,schema:z98.object({name:LocalMcpToolNameSchema,description:z98.string(),inputSchema:z98.record(z98.string(),z98.unknown())}).passthrough()});var LocalMcpFailureSchema=z98.strictObject({semanticStatus:z98.enum(["BLOCKED","INVALID_INPUT"]),error:z98.strictObject({code:z98.enum(["AUTHORIZATION_REQUIRED","FORBIDDEN","LOCAL_RUNTIME_UNAVAILABLE","RELEASE_UNAVAILABLE","VERSION_INCOMPATIBLE","INVALID_INPUT","LOCAL_CAPABILITY_UNAVAILABLE"]),outcome:z98.literal("NO_WRITE")}),nextActions:z98.array(LocalClientNextActionSchema).max(4)});var LocalMcpOutputSchemas={local_library_list:LocalLibraryProjectionPageSchema.extend({location:z98.literal("LOCAL")}),local_library_get:z98.strictObject({location:z98.literal("LOCAL"),item:LocalLibraryProjectionSchema.nullable()}),local_navigate:LocalMcpNavigationSchema,local_capability_describe:LocalMcpDescriptionSchema,local_runtime_status:LocalRuntimeStatusSchema.omit({nextActions:true}).extend({nextActions:z98.array(LocalMcpActionSchema).max(8)}),local_execution_list:LocalMcpExecutionPageSchema,local_execution_inspect:LocalMcpInspectionSchema,local_update_check:LocalMcpUpdateSchema};import{z as z99}from"zod";var LocalManagementCommandSchema=z99.discriminatedUnion("kind",[z99.strictObject({kind:z99.literal("ENROLL"),input:EnrollLocalDeviceSchema}),z99.strictObject({kind:z99.literal("REVOKE_DEVICE"),input:RevokeLocalDeviceSchema}),z99.strictObject({kind:z99.literal("PREVIEW"),input:StartLocalPreviewSchema}),z99.strictObject({kind:z99.literal("FINAL_RENDER"),input:StartLocalFinalRenderSchema})]);var LocalManagementResultSchema=z99.union([LocalDeviceViewSchema,LocalPreviewAdmissionSchema,LocalFinalRenderAdmissionSchema,z99.strictObject({semanticStatus:z99.literal("SUCCESS")})]);var LocalManagementReceiptSchema=z99.strictObject({fingerprint:z99.string().regex(/^[a-f0-9]{64}$/),result:LocalManagementResultSchema.nullable()});var LocalDeviceManagementCommandSchema=LocalManagementCommandSchema;var ScopedLocalManagementReceiptSchema=z99.strictObject({tenantId:LocalIdSchema,command:LocalDeviceManagementCommandSchema}).refine(value2=>value2.tenantId.toLowerCase()===value2.command.input.tenantId.toLowerCase(),{message:"Management receipt must use the authorized tenant"});import{z as z101}from"zod";import{z as z100}from"zod";var TenantMediaComputeModeSchema=z100.enum(["STAGE_ONE","TENANT_TRUSTED_VALIDATOR"]);var tenantRenderValidationProfile={protocol:"NVS_TENANT_MEDIA_REPORT_V1",inspection:"STUDIO_DECODE_READBACK_V1"};var TenantMediaWorkSchema=LocalWorkScopeSchema.extend({protocol:z100.literal("NVS_TENANT_MEDIA_WORK_V1"),family:z100.enum(["ROUGH_CUT_RENDER","FINAL_RENDER"]),validationMode:z100.literal("TENANT_TRUSTED_VALIDATOR"),operationId:OperationIdSchema,originRequestFingerprint:LocalDigestSchema,basisFingerprint:LocalDigestSchema,policyRevision:LocalRevisionSchema,target:TenantDeviceTargetSchema,renderProfileDigest:LocalDigestSchema,validationProfileDigest:LocalDigestSchema,audioRequired:z100.boolean()});var renderChecks=["CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","POSTER_DECODE"];var renderCheck=z100.strictObject({key:z100.enum(renderChecks),result:z100.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"])});var TenantMediaValidationBodySchema=LocalLeaseBindingSchema.extend({schemaVersion:z100.literal(1),work:TenantMediaWorkSchema,originRequestFingerprint:LocalDigestSchema,requestId:LocalIdSchema,validationRequestId:LocalIdSchema,outputs:z100.array(MediaObjectVersionSchema).length(2),checks:z100.array(renderCheck).length(renderChecks.length),technical:RoughCutTechnicalSchema.nullable()}).superRefine((report,ctx)=>{const{work,outputs,checks}=report;if(work.tenantId!==report.tenantId||work.projectId!==report.projectId||work.productionId!==report.productionId||work.runtimeJobId!==report.runtimeJobId||work.originRequestFingerprint!==report.originRequestFingerprint)ctx.addIssue({code:"custom",path:["work"],message:"Work scope mismatch"});if(!outputs.some(output2=>output2.role==="VIDEO")||!outputs.some(output2=>output2.role==="POSTER")||new Set(outputs.map(output2=>output2.versionId)).size!==2||outputs.some(output2=>output2.tenantId!==report.tenantId||output2.projectId!==report.projectId))ctx.addIssue({code:"custom",path:["outputs"],message:"Exact video and poster versions required"});if(new Set(checks.map(check=>check.key)).size!==renderChecks.length||checks.some(check=>check.result==="NOT_APPLICABLE"!==(check.key==="AUDIO_DECODE"&&!work.audioRequired)))ctx.addIssue({code:"custom",path:["checks"],message:"Exact applicable checks required"});const video=outputs.find(output2=>output2.role==="VIDEO");if(checks.every(check=>check.result==="PASS"||check.result==="NOT_APPLICABLE")&&!report.technical||report.technical&&(report.technical.checksumSha256!==video?.checksumSha256||report.technical.byteSize!==video?.byteSize||report.technical.hasAudio!==work.audioRequired))ctx.addIssue({code:"custom",path:["technical"],message:"Exact inspected video required"})});var TenantMediaValidationReportSchema=TenantMediaValidationBodySchema.safeExtend({reportFingerprint:LocalDigestSchema,signature:z100.string().regex(/^[A-Za-z0-9_-]{86}$/)});var PrepareTenantMediaValidationSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputReceiptIds:z101.array(LocalIdSchema).length(2).refine(ids=>new Set(ids).size===2)});var TenantMediaValidationRequestSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,validationRequestId:LocalIdSchema,work:TenantMediaWorkSchema,outputs:z101.array(MediaObjectVersionSchema).length(2)});var TenantMediaValidationReadbackSchema=z101.strictObject({request:TenantMediaValidationRequestSchema,tickets:z101.array(MediaObjectTicketSchema).length(2)});var TenantMediaDownloadSchema=LocalProjectScopeSchema.extend({representationId:LocalIdSchema});var TenantMediaOutputStageSchema=z101.strictObject({ticket:MediaObjectTicketSchema,uploaded:z101.boolean()});var TenantRenderMediaInputSchema=TimelineScopeSchema.extend({renderId:z101.uuid(),role:z101.enum(["VIDEO","POSTER"])});var TenantRenderMediaTicketSchema=TenantRenderMediaInputSchema.extend({representationId:z101.uuid(),ticket:MediaObjectTicketSchema.extend({object:MediaObjectVersionSchema.extend({tenantId:z101.uuid(),projectId:z101.uuid(),versionId:z101.uuid()})})});var TenantMediaCapabilitySchema=z101.strictObject({tenantId:LocalIdSchema,validationMode:z101.literal("TENANT_TRUSTED_VALIDATOR")});import{z as z113}from"zod";import{z as z102}from"zod";var IMPORTED_VISUAL_PROFILE_ID="IMPORTED_H264_SDR_CFR30_VISUAL_V1";var IMPORTED_VISUAL_MAX_BYTES=128*1024*1024;var Hash=z102.string().regex(/^[0-9a-f]{64}$/);var PositiveInteger=z102.int().positive().max(1e9);var ImportedVisualRationalSchema=z102.strictObject({numerator:PositiveInteger,denominator:PositiveInteger});var geometry=limit=>z102.strictObject({width:z102.int().min(2).max(limit).multipleOf(2),height:z102.int().min(2).max(limit).multipleOf(2)}).refine(({width,height})=>width*9===height*16||width*16===height*9,"Only exact 16:9 or 9:16 geometry is supported");var ImportedVisualToolchainSchema=z102.strictObject({ffmpegVersion:z102.string().startsWith("ffmpeg version ").max(512),ffprobeVersion:z102.string().startsWith("ffprobe version ").max(512)});var ImportedVisualSourceInputSchema=z102.strictObject({contentType:z102.literal("video/mp4"),checksumSha256:Hash,byteSize:z102.int().min(32).max(IMPORTED_VISUAL_MAX_BYTES),executionClass:z102.enum(["LIVE","TEST_ONLY"])});var ImportedVisualSourceRangeSchema=z102.strictObject({clock:z102.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z102.int().min(0).max(1799),endFrame:z102.int().min(1).max(1800)}).refine(v=>v.endFrame>v.startFrame&&v.endFrame-v.startFrame<=360,"The half-open interval must contain 1 to 360 frames");var ImportedVisualNormalizationRequestSchema=z102.strictObject({schemaVersion:z102.literal(1),profileId:z102.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceInputSchema,sourceRange:ImportedVisualSourceRangeSchema,output:geometry(1920),audioPolicy:z102.enum(["REQUIRE_NO_AUDIO","SILENT_DERIVATIVE"]),expectedToolchain:ImportedVisualToolchainSchema});var ImportedVisualSourceMetadataSchema=z102.strictObject({...ImportedVisualSourceInputSchema.shape,geometry:geometry(3840),videoCodec:z102.literal("h264"),pixelFormat:z102.literal("yuv420p"),sampleAspectRatio:z102.literal("1:1"),rotationDegrees:z102.literal(0),startPts:z102.literal(0),timeBase:ImportedVisualRationalSchema,frameRate:ImportedVisualRationalSchema,frameCount:z102.int().min(1).max(3600),durationTicks:z102.int().positive().max(6e10),availableCfr30Frames:z102.int().min(0).max(1800),color:z102.strictObject({range:z102.enum(["tv","unknown"]),space:z102.enum(["bt709","unknown"]),transfer:z102.enum(["bt709","unknown"]),primaries:z102.enum(["bt709","unknown"])}),audio:z102.strictObject({codec:z102.literal("aac"),sampleRateHz:z102.union([z102.literal(44100),z102.literal(48e3)]),channels:z102.union([z102.literal(1),z102.literal(2)]),startPts:z102.int(),timeBase:ImportedVisualRationalSchema,durationTicks:z102.int().positive().max(6e10)}).nullable(),fullDecode:z102.literal(true),cfrTimestampsVerified:z102.literal(true)}).superRefine((v,ctx)=>{if(![v.durationTicks,v.timeBase.numerator,v.timeBase.denominator,v.frameRate.numerator,v.frameRate.denominator,v.frameCount,v.availableCfr30Frames].every(Number.isSafeInteger)||v.timeBase.denominator<=0||v.frameRate.numerator<=0||v.frameRate.denominator<=0)return;const ticks=BigInt(v.durationTicks)*BigInt(v.timeBase.numerator);const base2=BigInt(v.timeBase.denominator);const declaredFrames=ticks*BigInt(v.frameRate.numerator);const expectedFrames=BigInt(v.frameCount)*base2*BigInt(v.frameRate.denominator);if(ticks>60n*base2||declaredFrames!==expectedFrames||BigInt(v.availableCfr30Frames)!==ticks*30n/base2||v.audio&&BigInt(v.audio.durationTicks)*BigInt(v.audio.timeBase.numerator)>60n*BigInt(v.audio.timeBase.denominator))ctx.addIssue({code:"custom",message:"Media clock/count/duration metadata is inconsistent"})});var ImportedVisualInspectionSchema=z102.strictObject({profileId:z102.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,evidenceScope:z102.literal("TECHNICAL_MEDIA_ONLY")});var ImportedVisualNormalizationReceiptSchema=z102.strictObject({schemaVersion:z102.literal(1),request:ImportedVisualNormalizationRequestSchema,original:ImportedVisualSourceMetadataSchema,output:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,frameMap:z102.array(z102.strictObject({outputFrame:z102.int().min(0).max(359),sourceFrame:z102.int().min(0).max(3599),sourcePts:z102.int().min(0).max(6e10)})).min(1).max(360),audioDisposition:z102.enum(["NO_AUDIO_PRESENT","REMOVED_FROM_DERIVATIVE_ONLY"]),evidenceScope:z102.literal("TECHNICAL_MEDIA_ONLY")}).superRefine((v,ctx)=>{const count=v.request.sourceRange.endFrame-v.request.sourceRange.startFrame;const source3=v.original;if(![source3.frameRate.numerator,source3.frameRate.denominator,source3.timeBase.numerator,source3.timeBase.denominator,v.request.sourceRange.startFrame].every(Number.isSafeInteger)||source3.frameRate.numerator<=0||source3.frameRate.denominator<=0)return;const rounded=i=>(2n*BigInt(i)*30n*BigInt(source3.frameRate.denominator)+BigInt(source3.frameRate.numerator))/(2n*BigInt(source3.frameRate.numerator));const exactFrameMap=v.frameMap.every((m,i)=>{if(!Number.isSafeInteger(m.sourcePts)||!Number.isSafeInteger(m.sourceFrame))return false;const absoluteFrame=BigInt(v.request.sourceRange.startFrame+i);return BigInt(m.sourcePts)*BigInt(source3.timeBase.numerator)*BigInt(source3.frameRate.numerator)===BigInt(m.sourceFrame)*BigInt(source3.timeBase.denominator)*BigInt(source3.frameRate.denominator)&&rounded(m.sourceFrame)<=absoluteFrame&&(m.sourceFrame+1===source3.frameCount||rounded(m.sourceFrame+1)>absoluteFrame)});if(!exactFrameMap||v.request.sourceRange.endFrame>source3.availableCfr30Frames||v.output.geometry.width>source3.geometry.width||v.output.geometry.height>source3.geometry.height||v.output.geometry.width*source3.geometry.height!==v.output.geometry.height*source3.geometry.width)ctx.addIssue({code:"custom",message:"Receipt frame mapping or geometry violates the pinned profile"});if(v.output.frameCount!==count||v.frameMap.length!==count||v.frameMap.some((m,i)=>m.outputFrame!==i||m.sourceFrame>=v.original.frameCount)||v.output.frameRate.numerator!==30||v.output.frameRate.denominator!==1||v.output.audio||v.original.checksumSha256!==v.request.source.checksumSha256||v.original.byteSize!==v.request.source.byteSize||v.original.executionClass!==v.request.source.executionClass||v.output.executionClass!==v.original.executionClass||v.output.geometry.width!==v.request.output.width||v.output.geometry.height!==v.request.output.height||v.toolchain.ffmpegVersion!==v.request.expectedToolchain.ffmpegVersion||v.toolchain.ffprobeVersion!==v.request.expectedToolchain.ffprobeVersion||v.audioDisposition!==(v.original.audio?"REMOVED_FROM_DERIVATIVE_ONLY":"NO_AUDIO_PRESENT")||v.original.audio&&v.request.audioPolicy!=="SILENT_DERIVATIVE"){ctx.addIssue({code:"custom",message:"Normalization receipt does not match its exact request/source/output"})}});import{z as z103}from"zod";var Uuid=z103.uuid();var Hash2=z103.string().regex(/^[0-9a-f]{64}$/);var ImportedVisualOriginalRegisterSchema=z103.strictObject({deviceId:z103.uuid().toLowerCase().optional(),projectSourceArtifactId:z103.uuid().optional(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,expectedProductionRevision:z103.int().nonnegative(),source:z103.strictObject({contentType:z103.literal("video/mp4"),checksumSha256:Hash2,byteSize:z103.int().min(32).max(128*1024*1024),executionClass:z103.enum(["LIVE","TEST_ONLY"])}),declaredProvenance:z103.strictObject({originalName:z103.string().trim().min(1).max(255).optional(),authorship:z103.string().trim().min(1).max(500).optional(),license:z103.string().trim().min(1).max(500).optional()}),idempotencyKey:z103.string().trim().min(1).max(200)});var ImportedVisualFromProjectSourceSchema=ImportedVisualOriginalRegisterSchema.omit({source:true,projectSourceArtifactId:true}).extend({projectSourceArtifactId:Uuid});var ImportedVisualOriginalReviseSchema=ImportedVisualOriginalRegisterSchema.extend({sourceId:Uuid,expectedVersion:z103.int().positive()});var ImportedVisualNormalizeStartSchema=z103.strictObject({deviceExecution:DeviceRenderTargetSchema.optional(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,expectedProductionRevision:z103.int().nonnegative(),request:ImportedVisualNormalizationRequestSchema,idempotencyKey:z103.string().trim().min(1).max(200)});var ImportedVisualGetSchema=z103.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid});var ImportedVisualReviewSchema=z103.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,representationId:Uuid,checksumSha256:Hash2,expectedReviewVersion:z103.int().nonnegative(),observations:z103.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z103.string().trim().min(1).max(2500),idempotencyKey:z103.string().trim().min(1).max(200)});var ImportedVisualDecisionSchema=z103.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,reviewId:Uuid,expectedAcceptanceVersion:z103.int().nonnegative(),action:z103.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z103.boolean().default(false),reason:z103.string().trim().min(1).max(2500),idempotencyKey:z103.string().trim().min(1).max(200)});var ImportedVisualOriginalViewSchema=z103.strictObject({sourceId:Uuid,versionId:Uuid,version:z103.int().positive(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,artifactId:Uuid,representationId:Uuid,metadata:ImportedVisualSourceMetadataSchema,declaredProvenance:ImportedVisualOriginalRegisterSchema.shape.declaredProvenance.optional(),executionClass:z103.enum(["LIVE","TEST_ONLY"]),current:z103.boolean(),createdAt:z103.iso.datetime({offset:true})});var ImportedVisualNormalizationViewSchema=z103.strictObject({normalizationId:Uuid,runtimeJobId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,lifecycle:z103.string(),cancellationRequested:z103.boolean(),receipt:ImportedVisualNormalizationReceiptSchema.nullable(),output:z103.strictObject({artifactId:Uuid,representationId:Uuid,posterArtifactId:Uuid,posterRepresentationId:Uuid}).nullable()});import{z as z104}from"zod";var id7=z104.uuid().toLowerCase();var SourceSyncRuntimeStartSchema=SourceSyncAudioStartSchema.extend({deviceId:id7.optional()});var SourceSyncRuntimePublicationSchema=SourceSyncRuntimeStartSchema.transform(({deviceId,...publication})=>{void deviceId;return publication});var SourceSyncRuntimeScopeSchema=z104.strictObject({tenantId:id7,productionId:id7,requestId:id7});var SourceSyncRuntimeAdmissionSchema=z104.strictObject({requestId:id7,runtimeJobId:id7,productionRevision:z104.int().positive()});var SourceSyncRuntimeViewSchema=SourceSyncRuntimeAdmissionSchema.extend({normalizationId:id7,lifecycle:z104.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),cancellationRequested:z104.boolean(),output:SourceSyncAudioReceiptSchema.nullable()});import{z as z105}from"zod";var id8=z105.uuid().toLowerCase();var hash4=z105.string().regex(/^[0-9a-f]{64}$/);var SourceSyncMediaIdentitySchema=z105.strictObject({artifactId:id8,representationId:id8,checksumSha256:hash4});var sampleRange=z105.strictObject({startSample:z105.int().nonnegative(),endSample:z105.int().positive()}).refine(v=>v.endSample>v.startSample);var frameRange=z105.strictObject({startFrame:z105.int().nonnegative(),endFrame:z105.int().positive()}).refine(v=>v.endFrame>v.startFrame);var SourceSyncListeningEvidenceSchema=z105.discriminatedUnion("kind",[z105.strictObject({id:z105.string().trim().min(1).max(100),kind:z105.literal("AUDIO_LISTENING"),media:SourceSyncMediaIdentitySchema,coverage:z105.array(sampleRange).min(1).max(64),producer:z105.string().trim().min(1).max(200)}),z105.strictObject({id:z105.string().trim().min(1).max(100),kind:z105.literal("VIDEO_PLAYBACK"),media:SourceSyncMediaIdentitySchema,coverage:z105.array(frameRange).min(1).max(64),producer:z105.string().trim().min(1).max(200)})]);var SourceSyncObservationSchema=z105.strictObject({key:z105.enum(["AUDIBILITY","AUDIO_VISUAL_ALIGNMENT"]),status:z105.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE"]),confidence:z105.enum(["CLEAR","UNCERTAIN"]),observed:z105.string().trim().min(1).max(2e3),evidenceIds:z105.array(z105.string().trim().min(1).max(100)).max(64)});var SourceSyncReviewTargetSchema=z105.strictObject({version:SourceSyncAudioVersionSchema,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,sampleCount:z105.int().positive(),frameCount:z105.int().positive().max(360),currentReviewVersion:z105.int().nonnegative(),declarationScope:z105.literal("ATTRIBUTED_OBSERVATIONS_NOT_LISTENING_ATTESTATION")});var SourceSyncReviewInputSchema=SourceSyncAudioGetSchema.extend({tenantId:id8,productionId:id8,shotId:id8,versionId:id8,expectedReviewVersion:z105.int().nonnegative(),audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z105.array(SourceSyncListeningEvidenceSchema).max(64),observations:z105.array(SourceSyncObservationSchema).length(2),summary:z105.string().trim().min(1).max(4e3),idempotencyKey:z105.string().trim().min(1).max(200)});var SourceSyncReviewRecordSchema=z105.strictObject({id:id8,versionId:id8,reviewVersion:z105.int().positive(),tenantId:id8,productionId:id8,shotId:id8,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z105.array(SourceSyncListeningEvidenceSchema).max(64),observations:z105.array(SourceSyncObservationSchema).length(2),outcome:z105.enum(["PASS","FAIL","NEEDS_REVIEW"]),summary:z105.string(),createdByPrincipalId:id8,executionClass:z105.enum(["LIVE","TEST_ONLY"]),createdAt:z105.iso.datetime({offset:true})});var SourceSyncReviewGetSchema=SourceSyncAudioGetSchema.extend({tenantId:id8,productionId:id8,shotId:id8,versionId:id8,reviewId:id8});import{z as z106}from"zod";var ImportedVideoReviewRecordSchema=VideoReviewRecordSchema.omit({generationId:true,candidateId:true,preparationId:true,contractId:true,contractFingerprint:true}).extend({sourceKind:z106.literal("IMPORTED"),normalizationId:z106.uuid(),sourceId:z106.uuid(),sourceVersionId:z106.uuid(),planVersionId:z106.uuid(),shotPlanningRevision:z106.int().positive()});var ImportedVideoReviewReceiptSchema=z106.strictObject({semanticStatus:z106.literal("SUCCESS"),review:ImportedVideoReviewRecordSchema,productionRevision:z106.int().positive()});import{z as z107}from"zod";var ImportedVisualCancellationSchema=z107.strictObject({cancellationRequested:z107.boolean()});var ImportedVisualAdmissionSchema=z107.strictObject({semanticStatus:z107.literal("ACCEPTED"),normalizationId:z107.uuid(),runtimeJobId:z107.uuid(),sourceId:z107.uuid(),sourceVersionId:z107.uuid(),productionRevision:z107.int().positive(),deviceExecution:DeviceRenderReceiptSchema.optional()});var ImportedVisualReviewTargetSchema=ProgrammaticVideoReviewTargetSchema.omit({renderId:true,compositionId:true,compositionVersionId:true,compositionVersion:true,compositionFingerprint:true,renderManifestFingerprint:true}).extend({sourceKind:z107.literal("IMPORTED"),normalizationId:z107.uuid(),sourceId:z107.uuid(),sourceVersionId:z107.uuid(),latestReview:ImportedVideoReviewRecordSchema.nullable()});import{z as z108}from"zod";var ImportedVisualOriginalGetSchema=z108.strictObject({tenantId:z108.uuid(),productionId:z108.uuid(),sourceId:z108.uuid(),version:z108.int().positive().optional()});var ImportedVisualOriginalHistoryQuerySchema=z108.strictObject({tenantId:z108.uuid(),productionId:z108.uuid(),sourceId:z108.uuid(),beforeVersion:z108.int().positive().optional(),limit:z108.int().min(1).max(50).default(20)});var ImportedVisualOriginalHistorySchema=z108.strictObject({sourceId:z108.uuid(),items:z108.array(ImportedVisualOriginalViewSchema).max(50),nextBeforeVersion:z108.int().positive().nullable()});var ImportedVisualOriginalQuerySchema=z108.strictObject({tenantId:z108.uuid().toLowerCase(),productionId:z108.uuid().toLowerCase(),shotId:z108.uuid().toLowerCase().optional(),afterSourceId:z108.uuid().toLowerCase().optional(),limit:z108.int().min(1).max(50).default(20)});var ImportedVisualOriginalPageSchema=z108.strictObject({tenantId:z108.uuid(),productionId:z108.uuid(),items:z108.array(ImportedVisualOriginalViewSchema).max(50),nextAfterSourceId:z108.uuid().nullable()}).refine(p=>p.nextAfterSourceId===null||p.items.at(-1)?.sourceId===p.nextAfterSourceId);import{z as z109}from"zod";var Content=z109.string().min(44).max(178956972).refine(value2=>{if(value2.length%4||/[^A-Za-z0-9+/=]/.test(value2))return false;const padding=value2.endsWith("==")?2:value2.endsWith("=")?1:0;return value2.indexOf("=")===(padding?value2.length-padding:-1)},"Invalid base64").refine(value2=>{const alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return value2.endsWith("==")?alphabet.indexOf(value2.at(-3))%16===0:value2.endsWith("=")?alphabet.indexOf(value2.at(-2))%4===0:true},"Noncanonical base64");var ImportedVisualOriginalUploadSchema=ImportedVisualOriginalRegisterSchema.extend({contentBase64:Content});var ImportedVisualOriginalRevisionUploadSchema=ImportedVisualOriginalReviseSchema.extend({contentBase64:Content});var LegacyImportedVisualUploadSchema=ImportedVisualOriginalUploadSchema.omit({deviceId:true});var LegacyImportedVisualRevisionSchema=ImportedVisualOriginalRevisionUploadSchema.omit({deviceId:true});var LegacyImportedVisualProjectSourceSchema=ImportedVisualFromProjectSourceSchema.omit({deviceId:true});import{z as z110}from"zod";var DirectOriginalCommandSchema=z110.discriminatedUnion("operation",[z110.strictObject({operation:z110.literal("REGISTER"),input:ImportedVisualOriginalRegisterSchema}),z110.strictObject({operation:z110.literal("REVISE"),input:ImportedVisualOriginalReviseSchema})]);var DirectOriginalKeySchema=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({intakeId:LocalIdSchema});var DirectOriginalAdmissionSchema=z110.strictObject({state:z110.literal("SUBMITTED"),tenantId:z110.uuid(),projectId:z110.uuid(),productionId:z110.uuid(),intakeId:z110.uuid(),runtimeJobId:z110.uuid(),operationId:OperationIdSchema});var accepted=z110.strictObject({state:z110.literal("ACCEPTED"),original:ImportedVisualOriginalViewSchema});var DirectOriginalStageSchema=z110.discriminatedUnion("state",[accepted,DirectOriginalAdmissionSchema,DirectOriginalKeySchema.extend({state:z110.literal("UPLOAD"),ticket:MediaObjectTicketSchema,uploaded:z110.boolean()})]);var DirectOriginalSubmitSchema=z110.discriminatedUnion("state",[accepted,DirectOriginalAdmissionSchema]);import{z as z112}from"zod";import{z as z111}from"zod";var ArtifactLifecycleSchema=z111.enum(["CREATING","PROCESSING","READY","INVALID","ARCHIVED"]);var ArtifactMetadataSchema=z111.object({id:ArtifactIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),family:z111.string().trim().min(1),origin:z111.string().trim().min(1),lifecycle:ArtifactLifecycleSchema,createdByPrincipalId:PrincipalIdSchema,checksumSha256:z111.string().regex(/^[0-9a-f]{64}$/).nullable(),contentType:z111.string().trim().min(1).nullable(),primaryRepresentationId:ArtifactRepresentationIdSchema.nullable(),mediaMetadata:z111.record(z111.string(),z111.unknown()),createdAt:z111.iso.datetime({offset:true}),readyAt:z111.iso.datetime({offset:true}).nullable()});var ArtifactRepresentationSchema=z111.object({id:ArtifactRepresentationIdSchema,tenantId:TenantIdSchema,artifactId:ArtifactIdSchema,role:z111.string().trim().min(1),storageDriver:z111.string().trim().min(1),storageLocator:z111.record(z111.string(),z111.unknown()),checksumSha256:z111.string().regex(/^[0-9a-f]{64}$/),contentType:z111.string().trim().min(1),byteSize:z111.string().regex(/^\d+$/),width:z111.int().positive().nullable(),height:z111.int().positive().nullable(),durationMs:z111.string().regex(/^\d+$/).nullable(),frameRate:z111.string().nullable(),videoCodec:z111.string().nullable(),audioCodec:z111.string().nullable(),hasAudio:z111.boolean().nullable(),sampleRateHz:z111.int().positive().nullable(),audioChannels:z111.int().positive().nullable(),createdAt:z111.iso.datetime({offset:true})});var ArtifactRelationSchema=z111.object({id:ArtifactRelationIdSchema,tenantId:TenantIdSchema,sourceArtifactId:ArtifactIdSchema,targetArtifactId:ArtifactIdSchema,relationType:z111.string().trim().min(1),createdByPrincipalId:PrincipalIdSchema,createdAt:z111.iso.datetime({offset:true})});var RegisterReadyArtifactInputSchema=z111.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),principalId:PrincipalIdSchema,family:z111.string().trim().min(1),origin:z111.string().trim().min(1),representation:z111.object({role:z111.string().trim().min(1),storageDriver:z111.string().trim().min(1),storageLocator:z111.record(z111.string(),z111.unknown()),checksumSha256:z111.string().regex(/^[0-9a-f]{64}$/),contentType:z111.string().trim().min(1),byteSize:z111.string().regex(/^\d+$/),width:z111.int().positive().nullable(),height:z111.int().positive().nullable(),durationMs:z111.string().regex(/^\d+$/).nullable(),frameRate:z111.string().nullable(),videoCodec:z111.string().nullable(),audioCodec:z111.string().nullable(),hasAudio:z111.boolean().nullable(),sampleRateHz:z111.int().positive().nullable(),audioChannels:z111.int().positive().nullable()}),mediaMetadata:z111.record(z111.string(),z111.unknown()).default({}),provenance:z111.array(z111.object({targetArtifactId:ArtifactIdSchema,relationType:z111.string().trim().min(1)})).default([])});var ReadyArtifactRegistrationSchema=z111.object({artifact:ArtifactMetadataSchema,primaryRepresentation:ArtifactRepresentationSchema,relations:z111.array(ArtifactRelationSchema)});var SourceInputMetadataSchema=z111.strictObject({idempotencyKey:z111.string().trim().min(1).max(200).optional(),tenantId:TenantIdSchema,kind:z111.enum(["PRODUCT_INFORMATION","REFERENCE_IMAGE","REFERENCE_VIDEO"]),contentType:z111.enum(["text/plain","application/json","image/png","image/jpeg","image/webp","video/mp4"]),originalName:z111.string().trim().min(1).max(255).optional()});var UploadSourceInputRequestSchema=SourceInputMetadataSchema.extend({contentBase64:z111.string().min(4).max(11184812).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var DirectProjectSourceCommandSchema=z112.strictObject({projectId:LocalIdSchema,metadata:SourceInputMetadataSchema.extend({tenantId:LocalIdSchema.pipe(TenantIdSchema),idempotencyKey:z112.string().trim().min(1).max(200)}),checksumSha256:LocalDigestSchema,byteSize:z112.int().positive().max(8*1024*1024),requestedDeviceId:LocalIdSchema.optional()}).refine(({metadata})=>metadata.kind==="REFERENCE_VIDEO"?metadata.contentType==="video/mp4":metadata.kind==="REFERENCE_IMAGE"&&["image/png","image/jpeg","image/webp"].includes(metadata.contentType));var DirectProjectSourceKeySchema=LocalProjectScopeSchema.extend({intakeId:LocalIdSchema});var DirectProjectSourceAdmissionSchema=DirectProjectSourceKeySchema.extend({state:z112.literal("SUBMITTED"),productionId:LocalIdSchema,runtimeJobId:LocalIdSchema,operationId:OperationIdSchema});var accepted2=z112.strictObject({state:z112.literal("ACCEPTED"),registration:ReadyArtifactRegistrationSchema});var DirectProjectSourceStageSchema=z112.discriminatedUnion("state",[accepted2,DirectProjectSourceAdmissionSchema,DirectProjectSourceKeySchema.extend({state:z112.literal("UPLOAD"),ticket:MediaObjectTicketSchema,uploaded:z112.boolean()})]);var DirectProjectSourceSubmitSchema=z112.discriminatedUnion("state",[accepted2,DirectProjectSourceAdmissionSchema]);var LocalLibraryDestinationSchema=z113.discriminatedUnion("kind",[z113.strictObject({kind:z113.literal("ORIGINAL"),command:DirectOriginalCommandSchema}),z113.strictObject({kind:z113.literal("PROJECT_SOURCE"),command:DirectProjectSourceCommandSchema})]);function localLibraryInspectable(reference){if(reference.contentType==="video/mp4")return reference.byteSize>=32;return["image/png","image/jpeg","image/webp"].includes(reference.contentType)&&reference.byteSize>0&&reference.byteSize<=8*1024*1024}var sameId=(left,right)=>left.toLowerCase()===right.toLowerCase();function destinationMatches(destination,reference){if(destination.kind==="ORIGINAL"){const{input}=destination.command;return sameId(input.tenantId,reference.tenantId)&&sameId(input.projectId,reference.projectId)&&(!input.deviceId||sameId(input.deviceId,reference.deviceId))&&input.source.contentType===reference.contentType&&input.source.byteSize===reference.byteSize&&input.source.checksumSha256===reference.checksumSha256}const{command:command2}=destination;return sameId(command2.metadata.tenantId,reference.tenantId)&&sameId(command2.projectId,reference.projectId)&&(!command2.requestedDeviceId||sameId(command2.requestedDeviceId,reference.deviceId))&&command2.metadata.contentType===reference.contentType&&command2.byteSize===reference.byteSize&&command2.checksumSha256===reference.checksumSha256}var command=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({requestId:LocalIdSchema,reference:LocalLibraryReferenceSchema,accessRevision:z113.int().positive()});var LocalLibraryCommandSchema=z113.discriminatedUnion("action",[command.extend({action:z113.literal("INSPECT")}),command.extend({action:z113.literal("PUBLISH"),destination:LocalLibraryDestinationSchema})]).superRefine((value2,ctx)=>{if(value2.reference.tenantId!==value2.tenantId||value2.reference.projectId!==value2.projectId)ctx.addIssue({code:"custom",message:"Exact local file project required"});if(!localLibraryInspectable(value2.reference))ctx.addIssue({code:"custom",message:"A qualified media file version is required"});if(value2.action!=="PUBLISH")return;const d=value2.destination;if(d.kind==="ORIGINAL"){const input=d.command.input;if(!sameId(input.tenantId,value2.tenantId)||!sameId(input.projectId,value2.projectId)||!sameId(input.productionId,value2.productionId)||input.deviceId&&!sameId(input.deviceId,value2.reference.deviceId)||input.source.byteSize!==value2.reference.byteSize||input.source.checksumSha256!==value2.reference.checksumSha256||input.source.contentType!==value2.reference.contentType)ctx.addIssue({code:"custom",message:"Original must bind exact local file and native Production"})}else if(!sameId(d.command.metadata.tenantId,value2.tenantId)||!sameId(d.command.projectId,value2.projectId)||d.command.requestedDeviceId&&!sameId(d.command.requestedDeviceId,value2.reference.deviceId)||d.command.byteSize!==value2.reference.byteSize||d.command.checksumSha256!==value2.reference.checksumSha256||d.command.metadata.contentType!==value2.reference.contentType)ctx.addIssue({code:"custom",message:"Project SOURCE must bind exact local file"})});var LocalLibraryCommandQuerySchema=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({requestId:LocalIdSchema});var LocalLibraryAdmissionSchema=LocalWorkScopeSchema.extend({state:z113.literal("SUBMITTED"),requestId:LocalIdSchema,operationId:OperationIdSchema,reference:LocalLibraryReferenceSchema,accessRevision:z113.int().positive()});var LocalLibraryInspectionSchema=z113.discriminatedUnion("kind",[z113.strictObject({kind:z113.literal("VIDEO"),metadata:ImportedVisualSourceMetadataSchema}),z113.strictObject({kind:z113.literal("IMAGE"),checksumSha256:LocalDigestSchema,byteSize:z113.int().positive().max(8*1024*1024),width:z113.int().positive().max(4096),height:z113.int().positive().max(4096)})]);var LocalLibraryInspectRecipeSchema=z113.strictObject({processor:z113.literal("LOCAL_MEDIA_INSPECT"),reference:LocalLibraryReferenceSchema,accessRevision:z113.int().positive(),libraryProfileDigest:LocalDigestSchema}).refine(({reference})=>localLibraryInspectable(reference),"Qualified local inspection required");var LocalLibraryPublishRecipeSchema=z113.strictObject({processor:z113.literal("LOCAL_MEDIA_PUBLISH"),reference:LocalLibraryReferenceSchema,accessRevision:z113.int().positive(),libraryProfileDigest:LocalDigestSchema,destination:LocalLibraryDestinationSchema,object:MediaObjectVersionSchema.extend({role:z113.literal("SOURCE")})}).refine(({reference,object,destination})=>localLibraryInspectable(reference)&&destinationMatches(destination,reference)&&object.tenantId===reference.tenantId&&object.projectId===reference.projectId&&object.checksumSha256===reference.checksumSha256&&object.byteSize===reference.byteSize,"Publication must use the exact local file version and native destination");var LocalLibraryInspectEvidenceSchema=z113.strictObject({processor:z113.literal("LOCAL_MEDIA_INSPECT"),inspection:LocalLibraryInspectionSchema});var LocalLibraryPublishEvidenceSchema=z113.strictObject({processor:z113.literal("LOCAL_MEDIA_PUBLISH"),inspection:LocalLibraryInspectionSchema});import{z as z125}from"zod";import{z as z124}from"zod";import{z as z114}from"zod";var sha16=z114.string().regex(/^[0-9a-f]{64}$/);var TemporalEvidenceSourceSchema=z114.strictObject({tenantId:z114.uuid(),projectId:z114.uuid(),productionId:z114.uuid(),artifactId:z114.uuid(),representationId:z114.uuid(),checksumSha256:sha16,byteSize:z114.int().positive().max(128*1024*1024),width:z114.int().min(16).max(4096),height:z114.int().min(16).max(4096),durationMs:z114.int().positive().max(6e4),frameRate:z114.number().min(1).max(60),frameCount:z114.int().positive().max(3600),videoCodec:z114.literal("h264"),executionClass:z114.enum(["LIVE","TEST_ONLY"])}).refine(v=>Math.abs(v.frameCount/v.frameRate*1e3-v.durationMs)<=150,"Exact frame count, duration and rate must agree");var TemporalRiskWindowSchema=z114.strictObject({startMs:z114.int().nonnegative().max(6e4),endMs:z114.int().positive().max(6e4),reason:z114.enum(["TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])}).refine(v=>v.endMs>v.startMs,"Risk window must advance");var TemporalSamplingProfileSchema=z114.strictObject({id:z114.literal("ADAPTIVE_TEMPORAL_V1"),motion:z114.enum(["NORMAL","HIGH"]),lockedIdentity:z114.boolean(),windows:z114.array(TemporalRiskWindowSchema).max(32)});var TemporalSampleSchema=z114.strictObject({ordinal:z114.int().nonnegative().max(63),frameIndex:z114.int().nonnegative().max(3599),timestampMs:z114.number().nonnegative().max(6e4),reasons:z114.array(z114.enum(["START","END","INTERIOR","HIGH_MOTION","LOCKED_IDENTITY","TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])).min(1).max(9)});var TemporalSamplingPlanSchema=z114.strictObject({schemaVersion:z114.literal(1),source:TemporalEvidenceSourceSchema,profile:TemporalSamplingProfileSchema,samples:z114.array(TemporalSampleSchema).min(1).max(64),frameWidth:z114.int().min(16).max(320),frameHeight:z114.int().min(16).max(320),columns:z114.int().min(1).max(4),rows:z114.int().min(1).max(16),gutterPx:z114.literal(8)}).superRefine((p,ctx)=>{const s=p.samples;if(s[0]?.frameIndex!==0||s.at(-1)?.frameIndex!==p.source.frameCount-1||p.rows!==Math.ceil(s.length/p.columns)||p.columns!==Math.min(4,s.length)||s.some((v,i)=>v.ordinal!==i||v.frameIndex>=p.source.frameCount||Math.abs(v.timestampMs-v.frameIndex*1e3/p.source.frameRate)>.001||i>0&&v.frameIndex<=s[i-1].frameIndex||new Set(v.reasons).size!==v.reasons.length)||p.profile.windows.some(w=>w.endMs>p.source.durationMs))ctx.addIssue({code:"custom",message:"Temporal samples must preserve exact bounded source order, time and layout"})});var ExtractedTemporalFrameSchema=z114.strictObject({sample:TemporalSampleSchema,checksumSha256:sha16,byteSize:z114.int().positive().max(2*1024*1024),width:z114.int().positive().max(320),height:z114.int().positive().max(320),contentType:z114.literal("image/png")});var TemporalEvidenceManifestSchema=z114.strictObject({schemaVersion:z114.literal(1),plan:TemporalSamplingPlanSchema,engineVersion:z114.string().min(1).max(200),frames:z114.array(ExtractedTemporalFrameSchema).min(1).max(64),sheet:z114.strictObject({checksumSha256:sha16,byteSize:z114.int().positive().max(16*1024*1024),width:z114.int().positive().max(1320),height:z114.int().positive().max(5256),contentType:z114.literal("image/png")})}).superRefine((m,ctx)=>{const p=m.plan;if(m.frames.length!==p.samples.length||m.frames.some((f,i)=>JSON.stringify(f.sample)!==JSON.stringify(p.samples[i])||f.width!==p.frameWidth||f.height!==p.frameHeight)||m.sheet.width!==p.columns*p.frameWidth+(p.columns+1)*p.gutterPx||m.sheet.height!==p.rows*p.frameHeight+(p.rows+1)*p.gutterPx)ctx.addIssue({code:"custom",message:"Evidence frames and sheet must match the exact sampling plan"})});function processorToolchain(raw,processor){const parsed=LocalToolchainSchema.safeParse(raw);if(!parsed.success)return null;const value2=parsed.data;if(processor!=="SPEECH_SYNTHESIZE_CPU"){if(value2.profile.kind!=="STUDIO_MEDIA_V2")return null;return selectLocalToolchain(value2,value2.profile.contractDigest)}const selected=value2.profile.kind==="AUDIO_MEDIA_V1"?value2:value2.supported?.find(s=>s.profile.kind==="AUDIO_MEDIA_V1");if(!selected)return null;const{supported,...base2}=value2;void supported;return LocalToolchainSchema.parse({...base2,profile:selected.profile,rendererVersion:selected.rendererVersion,rendererDigest:selected.rendererDigest})}import{z as z119}from"zod";import{z as z118}from"zod";import{z as z116}from"zod";import{z as z115}from"zod";var sha17=z115.string().regex(/^[0-9a-f]{64}$/);var name=z115.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/);var CompositionPathSchema=z115.string().max(240).regex(/^[A-Za-z0-9_-][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.-]+)*$/).refine(v=>!v.split("/").some(p=>p==="."||p===".."));var CompositionScopeSchema=z115.strictObject({tenantId:z115.uuid(),productionId:z115.uuid()});var CompositionBasisPinSchema=z115.strictObject({briefVersionId:z115.uuid(),storyVersionId:z115.uuid(),planVersionId:z115.uuid(),shotId:z115.uuid().nullable()});var CompositionBindingSchema=z115.strictObject({name,purpose:z115.enum(["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK","DATA","FONT","IMAGE","VIDEO"]),artifactId:z115.uuid(),representationId:z115.uuid(),checksumSha256:sha17,declaredOrigin:z115.enum(["CODE","AI","HUMAN","IMPORTED","UNKNOWN"])});var parameter=z115.discriminatedUnion("type",[z115.strictObject({name,type:z115.literal("STRING"),value:z115.string().max(4e3),maxLength:z115.int().min(0).max(4e3)}).refine(v=>v.value.length<=v.maxLength),z115.strictObject({name,type:z115.literal("NUMBER"),value:z115.number().finite(),minimum:z115.number().finite(),maximum:z115.number().finite()}).refine(v=>v.minimum<=v.value&&v.value<=v.maximum),z115.strictObject({name,type:z115.literal("BOOLEAN"),value:z115.boolean()})]);var CompositionContentSchema=z115.strictObject({schemaVersion:z115.literal(1),provider:z115.literal("HYPERFRAME"),dialect:z115.literal("HYPERFRAME_HTML_GSAP_V1"),role:z115.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),executionClass:z115.enum(["LIVE","TEST_ONLY"]),intent:z115.string().trim().min(1).max(2e3),viewport:z115.strictObject({width:z115.int().min(1).max(8192),height:z115.int().min(1).max(8192)}),clock:z115.strictObject({numerator:z115.int().positive(),denominator:z115.int().positive(),frameCount:z115.int().positive().max(2147483647)}),entrypoint:CompositionPathSchema,parameterSchemaVersion:z115.literal(1),parameters:z115.array(parameter).max(64),bindings:z115.array(CompositionBindingSchema).min(3).max(64),dependencies:z115.array(z115.strictObject({name:z115.string().regex(/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/),version:z115.string().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),integrity:z115.string().regex(/^sha(?:256|384|512)-[A-Za-z0-9+/]+={0,2}$/)})).min(1).max(64),randomSeed:z115.int().nonnegative().max(4294967295).nullable()}).superRefine((c,ctx)=>{for(const list of[c.parameters,c.bindings,c.dependencies])if(new Set(list.map(x=>x.name)).size!==list.length)ctx.addIssue({code:"custom",message:"Names must be unique within each input group"});for(const purpose of["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK"])if(c.bindings.filter(x=>x.purpose===purpose).length!==1)ctx.addIssue({code:"custom",path:["bindings"],message:"Exactly one "+purpose+" binding is required"});if(c.bindings.find(x=>x.purpose==="SOURCE")?.declaredOrigin!=="CODE")ctx.addIssue({code:"custom",path:["bindings"],message:"Programmatic source must retain CODE provenance"});for(const p of["@hyperframes/engine","@hyperframes/producer","gsap"])if(!c.dependencies.some(x=>x.name===p))ctx.addIssue({code:"custom",path:["dependencies"],message:"Missing authoring dependency: "+p})});var CompositionSourceBundleSchema=z115.strictObject({schemaVersion:z115.literal(1),entrypoint:CompositionPathSchema,files:z115.array(z115.strictObject({path:CompositionPathSchema,contentType:z115.enum(["text/html","text/css","text/javascript","image/svg+xml","application/json"]),content:z115.string().max(1048576)})).min(1).max(128)}).superRefine((b,ctx)=>{if(new Set(b.files.map(x=>x.path)).size!==b.files.length)ctx.addIssue({code:"custom",message:"Source paths must be unique"});if(!b.files.some(x=>x.path===b.entrypoint&&x.contentType==="text/html"))ctx.addIssue({code:"custom",message:"Entrypoint must resolve to a declared HTML file"})});var SubmitCompositionSchema=CompositionScopeSchema.extend({compositionId:z115.uuid().nullable(),expectedVersion:z115.int().nonnegative(),previousVersionId:z115.uuid().nullable(),expectedProductionRevision:z115.int().positive(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,idempotencyKey:z115.string().trim().min(1).max(200)}).superRefine((i,ctx)=>{if(i.expectedVersion===0!==(i.compositionId===null&&i.previousVersionId===null)||i.expectedVersion>0&&(!i.compositionId||!i.previousVersionId))ctx.addIssue({code:"custom",message:"Create and exact-version revision identities must not be mixed"});if(i.content.role==="PRIMARY_VISUAL"&&!i.basis.shotId)ctx.addIssue({code:"custom",message:"Primary visual must bind a planned Shot"})});var CompositionGetSchema=CompositionScopeSchema.extend({compositionId:z115.uuid(),versionId:z115.uuid().optional()});var CompositionHistorySchema=CompositionScopeSchema.extend({compositionId:z115.uuid(),limit:z115.int().min(1).max(100).default(20),beforeVersion:z115.int().positive().optional()});var CompositionInputFactSchema=CompositionBindingSchema.extend({contentType:z115.string().min(1),byteSize:z115.int().positive().max(67108864),registeredOrigin:z115.string().min(1),executionClass:z115.enum(["LIVE","TEST_ONLY"]).nullable()});var CompositionVersionSchema=CompositionScopeSchema.extend({id:z115.uuid(),compositionId:z115.uuid(),projectId:z115.uuid(),version:z115.int().positive(),previousVersionId:z115.uuid().nullable(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,inputs:z115.array(CompositionInputFactSchema).min(3).max(64),fingerprint:sha17,createdByPrincipalId:z115.uuid(),createdAt:z115.iso.datetime({offset:true})}).refine(v=>v.version===1===(v.previousVersionId===null));var CompositionReceiptSchema=z115.strictObject({semanticStatus:z115.literal("SUCCESS"),version:CompositionVersionSchema,productionRevision:z115.int().positive()});var CompositionViewSchema=z115.strictObject({version:CompositionVersionSchema,isCurrent:z115.boolean(),basisStatus:z115.enum(["CURRENT","STALE"]),inputStatus:z115.enum(["AVAILABLE","UNAVAILABLE"]),byteReadback:z115.literal("NOT_CHECKED")});var CompositionPageSchema=z115.strictObject({items:z115.array(CompositionViewSchema).max(100),hasMore:z115.boolean(),nextBeforeVersion:z115.int().positive().nullable()});var CompositionDependencyManifestSchema=z115.object({dependencies:z115.record(z115.string(),z115.string())});var CompositionDependencyLockSchema=z115.object({lockfileVersion:z115.literal(3),packages:z115.record(z115.string(),z115.object({version:z115.string().optional(),integrity:z115.string().optional(),dependencies:z115.record(z115.string(),z115.string()).optional()}))});var HyperframeLegacyRenderProfileSchema=z116.strictObject({id:z116.literal("HYPERFRAME_1080P30_FULL_PAINT_V1"),adapter:z116.literal("native-hyperframe-v1"),engine:z116.literal("0.8.134"),producer:z116.literal("0.8.134"),gsap:z116.literal("3.15.0"),node:z116.string().min(1).max(80),browser:z116.string().min(1).max(160),browserSha256:z116.string().regex(/^[0-9a-f]{64}$/),ffmpeg:z116.string().min(1).max(240),maxFrames:z116.literal(360),timeoutMs:z116.literal(6e5),maxRssBytes:z116.literal(3221225472),maxScratchBytes:z116.literal(3221225472),maxOutputBytes:z116.literal(134217728),maxCpuMs:z116.literal(6e5),capture:z116.literal("PNG_SOFTWARE_SCREENSHOT_FULL_PAINT"),encode:z116.literal("H264_YUV420P_CRF18_THREADS2_NO_AUDIO")});var HyperframeCachedRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z116.literal("HYPERFRAME_1080P30_FRAME_CACHE_V2"),adapter:z116.literal("native-hyperframe-cache-v2"),encode:z116.literal("H264_YUV420P_CRF18_VERYFAST_THREADS2_NO_AUDIO")});var HyperframeRenderProfileSchema=z116.discriminatedUnion("id",[HyperframeLegacyRenderProfileSchema,HyperframeCachedRenderProfileSchema]);var CompositionRenderStartSchema=CompositionGetSchema.extend({versionId:z116.uuid(),fingerprint:z116.string().regex(/^[0-9a-f]{64}$/),expectedProductionRevision:z116.int().positive(),profileId:z116.enum(["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2","HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"]),idempotencyKey:z116.string().trim().min(1).max(200),deviceId:z116.uuid().toLowerCase().optional()});var CompositionRenderGetSchema=CompositionScopeSchema.extend({renderId:z116.uuid()});var CompositionRenderManifestSchema=z116.strictObject({schemaVersion:z116.literal(1),version:CompositionVersionSchema,profile:HyperframeRenderProfileSchema,firstFrame:z116.literal(0),frameCount:z116.int().min(1).max(360)}).superRefine((m,ctx)=>{if(m.frameCount!==m.version.content.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728)ctx.addIssue({code:"custom",message:"Exact frame count and aggregate input budget required"})});var CompositionRenderReceiptSchema=z116.strictObject({semanticStatus:z116.literal("ACCEPTED"),renderId:z116.uuid(),runtimeJobId:z116.uuid(),compositionVersionId:z116.uuid(),manifestFingerprint:z116.string().regex(/^[0-9a-f]{64}$/),productionRevision:z116.int().positive()});var CompositionRenderTechnicalSchema=z116.strictObject({width:z116.literal(1920),height:z116.literal(1080),frameRate:z116.literal(30),frameCount:z116.int().min(1).max(360),durationMs:z116.number().positive(),contentType:z116.literal("video/mp4"),videoCodec:z116.literal("h264"),pixelFormat:z116.literal("yuv420p"),hasAudio:z116.literal(false),fullDecode:z116.literal(true),checksumSha256:z116.string().regex(/^[0-9a-f]{64}$/),byteSize:z116.int().min(1).max(134217728),decodedFramesSha256:z116.string().regex(/^[0-9a-f]{64}$/)});var CompositionRenderResourcesSchema=z116.strictObject({sampleIntervalMs:z116.literal(100),sampledTreePeakRssBytes:z116.int().nonnegative(),sampledTreeCpuMs:z116.number().nonnegative(),observedPids:z116.int().nonnegative(),scratchPeakBytes:z116.int().nonnegative(),wallMs:z116.number().nonnegative(),processGroupCleaned:z116.literal(true)});import{z as z117}from"zod";var HyperframeAlphaRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z117.literal("HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"),adapter:z117.literal("native-hyperframe-alpha-v1"),encode:z117.literal("RGBA_PNG_SEQUENCE_30_V1"),maxOutputBytes:z117.literal(67108864),maxDecodedBytes:z117.literal(536870912)});var CompositionFrameRenderManifestSchema=z117.strictObject({...CompositionRenderManifestSchema.shape,schemaVersion:z117.literal(2),profile:HyperframeAlphaRenderProfileSchema}).superRefine((m,context)=>{const c=m.version.content;if(m.frameCount!==c.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728||c.role!=="VISUAL_LAYER"||c.viewport.width>1920||c.viewport.height>1920||c.viewport.width*c.viewport.height>1920*1080||c.viewport.width*c.viewport.height*m.frameCount*4>m.profile.maxDecodedBytes||c.clock.numerator!==30||c.clock.denominator!==1)context.addIssue({code:"custom",message:"Qualified CODE alpha geometry/role/clock/decoded budget mismatch"})});var CompositionFrameTechnicalSchema=z117.strictObject({profileId:z117.literal("RGBA_PNG_SEQUENCE_30_V1"),width:z117.int().min(1).max(1920),height:z117.int().min(1).max(1920),frameRate:z117.literal(30),frameCount:z117.int().min(1).max(360),alpha:z117.literal("STRAIGHT_RGBA"),fullDecode:z117.literal(true),frames:z117.array(z117.strictObject({ordinal:z117.int().min(0).max(359),checksumSha256:z117.string().regex(/^[0-9a-f]{64}$/),byteSize:z117.int().min(1).max(16777216)})).min(1).max(360)}).superRefine((value2,context)=>{if(value2.frames.length!==value2.frameCount||value2.frames.some((f,i)=>f.ordinal!==i)||value2.width*value2.height>1920*1080||value2.width*value2.height*value2.frameCount*4>536870912||value2.frames.reduce((n,f)=>n+f.byteSize,0)>67108864)context.addIssue({code:"custom",message:"CODE frame order/geometry/byte budget mismatch"})});var CompositionFrameRenderOutputSchema=z117.strictObject({sequence:VisualFrameSequenceSchema,technical:CompositionFrameTechnicalSchema,resources:CompositionRenderResourcesSchema}).superRefine((output2,context)=>{if(output2.sequence.width!==output2.technical.width||output2.sequence.height!==output2.technical.height||output2.sequence.frameCount!==output2.technical.frameCount||output2.sequence.frames.some((frame2,i)=>frame2.ordinal!==output2.technical.frames[i]?.ordinal||frame2.checksumSha256!==output2.technical.frames[i]?.checksumSha256||frame2.byteSize!==output2.technical.frames[i]?.byteSize))context.addIssue({code:"custom",message:"CODE frame output must identify the exact native sequence"})});var CompositionRenderManifestReaderSchema=z118.discriminatedUnion("schemaVersion",[CompositionRenderManifestSchema,CompositionFrameRenderManifestSchema]);var CompositionRenderViewSchema=z118.strictObject({sourceIdentity:z118.strictObject({tenantId:z118.uuid(),projectId:z118.uuid(),productionId:z118.uuid(),compositionId:z118.uuid(),versionId:z118.uuid(),fingerprint:z118.string().regex(/^[0-9a-f]{64}$/),shotId:z118.uuid().nullable(),role:z118.enum(["PRIMARY_VISUAL","VISUAL_LAYER"])}).optional(),frameOutput:CompositionFrameRenderOutputSchema.optional(),receipt:CompositionRenderReceiptSchema,lifecycle:z118.string().min(1).max(80),cancellationRequested:z118.boolean(),failureClassification:z118.string().min(1).max(80).nullable(),output:z118.strictObject({artifactId:z118.uuid(),representationId:z118.uuid(),technical:CompositionRenderTechnicalSchema,resources:CompositionRenderResourcesSchema}).nullable()}).superRefine((view,context)=>{if(view.sourceIdentity&&view.sourceIdentity.versionId!==view.receipt.compositionVersionId)context.addIssue({code:"custom",message:"Render source identity must bind the admitted exact version"});if(view.frameOutput&&view.output!==null)context.addIssue({code:"custom",message:"CODE frame output must match its render Production and exclude an MP4 output"})});var CompositionRenderCancellationSchema=z118.strictObject({cancellationRequested:z118.boolean()});var identity2=z119.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema});var ProcessorCompositionAllocationSchema=z119.strictObject({sequence:identity2,frames:z119.array(identity2).min(1).max(360)}).refine(({sequence,frames})=>{const entries=[sequence,...frames];return new Set(entries.map(entry=>entry.artifactId)).size===entries.length&&new Set(entries.map(entry=>entry.representationId)).size===entries.length});var processorCompositionFields={manifest:CompositionRenderManifestReaderSchema,allocation:ProcessorCompositionAllocationSchema.nullable()};var base={processor:z119.literal("COMPOSITION_RENDER"),resources:CompositionRenderResourcesSchema};var ProcessorCompositionVideoEvidenceSchema=z119.strictObject({...base,format:z119.literal("MP4"),technical:CompositionRenderTechnicalSchema});var ProcessorCompositionSequenceEvidenceSchema=z119.strictObject({...base,format:z119.literal("RGBA_SEQUENCE"),technical:CompositionFrameTechnicalSchema,sequence:VisualFrameSequenceSchema});var ProcessorCompositionEvidenceSchema=z119.discriminatedUnion("format",[ProcessorCompositionVideoEvidenceSchema,ProcessorCompositionSequenceEvidenceSchema]);import{z as z123}from"zod";import{z as z120}from"zod";var VisualSequenceScopeSchema=z120.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var RegisterVisualSequenceSchema=VisualSequenceScopeSchema.extend({deviceId:z120.uuid().toLowerCase().optional(),productionId:ProductionIdSchema.nullable(),idempotencyKey:z120.string().trim().min(1).max(200),width:z120.int().min(1).max(1920),height:z120.int().min(1).max(1920),frameArtifactIds:z120.array(ArtifactIdSchema).min(1).max(360)}).refine(v=>v.width*v.height<=1920*1080&&new Set(v.frameArtifactIds).size===v.frameArtifactIds.length,"Sequence requires bounded geometry and unique ordered frame Artifacts");var VisualSequenceGetSchema=VisualSequenceScopeSchema.extend({artifactId:ArtifactIdSchema});var LegacyVisualSequenceRegistrationSchema=z120.strictObject(RegisterVisualSequenceSchema.shape).omit({deviceId:true}).refine(input=>RegisterVisualSequenceSchema.safeParse(input).success);var VisualSequenceRegistrationAdmissionSchema=z120.strictObject({semanticStatus:z120.literal("ACCEPTED"),requestId:z120.uuid(),runtimeJobId:z120.uuid(),runtimeProductionId:ProductionIdSchema,operationId:OperationIdSchema,artifactId:ArtifactIdSchema,representationId:z120.uuid()});var VisualSequenceViewSchema=z120.strictObject({sequence:VisualFrameSequenceSchema,freshness:z120.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z120.array(z120.enum(["SEQUENCE_UNAVAILABLE","FRAME_UNAVAILABLE"])).max(2),createdAt:z120.iso.datetime({offset:true})});var VisualSequenceQuerySchema=VisualSequenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VisualSequencePageSchema=z120.strictObject({items:z120.array(VisualSequenceViewSchema).max(100),page:QueryPageInfoSchema});var{checksumSha256:_checksum,...manifestShape}=VisualFrameSequenceSchema.shape;var VisualSequenceManifestSchema=z120.strictObject(manifestShape).superRefine((value2,context)=>{if(!VisualFrameSequenceSchema.safeParse({...value2,checksumSha256:"0".repeat(64)}).success)context.addIssue({code:"custom",message:"Invalid canonical frame sequence manifest"})});import{z as z121}from"zod";var TranscribeAudioRecipeSchema=z121.strictObject({processor:z121.literal("TRANSCRIBE_AUDIO"),source:ObservationSourceSchema.extend({contentType:z121.literal("audio/wav")}),identity:LocalWhisperIdentitySchema});var TranscribeAudioEvidenceSchema=z121.strictObject({processor:z121.literal("TRANSCRIBE_AUDIO"),identity:LocalWhisperIdentitySchema,transcript:TranscriptSchema.refine(transcript=>transcript.timing==="UNAVAILABLE"),inputPcmSha256:LocalDigestSchema,inputPcmByteSize:z121.int().min(44).max(1920044)});var QwenAsrRecipeSchema=z121.strictObject({processor:z121.literal("TRANSCRIBE_EXTERNAL_QWEN"),observationId:LocalIdSchema,quoteFingerprint:LocalDigestSchema,credential:QwenDeviceCredentialIdentitySchema,source:TranscribeAudioRecipeSchema.shape.source,parameters:z121.strictObject({context:z121.string().max(2e3).refine(value2=>!value2.includes("\0")).optional(),language:z121.string().regex(/^[a-zA-Z][a-zA-Z0-9-]{1,19}$/).optional(),enable_itn:z121.boolean().optional()})});var asrTokens=z121.int().min(0).max(1e7).optional();var QwenAsrEvidenceSchema=z121.strictObject({processor:z121.literal("TRANSCRIBE_EXTERNAL_QWEN"),providerRequestId:z121.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),model:z121.literal("qwen3-asr-flash-2026-02-10"),usage:z121.strictObject({seconds:z121.int().min(0).max(60).optional(),prompt_tokens:asrTokens,completion_tokens:asrTokens,total_tokens:asrTokens}),transcript:TranscriptSchema.options[0]});import{z as z122}from"zod";var CpuSpeechRecipeSchema=CpuSpeechInputSchema.extend({processor:z122.literal("SPEECH_SYNTHESIZE_CPU"),identity:CpuSpeechIdentitySchema,voiceProfile:VoiceProfileUseSchema}).refine(v=>v.voiceProfile.language===v.language);var CpuSpeechEvidenceSchema=SpeechSynthesisEvidenceSchema.extend({processor:z122.literal("SPEECH_SYNTHESIZE_CPU"),sourceMedia:z122.strictObject({sampleRateHz:z122.literal(24e3),audioChannels:z122.literal(1),sampleCount:z122.int().min(2400).max(144e4)})});var sourceReference=z123.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema,byteSize:MediaObjectVersionSchema.shape.byteSize,checksumSha256:LocalDigestSchema,contentType:z123.string().min(1).max(100)});var source2=sourceReference.extend({contentType:z123.literal("video/mp4")});var normalize=z123.strictObject({processor:z123.literal("IMPORTED_VISUAL_NORMALIZE"),source:source2,request:ImportedVisualNormalizationRequestSchema}).refine(({request,source:source3})=>request.source.byteSize===source3.byteSize&&request.source.checksumSha256===source3.checksumSha256,"Original representation must match the normalization request");var audio=z123.strictObject({processor:z123.literal("SOURCE_SYNC_AUDIO"),source:source2,input:ImportedVisualSourceInputSchema,extraction:ImportedSynchronousAudioExtractionSchema}).refine(value2=>value2.source.checksumSha256===value2.input.checksumSha256&&value2.source.checksumSha256===value2.extraction.originalChecksumSha256&&value2.source.representationId===value2.extraction.originalRepresentationId&&value2.source.artifactId===value2.extraction.originalArtifactId&&value2.source.byteSize===value2.input.byteSize);var temporal=z123.strictObject({processor:z123.literal("TEMPORAL_SAMPLE"),source:source2,plan:TemporalSamplingPlanSchema}).refine(value2=>value2.source.checksumSha256===value2.plan.source.checksumSha256&&value2.source.representationId===value2.plan.source.representationId&&value2.source.artifactId===value2.plan.source.artifactId&&value2.source.byteSize===value2.plan.source.byteSize);var delivery=z123.strictObject({processor:z123.literal("DELIVERY_VALIDATE"),recipe:LocalMediaRecipeSchema.refine(value2=>value2.family==="FINAL_RENDER"),target:DeliveryTargetSchema.pick({representationId:true,checksumSha256:true,byteSize:true,artifactId:true}).extend({contentType:z123.literal("video/mp4")}),policy:z123.strictObject({requiredAudio:z123.boolean(),requiredCaptions:z123.boolean(),requiredGraphics:z123.boolean()}),engineVersion:z123.string().min(1).max(200),sources:z123.array(sourceReference).min(1).max(512),manifestBasisFingerprint:LocalDigestSchema}).refine(({sources,target:target2})=>new Set([target2.representationId,...sources.map(v=>v.representationId)]).size===sources.length+1);var composition=z123.strictObject({processor:z123.literal("COMPOSITION_RENDER"),...processorCompositionFields,sources:z123.array(sourceReference).min(1).max(64)}).refine(({manifest,allocation,sources})=>{const inputs=manifest.version.inputs;return(manifest.schemaVersion===1?allocation===null:allocation?.frames.length===manifest.frameCount)&&new Set(inputs.map(input=>input.representationId)).size===sources.length&&new Set(sources.map(source3=>source3.representationId)).size===sources.length&&inputs.every(input=>sources.some(source3=>source3.representationId===input.representationId&&source3.artifactId===input.artifactId&&source3.checksumSha256===input.checksumSha256&&source3.byteSize===input.byteSize&&source3.contentType===input.contentType))});var directOriginal=z123.strictObject({processor:z123.literal("IMPORT_ORIGINAL"),command:DirectOriginalCommandSchema,object:MediaObjectVersionSchema.extend({role:z123.literal("SOURCE")})}).refine(({command:{input},object})=>input.tenantId===object.tenantId&&input.projectId===object.projectId&&input.source.checksumSha256===object.checksumSha256&&input.source.byteSize===object.byteSize);var projectSource=z123.strictObject({processor:z123.literal("IMPORT_PROJECT_SOURCE"),metadata:SourceInputMetadataSchema.extend({idempotencyKey:z123.string().trim().min(1).max(200)}),projectId:LocalIdSchema,object:MediaObjectVersionSchema.extend({role:z123.literal("SOURCE")})}).refine(({metadata,projectId,object})=>metadata.tenantId===object.tenantId&&projectId===object.projectId&&object.byteSize<=8*1024*1024&&(metadata.kind==="REFERENCE_VIDEO"?metadata.contentType==="video/mp4":metadata.kind==="REFERENCE_IMAGE"&&["image/png","image/jpeg","image/webp"].includes(metadata.contentType)));var visualSequence=z123.strictObject({processor:z123.literal("REGISTER_VISUAL_SEQUENCE"),input:RegisterVisualSequenceSchema,manifest:VisualSequenceManifestSchema,sources:z123.array(sourceReference).min(1).max(360)}).refine(({input,manifest,sources})=>input.tenantId===manifest.tenantId&&input.projectId===manifest.projectId&&input.productionId===manifest.productionId&&new Set(sources.map(source3=>source3.representationId)).size===sources.length&&manifest.frames.every(frame2=>sources.some(source3=>source3.artifactId===frame2.artifactId&&source3.representationId===frame2.representationId&&source3.byteSize===frame2.byteSize&&source3.checksumSha256===frame2.checksumSha256&&source3.contentType==="image/png")));var TenantProcessorRecipeSchema=z123.discriminatedUnion("processor",[normalize,audio,temporal,delivery,composition,directOriginal,projectSource,LocalLibraryInspectRecipeSchema,LocalLibraryPublishRecipeSchema,visualSequence,SpeechSynthesisRecipeSchema,CpuSpeechRecipeSchema,QwenSpeechRecipeSchema,TranscribeAudioRecipeSchema,QwenAsrRecipeSchema,QwenKeyframeRecipeSchema,QwenVideoRecipeSchema]);var TenantProcessorWorkSchema=TenantMediaWorkSchema.omit({audioRequired:true,renderProfileDigest:true}).extend({protocol:z124.literal("NVS_TENANT_PROCESSOR_V1"),family:z124.enum(["ARTIFACT_INGEST","TEMPORAL_SAMPLE","DELIVERY_VALIDATE","COMPOSITION_RENDER","AUDIO_GENERATE","OBSERVE","KEYFRAME_GENERATE","VIDEO_GENERATE"]),processor:TenantProcessorKindSchema,recipeFingerprint:LocalDigestSchema,toolchainFingerprint:LocalDigestSchema,externalGeneration:ExternalGenerationReservationMarkerSchema.optional()}).refine(value2=>processorFamilies[value2.processor]===value2.family&&(value2.processor==="KEYFRAME_GENERATE"||value2.processor==="VIDEO_GENERATE")===!!value2.externalGeneration);var TenantComputeWorkSchema=z124.discriminatedUnion("protocol",[TenantMediaWorkSchema,TenantProcessorWorkSchema]);var importedNormalizationValidationProfile={processor:"IMPORTED_VISUAL_NORMALIZE",protocol:"NVS_TENANT_PROCESSOR_REPORT_V1",inspection:"IMPORTED_MP4_AND_POSTER_READBACK_V1"};var ClaimTenantProcessorSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema});var TenantProcessorAssignmentSchema=z124.strictObject({work:TenantProcessorWorkSchema,recipe:TenantProcessorRecipeSchema,lease:LocalExecutionLeaseSchema,toolchain:LocalToolchainSchema}).superRefine(({work,recipe,lease,toolchain},ctx)=>{const selected=work.processor==="SPEECH_SYNTHESIZE_CPU"?processorToolchain(toolchain,work.processor):toolchain;if(!selected||toolchain.profile.kind==="AUDIO_MEDIA_V1"&&work.processor!=="SPEECH_SYNTHESIZE_CPU"||canonicalLocalJson(selected)!==canonicalLocalJson(toolchain))ctx.addIssue({code:"custom",message:"Exact processor media profile required"});const target2=lease.target;if((recipe.processor==="LOCAL_MEDIA_INSPECT"||recipe.processor==="LOCAL_MEDIA_PUBLISH")&&(recipe.reference.tenantId!==work.tenantId||recipe.reference.projectId!==work.projectId||recipe.reference.deviceId!==work.target.deviceId||recipe.processor==="LOCAL_MEDIA_PUBLISH"&&recipe.destination.kind==="ORIGINAL"&&recipe.destination.command.input.productionId.toLowerCase()!==work.productionId))ctx.addIssue({code:"custom",message:"Local file reference must match native target and scope"});if(recipe.processor!==work.processor||lease.tenantId!==work.tenantId||lease.projectId!==work.projectId||lease.productionId!==work.productionId||lease.runtimeJobId!==work.runtimeJobId||lease.toolchainFingerprint!==work.toolchainFingerprint||target2.kind!=="DEVICE"||!sameDeviceAuthority(target2,work.target))ctx.addIssue({code:"custom",message:"Assignment must match the frozen device work"})});var TenantProcessorClaimReceiptSchema=z124.strictObject({found:z124.boolean(),assignment:TenantProcessorAssignmentSchema.nullable()});var StageTenantProcessorOutputSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,role:z124.enum(["VIDEO","POSTER","AUDIO","FRAME","SHEET","MANIFEST"]),ordinal:z124.int().nonnegative().max(359).default(0),checksumSha256:LocalDigestSchema,byteSize:MediaObjectVersionSchema.shape.byteSize});var PrepareTenantProcessorReportSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputVersionIds:z124.array(LocalIdSchema).max(362).refine(ids=>ids.length===new Set(ids).size)});var TenantProcessorReportRequestSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,validationRequestId:LocalIdSchema,work:TenantProcessorWorkSchema,outputs:z124.array(MediaObjectVersionSchema).max(362)});var poster=z124.strictObject({checksumSha256:LocalDigestSchema,byteSize:z124.int().min(1).max(2*1024*1024),width:z124.int().min(1).max(320),height:z124.int().min(1).max(320)});var TenantProcessorEvidenceSchema=z124.discriminatedUnion("processor",[LocalLibraryInspectEvidenceSchema,LocalLibraryPublishEvidenceSchema,z124.strictObject({processor:z124.literal("IMPORTED_VISUAL_NORMALIZE"),receipt:ImportedVisualNormalizationReceiptSchema,posterEvidence:poster}),z124.strictObject({processor:z124.literal("SOURCE_SYNC_AUDIO"),provenance:ImportedSynchronousAudioSourceSchema}),z124.strictObject({processor:z124.literal("TEMPORAL_SAMPLE"),manifest:TemporalEvidenceManifestSchema}),z124.strictObject({processor:z124.literal("DELIVERY_VALIDATE"),checks:DeliveryPhysicalChecksSchema,technical:FinalRenderTechnicalSchema.nullable()}),ProcessorCompositionEvidenceSchema,SpeechSynthesisEvidenceSchema,CpuSpeechEvidenceSchema,QwenSpeechEvidenceSchema,TranscribeAudioEvidenceSchema,QwenAsrEvidenceSchema,QwenKeyframeEvidenceSchema,QwenVideoEvidenceSchema,z124.strictObject({processor:z124.literal("IMPORT_ORIGINAL"),metadata:ImportedVisualSourceMetadataSchema}),z124.strictObject({processor:z124.literal("IMPORT_PROJECT_SOURCE"),validated:z124.strictObject({checksumSha256:LocalDigestSchema,byteSize:z124.int().positive().max(8*1024*1024),width:z124.int().positive().max(4096),height:z124.int().positive().max(4096),video:ImportedVisualSourceMetadataSchema.optional()})}),z124.strictObject({processor:z124.literal("REGISTER_VISUAL_SEQUENCE"),evidence:z124.strictObject({checksumSha256:VisualFrameSequenceSchema.shape.checksumSha256,width:VisualFrameSequenceSchema.shape.width,height:VisualFrameSequenceSchema.shape.height,frames:VisualFrameSequenceSchema.shape.frames,byteSize:z124.int().positive().max(2*1024*1024)})})]);var TenantProcessorReportBodySchema=TenantProcessorReportRequestSchema.extend({schemaVersion:z124.literal(1),evidence:TenantProcessorEvidenceSchema}).superRefine(({work,outputs,evidence,...binding},ctx)=>{if(work.tenantId!==binding.tenantId||work.projectId!==binding.projectId||work.productionId!==binding.productionId||work.runtimeJobId!==binding.runtimeJobId||work.toolchainFingerprint!==binding.toolchainFingerprint||evidence.processor!==work.processor||new Set(outputs.map(value2=>value2.versionId)).size!==outputs.length||outputs.some(object=>object.tenantId!==work.tenantId||object.projectId!==work.projectId)||!matchesEvidence(outputs,evidence))ctx.addIssue({code:"custom",message:"Report must bind the exact processor and committed media versions"})});function matchesEvidence(outputs,evidence){const matches=(index,role,expected)=>{const output2=outputs[index];return output2?.role===role&&output2.checksumSha256===expected.checksumSha256&&output2.byteSize===expected.byteSize};switch(evidence.processor){case"IMPORTED_VISUAL_NORMALIZE":return outputs.length===2&&matches(0,"VIDEO",evidence.receipt.output)&&matches(1,"POSTER",evidence.posterEvidence);case"SOURCE_SYNC_AUDIO":return outputs.length===1&&matches(0,"AUDIO",{checksumSha256:evidence.provenance.wavChecksumSha256,byteSize:evidence.provenance.wavByteSize});case"SPEECH_SYNTHESIZE":case"SPEECH_SYNTHESIZE_CPU":case"SPEECH_EXTERNAL_QWEN":return outputs.length===2&&matches(0,"AUDIO",evidence.source)&&matches(1,"AUDIO",evidence.normalized);case"TEMPORAL_SAMPLE":{const frames=evidence.manifest.frames;return outputs.length===frames.length+2&&frames.every((value2,index)=>matches(index,"FRAME",value2))&&matches(frames.length,"SHEET",evidence.manifest.sheet)&&outputs.at(-1)?.role==="MANIFEST"}case"DELIVERY_VALIDATE":case"TRANSCRIBE_AUDIO":case"TRANSCRIBE_EXTERNAL_QWEN":case"LOCAL_MEDIA_INSPECT":case"LOCAL_MEDIA_PUBLISH":case"IMPORT_ORIGINAL":case"IMPORT_PROJECT_SOURCE":return outputs.length===0;case"REGISTER_VISUAL_SEQUENCE":return outputs.length===1&&matches(0,"MANIFEST",evidence.evidence);case"KEYFRAME_GENERATE":return outputs.length===1&&matches(0,"FRAME",evidence.image);case"VIDEO_GENERATE":return outputs.length===2&&matches(0,"VIDEO",evidence.video)&&matches(1,"POSTER",evidence.poster);case"COMPOSITION_RENDER":if(evidence.format==="MP4")return outputs.length===1&&matches(0,"VIDEO",evidence.technical);return outputs.length===evidence.technical.frames.length+1&&evidence.technical.frames.every((value2,index)=>matches(index,"FRAME",value2))&&outputs.at(-1)?.role==="MANIFEST"&&outputs.at(-1)?.checksumSha256===evidence.sequence.checksumSha256}}var TenantProcessorReportSchema=TenantProcessorReportBodySchema.safeExtend({reportFingerprint:LocalDigestSchema,signature:z124.string().regex(/^[A-Za-z0-9_-]{86}$/)});var TenantProcessorReceiptQuerySchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema});var TenantProcessorStateSchema=z124.strictObject({binding:LocalLeaseBindingSchema,state:z124.enum(["FENCED","PENDING"])});var TenantProcessorFailureSchema=LocalLeaseBindingSchema.extend({code:z124.literal("INVALID_SOURCE")});var TenantProcessorProviderOutcomeSchema=LocalLeaseBindingSchema.extend({outcome:z124.enum(["UNKNOWN","REJECTED","WAITING","INVALID_RESULT"]),providerExecutionId:QwenVideoTaskIdSchema.optional()}).refine(value2=>!["WAITING","INVALID_RESULT"].includes(value2.outcome)||!!value2.providerExecutionId);var TenantProcessorProviderTaskSchema=LocalLeaseBindingSchema.extend({providerExecutionId:QwenVideoTaskIdSchema.optional()});var TenantProcessorInvalidSpeechSchema=LocalLeaseBindingSchema.extend(QwenSpeechEvidenceSchema.pick({providerRequestId:true,audioId:true}).shape);var TenantProcessorReceiptSchema=TenantProcessorReceiptQuerySchema.extend({operationId:TenantProcessorWorkSchema.shape.operationId,reportFingerprint:LocalDigestSchema,result:z124.union([z124.strictObject({localMediaInspectionId:LocalIdSchema}),z124.strictObject({normalizationId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema,posterArtifactId:LocalIdSchema,posterRepresentationId:LocalIdSchema}),SourceSyncAudioReceiptSchema,z124.strictObject({generationId:LocalIdSchema,audio:AudioReceiptSchema}),z124.strictObject({observationId:LocalIdSchema}),z124.strictObject({generationId:LocalIdSchema,candidateId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema}),z124.strictObject({evidenceId:LocalIdSchema,frameSetArtifactId:LocalIdSchema,contactSheetArtifactId:LocalIdSchema}),z124.strictObject({deliveryValidationId:LocalIdSchema,reviewId:LocalIdSchema}),z124.strictObject({renderId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema}),ImportedVisualOriginalViewSchema,ReadyArtifactRegistrationSchema,z124.strictObject({requestId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema})])});var LocalLibraryCommandStatusSchema=z125.strictObject({admission:LocalLibraryAdmissionSchema,lifecycle:z125.enum(["READY","WAITING","RUNNING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),receipt:TenantProcessorReceiptSchema.nullable(),inspection:LocalLibraryInspectionSchema.nullable(),failureSummary:z125.string().max(500).nullable()}).superRefine(({admission,receipt},ctx)=>{if(receipt&&(receipt.tenantId!==admission.tenantId||receipt.projectId!==admission.projectId||receipt.productionId!==admission.productionId||receipt.runtimeJobId!==admission.runtimeJobId||receipt.operationId!==admission.operationId))ctx.addIssue({code:"custom",message:"Original native receipt must match admitted local file work"})});import{z as z126}from"zod";var LocalWorkspaceDeviceSchema=z126.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema});var LocalDeviceWorkScopesSchema=z126.array(LocalProjectScopeSchema).max(64);import{z as z127}from"zod";var output=z127.discriminatedUnion("role",[z127.strictObject({role:z127.literal("VIDEO"),receiptId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z127.int().positive().max(128*1024*1024),contentType:z127.literal("video/mp4")}),z127.strictObject({role:z127.literal("POSTER"),receiptId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z127.int().positive().max(2*1024*1024),contentType:z127.literal("image/png")})]);var LocalCompletionSubmissionSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputs:z127.array(output).length(2),technical:RoughCutTechnicalSchema}).superRefine((v,ctx)=>{const video=v.outputs.find(o=>o.role==="VIDEO");if(new Set(v.outputs.map(o=>o.role)).size!==2||new Set(v.outputs.map(o=>o.receiptId)).size!==2||!video||video.checksumSha256!==v.technical.checksumSha256||video.byteSize!==v.technical.byteSize)ctx.addIssue({code:"custom",message:"Exact video/poster receipts required"})});var LocalVerifiedUploadSchema=z127.strictObject({binding:LocalLeaseBindingSchema,output,verifiedAt:LocalTimeSchema});var LocalCompletionReceiptSchema=LocalLeaseBindingSchema.extend({submissionFingerprint:LocalDigestSchema.optional(),semanticStatus:z127.literal("SUCCESS"),requestId:LocalIdSchema,renderId:LocalIdSchema,operationId:OperationIdSchema,artifactId:LocalIdSchema,videoRepresentationId:LocalIdSchema,posterRepresentationId:LocalIdSchema,checksumSha256:LocalDigestSchema,acceptedAt:LocalTimeSchema});var GetLocalCompletionReceiptSchema=LocalLeaseBindingSchema.pick({tenantId:true,projectId:true,productionId:true,runtimeJobId:true}).extend({requestId:LocalIdSchema});function localAgentMediaSnapshot(raw){const c=ReviewIntelligenceContextResultSchema.parse(raw),r=c.reviewTarget,t=r.target,scope=c.basis.scope;if(c.ownerContext.semanticStatus!=="SUCCESS"||!t.productionRunnable||t.freshness!=="CURRENT_BASIS"||t.tenantId!==scope.tenantId||t.projectId!==scope.projectId||t.productionId!==scope.productionId||c.ownerContext.basis.tenantId!==scope.tenantId||c.ownerContext.basis.projectId!==scope.projectId||c.ownerContext.basis.productionId!==scope.productionId||r.kind!==c.basis.target.kind)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");let media,descriptor;if(r.kind==="ROUGH_CUT"){if(!r.target.inspectable||c.basis.target.kind!=="ROUGH_CUT"||r.target.renderId!==c.basis.target.renderId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");media=r.target.basis;descriptor={...r.target.technical,contentType:"video/mp4"}}else if(r.kind==="PROGRAMMATIC"){if(!r.target.runtimeSucceeded||r.target.media.availability!=="AVAILABLE"||c.basis.target.kind!=="PROGRAMMATIC"||r.target.renderId!==c.basis.target.renderId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");media=r.target.media;descriptor=r.target.media}else{if(!r.target.runtimeSucceeded||r.target.candidate.availability!=="AVAILABLE"||r.target.candidate.freshness!=="CURRENT_BASIS"||!("generationId"in c.basis.target)||r.target.generationId!==c.basis.target.generationId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");media=r.target.candidate;descriptor=r.target.candidate}const video=descriptor.contentType==="video/mp4";return LocalAgentSnapshotSchema.parse({basis:c.basis,productionRevision:c.ownerContext.basis.productionRevision,reviewVersion:t.reviewVersion,executionClass:t.executionClass,media:{artifactId:media.artifactId,representationId:media.representationId,checksumSha256:media.checksumSha256},requirements:t.requirements,evidence:{profile:"NVS_AGENT_DERIVED_EVIDENCE_V1",contentType:descriptor.contentType,byteSize:descriptor.byteSize,width:descriptor.width,height:descriptor.height,...video&&"durationMs"in descriptor?{durationMs:descriptor.durationMs,frameRate:descriptor.frameRate,hasAudio:descriptor.hasAudio}:{}}})}function localAgentMediaProposal(raw){const v=LocalAgentReviewViewSchema.parse(raw),s=v.plan.snapshot;if(!s.evidence)return localAgentNativeProposal(v);if(v.phase!=="RESULT_PENDING"||!v.answer||!v.evidenceReceipt||s.basis.target.kind==="ROUGH_CUT")throw Error("LOCAL_AGENT_FULL_TEMPORAL_INSPECTION_REQUIRED");const video=s.evidence.contentType==="video/mp4",p=v.provenance,id9=video?"sampled_frames":"normalized_image";const observations=v.answer.observations.map(o=>{const requirement=s.requirements.find(r=>r.key===o.key);if(!requirement)throw Error("LOCAL_AGENT_RESULT_UNAVAILABLE");const sound="family"in requirement&&requirement.family==="SOUND"||/^(audio|sound):/.test(requirement.key);return{...o,status:video||!("status"in o)?"NOT_OBSERVABLE":o.status,confidence:video||!("confidence"in o)?"UNCERTAIN":o.confidence,observed:video?sound?"This draft has no listening evidence.":"Sampled frames are advisory. This draft has no playback coverage.":o.observed,evidenceIds:video&&sound?[]:[id9],..."interval"in requirement&&requirement.interval?{interval:requirement.interval}:{}}});return ValidateReviewIntelligenceSchema.parse({basis:s.basis,proposal:{origin:{kind:"EXTERNAL_AGENT_HOST",label:p.reviewerLabel},summary:`Advisory ${video?"sampled frame observations. Full playback, listening and transcription are unavailable":"normalized original image"}. ${p.inference} via ${p.adapter} using Codex ${p.version}, model ${p.model}, effort ${p.reasoningEffort??"DEFAULT"}, binary ${p.binaryDigest}. Source ${s.media.checksumSha256}, attachment ${v.evidenceReceipt.attachment.checksumSha256}, draft ${v.plan.id}, plan ${v.plan.fingerprint}. ${v.answer.summary}`,evidence:observations.some(o=>o.evidenceIds.length)?[{id:id9,label:video?"Ordered verified source frame samples":"Verified normalized source image",producer:"EXTERNAL_AGENT_HOST",media:s.media,...video?{kind:"VIDEO_FRAMES",timestampsMs:v.evidenceReceipt.timestampsMs}:{kind:"IMAGE_PIXELS"}}]:[],review:{kind:s.basis.target.kind,observations}}})}import{z as z128}from"zod";var CpuSpeechPrepareInputSchema=z128.strictObject({profileId:z128.literal(kokoroCpuProfile.id).default(kokoroCpuProfile.id),voiceIds:z128.array(CpuSpeechInputSchema.shape.voiceId).min(1).max(8).refine(v=>new Set(v).size===v.length).default([0,45])});var CpuSpeechPreparedSchema=z128.strictObject({semanticStatus:z128.literal("PREPARED"),selection:CpuSpeechInstallationSchema,capability:CpuSpeechCapabilitySchema,reused:z128.strictObject({engine:z128.boolean(),model:z128.boolean()})});import{createHash}from"node:crypto";import{z as z129}from"zod";var success=z129.strictObject({semanticStatus:z129.literal("SUCCESS")});var same=(a,b)=>canonicalLocalJson(a??null)===canonicalLocalJson(b??null);function resultMatches(command2,raw){const schema=command2.kind==="ENROLL"?LocalDeviceViewSchema:command2.kind==="PREVIEW"?LocalPreviewAdmissionSchema:command2.kind==="FINAL_RENDER"?LocalFinalRenderAdmissionSchema:success;const parsed=schema.safeParse(raw);if(!parsed.success)return false;const result=parsed.data,original=command2.input;for(const key4 of["tenantId","projectId","deviceId","productionId","timelineVersionId"])if(key4 in original&&key4 in result&&String(result[key4]).toLowerCase()!==String(original[key4]).toLowerCase())return false;if(command2.kind==="ENROLL")return result.revokedAt===null&&["publicKey","label","platform","runtimeVersion"].every(key4=>same(original[key4],result[key4]));if(command2.kind==="PREVIEW"||command2.kind==="FINAL_RENDER")return same(original.timelineFingerprint,result.timelineFingerprint)&&same(command2.input.placement,result.placement.policy);return true}function checkedManagementReceipt(rawCommand,rawReceipt){const command2=LocalDeviceManagementCommandSchema.parse(rawCommand);const receipt=LocalManagementReceiptSchema.parse(rawReceipt);if(receipt.fingerprint!==createHash("sha256").update(canonicalLocalJson(command2)).digest("hex")||receipt.result!==null&&!resultMatches(command2,receipt.result))throw new NativeStudioSdkError("LOCAL_RECEIPT_INVALID","BLOCKED","NO_WRITE");return receipt}function assertManagementReceipt(key4,input,result){if(key4==="device.management-receipt")checkedManagementReceipt(input.command,result);else if(key4==="device.enroll"){const command2=LocalDeviceManagementCommandSchema.parse({kind:"ENROLL",input});if(!resultMatches(command2,result))throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}}export{LocalDigestSchema,AgentHostScopeSchema,AgentHostSelectionSchema,ConfigureAgentHostSchema,RevokeAgentHostSchema,AgentHostBindingSchema,UpdateAgentHostSelectionSchema,AgentHostCurrentSchema,AgentHostHistoryQuerySchema,AgentHostHistoryPageSchema,AgentHostReadinessSchema,NativeRuntimePublicKeySchema,ConfigureNativeToolGrantSchema,NativeToolGrantGetSchema,RevokeNativeToolGrantSchema,NativeRuntimeProofRequestSchema,NativeToolGrantViewSchema,EnrollLocalDeviceSchema,LocalDeviceViewSchema,LocalDeviceChallengeSchema,RevokeLocalDeviceSchema,WorkspaceDeviceListInputSchema,WorkspaceDeviceListSchema,ClipTransitionSchema,TimelineGraphicInputSchema,CaptionTranscriptPlanSchema,AuthorTranscriptCaptionsSchema,CaptionContentSchema,CaptionScopeSchema,AuthorCaptionsSchema,CaptionGetSchema,CaptionQuerySchema,CaptionViewSchema,CaptionReceiptSchema,CaptionBasisSchema,CaptionPageSchema,CaptionExportSchema,CaptionSnapshotSchema,CaptionTranscriptDraftSchema,VoiceProfileRefSchema,VoiceLocaleSchema,VoiceProfileUseSchema,AudioReadScopeSchema,AudioImportRequestSchema,AudioGetSchema,AudioQuerySchema,AudioViewSchema,AudioReceiptSchema,AudioBasisSchema,AudioPageSchema,AudioSnapshotSchema,TimelineAudioInputSchema,ModelProfileIdSchema,ProviderSelectionSchema,ConfigureProviderInputSchema,ProviderConnectionViewSchema,ProviderConnectionCommandSchema,ProviderCredentialRevokeSchema,SetKeyframeDefaultSchema,GenerationCostQuoteSchema,PreparationIdSchema,GenerationContractIdSchema,ContentFingerprintSchema,PreparationTargetSchema,PreparationBasisSchema,ReferenceRoleSchema,ReferenceBindingInputSchema,ExactEvidenceReferenceSchema,PreparationBlockerSchema,ConstraintSetSchema,ReferenceSetSchema,VideoProviderProfileSchema,VideoOptionsInputSchema,VideoStartInputSchema,VideoDeviceStartInputSchema,VideoGetInputSchema,VideoQueryInputSchema,VideoAdmissionSchema,VideoGenerationViewSchema,VideoQueryPageSchema,VideoSummarySchema,RoughCutProfileIdSchema,AcceptedVisualSourceReferenceSchema,SourceSyncAudioGetSchema,SourceSyncAudioViewSchema,SpeechParametersSchema,NativeSpeechExecutionSchema,SpeechScopeSchema,SpeechStartSchema,SpeechGetSchema,SpeechAdmissionSchema,SpeechGenerationViewSchema,LocalSpeechStartSchema,LocalSpeechAdmissionSchema,LocalSpeechGenerationViewSchema,SpeechOptionsSchema,KeyframeProviderProfileSchema,KeyframeStartInputSchema,KeyframeDeviceStartInputSchema,KeyframeGetInputSchema,KeyframeQueryInputSchema,KeyframeAdmissionSchema,KeyframeGenerationViewSchema,KeyframeQueryPageSchema,KeyframeMediaSchema,KeyframeSummarySchema,ProviderTenantInputSchema,ProviderDefaultViewSchema,ProviderConnectionPageSchema,ProviderModelsViewSchema,SpeechCostQuoteSchema,SpeechDeviceStartSchema,ProviderModelViewSchema,ConfigureProviderModelSchema,DisableProviderModelSchema,ProviderModelPageSchema,ProviderModelGetSchema,SoundPlanScopeSchema,SoundPlanValidateSchema,SoundPlanAcceptSchema,SoundPlanGetSchema,SoundPlanValidationSchema,SoundPlanViewSchema,SoundPlanReceiptSchema,SoundPlanContextSchema,TimelineVisualLayerInputSchema,processorFamilies,DeviceRenderTargetSchema,DeviceRenderReceiptSchema,ProjectDeviceListInputSchema,ProjectDeviceListSchema,TimelineManifestReaderSchema,TimelineScopeSchema,BuildTimelineShapeSchema,BuildTimelineSchema,TimelineViewSchema,TimelineGetSchema,TimelineQuerySchema,TimelinePageSchema,TimelineBuildReceiptSchema,TimelineBasisSchema,TimelineSnapshotSchema,RoughCutStartSchema,RoughCutGetSchema,RoughCutQuerySchema,RoughCutAdmissionSchema,RoughCutViewSchema,RoughCutPageSchema,RoughCutSnapshotSchema,DeliveryPolicySchema,DeliveryPolicyInputSchema,DeliveryTargetSchema,DeliveryCheckKeySchema,DeliveryValidationReviewSchema,DeliveryApprovalSchema,DeliveryManifestLinkSchema,FinalDeliveryReceiptSchema,DecideFinalReadySchema,RevokeFinalReadySchema,FinalReadyViewSchema,FinalReadyQuerySchema,FinalReadyPageSchema,FinalReadyReceiptSchema,RoughCutReviewSnapshotSchema,FinalRenderStartSchema,FinalRenderGetSchema,FinalRenderQuerySchema,FinalRenderManifestReaderSchema,FinalRenderTechnicalSchema,FinalRenderAdmissionSchema,FinalRenderViewSchema,FinalRenderPageSchema,FinalRenderEligibilitySchema,FinalRenderSnapshotSchema,LocalOfflineCallSchema,LocalOfflinePageSchema,MediaCategorySchema,mediaCategoryOf,localLibraryProfile,LocalLibraryReferenceSchema,LocalLibraryItemSchema,LocalLibraryPageSchema,LocalLibraryProjectionSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryImportSchema,LocalLibraryReadReplySchema,LocalLibraryGetSchema,LocalLibraryCallSchema,LocalLibraryCapabilitySchema,LocalLibraryUsageSchema,ListeningEvidenceSchema,CompositionFindingLocalitySchema,BriefContentSchema,AcceptBriefRequestSchema,AcceptBriefResultSchema,StoryContentSchema,AcceptStoryRequestSchema,StoryVersionSchema,AcceptStoryResultSchema,ConsistencyProfileScopeSchema,ConsistencyProfileVersionQuerySchema,ConfigureConsistencyProfileSchema,ConsistencyProfileVersionSchema,ConsistencyProfileViewSchema,ConsistencyProfileReceiptSchema,RoughCutReviewScopeSchema,RecordRoughCutReviewSchema,RoughCutReviewRecordSchema,RoughCutReviewTargetSchema,RoughCutFindingViewSchema,RoughCutReviewQuerySchema,RoughCutReviewPageSchema,RoughCutFindingQuerySchema,RoughCutFindingPageSchema,RoughCutReviewReceiptSchema,ReviewEvidenceKeySchema,LocalAgentGrantSchema,LocalAgentDiscoverySchema,whisperCppRecognitionProfile,LocalCompositionBrowserSelectionSchema,LocalToolSelectionSchema,LocalRuntimeDescriptorSchema,RuntimeCaptionAssets,LocalRuntimeComponentSchema,LocalSessionConnectorSchema,LocalManagementInventorySchema,LocalReleaseSchema,LocalSignedCatalogueSchema,LocalToolChoiceSchema,LocalUpdatePlanSchema,LocalResourcePolicySchema,LocalWorkspaceInspectionSchema,LocalDiagnosticsSchema,canonicalLocalJson,ObservationScopeSchema,ObservationStartSchema,ObservationGetSchema,ObservationAdmissionSchema,ObservationViewSchema,ObservationOptionsSchema,LocalObservationStartSchema,LocalObservationAdmissionSchema,LocalObservationViewSchema,QwenAsrDeviceQuoteInputSchema,QwenAsrCostQuoteSchema,QwenAsrDeviceStartSchema,QwenAsrDeviceAdmissionSchema,QwenAsrDeviceViewSchema,ProductionGuidanceContextSchema,VideoReviewScopeSchema,VideoReviewRequirementSchema,VideoObservationSchema,RecordVideoReviewSchema,DecideVideoShotSchema,ShotAcceptanceScopeSchema,RevokeShotAcceptanceSchema,GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,VideoReviewTargetSchema,ShotAcceptanceViewSchema,VideoReviewQuerySchema,VideoReviewPageSchema,ShotDecisionQuerySchema,ShotDecisionPageSchema,VideoReviewReceiptSchema,ShotDecisionReceiptSchema,ProgrammaticVideoReviewScopeSchema,ProgrammaticVideoReviewTargetSchema,RecordProgrammaticVideoReviewSchema,DecideProgrammaticShotSchema,ProgrammaticVideoReviewQuerySchema,ProgrammaticVideoReviewPageSchema,ProgrammaticVideoReviewReceiptSchema,BoundaryRequirementSchema,ShotIntentSchema,AcceptSceneShotPlanRequestSchema,ShotPlanEntrySchema,SceneShotPlanVersionSchema,AcceptSceneShotPlanResultSchema,WriterScopeSchema,ValidateWriterProposalSchema,WriterBriefResultSchema,WriterValidationResultSchema,DirectorScopeSchema,DirectorBasisSchema,ValidateDirectorProposalSchema,DirectorContextResultSchema,DirectorValidationResultSchema,KeyframeReviewScopeSchema,VisualRequirementSchema,KeyframeObservationSchema,RecordKeyframeReviewSchema,DecideKeyframeSchema,KeyframeReferenceScopeSchema,RevokeKeyframeSchema,KeyframeReviewTargetSchema,KeyframeReferenceViewSchema,KeyframeReviewQuerySchema,KeyframeReviewPageSchema,KeyframeReviewReceiptSchema,KeyframeDecisionReceiptSchema,KeyframeDecisionQuerySchema,KeyframeDecisionPageSchema,KeyframeReviewSummarySchema,ReviewIntelligenceContextInputSchema,ValidateReviewIntelligenceSchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema,LocalAgentSnapshotSchema,LocalAgentProbeSchema,LocalAgentReviewViewSchema,localAgentSnapshotFromContext,LocalExecutionListInputSchema,LocalExecutionInspectInputSchema,LocalIpcRequestSchema,LocalRuntimeStatusSchema,LocalDoctorReportSchema,LocalExecutionInspectionSchema,LocalExecutionPageSchema,LocalIpcResponseSchema,mediaObjectTransferPath,MediaBrowserContentTypeSchema,MediaObjectVersionSchema,MediaObjectTicketSchema,MediaBrowserReadTicketSchema,StartLocalPreviewSchema,LocalDeviceSessionSchema,LocalDeviceTransportConfigurationSchema,LocalPreviewAdmissionSchema,StartLocalFinalRenderSchema,LocalFinalRenderAdmissionSchema,LocalMcpFailureSchema,LocalMcpOutputSchemas,localAgentMediaSnapshot,localAgentMediaProposal,LocalManagementCommandSchema,LocalManagementResultSchema,LocalManagementReceiptSchema,LocalDeviceManagementCommandSchema,ScopedLocalManagementReceiptSchema,tenantRenderValidationProfile,TenantMediaDownloadSchema,TenantRenderMediaInputSchema,TenantRenderMediaTicketSchema,TenantMediaCapabilitySchema,ImportedVisualFromProjectSourceSchema,ImportedVisualNormalizeStartSchema,ImportedVisualGetSchema,ImportedVisualReviewSchema,ImportedVisualDecisionSchema,ImportedVisualOriginalViewSchema,ImportedVisualNormalizationViewSchema,SourceSyncRuntimeStartSchema,SourceSyncRuntimeScopeSchema,SourceSyncRuntimeAdmissionSchema,SourceSyncRuntimeViewSchema,SourceSyncReviewTargetSchema,SourceSyncReviewInputSchema,SourceSyncReviewRecordSchema,SourceSyncReviewGetSchema,ImportedVideoReviewReceiptSchema,ImportedVisualCancellationSchema,ImportedVisualAdmissionSchema,ImportedVisualReviewTargetSchema,ImportedVisualOriginalGetSchema,ImportedVisualOriginalHistoryQuerySchema,ImportedVisualOriginalHistorySchema,ImportedVisualOriginalQuerySchema,ImportedVisualOriginalPageSchema,LegacyImportedVisualUploadSchema,LegacyImportedVisualRevisionSchema,LegacyImportedVisualProjectSourceSchema,DirectOriginalCommandSchema,DirectOriginalStageSchema,DirectOriginalSubmitSchema,ReadyArtifactRegistrationSchema,SourceInputMetadataSchema,UploadSourceInputRequestSchema,DirectProjectSourceCommandSchema,DirectProjectSourceStageSchema,DirectProjectSourceSubmitSchema,LocalLibraryCommandSchema,LocalLibraryCommandQuerySchema,LocalLibraryAdmissionSchema,TemporalEvidenceSourceSchema,TemporalSamplingProfileSchema,TemporalEvidenceManifestSchema,CompositionPathSchema,CompositionScopeSchema,CompositionBasisPinSchema,CompositionBindingSchema,CompositionContentSchema,SubmitCompositionSchema,CompositionGetSchema,CompositionHistorySchema,CompositionInputFactSchema,CompositionReceiptSchema,CompositionViewSchema,CompositionPageSchema,CompositionDependencyManifestSchema,CompositionDependencyLockSchema,CompositionRenderStartSchema,CompositionRenderGetSchema,CompositionRenderReceiptSchema,CompositionRenderViewSchema,CompositionRenderCancellationSchema,RegisterVisualSequenceSchema,VisualSequenceGetSchema,LegacyVisualSequenceRegistrationSchema,VisualSequenceRegistrationAdmissionSchema,VisualSequenceViewSchema,VisualSequenceQuerySchema,VisualSequencePageSchema,importedNormalizationValidationProfile,LocalLibraryCommandStatusSchema,CpuSpeechPrepareInputSchema,CpuSpeechPreparedSchema,checkedManagementReceipt,assertManagementReceipt};