@nativestudio/cli 0.3.0-rc.5 → 0.3.0-rc.7

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 (162) hide show
  1. package/COMPATIBILITY.json +7 -7
  2. package/LICENSE +201 -21
  3. package/components/runtime.json +3 -3
  4. package/components/runtime.tgz +0 -0
  5. package/dist/_chunks/{chunk-CA54SKBO.js → chunk-6SYHA2B4.js} +1 -1
  6. package/dist/_chunks/{chunk-GJ7BZJLW.js → chunk-A7EUJNCL.js} +1 -1
  7. package/dist/_chunks/chunk-AJ7S73M4.js +1 -0
  8. package/dist/_chunks/chunk-DRHPICBU.js +1 -0
  9. package/dist/_chunks/chunk-FCHO4AVP.js +1 -0
  10. package/dist/_chunks/chunk-JH5QP6PC.js +1 -0
  11. package/dist/_chunks/chunk-LF442QV6.js +1 -0
  12. package/dist/_chunks/chunk-LUBHPAPW.js +1 -0
  13. package/dist/_chunks/chunk-OZ5KZSTM.js +1 -0
  14. package/dist/_chunks/chunk-RJ4QQF7E.js +1 -0
  15. package/dist/_chunks/chunk-RT5PFKYS.js +1 -0
  16. package/dist/_chunks/chunk-SIJPJIBO.js +1 -0
  17. package/dist/_chunks/{chunk-KNFUMWDY.js → chunk-TCZJLYSR.js} +1 -1
  18. package/dist/_chunks/chunk-TTFDNLQE.js +1 -0
  19. package/dist/_chunks/chunk-URKX77KR.js +1 -0
  20. package/dist/_chunks/chunk-XRYARPEL.js +1 -0
  21. package/dist/_chunks/device-management-4XIITODX.js +1 -0
  22. package/dist/_chunks/device-preflight-SDA7Q3LH.js +1 -0
  23. package/dist/_chunks/devices-inventory-RVHGI2YW.js +1 -0
  24. package/dist/_chunks/devices-main-WOILNAGY.js +1 -0
  25. package/dist/_chunks/http-profile-XCHTSJV4.js +1 -0
  26. package/dist/_chunks/library-main-ZQKJQNHE.js +1 -0
  27. package/dist/_chunks/local-main-DX47PKHX.js +1 -0
  28. package/dist/_chunks/local-mcp-HMS5ODZN.js +1 -0
  29. package/dist/_chunks/main-HQGVZ2O2.js +2 -0
  30. package/dist/_chunks/mcp-6Q4ALHN6.js +1 -0
  31. package/dist/_chunks/project-connect-U2IHGC5W.js +1 -0
  32. package/dist/_chunks/render-main-A2AABFAG.js +1 -0
  33. package/dist/_chunks/source-import-5N4KZMTC.js +1 -0
  34. package/dist/_chunks/src-NIMTPR5W.js +1 -0
  35. package/dist/_chunks/{stdio-main-4Z2JVCMO.js → stdio-main-JJCNIY4H.js} +1 -1
  36. package/dist/_chunks/workspace-main-ZIZO4WRI.js +1 -0
  37. package/dist/_types/cli/local/desktop-contract.d.ts +1077 -564
  38. package/dist/_types/cli/local/desktop-device-contract.d.ts +170 -556
  39. package/dist/_types/cli/local/desktop-device-owner.d.ts +16 -50
  40. package/dist/_types/cli/local/desktop-device-state.d.ts +198 -31
  41. package/dist/_types/cli/local/desktop-library.d.ts +853 -0
  42. package/dist/_types/cli/local/desktop-owner.d.ts +220 -39
  43. package/dist/_types/cli/local/ledger.d.ts +2 -0
  44. package/dist/_types/cli/local/manager.d.ts +352 -22
  45. package/dist/_types/cli/local/mcp-tools.d.ts +218 -39
  46. package/dist/_types/cli/local/project-render-tools.d.ts +8742 -77
  47. package/dist/_types/cli/local-management.d.ts +2 -1
  48. package/dist/_types/contracts/artifact-discovery.d.ts +76 -4
  49. package/dist/_types/contracts/audio.d.ts +4 -0
  50. package/dist/_types/contracts/composition-authoring.d.ts +8 -8
  51. package/dist/_types/contracts/composition-frame-render.d.ts +4 -4
  52. package/dist/_types/contracts/composition-render-base.d.ts +5 -4
  53. package/dist/_types/contracts/composition-render.d.ts +8 -8
  54. package/dist/_types/contracts/composition-repair.d.ts +10 -10
  55. package/dist/_types/contracts/composition-source-review.d.ts +12 -12
  56. package/dist/_types/contracts/delivery-manifest.d.ts +25 -11765
  57. package/dist/_types/contracts/delivery-operations.d.ts +51 -3921
  58. package/dist/_types/contracts/delivery-summary.d.ts +2 -2
  59. package/dist/_types/contracts/delivery-validation.d.ts +23 -0
  60. package/dist/_types/contracts/device-render.d.ts +67 -0
  61. package/dist/_types/contracts/editor-intelligence.d.ts +114 -2491
  62. package/dist/_types/contracts/exploration-recommendation.d.ts +263 -11655
  63. package/dist/_types/contracts/external-agent-access.d.ts +9 -3
  64. package/dist/_types/contracts/final-ready.d.ts +22 -22
  65. package/dist/_types/contracts/final-render.d.ts +1569 -6949
  66. package/dist/_types/contracts/human-identity.d.ts +13 -0
  67. package/dist/_types/contracts/index.d.ts +3 -0
  68. package/dist/_types/contracts/interface/media-output.d.ts +28 -0
  69. package/dist/_types/contracts/interface/production-snapshot.d.ts +15 -193
  70. package/dist/_types/contracts/keyframe-generation.d.ts +29 -0
  71. package/dist/_types/contracts/local-execution/agent-evidence.d.ts +2 -2
  72. package/dist/_types/contracts/local-execution/agent-grant.d.ts +2 -2
  73. package/dist/_types/contracts/local-execution/agent-review.d.ts +30 -285
  74. package/dist/_types/contracts/local-execution/common.d.ts +12 -11
  75. package/dist/_types/contracts/local-execution/completion.d.ts +41 -45
  76. package/dist/_types/contracts/local-execution/device-authority.d.ts +31 -0
  77. package/dist/_types/contracts/local-execution/device-inventory.d.ts +76 -0
  78. package/dist/_types/contracts/local-execution/device-workspace.d.ts +11 -0
  79. package/dist/_types/contracts/local-execution/device.d.ts +19 -59
  80. package/dist/_types/contracts/local-execution/external-generation.d.ts +199 -0
  81. package/dist/_types/contracts/local-execution/index.d.ts +19 -0
  82. package/dist/_types/contracts/local-execution/ipc.d.ts +1517 -711
  83. package/dist/_types/contracts/local-execution/library-command.d.ts +620 -0
  84. package/dist/_types/contracts/local-execution/library-result.d.ts +408 -0
  85. package/dist/_types/contracts/local-execution/library.d.ts +873 -0
  86. package/dist/_types/contracts/local-execution/lifecycle.d.ts +21 -5
  87. package/dist/_types/contracts/local-execution/local-navigation.d.ts +161 -44
  88. package/dist/_types/contracts/local-execution/management.d.ts +214 -208
  89. package/dist/_types/contracts/local-execution/media-recipe.d.ts +5 -1
  90. package/dist/_types/contracts/local-execution/media-validation-request.d.ts +232 -0
  91. package/dist/_types/contracts/local-execution/media-validation.d.ts +262 -0
  92. package/dist/_types/contracts/local-execution/object-transfer.d.ts +155 -0
  93. package/dist/_types/contracts/local-execution/preview.d.ts +120 -10988
  94. package/dist/_types/contracts/local-execution/processor-capability.d.ts +39 -0
  95. package/dist/_types/contracts/local-execution/processor-direct.d.ts +290 -0
  96. package/dist/_types/contracts/local-execution/processor-recipes.d.ts +1122 -0
  97. package/dist/_types/contracts/local-execution/processor.d.ts +6173 -0
  98. package/dist/_types/contracts/local-execution/project-source-direct.d.ts +201 -0
  99. package/dist/_types/contracts/local-execution/qwen-tts.d.ts +31 -0
  100. package/dist/_types/contracts/local-execution/recognition.d.ts +170 -0
  101. package/dist/_types/contracts/local-execution/speech.d.ts +95 -0
  102. package/dist/_types/contracts/local-execution/tool-selection.d.ts +45 -5
  103. package/dist/_types/contracts/local-execution/whisper.d.ts +24 -0
  104. package/dist/_types/contracts/local-execution/work.d.ts +69 -10741
  105. package/dist/_types/contracts/local-execution/workspace.d.ts +5 -0
  106. package/dist/_types/contracts/media-category.d.ts +11 -0
  107. package/dist/_types/contracts/media-observation.d.ts +929 -8
  108. package/dist/_types/contracts/observation-profile.d.ts +3 -3
  109. package/dist/_types/contracts/programmatic-composition.d.ts +24 -24
  110. package/dist/_types/contracts/programmatic-exploration.d.ts +348 -6009
  111. package/dist/_types/contracts/provider-catalog.d.ts +3 -3
  112. package/dist/_types/contracts/provider-models.d.ts +16 -8
  113. package/dist/_types/contracts/provider.d.ts +66 -1
  114. package/dist/_types/contracts/reference-preview.d.ts +19 -0
  115. package/dist/_types/contracts/repair-lifecycle.d.ts +52 -384
  116. package/dist/_types/contracts/repair-plan.d.ts +16 -98
  117. package/dist/_types/contracts/repair-strategy.d.ts +162 -4505
  118. package/dist/_types/contracts/review-intelligence-final-output.d.ts +317 -8163
  119. package/dist/_types/contracts/review-intelligence.d.ts +450 -11468
  120. package/dist/_types/contracts/rough-cut-manifest.d.ts +1 -0
  121. package/dist/_types/contracts/rough-cut-review.d.ts +134 -12566
  122. package/dist/_types/contracts/rough-cut.d.ts +1076 -5731
  123. package/dist/_types/contracts/sound-making-plan.d.ts +3 -2
  124. package/dist/_types/contracts/speech-cost.d.ts +81 -0
  125. package/dist/_types/contracts/speech.d.ts +149 -0
  126. package/dist/_types/contracts/temporal-evidence-operation.d.ts +1 -0
  127. package/dist/_types/contracts/timeline-audio.d.ts +1 -0
  128. package/dist/_types/contracts/timeline-manifest.d.ts +2 -0
  129. package/dist/_types/contracts/timeline-source-sound.d.ts +1 -0
  130. package/dist/_types/contracts/timeline-v2.d.ts +4 -0
  131. package/dist/_types/contracts/timeline-version-reader.d.ts +10 -0
  132. package/dist/_types/contracts/timeline-visual-layers.d.ts +4 -0
  133. package/dist/_types/contracts/timeline.d.ts +50 -4850
  134. package/dist/_types/contracts/transcription.d.ts +1 -1
  135. package/dist/_types/contracts/video-generation.d.ts +33 -0
  136. package/dist/_types/contracts/visual-layer-render.d.ts +37 -6
  137. package/dist/_types/contracts/visual-sequence.d.ts +22 -0
  138. package/dist/_types/contracts/workspace.d.ts +22 -0
  139. package/dist/_types/sdk/errors.d.ts +1 -1
  140. package/dist/_types/sdk/local-runtime/device-client.d.ts +7 -33
  141. package/dist/_types/sdk/local-runtime/library.d.ts +268 -0
  142. package/dist/_types/sdk/local-runtime/workspace.d.ts +9 -4
  143. package/dist/_types/sdk/local-runtime-client.d.ts +477 -32
  144. package/dist/entry.js +1 -1
  145. package/dist/local-management.js +1 -1
  146. package/dist/local-navigation.js +1 -1
  147. package/package.json +2 -8
  148. package/README.md +0 -119
  149. package/dist/_chunks/chunk-D533YC7J.js +0 -1
  150. package/dist/_chunks/chunk-INLSOHAK.js +0 -1
  151. package/dist/_chunks/chunk-JPH576UL.js +0 -1
  152. package/dist/_chunks/chunk-N6S6HCWE.js +0 -1
  153. package/dist/_chunks/chunk-PBEHCYR7.js +0 -1
  154. package/dist/_chunks/chunk-RVGDXRPK.js +0 -1
  155. package/dist/_chunks/chunk-YKOJPJZR.js +0 -1
  156. package/dist/_chunks/local-main-S2K34Y2F.js +0 -1
  157. package/dist/_chunks/local-mcp-LCHXL2IE.js +0 -1
  158. package/dist/_chunks/main-KLXOK7QK.js +0 -2
  159. package/dist/_chunks/mcp-P7W623FE.js +0 -1
  160. package/dist/_chunks/project-connect-W7V3OALV.js +0 -1
  161. package/dist/_chunks/render-main-ZW6UJHGN.js +0 -1
  162. package/dist/_chunks/src-BXLFLNRG.js +0 -1
@@ -1 +0,0 @@
1
- import{ArtifactIdSchema,ArtifactRepresentationIdSchema,BriefIdSchema,BriefVersionIdSchema,ContinuationSchema,ContinuityEdgeIdSchema,DeliveryOutputProfileSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneIdSchema,SceneShotPlanIdSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,StoryIdSchema,StoryVersionIdSchema,TenantIdSchema,finalProfileIds}from"./chunk-VPYAXWXY.js";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")})});import{z as z2}from"zod";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 offset=z3.int().min(0).max(4094).multipleOf(2);var dimension=z3.int().min(2).max(4096).multipleOf(2);var ClipFramingSchema=z3.strictObject({algorithm:z3.literal("CROP_PAD_V1"),crop:z3.strictObject({x:offset,y:offset,width:dimension,height:dimension}),anchorXPermille:z3.int().min(0).max(1e3),anchorYPermille:z3.int().min(0).max(1e3)});var PicturePolicySchema=z3.literal("CROP_PAD_V1");import{z as z4}from"zod";var ClipTransitionSchema=z4.union([z4.literal("CUT"),z4.strictObject({kind:z4.literal("CROSS_DISSOLVE_V1"),durationFrames:z4.int().min(2).max(30)})]);import{z as z5}from"zod";var sha=z5.string().regex(/^[0-9a-f]{64}$/);var GraphicPlacementSchema=z5.strictObject({startFrame:z5.int().nonnegative().max(1800),endFrame:z5.int().positive().max(1800),anchor:z5.enum(["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"]),widthPermille:z5.int().min(50).max(400),marginXPermille:z5.int().min(0).max(100),marginYPermille:z5.int().min(0).max(100),opacityPermille:z5.int().min(100).max(1e3)}).refine(v=>v.endFrame>v.startFrame,"Graphic frame interval must advance");var TimelineGraphicInputSchema=z5.strictObject({artifactId:ArtifactIdSchema,placement:GraphicPlacementSchema});var TimelineGraphicSourceSchema=z5.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha,contentType:z5.enum(["image/png","image/webp"]),byteSize:z5.int().positive().max(16*1024*1024),width:z5.int().positive().max(8192),height:z5.int().positive().max(8192)});var TimelineGraphicSchema=z5.strictObject({source:TimelineGraphicSourceSchema,placement:GraphicPlacementSchema});import{z as z6}from"zod";var id2=z6.uuid().toLowerCase();var hash=z6.string().regex(/^[0-9a-f]{64}$/);var CaptionTranscriptPlacementSchema=z6.discriminatedUnion("kind",[z6.strictObject({kind:z6.literal("AUDIO_TRACK"),purpose:z6.enum(["VOICEOVER","MUSIC"])}),z6.strictObject({kind:z6.literal("SPEECH_CUE"),cueId:z6.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}),z6.strictObject({kind:z6.literal("TIMELINE_OUTPUT")})]);var CaptionTranscriptPlanSchema=z6.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,timelineVersionId:id2,language:z6.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),sources:z6.array(z6.strictObject({observationId:id2,placement:CaptionTranscriptPlacementSchema,granularity:z6.enum(["word","segment"])})).min(1).max(64)});var AuthorTranscriptCaptionsSchema=CaptionTranscriptPlanSchema.extend({expectedProductionRevision:z6.int().positive(),expectedCaptionVersion:z6.int().nonnegative(),idempotencyKey:z6.string().trim().min(1).max(200)});var CaptionTranscriptProvenanceSchema=z6.strictObject({schemaVersion:z6.literal(1),advisory:z6.literal(true),timing:z6.literal("PROVIDER_REPORTED"),timelineVersionId:id2,timingFingerprint:hash,sources:z6.array(z6.strictObject({observationId:id2,artifactId:id2,representationId:id2,checksumSha256:hash,placement:CaptionTranscriptPlacementSchema,granularity:z6.enum(["word","segment"]),sourceInMs:z6.int().nonnegative(),sourceOutMs:z6.int().positive(),startMs:z6.int().nonnegative(),spanIndices:z6.array(z6.int().nonnegative().max(1199)).min(1).max(120),excludedSpans:z6.int().nonnegative().max(1200)})).min(1).max(64)});import{z as z7}from"zod";var sha2=z7.string().regex(/^[0-9a-f]{64}$/);var CaptionContentSchema=z7.strictObject({language:z7.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),durationMs:z7.int().min(3e4).max(6e4),cues:z7.array(z7.strictObject({startMs:z7.int().nonnegative().max(59999),endMs:z7.int().positive().max(6e4),text:z7.string().min(1).max(240)})).min(1).max(120)});var CaptionScopeSchema=z7.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AuthorCaptionsSchema=CaptionScopeSchema.extend({expectedProductionRevision:z7.int().positive(),expectedCaptionVersion:z7.int().nonnegative(),idempotencyKey:z7.string().trim().min(1).max(200),content:CaptionContentSchema});var CaptionGetSchema=CaptionScopeSchema.extend({versionId:z7.uuid()});var CaptionQuerySchema=CaptionScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var CaptionRepresentationSchema=z7.strictObject({id:z7.uuid(),checksumSha256:sha2,byteSize:z7.int().positive().max(131072)});var CaptionVersionSchema=CaptionScopeSchema.extend({transcriptProvenance:CaptionTranscriptProvenanceSchema.optional(),id:z7.uuid(),captionId:z7.uuid(),projectId:z7.uuid(),version:z7.int().positive(),artifactId:z7.uuid(),content:CaptionContentSchema,fingerprint:sha2,original:CaptionRepresentationSchema,subtitle:CaptionRepresentationSchema,previousVersionId:z7.uuid().nullable(),createdByPrincipalId:z7.uuid(),createdAt:z7.iso.datetime({offset:true})});var CaptionViewSchema=z7.strictObject({version:CaptionVersionSchema,isCurrent:z7.boolean(),availability:z7.enum(["AVAILABLE","UNAVAILABLE"])});var CaptionReceiptSchema=z7.strictObject({semanticStatus:z7.literal("SUCCESS"),version:CaptionVersionSchema,productionRevision:z7.int().positive()});var CaptionBasisSchema=CaptionScopeSchema.extend({productionRevision:z7.int().positive(),currentVersion:z7.int().nonnegative(),currentVersionId:z7.uuid().nullable(),authorable:z7.boolean()});var CaptionPageSchema=z7.strictObject({items:z7.array(CaptionViewSchema).max(200),page:QueryPageInfoSchema});var CaptionExportSchema=CaptionGetSchema.extend({format:z7.enum(["JSON","SRT"])});var CaptionSnapshotSchema=z7.strictObject({currentVersion:z7.int().positive().nullable(),currentVersionId:z7.uuid().nullable(),artifactId:z7.uuid().nullable(),availability:z7.enum(["NONE","AVAILABLE","UNAVAILABLE"]),cueCount:z7.int().nonnegative().max(120),durationMs:z7.int().min(3e4).max(6e4).nullable(),attachedToTimeline:z7.boolean(),attachedCaptionVersionId:z7.uuid().nullable().optional(),attachedTimelineVersionId:z7.uuid().nullable().optional()});var CaptionTranscriptDraftSchema=z7.strictObject({content:CaptionContentSchema,provenance:CaptionTranscriptProvenanceSchema});import{z as z8}from"zod";var LegacyCaptionRenderStyleSchema=z8.strictObject({id:z8.literal("PLAIN_TEXT_NOTO_SANS_SC_V1"),fontSha256:z8.literal("a3041811a78c361b1de50f953c805e0244951c21c5bd412f7232ef0d899af0da"),framePolicy:z8.literal("PTS_HALF_OPEN_CEIL_V1")});var RegularCaptionRenderStyleSchema=z8.strictObject({id:z8.literal("PLAIN_TEXT_NATIVE_SC_REGULAR_V2"),fontSha256:z8.literal("e5a51f41fc1b827da651afee3975e07a182ff4f8e04d9dfc0a3cecd6177a52b6"),framePolicy:z8.literal("PTS_HALF_OPEN_CEIL_V1")});var CaptionRenderStyleSchema=z8.discriminatedUnion("id",[LegacyCaptionRenderStyleSchema,RegularCaptionRenderStyleSchema]);import{z as z9}from"zod";var sha3=z9.string().regex(/^[0-9a-f]{64}$/);var AudioPurposeSchema=z9.enum(["VOICEOVER","MUSIC"]);var AudioProductionScopeSchema=z9.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AudioScopeSchema=AudioProductionScopeSchema.extend({purpose:AudioPurposeSchema});var AudioMediaSchema=z9.strictObject({profile:z9.literal("PCM_S16LE_48000_V1"),audioCodec:z9.literal("pcm_s16le"),sampleRateHz:z9.literal(48e3),audioChannels:z9.union([z9.literal(1),z9.literal(2)]),sampleCount:z9.int().min(4800).max(288e4),durationMs:z9.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:z9.int().positive(),expectedAudioVersion:z9.int().nonnegative(),idempotencyKey:z9.string().trim().min(1).max(200),contentType:z9.literal("audio/wav"),originalName:z9.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).optional()});var AudioImportRequestSchema=AudioImportSchema.extend({contentBase64:z9.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var AudioGetSchema=AudioScopeSchema.extend({versionId:z9.uuid()});var AudioQuerySchema=AudioScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var AudioRepresentationSchema=z9.strictObject({id:z9.uuid(),checksumSha256:sha3,byteSize:z9.int().min(44).max(12582912)});var AudioVersionSchema=AudioScopeSchema.extend({id:z9.uuid(),audioId:z9.uuid(),projectId:z9.uuid(),version:z9.int().positive(),artifactId:z9.uuid(),original:AudioRepresentationSchema,media:AudioMediaSchema,originalName:z9.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).nullable(),previousVersionId:z9.uuid().nullable(),createdByPrincipalId:z9.uuid(),createdAt:z9.iso.datetime({offset:true}),generation:z9.strictObject({generationId:z9.uuid(),executionClass:z9.enum(["LIVE","TEST_ONLY"]),sourceArtifactId:z9.uuid(),sourceRepresentationId:z9.uuid(),sourceChecksumSha256:sha3,sourceByteSize:z9.int().min(44).max(12582912),sourceMedia:z9.strictObject({sampleRateHz:z9.int().positive().max(48e3),audioChannels:z9.union([z9.literal(1),z9.literal(2)]),sampleCount:z9.int().positive()}),normalizationVersion:z9.literal("SPEECH_PCM_V1"),padSamples:z9.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=z9.strictObject({version:AudioVersionSchema,isCurrent:z9.boolean(),availability:z9.enum(["AVAILABLE","UNAVAILABLE"])});var AudioReceiptSchema=z9.strictObject({semanticStatus:z9.literal("SUCCESS"),version:AudioVersionSchema,productionRevision:z9.int().positive()});var AudioBasisSchema=AudioScopeSchema.extend({productionRevision:z9.int().positive(),currentVersion:z9.int().nonnegative(),currentVersionId:z9.uuid().nullable(),importable:z9.boolean()});var AudioPageSchema=z9.strictObject({items:z9.array(AudioViewSchema).max(200),page:QueryPageInfoSchema});var AudioSnapshotSchema=z9.strictObject({tracks:z9.array(z9.strictObject({purpose:AudioPurposeSchema,currentVersion:z9.int().positive().nullable(),currentVersionId:z9.uuid().nullable(),artifactId:z9.uuid().nullable(),availability:z9.enum(["NONE","AVAILABLE","UNAVAILABLE"]),durationMs:z9.int().min(100).max(6e4).nullable(),audioChannels:z9.union([z9.literal(1),z9.literal(2)]).nullable(),attachedToTimeline:z9.boolean()})).length(2)});import{z as z10}from"zod";var placement={sourceInMs:z10.int().nonnegative().max(6e4),sourceOutMs:z10.int().positive().max(6e4),startMs:z10.int().nonnegative().max(6e4),gainPermille:z10.int().nonnegative().max(1e3)};var TimelineAudioInputSchema=z10.strictObject({tracks:z10.array(z10.strictObject({purpose:AudioPurposeSchema,versionId:z10.uuid(),...placement})).min(1).max(2),duckingMusicPermille:z10.int().nonnegative().max(1e3).default(1e3)}).superRefine((audio,ctx)=>{if(new Set(audio.tracks.map(t=>t.purpose)).size!==audio.tracks.length||audio.tracks.some(t=>t.sourceOutMs<=t.sourceInMs)||audio.duckingMusicPermille<1e3&&audio.tracks.length!==2)ctx.addIssue({code:"custom",message:"Distinct purposes, advancing trims and explicit ducking pair required"})});var AudioMixProfileSchema=z10.strictObject({id:z10.literal("PCM_WINDOW_MIX_AAC_V1"),sampleRateHz:z10.literal(48e3),audioChannels:z10.literal(2),audioCodec:z10.literal("aac"),bitrate:z10.literal(192e3),peakPermille:z10.literal(950),duckingMusicPermille:z10.int().nonnegative().max(1e3)});var TimelineAudioCompositionSchema=z10.strictObject({mix:AudioMixProfileSchema,tracks:z10.array(z10.strictObject({source:AudioVersionSchema,...placement})).min(1).max(2)}).superRefine((audio,ctx)=>{if(new Set(audio.tracks.map(t=>t.source.purpose)).size!==audio.tracks.length||audio.tracks.some(t=>t.sourceOutMs<=t.sourceInMs||t.sourceOutMs>t.source.media.durationMs)||audio.mix.duckingMusicPermille<1e3&&audio.tracks.length!==2)ctx.addIssue({code:"custom",message:"Invalid exact audio composition"})});var RenderedAudioSchema=z10.strictObject({audioCodec:z10.literal("aac"),sampleRateHz:z10.literal(48e3),audioChannels:z10.literal(2),sampleCount:z10.int().positive().max(288e4)});import{z as z11}from"zod";var Fingerprint=z11.string().regex(/^[0-9a-f]{64}$/);var AcceptedShotReferenceSchema=z11.strictObject({acceptanceId:z11.uuid(),reviewId:z11.uuid(),generationId:z11.uuid(),candidateId:z11.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint,artifactChecksumSha256:Fingerprint,preparationId:z11.uuid(),contractId:z11.uuid(),contractFingerprint:Fingerprint,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z11.int().positive(),shotPlanningRevision:z11.int().positive(),executionClass:z11.enum(["LIVE","TEST_ONLY"]),reviewResult:z11.enum(["PASS","WARNING"])});import{z as z12}from"zod";var ProviderIdSchema=z12.enum(["QWEN_CN","VOLCENGINE_CN","GEMINI","OPENAI","XAI"]);var ProviderConnectionIdSchema=z12.uuid().brand();var ModelProfileIdSchema=z12.string().regex(/^[a-z][a-z0-9-]{1,79}$/);var GeometryPolicySchema=z12.enum(["STRICT","PAD_TO_ASPECT"]);var ProviderSelectionSchema=z12.strictObject({connectionId:ProviderConnectionIdSchema,modelProfileId:ModelProfileIdSchema});var ProviderConfigurationSchema=z12.strictObject({providerId:ProviderIdSchema,label:z12.string().trim().min(1).max(100),allowedModelProfileIds:z12.array(ModelProfileIdSchema).min(1).max(16),qwenEndpoint:z12.literal("QIANWEN_PLATFORM").optional(),credentialService:z12.enum(["ARK","DOUBAO_SPEECH"]).optional(),qwenWorkspaceId:z12.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/).optional(),geometryPolicy:GeometryPolicySchema.default("STRICT")}).superRefine((v,c)=>{if(new Set(v.allowedModelProfileIds).size!==v.allowedModelProfileIds.length)c.addIssue({code:"custom",message:"Duplicate model profile"});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=z12.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z12.int().nonnegative(),configuration:ProviderConfigurationSchema,apiKey:z12.string().min(8).max(4096).regex(/^[!-~]+$/)});var ProviderConnectionViewSchema=z12.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z12.int().positive(),enabled:z12.boolean(),credentialConfigured:z12.boolean(),configuration:ProviderConfigurationSchema,createdByPrincipalId:PrincipalIdSchema,updatedAt:z12.iso.datetime({offset:true})});var ProviderConnectionCommandSchema=z12.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z12.int().positive()});var ProviderCredentialRevokeSchema=z12.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z12.int().positive()});var SetKeyframeDefaultSchema=z12.strictObject({tenantId:TenantIdSchema,selection:ProviderSelectionSchema,expectedRevision:z12.int().nonnegative()});var ProviderExecutionBindingSchema=z12.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,connectionVersion:z12.int().positive(),providerId:ProviderIdSchema,modelProfileId:ModelProfileIdSchema,modelProfileVersion:z12.int().positive(),modelId:z12.string().min(1).max(160),credentialRef:z12.uuid(),credentialVersion:z12.int().positive(),geometryPolicy:GeometryPolicySchema,qwenEndpoint:z12.literal("QIANWEN_PLATFORM").optional()}).refine(binding=>!binding.qwenEndpoint||binding.providerId==="QWEN_CN",{message:"Qianwen platform binding requires Qwen China"});import{z as z13}from"zod";var GenerationCostVariantSchema=z13.strictObject({mode:z13.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),aspectRatio:z13.enum(["16:9","9:16"]),workingWidth:z13.int().min(0).max(4096),workingHeight:z13.int().min(0).max(4096),hasAudio:z13.boolean(),references:z13.int().min(0).max(24),durationSeconds:z13.number().finite().min(0).max(30)});var GenerationCostPolicySchema=z13.strictObject({currency:z13.literal("USD"),sourceUrl:z13.url({protocol:/^https$/}).max(2e3),rationale:z13.string().trim().min(1).max(2e3),validUntil:z13.iso.datetime({offset:true}),rules:z13.array(z13.strictObject({id:z13.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),variant:GenerationCostVariantSchema,upperBoundMicros:z13.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=z13.strictObject({connectionVersion:z13.int().positive(),modelProfileVersion:z13.int().positive(),quoteValidUntil:z13.iso.datetime({offset:true})});var GenerationCostQuoteSchema=z13.strictObject({currency:z13.literal("USD"),upperBoundMicros:z13.int().nonnegative().max(1e9),selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema,sourceUrl:z13.url({protocol:/^https$/}).max(2e3),ruleIds:z13.array(z13.string()).min(1).max(64),preparationId:z13.uuid(),contractFingerprint:z13.string().regex(/^[a-f0-9]{64}$/)});import{z as z14}from"zod";var id3=z14.uuid().toLowerCase();var hash2=z14.string().regex(/^[0-9a-f]{64}$/);var NativeVideoAudioMetadataSchema=z14.strictObject({normalizationVersion:z14.literal("VIDEO_AUDIO_PCM_V1"),sourceCodec:z14.literal("aac"),sourceSampleRateHz:z14.int().min(8e3).max(96e3),sourceChannels:z14.union([z14.literal(1),z14.literal(2)]),sourceFrameRateHz:z14.union([z14.literal(24),z14.literal(30)]),sourceFrameCount:z14.int().positive().max(905),sourceStartOffsetMs:z14.number().finite().min(-500).max(5e3),sourceDeclaredDurationMs:z14.number().positive().max(31e3),alignment:z14.literal("TRIM_PAD_PCM_TO_VIDEO_ZERO_V1"),media:z14.strictObject({profile:z14.literal("PCM_S16LE_48000_NATIVE_VIDEO_V1"),audioCodec:z14.literal("pcm_s16le"),sampleRateHz:z14.literal(48e3),audioChannels:z14.union([z14.literal(1),z14.literal(2)]),sampleCount:z14.int().positive().max(1448e3),durationMs:z14.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=z14.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:z14.int().min(44).max(12582912),metadata:NativeVideoAudioMetadataSchema,executionClass:z14.enum(["LIVE","TEST_ONLY"])});import{z as z15}from"zod";var KeyframePurposeSchema=z15.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"]);var AcceptedKeyframeReferenceSchema=z15.strictObject({acceptanceId:z15.uuid(),reviewId:z15.uuid(),generationId:z15.uuid(),candidateId:z15.uuid(),shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z15.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z15.string().regex(/^[0-9a-f]{64}$/),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z15.int().positive(),shotPlanningRevision:z15.int().positive(),executionClass:z15.enum(["LIVE","TEST_ONLY"])});import{z as z16}from"zod";var ConsistencyReviewScaleSchema=z16.enum(["INTRA_SHOT","INTER_SHOT","PRODUCTION"]);var State=z16.string().trim().min(1).max(300);var StoryTime=z16.int().nonnegative().max(31536e8);var position=z16.int().min(1).max(999);var StateChange=z16.strictObject({atPermille:position,from:State,to:State,reason:State});var TimeJump=z16.strictObject({atPermille:position,fromMs:StoryTime,toMs:StoryTime,reason:State});var ContinuityExpectationSchema=z16.discriminatedUnion("kind",[z16.strictObject({kind:z16.literal("STATE"),mode:z16.enum(["PRESERVE","PLANNED_TRANSITIONS"]),entry:State,exit:State,changes:z16.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"})}),z16.strictObject({kind:z16.literal("TIME"),mode:z16.enum(["MONOTONIC","PLANNED_JUMPS"]),entryMs:StoryTime,exitMs:StoryTime,jumps:z16.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=z16.strictObject({atMs:z16.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=z16.array(ContinuitySampleSchema).min(3).max(64);import{z as z17}from"zod";var PreparationIdSchema=z17.uuid().brand();var GenerationContractIdSchema=z17.uuid().brand();var ContentFingerprintSchema=z17.string().regex(/^[0-9a-f]{64}$/);var PreparationTargetSchema=z17.discriminatedUnion("mediaType",[z17.strictObject({mediaType:z17.literal("IMAGE"),purpose:z17.enum(["KEYFRAME","REFERENCE_FRAME"]),framePurpose:z17.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"])}),z17.strictObject({mediaType:z17.literal("VIDEO"),purpose:z17.literal("SHOT_CANDIDATE")})]);var PreparationBasisSchema=z17.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sceneId:SceneIdSchema,shotId:ShotIdSchema,productionRevision:z17.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z17.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z17.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z17.int().positive(),shotPlanningRevision:z17.int().positive(),resolverVersion:z17.literal("w7-product-preflight-v1"),consistencyProfile:z17.strictObject({id:z17.uuid(),version:z17.int().positive(),effectiveFingerprint:ContentFingerprintSchema}).optional()});var ReferenceRoleSchema=z17.enum(["PRODUCT_IDENTITY","PRODUCT_PACKSHOT","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","START_FRAME_ANCHOR","END_FRAME_ANCHOR"]);var ReferenceBindingInputSchema=z17.strictObject({keyframeAcceptanceId:z17.uuid().optional(),role:ReferenceRoleSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,reason:z17.string().trim().min(1).max(500)});var ExactEvidenceReferenceSchema=z17.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,artifactChecksumSha256:ContentFingerprintSchema});var ResolvedReferenceSchema=ReferenceBindingInputSchema.extend({artifactChecksumSha256:ContentFingerprintSchema,contentType:z17.enum(["image/png","image/jpeg","image/webp"]),acceptedKeyframe:AcceptedKeyframeReferenceSchema.optional(),consistencyRuleId:z17.uuid().optional(),subjectId:z17.uuid().optional(),authority:z17.enum(["BRIEF_SOURCE_AND_EXPLICIT_BINDING","EXPLICIT_SHOT_BINDING","CANONICAL_PROFILE_MASTER","ACCEPTED_KEYFRAME_AND_EXPLICIT_BINDING"])});var ResolvedConstraintSchema=z17.strictObject({continuity:ContinuityExpectationSchema.optional(),reviewScales:z17.array(ConsistencyReviewScaleSchema).min(1).max(3).optional(),key:z17.string().min(1).max(200),family:z17.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY"]),scope:z17.enum(["PROJECT","PRODUCTION","SCENE","SHOT","CONTINUITY_EDGE"]),subjectId:z17.uuid().optional(),dimension:z17.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).optional(),enforcement:z17.enum(["LOCKED","REQUIRED","PREFERRED"]),expected:z17.string().min(1).max(1e3),source:z17.strictObject({kind:z17.enum(["BRIEF","SCENE","SHOT","CONTINUITY_EDGE","CONSISTENCY_PROFILE"]),id:z17.uuid(),version:z17.int().positive()})});var PreparationBlockerSchema=z17.strictObject({code:z17.enum(["MISSING_PRODUCT_REFERENCE","CANONICAL_SOURCE_UNAVAILABLE","CONSTRAINT_CONFLICT","PREVIOUS_SHOT_EVIDENCE_UNAVAILABLE","GENERATED_KEYFRAME_REQUIRED"]),summary:z17.string().min(1).max(1e3),relatedShotId:ShotIdSchema.optional(),edgeId:ContinuityEdgeIdSchema.optional()});var ConstraintSetSchema=z17.strictObject({preparationId:PreparationIdSchema,version:z17.int().positive(),fingerprint:ContentFingerprintSchema,items:z17.array(ResolvedConstraintSchema).max(2048)});var ReferenceSetSchema=z17.strictObject({preparationId:PreparationIdSchema,version:z17.int().positive(),fingerprint:ContentFingerprintSchema,bindings:z17.array(ResolvedReferenceSchema).max(12)});import{z as z18}from"zod";var VideoGenerationIdSchema=z18.uuid().brand();var VideoProviderProfileSchema=z18.strictObject({id:z18.string().regex(/^[a-z][a-z0-9-]{1,79}$/),adapterVersion:z18.string().min(1).max(80),model:z18.string().min(1).max(160),executionClass:z18.enum(["LIVE","TEST_ONLY"]),mediaType:z18.literal("VIDEO"),modes:z18.array(z18.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"])).min(1).max(3),referenceRoles:z18.array(ReferenceRoleSchema).min(1).max(8),aspectRatios:z18.array(z18.enum(["16:9","9:16"])).min(1).max(2),minDurationSeconds:z18.int().min(1),maxDurationSeconds:z18.int().max(30),maxReferences:z18.int().min(1).max(10),combineAnchorsAndReferences:z18.boolean(),workingWidth:z18.int().positive().max(4096),workingHeight:z18.int().positive().max(4096),frameRate:z18.union([z18.literal(24),z18.literal(30)]),sourceFormat:z18.strictObject({videoCodec:z18.literal("hevc"),pixelFormat:z18.literal("yuv420p10le")}).optional(),hasAudio:z18.boolean(),nativeAudioChannels:z18.union([z18.literal(1),z18.literal(2)]).optional(),correlationStrategy:z18.literal("PROVIDER_TASK_ID")});var VideoStartInputSchema=z18.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,selection:ProviderSelectionSchema,idempotencyKey:z18.string().trim().min(1).max(200)});var VideoGetInputSchema=z18.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:VideoGenerationIdSchema});var VideoQueryInputSchema=z18.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoAdmissionSchema=z18.strictObject({semanticStatus:z18.literal("ACCEPTED"),generationId:VideoGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z18.enum(["LIVE","TEST_ONLY"])});var VideoTechnicalMetadataSchema=z18.strictObject({contentType:z18.literal("video/mp4"),checksumSha256:ContentFingerprintSchema,byteSize:z18.int().positive().max(128*1024*1024),width:z18.int().positive().max(4096),height:z18.int().positive().max(4096),durationMs:z18.int().min(1).max(30150),frameRate:z18.number().positive().max(120),videoCodec:z18.enum(["h264","hevc"]),pixelFormat:z18.literal("yuv420p10le").optional(),hasAudio:z18.boolean(),nativeAudio:NativeVideoAudioMetadataSchema.optional()});var VideoPosterSchema=z18.strictObject({representationId:ArtifactRepresentationIdSchema,contentType:z18.literal("image/png"),checksumSha256:ContentFingerprintSchema,byteSize:z18.int().positive().max(2*1024*1024),width:z18.int().positive().max(320),height:z18.int().positive().max(320)});var VideoCandidateSchema=VideoTechnicalMetadataSchema.extend({nativeSound:NativeVideoSoundReferenceSchema.optional(),id:z18.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,poster:VideoPosterSchema,availability:z18.enum(["AVAILABLE","INVALID"]),observation:z18.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z18.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z18.boolean(),reviewId:z18.uuid().optional(),reviewVersion:z18.int().positive().optional(),acceptanceDecisionId:z18.uuid().optional(),freshness:z18.enum(["CURRENT_BASIS","STALE_BASIS"])});var VideoGenerationViewSchema=z18.strictObject({generationId:VideoGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,connection:z18.strictObject({connectionId:z18.uuid(),connectionVersion:z18.int().positive(),modelProfileId:z18.string(),modelProfileVersion:z18.int().positive()}),operationId:OperationIdSchema,provider:VideoProviderProfileSchema,runtimeStatus:z18.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z18.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z18.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z18.boolean(),candidate:VideoCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z18.iso.datetime({offset:true})});var VideoQueryPageSchema=z18.strictObject({items:z18.array(VideoGenerationViewSchema),page:QueryPageInfoSchema});var VideoSummarySchema=z18.strictObject({generations:z18.int().nonnegative(),running:z18.int().nonnegative(),waiting:z18.int().nonnegative(),registeredCandidates:z18.int().nonnegative(),testCandidates:z18.int().nonnegative(),liveCandidates:z18.int().nonnegative()});import{z as z19}from"zod";var TimelineDurationSchema=z19.strictObject({totalMs:z19.int().positive().max(603e4),targetMs:z19.int().min(3e4).max(6e4),minMs:z19.literal(3e4),maxMs:z19.literal(6e4),deltaTargetMs:z19.int(),classification:z19.enum(["TOO_SHORT","WITHIN_TARGET","TOO_LONG"])});var TimelineClipSchema=z19.strictObject({ordinal:z19.int().positive().max(200),source:AcceptedShotReferenceSchema,technical:VideoTechnicalMetadataSchema,sourceInMs:z19.int().nonnegative(),sourceOutMs:z19.int().positive(),startMs:z19.int().nonnegative(),durationMs:z19.int().positive(),transition:ClipTransitionSchema,framing:ClipFramingSchema.optional()});var TimelineManifestSchema=z19.strictObject({schemaVersion:z19.literal(1),caption:CaptionVersionSchema.optional(),captionStyle:CaptionRenderStyleSchema.optional(),audio:TimelineAudioCompositionSchema.optional(),graphics:z19.array(TimelineGraphicSchema).max(8).optional(),basis:z19.strictObject({briefVersionId:BriefVersionIdSchema,briefVersion:z19.int().positive(),storyVersion:z19.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z19.int().positive()}),output:z19.strictObject({aspectRatio:z19.enum(["16:9","9:16"]),profile:DeliveryOutputProfileSchema}),clips:z19.array(TimelineClipSchema).min(1).max(200),duration:TimelineDurationSchema,missingPlannedShotIds:z19.array(ShotIdSchema).max(200),executionClass:z19.enum(["LIVE","TEST_ONLY"])});var TimelineVersionIdentityShape={id:z19.uuid(),timelineId:z19.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z19.int().positive(),fingerprint:z19.string().regex(/^[0-9a-f]{64}$/),createdByPrincipalId:PrincipalIdSchema,createdAt:z19.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 z20}from"zod";var RoughCutProfileIdSchema=z20.enum(["PREVIEW_H264_480P_V1","PREVIEW_H264_720P_V1","PREVIEW_H264_1080P_V1"]);var RoughCutProfileSchema=z20.strictObject({captionPolicy:z20.literal("BURN_IN").optional(),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z20.literal("OVERLAY_V1").optional(),id:RoughCutProfileIdSchema,algorithm:z20.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z20.union([z20.literal(854),z20.literal(480),z20.literal(1280),z20.literal(720),z20.literal(1920),z20.literal(1080)]),height:z20.union([z20.literal(854),z20.literal(480),z20.literal(1280),z20.literal(720),z20.literal(1920),z20.literal(1080)]),frameRate:z20.literal(30),codec:z20.literal("h264"),pixelFormat:z20.literal("yuv420p"),fit:z20.literal("PAD"),hasAudio:z20.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z20.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"})});import{z as z21}from"zod";var RoughCutManifestSchema=z21.strictObject({schemaVersion:z21.literal(1),timeline:TimelineVersionSchema,profile:RoughCutProfileSchema,frames:z21.array(z21.strictObject({ordinal:z21.int().positive().max(200),startFrame:z21.int().nonnegative().max(1800),frameCount:z21.int().positive().max(1800),overlapFrames:z21.int().nonnegative().max(30).default(0)})).min(1).max(200),totalFrames:z21.int().min(900).max(1800)});import{z as z22}from"zod";var Fingerprint2=z22.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticAcceptedVisualSourceReferenceSchema=z22.strictObject({sourceKind:z22.literal("PROGRAMMATIC"),acceptanceId:z22.uuid(),reviewId:z22.uuid(),renderId:z22.uuid(),compositionId:z22.uuid(),compositionVersionId:z22.uuid(),compositionVersion:z22.int().positive(),compositionFingerprint:Fingerprint2,renderManifestFingerprint:Fingerprint2,shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,artifactChecksumSha256:Fingerprint2,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z22.int().positive(),shotPlanningRevision:z22.int().positive(),executionClass:z22.enum(["LIVE","TEST_ONLY"]),reviewResult:z22.enum(["PASS","WARNING"])});var ImportedAcceptedVisualSourceReferenceSchema=z22.strictObject({sourceKind:z22.literal("IMPORTED"),acceptanceId:z22.uuid(),reviewId:z22.uuid(),normalizationId:z22.uuid(),sourceId:z22.uuid(),sourceVersionId:z22.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint2,executionClass:z22.enum(["LIVE","TEST_ONLY"]),reviewResult:z22.enum(["PASS","WARNING"])});var AcceptedVisualSourceReferenceSchema=z22.union([AcceptedShotReferenceSchema,ProgrammaticAcceptedVisualSourceReferenceSchema,ImportedAcceptedVisualSourceReferenceSchema]);import{z as z23}from"zod";var SourceSoundTreatmentSchema=z23.strictObject({policy:z23.enum(["KEEP","MUTE","DUCK"]),gainPermille:z23.int().min(0).max(1e3),duckingPermille:z23.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 z24}from"zod";var SpeechParameterValueSchema=z24.union([z24.string().max(4096),z24.number().finite(),z24.boolean(),z24.array(z24.string().max(4096)).max(100),z24.record(z24.string().min(1).max(100),z24.string().max(4096)).refine(v=>Object.keys(v).length<=100)]);var SpeechParameterRuleSchema=z24.strictObject({label:z24.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),type:z24.enum(["NUMBER","INTEGER","STRING","BOOLEAN","STRING_ARRAY","STRING_MAP"]),required:z24.boolean().default(false),min:z24.number().optional(),max:z24.number().optional(),maxLength:z24.int().positive().max(4096).optional(),options:z24.array(z24.string().min(1).max(100)).max(100).optional(),default:SpeechParameterValueSchema.optional(),unit:z24.string().max(40).optional(),description:z24.string().max(500).optional(),maxItems:z24.int().positive().max(100).optional(),maxKeyLength:z24.int().positive().max(100).optional()});var SpeechParametersSchema=z24.record(z24.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterValueSchema).refine(p=>Object.keys(p).length<=24);var SpeechModelProfileSchema=z24.strictObject({id:ModelProfileIdSchema,version:z24.int().positive(),providerId:ProviderIdSchema,modelId:z24.string().min(1).max(160).nullable(),protocol:z24.enum(["QWEN_TTS","QWEN_AUDIO_TTS","OPENAI_TTS","XAI_TTS","GEMINI_INTERACTIONS_TTS","VOLCENGINE_TTS"]),label:z24.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),textMaxCharacters:z24.int().positive().max(6e3),requestTimeoutMs:z24.int().positive().max(3e5),workspaceRequired:z24.boolean(),voices:z24.array(z24.strictObject({id:z24.string().min(1).max(100),label:z24.string().min(1).max(100),languages:z24.array(z24.string().min(2).max(20)).min(1).max(32).optional(),parameterDefaults:SpeechParametersSchema.optional(),parameterOptions:z24.record(z24.string(),z24.array(z24.string().min(1).max(100)).min(1).max(100)).optional(),unsupportedParameters:z24.array(z24.string()).max(24).optional()})).min(1).max(100),languages:z24.array(z24.string().min(2).max(20)).min(1).max(32),parameters:z24.record(z24.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterRuleSchema),sourceUrl:z24.url().max(2048),verifiedAt:z24.iso.date(),providerTextMaxCharacters:z24.int().positive().nullable(),resourceId:z24.string().min(1).max(100).nullable(),output:z24.literal("PCM_S16LE_48000_V1"),normalizationVersion:z24.literal("SPEECH_PCM_V1")});var SpeechScopeSchema=z24.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var SpeechExecutionBindingSchema=z24.strictObject({tenantId:TenantIdSchema,connectionId:z24.uuid(),connectionVersion:z24.int().positive(),credentialRef:z24.uuid(),credentialVersion:z24.int().positive(),profile:SpeechModelProfileSchema,executionClass:z24.enum(["LIVE","TEST_ONLY"])});var SpeechStartSchema=SpeechScopeSchema.extend({soundCue:z24.strictObject({soundPlanVersionId:z24.uuid(),cueId:z24.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}).optional(),expectedProductionRevision:z24.int().positive(),expectedAudioVersion:z24.int().nonnegative(),expectedModelProfileVersion:z24.int().positive(),idempotencyKey:z24.string().trim().min(1).max(200),selection:ProviderSelectionSchema,text:z24.string().min(1).max(6e3).refine(s=>s.trim().length>0&&!s.includes("\0")),voice:z24.string().min(1).max(100),parameters:SpeechParametersSchema.default({})});var SpeechGetSchema=SpeechScopeSchema.extend({generationId:z24.uuid()});var SpeechAdmissionSchema=z24.strictObject({semanticStatus:z24.literal("ACCEPTED"),generationId:z24.uuid(),runtimeJobId:z24.uuid(),productionRevision:z24.int().positive(),executionClass:z24.enum(["LIVE","TEST_ONLY"])});var SpeechGenerationViewSchema=SpeechAdmissionSchema.omit({semanticStatus:true}).extend({tenantId:TenantIdSchema,productionId:ProductionIdSchema,soundCue:SpeechStartSchema.shape.soundCue,text:z24.string().min(1).max(6e3),voice:z24.string().min(1).max(100),parameters:SpeechParametersSchema,profile:SpeechModelProfileSchema,connectionId:z24.uuid(),connectionVersion:z24.int().positive(),runtimeStatus:z24.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z24.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z24.boolean(),result:AudioReceiptSchema.nullable(),createdAt:z24.iso.datetime({offset:true})});var SpeechOptionsSchema=SpeechScopeSchema.extend({options:z24.array(z24.strictObject({selection:ProviderSelectionSchema,profile:SpeechModelProfileSchema,connectionLabel:z24.string().min(1).max(100),connectionVersion:z24.int().positive()})).max(100),possiblyTruncated:z24.boolean()});import{z as z25}from"zod";var KeyframeGenerationIdSchema=z25.uuid().brand();var KeyframeProviderProfileSchema=z25.strictObject({id:z25.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,79}$/),adapterVersion:z25.string().min(1).max(80),model:z25.string().min(1).max(120),executionClass:z25.enum(["LIVE","TEST_ONLY"]),mediaType:z25.literal("IMAGE"),mode:z25.literal("REFERENCE_TO_IMAGE"),referenceRoles:z25.array(ReferenceRoleSchema).min(1).max(6),aspectRatios:z25.array(z25.enum(["16:9","9:16"])).min(1).max(2),maxReferences:z25.int().min(1).max(12),correlationLookup:z25.boolean()});var KeyframeStartInputSchema=z25.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),selection:ProviderSelectionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,idempotencyKey:z25.string().trim().min(1).max(200)});var KeyframeGetInputSchema=z25.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:KeyframeGenerationIdSchema});var KeyframeQueryInputSchema=z25.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeAdmissionSchema=z25.strictObject({semanticStatus:z25.literal("ACCEPTED"),generationId:KeyframeGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z25.enum(["LIVE","TEST_ONLY"])});var KeyframeCandidateSchema=z25.strictObject({id:z25.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z25.enum(["AVAILABLE","INVALID"]),observation:z25.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z25.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z25.boolean(),reviewId:z25.uuid().optional(),reviewVersion:z25.int().positive().optional(),acceptanceDecisionId:z25.uuid().optional(),freshness:z25.enum(["CURRENT_BASIS","STALE_BASIS"]),checksumSha256:ContentFingerprintSchema,contentType:z25.enum(["image/png","image/jpeg","image/webp"]),byteSize:z25.int().positive(),width:z25.int().positive(),height:z25.int().positive()});var KeyframeGenerationViewSchema=z25.strictObject({connection:z25.strictObject({connectionId:z25.uuid(),connectionVersion:z25.int().positive(),modelProfileId:z25.string(),modelProfileVersion:z25.int().positive()}).optional(),generationId:KeyframeGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,operationId:OperationIdSchema,provider:KeyframeProviderProfileSchema,runtimeStatus:z25.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z25.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z25.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z25.boolean(),candidate:KeyframeCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z25.iso.datetime({offset:true})});var KeyframeQueryPageSchema=z25.strictObject({items:z25.array(KeyframeGenerationViewSchema),page:QueryPageInfoSchema});var KeyframeMediaSchema=z25.strictObject({contentType:z25.enum(["image/png","image/jpeg","image/webp"]),checksumSha256:ContentFingerprintSchema,byteSize:z25.int().positive().max(8*1024*1024),contentBase64:z25.string().min(4).max(4*Math.ceil(8*1024*1024/3))});var KeyframeSummarySchema=z25.strictObject({generations:z25.int().nonnegative(),running:z25.int().nonnegative(),waiting:z25.int().nonnegative(),registeredCandidates:z25.int().nonnegative(),testCandidates:z25.int().nonnegative(),liveCandidates:z25.int().nonnegative()});import{z as z26}from"zod";var MatrixParameterRuleSchema=SpeechParameterRuleSchema.extend({numberOptions:z26.array(z26.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"})});import{z as z27}from"zod";var AsrProfileSchema=z27.strictObject({id:ModelProfileIdSchema,version:z27.int().positive(),providerId:ProviderIdSchema,sourceUrl:z27.url().max(2048),verifiedAt:z27.iso.date(),modelId:z27.string().min(1).max(160),label:z27.string().min(1).max(100),protocol:z27.enum(["OPENAI_TRANSCRIPTION_V1","OPENAI_WHISPER_TRANSCRIPTION_V1","QWEN_ASR_V1"]),modes:z27.tuple([z27.literal("TRANSCRIPTION")]),inputKinds:z27.array(z27.enum(["AUDIO","VIDEO"])).min(1).max(2),requestTimeoutMs:z27.int().min(1e3).max(18e4),maxBytes:z27.int().positive().max(12582912),maxDurationMs:z27.int().positive().max(6e4),parameters:z27.record(z27.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:z27.literal(1),text:z27.string().max(6e4),languages:z27.array(z27.string().min(2).max(40)).max(32)};var TimedText=z27.strictObject({text:z27.string().min(1).max(2500),startMs:z27.int().nonnegative().max(6e4),endMs:z27.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Transcript interval must advance");var TranscriptSchema=z27.discriminatedUnion("timing",[z27.strictObject({...TranscriptText,timing:z27.literal("UNAVAILABLE")}),z27.strictObject({...TranscriptText,timing:z27.literal("PROVIDER_REPORTED"),timeBase:z27.literal("ORIGINAL_MEDIA_MS"),granularities:z27.array(z27.enum(["word","segment"])).min(1).max(2),words:z27.array(TimedText).max(1200),segments:z27.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"})}})]);import{z as z28}from"zod";var ObservationModeSchema=z28.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES","TRANSCRIPTION"]);var ObservationParametersSchema=SpeechParametersSchema;var VisualObservationProfileSchema=z28.strictObject({id:ModelProfileIdSchema,version:z28.int().positive(),providerId:ProviderIdSchema,sourceUrl:z28.url().max(2048),modelId:z28.string().min(1).max(160),label:z28.string().min(1).max(100),protocol:z28.enum(["GEMINI_INTERACTIONS_V1","QIANWEN_VIDEO_V1"]),modes:z28.array(z28.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES"])).min(1).max(4),requestTimeoutMs:z28.int().min(1e3).max(18e4),maxBytes:z28.int().positive().max(12582912),maxDurationMs:z28.int().positive().max(6e4),parameters:z28.record(z28.string(),z28.strictObject({type:z28.enum(["NUMBER","INTEGER","BOOLEAN","STRING"]),min:z28.number().optional(),max:z28.number().optional(),options:z28.array(z28.string()).max(20).optional(),default:z28.union([z28.number().finite(),z28.boolean(),z28.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=z28.union([VisualObservationProfileSchema,AsrProfileSchema]);import{z as z29}from"zod";var ProviderTenantInputSchema=z29.strictObject({tenantId:TenantIdSchema});var ImageModelProfileSchema=z29.strictObject({referenceRoles:z29.array(ReferenceRoleSchema.exclude(["START_FRAME_ANCHOR","END_FRAME_ANCHOR"])).min(1).max(6).optional(),id:ModelProfileIdSchema,version:z29.int().positive(),providerId:ProviderIdSchema,modelId:z29.string().min(1).max(160),protocol:z29.enum(["QWEN_EDIT","ARK_IMAGE","GEMINI_IMAGE","OPENAI_IMAGE","XAI_IMAGE"]),maxReferences:z29.int().positive(),promptMaxUtf8Bytes:z29.int().positive(),requestTimeoutMs:z29.int().positive(),workingWidth:z29.int().nonnegative(),workingHeight:z29.int().nonnegative()});var VideoModelProfileSchema=z29.strictObject({id:ModelProfileIdSchema,version:z29.int().positive(),providerId:ProviderIdSchema,modelId:z29.string().min(1).max(160),protocol:z29.enum(["QWEN_VIDEO","VOLCENGINE_VIDEO"]),requestTimeoutMs:z29.int().positive(),promptMaxCharacters:z29.int().positive(),resolution:z29.enum(["720P","1080P"]),adapterVersion:z29.string().min(1).max(80),capabilities:VideoProviderProfileSchema.omit({id:true,adapterVersion:true,model:true,executionClass:true})});var ProviderDefaultViewSchema=z29.strictObject({selection:ProviderSelectionSchema,revision:z29.int().positive()});var scan=z29.strictObject({limit:z29.literal(100),possiblyTruncated:z29.boolean()});var ProviderConnectionPageSchema=scan.extend({items:z29.array(ProviderConnectionViewSchema).max(100)});var ProviderModelsViewSchema=z29.strictObject({catalog:z29.array(ImageModelProfileSchema).max(100),videoCatalog:z29.array(VideoModelProfileSchema).max(100),speechCatalog:z29.array(SpeechModelProfileSchema).max(100).default([]),observationCatalog:z29.array(ObservationProfileSchema).max(100).default([]),available:z29.array(z29.strictObject({selection:ProviderSelectionSchema,profile:KeyframeProviderProfileSchema})).max(1600),defaultSelection:ProviderDefaultViewSchema.nullable(),connectionScan:scan});import{z as z30}from"zod";var key2=z30.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,99}$/);var value=z30.union([z30.string().max(160),z30.number().finite(),z30.boolean()]);var ModelAudioCapabilitySchema=z30.enum(["SYNCHRONIZED_AUDIO","SPEECH_GENERATION","SPEECH_RECOGNITION","TRANSCRIPT_TIMESTAMPS","VOICE_REFERENCE","AUDIO_REFERENCE","AUDIO_DRIVEN_VIDEO","LIP_SYNCHRONIZATION","AUDIO_EDITING","SEPARATE_STEMS"]);var ModelCapabilityMatrixSchema=z30.strictObject({schemaVersion:z30.literal(1),service:key2,lifecycle:z30.enum(["ACTIVE","DEPRECATED","RETIRED"]),sources:z30.array(z30.strictObject({url:z30.url().max(2048),checkedAt:z30.iso.date()})).min(1).max(8),modes:z30.array(key2).min(1).max(16),claims:z30.array(z30.strictObject({capability:ModelAudioCapabilitySchema,modes:z30.array(key2).min(1).max(16),support:z30.enum(["SUPPORTED","UNSUPPORTED","UNKNOWN"]),control:z30.enum(["PARAMETER","PROMPT","ALWAYS_ON","MEDIA_INPUT","NONE"]),parameterPath:key2.optional(),access:z30.enum(["PUBLIC","QUALIFIED_ACCOUNT"]).default("PUBLIC"),description:z30.string().max(600).optional()})).max(64),parameters:z30.record(key2,MatrixParameterRuleSchema),constraints:z30.array(z30.strictObject({modes:z30.array(key2).min(1).max(16),when:z30.strictObject({parameter:key2,equals:value}).optional(),require:z30.array(key2).max(16).default([]),forbid:z30.array(key2).max(16).default([]),requireValues:z30.record(key2,value).default({}),reason:z30.string().min(1).max(300)})).max(32),references:z30.array(z30.strictObject({kind:z30.enum(["VOICE_ID","AUDIO_REFERENCE","DRIVING_AUDIO"]),modes:z30.array(key2).min(1).max(16),parameterPath:key2,maxItems:z30.int().min(1).max(10),minDurationMs:z30.int().positive().optional(),maxDurationMs:z30.int().positive().max(6e4).optional(),maxTotalDurationMs:z30.int().positive().max(6e4).optional(),maxBytes:z30.int().positive().max(67108864).optional(),formats:z30.array(z30.enum(["WAV","MP3"])).max(2),requiresVisual:z30.boolean(),access:z30.enum(["PUBLIC","QUALIFIED_ACCOUNT"])})).max(16),outputAudioChannels:z30.union([z30.literal(1),z30.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 z31}from"zod";var cost={costPolicy:GenerationCostPolicySchema.optional()};var matrix={matrix:ModelCapabilityMatrixSchema.optional()};var ProviderModelDefinitionSchema=z31.discriminatedUnion("family",[z31.strictObject({family:z31.literal("IMAGE"),profile:ImageModelProfileSchema,...matrix,...cost}),z31.strictObject({family:z31.literal("VIDEO"),profile:VideoModelProfileSchema,...matrix,...cost}),z31.strictObject({family:z31.literal("SPEECH"),profile:SpeechModelProfileSchema,...matrix}),z31.strictObject({family:z31.literal("OBSERVATION"),profile:ObservationProfileSchema,...matrix}),z31.strictObject({family:z31.literal("DECLARED"),profile:z31.strictObject({id:ModelProfileIdSchema,version:z31.int().positive(),providerId:ProviderIdSchema,modelId:z31.string().min(1).max(160),protocol:z31.literal("DOCUMENTED_ONLY")}),matrix:ModelCapabilityMatrixSchema})]);var ProviderModelViewSchema=z31.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z31.int().positive(),enabled:z31.boolean(),definition:ProviderModelDefinitionSchema}).refine(v=>v.id===v.definition.profile.id&&v.version===v.definition.profile.version,{message:"Model version identity mismatch"});var ConfigureProviderModelSchema=z31.strictObject({tenantId:TenantIdSchema,expectedVersion:z31.int().nonnegative(),definition:ProviderModelDefinitionSchema}).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=z31.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,expectedVersion:z31.int().positive()});var ProviderModelPageSchema=z31.strictObject({items:z31.array(ProviderModelViewSchema).max(100),possiblyTruncated:z31.boolean()});var ProviderModelGetSchema=z31.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z31.int().positive().optional()});import{z as z32}from"zod";var id4=z32.uuid().toLowerCase();var SoundPlanScopeSchema=z32.strictObject({tenantId:id4,productionId:id4});var SoundPlanBasisSchema=z32.strictObject({briefVersionId:id4,briefVersion:z32.int().positive(),storyVersionId:id4,storyVersion:z32.int().positive(),planVersionId:id4,planVersion:z32.int().positive()});var SoundPlanModelSchema=z32.strictObject({modelProfileId:z32.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z32.int().positive(),connectionId:id4});var SoundMakingPlanContentSchema=z32.strictObject({visuals:z32.array(z32.strictObject({shotId:id4,method:z32.enum(["CODE","GENERATED","IMPORTED"]),model:SoundPlanModelSchema.optional(),nativeAudio:z32.boolean().optional(),sourceSound:SourceSoundTreatmentSchema,rationale:z32.string().trim().min(1).max(600)})).min(1).max(200),cues:z32.array(z32.strictObject({id:z32.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z32.enum(["NARRATION","DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT"]),source:z32.enum(["TTS","NATIVE_VIDEO","IMPORTED_AUDIO","EXISTING_AUDIO"]),shotIds:z32.array(id4).min(1).max(200),startMs:z32.int().min(0).max(6e4),endMs:z32.int().positive().max(6e4),text:z32.string().trim().min(1).max(6e3).optional(),voice:z32.string().min(1).max(100).optional(),model:SoundPlanModelSchema.optional(),parameters:SpeechParametersSchema.optional(),audio:z32.strictObject({purpose:z32.enum(["VOICEOVER","MUSIC"]),versionId:z32.uuid()}).optional(),lipSync:z32.enum(["REQUIRED","NONE"]),exactSpeech:z32.boolean()})).max(64),unknowns:z32.array(z32.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||!["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.parameters)||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:id4,soundPlanId:id4,projectId:id4,version:z32.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema,createdByPrincipalId:id4,createdAt:z32.iso.datetime({offset:true})});var SoundPlanValidateSchema=SoundPlanScopeSchema.extend({expectedProductionRevision:z32.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema});var SoundPlanAcceptSchema=SoundPlanValidateSchema.extend({expectedVersion:z32.int().nonnegative(),idempotencyKey:z32.string().trim().min(1).max(200)});var SoundPlanGetSchema=SoundPlanScopeSchema.extend({versionId:id4.optional()});var SoundPlanDiagnosticSchema=z32.strictObject({severity:z32.enum(["ERROR","WARNING"]),code:z32.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),shotId:id4.optional(),cueId:z32.string().max(64).optional(),message:z32.string().max(500)});var SoundPlanValidationSchema=z32.strictObject({executable:z32.boolean(),diagnostics:z32.array(SoundPlanDiagnosticSchema).max(256),semantics:z32.literal("PLAN_VALIDATION_NOT_CREATIVE_OR_LISTENING_APPROVAL")});var SoundPlanViewSchema=z32.strictObject({version:SoundPlanVersionSchema,current:z32.boolean(),freshness:z32.enum(["CURRENT_BASIS","STALE_BASIS"])});var SoundPlanReceiptSchema=z32.strictObject({semanticStatus:z32.literal("SUCCESS"),version:SoundPlanVersionSchema,productionRevision:z32.int().positive()});var SoundPlanContextSchema=SoundPlanScopeSchema.extend({projectId:id4,productionRevision:z32.int().positive(),runnable:z32.boolean(),basis:SoundPlanBasisSchema.nullable(),targetDurationMs:z32.int().positive().nullable(),shots:z32.array(z32.strictObject({shotId:id4,durationMs:z32.int().positive()})).max(200),currentVersion:z32.int().nonnegative(),currentVersionId:id4.nullable(),capabilities:z32.strictObject({models:z32.array(ProviderModelViewSchema).max(100),video:z32.array(z32.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600),speech:SpeechOptionsSchema.shape.options,audio:z32.array(AudioViewSchema).max(64)})});import{z as z35}from"zod";import{z as z34}from"zod";import{z as z33}from"zod";var id5=z33.uuid().toLowerCase();var hash3=z33.string().regex(/^[0-9a-f]{64}$/);var ImportedSynchronousAudioPurposeSchema=z33.literal("SOURCE_SYNC");var SourceSyncPcmMediaSchema=z33.strictObject({profile:z33.literal("PCM_S16LE_48000_SOURCE_SYNC_V1"),audioCodec:z33.literal("pcm_s16le"),sampleRateHz:z33.literal(48e3),audioChannels:z33.union([z33.literal(1),z33.literal(2)]),sampleCount:z33.int().min(1600).max(576e3),durationMs:z33.number().positive().max(12e3)}).refine(m=>m.sampleCount%1600===0&&m.durationMs===m.sampleCount/48);var ImportedSynchronousAudioExtractionSchema=z33.strictObject({schemaVersion:z33.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id5,projectId:id5,productionId:id5,shotId:id5,sourceId:id5,sourceVersionId:id5,normalizationId:id5,originalArtifactId:id5,originalRepresentationId:id5,originalChecksumSha256:hash3,sourceRange:z33.strictObject({clock:z33.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z33.int().nonnegative().max(1799),endFrame:z33.int().positive().max(1800)}),destinationStartSample:z33.literal(0)}).refine(v=>v.sourceRange.endFrame>v.sourceRange.startFrame&&v.sourceRange.endFrame-v.sourceRange.startFrame<=360);var ImportedSynchronousAudioSourceSchema=z33.strictObject({schemaVersion:z33.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id5,projectId:id5,productionId:id5,shotId:id5,sourceId:id5,sourceVersionId:id5,normalizationId:id5,originalArtifactId:id5,originalRepresentationId:id5,originalChecksumSha256:hash3,sourceRange:z33.strictObject({clock:z33.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z33.int().nonnegative(),endFrame:z33.int().positive()}),destinationStartSample:z33.int().nonnegative(),media:z33.union([AudioMediaSchema,SourceSyncPcmMediaSchema]),wavChecksumSha256:hash3,wavByteSize:z33.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 id6=z34.uuid().toLowerCase();var key3=z34.string().trim().min(1).max(200);var SourceSyncAudioStartSchema=z34.strictObject({tenantId:id6,productionId:id6,normalizationId:id6,expectedProductionRevision:z34.int().positive(),expectedVersion:z34.int().nonnegative(),idempotencyKey:key3});var SourceSyncAudioGetSchema=z34.strictObject({tenantId:id6,productionId:id6,shotId:id6,versionId:id6});var SourceSyncAudioVersionSchema=z34.strictObject({schemaVersion:z34.literal(1),purpose:z34.literal("SOURCE_SYNC"),id:id6,audioId:id6,version:z34.int().positive(),tenantId:id6,projectId:id6,productionId:id6,shotId:id6,normalizationId:id6,artifactId:id6,representationId:id6,provenance:ImportedSynchronousAudioSourceSchema,previousVersionId:id6.nullable(),executionClass:z34.enum(["LIVE","TEST_ONLY"]),createdByPrincipalId:id6,createdAt:z34.iso.datetime({offset:true})});var SourceSyncAudioReceiptSchema=z34.strictObject({semanticStatus:z34.literal("SUCCESS"),version:SourceSyncAudioVersionSchema,productionRevision:z34.int().positive()});var SourceSyncAudioViewSchema=z34.strictObject({version:SourceSyncAudioVersionSchema,status:z34.enum(["CURRENT","STALE"]),availability:z34.enum(["AVAILABLE","UNAVAILABLE"])});var TimelineSourceSoundInputSchema=z35.strictObject({duckingMusicPermille:z35.int().nonnegative().max(1e3).optional(),soundPlanVersionId:z35.uuid(),clips:z35.array(z35.strictObject({ordinal:z35.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,importedAudioVersionId:z35.uuid().optional()})).min(1).max(200),speechCues:z35.array(z35.strictObject({cueId:z35.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),audioVersionId:z35.uuid()})).max(64)});var TimelineSourceSoundSourceSchema=z35.discriminatedUnion("kind",[z35.strictObject({kind:z35.literal("NATIVE_GENERATED"),version:NativeVideoSoundReferenceSchema}),z35.strictObject({kind:z35.literal("IMPORTED_SYNC"),version:SourceSyncAudioVersionSchema})]);var TimelineSourceSoundCompositionSchema=z35.strictObject({schemaVersion:z35.literal(1),soundPlanVersionId:z35.uuid(),soundPlanFingerprint:z35.string().regex(/^[0-9a-f]{64}$/),plannedCues:SoundMakingPlanContentSchema.shape.cues,mix:AudioMixProfileSchema,clips:z35.array(z35.strictObject({ordinal:z35.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,source:TimelineSourceSoundSourceSchema.optional(),sourceInSample:z35.int().nonnegative().max(288e4),sourceOutSample:z35.int().nonnegative().max(288e4),startSample:z35.int().nonnegative().max(288e4),outputSampleCount:z35.int().positive().max(288e4)})).min(1).max(200),speechCues:z35.array(z35.strictObject({cueId:z35.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),source:AudioVersionSchema,sourceInMs:z35.literal(0),sourceOutMs:z35.int().positive().max(6e4),startMs:z35.int().nonnegative().max(6e4),gainPermille:z35.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"})});import{z as z36}from"zod";var TimelineV2ClipSchema=TimelineManifestSchema.shape.clips.element.extend({source:AcceptedVisualSourceReferenceSchema});var TimelineV2ManifestSchema=TimelineManifestSchema.extend({schemaVersion:z36.literal(2),clips:z36.array(TimelineV2ClipSchema).min(1).max(200),sourceSound:TimelineSourceSoundCompositionSchema.optional()});var TimelineV2VersionSchema=TimelineV2ManifestSchema.extend(TimelineVersionIdentityShape).superRefine(validateTimelineAttachments);import{z as z37}from"zod";var sha4=z37.string().regex(/^[0-9a-f]{64}$/);var VisualFrameSequenceSchema=z37.strictObject({schemaVersion:z37.literal(1),profileId:z37.literal("RGBA_PNG_SEQUENCE_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,width:z37.int().min(1).max(1920),height:z37.int().min(1).max(1920),frameRate:z37.literal(30),frameCount:z37.int().min(1).max(360),alpha:z37.literal("STRAIGHT_RGBA"),frames:z37.array(z37.strictObject({ordinal:z37.int().min(0).max(359),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,byteSize:z37.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=z37.strictObject({xPermille:z37.int().min(0).max(1e3),yPermille:z37.int().min(0).max(1e3),widthPermille:z37.int().min(1).max(1e3),heightPermille:z37.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=z37.strictObject({id:z37.uuid(),source:VisualFrameSequenceSchema,sourceInFrame:z37.int().min(0).max(359),sourceOutFrame:z37.int().min(1).max(360),startFrame:z37.int().min(0).max(1799),zIndex:z37.int().min(0).max(7),opacityPermille:z37.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=z37.strictObject({schemaVersion:z37.literal(1),profileId:z37.literal("STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,totalFrames:z37.int().min(1).max(1800),layers:z37.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 source=layer.source;const body=JSON.stringify(source);for(const frame of source.frames){const identity=JSON.stringify({artifactId:frame.artifactId,checksumSha256:frame.checksumSha256,byteSize:frame.byteSize,width:source.width,height:source.height});if(frames.has(frame.representationId)&&frames.get(frame.representationId)!==identity)context.addIssue({code:"custom",message:"Shared frame representation has inconsistent facts"});frames.set(frame.representationId,identity)}if(source.tenantId!==v.tenantId||source.projectId!==v.projectId||source.productionId!==null&&source.productionId!==v.productionId||layer.startFrame+layer.sourceOutFrame-layer.sourceInFrame>v.totalFrames||sources.has(source.representationId)&&sources.get(source.representationId)!==body)context.addIssue({code:"custom",message:"Layer source scope/identity/output bounds mismatch"});if(!sources.has(source.representationId))bytes+=source.frames.reduce((n,f)=>n+f.byteSize,0);sources.set(source.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"})});import{z as z38}from"zod";var TimelineVisualLayerInputSchema=z38.strictObject({id:z38.uuid(),artifactId:ArtifactIdSchema,sourceInFrame:z38.int().min(0).max(359),sourceOutFrame:z38.int().min(1).max(360),startFrame:z38.int().min(0).max(1799),zIndex:z38.int().min(0).max(7),opacityPermille:z38.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:z38.literal(3),visualLayers:VisualLayerCompositionSchema});var TimelineV3VersionSchema=TimelineV3ManifestSchema.extend(TimelineVersionIdentityShape).superRefine((timeline,context)=>{validateTimelineAttachments(timeline,context);validateTimelineVisualLayerClock(timeline,context)});function validateTimelineVisualLayerClock(timeline,context){const composition=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&&composition.tenantId!==timeline.tenantId||timeline.projectId!==void 0&&composition.projectId!==timeline.projectId||timeline.productionId!==void 0&&composition.productionId!==timeline.productionId||composition.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 z39}from"zod";var FinalRenderProfileIdSchema=z39.enum(["FINAL_H264_720P_V1","FINAL_H264_1080P_V1","FINAL_H264_480P_V1"]);var FinalRenderProfileSchema=z39.strictObject({id:FinalRenderProfileIdSchema,algorithm:z39.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z39.union([z39.literal(1280),z39.literal(720),z39.literal(1920),z39.literal(1080),z39.literal(854),z39.literal(480)]),height:z39.union([z39.literal(1280),z39.literal(720),z39.literal(1920),z39.literal(1080),z39.literal(854),z39.literal(480)]),frameRate:z39.literal(30),codec:z39.literal("h264"),pixelFormat:z39.literal("yuv420p"),fit:z39.literal("PAD"),hasAudio:z39.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z39.literal("CUMULATIVE_NEAREST_FRAME"),encoder:z39.literal("libx264"),crf:z39.literal(18),preset:z39.literal("veryfast"),gopFrames:z39.literal(30),bFrames:z39.literal(0),audioPolicy:z39.enum(["SILENT","MIXED"]),captionPolicy:z39.enum(["NONE","BURN_IN"]),sourceQualityPolicy:z39.literal("NO_UPSCALE_V1"),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z39.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"})});import{z as z40}from"zod";var dynamicPolicy=z40.literal("STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1");var VisualLayerPreviewProfileSchema=RoughCutProfileSchema.safeExtend({visualLayerPolicy:dynamicPolicy});var VisualLayerFinalProfileSchema=FinalRenderProfileSchema.safeExtend({visualLayerPolicy:dynamicPolicy,visualLayerSourceQualityPolicy:z40.literal("NO_UPSCALE_V1")});var shape={schemaVersion:z40.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=z40.union([VisualLayerPreviewManifestSchema,VisualLayerFinalManifestSchema]);import{z as z41}from"zod";var DeviceRenderTargetSchema=z41.strictObject({mode:z41.literal("tenant-device-only"),deviceId:z41.uuid().optional()});var DeviceRenderReceiptSchema=z41.strictObject({mode:z41.literal("tenant-device-only"),deviceId:z41.uuid(),runtimeJobId:z41.uuid()});import{z as z42}from"zod";var TimelineVersionReaderSchema=z42.discriminatedUnion("schemaVersion",[TimelineVersionSchema,TimelineV2VersionSchema,TimelineV3VersionSchema]);var TimelineManifestReaderSchema=z42.discriminatedUnion("schemaVersion",[TimelineManifestSchema,TimelineV2ManifestSchema,TimelineV3ManifestSchema.superRefine(validateTimelineVisualLayerClock)]);import{z as z43}from"zod";var TimelineScopeSchema=z43.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var TimelineClipInputSchema=z43.strictObject({shotId:ShotIdSchema,acceptanceId:z43.uuid(),framing:ClipFramingSchema.optional(),transition:ClipTransitionSchema.optional(),sourceInMs:z43.int().nonnegative().max(30150),sourceOutMs:z43.int().positive().max(30150)}).refine(v=>v.sourceOutMs>v.sourceInMs,"Clip source range must advance");var BuildTimelineShapeSchema=TimelineScopeSchema.extend({schemaVersion:z43.union([z43.literal(2),z43.literal(3)]).optional(),expectedProductionRevision:z43.int().positive(),expectedTimelineVersion:z43.int().nonnegative(),idempotencyKey:z43.string().trim().min(1).max(200),clips:z43.array(TimelineClipInputSchema).min(1).max(200),captionVersionId:z43.uuid().optional(),audio:TimelineAudioInputSchema.optional(),sourceSound:TimelineSourceSoundInputSchema.optional(),graphics:z43.array(TimelineGraphicInputSchema).max(8).optional(),visualLayers:z43.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=z43.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=z43.strictObject({version:TimelineVersionReaderSchema,isCurrent:z43.boolean(),freshness:z43.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z43.array(TimelineStaleReasonSchema).max(13),assemblyStatus:z43.enum(["DRAFT","ASSEMBLY_READY"])});var TimelineGetSchema=TimelineScopeSchema.extend({versionId:z43.uuid()});var TimelineQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var TimelinePageSchema=z43.strictObject({items:z43.array(TimelineViewSchema),page:QueryPageInfoSchema});var TimelineBuildReceiptSchema=z43.strictObject({semanticStatus:z43.literal("SUCCESS"),version:TimelineVersionReaderSchema,productionRevision:z43.int().positive()});var TimelineBasisSchema=TimelineScopeSchema.extend({productionRevision:z43.int().positive(),currentTimelineVersion:z43.int().nonnegative(),runnable:z43.boolean(),planningReady:z43.boolean(),output:TimelineManifestSchema.shape.output.nullable(),targetDurationMs:z43.int().positive().nullable(),shots:z43.array(z43.strictObject({shotId:ShotIdSchema,ordinal:z43.int().positive(),acceptanceStatus:z43.enum(["NONE","CURRENT","STALE"]),source:AcceptedVisualSourceReferenceSchema.nullable(),technical:VideoTechnicalMetadataSchema.nullable()})).max(200)});var TimelineSnapshotSchema=z43.strictObject({currentVersion:z43.int().positive().nullable(),stale:z43.boolean(),timelineId:z43.uuid().nullable(),versionId:z43.uuid().nullable(),assemblyStatus:z43.enum(["DRAFT","ASSEMBLY_READY"]).nullable(),totalDurationMs:z43.int().positive().nullable(),durationClassification:TimelineDurationSchema.shape.classification.nullable(),missingPlannedShots:z43.int().nonnegative(),staleReasons:z43.array(TimelineStaleReasonSchema).max(13)});import{z as z44}from"zod";var sha5=z44.string().regex(/^[0-9a-f]{64}$/);var RoughCutStartSchema=TimelineScopeSchema.extend({deviceExecution:DeviceRenderTargetSchema.optional(),timelineVersionId:z44.uuid(),timelineFingerprint:sha5,expectedProductionRevision:z44.int().positive(),profileId:RoughCutProfileIdSchema,idempotencyKey:z44.string().trim().min(1).max(200)});var RoughCutGetSchema=TimelineScopeSchema.extend({renderId:z44.uuid()});var RoughCutQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutV2ManifestSchema=RoughCutManifestSchema.extend({schemaVersion:z44.literal(2),timeline:TimelineV2VersionSchema});var RoughCutManifestReaderSchema=z44.discriminatedUnion("schemaVersion",[RoughCutManifestSchema,RoughCutV2ManifestSchema,VisualLayerPreviewManifestSchema]);var RoughCutTechnicalSchema=VideoTechnicalMetadataSchema.extend({hasAudio:z44.boolean(),audio:RenderedAudioSchema.optional(),durationMs:z44.int().min(29983).max(60017),frameRate:z44.literal(30),frameCount:z44.int().min(900).max(1800),engineVersion:z44.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:z44.uuid(),representationId:z44.uuid(),version:z44.int().positive(),poster:VideoPosterSchema,availability:z44.enum(["AVAILABLE","INVALID"]),reviewState:z44.enum(["UNREVIEWED","PASS","WARNING","FAIL"])});var RoughCutAdmissionSchema=z44.strictObject({deviceExecution:DeviceRenderReceiptSchema.optional(),semanticStatus:z44.literal("ACCEPTED"),renderId:z44.uuid(),operationId:OperationIdSchema,productionId:z44.uuid(),timelineVersionId:z44.uuid(),timelineFingerprint:sha5,executionClass:z44.enum(["LIVE","TEST_ONLY"]),manifestFingerprint:sha5,productionRevision:z44.int().positive()});var RoughCutViewSchema=TimelineScopeSchema.extend({renderId:z44.uuid(),projectId:ProjectIdSchema,runtimeJobId:z44.uuid(),operationId:OperationIdSchema,manifest:RoughCutManifestReaderSchema,manifestFingerprint:sha5,runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus,cancellationRequested:z44.boolean(),isCurrentTimeline:z44.boolean(),freshness:z44.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z44.array(z44.string().min(1).max(120)).max(16),executionClass:z44.enum(["LIVE","TEST_ONLY"]),roughCut:RoughCutArtifactSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z44.iso.datetime({offset:true})});var RoughCutPageSchema=z44.strictObject({items:z44.array(RoughCutViewSchema),page:QueryPageInfoSchema});var RoughCutSnapshotSchema=z44.strictObject({latestVersion:z44.int().positive().nullable(),reviewState:z44.enum(["UNREVIEWED","PASS","WARNING","FAIL"]).nullable(),latestRenderId:z44.uuid().nullable(),runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z44.uuid().nullable(),currentArtifactId:z44.uuid().nullable(),currentTimelineVersionId:z44.uuid().nullable(),stale:z44.boolean()});import{z as z45}from"zod";var sha6=z45.string().regex(/^[0-9a-f]{64}$/);var DeliveryPolicySchema=z45.strictObject({schemaVersion:z45.literal(1),requiredAudio:z45.boolean(),requiredCaptions:z45.boolean(),requiredGraphics:z45.boolean(),finalApproval:z45.enum(["AUTOMATIC","HUMAN"])});var DeliveryPolicyInputSchema=DeliveryPolicySchema.extend({requiredAudio:z45.boolean().default(false),requiredCaptions:z45.boolean().default(false),requiredGraphics:z45.boolean().default(false),finalApproval:z45.enum(["AUTOMATIC","HUMAN"]).default("AUTOMATIC")});var DeliveryCompositionSchema=z45.strictObject({hasAudio:z45.boolean(),hasCaptions:z45.boolean(),hasGraphics:z45.boolean()});var DeliveryTargetSchema=z45.strictObject({tenantId:z45.uuid(),projectId:z45.uuid(),productionId:z45.uuid(),renderId:z45.uuid(),timelineVersionId:z45.uuid(),timelineFingerprint:sha6,selectionId:z45.uuid(),selectionVersion:z45.int().positive(),renderManifestFingerprint:sha6,artifactId:z45.uuid(),representationId:z45.uuid(),checksumSha256:sha6,byteSize:z45.int().positive().max(128*1024*1024),executionClass:z45.enum(["LIVE","TEST_ONLY"])});var DeliveryCheckKeySchema=z45.enum(["FILE_READABLE","CHECKSUM","CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","REQUIRED_AUDIO","REQUIRED_CAPTIONS","REQUIRED_GRAPHICS","MISSING_MEDIA","BLACK_FRAMES","ARTIFACT_REGISTRATION","PROVENANCE","MANIFEST_INTEGRITY","EXACT_BASIS","BLOCKING_FINDINGS"]);var DeliveryCheckSchema=z45.strictObject({key:DeliveryCheckKeySchema,status:z45.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"]),detail:z45.string().trim().min(1).max(1e3)});var DeliveryValidationReviewSchema=z45.strictObject({id:z45.uuid(),target:DeliveryTargetSchema,policy:DeliveryPolicySchema,policyFingerprint:sha6,composition:DeliveryCompositionSchema,checks:z45.array(DeliveryCheckSchema).length(DeliveryCheckKeySchema.options.length),result:z45.enum(["PASS","FAIL"]),blockingChecks:z45.array(DeliveryCheckKeySchema).max(DeliveryCheckKeySchema.options.length),createdAt:z45.iso.datetime({offset:true})}).superRefine((review2,ctx)=>{const seen=new Set;const blocked=new Set;const{policy,composition}=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"&&!composition.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&&!composition.hasAudio)blocked.add("REQUIRED_AUDIO");if(policy.requiredCaptions&&!composition.hasCaptions)blocked.add("REQUIRED_CAPTIONS");if(policy.requiredGraphics&&!composition.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"})});import{z as z46}from"zod";var sha7=z46.string().regex(/^[0-9a-f]{64}$/);function sameTarget(a,b){return Object.keys(DeliveryTargetSchema.shape).every(key4=>a[key4]===b[key4])}var DeliveryApprovalSchema=z46.strictObject({id:z46.uuid(),reviewId:z46.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha7,authority:z46.literal("HUMAN"),action:z46.enum(["APPROVE","REJECT"]),principalId:z46.uuid(),createdAt:z46.iso.datetime({offset:true})});var DeliveryManifestLinkSchema=z46.strictObject({id:z46.uuid(),checksumSha256:sha7,target:DeliveryTargetSchema,policyFingerprint:sha7,reviewId:z46.uuid()});var FinalDeliveryReceiptSchema=z46.strictObject({id:z46.uuid(),deliveryRole:z46.literal("FINAL_ARTIFACT"),review:DeliveryValidationReviewSchema,manifest:DeliveryManifestLinkSchema,approval:DeliveryApprovalSchema.nullable(),productionRevision:z46.int().positive(),completedAt:z46.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 z47}from"zod";var sha8=z47.string().regex(/^[0-9a-f]{64}$/);var DecideFinalReadySchema=TimelineScopeSchema.extend({renderId:z47.uuid(),reviewId:z47.uuid(),basisFingerprint:sha8,action:z47.enum(["SELECT","REJECT"]),acknowledgeWarnings:z47.boolean().default(false),expectedProductionRevision:z47.int().positive(),expectedFinalReadyVersion:z47.int().nonnegative(),reason:z47.string().trim().min(1).max(2500),idempotencyKey:z47.string().trim().min(1).max(200)});var RevokeFinalReadySchema=TimelineScopeSchema.extend({selectionId:z47.uuid(),expectedFinalReadyVersion:z47.int().positive(),expectedProductionRevision:z47.int().positive(),reason:z47.string().trim().min(1).max(2500),idempotencyKey:z47.string().trim().min(1).max(200)});var FinalReadyDecisionSchema=TimelineScopeSchema.extend({id:z47.uuid(),projectId:ProjectIdSchema,version:z47.int().positive(),action:z47.enum(["SELECT","REJECT","REVOKE"]),renderId:z47.uuid(),reviewId:z47.uuid(),basisFingerprint:sha8,timelineVersionId:z47.uuid(),timelineFingerprint:sha8,artifactId:z47.uuid(),representationId:z47.uuid(),checksumSha256:sha8,outputProfile:DeliveryOutputProfileSchema,executionClass:z47.enum(["LIVE","TEST_ONLY"]),previousSelectionId:z47.uuid().nullable(),acknowledgeWarnings:z47.boolean(),warningKeys:z47.array(z47.string()).max(300),reason:z47.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z47.iso.datetime({offset:true})});var FinalReadyViewSchema=TimelineScopeSchema.extend({version:z47.int().nonnegative(),status:z47.enum(["NONE","CURRENT","STALE"]),selection:FinalReadyDecisionSchema.nullable(),staleReasons:z47.array(z47.string()).max(24)});var FinalReadyQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var FinalReadyPageSchema=z47.strictObject({items:z47.array(FinalReadyDecisionSchema),page:QueryPageInfoSchema});var FinalReadyReceiptSchema=z47.strictObject({semanticStatus:z47.literal("SUCCESS"),decision:FinalReadyDecisionSchema,productionRevision:z47.int().positive()});var RoughCutReviewSnapshotSchema=z47.strictObject({currentRenderId:z47.uuid().nullable(),latestReviewId:z47.uuid().nullable(),reviewVersion:z47.int().nonnegative(),result:z47.enum(["PASS","WARNING","FAIL"]).nullable(),current:z47.boolean(),inspectable:z47.boolean(),executionClass:z47.enum(["LIVE","TEST_ONLY"]).nullable(),findings:z47.strictObject({open:z47.int().nonnegative(),blocking:z47.int().nonnegative(),warnings:z47.int().nonnegative()}),finalReady:FinalReadyViewSchema,latestDecision:FinalReadyDecisionSchema.nullable()});import{z as z48}from"zod";var sha9=z48.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:z48.uuid(),expectedFinalReadyVersion:z48.int().positive(),timelineVersionId:z48.uuid(),timelineFingerprint:sha9,expectedProductionRevision:z48.int().positive(),profileId:FinalRenderProfileIdSchema,audioPolicy:z48.enum(["SILENT","MIXED"]),captionPolicy:z48.enum(["NONE","BURN_IN"]),idempotencyKey:z48.string().trim().min(1).max(200)});var FinalRenderGetSchema=RoughCutGetSchema;var FinalRenderQuerySchema=RoughCutQuerySchema;var finalManifestShape={selection:FinalReadyDecisionSchema.refine(v=>v.action==="SELECT"),selectionVersion:z48.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=z48.discriminatedUnion("schemaVersion",[FinalRenderManifestSchema,FinalRenderV2ManifestSchema,FinalRenderV3ManifestSchema]);var FinalRenderTechnicalSchema=RoughCutTechnicalSchema;var FinalRenderArtifactSchema=RoughCutArtifactSchema.safeExtend({reviewState:z48.literal("UNREVIEWED"),deliveryRole:z48.literal("NONE")});var FinalRenderAdmissionSchema=RoughCutAdmissionSchema.extend({selectionId:z48.uuid(),selectionVersion:z48.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:z48.array(z48.string().min(1).max(120)).max(24)});var FinalRenderPageSchema=z48.strictObject({items:z48.array(FinalRenderViewSchema).max(200),page:QueryPageInfoSchema});var FinalRenderSourceBlockerSchema=z48.strictObject({code:z48.enum(["SOURCE_RESOLUTION_INSUFFICIENT","SOURCE_MEDIA_UNSUPPORTED"]),shotId:z48.uuid(),ordinal:z48.int().positive().max(200),actualWidth:z48.int().positive().max(4096),actualHeight:z48.int().positive().max(4096),requiredWidth:z48.int().positive().max(4096),requiredHeight:z48.int().positive().max(4096)});var FinalRenderEligibilitySchema=TimelineScopeSchema.extend({productionRevision:z48.int().positive(),finalReady:FinalReadyViewSchema,profile:z48.union([FinalRenderProfileSchema,VisualLayerFinalProfileSchema]).nullable(),renderable:z48.boolean(),blockers:z48.array(z48.string().min(1).max(120)).max(24),sourceBlockers:z48.array(FinalRenderSourceBlockerSchema).max(200),supportedAudioPolicy:z48.enum(["SILENT","MIXED"]),supportedCaptionPolicy:z48.enum(["NONE","BURN_IN"])});var FinalRenderSnapshotSchema=z48.strictObject({latestRenderId:z48.uuid().nullable(),runtimeStatus:RoughCutViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z48.uuid().nullable(),currentArtifactId:z48.uuid().nullable(),stale:z48.boolean(),eligibility:FinalRenderEligibilitySchema});import{z as z49}from"zod";var TemporalEvidenceReferenceSchema=z49.strictObject({evidenceId:z49.uuid(),frameSetArtifactId:z49.uuid(),contactSheetArtifactId:z49.uuid(),manifestRepresentationId:z49.uuid(),sheetRepresentationId:z49.uuid(),planFingerprint:z49.string().regex(/^[0-9a-f]{64}$/),sourceArtifactId:z49.uuid(),sourceRepresentationId:z49.uuid(),sourceChecksumSha256:z49.string().regex(/^[0-9a-f]{64}$/),timestampsMs:z49.array(z49.number().nonnegative().max(6e4)).min(1).max(64),executionClass:z49.enum(["LIVE","TEST_ONLY"])});var TemporalEvidenceIdsSchema=z49.array(z49.uuid()).min(1).max(8).refine(v=>new Set(v).size===v.length,"Evidence references must be unique");import{z as z50}from"zod";var ListeningEvidenceIdsSchema=z50.array(z50.string().min(1).max(100)).max(64);var ListeningEvidenceSchema=z50.strictObject({id:z50.string().trim().min(1).max(100),kind:z50.enum(["AUDIO_LISTENING","VIDEO_WITH_AUDIO_PLAYBACK"]),media:z50.strictObject({artifactId:z50.uuid(),representationId:z50.uuid(),checksumSha256:z50.string().regex(/^[0-9a-f]{64}$/)}),coverage:z50.array(z50.strictObject({startMs:z50.int().nonnegative().max(6e4),endMs:z50.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs)).min(1).max(200),producer:z50.string().trim().min(1).max(200)});var ListeningEvidenceSetSchema=z50.array(ListeningEvidenceSchema).max(64).refine(v=>new Set(v.map(e=>e.id)).size===v.length);import{z as z51}from"zod";var sha10=z51.string().regex(/^[0-9a-f]{64}$/);var CompositionFindingLocalitySchema=z51.strictObject({schemaVersion:z51.literal(1),sourceKind:z51.literal("CODE"),role:z51.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),compositionId:z51.uuid(),compositionVersionId:z51.uuid(),compositionVersion:z51.int().positive(),compositionFingerprint:sha10,renderId:z51.uuid(),renderManifestFingerprint:sha10,artifactId:z51.uuid(),representationId:z51.uuid(),checksumSha256:sha10,clipOrdinal:z51.int().min(1).max(200).nullable(),visualLayerId:z51.uuid().nullable(),sourceInFrame:z51.int().min(0).max(359),sourceOutFrame:z51.int().min(1).max(360),mapping:z51.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 z52}from"zod";var CanonicalFactSchema=z52.strictObject({key:z52.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/),value:z52.string().trim().min(1).max(300),sourceArtifactId:ArtifactIdSchema,evidence:z52.discriminatedUnion("kind",[z52.strictObject({kind:z52.literal("JSON_POINTER"),pointer:z52.string().startsWith("/").max(200)}),z52.strictObject({kind:z52.literal("EXACT_TEXT_LINE")})])});var BriefContentSchema=z52.strictObject({objective:z52.string().trim().min(1).max(1e3),productPresentationGoal:z52.string().trim().min(1).max(1e3),audience:z52.string().trim().min(1).max(300).optional(),styleTone:z52.string().trim().min(1).max(300).optional(),callToAction:z52.string().trim().min(1).max(300).optional(),targetDurationSeconds:z52.int().min(30).max(60),aspectRatio:z52.enum(["16:9","9:16"]),outputProfile:DeliveryOutputProfileSchema,canonicalFacts:z52.array(CanonicalFactSchema).max(32).default([])});var AcceptBriefRequestSchema=z52.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z52.int().positive(),revisionReason:z52.string().trim().min(1).max(1e3).optional(),sourceArtifactIds:z52.array(ArtifactIdSchema).max(20).default([]),content:BriefContentSchema});var BriefSourceReferenceSchema=z52.strictObject({artifactId:ArtifactIdSchema,checksumSha256:z52.string().regex(/^[0-9a-f]{64}$/)});var BriefVersionSchema=z52.strictObject({id:BriefVersionIdSchema,briefId:BriefIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z52.int().positive(),content:BriefContentSchema,sources:z52.array(BriefSourceReferenceSchema).min(1).max(20),createdByPrincipalId:PrincipalIdSchema,createdAt:z52.iso.datetime({offset:true})});var AcceptBriefResultSchema=z52.discriminatedUnion("semanticStatus",[z52.strictObject({semanticStatus:z52.literal("SUCCESS"),briefVersion:BriefVersionSchema,productionRevision:z52.int().positive(),activeBriefVersion:z52.int().positive()}),z52.strictObject({semanticStatus:z52.literal("NEEDS_INPUT"),missingFacts:z52.array(z52.enum(["PRODUCT_INFORMATION_SOURCE","PRODUCT_NAME"])).min(1)})]);import{z as z53}from"zod";var StoryFactKeySchema=z53.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/);var StoryFactClaimSchema=z53.strictObject({key:StoryFactKeySchema,value:z53.string().trim().min(1).max(300)});var StoryBeatSchema=z53.strictObject({summary:z53.string().trim().min(1).max(600),sceneRequirements:z53.array(z53.string().trim().min(1).max(300)).max(8).default([])});var StoryContentSchema=z53.strictObject({narrativeIntent:z53.string().trim().min(1).max(2e3),beats:z53.array(StoryBeatSchema).min(1).max(24),factualClaims:z53.array(StoryFactClaimSchema).max(32).default([])});var AcceptStoryRequestSchema=z53.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z53.int().positive(),expectedBriefVersion:z53.int().positive(),revisionReason:z53.string().trim().min(1).max(1e3).optional(),idempotencyKey:z53.string().trim().min(1).max(200),content:StoryContentSchema});var StoryVersionSchema=z53.strictObject({id:StoryVersionIdSchema,storyId:StoryIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z53.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z53.int().positive(),content:StoryContentSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z53.iso.datetime({offset:true})});var AcceptStoryResultSchema=z53.discriminatedUnion("semanticStatus",[z53.strictObject({semanticStatus:z53.literal("SUCCESS"),storyVersion:StoryVersionSchema,productionRevision:z53.int().positive(),activeStoryVersion:z53.int().positive()}),z53.strictObject({semanticStatus:z53.literal("NEEDS_INPUT"),missingPrerequisites:z53.array(z53.literal("ACTIVE_BRIEF")).min(1)})]);import{z as z54}from"zod";var ConsistencyFamilySchema=z54.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","BOUNDARY_CONTINUITY","STYLE","VOICE_IDENTITY"]);var ConsistencyEnforcementSchema=z54.enum(["LOCKED","REQUIRED","PREFERRED","FREE"]);var ConsistencyMasterReferenceSchema=z54.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z54.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z54.string().regex(/^[0-9a-f]{64}$/),contentType:z54.enum(["image/png","image/jpeg","image/webp","audio/wav"])});var Fact=z54.strictObject({dimension:z54.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),value:z54.string().trim().min(1).max(1e3)});var ConsistencySubjectSchema=z54.strictObject({id:z54.uuid(),kind:z54.enum(["CHARACTER","VOICE"]),displayName:z54.string().trim().min(1).max(200),facts:z54.array(Fact).min(1).max(32),master:ConsistencyMasterReferenceSchema}).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"})});var ConsistencyRuleScopeSchema=z54.discriminatedUnion("kind",[z54.strictObject({kind:z54.literal("PROJECT")}),z54.strictObject({kind:z54.literal("PRODUCTION")}),z54.strictObject({kind:z54.literal("SCENE"),id:z54.uuid()}),z54.strictObject({kind:z54.literal("SHOT"),id:z54.uuid()}),z54.strictObject({kind:z54.literal("CONTINUITY_EDGE"),id:z54.uuid()})]);var ConsistencyRuleSchema=z54.strictObject({reviewScales:z54.array(ConsistencyReviewScaleSchema).min(1).max(3).refine(s=>new Set(s).size===s.length,"Review scales must be unique").optional(),continuity:ContinuityExpectationSchema.optional(),id:z54.uuid(),family:ConsistencyFamilySchema,subjectId:z54.uuid().nullable(),dimension:z54.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),scope:ConsistencyRuleScopeSchema,enforcement:ConsistencyEnforcementSchema,expected:z54.string().trim().min(1).max(1e3).nullable(),referenceMode:z54.enum(["NONE","SUBJECT_MASTER","EXACT"]),reference:ConsistencyMasterReferenceSchema.optional(),override:z54.strictObject({priorRuleId:z54.uuid(),reason:z54.string().trim().min(1).max(1e3)}).optional(),transition:z54.strictObject({edgeId:z54.uuid(),from:z54.string().trim().min(1).max(1e3),to:z54.string().trim().min(1).max(1e3),reason:z54.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.reviewScales)invalid("Native Voice review remains inactive");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=z54.strictObject({subjects:z54.array(ConsistencySubjectSchema).max(32),rules:z54.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");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(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=z54.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var ConsistencyProfileVersionQuerySchema=ConsistencyProfileScopeSchema.extend({profileId:z54.uuid()});var ConfigureConsistencyProfileSchema=ConsistencyProfileScopeSchema.extend({expectedProductionRevision:z54.int().positive(),expectedProfileVersion:z54.int().nonnegative(),content:ConsistencyProfileContentSchema,reason:z54.string().trim().min(1).max(2e3),idempotencyKey:z54.string().trim().min(1).max(200)});var ConsistencyProfileVersionSchema=ConsistencyProfileScopeSchema.extend({id:z54.uuid(),projectId:ProjectIdSchema,version:z54.int().positive(),previousVersionId:z54.uuid().nullable(),content:ConsistencyProfileContentSchema,fingerprint:z54.string().regex(/^[0-9a-f]{64}$/),reason:z54.string().trim().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z54.iso.datetime({offset:true})});var ConsistencyProfileViewSchema=ConsistencyProfileScopeSchema.extend({productionRevision:z54.int().positive(),current:ConsistencyProfileVersionSchema.nullable()});var ConsistencyProfileReceiptSchema=z54.strictObject({semanticStatus:z54.literal("SUCCESS"),profile:ConsistencyProfileVersionSchema,productionRevision:z54.int().positive()});import{z as z55}from"zod";var sha11=z55.string().regex(/^[0-9a-f]{64}$/);var RoughCutReviewScopeSchema=TimelineScopeSchema.extend({renderId:z55.uuid()});var ReviewIntervalSchema=z55.strictObject({startMs:z55.int().nonnegative().max(6e4),endMs:z55.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Review interval must advance");var RoughCutRequirementSchema=z55.strictObject({continuity:ContinuityExpectationSchema.optional(),consistencyScale:ConsistencyReviewScaleSchema.optional(),consistencyFamily:z55.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","BOUNDARY_CONTINUITY"]).optional(),consistencySubject:ConsistencySubjectSchema.optional(),consistencyReference:ConsistencyMasterReferenceSchema.optional(),key:z55.string().min(1).max(220),dimension:z55.enum(["PRODUCT_PRESENTATION","CANONICAL_FACT","NARRATIVE","PACING","REPETITION","STYLE","TECHNICAL","TRANSITION"]),expected:z55.string().min(1).max(4e3),enforcement:z55.enum(["LOCKED","REQUIRED","PREFERRED"]),scope:z55.enum(["PRODUCTION","TRANSITION"]),interval:ReviewIntervalSchema,shotIds:z55.array(z55.uuid()).min(1).max(200)});var RoughCutObservationSchema=z55.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z55.string().min(1).max(220),status:z55.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z55.enum(["CLEAR","UNCERTAIN"]),observed:z55.string().trim().min(1).max(1800),interval:ReviewIntervalSchema,location:z55.strictObject({interval:ReviewIntervalSchema,shotIds:z55.array(z55.uuid()).min(1).max(200)}).optional()});var RoughCutInspectionSchema=z55.strictObject({actor:z55.enum(["HUMAN","EXTERNAL_AGENT"]),method:z55.literal("FULL_TEMPORAL_INSPECTION"),coverage:z55.array(ReviewIntervalSchema).min(1).max(200)});var RoughCutReviewBasisSchema=z55.strictObject({consistencyRequirements:z55.array(RoughCutRequirementSchema).max(256).optional(),artifactId:z55.uuid(),representationId:z55.uuid(),checksumSha256:sha11,manifestFingerprint:sha11,manifest:RoughCutManifestReaderSchema,brief:BriefVersionSchema,story:StoryVersionSchema});var RecordRoughCutReviewSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),artifactId:z55.uuid(),representationId:z55.uuid(),checksumSha256:sha11,basisFingerprint:sha11,expectedProductionRevision:z55.int().positive(),expectedReviewVersion:z55.int().nonnegative(),idempotencyKey:z55.string().trim().min(1).max(200),inspection:RoughCutInspectionSchema,observations:z55.array(RoughCutObservationSchema).min(1).max(300),summary:z55.string().trim().min(1).max(2500)});var RoughCutReviewRecordSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z55.uuid(),projectId:ProjectIdSchema,version:z55.int().positive(),kind:z55.literal("PRODUCTION_REVIEW_2"),lifecycle:z55.literal("COMPLETED"),evaluatorVersion:z55.literal("production-review-v1"),basis:RoughCutReviewBasisSchema,basisFingerprint:sha11,executionClass:z55.enum(["LIVE","TEST_ONLY"]),technical:RoughCutTechnicalSchema,durationMs:z55.int().min(3e4).max(6e4),requirements:z55.array(RoughCutRequirementSchema).min(1).max(300),inspection:RoughCutInspectionSchema,observations:z55.array(RoughCutObservationSchema).min(1).max(300),result:z55.enum(["PASS","WARNING","FAIL"]),blockingKeys:z55.array(z55.string()).max(300),warningKeys:z55.array(z55.string()).max(300),summary:z55.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z55.iso.datetime({offset:true})});var RoughCutReviewTargetSchema=RoughCutReviewScopeSchema.extend({temporalEvidence:z55.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,productionRevision:z55.int().positive(),productionRunnable:z55.boolean(),executionClass:z55.enum(["LIVE","TEST_ONLY"]),freshness:z55.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z55.array(z55.string()).max(18),inspectable:z55.boolean(),durationMs:z55.int().min(3e4).max(6e4),basis:RoughCutReviewBasisSchema,basisFingerprint:sha11,technical:RoughCutTechnicalSchema,requirements:z55.array(RoughCutRequirementSchema).min(1).max(300),latestReview:RoughCutReviewRecordSchema.nullable(),reviewVersion:z55.int().nonnegative(),finalReadyVersion:z55.int().nonnegative()});var RoughCutFindingSchema=RoughCutReviewScopeSchema.extend({compositionLocality:z55.array(CompositionFindingLocalitySchema).min(1).max(208).optional(),id:z55.uuid(),projectId:ProjectIdSchema,reviewId:z55.uuid(),reviewVersion:z55.int().positive(),basisFingerprint:sha11,artifactId:z55.uuid(),timelineVersionId:z55.uuid(),requirement:RoughCutRequirementSchema,observation:RoughCutObservationSchema,blocking:z55.boolean(),severity:z55.enum(["BLOCKING","WARNING"]),remediation:z55.enum(["REVISE_PRODUCTION","REVISE_TRANSITION","CORRECT_CANONICAL_CONTRADICTION"]),affectedScope:z55.strictObject({kind:z55.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z55.array(z55.uuid()).min(1).max(200)}),initialLifecycle:z55.literal("OPEN"),createdAt:z55.iso.datetime({offset:true})});var RoughCutFindingViewSchema=RoughCutFindingSchema.extend({lifecycle:z55.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","WAIVED","SUPERSEDED"]),proofReviewId:z55.uuid().nullable(),proofDecisionId:z55.uuid().nullable()});var RoughCutReviewQuerySchema=RoughCutReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutReviewPageSchema=z55.strictObject({items:z55.array(RoughCutReviewRecordSchema),page:QueryPageInfoSchema});var RoughCutFindingQuerySchema=TimelineScopeSchema.extend({renderId:z55.uuid().optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutFindingGetSchema=TimelineScopeSchema.extend({findingId:z55.uuid()});var RoughCutFindingPageSchema=z55.strictObject({items:z55.array(RoughCutFindingViewSchema),page:QueryPageInfoSchema});var RoughCutReviewReceiptSchema=z55.strictObject({semanticStatus:z55.literal("SUCCESS"),review:RoughCutReviewRecordSchema,findingIds:z55.array(z55.uuid()).max(300),productionRevision:z55.int().positive()});import{z as z56}from"zod";var ReviewEvidenceKeySchema=z56.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ReviewEvidenceMediaSchema=z56.strictObject({artifactId:z56.uuid(),representationId:z56.uuid(),checksumSha256:z56.string().regex(/^[0-9a-f]{64}$/)});var common={id:ReviewEvidenceKeySchema,label:z56.string().trim().min(1).max(200),producer:z56.enum(["EXTERNAL_AGENT_HOST","HUMAN","VLM"]),media:ReviewEvidenceMediaSchema};var ReviewIntelligenceEvidenceSchema=z56.discriminatedUnion("kind",[z56.strictObject({...common,kind:z56.literal("METADATA")}),z56.strictObject({...common,kind:z56.literal("IMAGE_PIXELS")}),z56.strictObject({...common,kind:z56.literal("REGISTERED_TEMPORAL_FRAMES"),reference:TemporalEvidenceReferenceSchema}),z56.strictObject({...common,kind:z56.literal("VIDEO_PLAYBACK"),coverage:z56.array(ReviewIntervalSchema).min(1).max(200)}),z56.strictObject({...common,kind:z56.literal("AUDIO_LISTENING"),coverage:z56.array(ReviewIntervalSchema).min(1).max(200)}),z56.strictObject({...common,kind:z56.literal("VIDEO_WITH_AUDIO_PLAYBACK"),coverage:z56.array(ReviewIntervalSchema).min(1).max(200)}),z56.strictObject({...common,kind:z56.literal("VIDEO_FRAMES"),timestampsMs:z56.array(z56.number().nonnegative().max(6e4)).min(1).max(64)})]);import{z as z57}from"zod";var ObservationScopeSchema=z57.strictObject({tenantId:z57.uuid(),productionId:z57.uuid()});var ObservationSourceRequestSchema=z57.discriminatedUnion("kind",[z57.strictObject({kind:z57.literal("AUDIO"),media:ReviewEvidenceMediaSchema,versionId:z57.uuid(),purpose:z57.enum(["VOICEOVER","MUSIC"])}),z57.strictObject({kind:z57.literal("VIDEO"),media:ReviewEvidenceMediaSchema})]);var ObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:z57.int().positive(),idempotencyKey:z57.string().min(1).max(200),source:ObservationSourceRequestSchema,mode:ObservationModeSchema,selection:ProviderSelectionSchema,expectedModelProfileVersion:z57.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:z57.uuid()});var ObservationBindingSchema=z57.strictObject({tenantId:z57.uuid(),connectionId:z57.uuid(),connectionVersion:z57.int().positive(),credentialRef:z57.string(),credentialVersion:z57.int().positive(),profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),executionClass:z57.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:z57.uuid(),projectId:z57.uuid(),productionId:z57.uuid(),byteSize:z57.int().positive().max(12582912),durationMs:z57.number().positive().max(6e4),frameRate:z57.number().positive().max(60).optional(),executionClass:z57.enum(["LIVE","TEST_ONLY"])});var json=z57.record(z57.string(),z57.unknown());var ObservationResultSchema=z57.strictObject({schemaVersion:z57.int().positive(),advisory:z57.literal(true),producer:z57.enum(["VLM","ASR"]).optional(),source:ObservationSourceSchema,input:json,provider:json,observedAt:z57.iso.datetime(),report:json,transcript:TranscriptSchema.optional(),evidence:ReviewIntelligenceEvidenceSchema.optional(),limitations:z57.array(z57.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=z57.strictObject({semanticStatus:z57.literal("ACCEPTED"),observationId:z57.uuid(),runtimeJobId:z57.uuid(),productionRevision:z57.int().positive(),executionClass:z57.enum(["LIVE","TEST_ONLY"])});var ObservationViewSchema=ObservationScopeSchema.extend({observationId:z57.uuid(),runtimeJobId:z57.uuid(),request:ObservationStartSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),parameters:ObservationParametersSchema,executionClass:z57.enum(["LIVE","TEST_ONLY"]),runtimeStatus:z57.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z57.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z57.boolean(),failure:z57.strictObject({classification:z57.string().min(1).max(100),summary:z57.string().min(1).max(1e3)}).nullable(),result:ObservationResultSchema.nullable(),createdAt:z57.iso.datetime()});var ObservationOptionsSchema=ObservationScopeSchema.extend({options:z57.array(z57.strictObject({selection:ProviderSelectionSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),connectionLabel:z57.string(),connectionVersion:z57.int().positive()})).max(100),possiblyTruncated:z57.boolean()});var ProductionGuidanceSchema=z57.strictObject({version:z57.enum(["NVS_PRODUCTION_GUIDANCE_V1","NVS_PRODUCTION_GUIDANCE_V2"]),instructions:z57.string().min(1).max(16e3)});var ProductionGuidanceContextSchema=ObservationScopeSchema.extend({projectId:z57.uuid(),revision:z57.int().positive(),guidance:ProductionGuidanceSchema});var MAX_SHOT_REVIEW_REQUIREMENTS=2200;import{z as z58}from"zod";var Fingerprint3=z58.string().regex(/^[0-9a-f]{64}$/);var VideoReviewScopeSchema=z58.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z58.uuid()});var VideoReviewRequirementSchema=z58.strictObject({intentPath:z58.string().min(1).max(220).optional(),continuity:ContinuityExpectationSchema.optional(),interval:z58.strictObject({startMs:z58.int().nonnegative().max(6e4),endMs:z58.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Requirement interval must advance").optional(),key:z58.string().min(1).max(220),family:z58.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY","SOUND"]),expected:z58.string().min(1).max(2500),enforcement:z58.enum(["LOCKED","REQUIRED","PREFERRED"]),evidenceWindow:z58.enum(["WHOLE_VIDEO","START","END","TEMPORAL"])});var VideoObservationSchema=z58.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z58.string().min(1).max(220),status:z58.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z58.enum(["CLEAR","UNCERTAIN"]),observed:z58.string().trim().min(1).max(1800),interval:z58.strictObject({startMs:z58.int().nonnegative(),endMs:z58.int().positive()}).refine(v=>v.endMs>v.startMs,"Observation interval must advance").optional()});var RecordVideoReviewSchema=VideoReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),candidateId:z58.uuid(),representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,expectedReviewVersion:z58.int().nonnegative(),idempotencyKey:z58.string().trim().min(1).max(200),observations:z58.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z58.string().trim().min(1).max(2500)});var VideoReviewRecordSchema=z58.strictObject({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z58.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z58.uuid(),candidateId:z58.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,shotId:ShotIdSchema,version:z58.int().positive(),preparationId:z58.uuid(),contractId:z58.uuid(),contractFingerprint:Fingerprint3,executionClass:z58.enum(["LIVE","TEST_ONLY"]),kind:z58.literal("SHOT_REVIEW_1"),lifecycle:z58.literal("COMPLETED"),evaluatorVersion:z58.literal("shot-review-v1"),source:z58.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z58.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z58.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z58.enum(["PASS","WARNING","FAIL"]),blockingKeys:z58.array(z58.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z58.array(z58.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z58.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z58.iso.datetime({offset:true})});var DecideVideoShotSchema=VideoReviewScopeSchema.extend({candidateId:z58.uuid(),reviewId:z58.uuid(),expectedAcceptanceVersion:z58.int().nonnegative(),action:z58.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z58.boolean().default(false),reason:z58.string().trim().min(1).max(2500),idempotencyKey:z58.string().trim().min(1).max(200)});var ShotAcceptanceScopeSchema=z58.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema});var RevokeShotAcceptanceSchema=ShotAcceptanceScopeSchema.extend({acceptanceId:z58.uuid(),expectedAcceptanceVersion:z58.int().positive(),reason:z58.string().trim().min(1).max(2500),idempotencyKey:z58.string().trim().min(1).max(200)});var GeneratedShotAcceptanceDecisionSchema=z58.strictObject({id:z58.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z58.int().positive(),generationId:z58.uuid(),candidateId:z58.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z58.uuid(),action:z58.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedShotReferenceSchema.nullable(),previousAcceptanceId:z58.uuid().nullable(),warningKeys:z58.array(z58.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z58.boolean(),reason:z58.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z58.iso.datetime({offset:true})});var ProgrammaticShotAcceptanceDecisionSchema=z58.strictObject({sourceKind:z58.literal("PROGRAMMATIC"),id:z58.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z58.int().positive(),renderId:z58.uuid(),compositionId:z58.uuid(),compositionVersionId:z58.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z58.uuid(),action:z58.enum(["ACCEPT","REJECT","REVOKE"]),reference:ProgrammaticAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z58.uuid().nullable(),warningKeys:z58.array(z58.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z58.boolean(),reason:z58.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z58.iso.datetime({offset:true})});var ShotAcceptanceDecisionSchema=z58.union([GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,z58.strictObject({sourceKind:z58.literal("IMPORTED"),id:z58.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z58.int().positive(),normalizationId:z58.uuid(),sourceId:z58.uuid(),sourceVersionId:z58.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z58.uuid(),action:z58.enum(["ACCEPT","REJECT","REVOKE"]),reference:ImportedAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z58.uuid().nullable(),warningKeys:z58.array(z58.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z58.boolean(),reason:z58.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z58.iso.datetime({offset:true})})]);var VideoReviewTargetSchema=VideoReviewScopeSchema.extend({temporalEvidence:z58.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,preparationId:z58.uuid(),contractId:z58.uuid(),contractFingerprint:Fingerprint3,executionClass:z58.enum(["LIVE","TEST_ONLY"]),freshness:z58.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z58.boolean(),productionRunnable:z58.boolean(),candidate:VideoCandidateSchema,requirements:z58.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:VideoReviewRecordSchema.nullable(),reviewVersion:z58.int().nonnegative(),acceptanceVersion:z58.int().nonnegative(),activeAcceptanceId:z58.uuid().nullable()});var ShotAcceptanceViewSchema=ShotAcceptanceScopeSchema.extend({acceptanceVersion:z58.int().nonnegative(),status:z58.enum(["NONE","CURRENT","STALE"]),acceptance:ShotAcceptanceDecisionSchema.nullable(),reference:AcceptedVisualSourceReferenceSchema.nullable()});var VideoReviewQuerySchema=VideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoReviewPageSchema=z58.strictObject({items:z58.array(VideoReviewRecordSchema),page:QueryPageInfoSchema});var ShotDecisionQuerySchema=ShotAcceptanceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ShotDecisionPageSchema=z58.strictObject({items:z58.array(ShotAcceptanceDecisionSchema),page:QueryPageInfoSchema});var VideoReviewReceiptSchema=z58.strictObject({semanticStatus:z58.literal("SUCCESS"),review:VideoReviewRecordSchema,productionRevision:z58.int().positive()});var ShotDecisionReceiptSchema=z58.strictObject({semanticStatus:z58.literal("SUCCESS"),decision:ShotAcceptanceDecisionSchema,productionRevision:z58.int().positive()});import{z as z59}from"zod";var Fingerprint4=z59.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticVideoReviewScopeSchema=z59.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,renderId:z59.uuid()});var ProgrammaticReviewMediaSchema=VideoTechnicalMetadataSchema.extend({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z59.enum(["AVAILABLE","INVALID"])});var ProgrammaticVideoReviewRecordSchema=z59.strictObject({sourceKind:z59.literal("PROGRAMMATIC"),id:z59.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,renderId:z59.uuid(),compositionId:z59.uuid(),compositionVersionId:z59.uuid(),compositionVersion:z59.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,version:z59.int().positive(),planVersionId:z59.uuid(),planVersion:z59.int().positive(),shotPlanningRevision:z59.int().positive(),executionClass:z59.enum(["LIVE","TEST_ONLY"]),kind:z59.literal("SHOT_REVIEW_1"),lifecycle:z59.literal("COMPLETED"),evaluatorVersion:z59.literal("shot-review-v1"),source:z59.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z59.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z59.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z59.enum(["PASS","WARNING","FAIL"]),blockingKeys:z59.array(z59.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z59.array(z59.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z59.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z59.iso.datetime({offset:true})});var ProgrammaticVideoReviewTargetSchema=ProgrammaticVideoReviewScopeSchema.extend({sourceKind:z59.literal("PROGRAMMATIC"),temporalEvidence:z59.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,compositionId:z59.uuid(),compositionVersionId:z59.uuid(),compositionVersion:z59.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,executionClass:z59.enum(["LIVE","TEST_ONLY"]),freshness:z59.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z59.boolean(),productionRunnable:z59.boolean(),media:ProgrammaticReviewMediaSchema,requirements:z59.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:ProgrammaticVideoReviewRecordSchema.nullable(),reviewVersion:z59.int().nonnegative(),acceptanceVersion:z59.int().nonnegative(),activeAcceptanceId:z59.uuid().nullable()});var RecordProgrammaticVideoReviewSchema=ProgrammaticVideoReviewScopeSchema.extend({representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,expectedReviewVersion:z59.int().nonnegative(),idempotencyKey:z59.string().trim().min(1).max(200),observations:z59.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z59.string().trim().min(1).max(2500)});var DecideProgrammaticShotSchema=ProgrammaticVideoReviewScopeSchema.extend({reviewId:z59.uuid(),expectedAcceptanceVersion:z59.int().nonnegative(),action:z59.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z59.boolean().default(false),reason:z59.string().trim().min(1).max(2500),idempotencyKey:z59.string().trim().min(1).max(200)});var ProgrammaticVideoReviewQuerySchema=ProgrammaticVideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProgrammaticVideoReviewPageSchema=z59.strictObject({items:z59.array(ProgrammaticVideoReviewRecordSchema),page:QueryPageInfoSchema});var ProgrammaticVideoReviewReceiptSchema=z59.strictObject({semanticStatus:z59.literal("SUCCESS"),review:ProgrammaticVideoReviewRecordSchema,productionRevision:z59.int().positive()});import{z as z60}from"zod";var Intent=z60.string().trim().min(1).max(300);var CameraIntentSchema=z60.strictObject({scale:z60.enum(["EXTREME_CLOSE_UP","CLOSE_UP","MEDIUM","WIDE","EXTREME_WIDE"]),framing:z60.enum(["CENTERED","OFF_CENTER","SYMMETRICAL","OVER_SHOULDER"]),angle:z60.enum(["EYE_LEVEL","HIGH","LOW","TOP_DOWN"]),movement:z60.enum(["STATIC","PAN","TILT","DOLLY","TRACK","ORBIT","CRANE","ZOOM"]),stability:z60.enum(["LOCKED","STABILIZED","HANDHELD"]),direction:z60.enum(["LEFT","RIGHT","UP","DOWN","FORWARD","BACKWARD","CLOCKWISE","COUNTERCLOCKWISE"]).optional(),lensIntent:z60.string().trim().min(1).max(120).optional()});var ShotTemporalBeatSchema=z60.strictObject({startSeconds:z60.number().min(0).max(30),endSeconds:z60.number().positive().max(30),action:Intent});var ShotDirectionSchema=z60.strictObject({camera:CameraIntentSchema,temporalBeats:z60.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}import{z as z61}from"zod";var PlanningClientKeySchema=z61.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/);var BoundaryRequirementSchema=z61.strictObject({attribute:z61.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),value:z61.string().trim().min(1).max(300)});var ShotIntentSchema=z61.strictObject({narrativePurpose:z61.string().trim().min(1).max(600),subjectAction:z61.string().trim().min(1).max(600),targetDurationSeconds:z61.number().min(.5).max(30),subjectRequirements:z61.array(z61.string().trim().min(1).max(300)).max(16).default([]),cameraComposition:z61.string().trim().min(1).max(500).optional(),factualClaims:z61.array(StoryFactClaimSchema).max(16).default([]),requiresGeneratedKeyframe:z61.boolean().default(false),sourceMediaAllowed:z61.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=z61.strictObject({clientKey:PlanningClientKeySchema,shotId:ShotIdSchema.optional(),intent:ShotIntentSchema,entryBoundary:z61.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z61.array(BoundaryRequirementSchema).max(24).default([])});var ScenePlanInputSchema=z61.strictObject({clientKey:PlanningClientKeySchema,sceneId:SceneIdSchema.optional(),purpose:z61.string().trim().min(1).max(800),locationContext:z61.string().trim().min(1).max(300).optional(),timeContext:z61.string().trim().min(1).max(300).optional(),entryBoundary:z61.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z61.array(BoundaryRequirementSchema).max(24).default([]),shots:z61.array(ShotPlanInputSchema).min(1).max(24)});var ContinuityRequirementSchema=z61.strictObject({mode:z61.enum(["PERSIST","TRANSITION","REESTABLISH","REVIEW"]),attribute:z61.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),description:z61.string().trim().min(1).max(500)});var ContinuityEdgeInputSchema=z61.strictObject({fromShotKey:PlanningClientKeySchema,toShotKey:PlanningClientKeySchema,requirements:z61.array(ContinuityRequirementSchema).min(1).max(24)});var AcceptSceneShotPlanRequestSchema=z61.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z61.int().positive(),expectedStoryVersion:z61.int().positive(),revisionReason:z61.string().trim().min(1).max(1e3).optional(),idempotencyKey:z61.string().trim().min(1).max(200),scenes:z61.array(ScenePlanInputSchema).min(1).max(12),continuityEdges:z61.array(ContinuityEdgeInputSchema).max(64).default([])});var ShotPlanEntrySchema=z61.strictObject({shotId:ShotIdSchema,clientKey:PlanningClientKeySchema,ordinal:z61.int().positive(),planningRevision:z61.int().positive(),intent:ShotIntentSchema,entryBoundary:z61.array(BoundaryRequirementSchema).max(24),exitBoundary:z61.array(BoundaryRequirementSchema).max(24)});var ScenePlanEntrySchema=z61.strictObject({sceneId:SceneIdSchema,clientKey:PlanningClientKeySchema,ordinal:z61.int().positive(),purpose:z61.string().trim().min(1).max(800),locationContext:z61.string().trim().min(1).max(300).optional(),timeContext:z61.string().trim().min(1).max(300).optional(),entryBoundary:z61.array(BoundaryRequirementSchema).max(24),exitBoundary:z61.array(BoundaryRequirementSchema).max(24),shots:z61.array(ShotPlanEntrySchema).min(1).max(24)});var ContinuityEdgeSchema=z61.strictObject({id:ContinuityEdgeIdSchema,fromShotId:ShotIdSchema,toShotId:ShotIdSchema,requirements:z61.array(ContinuityRequirementSchema).min(1).max(24)});var SceneShotPlanVersionSchema=z61.strictObject({id:SceneShotPlanVersionIdSchema,planId:SceneShotPlanIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z61.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z61.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z61.int().positive(),scenes:z61.array(ScenePlanEntrySchema).min(1).max(12),continuityEdges:z61.array(ContinuityEdgeSchema).max(64),createdByPrincipalId:PrincipalIdSchema,createdAt:z61.iso.datetime({offset:true})});var AcceptSceneShotPlanResultSchema=z61.discriminatedUnion("semanticStatus",[z61.strictObject({semanticStatus:z61.literal("SUCCESS"),planVersion:SceneShotPlanVersionSchema,productionRevision:z61.int().positive(),activeSceneShotPlanVersion:z61.int().positive()}),z61.strictObject({semanticStatus:z61.literal("NEEDS_INPUT"),missingPrerequisites:z61.array(z61.literal("ACTIVE_STORY")).min(1)})]);import{z as z62}from"zod";var WriterScopeSchema=z62.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema});var WriterBasisSchema=WriterScopeSchema.extend({productionRevision:z62.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z62.int().positive()});var IntentSchema=z62.string().trim().min(1).max(600);var WriterAlternativeSchema=z62.strictObject({alternativeId:z62.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z62.string().trim().min(1).max(120),story:StoryContentSchema,rationale:z62.strictObject({coreMessage:IntentSchema,hook:IntentSchema,audienceFit:IntentSchema,pacingIntent:IntentSchema,endingIntent:IntentSchema,tradeoffs:z62.array(IntentSchema).max(6)}),beatDurationsSeconds:z62.array(z62.int().positive().max(60)).min(1).max(24)});var WriterProposalSchema=z62.strictObject({origin:z62.strictObject({kind:z62.literal("EXTERNAL_AGENT_HOST"),label:z62.string().trim().min(1).max(100)}),unknowns:z62.array(z62.string().trim().min(1).max(300)).max(8),alternatives:z62.array(WriterAlternativeSchema).min(1).max(3)});var ValidateWriterProposalSchema=z62.strictObject({basis:WriterBasisSchema,revisionReason:AcceptStoryRequestSchema.shape.revisionReason,proposal:WriterProposalSchema});var MissingBriefSchema=z62.strictObject({semanticStatus:z62.literal("NEEDS_INPUT"),missingPrerequisites:z62.array(z62.literal("ACTIVE_BRIEF")).min(1).max(1)});var WriterBriefResultSchema=z62.discriminatedUnion("semanticStatus",[z62.strictObject({semanticStatus:z62.literal("SUCCESS"),basis:WriterBasisSchema,briefVersion:BriefVersionSchema}),MissingBriefSchema]);var WriterAcceptanceDraftSchema=z62.strictObject({alternativeId:WriterAlternativeSchema.shape.alternativeId,projectId:ProjectIdSchema,productionId:ProductionIdSchema,request:AcceptStoryRequestSchema.omit({idempotencyKey:true})});var WriterValidationResultSchema=z62.discriminatedUnion("semanticStatus",[z62.strictObject({semanticStatus:z62.literal("SUCCESS"),advisory:z62.literal(true),basis:WriterBasisSchema,proposal:WriterProposalSchema,acceptanceDrafts:z62.array(WriterAcceptanceDraftSchema).min(1).max(3),limitations:z62.array(z62.enum(["PROSE_IS_CREATIVE_INTENT_NOT_FACT_VERIFIED","PACING_IS_ADVISORY_NOT_TIMELINE_TRUTH","ACCEPTANCE_RECHECKS_CURRENT_BASIS"])).length(3)}),MissingBriefSchema]);import{z as z63}from"zod";var DirectorScopeSchema=WriterScopeSchema;var DirectorBasisSchema=WriterBasisSchema.extend({storyVersionId:StoryVersionIdSchema,storyVersion:z63.int().positive(),sceneShotPlanVersionId:SceneShotPlanVersionIdSchema.nullable(),sceneShotPlanVersion:z63.int().positive().nullable()}).refine(value2=>value2.sceneShotPlanVersionId===null===(value2.sceneShotPlanVersion===null),"Current plan ID and version must both be present or null");var Intent2=z63.string().trim().min(1).max(600);var Plan=AcceptSceneShotPlanRequestSchema.pick({scenes:true,continuityEdges:true});var DirectorAlternativeSchema=z63.strictObject({alternativeId:z63.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z63.string().trim().min(1).max(120),plan:Plan,rationale:z63.strictObject({storyInterpretation:Intent2,visualApproach:Intent2,pacingIntent:Intent2,tradeoffs:z63.array(Intent2).max(6)}),shotStoryBeats:z63.array(z63.strictObject({shotKey:PlanningClientKeySchema,beatOrdinals:z63.array(z63.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=z63.strictObject({origin:z63.strictObject({kind:z63.literal("EXTERNAL_AGENT_HOST"),label:z63.string().trim().min(1).max(100)}),unknowns:z63.array(z63.string().trim().min(1).max(300)).max(8),alternatives:z63.array(DirectorAlternativeSchema).min(1).max(3)});var ValidateDirectorProposalSchema=z63.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=z63.strictObject({semanticStatus:z63.literal("NEEDS_INPUT"),missingPrerequisites:z63.array(z63.enum(["ACTIVE_BRIEF","ACTIVE_STORY"])).min(1).max(2)});var DirectorContextResultSchema=z63.discriminatedUnion("semanticStatus",[z63.strictObject({semanticStatus:z63.literal("SUCCESS"),basis:DirectorBasisSchema,briefVersion:BriefVersionSchema,storyVersion:StoryVersionSchema,sceneShotPlanVersion:SceneShotPlanVersionSchema.nullable(),stalePrerequisites:z63.array(z63.enum(["CURRENT_STORY","CURRENT_SCENE_SHOT_PLAN"])).min(1).max(2).optional()}),Missing]);var DirectorAcceptanceDraftSchema=z63.strictObject({alternativeId:DirectorAlternativeSchema.shape.alternativeId,projectId:DirectorScopeSchema.shape.projectId,productionId:DirectorScopeSchema.shape.productionId,request:AcceptSceneShotPlanRequestSchema.omit({idempotencyKey:true})});var DirectorValidationResultSchema=z63.discriminatedUnion("semanticStatus",[z63.strictObject({semanticStatus:z63.literal("SUCCESS"),advisory:z63.literal(true),basis:DirectorBasisSchema,proposal:DirectorProposalSchema,acceptanceDrafts:z63.array(DirectorAcceptanceDraftSchema).min(1).max(3),limitations:z63.array(z63.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 z64}from"zod";var Fingerprint5=z64.string().regex(/^[0-9a-f]{64}$/);var KeyframeReviewScopeSchema=z64.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z64.uuid()});var VisualRequirementSchema=z64.strictObject({intentPath:z64.string().min(1).max(220).optional(),key:z64.string().min(1).max(200),expected:z64.string().min(1).max(2500),enforcement:z64.enum(["LOCKED","REQUIRED","PREFERRED"])});var Region=z64.strictObject({x:z64.number().min(0).max(1),y:z64.number().min(0).max(1),width:z64.number().positive().max(1),height:z64.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=z64.strictObject({key:z64.string().min(1).max(200),status:z64.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z64.enum(["CLEAR","UNCERTAIN"]),observed:z64.string().trim().min(1).max(1500),region:Region.optional()});var RecordKeyframeReviewSchema=KeyframeReviewScopeSchema.extend({candidateId:z64.uuid(),representationId:z64.uuid(),checksumSha256:Fingerprint5,expectedReviewVersion:z64.int().nonnegative(),idempotencyKey:z64.string().trim().min(1).max(200),observations:z64.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z64.string().trim().min(1).max(2e3)});var KeyframeReviewRecordSchema=z64.strictObject({id:z64.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z64.uuid(),candidateId:z64.uuid(),artifactId:z64.uuid(),representationId:z64.uuid(),checksumSha256:Fingerprint5,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,version:z64.int().positive(),preparationId:z64.uuid(),contractId:z64.uuid(),contractFingerprint:Fingerprint5,executionClass:z64.enum(["LIVE","TEST_ONLY"]),kind:z64.literal("KEYFRAME_REFERENCE"),lifecycle:z64.literal("COMPLETED"),evaluatorVersion:z64.literal("keyframe-reference-v1"),source:z64.literal("EXPLICIT_VISUAL_INSPECTION"),requirements:z64.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z64.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z64.enum(["PASS","WARNING","FAIL"]),blockingKeys:z64.array(z64.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z64.array(z64.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z64.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z64.iso.datetime({offset:true})});var DecideKeyframeSchema=KeyframeReviewScopeSchema.extend({candidateId:z64.uuid(),reviewId:z64.uuid(),expectedSelectionVersion:z64.int().nonnegative(),action:z64.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z64.boolean().default(false),reason:z64.string().trim().min(1).max(2e3),idempotencyKey:z64.string().trim().min(1).max(200)});var KeyframeReferenceScopeSchema=z64.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema});var RevokeKeyframeSchema=KeyframeReferenceScopeSchema.extend({acceptanceId:z64.uuid(),expectedSelectionVersion:z64.int().positive(),reason:z64.string().trim().min(1).max(2e3),idempotencyKey:z64.string().trim().min(1).max(200)});var KeyframeDecisionRecordSchema=z64.strictObject({id:z64.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,selectionVersion:z64.int().positive(),generationId:z64.uuid(),candidateId:z64.uuid(),reviewId:z64.uuid(),action:z64.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedKeyframeReferenceSchema.nullable(),previousAcceptanceId:z64.uuid().nullable(),warningKeys:z64.array(z64.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z64.boolean(),reason:z64.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z64.iso.datetime({offset:true})});var KeyframeReviewTargetSchema=KeyframeReviewScopeSchema.extend({projectId:ProjectIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,preparationId:z64.uuid(),contractId:z64.uuid(),contractFingerprint:Fingerprint5,executionClass:z64.enum(["LIVE","TEST_ONLY"]),freshness:z64.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z64.boolean(),productionRunnable:z64.boolean(),candidate:KeyframeCandidateSchema,requirements:z64.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:KeyframeReviewRecordSchema.nullable(),reviewVersion:z64.int().nonnegative(),selectionVersion:z64.int().nonnegative(),activeAcceptanceId:z64.uuid().nullable()});var KeyframeReferenceViewSchema=KeyframeReferenceScopeSchema.extend({selectionVersion:z64.int().nonnegative(),status:z64.enum(["NONE","CURRENT","STALE"]),acceptance:KeyframeDecisionRecordSchema.nullable(),reference:AcceptedKeyframeReferenceSchema.nullable()});var KeyframeReviewQuerySchema=KeyframeReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeReviewPageSchema=z64.strictObject({items:z64.array(KeyframeReviewRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewReceiptSchema=z64.strictObject({semanticStatus:z64.literal("SUCCESS"),review:KeyframeReviewRecordSchema,productionRevision:z64.int().positive()});var KeyframeDecisionReceiptSchema=z64.strictObject({semanticStatus:z64.literal("SUCCESS"),decision:KeyframeDecisionRecordSchema,productionRevision:z64.int().positive()});var KeyframeDecisionQuerySchema=KeyframeReferenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeDecisionPageSchema=z64.strictObject({items:z64.array(KeyframeDecisionRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewSummarySchema=z64.strictObject({reviewedCandidates:z64.int().nonnegative(),unreviewedCandidates:z64.int().nonnegative(),decisionCount:z64.int().nonnegative()});import{z as z65}from"zod";var sha12=z65.string().regex(/^[0-9a-f]{64}$/);var evidenceIds=z65.array(ReviewEvidenceKeySchema).max(16);var ReviewIntelligenceTargetSchema=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("IMAGE"),generationId:z65.uuid()}),z65.strictObject({kind:z65.literal("VIDEO"),generationId:z65.uuid()}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),renderId:z65.uuid()}),z65.strictObject({kind:z65.literal("PROGRAMMATIC"),renderId:z65.uuid()})]);var ReviewIntelligenceContextInputSchema=z65.strictObject({scope:DirectorScopeSchema,target:ReviewIntelligenceTargetSchema});var ReviewIntelligenceBasisSchema=ReviewIntelligenceContextInputSchema.extend({contextFingerprint:sha12});var ReviewIntelligenceOwnerTargetSchema=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("IMAGE"),target:KeyframeReviewTargetSchema}),z65.strictObject({kind:z65.literal("VIDEO"),target:VideoReviewTargetSchema}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),target:RoughCutReviewTargetSchema}),z65.strictObject({kind:z65.literal("PROGRAMMATIC"),target:ProgrammaticVideoReviewTargetSchema})]);var review=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("IMAGE"),observations:z65.array(KeyframeObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z65.strictObject({kind:z65.literal("VIDEO"),observations:z65.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z65.strictObject({kind:z65.literal("PROGRAMMATIC"),observations:z65.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),observations:z65.array(RoughCutObservationSchema.extend({evidenceIds})).min(1).max(300),inspection:RoughCutInspectionSchema})]);var ValidateReviewIntelligenceSchema=z65.strictObject({basis:ReviewIntelligenceBasisSchema,proposal:z65.strictObject({origin:z65.strictObject({kind:z65.literal("EXTERNAL_AGENT_HOST"),label:z65.string().trim().min(1).max(100)}),summary:z65.string().trim().min(1).max(2e3),evidence:z65.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=z65.strictObject({semanticStatus:z65.literal("SUCCESS"),advisory:z65.literal(true),basis:ReviewIntelligenceBasisSchema,productionGuidance:ProductionGuidanceSchema.optional(),ownerContext:DirectorContextResultSchema,reviewTarget:ReviewIntelligenceOwnerTargetSchema,limitations:z65.array(z65.enum(["NO_IMPLICIT_MEDIA_OR_MODEL_CALL","READS_ARE_NOT_ATOMIC_OR_RESERVED"])).length(2)});var ReviewIntelligenceRecordDraftSchema=z65.discriminatedUnion("kind",[z65.strictObject({kind:z65.literal("PROGRAMMATIC"),input:RecordProgrammaticVideoReviewSchema.omit({idempotencyKey:true})}),z65.strictObject({kind:z65.literal("IMAGE"),input:RecordKeyframeReviewSchema.omit({idempotencyKey:true})}),z65.strictObject({kind:z65.literal("VIDEO"),input:RecordVideoReviewSchema.omit({idempotencyKey:true})}),z65.strictObject({kind:z65.literal("ROUGH_CUT"),input:RecordRoughCutReviewSchema.omit({idempotencyKey:true})})]);var ReviewIntelligenceIssueSchema=z65.strictObject({requirement:z65.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema]),observation:z65.union([KeyframeObservationSchema,VideoObservationSchema,RoughCutObservationSchema]),evidenceIds,blocking:z65.boolean(),severity:z65.enum(["BLOCKING","WARNING"]),affectedScope:z65.strictObject({kind:z65.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z65.array(z65.uuid()).min(1).max(200)}).optional()});var ReviewIntelligenceValidationResultSchema=z65.strictObject({semanticStatus:z65.literal("SUCCESS"),advisory:z65.literal(true),basis:ReviewIntelligenceBasisSchema,proposal:ValidateReviewIntelligenceSchema.shape.proposal,canonicalRulePreview:z65.strictObject({source:z65.literal("EXISTING_CANONICAL_DOMAIN_RULES"),authoritative:z65.literal(false),evaluatorVersion:z65.enum(["keyframe-reference-v1","shot-review-v1","production-review-v1"]),result:z65.enum(["PASS","WARNING","FAIL"]),blockingKeys:z65.array(z65.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z65.array(z65.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),issueProposals:z65.array(ReviewIntelligenceIssueSchema).max(MAX_SHOT_REVIEW_REQUIREMENTS),recordDraft:ReviewIntelligenceRecordDraftSchema,limitations:z65.array(z65.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)});export{AgentHostScopeSchema,AgentHostSelectionSchema,ConfigureAgentHostSchema,RevokeAgentHostSchema,AgentHostBindingSchema,UpdateAgentHostSelectionSchema,AgentHostCurrentSchema,AgentHostHistoryQuerySchema,AgentHostHistoryPageSchema,AgentHostReadinessSchema,NativeRuntimePublicKeySchema,ConfigureNativeToolGrantSchema,NativeToolGrantGetSchema,RevokeNativeToolGrantSchema,NativeRuntimeProofRequestSchema,NativeToolGrantViewSchema,ClipTransitionSchema,TimelineGraphicInputSchema,CaptionTranscriptPlanSchema,AuthorTranscriptCaptionsSchema,CaptionContentSchema,CaptionScopeSchema,AuthorCaptionsSchema,CaptionGetSchema,CaptionQuerySchema,CaptionViewSchema,CaptionReceiptSchema,CaptionBasisSchema,CaptionPageSchema,CaptionExportSchema,CaptionSnapshotSchema,CaptionTranscriptDraftSchema,CaptionRenderStyleSchema,AudioScopeSchema,AudioImportRequestSchema,AudioGetSchema,AudioQuerySchema,AudioViewSchema,AudioReceiptSchema,AudioBasisSchema,AudioPageSchema,AudioSnapshotSchema,TimelineAudioInputSchema,ProviderSelectionSchema,ConfigureProviderInputSchema,ProviderConnectionViewSchema,ProviderConnectionCommandSchema,ProviderCredentialRevokeSchema,SetKeyframeDefaultSchema,GenerationCostQuoteSchema,PreparationIdSchema,GenerationContractIdSchema,ContentFingerprintSchema,PreparationTargetSchema,PreparationBasisSchema,ReferenceRoleSchema,ReferenceBindingInputSchema,ExactEvidenceReferenceSchema,PreparationBlockerSchema,ConstraintSetSchema,ReferenceSetSchema,VideoProviderProfileSchema,VideoStartInputSchema,VideoGetInputSchema,VideoQueryInputSchema,VideoAdmissionSchema,VideoTechnicalMetadataSchema,VideoGenerationViewSchema,VideoQueryPageSchema,VideoSummarySchema,RoughCutProfileIdSchema,AcceptedVisualSourceReferenceSchema,SourceSyncAudioStartSchema,SourceSyncAudioGetSchema,SourceSyncAudioVersionSchema,SourceSyncAudioReceiptSchema,SourceSyncAudioViewSchema,SpeechScopeSchema,SpeechStartSchema,SpeechGetSchema,SpeechAdmissionSchema,SpeechGenerationViewSchema,SpeechOptionsSchema,KeyframeProviderProfileSchema,KeyframeStartInputSchema,KeyframeGetInputSchema,KeyframeQueryInputSchema,KeyframeAdmissionSchema,KeyframeGenerationViewSchema,KeyframeQueryPageSchema,KeyframeMediaSchema,KeyframeSummarySchema,ProviderTenantInputSchema,ProviderDefaultViewSchema,ProviderConnectionPageSchema,ProviderModelsViewSchema,ProviderModelViewSchema,ConfigureProviderModelSchema,DisableProviderModelSchema,ProviderModelPageSchema,ProviderModelGetSchema,SoundPlanScopeSchema,SoundPlanValidateSchema,SoundPlanAcceptSchema,SoundPlanGetSchema,SoundPlanValidationSchema,SoundPlanViewSchema,SoundPlanReceiptSchema,SoundPlanContextSchema,VisualFrameSequenceSchema,VisualLayerCompositionSchema,TimelineVisualLayerInputSchema,DeviceRenderTargetSchema,DeviceRenderReceiptSchema,TimelineManifestReaderSchema,TimelineScopeSchema,BuildTimelineShapeSchema,BuildTimelineSchema,TimelineViewSchema,TimelineGetSchema,TimelineQuerySchema,TimelinePageSchema,TimelineBuildReceiptSchema,TimelineBasisSchema,TimelineSnapshotSchema,RoughCutStartSchema,RoughCutGetSchema,RoughCutQuerySchema,RoughCutManifestReaderSchema,RoughCutTechnicalSchema,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,CompositionFindingLocalitySchema,BriefContentSchema,AcceptBriefRequestSchema,AcceptBriefResultSchema,StoryContentSchema,AcceptStoryRequestSchema,StoryVersionSchema,AcceptStoryResultSchema,ConsistencyProfileScopeSchema,ConsistencyProfileVersionQuerySchema,ConfigureConsistencyProfileSchema,ConsistencyProfileVersionSchema,ConsistencyProfileViewSchema,ConsistencyProfileReceiptSchema,RoughCutReviewScopeSchema,RoughCutRequirementSchema,RecordRoughCutReviewSchema,RoughCutReviewRecordSchema,RoughCutReviewTargetSchema,RoughCutFindingViewSchema,RoughCutReviewQuerySchema,RoughCutReviewPageSchema,RoughCutFindingQuerySchema,RoughCutFindingPageSchema,RoughCutReviewReceiptSchema,ReviewEvidenceKeySchema,ReviewEvidenceMediaSchema,MAX_SHOT_REVIEW_REQUIREMENTS,ObservationScopeSchema,ObservationStartSchema,ObservationGetSchema,ObservationAdmissionSchema,ObservationViewSchema,ObservationOptionsSchema,ProductionGuidanceContextSchema,VideoReviewScopeSchema,VideoReviewRequirementSchema,VideoObservationSchema,RecordVideoReviewSchema,VideoReviewRecordSchema,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,ReviewIntelligenceBasisSchema,ValidateReviewIntelligenceSchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema};
@@ -1 +0,0 @@
1
- import{fail,localSocketPath,privateAccess,privateDirectory,read,sha256,sha512}from"./chunk-KB2GVAN7.js";import{CaptionRenderStyleSchema,FinalRenderAdmissionSchema,FinalRenderManifestReaderSchema,FinalRenderStartSchema,KeyframeObservationSchema,NativeRuntimePublicKeySchema,ReviewEvidenceMediaSchema,ReviewIntelligenceBasisSchema,ReviewIntelligenceContextResultSchema,RoughCutAdmissionSchema,RoughCutManifestReaderSchema,RoughCutRequirementSchema,RoughCutStartSchema,RoughCutTechnicalSchema,ValidateReviewIntelligenceSchema,VideoReviewRequirementSchema,VideoTechnicalMetadataSchema,VisualLayerCompositionSchema,VisualRequirementSchema}from"./chunk-PBEHCYR7.js";import{OperationIdSchema}from"./chunk-VPYAXWXY.js";import{NativeStudioSdkError}from"./chunk-6NVIN2NI.js";import{z as z2}from"zod";import{z}from"zod";var LocalIdSchema=z.uuid().transform(v=>v.toLowerCase());var LocalDigestSchema=z.string().length(64).regex(/^[0-9a-f]{64}$/);var LocalRevisionSchema=z.int().positive();var LocalTimeSchema=z.iso.datetime({offset:true});var LocalPackageVersionSchema=z.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=z.strictObject({tenantId:LocalIdSchema,projectId:LocalIdSchema});var LocalWorkScopeSchema=LocalProjectScopeSchema.extend({productionId:LocalIdSchema,runtimeJobId:LocalIdSchema});var LocalPlacementPolicySchema=z.discriminatedUnion("mode",[z.strictObject({mode:z.literal("local-only"),deviceId:LocalIdSchema}),z.strictObject({mode:z.literal("local-preferred"),deviceId:LocalIdSchema}),z.strictObject({mode:z.literal("cloud-only")})]);var LocalPlacementAvailabilitySchema=z.discriminatedUnion("status",[z.strictObject({status:z.literal("AVAILABLE"),deviceId:LocalIdSchema}),z.strictObject({status:z.literal("UNAVAILABLE"),deviceId:LocalIdSchema,reason:z.enum(["OFFLINE","UNQUALIFIED","BUSY"])}),z.strictObject({status:z.literal("DENIED"),reason:z.enum(["FORBIDDEN","APPROVAL_REQUIRED","INVALID_INPUT"])})]);var LocalDevicePlatformSchema=z2.strictObject({os:z2.enum(["darwin","linux","win32"]),architecture:z2.enum(["x64","arm64"])});var EnrollLocalDeviceSchema=z2.strictObject({tenantId:LocalIdSchema,requestId:LocalIdSchema,label:z2.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=z2.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z2.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=z2.strictObject({protocol:z2.literal("NVS_LOCAL_DEVICE_PROOF_V1"),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z2.string().min(1).max(2048),jti:LocalIdSchema,iat:z2.int().nonnegative(),exp:z2.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var ProveLocalDeviceSchema=z2.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,assertion:z2.string().max(4096).regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var GrantLocalDeviceSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema,executionPolicy:z2.literal("DEVICE_ONLY").optional(),deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,expectedRevision:z2.int().nonnegative(),expiresAt:LocalTimeSchema,capability:z2.enum(["ROUGH_CUT_PREVIEW_V1","STUDIO_MEDIA_V2"])});var LocalDeviceGrantSchema=GrantLocalDeviceSchema.omit({requestId:true,expectedRevision:true}).extend({grantId:LocalIdSchema,revision:LocalRevisionSchema,approvedByPrincipalId:LocalIdSchema,createdAt:LocalTimeSchema,revokedAt:LocalTimeSchema.nullable()}).refine(v=>Date.parse(v.expiresAt)>Date.parse(v.createdAt));var RevokeLocalDeviceGrantSchema=LocalProjectScopeSchema.extend({grantId:LocalIdSchema,requestId:LocalIdSchema,expectedRevision:LocalRevisionSchema});var RevokeLocalDeviceSchema=z2.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,requestId:LocalIdSchema,expectedRevision:LocalRevisionSchema});import{z as z5}from"zod";import{z as z4}from"zod";import{z as z3}from"zod";var pixel=z3.int().nonnegative().max(4096);var dimension=z3.int().positive().max(4096);var frame=z3.int().nonnegative().max(1800);var sample=z3.int().nonnegative().max(288e4);var rectangle=z3.strictObject({x:pixel,y:pixel,width:dimension,height:dimension});var window=z3.strictObject({start:sample,count:sample});var source=z3.strictObject({representationId:z3.uuid(),checksum:LocalDigestSchema,byteSize:z3.int().positive().max(134217728)});var LocalMediaRecipeSchema=z3.strictObject({protocol:z3.literal("NVS_RESOLVED_MEDIA_RECIPE_V2"),family:z3.enum(["ROUGH_CUT_RENDER","FINAL_RENDER"]),width:dimension,height:dimension,totalFrames:z3.int().min(900).max(1800),crf:z3.union([z3.literal(18),z3.literal(23)]),algorithm:z3.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),clips:z3.array(z3.strictObject({representationId:z3.uuid(),technical:VideoTechnicalMetadataSchema,sourceInMs:z3.int().nonnegative().max(6e4),sourceOutMs:z3.int().positive().max(6e4),startFrame:frame,frameCount:z3.int().positive().max(1800),overlapFrames:frame,crop:rectangle.nullable(),viewport:rectangle})).min(1).max(32),caption:z3.strictObject({style:CaptionRenderStyleSchema,references:z3.array(z3.strictObject({representationId:z3.uuid(),expectedUtf8:z3.string().max(65536)})).length(2),cues:z3.array(z3.strictObject({ordinal:z3.int().nonnegative().max(512),startFrame:frame,endFrame:frame,fontSize:z3.int().min(16).max(256),margin:pixel,text:z3.string().min(1).max(2e3)})).min(1).max(512)}).nullable(),audio:z3.strictObject({algorithm:z3.literal("PCM_WINDOW_MIX_AAC_V1"),tracks:z3.array(source.extend({channels:z3.union([z3.literal(1),z3.literal(2)]),sampleCount:z3.int().positive().max(288e4),sourceIn:sample,sourceOut:sample,start:sample,count:sample,gain:z3.int().nonnegative().max(1e3),duck:z3.int().nonnegative().max(1e3),duckWindows:z3.array(window).max(512)})).min(1).max(266)}).nullable(),graphics:z3.array(source.extend({contentType:z3.enum(["image/png","image/webp"]),sourceWidth:dimension,sourceHeight:dimension,width:dimension,height:dimension,x:pixel,y:pixel,startFrame:frame,endFrame:frame,opacity:z3.number().min(.1).max(1)})).max(8),visual:z3.strictObject({composition:VisualLayerCompositionSchema,plans:z3.array(z3.strictObject({id:z3.uuid(),startFrame:frame,endFrame:frame,width:dimension,height:dimension,x:pixel,y:pixel,opacityPermille:z3.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"})});var previewProfile=z4.strictObject({kind:z4.literal("ROUGH_CUT_PREVIEW_V1"),profileId:z4.literal("PREVIEW_H264_480P_V1"),contractDigest:LocalDigestSchema});var studioProfile=z4.strictObject({kind:z4.literal("STUDIO_MEDIA_V2"),profileId:z4.literal("STUDIO_MEDIA_V2"),contractDigest:LocalDigestSchema});var LocalExecutionProfileSchema=z4.discriminatedUnion("kind",[previewProfile,studioProfile]);var LocalToolchainSchema=z4.strictObject({platform:LocalDevicePlatformSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema,ffmpeg:z4.strictObject({version:z4.string().min(1).max(160),binaryDigest:LocalDigestSchema}),ffprobe:z4.strictObject({version:z4.string().min(1).max(160),binaryDigest:LocalDigestSchema}),profile:LocalExecutionProfileSchema,supported:z4.array(z4.strictObject({profile:LocalExecutionProfileSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema})).max(4).optional()});var frozen=LocalWorkScopeSchema.extend({protocol:z4.literal("NVS_LOCAL_WORK_V1"),operationId:OperationIdSchema,renderId:LocalIdSchema,productionRevision:LocalRevisionSchema,executionClass:z4.enum(["LIVE","TEST_ONLY"]),policy:LocalPlacementPolicySchema,profile:previewProfile,manifest:RoughCutManifestReaderSchema,manifestFingerprint:LocalDigestSchema,sources:z4.array(z4.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z4.int().positive(),contentType:z4.string().min(1).max(100)})).min(1).max(512)});var studio=frozen.extend({protocol:z4.literal("NVS_LOCAL_WORK_V2"),profile:studioProfile,manifest:z4.union([RoughCutManifestReaderSchema,FinalRenderManifestReaderSchema]),recipe:LocalMediaRecipeSchema,recipeFingerprint:LocalDigestSchema});var LocalFrozenWorkSchema=z4.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(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:z4.string().min(1).max(200),workFingerprint:LocalDigestSchema,toolchainFingerprint:LocalDigestSchema});var target=z4.discriminatedUnion("kind",[z4.strictObject({kind:z4.literal("DEVICE"),deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,grantId:LocalIdSchema,grantRevision:LocalRevisionSchema}),z4.strictObject({kind:z4.literal("SERVER")})]);var LocalExecutionLeaseSchema=LocalLeaseBindingSchema.extend({target,issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema}).refine(v=>Date.parse(v.expiresAt)>Date.parse(v.issuedAt));var LocalWorkAssignmentSchema=z4.strictObject({work:LocalFrozenWorkSchema,lease:LocalExecutionLeaseSchema,toolchain:LocalToolchainSchema}).superRefine(({work,lease,toolchain},ctx)=>{if(["tenantId","projectId","productionId","runtimeJobId"].some(k=>work[k]!==lease[k]))ctx.addIssue({code:"custom",message:"Assignment work scope mismatch"});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"})});var StartLocalPreviewSchema=RoughCutStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema,localProfile:z5.literal("STUDIO_MEDIA_V2").optional()});var LocalDeviceScopeSchema=z5.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema});var LocalDeviceSessionSchema=z5.strictObject({...LocalDeviceScopeSchema.shape,expiresAt:LocalTimeSchema,credential:z5.string().length(43).regex(/^[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var LocalDeviceHeartbeatSchema=LocalDeviceScopeSchema.extend({toolchain:LocalToolchainSchema,available:z5.boolean(),maxConcurrentJobs:z5.int().min(1).max(2).optional()});var ClaimLocalPreviewSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema,deviceId:LocalIdSchema});var LocalOutputStageSchema=LocalLeaseBindingSchema.extend({uploadRequestId:LocalIdSchema,role:z5.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z5.int().positive().max(128*1024*1024)});var LocalOutputTicketSchema=z5.strictObject({receiptId:LocalIdSchema,role:z5.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z5.int().positive(),uploaded:z5.boolean()});var LocalSourceRequestSchema=LocalLeaseBindingSchema.extend({representationId:LocalIdSchema});var LocalProofChallengeRequestSchema=LocalDeviceScopeSchema.extend({deviceRevision:z5.int().positive()});var LocalPreviewPlacementViewSchema=z5.strictObject({target:z5.enum(["DEVICE","SERVER"]),reason:z5.enum(["LOCAL_AVAILABLE","CLOUD_ONLY","OFFLINE","UNQUALIFIED","BUSY","LEASE_RECOVERY"]),policy:LocalPlacementPolicySchema});var LocalDeviceTransportConfigurationSchema=z5.strictObject({endpoint:z5.string().url().max(2048),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:z5.int().positive(),projects:z5.array(LocalProjectScopeSchema).min(1).max(20),privateKeyFile:z5.string().min(1).max(4096),platform:LocalDevicePlatformSchema});var LocalPreviewAdmissionSchema=RoughCutAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var StartLocalFinalRenderSchema=FinalRenderStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema});var LocalFinalRenderAdmissionSchema=FinalRenderAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var LocalClaimReceiptSchema=z5.strictObject({found:z5.boolean(),assignment:LocalWorkAssignmentSchema.nullable()});var LocalWorkStateSchema=z5.strictObject({binding:LocalLeaseBindingSchema,status:z5.enum(["ACTIVE","FENCED","OUTCOME_UNKNOWN"]),assignment:LocalWorkAssignmentSchema.nullable()});import{z as z14}from"zod";import{z as z7}from"zod";import{z as z6}from"zod";var executable=z6.strictObject({path:z6.string().min(1).max(4096),digest:LocalDigestSchema});var LocalToolSelectionSchema=z6.strictObject({mode:z6.enum(["MANAGED","INSTALLED"]),ffmpeg:executable,ffprobe:executable});var LocalRuntimeDescriptorSchema=z7.strictObject({protocol:z7.literal("NVS_RUNTIME_DESCRIPTOR_V1"),version:LocalPackageVersionSchema,node:z7.strictObject({major:z7.literal(24),minMinor:z7.literal(12)}),platform:LocalDevicePlatformSchema,ipcProtocol:z7.literal("NVS_LOCAL_IPC_V1"),workProtocol:z7.enum(["NVS_LOCAL_WORK_V1","NVS_LOCAL_WORK_V2"]),journalSchema:z7.literal(1),rendererDigest:LocalDigestSchema,profileDigest:LocalDigestSchema,compatibleRenderers:z7.array(z7.strictObject({rendererDigest:LocalDigestSchema,profileDigest:LocalDigestSchema})).max(4).optional()});var LocalSessionConnectorSchema=z7.strictObject({protocol:z7.literal("NVS_LOCAL_CONNECTOR_V1"),stateDirectory:z7.string().min(1).max(4096),credential:z7.string().length(43).regex(/^[A-Za-z0-9_-]{43}$/),expiresAt:LocalTimeSchema,projects:z7.array(LocalProjectScopeSchema).min(1).max(100)});var LocalManagementInventorySchema=z7.strictObject({runtimeRevision:z7.int().positive(),descriptor:LocalRuntimeDescriptorSchema,activeProcesses:z7.int().nonnegative(),pendingExecutions:z7.int().nonnegative(),pendingRequests:z7.int().nonnegative(),pendingRenderers:z7.array(LocalDigestSchema).max(64)});var LocalReleaseAssetSchema=z7.strictObject({url:z7.string().url().max(2048),byteSize:z7.int().positive().max(256*1024*1024),sha512:z7.string().length(128).regex(/^[0-9a-f]{128}$/)});var LocalReleaseSchema=z7.strictObject({descriptor:LocalRuntimeDescriptorSchema,package:LocalReleaseAssetSchema,tools:z7.strictObject({ffmpeg:LocalReleaseAssetSchema.extend({sha256:LocalDigestSchema}),ffprobe:LocalReleaseAssetSchema.extend({sha256:LocalDigestSchema})}).nullable()});var LocalReleaseCatalogueSchema=z7.strictObject({protocol:z7.literal("NVS_LOCAL_RELEASE_CATALOGUE_V1"),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema,releases:z7.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=z7.strictObject({catalogue:LocalReleaseCatalogueSchema,signature:z7.string().length(86).regex(/^[A-Za-z0-9_-]{85}[AQgw]$/)});var LocalToolChoiceSchema=z7.discriminatedUnion("mode",[z7.strictObject({mode:z7.literal("MANAGED")}),LocalToolSelectionSchema.extend({mode:z7.literal("INSTALLED")})]);var LocalUpdatePlanSchema=z7.strictObject({protocol:z7.literal("NVS_LOCAL_UPDATE_PLAN_V1"),planId:LocalIdSchema,installationRevision:z7.int().nonnegative(),runtimeRevision:z7.int().positive().nullable(),catalogueFingerprint:LocalDigestSchema,trustFingerprint:LocalDigestSchema.optional(),release:LocalReleaseSchema,toolSelection:LocalToolChoiceSchema.optional(),fingerprint:LocalDigestSchema,createdAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var LocalClientNextActionSchema=z7.strictObject({surface:z7.enum(["CLI","LOCAL_IPC","REMOTE"]),operation:z7.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:z7.enum(["AVAILABLE","BLOCKED"]),reason:z7.enum(["READY","INSTALL_REQUIRED","AUTHORIZATION_REQUIRED","VERSION_INCOMPATIBLE","UPDATE_AVAILABLE","RECOVERY_REQUIRED","USER_APPROVAL_REQUIRED","TRUST_REQUIRED","UNAVAILABLE"])});import{z as z13}from"zod";import{z as z8}from"zod";var LocalOfflineSnapshotSchema=z8.strictObject({projectId:z8.uuid(),title:z8.string().min(1).max(200),savedAt:LocalTimeSchema,expiresAt:LocalTimeSchema,productions:z8.array(z8.strictObject({id:z8.uuid(),title:z8.string().max(200)})).max(40),possiblyTruncated:z8.boolean()}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=8192);var text=z8.string().max(4e3).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=8192);var LocalOfflineCallSchema=z8.discriminatedUnion("action",[z8.strictObject({action:z8.enum(["list","forget"]),key:LocalDigestSchema}),z8.strictObject({action:z8.literal("retain"),key:LocalDigestSchema,snapshot:LocalOfflineSnapshotSchema}),z8.strictObject({action:z8.literal("draft"),key:LocalDigestSchema,projectId:z8.uuid(),text,expectedRevision:z8.int().nonnegative()})]);var LocalOfflinePageSchema=z8.strictObject({historical:z8.literal(true),items:z8.array(z8.strictObject({snapshot:LocalOfflineSnapshotSchema,draft:z8.strictObject({text,revision:z8.int().nonnegative()})})).max(3)});import{z as z10}from"zod";import{z as z9}from"zod";var QualifiedLocalAgentVersionSchema=z9.enum(["0.164.0","0.165.0"]);var LocalAgentGrantSchema=z9.strictObject({protocol:z9.literal("NVS_CODEX_REVIEW_GRANT_V1"),binary:z9.string().min(1).max(4096).refine(v=>/^(?:\/|[A-Za-z]:[\\/])/.test(v)),binaryDigest:z9.string().regex(/^[a-f0-9]{64}$/),version:QualifiedLocalAgentVersionSchema,model:z9.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/),reasoningEffort:z9.enum(["low","medium","high","xhigh"]).optional(),reviewerLabel:z9.string().trim().min(1).max(100),inference:z9.literal("REMOTE_OPENAI"),remoteUseApproved:z9.literal(true),imageDisclosureApproved:z9.literal(true).optional(),mediaDisclosureApproved:z9.literal(true).optional(),projects:z9.array(LocalProjectScopeSchema).min(1).max(100),expiresAt:z9.iso.datetime({offset:true})});var LocalAgentMediaInputSchema=z10.strictObject({profile:z10.literal("NVS_AGENT_DERIVED_EVIDENCE_V1"),contentType:z10.enum(["image/png","image/jpeg","image/webp","video/mp4"]),byteSize:z10.int().positive().max(134217728),width:z10.int().positive().max(4096),height:z10.int().positive().max(4096),durationMs:z10.int().positive().max(6e4).optional(),frameRate:z10.union([z10.literal(24),z10.literal(30)]).optional(),hasAudio:z10.boolean().optional()}).refine(v=>v.contentType==="video/mp4"?!!v.durationMs&&!!v.frameRate:!v.durationMs&&!v.frameRate&&v.hasAudio===void 0);var sha=z10.string().regex(/^[a-f0-9]{64}$/);var LocalAgentEvidenceReceiptSchema=z10.strictObject({protocol:z10.literal("NVS_AGENT_DERIVED_EVIDENCE_V1"),draftId:z10.uuid(),media:ReviewEvidenceMediaSchema,ffmpegDigest:sha,ffprobeDigest:sha,attachment:z10.strictObject({checksumSha256:sha,byteSize:z10.int().positive().max(8388608),width:z10.int().positive().max(4096),height:z10.int().positive().max(4096)}),timestampsMs:z10.array(z10.number().nonnegative().max(6e4)).max(6),audio:z10.strictObject({sampleRateHz:z10.literal(48e3),channels:z10.literal(1),samples:z10.int().positive().max(2881024),peak:z10.number().min(0).max(1),rms:z10.number().min(0).max(1),clippedSamples:z10.int().nonnegative().max(2881024)}).nullable(),limitations:z10.tuple([z10.literal("SAMPLED_FRAMES_ARE_NOT_FULL_PLAYBACK"),z10.literal("AUDIO_STATISTICS_ARE_NOT_LISTENING_OR_TRANSCRIPTION")])});var LocalAgentDiscoverySchema=z10.strictObject({candidate:z10.strictObject({binary:z10.string().min(1).max(4096),binaryDigest:sha,version:z10.string().regex(/^\d+\.\d+\.\d+$/),qualified:z10.boolean()}).nullable(),configured:LocalAgentGrantSchema.nullable()});import{z as z11}from"zod";var LocalResourcePolicySchema=z11.strictObject({mode:z11.enum(["CONTINUOUS","IDLE_ONLY"]).default("CONTINUOUS"),idleAfterSeconds:z11.int().min(30).max(3600).default(300),maxConcurrentJobs:z11.int().min(1).max(2).default(1),cpuCores:z11.union([z11.literal(1),z11.literal(2)]).default(2),memoryMiB:z11.int().min(512).max(4096).default(4096),cacheQuotaBytes:z11.int().min(512*1024*1024).max(32*1024*1024*1024).default(1024*1024*1024)});var LocalResourceSettingsSchema=z11.strictObject({revision:z11.int().nonnegative(),policy:LocalResourcePolicySchema});var LocalExecutionProgressSchema=z11.strictObject({stage:z11.enum(["WAITING","DOWNLOADING","EXECUTING","UPLOADING","AWAITING_ACCEPTANCE","COMPLETE","RECOVERY_REQUIRED","FENCED"]),downloadedBytes:z11.int().nonnegative(),sourceBytes:z11.int().nonnegative(),uploadedBytes:z11.int().nonnegative(),outputBytes:z11.int().nonnegative(),lastError:z11.strictObject({code:z11.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),observedAt:LocalTimeSchema}).nullable()});var LocalStorageInspectionSchema=z11.strictObject({cacheBytes:z11.int().nonnegative(),protectedBytes:z11.int().nonnegative(),reclaimableBytes:z11.int().nonnegative(),transferBytes:z11.int().nonnegative(),journalBytes:z11.int().nonnegative(),reviewBytes:z11.int().nonnegative().optional(),ownerStagingBytes:z11.int().nonnegative().optional(),availableDiskBytes:z11.int().nonnegative(),quotaBytes:z11.int().positive(),overQuota:z11.boolean()});var LocalWorkspaceInspectionSchema=z11.strictObject({settings:LocalResourceSettingsSchema,storage:LocalStorageInspectionSchema,scheduling:z11.strictObject({state:z11.enum(["READY","WAITING_FOR_IDLE","AT_CAPACITY","DRAINING"]),activeJobs:z11.int().nonnegative(),idleObservationCurrent:z11.boolean()})});var LocalDiagnosticsSchema=z11.strictObject({protocol:z11.literal("NVS_LOCAL_DIAGNOSTICS_V1"),createdAt:LocalTimeSchema,runtimeVersion:z11.string().min(1).max(80),runtimeRevision:LocalRevisionSchema,settings:LocalResourceSettingsSchema,storage:LocalStorageInspectionSchema,recordCounts:z11.record(z11.string().regex(/^[A-Z_]{1,40}$/),z11.int().nonnegative()),failures:z11.array(z11.strictObject({taskFingerprint:z11.string().regex(/^[a-f0-9]{64}$/),code:z11.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),observedAt:LocalTimeSchema})).max(32)});import{z as z12}from"zod";function canonicalLocalJson(value){if(value===null||typeof value==="string"||typeof value==="boolean")return JSON.stringify(value);if(typeof value==="number"&&Number.isFinite(value))return JSON.stringify(value);if(Array.isArray(value))return"["+value.map(canonicalLocalJson).join(",")+"]";if(typeof value==="object")return"{"+Object.entries(value).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")}var sha2=z12.string().regex(/^[a-f0-9]{64}$/);var qualifiedVersion=QualifiedLocalAgentVersionSchema;var LocalAgentSnapshotSchema=z12.strictObject({basis:ReviewIntelligenceBasisSchema,productionRevision:z12.int().positive(),reviewVersion:z12.int().nonnegative(),executionClass:z12.enum(["LIVE","TEST_ONLY"]),media:ReviewEvidenceMediaSchema,requirements:z12.array(z12.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema])).min(1).max(64),evidence:LocalAgentMediaInputSchema.optional(),image:z12.strictObject({contentType:z12.literal("image/png"),byteSize:z12.int().positive().max(8388608),width:z12.int().positive().max(4096),height:z12.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=z12.strictObject({configured:z12.boolean(),available:z12.boolean(),reason:z12.enum(["GRANT_REQUIRED","READY","RUNTIME_UNAVAILABLE","GRANT_EXPIRED"]),grantFingerprint:sha2.nullable(),inference:z12.literal("REMOTE_OPENAI")});var LocalAgentPlanSchema=z12.strictObject({protocol:z12.enum(["NVS_LOCAL_AGENT_REVIEW_V1","NVS_LOCAL_AGENT_REVIEW_V2"]),id:z12.uuid(),grantFingerprint:sha2,snapshot:LocalAgentSnapshotSchema,expiresAt:z12.iso.datetime({offset:true}),fingerprint:sha2});var LocalAgentMetadataAnswerSchema=z12.strictObject({summary:z12.string().trim().min(1).max(1500),observations:z12.array(z12.strictObject({key:z12.string().min(1).max(220),observed:z12.string().trim().min(1).max(1e3)})).min(1).max(64)});var LocalAgentPixelAnswerSchema=z12.strictObject({summary:z12.string().trim().min(1).max(1500),imageReadback:z12.string().trim().min(1).max(800),observations:z12.array(KeyframeObservationSchema.omit({region:true}).extend({key:z12.string().min(1).max(220)})).min(1).max(64)});var LocalAgentAnswerSchema=z12.union([LocalAgentMetadataAnswerSchema,LocalAgentPixelAnswerSchema]).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=96*1024);var LocalAgentImageReceiptSchema=z12.strictObject({protocol:z12.literal("NVS_LOCAL_AGENT_IMAGE_V1"),draftId:z12.uuid(),media:ReviewEvidenceMediaSchema,byteSize:z12.int().positive().max(8388608),contentType:z12.literal("image/png"),width:z12.int().positive().max(4096),height:z12.int().positive().max(4096)});var LocalAgentReviewViewSchema=z12.strictObject({plan:LocalAgentPlanSchema,revision:z12.int().positive(),phase:z12.enum(["PREPARED","RUNNING","RESULT_PENDING","UNKNOWN"]),answer:LocalAgentAnswerSchema.nullable(),imageReceipt:LocalAgentImageReceiptSchema.optional(),evidenceReceipt:LocalAgentEvidenceReceiptSchema.optional(),provenance:z12.strictObject({adapter:z12.enum(["CODEX_METADATA_V1","CODEX_MEDIA_V2"]),binaryDigest:sha2,version:qualifiedVersion,model:z12.string().max(100),reasoningEffort:z12.enum(["low","medium","high","xhigh"]).optional(),reviewerLabel:z12.string().max(100),inference:z12.literal("REMOTE_OPENAI"),evidence:z12.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 projectInput=LocalProjectScopeSchema;var LocalExecutionListInputSchema=LocalProjectScopeSchema.extend({after:z13.string().length(64).regex(/^[0-9a-f]{64}$/).nullable().default(null),limit:z13.int().min(1).max(16).default(8),includeCompleted:z13.boolean().optional(),includeProgress:z13.boolean().optional()});var LocalExecutionInspectInputSchema=LocalWorkScopeSchema.extend({includeProgress:z13.boolean().optional()});var LocalIpcCallSchema=z13.discriminatedUnion("operation",[z13.strictObject({operation:z13.literal("agent.discover"),binary:z13.string().min(1).max(4096).optional()}),z13.strictObject({operation:z13.literal("offline.workspace"),input:LocalOfflineCallSchema}),z13.strictObject({operation:z13.literal("workspace.inspect")}),z13.strictObject({operation:z13.literal("workspace.configure"),policy:LocalResourcePolicySchema,expectedRevision:z13.int().nonnegative()}),z13.strictObject({operation:z13.literal("workspace.activity"),idleSeconds:z13.int().min(0).max(86400),observedAt:z13.iso.datetime()}),z13.strictObject({operation:z13.literal("storage.clean")}),z13.strictObject({operation:z13.literal("diagnostics.read")}),z13.strictObject({operation:z13.literal("agent.grant"),grant:LocalAgentGrantSchema,approval:z13.string().regex(/^[a-f0-9]{64}$/)}),z13.strictObject({operation:z13.literal("agent.probe")}),z13.strictObject({operation:z13.literal("agent.revoke"),approval:z13.string().regex(/^[a-f0-9]{64}$/)}),z13.strictObject({operation:z13.literal("agent.prepare"),snapshot:LocalAgentSnapshotSchema}),z13.strictObject({operation:z13.literal("agent.start"),id:z13.uuid(),expectedRevision:LocalRevisionSchema,approval:z13.string().regex(/^[a-f0-9]{64}$/)}),z13.strictObject({operation:z13.literal("agent.inspect"),id:z13.uuid()}),z13.strictObject({operation:z13.literal("runtime.status"),includeDevice:z13.literal(true).optional()}),z13.strictObject({operation:z13.literal("runtime.doctor")}),z13.strictObject({operation:z13.literal("runtime.inventory")}),z13.strictObject({operation:z13.literal("session.issue"),projects:z13.array(projectInput).min(1).max(100),expiresAt:z13.iso.datetime({offset:true})}),z13.strictObject({operation:z13.literal("runtime.stop"),expectedRuntimeRevision:LocalRevisionSchema}),z13.strictObject({operation:z13.literal("execution.inspect"),input:LocalExecutionInspectInputSchema}),z13.strictObject({operation:z13.literal("execution.list"),input:LocalExecutionListInputSchema}),z13.strictObject({operation:z13.literal("update.check")}),z13.strictObject({operation:z13.literal("update.prepare"),targetVersion:LocalPackageVersionSchema,expectedRuntimeRevision:LocalRevisionSchema}),z13.strictObject({operation:z13.literal("update.apply"),planId:LocalIdSchema,targetVersion:LocalPackageVersionSchema,expectedRuntimeRevision:LocalRevisionSchema})]);var LocalNextActionSchema=z13.strictObject({call:LocalIpcCallSchema,availability:z13.enum(["AVAILABLE","BLOCKED"]),reason:z13.enum(["READY","INSTALL_REQUIRED","AUTHORIZATION_REQUIRED","VERSION_INCOMPATIBLE","UPDATE_AVAILABLE","RECOVERY_REQUIRED"])});var LocalIpcRequestSchema=z13.strictObject({protocol:z13.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema,call:LocalIpcCallSchema});var LocalVersionReportSchema=z13.strictObject({component:z13.enum(["CLI","SDK","MCP","RUNTIME","MEDIA_TOOLS"]),installedVersion:LocalPackageVersionSchema.nullable(),runningVersion:LocalPackageVersionSchema.nullable(),availableVersion:LocalPackageVersionSchema.nullable(),executablePath:z13.string().min(1).max(4096).nullable(),installOwner:z13.enum(["NPM_GLOBAL","PROJECT","NPX","MANAGED","TARBALL","UNKNOWN"])});var LocalRuntimeStatusSchema=z13.strictObject({protocol:z13.literal("NVS_LOCAL_IPC_V1"),runtimeRevision:LocalRevisionSchema,state:z13.enum(["IDLE","EXECUTING","DRAINING","RECOVERY_REQUIRED"]),journalSchemaVersion:z13.literal(1),workProtocols:z13.array(z13.enum(["NVS_LOCAL_WORK_V1","NVS_LOCAL_WORK_V2"])).min(1).max(2),versions:z13.array(LocalVersionReportSchema).max(8),authorizedProjects:z13.array(projectInput).max(100),deviceAuthority:z13.strictObject({tenantId:z13.uuid(),deviceId:z13.uuid(),origin:z13.url()}).optional(),nextActions:z13.array(LocalNextActionSchema).max(8)});var LocalDoctorReportSchema=z13.strictObject({mode:z13.enum(["MANAGED","INSTALLED"]),availability:z13.enum(["AVAILABLE","UNAVAILABLE"]),reason:z13.enum(["QUALIFIED_PROCESS_TOOLS","MANAGED_TOOLS_MISSING","TOOL_QUALIFICATION_FAILED"]),nativeExecutionReady:z13.boolean(),executionProfiles:z13.array(z13.enum(["ROUGH_CUT_PREVIEW_V1","STUDIO_MEDIA_V2"])).max(2).optional(),tools:z13.array(z13.strictObject({name:z13.enum(["FFMPEG","FFPROBE"]),path:z13.string().min(1).max(4096),version:z13.string().min(1).max(200),digest:z13.string().regex(/^[0-9a-f]{64}$/)})).max(2)});var LocalExecutionInspectionSchema=z13.strictObject({binding:LocalLeaseBindingSchema,revision:LocalRevisionSchema,phase:z13.enum(["STAGED","RUNNING","RECOVERY_REQUIRED","OUTPUT_PENDING","RECEIPT_RECORDED","FENCED"]),checkpoint:z13.enum(["ADOPTED","SOURCES_READY","PROCESS_STARTED","OUTPUT_STAGED"]),progress:LocalExecutionProgressSchema.optional()});var LocalExecutionPageSchema=z13.strictObject({items:z13.array(LocalExecutionInspectionSchema).max(16),nextCursor:z13.string().length(64).regex(/^[0-9a-f]{64}$/).nullable()});var LocalIpcErrorCodeSchema=z13.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"]);var LocalIpcResponseSchema=z13.discriminatedUnion("semanticStatus",[z13.strictObject({protocol:z13.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema,semanticStatus:z13.literal("SUCCESS"),data:z13.union([LocalWorkspaceInspectionSchema,LocalDiagnosticsSchema,LocalOfflinePageSchema,LocalRuntimeStatusSchema,LocalDoctorReportSchema,LocalExecutionInspectionSchema.nullable(),z13.strictObject({state:z13.literal("DRAINING"),inventory:LocalManagementInventorySchema.optional(),backupPath:z13.string().min(1).max(4096).optional()}),LocalSessionConnectorSchema,LocalManagementInventorySchema,LocalExecutionPageSchema,LocalAgentProbeSchema,LocalAgentDiscoverySchema,LocalAgentReviewViewSchema])}),z13.strictObject({protocol:z13.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema.nullable(),semanticStatus:z13.enum(["BLOCKED","INVALID_INPUT"]),error:z13.strictObject({code:LocalIpcErrorCodeSchema})})]);var LocalMcpToolNameSchema=z14.enum(["local_navigate","local_capability_describe","local_runtime_status","local_execution_list","local_execution_inspect","local_update_check"]);var LocalMcpActionSchema=z14.strictObject({tool:LocalMcpToolNameSchema,arguments:z14.record(z14.string(),z14.unknown()),availability:z14.enum(["AVAILABLE","BLOCKED"]).optional(),reason:z14.string().max(100).optional()});var LocalMcpNavigationSchema=z14.strictObject({location:z14.literal("LOCAL"),state:z14.enum(["UNAVAILABLE","IDLE","EXECUTING","DRAINING","RECOVERY_REQUIRED"]),authorizedProjects:z14.array(LocalProjectScopeSchema).max(100).optional(),groups:z14.array(z14.strictObject({id:z14.string().max(40),label:z14.string().max(100),tools:z14.array(LocalMcpToolNameSchema).max(6)})).max(4),nextActions:z14.array(z14.union([LocalMcpActionSchema,LocalClientNextActionSchema])).max(16)});var LocalMcpExecutionPageSchema=LocalExecutionPageSchema.extend({nextActions:z14.array(LocalMcpActionSchema).max(16)});var LocalMcpInspectionSchema=z14.strictObject({location:z14.literal("LOCAL"),execution:LocalExecutionInspectionSchema.nullable(),nextActions:z14.array(LocalMcpActionSchema).max(4)});var LocalMcpUpdateSchema=z14.strictObject({location:z14.literal("LOCAL"),running:z14.array(LocalVersionReportSchema).max(8),available:z14.array(LocalRuntimeDescriptorSchema).max(32),nextActions:z14.array(LocalClientNextActionSchema).max(4)});var LocalMcpDescriptionSchema=z14.strictObject({location:z14.literal("LOCAL"),tool:LocalMcpToolNameSchema,schema:z14.object({name:LocalMcpToolNameSchema,description:z14.string(),inputSchema:z14.record(z14.string(),z14.unknown())}).passthrough()});var LocalMcpFailureSchema=z14.strictObject({semanticStatus:z14.enum(["BLOCKED","INVALID_INPUT"]),error:z14.strictObject({code:z14.enum(["AUTHORIZATION_REQUIRED","FORBIDDEN","LOCAL_RUNTIME_UNAVAILABLE","RELEASE_UNAVAILABLE","VERSION_INCOMPATIBLE","INVALID_INPUT","LOCAL_CAPABILITY_UNAVAILABLE"]),outcome:z14.literal("NO_WRITE")}),nextActions:z14.array(LocalClientNextActionSchema).max(4)});var LocalMcpOutputSchemas={local_navigate:LocalMcpNavigationSchema,local_capability_describe:LocalMcpDescriptionSchema,local_runtime_status:LocalRuntimeStatusSchema.omit({nextActions:true}).extend({nextActions:z14.array(LocalMcpActionSchema).max(8)}),local_execution_list:LocalMcpExecutionPageSchema,local_execution_inspect:LocalMcpInspectionSchema,local_update_check:LocalMcpUpdateSchema};import{z as z15}from"zod";var LocalManagementCommandSchema=z15.discriminatedUnion("kind",[z15.strictObject({kind:z15.literal("ENROLL"),input:EnrollLocalDeviceSchema}),z15.strictObject({kind:z15.literal("GRANT"),input:GrantLocalDeviceSchema}),z15.strictObject({kind:z15.literal("REVOKE_GRANT"),input:RevokeLocalDeviceGrantSchema}),z15.strictObject({kind:z15.literal("PREVIEW"),input:StartLocalPreviewSchema}),z15.strictObject({kind:z15.literal("FINAL_RENDER"),input:StartLocalFinalRenderSchema})]);var LocalManagementResultSchema=z15.union([LocalDeviceViewSchema,LocalDeviceGrantSchema,LocalPreviewAdmissionSchema,LocalFinalRenderAdmissionSchema,z15.strictObject({semanticStatus:z15.literal("SUCCESS")})]);var LocalManagementReceiptSchema=z15.strictObject({fingerprint:z15.string().regex(/^[a-f0-9]{64}$/),result:LocalManagementResultSchema.nullable()});import{z as z17}from"zod";import{createHash}from"node:crypto";function localBudget(timeoutMs,parent,ceiling=6e4){if(!Number.isInteger(timeoutMs)||timeoutMs<1||timeoutMs>ceiling)throw Error("LOCAL_DEADLINE_INVALID");const controller=new AbortController,timer=setTimeout(()=>controller.abort(),timeoutMs);return{signal:parent?AbortSignal.any([parent,controller.signal]):controller.signal,close:()=>clearTimeout(timer)}}async function localAbortable(work,signal){if(signal.aborted)void work.catch(()=>{});signal.throwIfAborted();return new Promise((resolve,reject)=>{const abort=()=>reject(Error("LOCAL_DEADLINE"));signal.addEventListener("abort",abort,{once:true});work.then(v=>{signal.removeEventListener("abort",abort);resolve(v)},e=>{signal.removeEventListener("abort",abort);reject(e)});if(signal.aborted)abort()})}import{z as z16}from"zod";var output=z16.discriminatedUnion("role",[z16.strictObject({role:z16.literal("VIDEO"),receiptId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z16.int().positive().max(128*1024*1024),contentType:z16.literal("video/mp4")}),z16.strictObject({role:z16.literal("POSTER"),receiptId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z16.int().positive().max(2*1024*1024),contentType:z16.literal("image/png")})]);var LocalCompletionSubmissionSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputs:z16.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=z16.strictObject({binding:LocalLeaseBindingSchema,output,verifiedAt:LocalTimeSchema});var LocalCompletionReceiptSchema=LocalLeaseBindingSchema.extend({submissionFingerprint:LocalDigestSchema.optional(),semanticStatus:z16.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});var NativeStudioLocalDeviceClient=class{constructor(options){this.options=options;const u=new URL(options.baseUrl);if(u.username||u.password||u.search||u.hash||u.pathname!=="/"||u.protocol!=="https:"&&!(u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname)))throw new NativeStudioSdkError("INVALID_INPUT","INVALID_INPUT","NO_WRITE");this.origin=u.origin}options;origin;async command(route,raw,input,output2,signal,readOnly=false){let started=false;const budget=localBudget(15e3,signal);try{const i=input.parse(raw);if((i.tenantId??i.input?.tenantId)!==this.options.tenantId)throw Error();budget.signal.throwIfAborted();const authorization=await localAbortable(Promise.resolve().then(()=>this.options.authorization()),budget.signal);if(authorization!==authorization.trim()||!/^Bearer [A-Za-z0-9._~-]{1,8192}$/.test(authorization))throw Error();const body=JSON.stringify(i);if(Buffer.byteLength(body)>65536)throw Error();budget.signal.throwIfAborted();started=true;const r=await fetch(this.origin+"/v1/local-execution/"+route,{method:"POST",headers:{authorization,"content-type":"application/json"},body,redirect:"error",signal:budget.signal});if(!r.ok){await r.body?.cancel();throw new NativeStudioSdkError(r.status===403||r.status===401?"FORBIDDEN":"LOCAL_COMMAND_REFUSED","BLOCKED",readOnly?"NO_WRITE":r.status>=500?"UNKNOWN":"REJECTED",r.status)}const parts=[];let size=0;for await(const b of r.body??[]){size+=b.length;if(size>262144)throw Error();parts.push(b)}const value=output2.parse(JSON.parse(Buffer.concat(parts).toString()));if(value&&typeof value==="object"){const result=value,request3=i;for(const key of["tenantId","projectId","deviceId"])if(key in result&&key in request3&&result[key]!==request3[key])throw Error()}return value}catch(e){if(e instanceof NativeStudioSdkError)throw e;throw new NativeStudioSdkError(started?readOnly?"LOCAL_QUERY_UNAVAILABLE":"LOCAL_COMMAND_UNKNOWN":"INVALID_INPUT",started?"BLOCKED":"INVALID_INPUT",started&&!readOnly?"UNKNOWN":"NO_WRITE")}finally{budget.close()}}enroll(input,signal){return this.command("devices/enroll",input,EnrollLocalDeviceSchema,LocalDeviceViewSchema,signal)}async managementReceipt(input,signal){const parsedInput=LocalManagementCommandSchema.safeParse(input);if(!parsedInput.success)throw new NativeStudioSdkError("INVALID_INPUT","INVALID_INPUT","NO_WRITE");const parsed=parsedInput.data;const value=await this.command("management-receipt",input,LocalManagementCommandSchema,LocalManagementReceiptSchema,signal,true);if(value.fingerprint!==createHash("sha256").update(canonicalLocalJson(parsed)).digest("hex"))throw new NativeStudioSdkError("LOCAL_RECEIPT_INVALID","BLOCKED","NO_WRITE");if(value.result){const result=value.result,original=parsed.input;for(const key of["tenantId","projectId","deviceId","productionId","timelineVersionId"])if(key in original&&key in result&&result[key]!==original[key])throw new NativeStudioSdkError("LOCAL_RECEIPT_INVALID","BLOCKED","NO_WRITE")}return value}grant(input,signal){return this.command("devices/grant",input,GrantLocalDeviceSchema,LocalDeviceGrantSchema,signal)}revokeDevice(input,signal){return this.command("devices/revoke",input,RevokeLocalDeviceSchema,z17.strictObject({semanticStatus:z17.literal("SUCCESS")}),signal)}revokeGrant(input,signal){return this.command("devices/revoke-grant",input,RevokeLocalDeviceGrantSchema,z17.strictObject({semanticStatus:z17.literal("SUCCESS")}),signal)}startPreview(input,signal){return this.command("previews",input,StartLocalPreviewSchema,LocalPreviewAdmissionSchema,signal)}startFinal(input,signal){return this.command("final-renders",input,StartLocalFinalRenderSchema,LocalFinalRenderAdmissionSchema,signal)}};import{randomUUID,createHash as createHash2}from"node:crypto";import{request}from"node:http";import{z as z18}from"zod";import{constants}from"node:fs";import{open,realpath}from"node:fs/promises";async function checkedLocalDirectory(path){await privateDirectory(path);return realpath(path)}async function readLocalCredential(path,maximum=32768){await privateAccess(path,"file");const file=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW);try{const stat=await file.stat();if(!stat.isFile()||stat.nlink!==1||process.platform!=="win32"&&(stat.uid!==process.getuid?.()||stat.mode&63)||stat.size>maximum)throw Error("LOCAL_CREDENTIAL_INVALID");const bytes=Buffer.alloc(Math.min(maximum+1,stat.size+1));let used=0;while(used<bytes.length){const part=await file.read(bytes,used,bytes.length-used,null);if(!part.bytesRead)break;used+=part.bytesRead}if(used>stat.size)throw Error("LOCAL_CREDENTIAL_INVALID");if(used>maximum)throw Error("LOCAL_CREDENTIAL_INVALID");return bytes.subarray(0,used)}finally{await file.close()}}async function stageAgentImage(options,view,input,signal){const budget=localBudget(view.plan.snapshot.evidence?18e4:options.timeoutMs??1e4,signal,view.plan.snapshot.evidence?18e4:6e4);let dispatched=false;try{budget.signal.throwIfAborted();if(input.byteLength>134217728)throw Error();const bytes=Buffer.from(input),snapshot=view.plan.snapshot,id=z18.uuid().parse(view.plan.id),requestId=randomUUID();if(!snapshot.image&&!snapshot.evidence||bytes.length!==(snapshot.evidence??snapshot.image).byteSize||bytes.length>(snapshot.evidence?134217728:8388608)||createHash2("sha256").update(bytes).digest("hex")!==snapshot.media.checksumSha256)throw Error();const root=await checkedLocalDirectory(options.stateDirectory),path=localSocketPath(root);await privateAccess(path,"pipe");const auth=await localAbortable(Promise.resolve().then(options.authorization),budget.signal);budget.signal.throwIfAborted();if(!/^Bearer [A-Za-z0-9_-]{43}$/.test(auth))throw Error();const reply=await new Promise((resolve,reject)=>{const req=request({socketPath:path,path:"/ipc/v1/agent-images/"+id,method:"PUT",signal:budget.signal,headers:{authorization:auth,"content-type":snapshot.evidence?"application/octet-stream":"image/png","content-length":bytes.length,"x-nvs-request-id":requestId}},res=>{let size=0;const chunks=[];res.on("error",reject);res.on("aborted",()=>reject(Error()));res.on("data",b=>{size+=b.length;if(size>262144)req.destroy(Error());else chunks.push(b)});res.on("end",()=>{try{resolve(JSON.parse(Buffer.concat(chunks).toString()))}catch{reject(Error())}})});req.on("error",reject);dispatched=true;req.end(bytes)});const response=LocalIpcResponseSchema.parse(reply);if(response.requestId!==requestId&&!(response.requestId===null&&response.semanticStatus!=="SUCCESS"&&["BUSY","FORBIDDEN"].includes(response.error.code)))throw Error();if(response.semanticStatus!=="SUCCESS")throw new NativeStudioSdkError(response.error.code,response.semanticStatus,response.error.code==="INTERNAL_OPERATIONAL_FAILURE"?"UNKNOWN":"REJECTED");const v=LocalAgentReviewViewSchema.parse(response.data),receipt=v.evidenceReceipt??v.imageReceipt;if(v.plan.id!==id||canonicalLocalJson(v.plan)!==canonicalLocalJson(view.plan)||v.revision<view.revision||v.phase!=="PREPARED"||!receipt||receipt.draftId!==id||canonicalLocalJson(receipt.media)!==canonicalLocalJson(snapshot.media)||!snapshot.evidence&&canonicalLocalJson({contentType:v.imageReceipt?.contentType,byteSize:v.imageReceipt?.byteSize,width:v.imageReceipt?.width,height:v.imageReceipt?.height})!==canonicalLocalJson(snapshot.image))throw Error();return v}catch(e){if(e instanceof NativeStudioSdkError)throw e;throw new NativeStudioSdkError("LOCAL_AGENT_IMAGE_TRANSFER_FAILED","BLOCKED",dispatched?"UNKNOWN":"NO_WRITE")}finally{budget.close()}}var NativeStudioLocalWorkspaceClient=class{constructor(client){this.client=client}client;async offline(raw,signal){return LocalOfflinePageSchema.parse(await this.client.call({operation:"offline.workspace",input:LocalOfflineCallSchema.parse(raw)},signal))}async inspect(signal){return LocalWorkspaceInspectionSchema.parse(await this.client.call({operation:"workspace.inspect"},signal))}async configure(raw,expectedRevision,signal){const policy=LocalResourcePolicySchema.parse(raw);return LocalWorkspaceInspectionSchema.parse(await this.client.call({operation:"workspace.configure",policy,expectedRevision},signal))}async observeActivity(idleSeconds,observedAt,signal){return LocalWorkspaceInspectionSchema.parse(await this.client.call({operation:"workspace.activity",idleSeconds,observedAt},signal))}async clean(signal){return LocalWorkspaceInspectionSchema.parse(await this.client.call({operation:"storage.clean"},signal))}async diagnostics(signal){return LocalDiagnosticsSchema.parse(await this.client.call({operation:"diagnostics.read"},signal))}};import{randomUUID as randomUUID2}from"node:crypto";import{request as request2}from"node:http";var NativeStudioLocalRuntimeClient=class _NativeStudioLocalRuntimeClient{constructor(options){this.options=options}options;workspace=new NativeStudioLocalWorkspaceClient(this);static async fromConnector(path){const initial=LocalSessionConnectorSchema.parse(JSON.parse((await readLocalCredential(path)).toString()));return new _NativeStudioLocalRuntimeClient({stateDirectory:initial.stateDirectory,projects:initial.projects,authorization:async()=>{const current=LocalSessionConnectorSchema.parse(JSON.parse((await readLocalCredential(path)).toString()));if(current.stateDirectory!==initial.stateDirectory||canonicalLocalJson(current.projects)!==canonicalLocalJson(initial.projects)||Date.parse(current.expiresAt)>Date.parse(initial.expiresAt)||Date.parse(current.expiresAt)<=Date.now())throw Error("LOCAL_AUTHORIZATION_REQUIRED");return"Bearer "+current.credential}})}async call(call,signal){let started=false;const budget=localBudget(this.options.timeoutMs??(["runtime.doctor","agent.probe","agent.grant","agent.start"].includes(call.operation)?6e4:3e4),signal);const readOnly=["runtime.status","runtime.doctor","runtime.inventory","execution.inspect","execution.list","update.check","agent.probe","agent.discover","agent.inspect","workspace.inspect","diagnostics.read"].includes(call.operation);try{const input=LocalIpcRequestSchema.parse({protocol:"NVS_LOCAL_IPC_V1",requestId:randomUUID2(),call});const root=await checkedLocalDirectory(this.options.stateDirectory);const path=localSocketPath(root);await privateAccess(path,"pipe");budget.signal.throwIfAborted();const auth=await localAbortable(Promise.resolve().then(()=>this.options.authorization()),budget.signal);budget.signal.throwIfAborted();if(auth.length!==50||!/^Bearer [A-Za-z0-9_-]{43}$/.test(auth))throw Error();const body=JSON.stringify(input);const reply=await new Promise((resolve,reject)=>{const abort=budget.signal;const req=request2({socketPath:path,method:"POST",path:"/ipc/v1",signal:abort,headers:{authorization:auth,"content-type":"application/json","content-length":Buffer.byteLength(body)}},res=>{const chunks=[];let length=0;res.on("error",reject);res.on("aborted",()=>reject(Error()));res.on("data",b=>{length+=b.length;if(length>256*1024)req.destroy(Error());else chunks.push(b)});res.on("end",()=>{try{resolve(JSON.parse(Buffer.concat(chunks).toString()))}catch{reject(Error())}})});req.on("error",reject);started=true;req.end(body)});const value=LocalIpcResponseSchema.parse(reply);if(value.requestId!==input.requestId&&!(value.requestId===null&&value.semanticStatus!=="SUCCESS"&&["FORBIDDEN","BUSY","INVALID_INPUT"].includes(value.error.code)))throw Error();if(value.semanticStatus!=="SUCCESS")throw new NativeStudioSdkError(value.error.code,value.semanticStatus,readOnly?"NO_WRITE":value.error.code==="INTERNAL_OPERATIONAL_FAILURE"?"UNKNOWN":"REJECTED");if(value.requestId!==input.requestId)throw Error();return value.data}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError("LOCAL_RUNTIME_UNAVAILABLE","BLOCKED",started&&!readOnly?"UNKNOWN":"NO_WRITE")}finally{budget.close()}}response(schema,raw){const result=schema.safeParse(raw);if(!result.success)throw new NativeStudioSdkError("LOCAL_RESPONSE_INVALID","BLOCKED","NO_WRITE");return result.data}async status(signal,includeDevice=false){const value=this.response(LocalRuntimeStatusSchema,await this.call({operation:"runtime.status",...includeDevice?{includeDevice:true}:{}},signal));if(this.options.projects&&value.authorizedProjects.some(p=>!this.options.projects.some(q=>q.tenantId===p.tenantId&&q.projectId===p.projectId)))throw new NativeStudioSdkError("LOCAL_SCOPE_INVALID","BLOCKED","NO_WRITE");return value}async doctor(signal){return this.response(LocalDoctorReportSchema,await this.call({operation:"runtime.doctor"},signal))}async inventory(signal){return this.response(LocalManagementInventorySchema,await this.call({operation:"runtime.inventory"},signal))}async grantAgent(raw,approval){return this.response(LocalAgentProbeSchema,await this.call({operation:"agent.grant",grant:LocalAgentGrantSchema.parse(raw),approval}))}async revokeAgent(approval){return this.response(LocalAgentProbeSchema,await this.call({operation:"agent.revoke",approval}))}async probeAgent(){return this.response(LocalAgentProbeSchema,await this.call({operation:"agent.probe"}))}async discoverAgent(binary){return this.response(LocalAgentDiscoverySchema,await this.call({operation:"agent.discover",...binary?{binary}:{}}))}async prepareAgentReview(snapshot){const input=LocalAgentSnapshotSchema.parse(snapshot);const v=this.response(LocalAgentReviewViewSchema,await this.call({operation:"agent.prepare",snapshot:input}));if(canonicalLocalJson(v.plan.snapshot)!==canonicalLocalJson(input))throw new NativeStudioSdkError("LOCAL_RESPONSE_INVALID","BLOCKED","UNKNOWN");return v}async startAgentReview(id,expectedRevision,approval){const v=this.response(LocalAgentReviewViewSchema,await this.call({operation:"agent.start",id,expectedRevision,approval}));if(v.plan.id!==id||v.plan.fingerprint!==approval)throw new NativeStudioSdkError("LOCAL_RESPONSE_INVALID","BLOCKED","UNKNOWN");return v}async stageAgentImage(id,bytes,signal){const budget=localBudget(18e4,signal,18e4);try{return await stageAgentImage(this.options,await this.inspectAgentReview(id,budget.signal),bytes,budget.signal)}finally{budget.close()}}async inspectAgentReview(id,signal){const v=this.response(LocalAgentReviewViewSchema,await this.call({operation:"agent.inspect",id},signal));if(v.plan.id!==id)throw new NativeStudioSdkError("LOCAL_RESPONSE_INVALID","BLOCKED","NO_WRITE");return v}async executions(input,signal){const i=LocalExecutionListInputSchema.parse(input);if(this.options.projects&&!this.options.projects.some(p=>p.tenantId===i.tenantId&&p.projectId===i.projectId))throw new NativeStudioSdkError("FORBIDDEN","BLOCKED","NO_WRITE");const page=this.response(LocalExecutionPageSchema,await this.call({operation:"execution.list",input:i},signal));if(page.items.some(e=>e.binding.tenantId!==i.tenantId||e.binding.projectId!==i.projectId))throw new NativeStudioSdkError("LOCAL_SCOPE_INVALID","BLOCKED","NO_WRITE");return page}async inspect(raw,signal){const input=LocalExecutionInspectInputSchema.parse(raw);if(this.options.projects&&!this.options.projects.some(p=>p.tenantId===input.tenantId&&p.projectId===input.projectId))throw new NativeStudioSdkError("FORBIDDEN","BLOCKED","NO_WRITE");const value=this.response(LocalExecutionInspectionSchema.nullable(),await this.call({operation:"execution.inspect",input},signal));if(value&&["tenantId","projectId","productionId","runtimeJobId"].some(k=>value.binding[k]!==input[k]))throw new NativeStudioSdkError("LOCAL_SCOPE_INVALID","BLOCKED","NO_WRITE");return value}};import{createPublicKey,verify}from"node:crypto";function endpoint(raw){const u=new URL(raw);if(u.username||u.password||u.search||u.hash||u.protocol!=="https:"&&!(u.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(u.hostname)))fail("RELEASE_ORIGIN_INVALID");return u}async function fetchBytes(raw,maximum,origin,signal=AbortSignal.timeout(3e4)){const u=endpoint(raw);if(u.origin!==origin)fail("RELEASE_ORIGIN_INVALID");const r=await fetch(u,{redirect:"error",signal,headers:{accept:"application/octet-stream"}});if(!r.ok||Number(r.headers.get("content-length"))>maximum){await r.body?.cancel();fail("RELEASE_UNAVAILABLE")}const parts=[];let size=0;for await(const part of r.body??[]){size+=part.byteLength;if(size>maximum){await r.body?.cancel().catch(()=>{});fail("RELEASE_LIMIT")}parts.push(part)}return Buffer.concat(parts)}async function catalogue(trust,signal){const origin=endpoint(trust.catalogueUrl).origin;const bytes=await fetchBytes(trust.catalogueUrl,65536,origin,signal??AbortSignal.timeout(3e4));const signed=LocalSignedCatalogueSchema.parse(JSON.parse(bytes.toString()));const key=createPublicKey((await read(trust.publicKeyFile,16384)).toString());if(key.asymmetricKeyType!=="ed25519"||!verify(null,Buffer.from(canonicalLocalJson(signed.catalogue)),key,Buffer.from(signed.signature,"base64url")))fail("RELEASE_SIGNATURE_INVALID");const now=Date.now();if(Date.parse(signed.catalogue.issuedAt)>now||Date.parse(signed.catalogue.expiresAt)<=now)fail("RELEASE_EXPIRED");for(const release of signed.catalogue.releases){for(const a of[release.package,...release.tools?Object.values(release.tools):[]])if(endpoint(a.url).origin!==origin)fail("RELEASE_ORIGIN_INVALID")}return{signed,fingerprint:sha256(canonicalLocalJson(signed.catalogue)),origin,trustFingerprint:sha256(canonicalLocalJson({catalogueUrl:endpoint(trust.catalogueUrl).href,publicKey:key.export({type:"spki",format:"der"}).toString("base64")}))}}function select(signed,version){const r=signed.catalogue.releases.find(r2=>r2.descriptor.version===version&&r2.descriptor.platform.os===process.platform&&r2.descriptor.platform.architecture===process.arch);if(!r)fail("VERSION_INCOMPATIBLE");const[major,minor]=process.versions.node.split(".").map(Number);if(major!==r.descriptor.node.major||minor<r.descriptor.node.minMinor)fail("NODE_VERSION_INCOMPATIBLE");return r}async function asset(a,origin){const bytes=await fetchBytes(a.url,a.byteSize,origin,AbortSignal.timeout(12e4));if(bytes.length!==a.byteSize||sha512(bytes)!==a.sha512)fail("RELEASE_INTEGRITY_INVALID");return bytes}export{EnrollLocalDeviceSchema,LocalDeviceViewSchema,LocalDeviceChallengeSchema,GrantLocalDeviceSchema,LocalDeviceGrantSchema,RevokeLocalDeviceGrantSchema,RevokeLocalDeviceSchema,LocalOfflineCallSchema,LocalOfflinePageSchema,LocalAgentGrantSchema,LocalAgentDiscoverySchema,LocalToolSelectionSchema,LocalRuntimeDescriptorSchema,LocalManagementInventorySchema,LocalReleaseSchema,LocalToolChoiceSchema,LocalUpdatePlanSchema,LocalResourcePolicySchema,LocalWorkspaceInspectionSchema,LocalDiagnosticsSchema,canonicalLocalJson,LocalAgentSnapshotSchema,LocalAgentProbeSchema,LocalAgentReviewViewSchema,localAgentSnapshotFromContext,localAgentNativeProposal,LocalExecutionListInputSchema,LocalExecutionInspectInputSchema,LocalDoctorReportSchema,StartLocalPreviewSchema,LocalDeviceSessionSchema,LocalDeviceTransportConfigurationSchema,LocalPreviewAdmissionSchema,StartLocalFinalRenderSchema,LocalFinalRenderAdmissionSchema,LocalMcpFailureSchema,LocalMcpOutputSchemas,LocalManagementCommandSchema,LocalManagementResultSchema,NativeStudioLocalDeviceClient,NativeStudioLocalRuntimeClient,endpoint,catalogue,select,asset};