@nativestudio/sdk 0.3.0-rc.21 → 0.3.0-rc.27

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 (103) hide show
  1. package/COMPATIBILITY.json +4 -4
  2. package/dist/_chunks/chunk-65Q3RST6.js +1 -0
  3. package/dist/_chunks/{chunk-K3TIFCD3.js → chunk-7VBZYNHE.js} +1 -1
  4. package/dist/_chunks/chunk-B5QT3BVS.js +1 -0
  5. package/dist/_chunks/chunk-KONHIJPZ.js +1 -0
  6. package/dist/_chunks/{chunk-WNXKJRZ6.js → chunk-RUWGYN4N.js} +1 -1
  7. package/dist/_chunks/{chunk-QVP4AMRJ.js → chunk-SCY6PJRK.js} +1 -1
  8. package/dist/_chunks/chunk-XPDAOUQ7.js +1 -0
  9. package/dist/_types/contracts/artifact.d.ts +2 -0
  10. package/dist/_types/contracts/component-status.d.ts +9 -0
  11. package/dist/_types/contracts/device-openai-asr.d.ts +479 -0
  12. package/dist/_types/contracts/device-render.d.ts +6 -0
  13. package/dist/_types/contracts/external-agent-access.d.ts +7 -0
  14. package/dist/_types/contracts/index.d.ts +3 -0
  15. package/dist/_types/contracts/interface/media-output.d.ts +4 -1
  16. package/dist/_types/contracts/interface/operation.d.ts +44 -0
  17. package/dist/_types/contracts/interface/production-snapshot.d.ts +39 -0
  18. package/dist/_types/contracts/interface/query.d.ts +38 -0
  19. package/dist/_types/contracts/local-execution/backup-retirement.d.ts +162 -0
  20. package/dist/_types/contracts/local-execution/claim-resolution.d.ts +1470 -0
  21. package/dist/_types/contracts/local-execution/components.d.ts +1 -1
  22. package/dist/_types/contracts/local-execution/cpu-preparation.d.ts +23 -0
  23. package/dist/_types/contracts/local-execution/credential-request.d.ts +20 -0
  24. package/dist/_types/contracts/local-execution/external-generation.d.ts +59 -2
  25. package/dist/_types/contracts/local-execution/index.d.ts +12 -0
  26. package/dist/_types/contracts/local-execution/ipc.d.ts +27 -0
  27. package/dist/_types/contracts/local-execution/library-command.d.ts +303 -5
  28. package/dist/_types/contracts/local-execution/library-result.d.ts +217 -3
  29. package/dist/_types/contracts/local-execution/lifecycle.d.ts +35 -0
  30. package/dist/_types/contracts/local-execution/local-navigation.d.ts +3 -0
  31. package/dist/_types/contracts/local-execution/management.d.ts +12 -12
  32. package/dist/_types/contracts/local-execution/model-cleanup.d.ts +60 -0
  33. package/dist/_types/contracts/local-execution/model-inspection.d.ts +365 -0
  34. package/dist/_types/contracts/local-execution/openai-asr.d.ts +105 -0
  35. package/dist/_types/contracts/local-execution/openai-realtime-speech.d.ts +151 -0
  36. package/dist/_types/contracts/local-execution/preview.d.ts +15 -4
  37. package/dist/_types/contracts/local-execution/processor-capability.d.ts +6 -0
  38. package/dist/_types/contracts/local-execution/processor-direct.d.ts +140 -4
  39. package/dist/_types/contracts/local-execution/processor-outcomes.d.ts +145 -0
  40. package/dist/_types/contracts/local-execution/processor-recipes.d.ts +163 -3
  41. package/dist/_types/contracts/local-execution/processor.d.ts +2422 -322
  42. package/dist/_types/contracts/local-execution/project-source-direct.d.ts +1 -0
  43. package/dist/_types/contracts/local-execution/provider-inspection.d.ts +58 -0
  44. package/dist/_types/contracts/local-execution/provider-release.d.ts +53 -0
  45. package/dist/_types/contracts/local-execution/provider-selection.d.ts +58 -0
  46. package/dist/_types/contracts/local-execution/recognition.d.ts +30 -0
  47. package/dist/_types/contracts/local-execution/speech.d.ts +1 -1
  48. package/dist/_types/contracts/local-execution/versions.d.ts +2 -0
  49. package/dist/_types/contracts/media-observation.d.ts +56 -0
  50. package/dist/_types/contracts/native-speech-http.d.ts +15 -0
  51. package/dist/_types/contracts/navigation-context.d.ts +144 -0
  52. package/dist/_types/contracts/navigation-groups.d.ts +1 -1
  53. package/dist/_types/contracts/navigation.d.ts +2 -0
  54. package/dist/_types/contracts/observation-profile.d.ts +12 -0
  55. package/dist/_types/contracts/openai-asr.d.ts +55 -0
  56. package/dist/_types/contracts/provider-catalog.d.ts +44 -0
  57. package/dist/_types/contracts/provider-models.d.ts +115 -3
  58. package/dist/_types/contracts/provider.d.ts +93 -7
  59. package/dist/_types/contracts/render-readiness.d.ts +74 -1
  60. package/dist/_types/contracts/repair-strategy.d.ts +1 -1
  61. package/dist/_types/contracts/resourcesdk.d.ts +231 -0
  62. package/dist/_types/contracts/sound-making-plan.d.ts +41 -0
  63. package/dist/_types/contracts/source-workspace.d.ts +2 -0
  64. package/dist/_types/contracts/speech-cost.d.ts +129 -0
  65. package/dist/_types/contracts/speech.d.ts +50 -0
  66. package/dist/_types/contracts/transcription.d.ts +11 -0
  67. package/dist/_types/sdk/catalog/carriers.d.ts +40 -0
  68. package/dist/_types/sdk/catalog/core.d.ts +164 -4
  69. package/dist/_types/sdk/catalog/device-library.d.ts +360 -4
  70. package/dist/_types/sdk/catalog/device-management.d.ts +16 -6
  71. package/dist/_types/sdk/catalog/imported-visual.d.ts +990 -22
  72. package/dist/_types/sdk/catalog/mcp.d.ts +12 -0
  73. package/dist/_types/sdk/catalog/media-observation.d.ts +630 -18
  74. package/dist/_types/sdk/catalog/navigation.d.ts +241 -4
  75. package/dist/_types/sdk/catalog/provider.d.ts +272 -98
  76. package/dist/_types/sdk/catalog/reference-preview.d.ts +52 -0
  77. package/dist/_types/sdk/catalog/resourcesdk.d.ts +573 -0
  78. package/dist/_types/sdk/catalog/speech.d.ts +98 -8
  79. package/dist/_types/sdk/client.d.ts +28 -1
  80. package/dist/_types/sdk/device-renders.d.ts +4 -1
  81. package/dist/_types/sdk/direct-source.d.ts +47 -1
  82. package/dist/_types/sdk/index.d.ts +2 -0
  83. package/dist/_types/sdk/local-runtime/components.d.ts +6 -0
  84. package/dist/_types/sdk/local-runtime-client.d.ts +35 -23
  85. package/dist/_types/sdk/navigation-client.d.ts +2 -0
  86. package/dist/_types/sdk/navigation-facade.d.ts +113 -0
  87. package/dist/_types/sdk/observe.d.ts +26 -0
  88. package/dist/_types/sdk/resource-data-plane.d.ts +108 -0
  89. package/dist/_types/sdk/resource-ingress.d.ts +18 -0
  90. package/dist/_types/sdk/transport/http.d.ts +1 -0
  91. package/dist/account.js +1 -1
  92. package/dist/host-protocol.js +1 -1
  93. package/dist/index.d.ts +2 -2
  94. package/dist/index.js +1 -1
  95. package/dist/local-runtime.js +1 -1
  96. package/dist/mcp-discovery.js +1 -1
  97. package/dist/runtime-authority.js +1 -1
  98. package/package.json +3 -2
  99. package/dist/_chunks/chunk-2QDPFLIO.js +0 -1
  100. package/dist/_chunks/chunk-7DXSLHXW.js +0 -1
  101. package/dist/_chunks/chunk-ASUZJSEP.js +0 -1
  102. package/dist/_chunks/chunk-Q53Q74OP.js +0 -1
  103. package/dist/_chunks/chunk-UKPD77FB.js +0 -1
@@ -1 +0,0 @@
1
- import{AgentHostContractInputSchema,AgentHostContractSchema,LegacyHostExecutionReleaseSchema,ReleaseLegacyHostExecutionSchema,canonicalHostContractJson}from"./chunk-K3TIFCD3.js";import{AcceptBriefRequestSchema,AcceptBriefResultSchema,AcceptSceneShotPlanRequestSchema,AcceptSceneShotPlanResultSchema,AcceptStoryRequestSchema,AcceptStoryResultSchema,AcceptedVisualSourceReferenceSchema,AudioBasisSchema,AudioGetSchema,AudioImportRequestSchema,AudioPageSchema,AudioQuerySchema,AudioReadScopeSchema,AudioReceiptSchema,AudioSnapshotSchema,AudioViewSchema,AuthorCaptionsSchema,AuthorTranscriptCaptionsSchema,BoundaryRequirementSchema,BriefContentSchema,BuildTimelineSchema,BuildTimelineShapeSchema,CaptionBasisSchema,CaptionContentSchema,CaptionExportSchema,CaptionGetSchema,CaptionPageSchema,CaptionQuerySchema,CaptionReceiptSchema,CaptionScopeSchema,CaptionSnapshotSchema,CaptionTranscriptDraftSchema,CaptionTranscriptPlanSchema,CaptionViewSchema,ClipTransitionSchema,CompositionBasisPinSchema,CompositionBindingSchema,CompositionContentSchema,CompositionDependencyLockSchema,CompositionDependencyManifestSchema,CompositionFindingLocalitySchema,CompositionGetSchema,CompositionHistorySchema,CompositionInputFactSchema,CompositionPageSchema,CompositionPathSchema,CompositionReceiptSchema,CompositionRenderCancellationSchema,CompositionRenderGetSchema,CompositionRenderReceiptSchema,CompositionRenderStartSchema,CompositionRenderViewSchema,CompositionScopeSchema,CompositionViewSchema,ConfigureConsistencyProfileSchema,ConfigureProviderInputSchema,ConfigureProviderModelSchema,ConsistencyProfileContentSchema,ConsistencyProfileReceiptSchema,ConsistencyProfileScopeSchema,ConsistencyProfileVersionQuerySchema,ConsistencyProfileVersionSchema,ConsistencyProfileViewSchema,ConstraintSetSchema,ContentFingerprintSchema,DecideFinalReadySchema,DecideKeyframeSchema,DecideProgrammaticShotSchema,DecideVideoShotSchema,DeliveryApprovalSchema,DeliveryCheckKeySchema,DeliveryManifestLinkSchema,DeliveryPolicyInputSchema,DeliveryPolicySchema,DeliveryTargetSchema,DeliveryValidationReviewSchema,DeviceEnrollmentIssueSchema,DeviceEnrollmentLookupSchema,DeviceEnrollmentObservationSchema,DeviceRenderReceiptSchema,DeviceRenderTargetSchema,DeviceSetupRecoverySchema,DeviceStatusInputSchema,DeviceStatusSchema,DirectOriginalCommandSchema,DirectOriginalStageSchema,DirectOriginalSubmitSchema,DirectProjectSourceCommandSchema,DirectProjectSourceStageSchema,DirectProjectSourceSubmitSchema,DirectorBasisSchema,DirectorContextResultSchema,DirectorScopeSchema,DirectorValidationResultSchema,DisableProviderModelSchema,EnrollLocalDeviceSchema,ExactEvidenceReferenceSchema,FinalDeliveryReceiptSchema,FinalReadyPageSchema,FinalReadyQuerySchema,FinalReadyReceiptSchema,FinalReadyViewSchema,FinalRenderAdmissionSchema,FinalRenderEligibilitySchema,FinalRenderGetSchema,FinalRenderManifestReaderSchema,FinalRenderPageSchema,FinalRenderQuerySchema,FinalRenderSnapshotSchema,FinalRenderStartSchema,FinalRenderTechnicalSchema,FinalRenderViewSchema,GeneratedShotAcceptanceDecisionSchema,GenerationContractIdSchema,GenerationCostQuoteSchema,ImportedVisualDecisionSchema,ImportedVisualFromProjectSourceSchema,ImportedVisualGetSchema,ImportedVisualNormalizationViewSchema,ImportedVisualNormalizeStartSchema,ImportedVisualOriginalRegisterSchema,ImportedVisualOriginalReviseSchema,ImportedVisualOriginalViewSchema,ImportedVisualReviewSchema,KeyframeAdmissionSchema,KeyframeDecisionPageSchema,KeyframeDecisionQuerySchema,KeyframeDecisionReceiptSchema,KeyframeDeviceStartInputSchema,KeyframeGenerationViewSchema,KeyframeGetInputSchema,KeyframeMediaSchema,KeyframeObservationSchema,KeyframeProviderProfileSchema,KeyframeQueryInputSchema,KeyframeQueryPageSchema,KeyframeReferenceScopeSchema,KeyframeReferenceViewSchema,KeyframeReviewPageSchema,KeyframeReviewQuerySchema,KeyframeReviewReceiptSchema,KeyframeReviewScopeSchema,KeyframeReviewSummarySchema,KeyframeReviewTargetSchema,KeyframeStartInputSchema,KeyframeSummarySchema,LegacyVisualSequenceRegistrationSchema,ListeningEvidenceSchema,LocalDevicePlatformSchema,LocalDeviceViewSchema,LocalDigestSchema,LocalIdSchema,LocalLeaseBindingSchema,LocalLibraryAdmissionSchema,LocalLibraryCommandQuerySchema,LocalLibraryCommandSchema,LocalLibraryInspectionSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalManagementReceiptSchema,LocalObservationAdmissionSchema,LocalObservationStartSchema,LocalObservationViewSchema,LocalPackageVersionSchema,LocalProjectScopeSchema,LocalRevisionSchema,LocalSpeechAdmissionSchema,LocalSpeechGenerationViewSchema,LocalSpeechStartSchema,LocalTimeSchema,MediaBrowserContentTypeSchema,MediaBrowserReadTicketSchema,MediaCategorySchema,MediaObjectTicketSchema,MediaObjectVersionSchema,ModelProfileIdSchema,NativeSpeechExecutionSchema,ObservationAdmissionSchema,ObservationGetSchema,ObservationOptionsSchema,ObservationScopeSchema,ObservationStartSchema,ObservationViewSchema,PreparationBasisSchema,PreparationBlockerSchema,PreparationIdSchema,PreparationTargetSchema,ProductionGuidanceContextSchema,ProgrammaticShotAcceptanceDecisionSchema,ProgrammaticVideoReviewPageSchema,ProgrammaticVideoReviewQuerySchema,ProgrammaticVideoReviewReceiptSchema,ProgrammaticVideoReviewScopeSchema,ProgrammaticVideoReviewTargetSchema,ProjectDeviceListInputSchema,ProjectDeviceListSchema,ProviderConnectionCommandSchema,ProviderConnectionPageSchema,ProviderConnectionViewSchema,ProviderCredentialRevokeSchema,ProviderDefaultViewSchema,ProviderModelGetSchema,ProviderModelPageSchema,ProviderModelViewSchema,ProviderModelsViewSchema,ProviderSelectionSchema,ProviderTenantInputSchema,QwenAsrCostQuoteSchema,QwenAsrDeviceAdmissionSchema,QwenAsrDeviceQuoteInputSchema,QwenAsrDeviceStartSchema,QwenAsrDeviceViewSchema,ReadyArtifactRegistrationSchema,RecordKeyframeReviewSchema,RecordProgrammaticVideoReviewSchema,RecordRoughCutReviewSchema,RecordVideoReviewSchema,ReferenceBindingInputSchema,ReferenceRoleSchema,ReferenceSetSchema,RegisterVisualSequenceSchema,ReviewEvidenceKeySchema,ReviewIntelligenceContextInputSchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema,RevokeFinalReadySchema,RevokeKeyframeSchema,RevokeLocalDeviceSchema,RevokeShotAcceptanceSchema,RoughCutAdmissionSchema,RoughCutFindingPageSchema,RoughCutFindingQuerySchema,RoughCutFindingViewSchema,RoughCutGetSchema,RoughCutPageSchema,RoughCutProfileIdSchema,RoughCutQuerySchema,RoughCutReviewPageSchema,RoughCutReviewQuerySchema,RoughCutReviewReceiptSchema,RoughCutReviewRecordSchema,RoughCutReviewScopeSchema,RoughCutReviewSnapshotSchema,RoughCutReviewTargetSchema,RoughCutSnapshotSchema,RoughCutStartSchema,RoughCutViewSchema,SceneShotPlanVersionSchema,ScopedLocalManagementReceiptSchema,SetKeyframeDefaultSchema,ShotAcceptanceScopeSchema,ShotAcceptanceViewSchema,ShotDecisionPageSchema,ShotDecisionQuerySchema,ShotDecisionReceiptSchema,ShotIntentSchema,ShotPlanEntrySchema,SoundPlanAcceptSchema,SoundPlanContextSchema,SoundPlanGetSchema,SoundPlanReceiptSchema,SoundPlanScopeSchema,SoundPlanValidateSchema,SoundPlanValidationSchema,SoundPlanViewSchema,SourceInputMetadataSchema,SourceSyncAudioGetSchema,SourceSyncAudioReceiptSchema,SourceSyncAudioStartSchema,SourceSyncAudioVersionSchema,SourceSyncAudioViewSchema,SpeechAdmissionSchema,SpeechCostQuoteSchema,SpeechDeviceStartSchema,SpeechGenerationViewSchema,SpeechGetSchema,SpeechOptionsSchema,SpeechParametersSchema,SpeechScopeSchema,SpeechStartSchema,StoryContentSchema,StoryVersionSchema,SubmitCompositionSchema,TemporalEvidenceManifestSchema,TemporalEvidenceSourceSchema,TemporalSamplingProfileSchema,TenantMediaWorkSchema,TenantProcessorReceiptSchema,TimelineAudioInputSchema,TimelineBasisSchema,TimelineBuildReceiptSchema,TimelineGetSchema,TimelineGraphicInputSchema,TimelineGraphicSchema,TimelineManifestReaderSchema,TimelinePageSchema,TimelineQuerySchema,TimelineScopeSchema,TimelineSnapshotSchema,TimelineViewSchema,TimelineVisualLayerInputSchema,UploadSourceInputRequestSchema,ValidateDirectorProposalSchema,ValidateReviewIntelligenceSchema,ValidateWriterProposalSchema,VideoAdmissionSchema,VideoDeviceStartInputSchema,VideoGenerationViewSchema,VideoGetInputSchema,VideoObservationSchema,VideoOptionsInputSchema,VideoProviderProfileSchema,VideoQueryInputSchema,VideoQueryPageSchema,VideoReviewPageSchema,VideoReviewQuerySchema,VideoReviewReceiptSchema,VideoReviewRecordSchema,VideoReviewRequirementSchema,VideoReviewScopeSchema,VideoReviewTargetSchema,VideoStartInputSchema,VideoSummarySchema,VisualRequirementSchema,VisualSequenceGetSchema,VisualSequencePageSchema,VisualSequenceQuerySchema,VisualSequenceRegistrationAdmissionSchema,VisualSequenceViewSchema,VoiceLocaleSchema,VoiceProfileRefSchema,VoiceProfileUseSchema,WorkspaceCallerSchema,WorkspacePageSchema,WorkspaceScopeSchema,WorkspaceStatusSchema,WorkspaceViewSchema,WriterBriefResultSchema,WriterScopeSchema,WriterValidationResultSchema,assertManagementReceipt,mediaObjectTransferPath}from"./chunk-7DXSLHXW.js";import{CurrentInboundBindingSchema,FederationPeerRefSchema,FederationResultLocatorSchema,FederationResultReadSchema,FederationResultReferenceSchema,FederationResultSnapshotSchema,FederationSourceSelectionSchema,InboundBindingConfigureSchema,InboundCatalogSchema,InboundQueryResultSchema,InboundQuerySchema,InboundReceiptInputSchema,InboundReceiptSchema,InboundReplayResultSchema,InboundReplaySchema,InboundSignalChangesPageSchema,InboundSignalChangesQuerySchema,InboundSignalsPageSchema,InboundSignalsQuerySchema,RESOURCE_CHANGE_SCHEMA,RESOURCE_CHANGE_TYPE,canonicalFederationCatalogJson,canonicalFederationReadJson}from"./chunk-VXBIT7XN.js";import{NativeStudioHttpTransport,abortable,assertResponseBindings,boundedResponseBytes,capabilityMismatch,descriptorOperation,failureOutcome,mcpOperation,nativeFailureCodes,operation,pageQuery,path}from"./chunk-Q53Q74OP.js";import{AgentHostExecutionEventPageSchema,AgentHostExecutionEventQuerySchema,AgentHostExecutionGetSchema,AgentHostExecutionPageSchema,AgentHostExecutionQuerySchema,AgentHostExecutionViewSchema,StartAgentHostExecutionSchema}from"./chunk-2QDPFLIO.js";import{CreateProjectRequestSchema,CreatedProjectResultSchema,ProjectLibraryPageSchema,ProjectLibraryQuerySchema,ProjectLibraryScopeSchema,ProjectSchema,ProjectWorkspaceSchema,SourceLibraryItemSchema,SourceLibraryMediaSchema,SourceLibraryPageSchema,SourceLibraryQuerySchema}from"./chunk-QVP4AMRJ.js";import{AgentHostBindingSchema,AgentHostCurrentSchema,AgentHostHistoryPageSchema,AgentHostHistoryQuerySchema,AgentHostReadinessSchema,AgentHostScopeSchema,ConfigureAgentHostSchema,ConfigureNativeToolGrantSchema,ConfigureWebhookReferenceSchema,ConfigureWebhookSchema,DisableWebhookSchema,EXTERNAL_EVENT_TYPES,ExternalEventTypeSchema,ExternalLifecycleEventSchema,FederationCatalogSchema,FederationDeliverySchema,FederationObservationSchema,FederationQueryResultSchema,FederationQuerySchema,FederationReceiptInputSchema,FederationReceiptSchema,FederationRecoverSchema,FederationRecoverySchema,FederationRouteConfigureSchema,FederationRouteSchema,FederationScopeSchema,FederationSubscriptionGetSchema,FederationSubscriptionResultSchema,FederationSubscriptionSetSchema,LifecycleEventScopeSchema,NativeToolGrantGetSchema,NativeToolGrantViewSchema,PrepareWebhookSecretSchema,ProductionEventReadSchema,ProductionFeedbackInputSchema,ProductionFeedbackResultSchema,QueryLifecycleEventsSchema,ReadProductionEventsSchema,ReplayWebhookSchema,RevokeAgentHostSchema,RevokeNativeToolGrantSchema,UpdateAgentHostSelectionSchema,WebhookAvailabilitySchema,WebhookSecretReferenceSchema,WebhookSubscriptionSchema,orderedFederationWindow}from"./chunk-NNDKZ5H5.js";import{ArtifactIdSchema,ArtifactRepresentationIdSchema,CapabilityVersionSchema,ContinuationSchema,DeliveryOutputProfileSchema,HumanLinksSchema,InterfaceSemanticStatusSchema,NextActionSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProductionSchema,ProductionStateSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,TenantIdSchema,WorkSummarySchema}from"./chunk-AFUVP2DC.js";import{NativeStudioSdkError,sdkInputError}from"./chunk-TT7IA5HB.js";import{z}from"zod";var WorkspaceDeviceListInputSchema=z.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema.optional(),after:LocalIdSchema.optional(),limit:z.int().min(1).max(50).default(25)});var WorkspaceDeviceInventoryItemSchema=z.strictObject({deviceId:LocalIdSchema,label:z.string().trim().min(1).max(120),platform:LocalDevicePlatformSchema,runtimeVersion:LocalPackageVersionSchema.nullable(),runtimeVersionObservedAt:LocalTimeSchema.nullable(),revision:LocalRevisionSchema,createdAt:LocalTimeSchema,verifiedAt:LocalTimeSchema.nullable(),revokedAt:LocalTimeSchema.nullable(),lastSeenAt:LocalTimeSchema.nullable(),connection:z.enum(["UNVERIFIED","REVOKED","OWNER_UNAVAILABLE","CONNECTED","DISCONNECTED"])}).refine(value=>value.runtimeVersion===null===(value.runtimeVersionObservedAt===null),{message:"Runtime version and observation time must be present together"});var WorkspaceDeviceListSchema=z.strictObject({tenantId:LocalIdSchema,observedAt:LocalTimeSchema,items:z.array(WorkspaceDeviceInventoryItemSchema).max(50),nextCursor:LocalIdSchema.nullable(),recovery:DeviceSetupRecoverySchema.optional()});import{z as z8}from"zod";import{z as z2}from"zod";var id=z2.uuid().toLowerCase();var SourceSyncRuntimeStartSchema=SourceSyncAudioStartSchema.extend({deviceId:id.optional()});var SourceSyncRuntimePublicationSchema=SourceSyncRuntimeStartSchema.transform(({deviceId,...publication})=>{void deviceId;return publication});var SourceSyncRuntimeScopeSchema=z2.strictObject({tenantId:id,productionId:id,requestId:id});var SourceSyncRuntimeAdmissionSchema=z2.strictObject({requestId:id,runtimeJobId:id,productionRevision:z2.int().positive()});var SourceSyncRuntimeViewSchema=SourceSyncRuntimeAdmissionSchema.extend({normalizationId:id,lifecycle:z2.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),cancellationRequested:z2.boolean(),output:SourceSyncAudioReceiptSchema.nullable()});import{z as z3}from"zod";var id2=z3.uuid().toLowerCase();var hash=z3.string().regex(/^[0-9a-f]{64}$/);var SourceSyncMediaIdentitySchema=z3.strictObject({artifactId:id2,representationId:id2,checksumSha256:hash});var sampleRange=z3.strictObject({startSample:z3.int().nonnegative(),endSample:z3.int().positive()}).refine(v=>v.endSample>v.startSample);var frameRange=z3.strictObject({startFrame:z3.int().nonnegative(),endFrame:z3.int().positive()}).refine(v=>v.endFrame>v.startFrame);var SourceSyncListeningEvidenceSchema=z3.discriminatedUnion("kind",[z3.strictObject({id:z3.string().trim().min(1).max(100),kind:z3.literal("AUDIO_LISTENING"),media:SourceSyncMediaIdentitySchema,coverage:z3.array(sampleRange).min(1).max(64),producer:z3.string().trim().min(1).max(200)}),z3.strictObject({id:z3.string().trim().min(1).max(100),kind:z3.literal("VIDEO_PLAYBACK"),media:SourceSyncMediaIdentitySchema,coverage:z3.array(frameRange).min(1).max(64),producer:z3.string().trim().min(1).max(200)})]);var SourceSyncObservationSchema=z3.strictObject({key:z3.enum(["AUDIBILITY","AUDIO_VISUAL_ALIGNMENT"]),status:z3.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE"]),confidence:z3.enum(["CLEAR","UNCERTAIN"]),observed:z3.string().trim().min(1).max(2e3),evidenceIds:z3.array(z3.string().trim().min(1).max(100)).max(64)});var SourceSyncReviewTargetSchema=z3.strictObject({version:SourceSyncAudioVersionSchema,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,sampleCount:z3.int().positive(),frameCount:z3.int().positive().max(360),currentReviewVersion:z3.int().nonnegative(),declarationScope:z3.literal("ATTRIBUTED_OBSERVATIONS_NOT_LISTENING_ATTESTATION")});var SourceSyncReviewInputSchema=SourceSyncAudioGetSchema.extend({tenantId:id2,productionId:id2,shotId:id2,versionId:id2,expectedReviewVersion:z3.int().nonnegative(),audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z3.array(SourceSyncListeningEvidenceSchema).max(64),observations:z3.array(SourceSyncObservationSchema).length(2),summary:z3.string().trim().min(1).max(4e3),idempotencyKey:z3.string().trim().min(1).max(200)});var SourceSyncReviewRecordSchema=z3.strictObject({id:id2,versionId:id2,reviewVersion:z3.int().positive(),tenantId:id2,productionId:id2,shotId:id2,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z3.array(SourceSyncListeningEvidenceSchema).max(64),observations:z3.array(SourceSyncObservationSchema).length(2),outcome:z3.enum(["PASS","FAIL","NEEDS_REVIEW"]),summary:z3.string(),createdByPrincipalId:id2,executionClass:z3.enum(["LIVE","TEST_ONLY"]),createdAt:z3.iso.datetime({offset:true})});var SourceSyncReviewGetSchema=SourceSyncAudioGetSchema.extend({tenantId:id2,productionId:id2,shotId:id2,versionId:id2,reviewId:id2});import{z as z4}from"zod";var ImportedVideoReviewRecordSchema=VideoReviewRecordSchema.omit({generationId:true,candidateId:true,preparationId:true,contractId:true,contractFingerprint:true}).extend({sourceKind:z4.literal("IMPORTED"),normalizationId:z4.uuid(),sourceId:z4.uuid(),sourceVersionId:z4.uuid(),planVersionId:z4.uuid(),shotPlanningRevision:z4.int().positive()});var ImportedVideoReviewReceiptSchema=z4.strictObject({semanticStatus:z4.literal("SUCCESS"),review:ImportedVideoReviewRecordSchema,productionRevision:z4.int().positive()});import{z as z5}from"zod";var ImportedVisualCancellationSchema=z5.strictObject({cancellationRequested:z5.boolean()});var ImportedVisualAdmissionSchema=z5.strictObject({semanticStatus:z5.literal("ACCEPTED"),normalizationId:z5.uuid(),runtimeJobId:z5.uuid(),sourceId:z5.uuid(),sourceVersionId:z5.uuid(),productionRevision:z5.int().positive(),deviceExecution:DeviceRenderReceiptSchema.optional()});var ImportedVisualReviewTargetSchema=ProgrammaticVideoReviewTargetSchema.omit({renderId:true,compositionId:true,compositionVersionId:true,compositionVersion:true,compositionFingerprint:true,renderManifestFingerprint:true}).extend({sourceKind:z5.literal("IMPORTED"),normalizationId:z5.uuid(),sourceId:z5.uuid(),sourceVersionId:z5.uuid(),latestReview:ImportedVideoReviewRecordSchema.nullable()});import{z as z6}from"zod";var ImportedVisualOriginalGetSchema=z6.strictObject({tenantId:z6.uuid(),productionId:z6.uuid(),sourceId:z6.uuid(),version:z6.int().positive().optional()});var ImportedVisualOriginalHistoryQuerySchema=z6.strictObject({tenantId:z6.uuid(),productionId:z6.uuid(),sourceId:z6.uuid(),beforeVersion:z6.int().positive().optional(),limit:z6.int().min(1).max(50).default(20)});var ImportedVisualOriginalHistorySchema=z6.strictObject({sourceId:z6.uuid(),items:z6.array(ImportedVisualOriginalViewSchema).max(50),nextBeforeVersion:z6.int().positive().nullable()});var ImportedVisualOriginalQuerySchema=z6.strictObject({tenantId:z6.uuid().toLowerCase(),productionId:z6.uuid().toLowerCase(),shotId:z6.uuid().toLowerCase().optional(),afterSourceId:z6.uuid().toLowerCase().optional(),limit:z6.int().min(1).max(50).default(20)});var ImportedVisualOriginalPageSchema=z6.strictObject({tenantId:z6.uuid(),productionId:z6.uuid(),items:z6.array(ImportedVisualOriginalViewSchema).max(50),nextAfterSourceId:z6.uuid().nullable()}).refine(p=>p.nextAfterSourceId===null||p.items.at(-1)?.sourceId===p.nextAfterSourceId);import{z as z7}from"zod";var Content=z7.string().min(44).max(178956972).refine(value=>{if(value.length%4||/[^A-Za-z0-9+/=]/.test(value))return false;const padding=value.endsWith("==")?2:value.endsWith("=")?1:0;return value.indexOf("=")===(padding?value.length-padding:-1)},"Invalid base64").refine(value=>{const alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return value.endsWith("==")?alphabet.indexOf(value.at(-3))%16===0:value.endsWith("=")?alphabet.indexOf(value.at(-2))%4===0:true},"Noncanonical base64");var ImportedVisualOriginalUploadSchema=ImportedVisualOriginalRegisterSchema.extend({contentBase64:Content});var ImportedVisualOriginalRevisionUploadSchema=ImportedVisualOriginalReviseSchema.extend({contentBase64:Content});var LegacyImportedVisualUploadSchema=ImportedVisualOriginalUploadSchema.omit({deviceId:true});var LegacyImportedVisualRevisionSchema=ImportedVisualOriginalRevisionUploadSchema.omit({deviceId:true});var LegacyImportedVisualProjectSourceSchema=ImportedVisualFromProjectSourceSchema.omit({deviceId:true});var LocalLibraryCommandStatusSchema=z8.strictObject({admission:LocalLibraryAdmissionSchema,lifecycle:z8.enum(["READY","WAITING","RUNNING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),receipt:TenantProcessorReceiptSchema.nullable(),inspection:LocalLibraryInspectionSchema.nullable(),failureSummary:z8.string().max(500).nullable()}).superRefine(({admission,receipt},ctx)=>{if(receipt&&(receipt.tenantId!==admission.tenantId||receipt.projectId!==admission.projectId||receipt.productionId!==admission.productionId||receipt.runtimeJobId!==admission.runtimeJobId||receipt.operationId!==admission.operationId))ctx.addIssue({code:"custom",message:"Original native receipt must match admitted local file work"})});import{z as z9}from"zod";var RenderReadinessInputSchema=z9.strictObject({tenantId:z9.uuid(),projectId:z9.uuid().optional(),productionId:z9.uuid().optional(),kind:z9.enum(["preview","final"]),deviceId:z9.uuid().optional(),hostAccess:z9.enum(["MCP_ONLY","AUTHORIZED_HOST"]).optional()});var RenderReadinessSchema=RenderReadinessInputSchema.omit({hostAccess:true}).extend({protocol:z9.literal("NVS_RENDER_READINESS_V1"),observedAt:z9.iso.datetime(),state:z9.enum(["SELECT_PROJECT","SELECT_PRODUCTION","BUSINESS_BLOCKED","AUTHORIZATION_REQUIRED","CHECK_DEVICE_INVENTORY","DEVICE_QUALIFICATION_UNKNOWN","WAIT_FOR_DEVICE","PREPARE_HOST","HOST_HANDOFF_REQUIRED","DEVICE_UNAVAILABLE","READY"]),reasonCode:z9.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),writeAuthorization:z9.enum(["READ_ONLY","WRITE_SCOPE_PRESENT","CHECK_AT_ADMISSION"]),blockers:FinalRenderEligibilitySchema.shape.blockers.optional(),sourceBlockers:FinalRenderEligibilitySchema.shape.sourceBlockers.optional(),candidates:ProjectDeviceListSchema.optional(),executionTarget:DeviceRenderTargetSchema.optional(),nextAction:z9.strictObject({owner:z9.enum(["AGENT","HOST_OWNER","AUTHORIZED_MEMBER","TENANT_OPERATOR"]),inspect:z9.strictObject({tool:z9.enum(["studio_capability_query","studio_capability_describe","workspace_caller"]),arguments:z9.record(z9.string(),z9.unknown())}).optional(),hostRequirements:z9.strictObject({packageName:z9.literal("@nativestudio/cli"),nodeMajor:z9.literal(24),permission:z9.literal("AUTHORIZED_USER_SHELL")}).optional()})});function renderDeviceSelection(candidates,requestedDeviceId){const fixed=requestedDeviceId?.toLowerCase();const available=candidates.items.filter(item=>item.availability==="AVAILABLE"&&(!fixed||item.deviceId.toLowerCase()===fixed));if(available.length>1)return{state:"DEVICE_SELECTION_REQUIRED"};if(available[0]&&(fixed||!candidates.truncated))return{state:"AVAILABLE",deviceId:available[0].deviceId};return{state:candidates.truncated?"INCOMPLETE_INVENTORY":"UNAVAILABLE"}}function currentPreviewRenderBasis(basis,current){if(!current||!current.isCurrent||current.assemblyStatus!=="ASSEMBLY_READY"||current.freshness!=="CURRENT_BASIS"||basis.currentTimelineVersion!==current.version.version)return null;return{timelineVersionId:current.version.id,timelineFingerprint:current.version.fingerprint,expectedProductionRevision:basis.productionRevision}}import{z as z10}from"zod";var NavigationGroupIdSchema=z10.enum(["navigation","materials","planning","execution","review","delivery","local","administration","unclassified"]);var NavigationGroups=Object.freeze([{id:"navigation",title:"\u5BFC\u822A\u4E0E\u6062\u590D",description:"Locate Productions, inspect state and reconcile original Operations"},{id:"materials",title:"\u9879\u76EE\u4E0E\u7D20\u6750",description:"Projects, source material, references and Artifact discovery"},{id:"planning",title:"\u521B\u4F5C\u4E0E\u8BA1\u5212",description:"Brief, Story, Scenes, Shots and creative plans"},{id:"execution",title:"\u6267\u884C\u4E0E\u8FDB\u5EA6",description:"Generation, runtime Jobs, observation and cancellation"},{id:"review",title:"\u5BA1\u67E5\u4E0E\u4FEE\u590D",description:"Review targets, Findings, evidence and repair"},{id:"delivery",title:"\u88C5\u914D\u4E0E\u4EA4\u4ED8",description:"Timeline, composition, preview, rendering and delivery"},{id:"local",title:"\u672C\u5730\u6267\u884C",description:"Authorized local Runtime, media tools and Agent connections"},{id:"administration",title:"\u7BA1\u7406\u4E0E\u96C6\u6210",description:"Tenant integration, Providers and native authority configuration"},{id:"unclassified",title:"\u5F85\u5206\u7C7B\u80FD\u529B",description:"Registered capabilities awaiting explicit semantic classification"}]);var namespaces=[["navigation",/^nvs_open_execution$/],["local",/^(?:local_|device_|list_devices$)/],["administration",/^(?:provider_|tenant_|oauth_|credential_|native_tool_|agent_host_|webhook_|federation_)/],["review",/(?:^|_)(?:review|reviewer|finding|repair)(?:_|$)/],["navigation",/^(?:workspace_|studio_|operation_|production_(?:query|snapshot)|job_(?:get|query)|production_guidance_)/],["materials",/^(?:project_|source_|artifact_|reference_|visual_sequence_|imported_visual_|source_sync_)/],["planning",/^(?:brief_|story_|scene_|shot_|writer_|director_|exploration_|consistency_|series_|voice_profile_|making_|sound_plan_|planning_|editor_)/],["delivery",/^(?:share_|timeline_|composition_|rough_cut_|final_|delivery_|caption_|audio_)/],["execution",/^(?:production_|keyframe_|video_|generation_|speech_|media_observation_|temporal_evidence_|lifecycle_)/]];function navigationGroup(tool){return namespaces.find(([,pattern])=>pattern.test(tool))?.[0]??"unclassified"}import{z as z13}from"zod";import{z as z12}from"zod";import{z as z11}from"zod";var OperationTargetSchema=z11.object({type:z11.string().min(1).max(120),id:z11.string().min(1).max(2048),version:z11.int().positive().nullable()});var OperationFailureReasonSchema=z11.enum(["AMBIGUOUS","PERMANENT_OPERATIONAL","SEMANTIC","RATE_LIMIT","TRANSIENT","NOT_RECORDED"]);var productionScope=z11.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var OperationFailureSchema=z11.strictObject({reasonCodes:z11.array(OperationFailureReasonSchema).min(1).max(OperationFailureReasonSchema.options.length).refine(codes=>new Set(codes).size===codes.length),summary:z11.string().min(1).max(1e3),next:z11.discriminatedUnion("capability",[z11.strictObject({capability:z11.literal("operation.get"),input:productionScope.extend({operationId:OperationIdSchema})}),z11.strictObject({capability:z11.literal("production.snapshot"),input:productionScope})])});var OperationSummarySchema=z11.object({humanLinks:HumanLinksSchema.optional(),id:OperationIdSchema,productionId:ProductionIdSchema,semanticStatus:InterfaceSemanticStatusSchema,targets:z11.array(OperationTargetSchema).max(100),work:WorkSummarySchema,blockers:z11.array(z11.string().min(1).max(1e3)).max(100),failure:OperationFailureSchema.optional(),nextActions:z11.array(NextActionSchema).max(50),startedAt:z11.iso.datetime({offset:true}),updatedAt:z11.iso.datetime({offset:true})});var ProductionQueryInputSchema=z12.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema.optional(),search:z12.string().trim().min(1).max(200).optional(),attention:z12.enum(["NEEDS_YOU","WORKING","FINISHED"]).optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProductionQueryPageSchema=z12.object({items:z12.array(ProductionSchema),page:QueryPageInfoSchema});var OperationQueryInputSchema=z12.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var OperationQueryPageSchema=z12.object({items:z12.array(OperationSummarySchema),page:QueryPageInfoSchema});var StoryQueryInputSchema=z12.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var StoryQueryPageSchema=z12.object({items:z12.array(StoryVersionSchema),page:QueryPageInfoSchema});var SceneShotPlanQueryInputSchema=z12.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var SceneShotPlanQueryPageSchema=z12.object({items:z12.array(SceneShotPlanVersionSchema),page:QueryPageInfoSchema});var NavigationProfile="contextual-v1";var NavigationProfileKey="io.nativestudio/discovery-profile";var NavigationToolNames=["studio_start","studio_capability_search","studio_capability_describe","studio_capability_groups","studio_navigate"];var Scope=z13.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema.optional()});var ToolName=z13.string().regex(/^[a-zA-Z0-9_-]{1,120}$/);var StudioStartInputSchema=ProductionQueryInputSchema.extend({limit:z13.int().min(1).max(5).default(5)}).strict();var StudioStartSchema=z13.object({tenantId:TenantIdSchema,choices:ProductionQueryPageSchema.shape.items.max(5),page:ProductionQueryPageSchema.shape.page,selection:z13.enum(["NONE","ONE","CHOOSE"]),guidance:z13.literal("Select an explicit Production ID, then call studio_navigate. Never infer an ID.")}).strict();var CapabilitySummarySchema=z13.object({tool:ToolName,title:z13.string().max(500),description:z13.string().max(6e3),family:z13.string().min(1).max(120),group:NavigationGroupIdSchema.optional(),readOnly:z13.boolean(),invocationTool:z13.enum(["studio_capability_query","studio_capability_invoke"]).optional(),registration:z13.literal("REGISTERED")}).strict();var CapabilitySearchInputSchema=Scope.extend({query:z13.string().trim().min(1).max(240),family:z13.string().regex(/^[a-z0-9_-]{1,120}$/).optional(),group:NavigationGroupIdSchema.optional(),limit:z13.int().min(1).max(8).default(5),next:z13.string().min(1).max(2048).optional()}).strict();var CapabilitySearchSchema=z13.object({tenantId:TenantIdSchema,catalogVersion:z13.string().regex(/^[a-f0-9]{64}$/),outcome:z13.enum(["MATCHES","AMBIGUOUS","NO_MATCH"]),candidates:z13.array(CapabilitySummarySchema.extend({matchedTerms:z13.array(z13.string().max(120)).max(24)})).max(8),page:z13.object({hasMore:z13.boolean(),next:z13.string().max(2048).nullable()}).strict(),guidance:z13.literal("Registration is not availability or authorization. Inspect the selected schema and native context before invoking its typed command.")}).strict();var CapabilityDescribeInputSchema=Scope.extend({tool:ToolName,schemaCursor:z13.string().min(1).max(2048).optional()}).strict();var JsonSchema=z13.record(z13.string(),z13.unknown());var PublicToolDefinitionSchema=z13.object({name:ToolName,title:z13.string().optional(),description:z13.string().optional(),inputSchema:JsonSchema,outputSchema:JsonSchema.optional(),annotations:JsonSchema.optional(),execution:JsonSchema.optional(),_meta:JsonSchema.optional(),icons:z13.array(JsonSchema).optional()}).strict();var CapabilityGroupsInputSchema=Scope.extend({includeDefinitions:z13.boolean().optional()}).strict();var CapabilityGroupsSchema=z13.object({tenantId:TenantIdSchema,catalogVersion:z13.string().regex(/^[a-f0-9]{64}$/),definitions:z13.array(PublicToolDefinitionSchema).max(6).optional(),groups:z13.array(z13.object({id:NavigationGroupIdSchema,title:z13.string().max(120),description:z13.string().max(500),count:z13.int().nonnegative(),readOnlyCount:z13.int().nonnegative()}).strict()).max(9)}).strict();var CapabilityDescribeSchema=CapabilitySummarySchema.extend({tenantId:TenantIdSchema,catalogVersion:z13.string().regex(/^[a-f0-9]{64}$/),capabilityVersion:CapabilityVersionSchema.optional(),outputContract:z13.enum(["DECLARED","NOT_DECLARED"]),schemaCursor:z13.string().min(1).max(2048),definition:PublicToolDefinitionSchema,guidance:z13.literal("Use this bounded definition as client-local schema metadata. Standard tools/list stays stable; commands revalidate authority and current state.")}).strict();var StudioNavigateInputSchema=Scope.extend({productionId:ProductionIdSchema,goal:z13.string().trim().min(1).max(240).optional(),actionLimit:z13.int().min(1).max(8).default(8).describe("Native action page size: 1\u20138 (default 8). Omit this field unless a smaller page is needed."),actionNext:z13.string().min(1).max(2048).optional().describe("Opaque actions.page.next; keep the same goal and actionLimit. Changed native state requires a fresh first page.")}).strict();import{createHash}from"node:crypto";import{z as z14}from"zod";var PrepareTenantMediaValidationSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputReceiptIds:z14.array(LocalIdSchema).length(2).refine(ids=>new Set(ids).size===2)});var TenantMediaValidationRequestSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,validationRequestId:LocalIdSchema,work:TenantMediaWorkSchema,outputs:z14.array(MediaObjectVersionSchema).length(2)});var TenantMediaValidationReadbackSchema=z14.strictObject({request:TenantMediaValidationRequestSchema,tickets:z14.array(MediaObjectTicketSchema).length(2)});var TenantMediaDownloadSchema=LocalProjectScopeSchema.extend({representationId:LocalIdSchema});var TenantMediaOutputStageSchema=z14.strictObject({ticket:MediaObjectTicketSchema,uploaded:z14.boolean()});var TenantRenderMediaInputSchema=TimelineScopeSchema.extend({renderId:z14.uuid(),role:z14.enum(["VIDEO","POSTER"])});var TenantRenderMediaTicketSchema=TenantRenderMediaInputSchema.extend({representationId:z14.uuid(),ticket:MediaObjectTicketSchema.extend({object:MediaObjectVersionSchema.extend({tenantId:z14.uuid(),projectId:z14.uuid(),versionId:z14.uuid()})})});var TenantMediaCapabilitySchema=z14.strictObject({tenantId:LocalIdSchema,validationMode:z14.literal("TENANT_TRUSTED_VALIDATOR")});var failed=()=>new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");async function downloadImmutableObject(ticket,options={}){const object=MediaObjectVersionSchema.parse(ticket.object),url=new URL(ticket.endpoint);if(ticket.method!=="GET"||url.pathname!==mediaObjectTransferPath||url.username||url.password||url.search||url.hash||url.protocol!=="https:"&&!(url.protocol==="http:"&&url.hostname==="127.0.0.1"))throw failed();const timeout=AbortSignal.timeout(12e4);const signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;try{const response=await fetch(url,{headers:{authorization:"Bearer "+ticket.credential},credentials:"omit",redirect:"error",signal});if(response.status!==200||response.headers.get("x-media-object-version")!==object.versionId||response.headers.get("x-content-sha256")!==object.checksumSha256||response.headers.get("content-length")!==String(object.byteSize)){await response.body?.cancel();throw failed()}const bytes=await boundedResponseBytes(response,object.byteSize,signal);if(bytes.byteLength!==object.byteSize||createHash("sha256").update(bytes).digest("hex")!==object.checksumSha256)throw failed();return{bytes,object}}catch{throw failed()}}async function downloadRenderObject(ticket,options){if(ticket.object.role==="SOURCE")throw failed();const result=await downloadImmutableObject(ticket,options);return{...result,contentType:result.object.role==="VIDEO"?"video/mp4":"image/png"}}import{z as z64}from"zod";import{z as z17}from"zod";import{z as z16}from"zod";import{z as z15}from"zod";var sha=z15.string().regex(/^[0-9a-f]{64}$/);var DeliveryManifestBasisSchema=z15.strictObject({schemaVersion:z15.literal(1),evaluatorVersion:z15.literal("DELIVERY_V1"),target:DeliveryTargetSchema,policyVersionId:z15.uuid(),policyVersion:z15.int().positive(),policy:DeliveryPolicySchema,policyFingerprint:sha,finalRenderRuntimeJobId:z15.uuid(),finalRenderManifest:FinalRenderManifestReaderSchema,finalRenderTechnical:FinalRenderTechnicalSchema,roughCutReview:RoughCutReviewRecordSchema,artifacts:z15.array(z15.strictObject({artifactId:z15.uuid(),family:z15.string().min(1).max(100),origin:z15.string().min(1).max(100),checksumSha256:sha})).min(1).max(2e3),relations:z15.array(z15.strictObject({id:z15.uuid(),sourceArtifactId:z15.uuid(),targetArtifactId:z15.uuid(),relationType:z15.string().min(1).max(100)})).max(4e3)}).superRefine((basis,ctx)=>{const t=basis.target,m=basis.finalRenderManifest;if(t.selectionId!==m.selection.id||t.selectionVersion!==m.selectionVersion||t.timelineVersionId!==m.timeline.id||t.timelineFingerprint!==m.timeline.fingerprint||t.tenantId!==m.timeline.tenantId||t.projectId!==m.timeline.projectId||t.productionId!==m.timeline.productionId||t.executionClass!==m.timeline.executionClass||t.checksumSha256!==basis.finalRenderTechnical.checksumSha256||t.byteSize!==basis.finalRenderTechnical.byteSize||basis.finalRenderTechnical.hasAudio!==m.profile.hasAudio||basis.roughCutReview.id!==m.selection.reviewId||basis.roughCutReview.basisFingerprint!==m.selection.basisFingerprint||!basis.artifacts.some(a=>a.artifactId===t.artifactId&&a.checksumSha256===t.checksumSha256)||new Set(basis.artifacts.map(a=>a.artifactId)).size!==basis.artifacts.length||new Set(basis.relations.map(r=>r.id)).size!==basis.relations.length||basis.relations.some(r=>!basis.artifacts.some(a=>a.artifactId===r.sourceArtifactId)||!basis.artifacts.some(a=>a.artifactId===r.targetArtifactId)))ctx.addIssue({code:"custom",message:"Manifest must identify exact render, Review-2 and provenance"})});var ProductionDeliveryManifestSchema=DeliveryManifestBasisSchema.safeExtend({reviewId:z15.uuid(),productionRevision:z15.int().positive(),completedAt:z15.iso.datetime({offset:true})});var DeliveryManifestGetSchema=TimelineScopeSchema.extend({manifestId:z15.uuid()});var RegisteredDeliveryManifestSchema=z15.strictObject({link:DeliveryManifestLinkSchema,body:ProductionDeliveryManifestSchema}).refine(v=>v.link.reviewId===v.body.reviewId&&v.link.policyFingerprint===v.body.policyFingerprint&&Object.keys(DeliveryTargetSchema.shape).every(key6=>v.link.target[key6]===v.body.target[key6]),"Manifest registration must match exact body");var sha2=z16.string().regex(/^[0-9a-f]{64}$/);var mutation=TimelineScopeSchema.extend({expectedProductionRevision:z16.int().positive(),idempotencyKey:z16.string().trim().min(1).max(200)});var ConfigureDeliveryPolicySchema=mutation.extend({expectedPolicyVersion:z16.int().nonnegative(),policy:DeliveryPolicyInputSchema});var DeliveryPolicyVersionSchema=TimelineScopeSchema.extend({id:z16.uuid(),projectId:z16.uuid(),version:z16.int().positive(),policy:DeliveryPolicySchema,policyFingerprint:sha2,createdByPrincipalId:z16.uuid(),createdAt:z16.iso.datetime({offset:true})});var DeliveryPolicyReceiptSchema=z16.strictObject({policy:DeliveryPolicyVersionSchema,productionRevision:z16.int().positive()});var LegacyStartDeliveryValidationSchema=mutation.extend({target:DeliveryTargetSchema,expectedPolicyVersion:z16.int().nonnegative()}).refine(v=>v.target.tenantId===v.tenantId&&v.target.productionId===v.productionId,"Exact delivery target must match command scope");var StartDeliveryValidationSchema=LegacyStartDeliveryValidationSchema.safeExtend({deviceId:z16.uuid().toLowerCase().optional()});var DeliveryValidationGetSchema=TimelineScopeSchema.extend({validationId:z16.uuid()});var DecideDeliveryApprovalSchema=mutation.extend({validationId:z16.uuid(),reviewId:z16.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha2,action:z16.enum(["APPROVE","REJECT"])}).refine(v=>v.target.tenantId===v.tenantId&&v.target.productionId===v.productionId,"Exact approval target must match command scope");var DeliveryAdmissionSchema=z16.strictObject({humanLinks:HumanLinksSchema.optional(),semanticStatus:z16.literal("ACCEPTED"),validationId:z16.uuid(),runtimeJobId:z16.uuid(),operationId:z16.string().min(1),target:DeliveryTargetSchema,policyVersionId:z16.uuid(),policyVersion:z16.int().positive(),policyFingerprint:sha2,manifestBasisFingerprint:sha2,evaluatorVersion:z16.literal("DELIVERY_V1"),productionRevision:z16.int().positive()});var DeliveryFindingSchema=z16.strictObject({id:z16.uuid(),reviewId:z16.uuid(),target:DeliveryTargetSchema,key:DeliveryCheckKeySchema,detail:z16.string().trim().min(1).max(1e3),blocking:z16.literal(true),createdAt:z16.iso.datetime({offset:true})});var DeliveryCompletionBlockerSchema=z16.enum(["VALIDATION_FAILED","EXACT_OUTPUT_CHANGED","DELIVERY_POLICY_CHANGED","FINAL_READY_STALE","ARTIFACT_UNAVAILABLE","PROVENANCE_INCOMPLETE","MANIFEST_NOT_REGISTERED","MANIFEST_BINDING_MISMATCH","BLOCKING_FINDINGS","TEST_EVIDENCE_DISABLED","APPROVAL_BINDING_MISMATCH","APPROVAL_REJECTED"]);var DeliveryReviewReceiptSchema=z16.strictObject({review:DeliveryValidationReviewSchema,action:z16.enum(["COMPLETE","WAITING_HUMAN","BLOCK"]),blockers:z16.array(DeliveryCompletionBlockerSchema).max(12),productionRevision:z16.int().positive()});var DeliveryDecisionReceiptSchema=z16.strictObject({humanLinks:HumanLinksSchema.optional(),approval:DeliveryApprovalSchema,finalDelivery:FinalDeliveryReceiptSchema.nullable(),productionRevision:z16.int().positive(),condition:z16.enum(["RUNNABLE","BLOCKED"])});var DeliveryValidationViewSchema=z16.strictObject({humanLinks:HumanLinksSchema.optional(),admission:DeliveryAdmissionSchema,policy:DeliveryPolicyVersionSchema,manifestBasis:DeliveryManifestBasisSchema,runtimeStatus:z16.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),current:z16.boolean(),reviewReceipt:DeliveryReviewReceiptSchema.nullable(),findings:z16.array(DeliveryFindingSchema).max(16),approval:DeliveryApprovalSchema.nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});var DeliverySnapshotSchema=TimelineScopeSchema.extend({humanLinks:HumanLinksSchema.optional(),productionRevision:z16.int().positive(),policy:DeliveryPolicyVersionSchema.nullable(),currentValidationId:z16.uuid().nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});var DeliverySummarySchema=z17.strictObject({policy:DeliveryPolicyVersionSchema.nullable(),validation:z17.strictObject({id:z17.uuid(),runtimeStatus:DeliveryValidationViewSchema.shape.runtimeStatus,current:z17.boolean(),reviewId:z17.uuid().nullable(),result:z17.enum(["PASS","FAIL"]).nullable(),action:z17.enum(["COMPLETE","WAITING_HUMAN","BLOCK"]).nullable(),blockingChecks:z17.array(DeliveryCheckKeySchema).max(16),approvalAction:z17.enum(["APPROVE","REJECT"]).nullable()}).nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});import{z as z21}from"zod";import{z as z20}from"zod";import{z as z19}from"zod";import{z as z18}from"zod";var ShotSoundContentSchema=z18.strictObject({model:z18.strictObject({modelProfileId:z18.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z18.int().positive(),connectionId:z18.uuid()}).optional(),nativeAudio:z18.boolean(),cues:z18.array(z18.strictObject({id:z18.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z18.enum(["DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT","NARRATION"]),startMs:z18.int().nonnegative().max(3e4),endMs:z18.int().positive().max(3e4),text:z18.string().trim().min(1).max(6e3).optional(),exactSpeech:z18.boolean(),lipSync:z18.enum(["REQUIRED","NONE"])}).refine(v=>v.endMs>v.startMs)).max(64)});var ShotSoundInstructionSchema=z18.strictObject({soundPlanVersionId:z18.uuid().toLowerCase(),fingerprint:z18.string().regex(/^[0-9a-f]{64}$/),content:ShotSoundContentSchema});var GenerationContractSchema=z19.strictObject({id:GenerationContractIdSchema,schemaVersion:z19.literal(1),preparationId:PreparationIdSchema,target:PreparationTargetSchema,basis:PreparationBasisSchema,mode:z19.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),creativeInstruction:z19.strictObject({sound:ShotSoundInstructionSchema.optional(),shot:ShotIntentSchema,scenePurpose:z19.string().min(1).max(800),locationContext:z19.string().max(300).optional(),timeContext:z19.string().max(300).optional(),productPresentationGoal:z19.string().min(1).max(1e3),styleTone:z19.string().max(300).optional(),entryBoundary:z19.array(BoundaryRequirementSchema).max(48),exitBoundary:z19.array(BoundaryRequirementSchema).max(48)}),acceptedShotReferences:z19.array(AcceptedVisualSourceReferenceSchema).max(24).default([]),constraintSetFingerprint:ContentFingerprintSchema,referenceSetFingerprint:ContentFingerprintSchema,output:z19.strictObject({aspectRatio:z19.enum(["16:9","9:16"]),targetDurationSeconds:z19.number().min(.5).max(30).nullable(),workingResolution:z19.null(),frameRate:z19.null(),finalDeliveryProfile:DeliveryOutputProfileSchema}),requiredCapabilities:z19.strictObject({referenceConditioning:z19.literal(true),referenceRoles:z19.array(ReferenceRoleSchema).min(1).max(8),startFrameControl:z19.boolean(),endFrameControl:z19.boolean(),nativeAudio:z19.boolean().optional()}),fingerprint:ContentFingerprintSchema}).superRefine((value,context)=>{const invalid=message=>context.addIssue({code:"custom",message});if(value.target.mediaType==="IMAGE"&&value.acceptedShotReferences.length)invalid("Image generation cannot depend on accepted video Shots");if(value.target.mediaType==="IMAGE"&&(value.mode!=="REFERENCE_TO_IMAGE"||value.output.targetDurationSeconds!==null||value.requiredCapabilities.startFrameControl||value.requiredCapabilities.endFrameControl))invalid("Image generation cannot claim video duration or frame-control semantics");if(value.target.mediaType==="VIDEO"&&(value.mode==="REFERENCE_TO_IMAGE"||value.output.targetDurationSeconds===null))invalid("Video generation requires video mode and duration");const roles=value.requiredCapabilities.referenceRoles;if(!roles.some(role=>role==="PRODUCT_IDENTITY"||role==="PRODUCT_PACKSHOT"))invalid("Product identity requires concrete reference conditioning");if(value.requiredCapabilities.startFrameControl&&!roles.includes("START_FRAME_ANCHOR"))invalid("Start-frame control requires an exact anchor role");if(value.requiredCapabilities.endFrameControl&&!roles.includes("END_FRAME_ANCHOR"))invalid("End-frame control requires an exact anchor role");if(value.mode==="FIRST_LAST_FRAME_TO_VIDEO"&&(!value.requiredCapabilities.startFrameControl||!value.requiredCapabilities.endFrameControl))invalid("First/last mode requires both anchor capabilities")});var PrepareShotRequestSchema=z20.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z20.int().positive(),expectedPlanVersionId:SceneShotPlanVersionIdSchema,expectedPlanVersion:z20.int().positive(),expectedShotPlanningRevision:z20.int().positive(),expectedPreparationVersion:z20.int().nonnegative(),idempotencyKey:z20.string().trim().min(1).max(200),target:PreparationTargetSchema,referenceBindings:z20.array(ReferenceBindingInputSchema).max(12).default([])});var PreparationVersionSchema=z20.strictObject({id:PreparationIdSchema,version:z20.int().positive(),basis:PreparationBasisSchema,target:PreparationTargetSchema,constraints:ConstraintSetSchema,referenceSet:ReferenceSetSchema,canonicalSources:z20.array(ExactEvidenceReferenceSchema).max(64),acceptedShotReferences:z20.array(AcceptedVisualSourceReferenceSchema).max(24).default([]),blockers:z20.array(PreparationBlockerSchema).max(2048),contract:GenerationContractSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z20.iso.datetime({offset:true})}).superRefine((value,context)=>{const invalid=message=>context.addIssue({code:"custom",message});if(value.constraints.preparationId!==value.id||value.referenceSet.preparationId!==value.id||value.constraints.version!==value.version||value.referenceSet.version!==value.version)invalid("Resolved snapshot identity must match preparation");if(value.contract!==null!==(value.blockers.length===0))invalid("A preparation contract exists only for an unblocked preflight");if(value.contract&&(value.contract.preparationId!==value.id||JSON.stringify(value.contract.basis)!==JSON.stringify(value.basis)||JSON.stringify(value.contract.target)!==JSON.stringify(value.target)||value.contract.constraintSetFingerprint!==value.constraints.fingerprint||value.contract.referenceSetFingerprint!==value.referenceSet.fingerprint||JSON.stringify(value.contract.acceptedShotReferences)!==JSON.stringify(value.acceptedShotReferences)))invalid("Generation Contract must freeze the exact preparation basis and snapshots")});var PrepareShotResultSchema=z20.strictObject({semanticStatus:z20.literal("SUCCESS"),preparation:PreparationVersionSchema,productionRevision:z20.int().positive()});var PreparationViewSchema=z20.strictObject({preparation:PreparationVersionSchema,freshness:z20.enum(["CURRENT_BASIS","STALE_BASIS"]),superseded:z20.boolean(),freshnessReasons:z20.array(z20.enum(["PLAN_CHANGED","SHOT_CHANGED","REFERENCE_UNAVAILABLE","CONSISTENCY_PROFILE_CHANGED","SOUND_PLAN_CHANGED","SUPERSEDED","KEYFRAME_SELECTION_CHANGED","PREDECESSOR_ACCEPTANCE_CHANGED"])).max(8),execution:z20.strictObject({eligibleVideoSelections:z20.array(ProviderSelectionSchema).max(1600).optional(),available:z20.boolean(),reasons:z20.array(z20.enum(["STALE_BASIS","PREPARATION_BLOCKED","PRODUCTION_NOT_RUNNABLE","PROVIDER_CAPABILITY_UNAVAILABLE","VIDEO_SELECTION_REQUIRED"])).min(0).max(4)})});var PreparationQueryInputSchema=z20.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),mediaType:z20.enum(["IMAGE","VIDEO"]).optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var PreparationQueryPageSchema=z20.strictObject({items:z20.array(PreparationViewSchema),page:QueryPageInfoSchema});var PreparationGetInputSchema=z20.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,preparationId:PreparationIdSchema});var PreparationActiveInputSchema=z20.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,mediaType:z20.enum(["IMAGE","VIDEO"])});var PreparationSummarySchema=z20.strictObject({latest:z20.int().nonnegative(),current:z20.int().nonnegative(),stale:z20.int().nonnegative(),contractValid:z20.int().nonnegative(),preflightBlocked:z20.int().nonnegative(),executionAvailable:z20.int().nonnegative()});var NullableVersionSchema=z21.int().positive().nullable();var ProductionBlockerSchema=z21.object({code:z21.string().min(1).max(120),summary:z21.string().min(1).max(1e3),targetType:z21.string().min(1).max(80),targetId:z21.string().min(1).max(2048)});var ProductionSnapshotSchema=z21.object({humanLinks:HumanLinksSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,state:ProductionStateSchema,planning:z21.object({activeBriefVersion:NullableVersionSchema,activeStoryVersion:NullableVersionSchema,activeSceneShotPlanVersion:NullableVersionSchema}),preparation:PreparationSummarySchema.optional(),keyframes:KeyframeSummarySchema.optional(),keyframeReview:KeyframeReviewSummarySchema.optional(),videos:VideoSummarySchema.optional(),captions:CaptionSnapshotSchema.optional(),audio:AudioSnapshotSchema.optional(),shots:z21.object({planned:z21.int().nonnegative(),ready:z21.int().nonnegative(),generating:z21.int().nonnegative(),candidates:z21.int().nonnegative(),accepted:z21.int().nonnegative(),blocked:z21.int().nonnegative(),stale:z21.int().nonnegative()}),findings:z21.object({open:z21.int().nonnegative(),blocking:z21.int().nonnegative(),warnings:z21.int().nonnegative()}),timeline:z21.object({currentVersion:NullableVersionSchema,stale:z21.boolean(),...TimelineSnapshotSchema.omit({currentVersion:true,stale:true}).partial().shape}),roughCut:RoughCutSnapshotSchema.partial().required({latestVersion:true,reviewState:true}),review2:RoughCutReviewSnapshotSchema.optional(),final:z21.object({ready:FinalReadyViewSchema.optional(),render:FinalRenderSnapshotSchema.optional(),renderState:z21.string().min(1).max(120).nullable(),delivery:DeliverySummarySchema.optional(),deliveryValidationState:z21.string().min(1).max(120).nullable()}),work:WorkSummarySchema,activeOperations:z21.array(OperationSummarySchema).max(20),blockers:z21.array(ProductionBlockerSchema).max(100),latestDecisions:z21.array(z21.string().min(1).max(1e3)).max(50),nextActions:z21.array(NextActionSchema).max(50),generatedAt:z21.iso.datetime({offset:true})});import{z as z22}from"zod";var InterfaceCancellationDataSchema=z22.strictObject({cancellationAccepted:z22.boolean()});var InterfaceCancellationReceiptSchema=InterfaceCancellationDataSchema.extend({semanticStatus:z22.literal("SUCCESS")});import{z as z24}from"zod";import{z as z23}from"zod";var key=z23.string().trim().min(1).max(200);var ScopedSourceInputSchema=SourceInputMetadataSchema.extend({projectId:ProjectIdSchema,idempotencyKey:key});var ScopedSourceUploadSchema=UploadSourceInputRequestSchema.extend({projectId:ProjectIdSchema,idempotencyKey:key});var SourceReadSchema=SourceLibraryMediaSchema.extend({offsetBytes:z23.int().min(0).max(8388608).default(0),maxTextBytes:z23.int().min(4).max(65536).default(16384)});var SourceTextWindowSchema=SourceLibraryMediaSchema.extend({contentType:z23.enum(["text/plain","application/json"]),checksumSha256:z23.string().regex(/^[0-9a-f]{64}$/),totalBytes:z23.int().positive().max(8388608),offsetBytes:z23.int().nonnegative(),byteLength:z23.int().nonnegative().max(65536),nextOffsetBytes:z23.int().nonnegative().nullable(),text:z23.string().max(65536)});var InterfaceImageMetadataSchema=KeyframeMediaSchema.omit({contentBase64:true});var InterfacePosterMetadataSchema=InterfaceImageMetadataSchema.extend({contentType:z24.literal("image/png")});var InterfaceDownloadDescriptorSchema=z24.strictObject({humanLinks:HumanLinksSchema.optional(),method:z24.literal("GET"),path:z24.string().min(1).max(2048),tenantId:TenantIdSchema,authentication:z24.literal("BEARER_AND_TENANT_HEADER"),contentType:z24.enum(["video/mp4","image/png","application/json"]),checksumSha256:z24.string().regex(/^[0-9a-f]{64}$/),byteSize:z24.int().positive().max(128*1024*1024)});var tenantMediaDownloadPath="/v1/local-execution/tenant-media/download";var InterfaceDeliveryDownloadDescriptorSchema=z24.discriminatedUnion("method",[InterfaceDownloadDescriptorSchema,InterfaceDownloadDescriptorSchema.extend({method:z24.literal("POST"),path:z24.literal(tenantMediaDownloadPath),productionId:ProductionIdSchema,contentType:z24.literal("video/mp4"),body:z24.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,representationId:ArtifactRepresentationIdSchema})})]);var SourceReadResultSchema=z24.union([SourceTextWindowSchema,SourceLibraryMediaSchema.extend(InterfaceImageMetadataSchema.shape).strict(),SourceLibraryMediaSchema.extend({contentType:z24.literal("video/mp4"),checksumSha256:z24.string().regex(/^[0-9a-f]{64}$/),byteSize:z24.int().positive().max(8388608),importOperation:z24.literal("imported-visual.register-source")}).strict()]);import{z as z25}from"zod";var StartReferencePreviewSchema=z25.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sourceArtifactId:ArtifactIdSchema,expectedBriefVersion:z25.int().positive(),idempotencyKey:z25.string().regex(/^[A-Za-z0-9_-]{8,80}$/),deviceId:z25.uuid().optional()});var ReferencePreviewAdmissionSchema=z25.strictObject({semanticStatus:z25.literal("ACCEPTED"),operationId:OperationIdSchema,productionId:ProductionIdSchema,sourceArtifactId:ArtifactIdSchema,briefVersion:z25.int().positive()});var ReferencePreviewResultSchema=z25.strictObject({semanticStatus:z25.literal("SUCCESS"),sourceArtifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,contentType:z25.literal("image/png"),checksumSha256:z25.string().regex(/^[0-9a-f]{64}$/),width:z25.int().positive(),height:z25.int().positive(),byteSize:z25.int().positive(),contentBase64:z25.string().min(4)});var ReferencePreviewOperationInputSchema=z25.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,operationId:OperationIdSchema});var ReferencePreviewReadResultSchema=z25.union([ReferencePreviewResultSchema,z25.strictObject({semanticStatus:z25.literal("ACCEPTED")})]);var ReferencePreviewCancelResultSchema=z25.union([z25.strictObject({semanticStatus:z25.literal("ACCEPTED")}),z25.strictObject({semanticStatus:z25.literal("NOT_FOUND")})]);import{z as z26}from"zod";var StudioCapabilitiesInputSchema=z26.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema.optional()});var StudioCapabilitiesSchema=z26.strictObject({semanticStatus:z26.literal("SUCCESS"),capabilities:z26.array(z26.strictObject({capability:z26.string().min(1).max(120),tool:z26.string().min(1).max(120).optional(),availability:z26.enum(["AVAILABLE","UNAVAILABLE"]),reason:z26.string().min(1).max(1e3).nullable()})).max(512)});var VideoOptionsSchema=z26.array(z26.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600);import{z as z29}from"zod";import{z as z27}from"zod";var uuid=z27.uuid().toLowerCase();var timestamp=z27.iso.datetime();var version=z27.int().positive();var digest=z27.string().regex(/^[a-f0-9]{64}$/);var requestKey=z27.string().trim().min(1).max(200);var reason=z27.string().trim().min(1).max(2e3);var scope=z27.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var commandBase=scope.extend({idempotencyKey:requestKey,reason});var claim=z27.strictObject({id:uuid,statement:z27.string().trim().min(1).max(1e3),evidenceArtifactId:ArtifactIdSchema,evidenceChecksumSha256:digest});var variant=z27.strictObject({id:uuid,market:z27.string().regex(/^(?:[A-Z]{2}|GLOBAL)$/),locale:z27.string().regex(/^[a-z]{2,3}(?:-[a-zA-Z0-9]{2,8}){0,4}$/),channel:z27.enum(["WEB","SOCIAL","PAID_AD","INTERNAL","EVENT","COMMERCE"]),allowedClaimIds:z27.array(uuid).max(20),requiredGraphicsSha256:z27.array(digest).max(4)});var brandContent=z27.strictObject({name:z27.string().trim().min(1).max(200),validFrom:timestamp,validUntil:timestamp,claims:z27.array(claim).max(40),variants:z27.array(variant).min(1).max(30)}).superRefine((value,ctx)=>{const claimIds=new Set(value.claims.map(item=>item.id));if(Date.parse(value.validFrom)>=Date.parse(value.validUntil))ctx.addIssue({code:"custom",path:["validUntil"],message:"End of brand validity must follow its start"});if(claimIds.size!==value.claims.length||new Set(value.variants.map(item=>item.id)).size!==value.variants.length)ctx.addIssue({code:"custom",message:"Brand claims and variants require unique identities"});for(const[index,item]of value.variants.entries()){if(new Set(item.allowedClaimIds).size!==item.allowedClaimIds.length||item.allowedClaimIds.some(id7=>!claimIds.has(id7)))ctx.addIssue({code:"custom",path:["variants",index,"allowedClaimIds"],message:"Every approved claim must appear once in this brand release"});if(new Set(item.requiredGraphicsSha256).size!==item.requiredGraphicsSha256.length)ctx.addIssue({code:"custom",path:["variants",index,"requiredGraphicsSha256"],message:"Required graphics must have distinct checksums"})}});var BrandPublicationSchema=scope.extend({brandId:uuid,version,content:brandContent,fingerprint:digest,reason,createdByPrincipalId:PrincipalIdSchema,createdAt:timestamp});var grantFields={grantId:uuid,brandId:uuid,version,consumerProjectId:ProjectIdSchema,variantIds:z27.array(uuid).min(1).max(30).refine(ids=>new Set(ids).size===ids.length),expiresAt:timestamp};var BrandGrantSchema=scope.extend({...grantFields,reason,createdByPrincipalId:PrincipalIdSchema,createdAt:timestamp,revokedAt:timestamp.nullable(),revokedByPrincipalId:PrincipalIdSchema.nullable(),revocationReason:reason.nullable()});var EnterpriseBrandCommandSchema=z27.discriminatedUnion("action",[commandBase.extend({action:z27.literal("PUBLISH"),brandId:uuid,expectedVersion:z27.int().nonnegative(),content:brandContent}),commandBase.extend({action:z27.literal("GRANT"),...grantFields}),commandBase.extend({action:z27.literal("REVOKE"),grantId:uuid})]);var EnterpriseBrandReceiptSchema=z27.discriminatedUnion("action",[scope.extend({action:z27.literal("PUBLISH"),idempotencyKey:requestKey,publication:BrandPublicationSchema}),scope.extend({action:z27.enum(["GRANT","REVOKE"]),idempotencyKey:requestKey,grant:BrandGrantSchema})]);var BrandSelectionSchema=z27.strictObject({ownerProjectId:ProjectIdSchema,brandId:uuid,version,grantId:uuid,variantId:uuid,selectedClaimIds:z27.array(uuid).max(20).refine(ids=>new Set(ids).size===ids.length)});var BoundBrandVariantSchema=BrandSelectionSchema.extend({variant,selectedClaims:z27.array(claim).max(20),releaseFingerprint:digest});var EnterpriseBrandQuerySchema=z27.discriminatedUnion("action",[scope.extend({action:z27.literal("PUBLICATION"),ownerProjectId:ProjectIdSchema,brandId:uuid,version,grantId:uuid.optional()}),scope.extend({action:z27.literal("GRANT"),ownerProjectId:ProjectIdSchema,grantId:uuid})]);var EnterpriseBrandViewSchema=z27.discriminatedUnion("action",[scope.extend({action:z27.literal("PUBLICATION"),grantId:uuid.optional(),publication:BrandPublicationSchema}),scope.extend({action:z27.literal("GRANT"),grant:BrandGrantSchema})]);var EnterpriseBrandReceiptQuerySchema=scope.extend({idempotencyKey:requestKey});import{z as z28}from"zod";var uuid2=z28.uuid().toLowerCase();var change=z28.strictObject({ruleId:uuid2,expected:z28.string().trim().min(1).max(1e3)});var SeriesCharacterVariantSchema=z28.strictObject({id:uuid2,subjectId:uuid2,name:z28.string().trim().min(1).max(200),wardrobe:z28.array(change).min(1).max(8).refine(rules=>new Set(rules.map(rule=>rule.ruleId)).size===rules.length),voiceSubjectId:uuid2.optional()});var SeriesCharacterVariantsSchema=z28.array(SeriesCharacterVariantSchema).min(1).max(16).refine(variants=>new Set(variants.map(variant2=>variant2.id)).size===variants.length);var SeriesCharacterVariantIdsSchema=z28.array(uuid2).min(1).max(16).refine(ids=>new Set(ids).size===ids.length);var digest2=z29.string().regex(/^[a-f0-9]{64}$/);var revision=z29.int().positive();var requestKey2=z29.string().trim().min(1).max(200);var reason2=z29.string().trim().min(1).max(2e3);var SeriesProjectScopeSchema=z29.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var identity=SeriesProjectScopeSchema.extend({seriesId:z29.uuid()});var SeriesStandardQuerySchema=identity.extend({version:revision.optional()});var SeriesStandardListSchema=SeriesProjectScopeSchema.extend({after:z29.uuid().optional(),limit:z29.int().positive().max(40).default(10)});var standard=z29.strictObject({name:z29.string().trim().min(1).max(200),consistency:ConsistencyProfileContentSchema,characterVariants:SeriesCharacterVariantsSchema.optional()});var PublishSeriesStandardSchema=identity.extend({expectedVersion:z29.int().nonnegative(),brand:BrandSelectionSchema.optional(),content:standard.extend({graphics:z29.array(TimelineGraphicInputSchema).max(4)}).superRefine(({consistency,graphics},ctx)=>{if(!consistency.rules.length&&!graphics.length)ctx.addIssue({code:"custom",message:"A series standard needs a rule or a graphic"});for(const[index,rule]of consistency.rules.entries()){if(rule.scope.kind!=="PROJECT"||rule.transition||rule.voiceTargets?.kind==="SOUND_CUES")ctx.addIssue({code:"custom",path:["consistency","rules",index],message:"Reusable rules require project scope and cannot name episode-specific cues or transitions"})}if(new Set(graphics.map(g=>g.artifactId.toLowerCase())).size!==graphics.length)ctx.addIssue({code:"custom",path:["graphics"],message:"Duplicate required graphic"})}),reason:reason2,idempotencyKey:requestKey2});var SeriesStandardVersionSchema=identity.extend({version:revision,brand:BoundBrandVariantSchema.optional(),content:standard.extend({graphics:z29.array(TimelineGraphicSchema).max(4)}),fingerprint:digest2,reason:reason2,createdByPrincipalId:PrincipalIdSchema,createdAt:z29.iso.datetime()});var SeriesStandardPageSchema=SeriesProjectScopeSchema.extend({items:z29.array(SeriesStandardVersionSchema.omit({content:true,brand:true}).extend({name:standard.shape.name})).max(40),next:z29.uuid().nullable()});var ProductionSeriesScopeSchema=SeriesProjectScopeSchema.extend({productionId:ProductionIdSchema});var ProductionSeriesQuerySchema=ProductionSeriesScopeSchema.extend({productionRevision:revision.optional(),atRevision:revision.optional()}).refine(query=>query.productionRevision===void 0||query.atRevision===void 0,"Use either the binding revision or a production receipt revision");var BindSeriesStandardSchema=ProductionSeriesScopeSchema.extend({seriesId:z29.uuid(),version:revision,expectedProductionRevision:revision,expectedProfileVersion:z29.int().nonnegative(),characterVariantIds:SeriesCharacterVariantIdsSchema.optional(),reason:reason2,idempotencyKey:requestKey2});var ProductionSeriesBindingSchema=ProductionSeriesScopeSchema.extend({standard:SeriesStandardVersionSchema,characterVariantIds:SeriesCharacterVariantIdsSchema.optional(),profileId:z29.uuid(),profileVersion:revision,productionRevision:revision,reason:reason2,createdByPrincipalId:PrincipalIdSchema,createdAt:z29.iso.datetime()});var PublishSeriesStandardReceiptSchema=z29.strictObject({action:z29.literal("PUBLISH"),idempotencyKey:requestKey2,standard:SeriesStandardVersionSchema});var BindSeriesStandardReceiptSchema=z29.strictObject({action:z29.literal("BIND"),idempotencyKey:requestKey2,binding:ProductionSeriesBindingSchema});var SeriesStandardReceiptSchema=z29.discriminatedUnion("action",[PublishSeriesStandardReceiptSchema,BindSeriesStandardReceiptSchema]);var SeriesStandardReceiptQuerySchema=SeriesProjectScopeSchema.extend({idempotencyKey:requestKey2});import{z as z30}from"zod";var id3=z30.uuid().toLowerCase();var ordinal=z30.int().positive();var scope2=z30.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var branch=scope2.extend({seriesId:id3,branchId:id3});var reference=z30.strictObject({branchId:id3,ordinal});var state=z30.record(z30.string().regex(/^[A-Z][A-Z0-9_.-]{0,63}$/),z30.string().trim().min(1).max(1e3)).refine(value=>Object.keys(value).length<=48,"Up to 48 canonical facts");var time=z30.strictObject({startTick:z30.int().nonnegative(),endTick:z30.int().positive()}).refine(range=>range.endTick>range.startTick,"Story time must have a positive duration");var relation=z30.discriminatedUnion("kind",[z30.strictObject({kind:z30.literal("CONTINUE")}),z30.strictObject({kind:z30.literal("FLASHBACK"),anchor:reference}),z30.strictObject({kind:z30.literal("FORK"),anchor:reference})]);var episode={productionId:ProductionIdSchema,storyTime:time,entryState:state,exitState:state,relation,reason:z30.string().trim().min(1).max(2e3),idempotencyKey:z30.string().trim().min(1).max(200)};var RecordSeriesCanonSchema=branch.extend({...episode,expectedHeadOrdinal:z30.int().nonnegative(),bindingRevision:ordinal,seriesVersion:ordinal});var SeriesCanonSchema=branch.extend({...episode,ordinal,bindingRevision:ordinal,seriesVersion:ordinal,basis:reference.nullable(),continuation:z30.strictObject({head:reference,endTick:z30.int().positive(),state}),createdAt:z30.iso.datetime(),createdByPrincipalId:PrincipalIdSchema});var SeriesCanonQuerySchema=branch.extend({ordinal:ordinal.optional()});var SeriesCanonReceiptQuerySchema=scope2.extend({idempotencyKey:episode.idempotencyKey});import{z as z31}from"zod";var id4=z31.uuid().toLowerCase();var version2=z31.int().positive();var scope3=z31.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var series=scope3.extend({seriesId:id4});var identity2=series.extend({proposalId:id4});var requestKey3=z31.string().trim().min(1).max(200);var reason3=z31.string().trim().min(1).max(2e3);var command=identity2.extend({reason:reason3,idempotencyKey:requestKey3});var finding=z31.strictObject({kind:z31.literal("FINDING"),productionId:ProductionIdSchema,bindingRevision:version2,findingId:id4});var canon=z31.strictObject({kind:z31.literal("CANON"),branchId:id4,ordinal:version2});var source=z31.discriminatedUnion("kind",[finding,canon]);var evidence=z31.discriminatedUnion("kind",[finding.extend({renderId:id4,reviewId:id4,timelineVersionId:id4,seriesVersion:version2,manifestFingerprint:z31.string().regex(/^[a-f0-9]{64}$/)}),canon.extend({productionId:ProductionIdSchema,bindingRevision:version2,seriesVersion:version2})]);var draft=z31.strictObject({content:PublishSeriesStandardSchema.shape.content,brand:BrandSelectionSchema.optional()});var SeriesImprovementCommandSchema=z31.discriminatedUnion("action",[command.extend({action:z31.literal("PROPOSE"),baseVersion:version2,source,draft}),command.extend({action:z31.literal("APPROVE")}),command.extend({action:z31.literal("DECLINE")})]);var actor={createdAt:z31.iso.datetime(),createdByPrincipalId:PrincipalIdSchema,reason:reason3};var SeriesImprovementProposalSchema=identity2.extend({baseVersion:version2,evidence,draft,...actor});var SeriesImprovementDecisionSchema=z31.discriminatedUnion("action",[identity2.extend({action:z31.literal("APPROVE"),published:SeriesStandardVersionSchema,...actor}),identity2.extend({action:z31.literal("DECLINE"),...actor})]);var SeriesImprovementReceiptSchema=identity2.extend({action:z31.enum(["PROPOSE","APPROVE","DECLINE"]),idempotencyKey:requestKey3,proposal:SeriesImprovementProposalSchema,decision:SeriesImprovementDecisionSchema.nullable()});var SeriesImprovementQuerySchema=z31.discriminatedUnion("action",[identity2.extend({action:z31.literal("GET")}),series.extend({action:z31.literal("LIST"),after:id4.optional(),limit:z31.int().min(1).max(20).default(10)})]);var SeriesImprovementViewSchema=z31.discriminatedUnion("action",[identity2.extend({action:z31.literal("GET"),proposal:SeriesImprovementProposalSchema,decision:SeriesImprovementDecisionSchema.nullable()}),series.extend({action:z31.literal("LIST"),items:z31.array(SeriesImprovementProposalSchema.omit({draft:true}).extend({disposition:z31.enum(["PENDING","APPROVED","DECLINED"])})).max(20),next:id4.nullable()})]);var SeriesImprovementReceiptQuerySchema=scope3.extend({idempotencyKey:requestKey3});import{z as z32}from"zod";var Key=z32.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var Intent=z32.string().trim().min(1).max(600);var ExplorationScopeSchema=DirectorScopeSchema.extend({shotId:ShotIdSchema});var ExplorationBasisSchema=DirectorBasisSchema.safeExtend({shotId:ShotIdSchema,shotPlanningRevision:z32.int().positive()});var ExplorationContextInputSchema=z32.strictObject({scope:ExplorationScopeSchema,preparationIds:z32.array(PreparationIdSchema).max(6).default([])}).refine(v=>new Set(v.preparationIds).size===v.preparationIds.length,"Preparation IDs must be distinct");var ExplorationProfileIdentitySchema=KeyframeProviderProfileSchema.pick({id:true,adapterVersion:true,model:true,executionClass:true});var ExplorationOptionSchema=z32.strictObject({selection:ProviderSelectionSchema.nullable(),profile:z32.discriminatedUnion("mediaType",[KeyframeProviderProfileSchema,VideoProviderProfileSchema])});var Missing=z32.strictObject({semanticStatus:z32.literal("NEEDS_INPUT"),missingPrerequisites:z32.array(z32.enum(["ACTIVE_BRIEF","ACTIVE_STORY","ACTIVE_SCENE_SHOT_PLAN"])).min(1).max(3)});var ExplorationContextResultSchema=z32.discriminatedUnion("semanticStatus",[z32.strictObject({semanticStatus:z32.literal("SUCCESS"),advisory:z32.literal(true),basis:ExplorationBasisSchema,owner:DirectorContextResultSchema.options[0],preparations:z32.array(z32.strictObject({view:PreparationViewSchema,eligibleOptions:z32.array(ExplorationOptionSchema).max(24),eligibleOptionCount:z32.int().nonnegative(),optionsTruncated:z32.boolean()})).max(6)}),Missing]);var ImageDraft=KeyframeStartInputSchema.omit({idempotencyKey:true});var VideoDraft=VideoStartInputSchema.omit({idempotencyKey:true});var ExplorationCommandSchema=z32.strictObject({commandKey:Key,purpose:Intent,mediaType:z32.enum(["IMAGE","VIDEO"]),preparationId:PreparationIdSchema,contractId:ImageDraft.shape.contractId,contractFingerprint:ImageDraft.shape.contractFingerprint,selection:ProviderSelectionSchema.nullable(),profile:ExplorationProfileIdentitySchema});var ValidateExplorationPlanSchema=z32.strictObject({basis:ExplorationBasisSchema,plan:z32.strictObject({origin:z32.strictObject({kind:z32.literal("EXTERNAL_AGENT_HOST"),label:z32.string().trim().min(1).max(100)}),objective:Intent,comparisonCriteria:z32.array(Intent).min(1).max(8),unknowns:z32.array(z32.string().trim().min(1).max(300)).max(8),maximumGenerationCommands:z32.int().min(1).max(6),commands:z32.array(ExplorationCommandSchema).min(1).max(6)})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Exploration input exceeds the 1 MiB JSON budget");var ExplorationDraftSchema=z32.discriminatedUnion("mediaType",[z32.strictObject({commandKey:Key,mediaType:z32.literal("IMAGE"),request:ImageDraft}),z32.strictObject({commandKey:Key,mediaType:z32.literal("VIDEO"),request:VideoDraft})]);var ExplorationValidationResultSchema=z32.discriminatedUnion("semanticStatus",[z32.strictObject({semanticStatus:z32.literal("SUCCESS"),advisory:z32.literal(true),basis:ExplorationBasisSchema,plan:ValidateExplorationPlanSchema.shape.plan,generationDrafts:z32.array(ExplorationDraftSchema).min(1).max(6),limitations:z32.array(z32.enum(["ADMISSION_RECHECKS_BASIS_AND_PROVIDER","COMMAND_COUNT_IS_NOT_MONETARY_BUDGET","NO_AUTOMATIC_EXECUTION_OR_ACCEPTANCE","QUALITY_REQUIRES_EXACT_MEDIA_INSPECTION"])).length(4)}),Missing]);var ExplorationCompareInputSchema=z32.strictObject({scope:ExplorationScopeSchema,items:z32.array(z32.strictObject({label:Key,mediaType:z32.enum(["IMAGE","VIDEO"]),generationId:z32.uuid()})).min(2).max(6)});var ExplorationComparisonResultSchema=z32.strictObject({semanticStatus:z32.literal("SUCCESS"),advisory:z32.literal(true),scope:ExplorationScopeSchema,items:z32.array(z32.discriminatedUnion("mediaType",[z32.strictObject({label:Key,mediaType:z32.literal("IMAGE"),generation:KeyframeGenerationViewSchema,handoff:z32.strictObject({mediaRead:KeyframeReviewScopeSchema,reviewTarget:KeyframeReviewScopeSchema}).nullable()}),z32.strictObject({label:Key,mediaType:z32.literal("VIDEO"),generation:VideoGenerationViewSchema,handoff:z32.strictObject({mediaRead:VideoReviewScopeSchema,reviewTarget:VideoReviewScopeSchema}).nullable()})])).min(2).max(6),limitations:z32.tuple([z32.literal("OWNER_STATES_ARE_NOT_VISUAL_SCORES"),z32.literal("REVIEW_AND_ACCEPTANCE_REMAIN_EXPLICIT")])});import{z as z33}from"zod";var sha3=z33.string().regex(/^[0-9a-f]{64}$/);var FinalOutputReviewContextInputSchema=z33.strictObject({scope:DirectorScopeSchema,renderId:z33.uuid()});var FinalOutputReviewBasisSchema=FinalOutputReviewContextInputSchema.extend({contextFingerprint:sha3});var FinalOutputReviewContextResultSchema=z33.strictObject({semanticStatus:z33.literal("SUCCESS"),advisory:z33.literal(true),basis:FinalOutputReviewBasisSchema,ownerContext:DirectorContextResultSchema,deliveryTarget:DeliveryTargetSchema,deliverySnapshot:DeliverySnapshotSchema,validation:DeliveryValidationViewSchema.nullable(),manifest:RegisteredDeliveryManifestSchema.nullable(),limitations:z33.array(z33.enum(["OWNER_REVIEW_3_REMAINS_AUTHORITATIVE","NO_CALLER_SUPPLIED_DELIVERY_CHECKS","NO_IMPLICIT_MEDIA_OR_MODEL_CALL","READS_ARE_NOT_ATOMIC_OR_RESERVED"])).length(4)});import{z as z38}from"zod";import{z as z37}from"zod";import{z as z36}from"zod";import{z as z34}from"zod";var Text=z34.string().trim().min(1).max(600);var Method=z34.enum(["HUMAN","AI","CODE"]);var Key2=z34.string().regex(/^[a-z][a-z0-9_.:-]{0,99}$/);var CompositionAuthoringObligationsSchema=z34.strictObject({schemaVersion:z34.literal(1),basis:CompositionBasisPinSchema,productionRevision:z34.int().positive(),output:BriefContentSchema.pick({targetDurationSeconds:true,aspectRatio:true,outputProfile:true}),objective:BriefContentSchema.shape.objective,productPresentationGoal:BriefContentSchema.shape.productPresentationGoal,audience:BriefContentSchema.shape.audience,styleTone:BriefContentSchema.shape.styleTone,callToAction:BriefContentSchema.shape.callToAction,narrativeIntent:StoryContentSchema.shape.narrativeIntent,canonicalFacts:BriefContentSchema.shape.canonicalFacts,storyBeats:StoryContentSchema.shape.beats,storyFactualClaims:StoryContentSchema.shape.factualClaims,shot:ShotPlanEntrySchema.nullable(),obligationKeys:z34.array(Key2).min(1).max(384).refine(v=>new Set(v).size===v.length,"Obligation keys must be unique"),semantics:z34.literal("ACCEPTED_INTENT_NOT_OBSERVED_MEDIA")}).refine(v=>v.basis.shotId===null===(v.shot===null)&&(!v.shot||v.shot.shotId===v.basis.shotId),"Authoring Shot must match the exact planning basis");var MakingAlternativeSchema=z34.strictObject({alternativeId:z34.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z34.string().trim().min(1).max(120),method:z34.enum(["HUMAN","AI","CODE","HYBRID"]),contributions:z34.array(z34.strictObject({method:Method,role:z34.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),intent:Text})).min(1).max(6),rationale:Text,tradeoffs:z34.array(Text).max(6),obligationKeys:z34.array(Key2).min(1).max(384)}).superRefine((v,ctx)=>{const methods=new Set(v.contributions.map(c=>c.method));if(v.method==="HYBRID"?methods.size<2:methods.size!==1||!methods.has(v.method))ctx.addIssue({code:"custom",path:["contributions"],message:"Contributions must match the advisory making method"});if(new Set(v.contributions.map(c=>c.method+":"+c.role)).size!==v.contributions.length)ctx.addIssue({code:"custom",path:["contributions"],message:"Method/role contributions must be unique"});if(new Set(v.obligationKeys).size!==v.obligationKeys.length)ctx.addIssue({code:"custom",path:["obligationKeys"],message:"Obligation references must be unique"})});var ValidateCompositionMakingSchema=CompositionScopeSchema.extend({projectId:z34.uuid(),expectedProductionRevision:z34.int().positive(),basis:CompositionBasisPinSchema,proposal:z34.strictObject({origin:z34.strictObject({kind:z34.literal("EXTERNAL_AGENT_HOST"),label:z34.string().trim().min(1).max(100)}),makingIntent:z34.enum(["REAL_WORLD_CAPTURE","GENERATED_SCENE","PROGRAMMATIC_EXPLANATION"]),unknowns:z34.array(z34.string().trim().min(1).max(300)).max(8),alternatives:z34.array(MakingAlternativeSchema).min(1).max(3)})}).superRefine((v,ctx)=>{if(new Set(v.proposal.alternatives.map(a=>a.alternativeId)).size!==v.proposal.alternatives.length)ctx.addIssue({code:"custom",message:"Alternative IDs must be unique"});if(new TextEncoder().encode(JSON.stringify(v)).byteLength>131072)ctx.addIssue({code:"custom",message:"Making proposal exceeds the 128 KiB UTF-8 JSON budget"})});var CompositionMakingValidationSchema=CompositionScopeSchema.extend({semanticStatus:z34.literal("SUCCESS"),advisory:z34.literal(true),projectId:z34.uuid(),authoring:CompositionAuthoringObligationsSchema,proposal:ValidateCompositionMakingSchema.shape.proposal,limitations:z34.tuple([z34.literal("STRATEGY_IS_AGENT_ADVICE_NOT_CANONICAL_SELECTION"),z34.literal("SOURCE_METHOD_IS_NOT_PROVENANCE_OR_PROVIDER_ELIGIBILITY"),z34.literal("AUTHORING_AND_RENDER_RECHECK_CURRENT_BASIS"),z34.literal("INDEPENDENT_REVIEW_AND_DELIVERY_REMAIN_REQUIRED")])}).superRefine((v,ctx)=>{const required=new Set(v.authoring.obligationKeys);if(new Set(v.proposal.alternatives.map(a=>a.alternativeId)).size!==v.proposal.alternatives.length||v.proposal.alternatives.some(a=>a.obligationKeys.length!==required.size||a.obligationKeys.some(k=>!required.has(k))))ctx.addIssue({code:"custom",message:"Making result must retain unique alternatives and exact native obligation coverage"})});import{z as z35}from"zod";var CompositionAuthoringRequirementsSchema=z35.strictObject({videoFrameCache:z35.strictObject({profileId:z35.literal("HYPERFRAME_1080P30_FRAME_CACHE_V2"),media:z35.literal("MANAGED_MP4_H264_CFR30_SDR_YUV420P"),maxVideos:z35.literal(4),maxDimension:z35.literal(1920),maxPixels:z35.literal(2073600),maxSourceSeconds:z35.literal(60),playbackRate:z35.literal(1),loop:z35.literal(false),sourceOffset:z35.literal("ZERO_BASED_FRAME_ALIGNED"),srcPattern:z35.literal("/inputs/{inputName}.mp4"),attributes:z35.tuple([z35.literal("id"),z35.literal("src"),z35.literal("data-start"),z35.literal("data-duration")]),dynamicVideoSupported:z35.literal(false),nativePlaybackAndCanvasSamplingSupported:z35.literal(false)}).optional(),semantics:z35.literal("REQUIREMENTS_NOT_RUNTIME_OR_REVIEW_EVIDENCE"),dependencies:CompositionContentSchema.shape.dependencies,html:z35.strictObject({entrypoint:z35.literal("index.html"),stageSelector:z35.literal("#stage"),timelineRegistry:z35.literal("window.__timelines"),readinessPromise:z35.literal("window.__nativeReady"),gsapScript:z35.literal("/_native/gsap.min.js"),managedInputsScript:z35.literal("/native-inputs.js"),rootAttributes:z35.tuple([z35.literal("data-composition-id"),z35.literal("data-width"),z35.literal("data-height"),z35.literal("data-duration")]),timing:z35.literal("PAUSED_GSAP_TIMELINE_WITH_DURATION_MATCHING_LOCAL_CLOCK")})});var jsonSchema=z35.record(z35.string().max(120),z35.json());var CompositionAuthoringGuideSchema=z35.strictObject({inputTool:z35.literal("composition_put_input"),inputField:z35.literal("contentUtf8"),encoding:z35.literal("UTF8_JSON"),schemas:z35.strictObject({SOURCE:jsonSchema,DEPENDENCY_MANIFEST:jsonSchema,DEPENDENCY_LOCK:jsonSchema}),rendererRequirements:CompositionAuthoringRequirementsSchema.nullable(),dependencyInputs:z35.strictObject({dependencies:CompositionContentSchema.shape.dependencies,manifest:CompositionDependencyManifestSchema,lock:CompositionDependencyLockSchema}).nullable().optional(),validation:z35.literal("NATIVE_OWNER_RECHECKS_BYTES_BASIS_AND_SEMANTIC_REFINEMENTS")}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=65536);var CreateCompositionSchema=SubmitCompositionSchema.safeExtend({compositionId:z36.null(),expectedVersion:z36.literal(0),previousVersionId:z36.null()});var ReviseCompositionSchema=SubmitCompositionSchema.safeExtend({compositionId:z36.uuid(),expectedVersion:z36.int().positive(),previousVersionId:z36.uuid()});var CompositionBriefQuerySchema=CompositionScopeSchema.extend({shotId:z36.uuid().nullable().default(null)});var CompositionAuthoringBriefSchema=CompositionScopeSchema.extend({projectId:z36.uuid(),productionRevision:z36.int().positive(),planningStatus:z36.enum(["READY","MISSING_PLANNING","STALE_PLANNING","INACTIVE"]),basis:CompositionBasisPinSchema.nullable(),briefContent:BriefContentSchema.nullable(),storyContent:StoryContentSchema.nullable(),shot:ShotPlanEntrySchema.nullable(),authoring:CompositionAuthoringObligationsSchema.nullable().optional()});var ValidateCompositionSchema=CompositionScopeSchema.extend({expectedProductionRevision:z36.int().positive(),basis:CompositionBasisPinSchema,content:CompositionContentSchema}).superRefine((v,ctx)=>{if(v.content.role==="PRIMARY_VISUAL"&&!v.basis.shotId)ctx.addIssue({code:"custom",path:["basis","shotId"],message:"Primary visual requires a planned Shot"})});var CompositionValidationReceiptSchema=z36.strictObject({authoringValidation:z36.literal("PASS"),basis:CompositionBasisPinSchema,productionRevision:z36.int().positive(),contentFingerprint:z36.string().regex(/^[0-9a-f]{64}$/),inputCount:z36.int().min(3).max(64),byteReadback:z36.literal("VERIFIED"),rendererValidation:z36.literal("NOT_EXECUTED"),renderAvailability:z36.enum(["AVAILABLE","UNAVAILABLE"]),nextActions:z36.array(z36.enum(["CREATE_COMPOSITION","REVISE_COMPOSITION"])).max(2)});var PutCompositionInputSchema=CompositionScopeSchema.extend({name:CompositionBindingSchema.shape.name,purpose:z36.enum(["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK","DATA"]),declaredOrigin:CompositionBindingSchema.shape.declaredOrigin,executionClass:z36.enum(["LIVE","TEST_ONLY"]),contentUtf8:z36.string().min(1).max(8388608),idempotencyKey:z36.string().trim().min(1).max(200)}).superRefine((v,ctx)=>{if(v.purpose==="SOURCE"&&v.declaredOrigin!=="CODE")ctx.addIssue({code:"custom",path:["declaredOrigin"],message:"Programmatic source must retain CODE provenance"})});var CompositionInputReceiptSchema=z36.strictObject({binding:CompositionBindingSchema,projectId:z36.uuid(),contentType:z36.literal("application/json"),byteSize:z36.int().positive().max(8388608),executionClass:z36.enum(["LIVE","TEST_ONLY"]),inputStatus:z36.enum(["AVAILABLE","UNAVAILABLE"]),byteReadback:z36.literal("VERIFIED_AT_REGISTRATION")});var CompositionCapabilitySchema=z36.strictObject({capability:z36.string().min(1).max(80),tool:z36.string().nullable(),availability:z36.enum(["AVAILABLE","UNAVAILABLE"]),reason:z36.string().nullable()});var CompositionCapabilitiesSchema=z36.strictObject({provider:z36.literal("HYPERFRAME"),dialect:z36.literal("HYPERFRAME_HTML_GSAP_V1"),planningStatus:CompositionAuthoringBriefSchema.shape.planningStatus,capabilities:z36.array(CompositionCapabilitySchema).max(18),inputLimitsMiB:z36.strictObject({SOURCE:z36.literal(8),DEPENDENCY_MANIFEST:z36.literal(8),DEPENDENCY_LOCK:z36.literal(8),DATA:z36.literal(8),FONT:z36.literal(32),IMAGE:z36.literal(8),VIDEO:z36.literal(64)}),clockSemantics:z36.literal("RATIONAL_FPS_HALF_OPEN_FRAMES"),rendererValidation:z36.enum(["C3_PENDING","PER_REQUEST_CONFORMANCE"]),authoringGuide:CompositionAuthoringGuideSchema.optional()});var CompositionFailureSchema=z36.strictObject({semanticStatus:z36.enum(["INVALID_INPUT","NOT_FOUND","REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z36.strictObject({code:z36.string().max(80),message:z36.string().max(2e3)}),retryable:z36.boolean(),nextActions:z36.array(z36.string().max(80)).max(4),diagnostics:z36.array(z36.strictObject({code:z36.string().max(80),message:z36.string().max(2e3)})).max(32)});var ParameterValue=z37.strictObject({kind:z37.literal("PARAMETER_VALUE"),name:CompositionBindingSchema.shape.name,value:z37.union([z37.string().max(4e3),z37.number().finite(),z37.boolean()])});var Binding=CompositionBindingSchema.extend({purpose:z37.enum(["SOURCE","DATA","FONT","IMAGE","VIDEO"])});var CompositionRepairConsumerSchema=z37.discriminatedUnion("role",[z37.strictObject({role:z37.literal("PRIMARY_VISUAL"),clipOrdinal:z37.int().min(1).max(200)}),z37.strictObject({role:z37.literal("VISUAL_LAYER"),visualLayerId:z37.uuid()})]);var Consumers=z37.array(CompositionRepairConsumerSchema).min(1).max(208).refine(items=>new Set(items.map(i=>i.role==="PRIMARY_VISUAL"?i.role+i.clipOrdinal:i.role+i.visualLayerId)).size===items.length,"Coordinated consumers must be unique exact occurrences");var CompositionRepairPatchSchema=z37.discriminatedUnion("kind",[ParameterValue,z37.strictObject({kind:z37.literal("BINDING_REPLACE"),binding:Binding})]);var ReviseCompositionRepairActionSchema=z37.strictObject({kind:z37.literal("REVISE_COMPOSITION"),localityIndex:z37.int().min(0).max(207),patches:z37.array(CompositionRepairPatchSchema).min(1).max(16),coordinatedConsumers:Consumers.optional()}).superRefine((v,ctx)=>{const names=v.patches.map(p=>p.kind+":"+(p.kind==="PARAMETER_VALUE"?p.name:p.binding.name));if(new Set(names).size!==names.length)ctx.addIssue({code:"custom",message:"Local Composition patch targets must be unique"})});var CompositionRepairSubjectSchema=z37.strictObject({locality:CompositionFindingLocalitySchema,composition:CompositionViewSchema,render:CompositionRenderViewSchema});var{idempotencyKey,...revisionShape}=ReviseCompositionSchema.shape;var RevisionDraft=z37.strictObject(revisionShape).refine(v=>v.content.role!=="PRIMARY_VISUAL"||v.basis.shotId!==null,"Primary repair retains an exact planned Shot");var CompositionRepairHandoffSchema=z37.strictObject({kind:z37.literal("COMPOSITION_REVISE"),locality:CompositionFindingLocalitySchema,input:RevisionDraft,renderProfileId:z37.enum(["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2","HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"]),sourceReviewRequired:z37.boolean(),coordinatedConsumers:Consumers.optional()}).superRefine((v,ctx)=>{if(v.input.compositionId!==v.locality.compositionId||v.input.previousVersionId!==v.locality.compositionVersionId||v.input.expectedVersion!==v.locality.compositionVersion||v.input.content.role!==v.locality.role||v.coordinatedConsumers?.some(i=>i.role!==v.locality.role)||v.sourceReviewRequired!==(v.locality.role==="PRIMARY_VISUAL")||!(v.locality.role==="PRIMARY_VISUAL"?["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2"].includes(v.renderProfileId):v.renderProfileId==="HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"))ctx.addIssue({code:"custom",message:"Composition repair handoff must retain exact locality identity, role and original output profile"})});var text=z38.string().trim().min(1).max(2e3);var key2=z38.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var RepairStrategyContextInputSchema=z38.strictObject({scope:DirectorScopeSchema,findingId:z38.uuid()});var RepairStrategyBasisSchema=RepairStrategyContextInputSchema.extend({contextFingerprint:z38.string().regex(/^[0-9a-f]{64}$/)});var RepairStrategyActionSchema=z38.discriminatedUnion("kind",[ReviseCompositionRepairActionSchema,z38.strictObject({kind:z38.literal("TRIM_CLIP"),ordinal:z38.int().min(1).max(200),sourceInMs:z38.int().nonnegative().max(30150),sourceOutMs:z38.int().positive().max(30150)}),z38.strictObject({kind:z38.literal("REVISE_CAPTIONS"),content:CaptionContentSchema}),z38.strictObject({kind:z38.literal("ADJUST_TRANSITION"),ordinal:z38.int().min(2).max(200),transition:ClipTransitionSchema}),z38.strictObject({kind:z38.literal("ADJUST_AUDIO_COMPOSITION"),audio:TimelineAudioInputSchema}),z38.strictObject({kind:z38.literal("ACKNOWLEDGE_WARNINGS"),acknowledgements:z38.array(z38.strictObject({key:z38.string().min(1).max(220),reason:text})).min(1).max(300)}),z38.strictObject({kind:z38.literal("REGENERATE_SHOT"),shotId:z38.uuid()}),z38.strictObject({kind:z38.literal("REQUEST_HUMAN_INPUT"),question:text}),z38.strictObject({kind:z38.literal("REQUEST_CANONICAL_CHANGE"),requestedChange:text})]);var RepairStrategyAlternativeSchema=z38.strictObject({id:key2,rationale:text,whySmallerChangeInsufficient:text,action:RepairStrategyActionSchema});var ValidateRepairStrategySchema=z38.strictObject({basis:RepairStrategyBasisSchema,proposal:z38.strictObject({origin:z38.strictObject({kind:z38.literal("EXTERNAL_AGENT_HOST"),label:z38.string().trim().min(1).max(100)}),summary:text,alternatives:z38.array(RepairStrategyAlternativeSchema).min(1).max(6),selectedAlternativeId:key2})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Repair Strategy input exceeds the 1 MiB JSON budget");var RepairStrategyContextResultSchema=z38.strictObject({compositionRepairAvailable:z38.boolean().optional(),semanticStatus:z38.literal("SUCCESS"),advisory:z38.literal(true),basis:RepairStrategyBasisSchema,ownerContext:DirectorContextResultSchema,finding:RoughCutFindingViewSchema,reviewTarget:RoughCutReviewTargetSchema,finalReady:FinalReadyViewSchema,eligibility:z38.strictObject({ready:z38.boolean(),reasons:z38.array(z38.enum(["FINDING_NOT_OPEN","TARGET_STALE","MEDIA_UNAVAILABLE","PRODUCTION_UNAVAILABLE","REVIEW_CHANGED","FINDING_BASIS_CHANGED"])).max(6)})});var RepairStrategyHandoffSchema=z38.discriminatedUnion("kind",[CompositionRepairHandoffSchema,z38.strictObject({kind:z38.literal("TIMELINE_BUILD"),input:BuildTimelineShapeSchema.omit({idempotencyKey:true})}),z38.strictObject({kind:z38.literal("CAPTION_AUTHOR"),input:AuthorCaptionsSchema.omit({idempotencyKey:true})}),z38.strictObject({kind:z38.literal("FINAL_READY_DECIDE"),input:DecideFinalReadySchema.omit({idempotencyKey:true})}),z38.strictObject({kind:z38.literal("REGENERATION_INTENT"),preparationQuery:PreparationActiveInputSchema,admission:z38.literal("EXPLICIT_NATIVE_PREPARATION_AND_SELECTION_REQUIRED")}),z38.strictObject({kind:z38.literal("HUMAN_INPUT_INTENT"),question:text}),z38.strictObject({kind:z38.literal("CANONICAL_CHANGE_INTENT"),requestedChange:text})]);var RepairStrategyValidationResultSchema=z38.strictObject({semanticStatus:z38.literal("SUCCESS"),advisory:z38.literal(true),basis:RepairStrategyBasisSchema,proposal:ValidateRepairStrategySchema.shape.proposal,finding:RoughCutFindingViewSchema,alternatives:z38.array(z38.strictObject({alternativeId:key2,affectedScope:RoughCutFindingViewSchema.shape.affectedScope,handoff:RepairStrategyHandoffSchema,materialChange:z38.boolean(),preservedAcceptanceIds:z38.array(z38.uuid()).max(200),followUp:z38.array(z38.enum(["REVOKE_FINAL_READY_AND_REFRESH","REFRESH_TIMELINE_BASIS","ATTACH_NEW_CAPTION","REFRESH_AND_PREPARE_SHOT","EXPLICIT_VIDEO_GENERATION","REVIEW_1","SHOT_ACCEPTANCE","REBUILD_TIMELINE","ROUGH_CUT_RENDER","REVIEW_2","FINAL_READY_DECISION","AUTHORIZED_PLANNING_DECISION","COMPOSITION_REVISE","COMPOSITION_RENDER"])).max(10)})).min(1).max(6),selectedAlternativeId:key2,limitations:z38.tuple([z38.literal("NO_CANONICAL_REPAIR_LIFECYCLE_OR_WRITE"),z38.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z38.literal("CREATIVE_RATIONALE_IS_NOT_VERIFIED"),z38.literal("OWNER_RECHECKS_CAS_IDEMPOTENCY_AND_EXECUTION_CLASS"),z38.literal("MATERIAL_REPAIR_REQUIRES_NEW_OBSERVATION_AND_REVIEW")])}).superRefine((v,ctx)=>{const ids=v.alternatives.map(a=>a.alternativeId);const proposed=v.proposal.alternatives.map(a=>a.id);if(v.finding.id!==v.basis.findingId||v.finding.tenantId!==v.basis.scope.tenantId||v.finding.projectId!==v.basis.scope.projectId||v.finding.productionId!==v.basis.scope.productionId||v.selectedAlternativeId!==v.proposal.selectedAlternativeId||!ids.includes(v.selectedAlternativeId)||new Set(ids).size!==ids.length||ids.length!==proposed.length||ids.some(id7=>!proposed.includes(id7)))ctx.addIssue({code:"custom",message:"Repair validation must retain exact Finding and proposal selection"});for(const alternative of v.alternatives){const h=alternative.handoff;if("input"in h&&(h.input.tenantId!==v.basis.scope.tenantId||h.input.productionId!==v.basis.scope.productionId))ctx.addIssue({code:"custom",message:"Repair handoff must retain the exact native Tenant/Production scope"})}});import{z as z39}from"zod";var text2=z39.string().trim().min(1).max(2e3);var key3=z39.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var EditorContextInputSchema=z39.strictObject({scope:DirectorScopeSchema,timelineVersionId:z39.uuid()});var EditorBasisSchema=EditorContextInputSchema.extend({contextFingerprint:z39.string().regex(/^[0-9a-f]{64}$/)});var EditorAlternativeSchema=z39.strictObject({id:key3,rationale:text2,pacingIntent:text2,action:z39.discriminatedUnion("kind",[z39.strictObject({kind:z39.literal("BUILD_TIMELINE"),clips:BuildTimelineSchema.shape.clips}),z39.strictObject({kind:z39.literal("EDIT_GRAPHICS"),graphics:z39.array(TimelineGraphicInputSchema).min(1).max(8)}),z39.strictObject({kind:z39.literal("EDIT_VISUAL_LAYERS"),visualLayers:z39.array(TimelineVisualLayerInputSchema).min(1).max(8)}),z39.strictObject({kind:z39.literal("EDIT_AUDIO_COMPOSITION"),audio:TimelineAudioInputSchema}),z39.strictObject({kind:z39.literal("REVISE_CAPTIONS"),content:CaptionContentSchema}),z39.strictObject({kind:z39.literal("REQUEST_COMPOSITION_CAPABILITY"),concern:z39.enum(["TRANSITION","AUDIO_VISUAL_ALIGNMENT","VOICE_TIMING","CAPTION_RETIMING"]),requestedChange:text2}),z39.strictObject({kind:z39.literal("REQUEST_HUMAN_INPUT"),question:text2})])});var ValidateEditorProposalSchema=z39.strictObject({basis:EditorBasisSchema,proposal:z39.strictObject({origin:z39.strictObject({kind:z39.literal("EXTERNAL_AGENT_HOST"),label:z39.string().trim().min(1).max(100)}),summary:text2,alternatives:z39.array(EditorAlternativeSchema).min(1).max(6),selectedAlternativeId:key3})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Editor Intelligence input exceeds the 1 MiB JSON budget");var EditorContextResultSchema=z39.strictObject({semanticStatus:z39.literal("SUCCESS"),advisory:z39.literal(true),basis:EditorBasisSchema,ownerContext:DirectorContextResultSchema,timeline:TimelineViewSchema,timelineBasis:TimelineBasisSchema,finalReady:FinalReadyViewSchema,eligibility:z39.strictObject({ready:z39.boolean(),reasons:z39.array(z39.enum(["TIMELINE_NOT_CURRENT","TIMELINE_STALE","PRODUCTION_UNAVAILABLE","PLANNING_NOT_READY","CREATIVE_BASIS_CHANGED","NO_CURRENT_ACCEPTED_MEDIA","COMPOSITION_VERSION_UNSUPPORTED"])).max(7)})});var ReviewScope=z39.strictObject({kind:z39.literal("PRODUCTION"),interval:z39.strictObject({startMs:z39.literal(0),endMs:z39.int().positive().max(603e4)}),shotIds:z39.array(z39.uuid()).min(1).max(200),dimensions:z39.array(z39.enum(["PACING","ORDERING","CUT_CONTINUITY","PRODUCT_PRESENTATION","CAPTION_TIMING_VISIBILITY","AUDIO_VISUAL_ALIGNMENT","BASIC_MIX"])).min(4).max(7),requirement:z39.literal("COMPLETE_NEW_OUTPUT_INSPECTION")});var EditorHandoffSchema=z39.discriminatedUnion("kind",[z39.strictObject({kind:z39.literal("TIMELINE_BUILD"),input:BuildTimelineShapeSchema.omit({idempotencyKey:true}),preview:TimelineManifestReaderSchema,assemblyStatus:z39.enum(["DRAFT","ASSEMBLY_READY"]),changedOrdinals:z39.array(z39.int().positive().max(200)).max(200),changedGraphicArtifactIds:z39.array(z39.uuid()).max(8),changedAudioPurposes:z39.array(z39.enum(["VOICEOVER","MUSIC"])).max(2),preservedAcceptanceIds:z39.array(z39.uuid()).max(200),reviewScope:ReviewScope,followUp:z39.array(z39.enum(["NATIVE_TIMELINE_BUILD","COMPLETE_TIMELINE","ROUGH_CUT_RENDER","REVIEW_2","FINAL_READY_DECISION"])).min(4).max(5)}),z39.strictObject({kind:z39.literal("CAPTION_AUTHOR"),input:AuthorCaptionsSchema.omit({idempotencyKey:true}),attachment:z39.strictObject({expectedTimelineVersion:z39.int().positive(),preserveCurrentComposition:z39.literal(true),composition:z39.strictObject({schemaVersion:BuildTimelineShapeSchema.shape.schemaVersion,clips:BuildTimelineSchema.shape.clips,audio:BuildTimelineSchema.shape.audio.optional(),sourceSound:BuildTimelineShapeSchema.shape.sourceSound,graphics:BuildTimelineSchema.shape.graphics.optional(),visualLayers:BuildTimelineShapeSchema.shape.visualLayers})}),followUp:z39.tuple([z39.literal("NATIVE_CAPTION_AUTHOR"),z39.literal("ATTACH_NEW_CAPTION_TO_TIMELINE"),z39.literal("ROUGH_CUT_RENDER"),z39.literal("REVIEW_2"),z39.literal("FINAL_READY_DECISION")])}),z39.strictObject({kind:z39.literal("COMPOSITION_CAPABILITY_INTENT"),concern:z39.enum(["TRANSITION","AUDIO_VISUAL_ALIGNMENT","VOICE_TIMING","CAPTION_RETIMING"]),requestedChange:text2,admission:z39.literal("EXPLICIT_CANONICAL_CAPABILITY_REQUIRED")}),z39.strictObject({kind:z39.literal("HUMAN_INPUT_INTENT"),question:text2})]);var EditorValidationResultSchema=z39.strictObject({semanticStatus:z39.literal("SUCCESS"),advisory:z39.literal(true),basis:EditorBasisSchema,proposal:ValidateEditorProposalSchema.shape.proposal,alternatives:z39.array(z39.strictObject({alternativeId:key3,handoff:EditorHandoffSchema})).min(1).max(6),selectedAlternativeId:key3,limitations:z39.tuple([z39.literal("NO_TIMELINE_WRITE_RENDER_OR_PROVIDER_CALL"),z39.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z39.literal("CREATIVE_RATIONALE_IS_NOT_VERIFIED"),z39.literal("OWNER_RECHECKS_CAS_IDEMPOTENCY_AND_EXECUTION_CLASS"),z39.literal("EDIT_REQUIRES_NEW_OUTPUT_INSPECTION_AND_REVIEW")])});import{z as z40}from"zod";var scope4={tenantId:z40.uuid(),productionId:z40.uuid()};var TemporalEvidenceTargetSchema=z40.strictObject({...scope4,artifactId:z40.uuid(),representationId:z40.uuid(),checksumSha256:z40.string().regex(/^[0-9a-f]{64}$/)});var OriginalVideoReadSchema=TemporalEvidenceTargetSchema;var OriginalVideoResultSchema=z40.strictObject({source:TemporalEvidenceSourceSchema,contentType:z40.literal("video/mp4"),dataBase64:z40.string().min(4).max(4*Math.ceil(8*1024*1024/3)).regex(/^[A-Za-z0-9+/]+={0,2}$/)}).refine(v=>{const padding=v.dataBase64.endsWith("==")?2:v.dataBase64.endsWith("=")?1:0;return v.dataBase64.length%4===0&&v.source.byteSize<=8*1024*1024&&v.dataBase64.length/4*3-padding===v.source.byteSize},"Original video must match its exact bounded byte size");var TemporalEvidenceStartSchema=TemporalEvidenceTargetSchema.extend({profile:TemporalSamplingProfileSchema,expectedProductionRevision:z40.int().positive(),idempotencyKey:z40.string().trim().min(1).max(128),deviceId:z40.uuid().toLowerCase().optional()});var TemporalEvidenceGetSchema=z40.strictObject({...scope4,evidenceId:z40.uuid()});var TemporalEvidenceAdmissionSchema=z40.strictObject({semanticStatus:z40.literal("ACCEPTED"),evidenceId:z40.uuid(),runtimeJobId:z40.uuid(),operationId:z40.string().min(1),source:TemporalEvidenceSourceSchema,planFingerprint:z40.string().regex(/^[0-9a-f]{64}$/),productionRevision:z40.int().positive()});var TemporalEvidenceOutputSchema=z40.strictObject({frameSetArtifactId:z40.uuid(),manifestRepresentationId:z40.uuid(),frameRepresentationIds:z40.array(z40.uuid()).min(1).max(64),contactSheetArtifactId:z40.uuid(),sheetRepresentationId:z40.uuid(),manifest:TemporalEvidenceManifestSchema,createdAt:z40.iso.datetime({offset:true})}).refine(v=>v.frameRepresentationIds.length===v.manifest.frames.length&&new Set(v.frameRepresentationIds).size===v.frameRepresentationIds.length,"Exact frame representations must be complete and unique");var TemporalEvidenceViewSchema=z40.strictObject({evidenceId:z40.uuid(),runtimeJobId:z40.uuid(),operationId:z40.string().min(1),source:TemporalEvidenceSourceSchema,planFingerprint:z40.string().regex(/^[0-9a-f]{64}$/),runtimeState:z40.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),output:TemporalEvidenceOutputSchema.nullable()});var TemporalEvidenceMediaSchema=TemporalEvidenceGetSchema.extend({kind:z40.enum(["FRAME","SHEET","MANIFEST"]),ordinal:z40.int().nonnegative().max(63).optional()}).refine(v=>v.kind==="FRAME"?v.ordinal!==void 0:v.ordinal===void 0,"Only individual frames require an ordinal");var TemporalEvidenceImageSchema=TemporalEvidenceMediaSchema.safeExtend({kind:z40.enum(["FRAME","SHEET"])});var TemporalEvidenceImageMetadataSchema=TemporalEvidenceImageSchema.safeExtend({contentType:z40.literal("image/png"),checksumSha256:z40.string().regex(/^[0-9a-f]{64}$/),byteSize:z40.int().positive().max(16*1024*1024)});import{z as z41}from"zod";var Text2=z41.string().trim().min(1).max(1e3);var bounded=(value,bytes)=>new TextEncoder().encode(JSON.stringify(value)).byteLength<=bytes;var ExplorationComparisonCriterionSchema=z41.strictObject({key:ReviewEvidenceKeySchema,description:Text2,modality:z41.enum(["VISUAL","TEMPORAL"])});var ExplorationRecommendationContextInputSchema=ExplorationCompareInputSchema.extend({criteria:z41.array(ExplorationComparisonCriterionSchema).min(1).max(8)}).superRefine((v,c)=>{if(new Set(v.items.map(i=>i.mediaType)).size!==1)c.addIssue({code:"custom",message:"Recommendation compares one media type"});if(new Set(v.items.map(i=>i.label)).size!==v.items.length||new Set(v.items.map(i=>i.generationId.toLowerCase())).size!==v.items.length)c.addIssue({code:"custom",message:"Labels and generation identities must be distinct"});if(new Set(v.criteria.map(i=>i.key)).size!==v.criteria.length)c.addIssue({code:"custom",message:"Comparison criterion keys must be distinct"});if(v.items[0].mediaType==="IMAGE"&&v.criteria.some(i=>i.modality==="TEMPORAL"))c.addIssue({code:"custom",message:"Temporal comparison requires VIDEO"});if(!bounded(v,1024*1024))c.addIssue({code:"custom",message:"Recommendation input exceeds 1 MiB"})});var ExplorationRecommendationBasisSchema=z41.strictObject({input:ExplorationRecommendationContextInputSchema,contextFingerprint:z41.string().regex(/^[0-9a-f]{64}$/)});var ExplorationRecommendationCandidateSchema=z41.strictObject({label:ReviewEvidenceKeySchema,readiness:z41.enum(["REVIEWABLE","UNAVAILABLE"]),reasons:z41.array(z41.enum(["NO_CANDIDATE","STALE_BASIS","PRODUCTION_NOT_RUNNABLE","OUTPUT_NOT_INSPECTABLE"])).max(4),reviewContext:ReviewIntelligenceContextResultSchema.nullable()});var ExplorationRecommendationContextResultSchema=z41.strictObject({semanticStatus:z41.literal("SUCCESS"),advisory:z41.literal(true),basis:ExplorationRecommendationBasisSchema,comparison:ExplorationComparisonResultSchema,candidates:z41.array(ExplorationRecommendationCandidateSchema).min(2).max(6),limitations:z41.tuple([z41.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z41.literal("NO_IMPLICIT_MEDIA_OR_MODEL_CALL")])}).refine(v=>bounded(v,2*1024*1024),"Recommendation context exceeds 2 MiB");var ExplorationComparisonJudgmentSchema=z41.strictObject({label:ReviewEvidenceKeySchema,criterionKey:ReviewEvidenceKeySchema,judgment:z41.enum(["FAVORABLE","UNFAVORABLE","UNCERTAIN","NOT_OBSERVABLE"]),rationale:Text2,evidenceIds:z41.array(ReviewEvidenceKeySchema).max(16)});var ExplorationRecommendationDecisionSchema=z41.discriminatedUnion("kind",[z41.strictObject({kind:z41.literal("RECOMMEND"),label:ReviewEvidenceKeySchema,rationale:Text2,notSelected:z41.array(z41.strictObject({label:ReviewEvidenceKeySchema,reason:Text2})).min(1).max(5)}),z41.strictObject({kind:z41.literal("NO_RECOMMENDATION"),reason:Text2})]);var ValidateExplorationRecommendationSchema=z41.strictObject({basis:ExplorationRecommendationBasisSchema,proposal:z41.strictObject({origin:z41.strictObject({kind:z41.literal("EXTERNAL_AGENT_HOST"),label:z41.string().trim().min(1).max(100)}),summary:z41.string().trim().min(1).max(2e3),assessments:z41.array(z41.strictObject({label:ReviewEvidenceKeySchema,reviewProposal:ValidateReviewIntelligenceSchema.shape.proposal})).max(6),judgments:z41.array(ExplorationComparisonJudgmentSchema).max(48),decision:ExplorationRecommendationDecisionSchema,unknowns:z41.array(z41.string().trim().min(1).max(300)).max(8)})}).refine(v=>bounded(v,1024*1024),"Recommendation input exceeds 1 MiB");var ExplorationRecommendationValidationResultSchema=z41.strictObject({semanticStatus:z41.literal("SUCCESS"),advisory:z41.literal(true),basis:ExplorationRecommendationBasisSchema,origin:ValidateExplorationRecommendationSchema.shape.proposal.shape.origin,summary:z41.string(),judgments:z41.array(ExplorationComparisonJudgmentSchema).max(48),decision:ExplorationRecommendationDecisionSchema,unknowns:z41.array(z41.string()).max(8),reviews:z41.array(z41.strictObject({label:ReviewEvidenceKeySchema,validation:ReviewIntelligenceValidationResultSchema})).max(6),limitations:z41.tuple([z41.literal("HOST_PREFERENCE_IS_NOT_CANONICAL_SELECTION"),z41.literal("EVIDENCE_DECLARATIONS_ARE_NOT_ATTESTED_INSPECTION"),z41.literal("RULE_PREVIEWS_ARE_NOT_CANONICAL_REVIEWS"),z41.literal("EXPLICIT_RECORD_AND_SEPARATE_ACCEPTANCE_REQUIRED"),z41.literal("OWNER_RECHECKS_CURRENTNESS_CAS_AND_EXECUTION_CLASS")])}).refine(v=>bounded(v,4*1024*1024),"Recommendation result exceeds 4 MiB");import{z as z43}from"zod";import{z as z42}from"zod";var Review1FindingSchema=z42.strictObject({id:z42.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,mediaType:z42.enum(["IMAGE","VIDEO"]),framePurpose:z42.string().max(40).optional(),generationId:z42.uuid(),candidateId:z42.uuid(),reviewId:z42.uuid(),artifactId:z42.uuid(),representationId:z42.uuid(),checksumSha256:z42.string().regex(/^[0-9a-f]{64}$/),preparationId:z42.uuid(),contractId:z42.uuid(),contractFingerprint:z42.string().regex(/^[0-9a-f]{64}$/),executionClass:z42.enum(["LIVE","TEST_ONLY"]),requirement:z42.union([VideoReviewRequirementSchema,VisualRequirementSchema]),observation:z42.union([VideoObservationSchema,KeyframeObservationSchema]),blocking:z42.boolean(),severity:z42.enum(["BLOCKING","WARNING"]),basisFingerprint:z42.string().regex(/^[0-9a-f]{64}$/),createdAt:z42.iso.datetime({offset:true})}).superRefine((v,c)=>{if(v.requirement.key!==v.observation.key||v.blocking!==(v.severity==="BLOCKING"))c.addIssue({code:"custom",message:"Finding must bind its exact native obligation"})});var Review1FindingViewSchema=Review1FindingSchema.safeExtend({lifecycle:z42.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","SUPERSEDED"]),proofReviewId:z42.uuid().nullable()});var Review1RepairSourceSchema=z42.strictObject(Review1FindingSchema.shape).omit({id:true,createdAt:true}).superRefine((v,c)=>{if(v.requirement.key!==v.observation.key||v.blocking!==(v.severity==="BLOCKING"))c.addIssue({code:"custom",message:"Source must bind its exact native obligation"})});var Review1RepairSourceQuerySchema=z42.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,mediaType:z42.enum(["IMAGE","VIDEO"]),generationId:z42.uuid(),reviewId:z42.uuid(),requirementKey:z42.string().min(1).max(220)});var sha4=z43.string().regex(/^[0-9a-f]{64}$/);var handoffs={REVISE_COMPOSITION:"COMPOSITION_REVISE",TRIM_CLIP:"TIMELINE_BUILD",ADJUST_TRANSITION:"TIMELINE_BUILD",ADJUST_AUDIO_COMPOSITION:"TIMELINE_BUILD",REVISE_CAPTIONS:"CAPTION_AUTHOR",ACKNOWLEDGE_WARNINGS:"FINAL_READY_DECIDE",REGENERATE_SHOT:"REGENERATION_INTENT",REQUEST_HUMAN_INPUT:"HUMAN_INPUT_INTENT",REQUEST_CANONICAL_CHANGE:"CANONICAL_CHANGE_INTENT"};var SemanticRepairBudgetSchema=z43.strictObject({maxSemanticAttempts:z43.int().min(1).max(20),maxElapsedMs:z43.int().min(1).max(864e5),currency:z43.literal("USD"),maxCostMicros:z43.int().min(0).max(1e9),maxConsecutiveNoImprovement:z43.int().min(1).max(20)});var RepairPlanScopeSchema=z43.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,planId:z43.uuid()});var AuthorRepairPlanSchema=z43.strictObject({strategy:ValidateRepairStrategySchema,expectedProductionRevision:z43.int().positive(),expectedCaseVersion:z43.int().nonnegative(),budget:SemanticRepairBudgetSchema,idempotencyKey:z43.string().trim().min(1).max(200)}).superRefine((v,c)=>{const p=v.strategy.proposal;if(new Set(p.alternatives.map(a=>a.id)).size!==p.alternatives.length||!p.alternatives.some(a=>a.id===p.selectedAlternativeId))c.addIssue({code:"custom",message:"Repair authoring requires unique alternatives and an explicit selection"})});var RepairDecisionSchema=z43.strictObject({id:z43.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,caseId:z43.uuid(),caseVersion:z43.int().positive(),basis:RepairStrategyBasisSchema,sourceReviewId:z43.uuid(),sourceRenderId:z43.uuid().nullable(),review1Source:Review1FindingSchema.optional(),sourceBasisFingerprint:sha4,affectedScopeFingerprint:sha4,obligationFingerprint:sha4,proposal:ValidateRepairStrategySchema.shape.proposal,selectedAlternativeId:z43.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),handoff:RepairStrategyHandoffSchema,budget:SemanticRepairBudgetSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z43.iso.datetime({offset:true})}).superRefine((d,c)=>{if(d.sourceRenderId===null!==!!d.review1Source||d.review1Source&&(d.review1Source.id!==d.basis.findingId||d.review1Source.reviewId!==d.sourceReviewId||d.review1Source.tenantId!==d.tenantId||d.review1Source.projectId!==d.projectId||d.review1Source.productionId!==d.productionId||d.handoff.kind!=="REGENERATION_INTENT"))c.addIssue({code:"custom",message:"Repair must retain its native Review layer and source"});if(d.basis.scope.tenantId!==d.tenantId||d.basis.scope.productionId!==d.productionId||d.basis.scope.projectId!==d.projectId)c.addIssue({code:"custom",message:"Repair Decision scope must be exactly owned"});if(d.selectedAlternativeId!==d.proposal.selectedAlternativeId||new Set(d.proposal.alternatives.map(a=>a.id)).size!==d.proposal.alternatives.length||!d.proposal.alternatives.some(a=>a.id===d.selectedAlternativeId&&handoffs[a.action.kind]===d.handoff.kind))c.addIssue({code:"custom",message:"Repair Decision must bind the explicit selected alternative"})});var SemanticRepairAttemptSchema=z43.strictObject({id:z43.uuid(),planId:z43.uuid(),caseId:z43.uuid(),ordinal:z43.int().min(1).max(20),executionIdentity:z43.string().trim().min(1).max(200),strategyFingerprint:sha4,startedAt:z43.iso.datetime({offset:true}),reservedCostMicros:z43.int().min(0).max(1e9),chargedCostMicros:z43.int().min(0).max(1e9).nullable(),currency:z43.literal("USD"),outcome:z43.enum(["IN_FLIGHT","AWAITING_REVIEW","IMPROVED","NO_IMPROVEMENT","OPERATIONAL_FAILURE","WAIVED"])});var RecordRepairProofSchema=RepairPlanScopeSchema.extend({attemptId:z43.uuid(),renderId:z43.uuid(),reviewId:z43.uuid(),expectedProductionRevision:z43.int().positive(),idempotencyKey:z43.string().trim().min(1).max(200)});import{z as z44}from"zod";var AuthorReview1RepairSchema=z44.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,mediaType:z44.enum(["IMAGE","VIDEO"]),generationId:z44.uuid(),reviewId:z44.uuid(),requirementKey:z44.string().min(1).max(220),reason:z44.string().trim().min(1).max(2e3),expectedProductionRevision:z44.int().positive(),expectedCaseVersion:z44.int().nonnegative(),budget:SemanticRepairBudgetSchema,idempotencyKey:z44.string().trim().min(1).max(200)});var RecordReview1RepairProofSchema=RepairPlanScopeSchema.extend({attemptId:z44.uuid(),generationId:z44.uuid(),reviewId:z44.uuid(),expectedProductionRevision:z44.int().positive(),idempotencyKey:z44.string().trim().min(1).max(200)});import{z as z45}from"zod";var ExecuteRepairSchema=RepairPlanScopeSchema.extend({expectedProductionRevision:z45.int().positive(),expectedCaseVersion:z45.int().positive(),idempotencyKey:z45.string().trim().min(1).max(200),generation:VideoStartInputSchema.omit({idempotencyKey:true}).optional(),keyframeGeneration:KeyframeStartInputSchema.omit({idempotencyKey:true}).optional()});var RepairAttemptEventSchema=z45.strictObject({id:z45.uuid(),attemptId:z45.uuid(),version:z45.int().positive(),outcome:SemanticRepairAttemptSchema.shape.outcome.exclude(["IN_FLIGHT"]),renderId:z45.uuid().nullable(),reviewId:z45.uuid().nullable(),generationId:z45.uuid().optional(),recordedAt:z45.iso.datetime({offset:true})});var RepairAttemptViewSchema=SemanticRepairAttemptSchema.extend({costQuote:GenerationCostQuoteSchema.optional(),events:z45.array(RepairAttemptEventSchema).max(40)});var RepairCaseViewSchema=z45.strictObject({id:z45.uuid(),version:z45.int().positive(),issueKey:z45.string().regex(/^[0-9a-f]{64}$/),budget:SemanticRepairBudgetSchema,openedAt:z45.iso.datetime({offset:true})});var RepairPlanViewSchema=z45.strictObject({review1Finding:Review1FindingViewSchema.optional(),decision:RepairDecisionSchema,repairCase:RepairCaseViewSchema,attempts:z45.array(RepairAttemptViewSchema).max(20)});var RepairAuthorReceiptSchema=z45.strictObject({semanticStatus:z45.literal("SUCCESS"),decision:RepairDecisionSchema,productionRevision:z45.int().positive()});var RepairExecutionReceiptSchema=z45.strictObject({costQuote:GenerationCostQuoteSchema.optional(),semanticStatus:z45.literal("ACCEPTED"),attempt:SemanticRepairAttemptSchema,decision:RepairDecisionSchema,productionRevision:z45.int().positive(),generation:ExecuteRepairSchema.shape.generation.nullable(),keyframeGeneration:ExecuteRepairSchema.shape.keyframeGeneration.nullable().optional()});var RepairProgressSchema=z45.strictObject({view:RepairPlanViewSchema,stage:z45.enum(["WAITING_INPUT","WAITING_GENERATION","WAITING_COMPOSITION_RENDER","WAITING_SOURCE_ACCEPTANCE","WAITING_RENDER","AWAITING_REVIEW","WAIVED","OPERATIONAL_FAILURE","IMPROVED","NO_IMPROVEMENT"]),renderId:z45.uuid().nullable(),generationId:z45.uuid().nullable()});var RepairProofReceiptSchema=z45.strictObject({semanticStatus:z45.literal("SUCCESS"),event:RepairAttemptEventSchema,productionRevision:z45.int().positive()});import{z as z46}from"zod";var WebhookReplayReceiptSchema=z46.strictObject({deliveryId:z46.uuid(),eventId:z46.uuid(),runtimeJobId:z46.uuid()});var WebhookDeliveryViewSchema=z46.strictObject({deliveryId:z46.uuid(),eventId:z46.uuid(),subscriptionId:z46.uuid(),subscriptionVersion:z46.int().positive(),replayNumber:z46.int().nonnegative(),runtimeJobId:z46.uuid(),lifecycle:z46.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),runtimeAttempts:z46.int().nonnegative(),wakeAt:z46.iso.datetime({offset:true}).nullable()});var WebhookAttemptViewSchema=z46.strictObject({attemptId:z46.uuid(),runtimeAttemptId:z46.uuid(),outcome:z46.enum(["STARTED","ACKNOWLEDGED","TRANSIENT","PERMANENT","SKIPPED"]),responseStatus:z46.int().min(100).max(599).nullable(),startedAt:z46.iso.datetime({offset:true}),endedAt:z46.iso.datetime({offset:true}).nullable()});var page={next:z46.uuid().nullable()};var WebhookSubscriptionPageSchema=z46.strictObject({...page,items:z46.array(WebhookSubscriptionSchema).max(50)});var ExternalLifecycleEventPageSchema=z46.strictObject({...page,items:z46.array(ExternalLifecycleEventSchema).max(50)});var WebhookDeliveryPageSchema=z46.strictObject({...page,items:z46.array(WebhookDeliveryViewSchema).max(50)});var WebhookAttemptPageSchema=z46.strictObject({...page,items:z46.array(WebhookAttemptViewSchema).max(50)});var LifecycleEventCapabilitiesSchema=z46.strictObject({configuration:WebhookAvailabilitySchema,readinessScope:z46.literal("CURRENT_PROCESS_SIGNING_STORAGE"),deliveryConfirmation:z46.literal("READ_NATIVE_DELIVERIES_AND_ATTEMPTS"),eventTypes:z46.array(ExternalEventTypeSchema).max(14),unavailableNativeEvents:z46.array(z46.enum(["production.failed","production.cancelled","finding.opened"])).max(3),delivery:z46.literal("AT_LEAST_ONCE"),payload:z46.literal("QUERY_NOTIFICATION"),scope:z46.literal("PRODUCTION"),automaticOutboundAttempts:z46.literal(3),manualReplaysPerEvent:z46.literal(3),projectOnlyArtifacts:z46.literal("UNAVAILABLE"),orderingGuaranteed:z46.literal(false),signature:z46.literal("HMAC_SHA256_TIMESTAMP_DOT_EXACT_BODY")});import{z as z47}from"zod";var sha5=z47.string().regex(/^[0-9a-f]{64}$/);var CompositionSourceInspectSchema=CompositionGetSchema.extend({versionId:z47.uuid(),fingerprint:sha5,file:CompositionPathSchema.optional(),startLine:z47.int().min(1).max(8388609).default(1),lineLimit:z47.int().min(1).max(200).default(80)});var CompositionSourceInspectionSchema=z47.strictObject({composition:CompositionViewSchema,source:CompositionInputFactSchema,byteReadback:z47.literal("VERIFIED"),selection:z47.strictObject({file:CompositionPathSchema.nullable(),startLine:z47.int().positive(),lineLimit:z47.int().min(1).max(200)}),files:z47.array(z47.strictObject({path:CompositionPathSchema,contentType:z47.string().max(80),byteSize:z47.int().nonnegative().max(8388608),lineCount:z47.int().positive().max(8388609)})).min(1).max(128),window:z47.strictObject({file:CompositionPathSchema,startLine:z47.int().positive(),lines:z47.array(z47.strictObject({number:z47.int().positive(),text:z47.string().max(65536)})).max(200),hasMore:z47.boolean(),nextLine:z47.int().positive().nullable()}).nullable(),limitations:z47.tuple([z47.literal("SOURCE_INSPECTION_IS_NOT_OUTPUT_REVIEW"),z47.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED")])});var SourceReviewContextInputSchema=z47.strictObject({scope:DirectorScopeSchema,source:CompositionSourceInspectSchema,renderId:z47.uuid().optional()}).refine(i=>i.scope.tenantId===i.source.tenantId&&i.scope.productionId===i.source.productionId,"Source Review retains exact Tenant/Production scope");var SourceReviewContextSchema=z47.strictObject({semanticStatus:z47.literal("SUCCESS"),advisory:z47.literal(true),basis:z47.strictObject({input:SourceReviewContextInputSchema,contextFingerprint:sha5}),ownerContext:DirectorContextResultSchema,source:CompositionSourceInspectionSchema,render:CompositionRenderViewSchema.nullable(),outputReviewTarget:ProgrammaticVideoReviewTargetSchema.nullable(),limitations:z47.tuple([z47.literal("SOURCE_REASONING_DOES_NOT_CERTIFY_OUTPUT_QUALITY"),z47.literal("INDEPENDENT_OUTPUT_REVIEW_AND_ACCEPTANCE_REQUIRED"),z47.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED")])});import{z as z48}from"zod";var key4=z48.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ProgrammaticCompareSchema=z48.strictObject({scope:ExplorationScopeSchema,items:z48.array(z48.strictObject({label:key4,renderId:z48.uuid()})).min(2).max(6)}).superRefine((i,c)=>{if(new Set(i.items.map(v=>v.label)).size!==i.items.length||new Set(i.items.map(v=>v.renderId.toLowerCase())).size!==i.items.length)c.addIssue({code:"custom",message:"Programmatic labels and exact renders must be distinct"})});var ProgrammaticComparisonSchema=z48.strictObject({semanticStatus:z48.literal("SUCCESS"),advisory:z48.literal(true),scope:ExplorationScopeSchema,selection:ProgrammaticCompareSchema.shape.items,items:z48.array(z48.strictObject({label:key4,sourceKind:z48.literal("PROGRAMMATIC"),composition:CompositionViewSchema,render:CompositionRenderViewSchema,reviewTarget:ProgrammaticVideoReviewTargetSchema.nullable()})).min(2).max(6),limitations:z48.tuple([z48.literal("OWNER_STATES_ARE_NOT_VISUAL_SCORES"),z48.literal("REVIEW_AND_ACCEPTANCE_REMAIN_EXPLICIT")])}).superRefine((v,c)=>{if(v.items.length!==v.selection.length||v.items.some((item,i)=>item.label!==v.selection[i].label||item.render.receipt.renderId!==v.selection[i].renderId))c.addIssue({code:"custom",message:"Programmatic comparison retains every exact selected label/render"});for(const item of v.items){const owner=item.composition.version,target2=item.reviewTarget;if(owner.tenantId!==v.scope.tenantId||owner.projectId!==v.scope.projectId||owner.productionId!==v.scope.productionId||owner.basis.shotId!==v.scope.shotId||owner.content.role!=="PRIMARY_VISUAL"||owner.id!==item.render.receipt.compositionVersionId||target2&&(target2.renderId!==item.render.receipt.renderId||target2.compositionVersionId!==owner.id||target2.tenantId!==v.scope.tenantId||target2.projectId!==v.scope.projectId||target2.productionId!==v.scope.productionId||target2.shotId!==v.scope.shotId))c.addIssue({code:"custom",message:"Programmatic comparison retains exact native source/output scope"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=2*1024*1024,"Programmatic comparison exceeds2MiB");var ProgrammaticRecommendationContextInputSchema=ProgrammaticCompareSchema.safeExtend({criteria:z48.array(ExplorationComparisonCriterionSchema).min(1).max(8)}).refine(i=>new Set(i.criteria.map(v=>v.key)).size===i.criteria.length,"Criteria must be distinct");var ProgrammaticRecommendationBasisSchema=z48.strictObject({input:ProgrammaticRecommendationContextInputSchema,contextFingerprint:z48.string().regex(/^[0-9a-f]{64}$/)});var ProgrammaticRecommendationContextSchema=z48.strictObject({semanticStatus:z48.literal("SUCCESS"),advisory:z48.literal(true),basis:ProgrammaticRecommendationBasisSchema,comparison:ProgrammaticComparisonSchema,candidates:z48.array(ExplorationRecommendationCandidateSchema).min(2).max(6),limitations:z48.tuple([z48.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z48.literal("NO_IMPLICIT_MEDIA_OR_MODEL_CALL")])}).superRefine((v,c)=>{if(JSON.stringify(v.basis.input.scope)!==JSON.stringify(v.comparison.scope)||JSON.stringify(v.basis.input.items)!==JSON.stringify(v.comparison.selection)||v.candidates.length!==v.comparison.items.length||v.candidates.some((candidate,i)=>candidate.label!==v.comparison.items[i].label))c.addIssue({code:"custom",message:"Programmatic Recommendation keeps exact comparison scope/selection"});for(const candidate of v.candidates){const target2=candidate.reviewContext?.reviewTarget;const item=v.comparison.items.find(i=>i.label===candidate.label);if(target2&&(target2.kind!=="PROGRAMMATIC"||target2.target.renderId!==item?.render.receipt.renderId||target2.target.compositionVersionId!==item.composition.version.id))c.addIssue({code:"custom",message:"Candidate assessment binds the exact native CODE output"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=2*1024*1024,"Programmatic recommendation context exceeds2MiB");var ValidateProgrammaticRecommendationSchema=z48.strictObject({basis:ProgrammaticRecommendationBasisSchema,proposal:ValidateExplorationRecommendationSchema.shape.proposal}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=1024*1024,"Programmatic recommendation input exceeds1MiB");var ProgrammaticRecommendationValidationSchema=z48.strictObject({...ExplorationRecommendationValidationResultSchema.shape,basis:ProgrammaticRecommendationBasisSchema}).superRefine((v,c)=>{const s=v.basis.input.scope;for(const assessment of v.reviews){const item=v.basis.input.items.find(i=>i.label===assessment.label),draft2=assessment.validation.recordDraft;if(!item||draft2.kind!=="PROGRAMMATIC"||draft2.input.renderId!==item.renderId||draft2.input.tenantId!==s.tenantId||draft2.input.productionId!==s.productionId||assessment.validation.basis.scope.projectId!==s.projectId)c.addIssue({code:"custom",message:"Recommendation review draft binds exact CODE output and scope"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=4*1024*1024,"Programmatic recommendation result exceeds4MiB");import{z as z49}from"zod";var CompositionRenderQuerySchema=CompositionScopeSchema.extend({limit:z49.int().min(1).max(24).default(12),next:ContinuationSchema.optional(),shotId:z49.uuid().optional(),role:z49.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]).default("PRIMARY_VISUAL")});var CompositionRenderObservationSchema=z49.strictObject({render:CompositionRenderViewSchema,createdAt:z49.iso.datetime({offset:true}),version:z49.int().positive(),executionClass:z49.enum(["LIVE","TEST_ONLY"]),freshness:z49.enum(["CURRENT_BASIS","STALE_BASIS"]),available:z49.boolean(),review:z49.strictObject({result:z49.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),reviewId:z49.uuid().nullable(),acceptanceId:z49.uuid().nullable(),accepted:z49.boolean()})}).superRefine((v,ctx)=>{if(!v.render.sourceIdentity||v.review.result==="UNREVIEWED"!==(v.review.reviewId===null)||v.review.accepted!==(v.review.acceptanceId!==null)||v.review.accepted&&(!v.review.acceptanceId||!v.review.reviewId||!v.available||v.freshness!=="CURRENT_BASIS"||!["PASS","WARNING"].includes(v.review.result)))ctx.addIssue({code:"custom",message:"Observation requires exact native source/Review/acceptance identity"})});var CompositionRenderPageSchema=z49.strictObject({items:z49.array(CompositionRenderObservationSchema).max(24),page:QueryPageInfoSchema}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=4194304,"Render observation page exceeds 4 MiB");var CompositionRenderMediaDescriptorSchema=z49.strictObject({path:z49.string().regex(/^\/v1\/productions\/[0-9a-f-]{36}\/compositions\/renders\/[0-9a-f-]{36}\/media$/i),contentType:z49.literal("video/mp4"),checksumSha256:z49.string().regex(/^[0-9a-f]{64}$/),byteSize:z49.int().positive().max(134217728),authentication:z49.literal("BEARER_AND_TENANT_HEADER")});import{z as z50}from"zod";var CompositionSampleStartSchema=CompositionRenderGetSchema.extend({expectedProductionRevision:z50.int().positive(),profile:TemporalSamplingProfileSchema,idempotencyKey:z50.string().trim().min(1).max(128)});var CompositionObserveGetSchema=CompositionRenderGetSchema.extend({evidenceId:z50.uuid()});var RenderObservationIdentitySchema=z50.strictObject({renderId:z50.uuid(),compositionVersionId:z50.uuid(),artifactId:z50.uuid(),representationId:z50.uuid(),checksumSha256:z50.string().regex(/^[0-9a-f]{64}$/)});var CompositionSampleReceiptSchema=RenderObservationIdentitySchema.extend({evidence:TemporalEvidenceAdmissionSchema,nextActions:z50.tuple([z50.literal("READ_OBSERVATION")])});var CompositionFrameObservationSchema=z50.strictObject({ordinal:z50.int().nonnegative().max(63),frameIndex:z50.int().nonnegative().max(3599),timestampMs:z50.number().nonnegative().max(6e4),checksumSha256:z50.string().regex(/^[0-9a-f]{64}$/),representationId:z50.uuid(),diagnostic:z50.literal("FRAME_EVIDENCE_READY")});var CompositionObservationViewSchema=RenderObservationIdentitySchema.extend({evidence:TemporalEvidenceViewSchema,frames:z50.array(CompositionFrameObservationSchema).max(64),contactSheetArtifactId:z50.uuid().nullable(),nextActions:z50.array(z50.enum(["READ_OBSERVATION","READ_FRAME_MEDIA","REVISE_COMPOSITION","RENDER_REVISION"])).min(1).max(4)});var scope5={projectId:ProjectIdSchema,productionId:ProductionIdSchema};var ScopedAcceptBriefSchema=AcceptBriefRequestSchema.extend(scope5);var ScopedAcceptStorySchema=AcceptStoryRequestSchema.extend(scope5);var ScopedAcceptSceneShotPlanSchema=AcceptSceneShotPlanRequestSchema.extend(scope5);import{z as z51}from"zod";var CreateProductionRequestSchema=z51.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,idempotencyKey:z51.string().trim().min(1).max(200)});var CreatedProductionResultSchema=CreatedProjectResultSchema;import{z as z52}from"zod";var sha6=z52.string().regex(/^[0-9a-f]{64}$/);var WavExportResultSchema=z52.strictObject({contentType:z52.literal("audio/wav"),checksumSha256:sha6,byteSize:z52.int().min(44).max(12582912),contentBase64:z52.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]+={0,2}$/)});var AudioExportResultSchema=WavExportResultSchema.extend({representationId:z52.uuid()});var CaptionExportResultSchema=z52.strictObject({contentType:z52.enum(["application/json","application/x-subrip"]),checksumSha256:sha6,representationId:z52.uuid(),text:z52.string().min(1).max(131072)});import{z as z53}from"zod";var tenant=TenantIdSchema.toLowerCase();var project=ProjectIdSchema.toLowerCase();var production=ProductionIdSchema.toLowerCase();var artifact=ArtifactIdSchema.toLowerCase();var representation=ArtifactRepresentationIdSchema.toLowerCase();var DiscoverableArtifactFamilySchema=z53.enum(["SOURCE","KEYFRAME_CANDIDATE","SHOT_CANDIDATE","COMPOSITION_RENDER_OUTPUT","ROUGH_CUT","FINAL_RENDER_OUTPUT","IMPORTED_VISUAL_ORIGINAL","IMPORTED_VISUAL_NORMALIZED","IMPORTED_VISUAL_POSTER","AUDIO","AUDIO_SOURCE_SYNC","CAPTION","CONTACT_SHEET"]);var DiscoveryContentTypeSchema=MediaBrowserContentTypeSchema;var ArtifactDiscoveryQuerySchema=z53.strictObject({tenantId:tenant,projectId:project.optional(),productionId:production.optional(),artifactId:artifact.optional(),mediaCategory:MediaCategorySchema.optional(),family:DiscoverableArtifactFamilySchema.optional(),search:z53.string().trim().min(1).max(200).optional(),lifecycle:z53.enum(["READY","ARCHIVED"]).default("READY"),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ArtifactDiscoveryMediaSchema=z53.strictObject({tenantId:tenant,projectId:project,artifactId:artifact,representationId:representation});var ArtifactMediaTicketRequestSchema=ArtifactDiscoveryMediaSchema.extend({download:z53.boolean().optional()});var ArtifactMediaTicketSchema=ArtifactDiscoveryMediaSchema.extend(MediaBrowserReadTicketSchema.shape);var ArtifactDiscoveryItemSchema=z53.strictObject({humanLinks:HumanLinksSchema.optional(),artifactId:ArtifactIdSchema,projectId:ProjectIdSchema,projectName:z53.string().min(1).max(500),projectLifecycle:ProjectSchema.shape.lifecycle.nullable().default(null),productionId:ProductionIdSchema.nullable(),representationId:ArtifactRepresentationIdSchema,family:DiscoverableArtifactFamilySchema,lifecycle:z53.enum(["READY","ARCHIVED"]),origin:z53.string().min(1).max(120),contentType:DiscoveryContentTypeSchema,checksumSha256:z53.string().regex(/^[a-f0-9]{64}$/),byteSize:z53.int().positive(),width:z53.int().positive().nullable(),height:z53.int().positive().nullable(),durationMs:z53.int().nonnegative().nullable(),createdAt:z53.iso.datetime({offset:true}),originalName:z53.string().max(255).nullable(),sourceKind:SourceLibraryItemSchema.shape.kind.nullable().default(null),executionClass:z53.enum(["LIVE","TEST_ONLY","UNKNOWN"]),mediaAvailable:z53.boolean(),sourceVersionId:z53.uuid().nullable(),normalizationId:z53.uuid().nullable()});var ArtifactDiscoveryPageSchema=z53.strictObject({items:z53.array(ArtifactDiscoveryItemSchema).max(100),page:QueryPageInfoSchema});import{z as z54}from"zod";var TerminateProductionSchema=z54.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,outcome:z54.enum(["FAILED","CANCELLED"]),expectedProductionRevision:z54.int().positive(),reason:z54.string().trim().min(1).max(1e3),idempotencyKey:z54.string().trim().min(1).max(200)});var ProductionTerminationReceiptSchema=z54.strictObject({decisionId:z54.uuid(),productionId:ProductionIdSchema,projectId:ProjectIdSchema,state:ProductionStateSchema});import{z as z55}from"zod";var text3=z55.string().trim().min(1).max(600);var key5=z55.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var Review1RepairSourceResultSchema=z55.strictObject({input:Review1RepairSourceQuerySchema,source:Review1RepairSourceSchema,productionRevision:z55.int().positive(),caseVersion:z55.int().nonnegative(),budget:SemanticRepairBudgetSchema.nullable()}).superRefine((v,c)=>{const fields=["tenantId","projectId","productionId","mediaType","generationId","reviewId"];if(fields.some(key6=>v.input[key6]!==v.source[key6])||v.input.requirementKey!==v.source.requirement.key)c.addIssue({code:"custom",message:"Native source must match the exact scoped Review obligation"})});var Review1RepairStrategyBasisSchema=z55.strictObject({input:Review1RepairSourceQuerySchema,contextFingerprint:z55.string().regex(/^[0-9a-f]{64}$/)});var Review1RepairStrategyContextSchema=z55.strictObject({semanticStatus:z55.literal("SUCCESS"),advisory:z55.literal(true),basis:Review1RepairStrategyBasisSchema,owner:Review1RepairSourceResultSchema});var ValidateReview1RepairStrategySchema=z55.strictObject({basis:Review1RepairStrategyBasisSchema,budget:SemanticRepairBudgetSchema.optional(),proposal:z55.strictObject({origin:z55.strictObject({kind:z55.literal("EXTERNAL_AGENT_HOST"),label:z55.string().trim().min(1).max(100)}),summary:text3,alternatives:z55.array(z55.strictObject({id:key5,rationale:text3,whySmallerChangeInsufficient:text3,action:z55.discriminatedUnion("kind",[z55.strictObject({kind:z55.literal("REGENERATE_SHOT")}),z55.strictObject({kind:z55.literal("REQUEST_HUMAN_INPUT"),question:text3}),z55.strictObject({kind:z55.literal("REQUEST_CANONICAL_CHANGE"),requestedChange:text3})])})).min(1).max(6),selectedAlternativeId:key5})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Review-1 strategy exceeds 1 MiB");var Review1RepairStrategyValidationSchema=z55.strictObject({semanticStatus:z55.literal("SUCCESS"),advisory:z55.literal(true),basis:Review1RepairStrategyBasisSchema,proposal:ValidateReview1RepairStrategySchema.shape.proposal,alternatives:z55.array(z55.strictObject({alternativeId:key5,handoff:z55.discriminatedUnion("kind",[z55.strictObject({kind:z55.literal("AUTHOR_REVIEW1_REPAIR"),input:AuthorReview1RepairSchema.omit({idempotencyKey:true})}),z55.strictObject({kind:z55.literal("HUMAN_INPUT_INTENT"),question:text3}),z55.strictObject({kind:z55.literal("CANONICAL_CHANGE_INTENT"),requestedChange:text3})])})).min(1).max(6),selectedAlternativeId:key5,followUp:z55.union([z55.tuple([]),z55.tuple([z55.literal("EXPLICIT_NATIVE_AUTHORING"),z55.literal("OWNER_BUDGET_AND_COST_ADMISSION"),z55.literal("EXPLICIT_NATIVE_EXECUTION"),z55.literal("INDEPENDENT_REVIEW_1_AND_NATIVE_PROOF")])])});import{z as z56}from"zod";var McpEntryToolNames=["workspace_caller","studio_capability_groups","studio_capability_search","studio_capability_describe","studio_capability_query","studio_capability_invoke"];var McpCapabilityGatewayNames=["studio_capability_query","studio_capability_invoke"];var CapabilityInvocationInputSchema=z56.strictObject({tenantId:TenantIdSchema,tool:z56.string().regex(/^[a-zA-Z0-9_-]{1,120}$/),arguments:z56.record(z56.string(),z56.unknown()),capabilityVersion:CapabilityVersionSchema.optional()});var CapabilityInvocationOutputSchema=z56.strictObject({tool:z56.string().regex(/^[a-zA-Z0-9_-]{1,120}$/),result:z56.unknown().optional()});import{z as z57}from"zod";var OperationArguments=z57.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,operationId:OperationSummarySchema.shape.id});var OperationInspect=z57.discriminatedUnion("tool",[z57.strictObject({tool:z57.literal("operation_get"),arguments:OperationArguments}),z57.strictObject({tool:z57.literal("studio_capability_query"),arguments:CapabilityInvocationInputSchema.extend({tool:z57.literal("operation_get"),arguments:OperationArguments})})]);var SnapshotArguments=OperationArguments.omit({operationId:true});var FailureInspect=z57.union([OperationInspect,z57.strictObject({tool:z57.literal("production_snapshot"),arguments:SnapshotArguments}),z57.strictObject({tool:z57.literal("studio_capability_query"),arguments:CapabilityInvocationInputSchema.extend({tool:z57.literal("production_snapshot"),arguments:SnapshotArguments})})]);var Evidence=z57.object({path:z57.string().min(1).max(120)}).strict();var StudioNavigationSchema=z57.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,evidence:z57.object({source:z57.literal("production_snapshot"),revision:z57.int().positive(),generatedAt:z57.iso.datetime({offset:true})}).strict(),state:ProductionSnapshotSchema.shape.state.extend({blockingReason:z57.string().max(1e3).nullable(),waitingReason:z57.string().max(1e3).nullable()}),stateReasonsTruncated:z57.object({blockingReason:z57.boolean(),waitingReason:z57.boolean()}).strict(),planning:ProductionSnapshotSchema.shape.planning,shots:ProductionSnapshotSchema.shape.shots,work:ProductionSnapshotSchema.shape.work,findings:ProductionSnapshotSchema.shape.findings,timeline:ProductionSnapshotSchema.shape.timeline.pick({currentVersion:true,stale:true}),final:ProductionSnapshotSchema.shape.final.pick({renderState:true,deliveryValidationState:true}),blockers:z57.object({total:z57.int().nonnegative(),truncated:z57.boolean(),items:z57.array(ProductionSnapshotSchema.shape.blockers.element.extend({evidence:Evidence})).max(10)}).strict(),actions:z57.object({total:z57.int().nonnegative(),truncated:z57.boolean(),items:z57.array(NextActionSchema.extend({tool:z57.string().min(1).max(120).nullable(),registration:z57.enum(["REGISTERED","NOT_ON_SURFACE"]),readOnly:z57.boolean().nullable(),invocationTool:z57.enum(["studio_capability_query","studio_capability_invoke"]).optional(),purpose:z57.string().max(500).nullable(),group:NavigationGroupIdSchema.nullable(),context:z57.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,revision:z57.int().positive()}).strict(),inputHints:z57.object({knownInputs:z57.partialRecord(z57.enum(["tenantId","projectId","productionId","shotId","sceneId","findingId","operationId","artifactId"]),z57.string().min(1).max(2048)),schemaFingerprint:z57.string().regex(/^[a-f0-9]{64}$/).nullable(),requiredInputs:z57.array(z57.string()).max(128),missingInputs:z57.array(z57.string()).max(128),schemaInspectionRequired:z57.literal(true)}).strict().nullable(),recommendation:z57.array(z57.enum(["NATIVE_AVAILABLE","NATIVE_UNAVAILABLE","GOAL_MATCH","INSPECT_SCHEMA","NOT_ON_SURFACE"])).max(4),inspect:z57.object({tool:z57.literal("studio_capability_describe"),arguments:CapabilityDescribeInputSchema}).strict().nullable(),evidence:Evidence})).max(8),page:z57.object({hasMore:z57.boolean(),next:z57.string().max(2048).nullable()}).strict()}).strict(),operations:z57.object({total:z57.int().nonnegative(),truncated:z57.boolean(),items:z57.array(OperationSummarySchema.pick({id:true,productionId:true,semanticStatus:true,startedAt:true,updatedAt:true}).extend({inspect:OperationInspect.nullable(),failure:OperationFailureSchema.extend({next:FailureInspect.nullable()}).optional(),targetCount:z57.int().nonnegative(),blockerCount:z57.int().nonnegative(),evidence:Evidence})).max(5)}).strict(),related:CapabilitySearchSchema.nullable(),guidance:z57.literal("Use native IDs and revision from this snapshot. An outstanding or unacknowledged write must be reconciled through its Operation; never replay it automatically. Commands revalidate current authority, prerequisites, revision and idempotency.")}).strict();import{z as z59}from"zod";import{z as z58}from"zod";var VoiceReferenceAudioSchema=z58.strictObject({audioVersionId:z58.uuid(),projectId:z58.uuid(),productionId:z58.uuid(),artifactId:z58.uuid(),representationId:z58.uuid(),checksumSha256:z58.string().regex(/^[a-f0-9]{64}$/),byteSize:z58.int().min(44).max(12582912),durationMs:z58.int().min(100).max(6e4),executionClass:z58.enum(["LIVE","TEST_ONLY"]),voiceProfile:VoiceProfileUseSchema.safeExtend({usage:z58.literal("AUDITION")})});var VoiceReferenceSchema=z58.strictObject({humanLinks:HumanLinksSchema.optional(),id:z58.uuid(),tenantId:TenantIdSchema,voiceProfileId:z58.uuid(),ref:VoiceProfileRefSchema,version:z58.int().positive(),audio:VoiceReferenceAudioSchema.nullable(),createdByPrincipalId:z58.uuid(),createdAt:z58.iso.datetime({offset:true})}).refine(v=>v.ref.ownerSystem==="native-video-studio"&&v.ref.ownerTenantRef===v.tenantId&&v.ref.voiceProfileRef===v.voiceProfileId&&(!v.audio||Object.entries(v.ref).every(([key6,value])=>v.audio.voiceProfile.ref[key6]===value)),"Reference selection must preserve its exact workspace voice identity");var VoiceReferenceGetSchema=z58.strictObject({tenantId:TenantIdSchema,voiceProfileId:z58.uuid(),referenceId:z58.uuid()});var VoiceProfileScopeSchema=z59.strictObject({tenantId:TenantIdSchema,voiceProfileId:z59.uuid()});var VoiceProfileBindingSchema=z59.strictObject({key:z59.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),modelProfileId:ModelProfileIdSchema,modelProfileVersion:z59.int().positive(),voice:z59.string().min(1).max(100),languages:z59.array(VoiceLocaleSchema).min(1).max(16).refine(v=>new Set(v.map(s=>s.toLowerCase())).size===v.length),parameters:SpeechParametersSchema.default({}),nativeExecution:NativeSpeechExecutionSchema.optional()});var VoiceProfileContentSchema=z59.strictObject({displayName:z59.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),description:z59.string().trim().max(1e3).default(""),style:z59.string().trim().max(400).default(""),origin:z59.enum(["PRESET","LICENSED_REFERENCE","CLONED_WITH_CONSENT"]),allowedUses:z59.array(z59.enum(["AUDITION","PRODUCTION"])).min(1).max(2).refine(v=>new Set(v).size===v.length).default(["AUDITION","PRODUCTION"]),expiresAt:z59.iso.datetime({offset:true}).optional(),rightsStatement:z59.string().trim().min(1).max(1e3).optional(),bindings:z59.array(VoiceProfileBindingSchema).min(1).max(8).refine(v=>new Set(v.map(b=>b.key)).size===v.length)});var command2={tenantId:TenantIdSchema,idempotencyKey:z59.string().trim().min(1).max(200)};var revision2={voiceProfileId:z59.uuid(),expectedRevision:z59.int().positive()};var VoiceProfileCommandSchema=z59.discriminatedUnion("action",[z59.strictObject({...command2,action:z59.literal("CREATE"),content:VoiceProfileContentSchema}),z59.strictObject({...command2,...revision2,action:z59.literal("REVISE"),content:VoiceProfileContentSchema}),z59.strictObject({...command2,...revision2,action:z59.literal("PUBLISH")}),z59.strictObject({...command2,...revision2,action:z59.literal("SET_ENABLED"),enabled:z59.boolean()}),z59.strictObject({...command2,...revision2,action:z59.literal("SET_REFERENCE"),voiceProfileVersion:z59.int().positive(),audioVersionId:z59.uuid().nullable()})]);var VoiceProfileVersionQuerySchema=VoiceProfileScopeSchema.extend({version:z59.int().positive()});var VoiceProfileListSchema=z59.strictObject({tenantId:TenantIdSchema,search:z59.string().trim().max(100).optional(),status:z59.enum(["DRAFT","PUBLISHED","DISABLED"]).optional(),limit:z59.int().min(1).max(100).default(25),next:z59.string().min(1).max(4096).optional()});var VoiceProfileReceiptSchema=z59.strictObject({humanLinks:HumanLinksSchema.optional(),reference:VoiceReferenceSchema.optional(),semanticStatus:z59.literal("SUCCESS"),tenantId:TenantIdSchema,voiceProfileId:z59.uuid(),revision:z59.int().positive(),publishedVersion:z59.int().positive().nullable(),enabled:z59.boolean()});var VoiceProfileVersionSchema=z59.strictObject({humanLinks:HumanLinksSchema.optional(),ref:VoiceProfileRefSchema,content:VoiceProfileContentSchema,publishedByPrincipalId:z59.uuid(),publishedAt:z59.iso.datetime({offset:true})});var VoiceProfileSummarySchema=VoiceProfileReceiptSchema.omit({semanticStatus:true}).extend({displayName:z59.string().min(1).max(100),status:z59.enum(["DRAFT","PUBLISHED","DISABLED"]),updatedAt:z59.iso.datetime({offset:true})});var VoiceProfileViewSchema=VoiceProfileSummarySchema.extend({reference:VoiceReferenceSchema.nullable().default(null),draft:VoiceProfileContentSchema,draftDigest:z59.string().regex(/^[a-f0-9]{64}$/),published:VoiceProfileVersionSchema.nullable()});var VoiceProfilePageSchema=z59.strictObject({humanLinks:HumanLinksSchema.optional(),items:z59.array(VoiceProfileSummarySchema).max(100),next:z59.string().max(4096).nullable()});var VoiceProfileCreateSchema=VoiceProfileCommandSchema.options[0].omit({action:true});var VoiceProfileReviseSchema=VoiceProfileCommandSchema.options[1].omit({action:true});var VoiceProfilePublishSchema=VoiceProfileCommandSchema.options[2].omit({action:true});var VoiceProfileSetEnabledSchema=VoiceProfileCommandSchema.options[3].omit({action:true});var VoiceProfileSetReferenceSchema=VoiceProfileCommandSchema.options[4].omit({action:true});import{z as z60}from"zod";var sha7=z60.string().regex(/^[a-f0-9]{64}$/);var VoiceReviewAudioSchema=VoiceReferenceAudioSchema.omit({voiceProfile:true}).extend({voiceProfile:VoiceProfileUseSchema});var VoiceReviewScopeSchema=z60.strictObject({tenantId:TenantIdSchema,voiceProfileId:z60.uuid()});var VoiceReviewTargetQuerySchema=VoiceReviewScopeSchema.extend({audioVersionId:z60.uuid()});var VoiceReviewBasisSchema=z60.strictObject({reference:VoiceReferenceSchema.safeExtend({audio:VoiceReferenceAudioSchema}),candidate:VoiceReviewAudioSchema}).refine(v=>Object.entries(v.reference.ref).every(([key6,value])=>v.candidate.voiceProfile.ref[key6]===value),"Comparison must preserve the exact same voice identity");var VoiceIdentityObservationSchema=z60.strictObject({status:z60.enum(["MATCH","DIFFERENT","UNDETERMINED"]),confidence:z60.enum(["CLEAR","UNCERTAIN"]),observed:z60.string().trim().min(1).max(1800)});var VoiceNaturalnessObservationSchema=z60.strictObject({status:z60.enum(["NATURAL","NEEDS_WORK","NOT_ASSESSED"]),observed:z60.string().trim().min(1).max(1800)});var RecordVoiceReviewSchema=VoiceReviewTargetQuerySchema.extend({referenceId:z60.uuid(),basisFingerprint:sha7,expectedReviewVersion:z60.int().nonnegative(),idempotencyKey:z60.string().trim().min(1).max(200),actor:z60.enum(["HUMAN","EXTERNAL_AGENT"]),referenceListening:ListeningEvidenceSchema,candidateListening:ListeningEvidenceSchema,identity:VoiceIdentityObservationSchema,naturalness:VoiceNaturalnessObservationSchema});var VoiceReviewRecordSchema=VoiceReviewTargetQuerySchema.extend({id:z60.uuid(),version:z60.int().positive(),basis:VoiceReviewBasisSchema,basisFingerprint:sha7,actor:z60.enum(["HUMAN","EXTERNAL_AGENT"]),executionClass:z60.enum(["LIVE","TEST_ONLY"]),referenceListening:ListeningEvidenceSchema,candidateListening:ListeningEvidenceSchema,identity:VoiceIdentityObservationSchema,naturalness:VoiceNaturalnessObservationSchema,identityResult:z60.enum(["MATCH","DIFFERENT","UNDETERMINED"]),createdByPrincipalId:z60.uuid(),createdAt:z60.iso.datetime({offset:true})}).refine(v=>v.basis.reference.audio.audioVersionId!==v.basis.candidate.audioVersionId&&v.basis.reference.tenantId===v.tenantId&&v.basis.reference.voiceProfileId===v.voiceProfileId&&v.basis.candidate.audioVersionId===v.audioVersionId&&v.executionClass===([v.basis.reference.audio,v.basis.candidate].some(a=>a.executionClass==="TEST_ONLY")?"TEST_ONLY":"LIVE")&&v.identityResult===(v.identity.confidence==="CLEAR"?v.identity.status:"UNDETERMINED"),"Review must preserve exact comparison scope, execution class and independent result");var VoiceReviewStaleReasonSchema=z60.enum(["NO_REFERENCE","REFERENCE_CHANGED","REVIEW_SUPERSEDED","VOICE_UNAVAILABLE","AUDIO_UNAVAILABLE","IDENTITY_MISMATCH","SAME_AUDIO","TEST_ONLY"]);var VoiceReviewTargetSchema=VoiceReviewTargetQuerySchema.extend({humanLinks:HumanLinksSchema.optional(),basis:VoiceReviewBasisSchema.nullable(),basisFingerprint:sha7.nullable(),reviewVersion:z60.int().nonnegative(),eligible:z60.boolean(),staleReasons:z60.array(VoiceReviewStaleReasonSchema).max(8),latestReview:VoiceReviewRecordSchema.nullable()}).refine(v=>v.eligible===(v.staleReasons.length===0)&&(!v.eligible||!!v.basis&&!!v.basisFingerprint)&&v.basis===null===(v.basisFingerprint===null)&&(!v.basis||v.basis.reference.tenantId===v.tenantId&&v.basis.reference.voiceProfileId===v.voiceProfileId&&v.basis.candidate.audioVersionId===v.audioVersionId)&&v.reviewVersion===(v.latestReview?.version??0)&&(!v.latestReview||v.latestReview.tenantId===v.tenantId&&v.latestReview.voiceProfileId===v.voiceProfileId&&v.latestReview.audioVersionId===v.audioVersionId&&v.latestReview.basis.reference.id===v.basis?.reference.id),"Target projection must preserve exact scope and eligibility");var VoiceReviewGetSchema=VoiceReviewScopeSchema.extend({reviewId:z60.uuid()});var VoiceReviewViewSchema=z60.strictObject({humanLinks:HumanLinksSchema.optional(),review:VoiceReviewRecordSchema,current:z60.boolean(),staleReasons:z60.array(VoiceReviewStaleReasonSchema).max(8)}).refine(v=>v.current===(v.staleReasons.length===0),"Historical applicability must agree with currentness reasons");var VoiceReviewReceiptSchema=z60.strictObject({humanLinks:HumanLinksSchema.optional(),semanticStatus:z60.literal("SUCCESS"),review:VoiceReviewRecordSchema});import{z as z61}from"zod";var scope6=z61.strictObject({tenantId:z61.uuid().toLowerCase(),shareId:z61.uuid().toLowerCase()});var ShareCreateSchema=ArtifactDiscoveryMediaSchema.extend({shareId:z61.uuid().toLowerCase(),idempotencyKey:z61.string().min(1).max(128),title:z61.string().trim().min(1).max(160).default("Video"),expiresAt:z61.iso.datetime({offset:true}).optional()}).strict();var ShareGetSchema=scope6;var ShareRevokeSchema=scope6.extend({expectedRevision:z61.int().positive(),idempotencyKey:z61.string().min(1).max(128)}).strict();var ShareListSchema=z61.strictObject({tenantId:z61.uuid().toLowerCase(),projectId:z61.uuid().toLowerCase().optional(),artifactId:z61.uuid().toLowerCase().optional(),after:z61.uuid().toLowerCase().optional(),limit:z61.int().min(1).max(50).default(20)});var ShareViewSchema=ArtifactDiscoveryMediaSchema.extend({shareId:z61.uuid(),productionId:z61.uuid().nullable(),createdByPrincipalId:z61.uuid(),title:z61.string().min(1).max(160),purpose:z61.enum(["PREVIEW","ROUGH_CUT","FINAL_RENDER"]),contentType:z61.literal("video/mp4"),checksumSha256:z61.string().regex(/^[a-f0-9]{64}$/),byteSize:z61.int().positive().max(128*1024*1024),revision:z61.int().positive(),state:z61.enum(["PREPARING","ACTIVE","REVOKED","EXPIRED","AUTHORITY_REVOKED"]),createdAt:z61.iso.datetime({offset:true}),expiresAt:z61.iso.datetime({offset:true})}).strict();var ShareUrlSchema=z61.url().max(2048).refine(value=>{try{const u=new URL(value);return!u.username&&!u.password&&!u.search&&/^\/s\/[a-f0-9-]{36}$/.test(u.pathname)&&/^#key=[A-Za-z0-9_-]{43}$/.test(u.hash)&&(u.protocol==="https:"||u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname))}catch{return false}});var ShareLinkResultSchema=z61.strictObject({share:ShareViewSchema,url:ShareUrlSchema.nullable(),linkState:z61.enum(["AVAILABLE","UNCONFIGURED","UNAVAILABLE","NOT_ACTIVE"])}).refine(v=>v.linkState==="AVAILABLE"===(v.url!==null)).refine(v=>!v.url||v.share.state==="ACTIVE"&&new URL(v.url).pathname==="/s/"+v.share.shareId);var SharePageSchema=z61.strictObject({items:z61.array(ShareViewSchema).max(50),next:z61.uuid().nullable()});var SharePublicInputSchema=z61.strictObject({shareId:z61.uuid().toLowerCase(),secret:z61.string().regex(/^[A-Za-z0-9_-]{43}$/)});import{z as z62}from"zod";var id5=z62.uuid().toLowerCase();var EventLinkScopeSchema=FederationScopeSchema.extend({tenantId:id5.pipe(TenantIdSchema),productionId:id5.pipe(ProductionIdSchema)});var EventLinkContinuationScopeSchema=z62.strictObject({workspace:id5,productionId:id5,eventLink:id5});var EventLinkStateLocatorSchema=z62.string().regex(/^[a-f0-9]{64}[A-Za-z0-9_-]{43}$/).transform(value=>{const uuid6=v=>[v.slice(0,8),v.slice(8,12),v.slice(12,16),v.slice(16,20),v.slice(20)].join("-");return{requestId:uuid6(value.slice(0,32)),productionId:uuid6(value.slice(32,64))}}).pipe(z62.strictObject({requestId:id5,productionId:id5}));var EventLinkRequestInputSchema=EventLinkScopeSchema.extend({requestId:id5});var EventLinkStartInputSchema=EventLinkRequestInputSchema.extend({targetId:z62.string().regex(/^[a-zA-Z0-9_.:-]{1,80}$/),eventType:ExternalEventTypeSchema});var EventLinkConfirmInputSchema=EventLinkRequestInputSchema.extend({expiresAt:z62.iso.datetime().transform(v=>new Date(v).toISOString()),publicationMode:z62.enum(["FIXED","ON_DEMAND"])});var EventLinkCallbackInputSchema=EventLinkRequestInputSchema.extend({callback:z62.string().min(1).max(8192)});var EventLinkTargetsSchema=EventLinkScopeSchema.extend({sdkVersion:z62.literal("0.4.0"),protocol:z62.literal("event-link/1"),role:z62.literal("SENDER"),configuration:z62.enum(["CONFIGURED","UNCONFIGURED"]),targets:z62.array(z62.strictObject({id:z62.string().max(80),displayName:z62.string().min(1).max(160),serviceRef:z62.string().min(1).max(256),eventTypes:z62.array(ExternalEventTypeSchema).min(1).max(14)})).max(32)});var EventLinkViewSchema=EventLinkRequestInputSchema.extend({phase:z62.enum(["LOGIN","EXCHANGING","CONFIRM","CONFIRMED","DENIED","CANCELLED","EXPIRED","UNKNOWN"]),targetId:z62.string().max(80),eventType:ExternalEventTypeSchema,expiresAt:z62.iso.datetime(),peer:z62.strictObject({serviceRef:z62.string().min(1).max(256),tenantRef:z62.string().min(1).max(256),displayName:z62.string().min(1).max(160)}).nullable(),route:FederationRouteSchema.nullable()}).refine(v=>v.phase==="CONFIRMED"?!!v.route&&v.route.tenantId===v.tenantId&&v.route.productionId===v.productionId&&v.route.routeId===v.requestId&&v.route.selectedEventTypes.length===1&&v.route.selectedEventTypes[0]===v.eventType&&v.peer?.tenantRef===v.route.remoteTenant&&v.peer?.serviceRef===v.route.remoteService:v.route===null);var authorizationUrl=z62.url().max(8192).refine(value=>{try{const u=new URL(value);return!u.username&&!u.password&&!u.hash&&(u.protocol==="https:"||u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname))&&u.pathname==="/eventsdk/connect/authorize"}catch{return false}});var EventLinkStartSchema=EventLinkViewSchema.safeExtend({authorizationUrl:authorizationUrl.nullable(),continuationUrl:z62.url().max(2048)}).refine(v=>{const human=new URL(v.continuationUrl);if(human.username||human.password||human.hash||human.pathname!=="/settings/events"||human.protocol!=="https:"&&!(human.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(human.hostname))||human.searchParams.size!==3||!EventLinkContinuationScopeSchema.safeParse(Object.fromEntries(human.searchParams)).success||human.searchParams.get("workspace")!==v.tenantId||human.searchParams.get("eventLink")!==v.requestId||human.searchParams.get("productionId")!==v.productionId)return false;if(v.phase!=="LOGIN")return v.authorizationUrl===null;if(!v.authorizationUrl)return false;const p=new URL(v.authorizationUrl).searchParams;return p.get("request_id")===v.requestId&&p.get("profile")==="event-link/1"&&p.get("state")?.startsWith((v.requestId+v.productionId).replaceAll("-",""))===true&&EventLinkStateLocatorSchema.safeParse(p.get("state")).success});var EventLinkConfirmedSchema=EventLinkViewSchema.refine(v=>v.phase==="CONFIRMED");var EventLinkCancelledSchema=EventLinkViewSchema.refine(v=>v.phase==="CANCELLED");import{z as z63}from"zod";var ref=z63.uuid().toLowerCase();var proof=z63.string().regex(/^[A-Za-z0-9_-]{43}$/);var EventReceiverLocatorSchema=z63.strictObject({ref,proof});var EventReceiverAccessSchema=EventReceiverLocatorSchema.extend({tenantId:EventLinkScopeSchema.shape.tenantId});var EventReceiverBeginInputSchema=z63.strictObject({authorization:z63.string().min(1).max(8192),resume:EventReceiverLocatorSchema.optional()});var EventReceiverBeginSchema=EventReceiverLocatorSchema.extend({expiresAt:z63.iso.datetime()});var EventReceiverPrepareSchema=EventReceiverAccessSchema.extend({productionId:EventLinkScopeSchema.shape.productionId,sourceSelection:FederationSourceSelectionSchema,expiresAt:z63.iso.datetime().transform(v=>new Date(v).toISOString())});var EventReceiverDecideSchema=EventReceiverAccessSchema.extend({consentBinding:z63.string().regex(/^[a-f0-9]{64}$/).optional(),decision:z63.enum(["allow","deny"])}).refine(v=>v.decision==="deny"||v.consentBinding!==void 0);var EventReceiverChoiceSchema=EventLinkScopeSchema.extend({sourceSelection:FederationSourceSelectionSchema,expiresAt:z63.iso.datetime()});var EventReceiverViewSchema=z63.strictObject({ref,state:z63.enum(["PENDING","APPROVED","CONSUMED","DENIED","EXPIRED"]),expiresAt:z63.iso.datetime(),source:z63.strictObject({displayName:z63.string().min(1).max(160),serviceRef:FederationPeerRefSchema,tenantRef:FederationPeerRefSchema,installationSource:z63.string().min(1).max(2048)}),eventType:z63.literal(RESOURCE_CHANGE_TYPE),effect:z63.literal("REFRESH_HINT"),choice:EventReceiverChoiceSchema.nullable()});var EventReceiverInspectionSchema=z63.strictObject({view:EventReceiverViewSchema,callback:z63.strictObject({redirectUri:z63.url().max(2048),state:z63.string().max(8192),issuer:z63.url()})});var EventReceiverReviewSchema=z63.strictObject({view:EventReceiverViewSchema,consentBinding:z63.string().regex(/^[a-f0-9]{64}$/)});var EventReceiverDecisionSchema=z63.strictObject({ref,redirectUri:z63.url().max(16384)});var EventReceiverPortalSchema=EventLinkScopeSchema.extend({role:z63.literal("RECEIVER"),protocol:z63.literal("event-link/1"),sdkVersion:z63.literal("0.4.0"),configuration:z63.enum(["CONFIGURED","UNCONFIGURED"]),authorizationEndpoint:z63.url().nullable(),tokenEndpoint:z63.url().nullable(),eventType:z63.literal(RESOURCE_CHANGE_TYPE),dataSchema:z63.literal(RESOURCE_CHANGE_SCHEMA),effect:z63.literal("REFRESH_HINT"),defaultReceive:z63.literal(false)});var intent=z64.strictObject({productionId:z64.uuid(),idempotencyKey:z64.string().trim().min(1).max(200),deviceId:z64.uuid().optional(),validationMode:DeviceRenderTargetSchema.shape.validationMode});var DeviceDiscoveryInputSchema=ProjectDeviceListInputSchema.omit({tenantId:true});var DeviceRenderIntentSchema=z64.discriminatedUnion("kind",[intent.extend({kind:z64.literal("preview"),profileId:RoughCutProfileIdSchema.optional()}),intent.extend({kind:z64.literal("final")})]);var DeviceRenderReadSchema=z64.strictObject({kind:z64.enum(["preview","final"]),productionId:z64.uuid(),renderId:z64.uuid()});var basisInput=DeviceRenderReadSchema.pick({kind:true,productionId:true});var DeviceRenderDownloadSchema=DeviceRenderReadSchema.extend({role:z64.enum(["VIDEO","POSTER"])});var PreparedDeviceRenderSchema=z64.discriminatedUnion("kind",[z64.strictObject({kind:z64.literal("preview"),command:RoughCutStartSchema.extend({deviceExecution:DeviceRenderTargetSchema})}),z64.strictObject({kind:z64.literal("final"),command:FinalRenderStartSchema.extend({deviceExecution:DeviceRenderTargetSchema})})]);var DeviceRenderReceiptHandoffSchema=z64.strictObject({protocol:z64.literal("NVS_RENDER_RECEIPT_V1"),scope:z64.strictObject({resource:z64.string().min(1).max(2048),tenantId:z64.uuid(),projectId:z64.uuid(),principalId:z64.uuid(),grantId:z64.uuid()}),prepared:PreparedDeviceRenderSchema});var DeviceRenderAdmissionSchema=z64.union([RoughCutAdmissionSchema.extend({deviceExecution:DeviceRenderReceiptSchema}),FinalRenderAdmissionSchema.extend({deviceExecution:DeviceRenderReceiptSchema})]);var NativeStudioDeviceRenders=class{constructor(caller){this.caller=caller}caller;list(raw,options){const input=DeviceDiscoveryInputSchema.parse(raw);return this.caller.call("devices.list",{...input,tenantId:this.caller.tenantId},options)}async basis(raw,options){const{kind,productionId}=basisInput.parse(raw);const scope7={tenantId:this.caller.tenantId,productionId};if(kind==="final"){const e=await this.caller.call("final-render.eligibility",scope7,options);const selection2=e.finalReady.selection;const basis2=e.renderable&&e.profile&&selection2?{selectionId:selection2.id,expectedFinalReadyVersion:e.finalReady.version,timelineVersionId:selection2.timelineVersionId,timelineFingerprint:selection2.timelineFingerprint,expectedProductionRevision:e.productionRevision,profileId:e.profile.id,audioPolicy:e.profile.audioPolicy,captionPolicy:e.profile.captionPolicy}:null;return{kind,basis:basis2,blockers:basis2?[]:e.blockers.length?e.blockers:["FINAL_READY_NOT_CURRENT"],sourceBlockers:e.sourceBlockers}}const basis=await this.caller.call("timeline.basis",scope7,options);if(!basis.runnable||basis.currentTimelineVersion===0)return{kind,basis:null,blockers:["TIMELINE_NOT_RUNNABLE"]};const current=await this.caller.call("timeline.current",scope7,options);const selection=currentPreviewRenderBasis(basis,current);return{kind,basis:selection,blockers:selection?[]:["TIMELINE_NOT_CURRENT"]}}async prepare(raw,options){const input=DeviceRenderIntentSchema.parse(raw);const scope7={tenantId:this.caller.tenantId,productionId:input.productionId};const base={...scope7,idempotencyKey:input.idempotencyKey,deviceExecution:{mode:"tenant-device-only",...input.deviceId?{deviceId:input.deviceId}:{},...input.validationMode?{validationMode:input.validationMode}:{}}};const{basis}=await this.basis({kind:input.kind,productionId:input.productionId},options);if(!basis)throw new NativeStudioSdkError("STALE_BASIS","STALE_BASIS","NO_WRITE");return PreparedDeviceRenderSchema.parse({kind:input.kind,command:{...base,...basis,...input.kind==="preview"&&{profileId:input.profileId??"PREVIEW_H264_480P_V1"}}})}get(raw,options){const{kind,...input}=DeviceRenderReadSchema.parse(raw);return kind==="preview"?this.caller.call("rough-cut.get",input,options):this.caller.call("final-render.get",input,options)}async mediaTicket(raw,options){const{kind,...input}=DeviceRenderDownloadSchema.parse(raw);const result=kind==="preview"?await this.caller.call("rough-cut.media-ticket",input,options):await this.caller.call("final-render.media-ticket",input,options);if(result.ticket.object.tenantId!==this.caller.tenantId||result.ticket.method!=="GET"||result.ticket.object.role!==input.role)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return result}async download(raw,options,expectedProjectId){const input=DeviceRenderDownloadSchema.parse(raw);const{role,...scope7}=input;const view=await this.get(scope7,options);const accepted="roughCut"in view?view.roughCut:view.finalOutput;const expected=role==="POSTER"?accepted?.poster:accepted;const failure=()=>new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");if(!expected||expectedProjectId&&expectedProjectId!==view.projectId)throw failure();const media=await this.mediaTicket(input,options);if(media.ticket.object.projectId!==view.projectId||media.representationId!==expected.representationId||media.ticket.object.checksumSha256!==expected.checksumSha256||media.ticket.object.byteSize!==expected.byteSize)throw failure();const output=await downloadRenderObject(media.ticket,options);return{...output,representationId:media.representationId,renderId:media.renderId}}receipt(raw,options){const prepared=PreparedDeviceRenderSchema.parse(raw);return prepared.kind==="preview"?this.caller.call("rough-cut.admission-receipt",prepared.command,options):this.caller.call("final-render.admission-receipt",prepared.command,options)}start(raw,options){const prepared=PreparedDeviceRenderSchema.parse(raw);return prepared.kind==="preview"?this.caller.call("rough-cut.start",prepared.command,options):this.caller.call("final-render.start",prepared.command,options)}};var NativeStudioNavigationFacade=class{constructor(caller){this.caller=caller}caller;find(input,options){return this.caller.call("studio.start",input,options)}overview(input,options){return this.caller.call("studio.navigate",input,options)}next(input,options){return this.overview(input,options)}resume(input,options){return this.caller.call("operation.get",input,options)}groups(input={},options){return this.caller.call("studio.capability.groups",input,options)}search(input,options){return this.caller.call("studio.capability.search",input,options)}describe(input,options){return this.caller.call("studio.capability.describe",input,options)}query(input,options){return this.caller.call("studio.capability.query",input,options)}invoke(input,options){return this.caller.call("studio.capability.invoke",input,options)}};import"zod";var post=(action,input,output,readOnly,identity4=[])=>operation(input,output,i=>({method:"POST",tenantId:i.tenantId,path:path("shares",action),body:i}),identity4,{readOnly});var target=["shareId","projectId","artifactId","representationId"].map(k=>[k,"share."+k]);var shareOperations={"share.create":post("create",ShareCreateSchema,ShareLinkResultSchema,false,target),"share.link":post("link",ShareGetSchema,ShareLinkResultSchema,false,[["shareId","share.shareId"]]),"share.get":post("get",ShareGetSchema,ShareViewSchema.nullable(),true,[["shareId","shareId"]]),"share.list":post("list",ShareListSchema,SharePageSchema,true,[["artifactId","items.*.artifactId"]]),"share.revoke":post("revoke",ShareRevokeSchema,ShareViewSchema,false,[["shareId","shareId"]]),"share.receipt":post("receipt",ShareCreateSchema,ShareViewSchema.nullable(),true,[...["shareId","projectId","artifactId","representationId"].map(k=>[k,k])])};import{z as z66}from"zod";function inputIssues(error,schema){const fields=new Set;const collect=node=>{if(node instanceof z66.ZodObject)Object.keys(node.shape).forEach(key6=>fields.add(key6));else if(node instanceof z66.ZodUnion)node.options.forEach(branch2=>collect(branch2))};collect(schema);const result=new Map;for(const issue of error.issues){const first=issue.path[0];const field=typeof first==="string"&&first.length<=120&&fields.has(first)?first:"$";const safe={field,code:issue.code};result.set(`${field}:${safe.code}`,safe);if(result.size>=8)break}return[...result.values()]}import{z as z67}from"zod";var success=z67.strictObject({semanticStatus:z67.literal("SUCCESS")});var deviceManagementOperations={"device.status":operation(DeviceStatusInputSchema,DeviceStatusSchema,({tenantId,deviceId})=>({method:"GET",path:path("local-execution","devices",deviceId,"status"),tenantId}),[["tenantId","tenantId"],["deviceId","deviceId"]]),"device.enrollment.issue":operation(DeviceEnrollmentIssueSchema,DeviceEnrollmentObservationSchema,body=>({method:"POST",path:path("local-execution","devices","enrollments"),tenantId:body.tenantId,body}),[["tenantId","tenantId"],["requestId","requestId"]]),"device.enrollment.lookup":operation(DeviceEnrollmentLookupSchema,DeviceEnrollmentObservationSchema,({tenantId,requestId})=>({method:"GET",path:path("local-execution","devices","enrollments",requestId),tenantId}),[["tenantId","tenantId"],["requestId","requestId"]]),"workspace.devices.list":operation(WorkspaceDeviceListInputSchema,WorkspaceDeviceListSchema,({tenantId,deviceId,after,limit})=>({method:"GET",tenantId,path:path("local-execution","devices"),query:{deviceId,after,limit}}),[["deviceId","items.*.deviceId"]],{readOnly:true}),"device.enroll":operation(EnrollLocalDeviceSchema,LocalDeviceViewSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("local-execution","devices","enroll"),body:i}),[["tenantId","tenantId"],["publicKey","publicKey"],["label","label"],["platform","platform"],["runtimeVersion","runtimeVersion"]]),"device.revoke":operation(RevokeLocalDeviceSchema,success,i=>({method:"POST",tenantId:i.tenantId,path:path("local-execution","devices","revoke"),body:i})),"device.management-receipt":operation(ScopedLocalManagementReceiptSchema,LocalManagementReceiptSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("local-execution","management-receipt"),body:i.command}),[],{readOnly:true})};import{createHash as createHash2}from"node:crypto";var identityFailure=()=>new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN");function checkTicket({endpoint,method,object},expected){const url=new URL(endpoint);if(method!=="PUT"||object.role!=="SOURCE"||object.tenantId!==expected.tenantId||object.projectId!==expected.projectId||object.byteSize!==expected.byteSize||object.checksumSha256!==expected.checksumSha256||url.pathname!==mediaObjectTransferPath||url.username||url.password||url.search||url.hash||url.protocol!=="https:"&&!(url.protocol==="http:"&&url.hostname==="127.0.0.1"))throw identityFailure();return url}async function upload(ticket,url,bytes,options){const timeout=AbortSignal.timeout(12e4);const signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;try{const result=await fetch(url,{method:"PUT",redirect:"error",headers:{authorization:"Bearer "+ticket.credential},body:new Uint8Array(bytes),signal});await result.body?.cancel();if(result.status===204)return}catch{}throw new NativeStudioSdkError("OBJECT_UPLOAD_UNCONFIRMED","BLOCKED","UNKNOWN")}var NativeStudioDirectSources=class{constructor(tenantId,transport){this.tenantId=tenantId;this.transport=transport}tenantId;transport;async importProjectSource(intent2,input,options={}){if(!(input instanceof Uint8Array)||input.length<1||input.length>8*1024*1024)sdkInputError();const bytes=Buffer.from(input);const result=DirectProjectSourceCommandSchema.safeParse({...intent2,metadata:{...intent2.metadata,tenantId:this.tenantId},byteSize:bytes.length,checksumSha256:createHash2("sha256").update(bytes).digest("hex")});if(!result.success)sdkInputError();const{projectId,...body}=result.data;const scope7={tenantId:this.tenantId,projectId};const endpoint=action=>path("projects",projectId,"source-artifacts","direct",action);const validate=receipt2=>{if(receipt2.state==="ACCEPTED"){const{artifact:artifact2,primaryRepresentation}=receipt2.registration;if(artifact2.tenantId!==scope7.tenantId||artifact2.projectId!==projectId||artifact2.productionId!==null||artifact2.lifecycle!=="READY"||primaryRepresentation.artifactId!==artifact2.id||primaryRepresentation.tenantId!==scope7.tenantId||primaryRepresentation.checksumSha256!==body.checksumSha256||primaryRepresentation.byteSize!==String(body.byteSize))throw identityFailure()}else if(receipt2.tenantId!==scope7.tenantId||receipt2.projectId!==projectId)throw identityFailure();return receipt2};const stage=await this.transport.json({method:"POST",tenantId:scope7.tenantId,path:endpoint("stage"),body},DirectProjectSourceStageSchema,options);if(stage.state!=="UPLOAD")return validate(stage);if(stage.tenantId!==scope7.tenantId||stage.projectId!==projectId)throw identityFailure();const url=checkTicket(stage.ticket,{...scope7,...body});if(!stage.uploaded)await upload(stage.ticket,url,bytes,options);const receipt=await this.transport.json({method:"POST",tenantId:scope7.tenantId,path:endpoint("submit"),body:{tenantId:scope7.tenantId,intakeId:stage.intakeId}},DirectProjectSourceSubmitSchema,options);if(receipt.state==="SUBMITTED"&&receipt.intakeId!==stage.intakeId)throw identityFailure();return validate(receipt)}async importOriginal(raw,input,options={}){const parsed=DirectOriginalCommandSchema.safeParse(raw);if(!parsed.success)sdkInputError();const command3=parsed.data;const{tenantId,projectId,productionId,shotId,source:source3}=command3.input;if(tenantId!==this.tenantId||!(input instanceof Uint8Array)||input.length!==source3.byteSize)sdkInputError();const bytes=Buffer.from(input);if(createHash2("sha256").update(bytes).digest("hex")!==source3.checksumSha256)sdkInputError();const scope7={tenantId,projectId,productionId};const endpoint=action=>path("productions",productionId,"imported-visuals","originals","direct",action);const validate=receipt2=>{const value=receipt2.state==="ACCEPTED"?receipt2.original:receipt2;if(value.tenantId!==tenantId||value.projectId!==projectId||value.productionId!==productionId)throw identityFailure();if(receipt2.state==="ACCEPTED"){const{original}=receipt2;if(original.shotId!==shotId||original.metadata.checksumSha256!==source3.checksumSha256||original.metadata.byteSize!==source3.byteSize||command3.operation==="REVISE"&&(original.sourceId!==command3.input.sourceId||original.version!==command3.input.expectedVersion+1))throw identityFailure()}return receipt2};const stage=await this.transport.json({method:"POST",tenantId,path:endpoint("stage"),body:command3},DirectOriginalStageSchema,options);if(stage.state!=="UPLOAD")return validate(stage);if(stage.tenantId!==tenantId||stage.projectId!==projectId||stage.productionId!==productionId)throw identityFailure();const url=checkTicket(stage.ticket,{...scope7,...source3});if(!stage.uploaded)await upload(stage.ticket,url,bytes,options);const receipt=await this.transport.json({method:"POST",tenantId,path:endpoint("submit"),body:{...scope7,intakeId:stage.intakeId}},DirectOriginalSubmitSchema,options);if(receipt.state==="SUBMITTED"&&receipt.intakeId!==stage.intakeId)throw identityFailure();return validate(receipt)}};import{createHash as createHash8}from"node:crypto";import{createHash as createHash3}from"node:crypto";function assertExportBytes(value,captionFormat){const v=value;const bytes=v.contentBase64!==void 0?Buffer.from(v.contentBase64,"base64"):Buffer.from(v.text,"utf8");if(v.contentBase64!==void 0&&(bytes.toString("base64")!==v.contentBase64||bytes.length!==v.byteSize||bytes.toString("ascii",0,4)!=="RIFF"||bytes.toString("ascii",8,12)!=="WAVE")||bytes.length>(v.contentBase64!==void 0?12582912:131072)||captionFormat!==void 0&&v.contentType!==(captionFormat==="JSON"?"application/json":"application/x-subrip")||createHash3("sha256").update(bytes).digest("hex")!==v.checksumSha256)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}import{createHash as createHash4}from"node:crypto";function assertPreviewBytes(value){const v=value;if(v.semanticStatus!=="SUCCESS")return;const data=v.contentBase64;if(typeof data!=="string"||data.length>4*Math.ceil(8*1024*1024/3))throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");const bytes=Buffer.from(data,"base64");if(bytes.length!==v.byteSize||bytes.toString("base64")!==data||!bytes.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10]))||createHash4("sha256").update(bytes).digest("hex")!==v.checksumSha256)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}import{createHash as createHash5}from"node:crypto";function assertOriginalVideoBytes(value){const v=value;const bytes=Buffer.from(v.dataBase64,"base64");if(bytes.toString("base64")!==v.dataBase64||bytes.length!==v.source.byteSize||bytes.subarray(4,8).toString("ascii")!=="ftyp"||createHash5("sha256").update(bytes).digest("hex")!==v.source.checksumSha256)throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}import{z as z68}from"zod";var production2=z68.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var sourceUpload=UploadSourceInputRequestSchema.extend({projectId:ProjectIdSchema,idempotencyKey:z68.string().trim().min(1).max(200)});var projectProduction=(p,prod,suffix)=>path("projects",p,"productions",prod,suffix);var coreOperations={"workspace.status":operation(WorkspaceScopeSchema,WorkspaceStatusSchema,({tenantId})=>({method:"GET",path:path("workspace","status"),tenantId}),[["tenantId","tenantId"]]),"workspace.get":operation(WorkspaceScopeSchema,WorkspaceViewSchema,i=>({method:"GET",path:path("workspace"),tenantId:i.tenantId})),"workspace.caller":operation(WorkspaceScopeSchema,WorkspaceCallerSchema,i=>({method:"GET",path:path("workspace","caller"),tenantId:i.tenantId}),[["tenantId","tenantId"]]),"workspace.query":operation(WorkspaceScopeSchema,WorkspacePageSchema,i=>({method:"GET",path:path("workspaces"),tenantId:i.tenantId})),"visual-sequence.start-registration":operation(RegisterVisualSequenceSchema,VisualSequenceRegistrationAdmissionSchema,i=>{const{tenantId,projectId,...body}=i;return{method:"POST",path:path("projects",projectId,"visual-sequences","jobs"),tenantId,body}}),"visual-sequence.register":operation(LegacyVisualSequenceRegistrationSchema,VisualSequenceViewSchema,i=>{const{tenantId,projectId,...body}=i;return{method:"POST",path:path("projects",projectId,"visual-sequences"),tenantId,body}},[["projectId","sequence.projectId"]]),"visual-sequence.get":operation(VisualSequenceGetSchema,VisualSequenceViewSchema,i=>({method:"GET",path:path("projects",i.projectId,"visual-sequences",i.artifactId),tenantId:i.tenantId}),[["artifactId","sequence.artifactId"]]),"visual-sequence.query":operation(VisualSequenceQuerySchema,VisualSequencePageSchema,i=>({method:"GET",path:path("projects",i.projectId,"visual-sequences"),tenantId:i.tenantId,query:pageQuery(i)})),"project.create":operation(CreateProjectRequestSchema,CreatedProjectResultSchema,input=>({method:"POST",path:path("projects"),tenantId:input.tenantId,body:input})),"production.create":operation(CreateProductionRequestSchema,CreatedProductionResultSchema,input=>({method:"POST",path:path("projects",input.projectId,"productions"),tenantId:input.tenantId,body:{idempotencyKey:input.idempotencyKey}}),[["projectId","project.id"]]),"production.terminate":operation(TerminateProductionSchema,ProductionTerminationReceiptSchema,input=>({method:"POST",path:path("projects",input.projectId,"productions",input.productionId,"terminate"),tenantId:input.tenantId,body:{outcome:input.outcome,expectedProductionRevision:input.expectedProductionRevision,reason:input.reason,idempotencyKey:input.idempotencyKey}}),[["productionId","productionId"],["projectId","projectId"]]),"project.query":operation(ProjectLibraryQuerySchema,ProjectLibraryPageSchema,input=>({method:"GET",path:path("projects"),tenantId:input.tenantId,query:pageQuery(input)})),"project.get":operation(ProjectLibraryScopeSchema,ProjectWorkspaceSchema,input=>({method:"GET",path:path("projects",input.projectId),tenantId:input.tenantId}),[["projectId","project.id"]]),"devices.list":operation(ProjectDeviceListInputSchema,ProjectDeviceListSchema,({tenantId,projectId,kind,deviceId})=>({method:"GET",path:path("local-execution","projects",projectId,"devices"),tenantId,query:{kind,deviceId}}),[["projectId","projectId"],["kind","kind"],["deviceId","items.*.deviceId"]],{readOnly:true}),"source.query":operation(SourceLibraryQuerySchema,SourceLibraryPageSchema,input=>({method:"GET",path:input.projectId?path("projects",input.projectId,"source-artifacts"):path("source-artifacts"),tenantId:input.tenantId,query:pageQuery(input)})),"source.ingest":operation(sourceUpload,ReadyArtifactRegistrationSchema,input=>{const{projectId,...body}=input;return{method:"POST",path:path("projects",projectId,"source-artifacts"),tenantId:input.tenantId,body}}),"source.text":operation(SourceReadSchema,SourceTextWindowSchema,input=>({method:"GET",path:path("projects",input.projectId,"source-artifacts",input.artifactId,"text"),tenantId:input.tenantId,query:{offsetBytes:input.offsetBytes,maxTextBytes:input.maxTextBytes}}),[["artifactId","artifactId"]]),"production.query":operation(ProductionQueryInputSchema.strict(),ProductionQueryPageSchema,input=>({method:"GET",path:path("productions"),tenantId:input.tenantId,query:{...pageQuery(input),projectId:input.projectId,search:input.search,attention:input.attention}})),"production.snapshot":operation(production2,ProductionSnapshotSchema,input=>({method:"GET",path:path("productions",input.productionId,"snapshot"),tenantId:input.tenantId})),"brief.accept":operation(ScopedAcceptBriefSchema,AcceptBriefResultSchema,input=>{const{projectId,productionId,...body}=input;return{method:"POST",path:projectProduction(projectId,productionId,"brief-versions"),tenantId:input.tenantId,body}}),"story.accept":operation(ScopedAcceptStorySchema,AcceptStoryResultSchema,input=>{const{projectId,productionId,...body}=input;return{method:"POST",path:projectProduction(projectId,productionId,"story-versions"),tenantId:input.tenantId,body}}),"scene-shot-plan.accept":operation(ScopedAcceptSceneShotPlanSchema,AcceptSceneShotPlanResultSchema,input=>{const{projectId,productionId,...body}=input;return{method:"POST",path:projectProduction(projectId,productionId,"scene-shot-plan-versions"),tenantId:input.tenantId,body}}),"story.query":operation(StoryQueryInputSchema.strict(),StoryQueryPageSchema,input=>({method:"GET",path:path("productions",input.productionId,"stories"),tenantId:input.tenantId,query:pageQuery(input)})),"story.active":operation(production2,StoryVersionSchema,input=>({method:"GET",path:path("productions",input.productionId,"stories","active"),tenantId:input.tenantId})),"scene-shot-plan.query":operation(SceneShotPlanQueryInputSchema.strict(),SceneShotPlanQueryPageSchema,input=>({method:"GET",path:path("productions",input.productionId,"scene-shot-plans"),tenantId:input.tenantId,query:pageQuery(input)})),"scene-shot-plan.active":operation(production2,SceneShotPlanVersionSchema,input=>({method:"GET",path:path("productions",input.productionId,"scene-shot-plans","active"),tenantId:input.tenantId})),"operation.query":operation(OperationQueryInputSchema.strict(),OperationQueryPageSchema,input=>({method:"GET",path:path("productions",input.productionId,"operations"),tenantId:input.tenantId,query:pageQuery(input)})),"operation.get":operation(production2.extend({operationId:OperationIdSchema}),OperationSummarySchema,input=>({method:"GET",path:path("productions",input.productionId,"operations",input.operationId),tenantId:input.tenantId}),[["operationId","id"]])};var reference2=["tenantId","projectId","deviceId","fileId","versionId","checksumSha256","byteSize","contentType"];var deviceLibraryOperations={"device-library.query":operation(LocalLibraryProjectionQuerySchema,LocalLibraryProjectionPageSchema,({tenantId,projectId,deviceId,after,limit,search,mediaCategory})=>({method:"GET",tenantId,path:path("local-execution","projects",projectId,"devices",deviceId,"library"),query:{after:after??void 0,limit,search,mediaCategory}}),[["tenantId","items.*.reference.tenantId"],["projectId","items.*.reference.projectId"],["deviceId","items.*.reference.deviceId"]],{readOnly:true}),"device-library.admit":operation(LocalLibraryCommandSchema,LocalLibraryAdmissionSchema,({tenantId,productionId,...body})=>({method:"POST",tenantId,path:path("productions",productionId,"device-library","commands"),body:{tenantId,productionId,...body}}),[["tenantId","tenantId"],["projectId","projectId"],["productionId","productionId"],["requestId","requestId"],["accessRevision","accessRevision"],...reference2.map(field=>[`reference.${field}`,`reference.${field}`])]),"device-library.receipt":operation(LocalLibraryCommandQuerySchema,LocalLibraryCommandStatusSchema.nullable(),({tenantId,projectId,productionId,requestId})=>({method:"GET",tenantId,path:path("productions",productionId,"device-library","commands",requestId),query:{projectId}}),[["tenantId","admission.tenantId"],["projectId","admission.projectId"],["productionId","admission.productionId"],["requestId","admission.requestId"],["tenantId","admission.reference.tenantId"],["projectId","admission.reference.projectId"]],{readOnly:true})};var navigationOperations={"studio.media.readiness":mcpOperation(RenderReadinessInputSchema,RenderReadinessSchema,true,[["tenantId","tenantId"],["projectId","projectId"],["productionId","productionId"],["kind","kind"],["deviceId","deviceId"]]),"studio.capability.query":mcpOperation(CapabilityInvocationInputSchema,CapabilityInvocationOutputSchema,true,[["tool","tool"]]),"studio.capability.invoke":mcpOperation(CapabilityInvocationInputSchema,CapabilityInvocationOutputSchema,false,[["tool","tool"]]),"studio.capability.groups":mcpOperation(CapabilityGroupsInputSchema,CapabilityGroupsSchema,true),"studio.start":mcpOperation(StudioStartInputSchema,StudioStartSchema,true),"studio.capability.search":mcpOperation(CapabilitySearchInputSchema,CapabilitySearchSchema,true),"studio.capability.describe":mcpOperation(CapabilityDescribeInputSchema,CapabilityDescribeSchema,true),"studio.navigate":mcpOperation(StudioNavigateInputSchema,StudioNavigationSchema,true,[["productionId","productionId"],["projectId","projectId"]])};import{createHash as createHash6}from"node:crypto";var verifiedHostContract=AgentHostContractSchema.refine(v=>v.digest==="sha256:"+createHash6("sha256").update(canonicalHostContractJson(v.document)).digest("hex"));function write(input,suffix){return operation(input,AgentHostBindingSchema,value=>({method:"POST",tenantId:value.tenantId,path:path("projects",value.projectId,"agent-host",...suffix),body:Object.fromEntries(Object.entries(value).filter(([key6])=>!["tenantId","projectId"].includes(key6)))}),[["bindingId","bindingId"]])}var agentHostOperations={"agent-host.contract":operation(AgentHostContractInputSchema,verifiedHostContract,value=>({method:"GET",tenantId:value.tenantId,path:path("projects",value.projectId,"agent-host","contract"),query:{expectedDigest:value.expectedDigest}}),[["expectedDigest","digest"]],{readOnly:true}),"agent-host.get":operation(AgentHostScopeSchema,AgentHostCurrentSchema,value=>({method:"GET",tenantId:value.tenantId,path:path("projects",value.projectId,"agent-host")})),"agent-host.readiness":operation(AgentHostScopeSchema,AgentHostReadinessSchema,value=>({method:"GET",tenantId:value.tenantId,path:path("projects",value.projectId,"agent-host","readiness")})),"agent-host.history":operation(AgentHostHistoryQuerySchema,AgentHostHistoryPageSchema,value=>({method:"GET",tenantId:value.tenantId,path:path("projects",value.projectId,"agent-host","history"),query:{limit:value.limit,beforeVersion:value.beforeVersion}})),"agent-host.configure":write(ConfigureAgentHostSchema,[]),"agent-host.selection.update":write(UpdateAgentHostSelectionSchema,["selection"]),"agent-host.revoke":write(RevokeAgentHostSchema,["revoke"])};var route=(scope7,...suffix)=>path("projects",scope7.projectId,"productions",scope7.productionId,"agent-host-executions",...suffix);var mutation2=action=>operation(AgentHostExecutionGetSchema,AgentHostExecutionViewSchema,value=>({method:"POST",tenantId:value.tenantId,path:route(value,value.executionId,action),body:{}}),[["executionId","executionId"]]);var agentHostExecutionOperations={"agent-host-execution.legacy-release.get":operation(AgentHostExecutionGetSchema,LegacyHostExecutionReleaseSchema,value=>({method:"GET",tenantId:value.tenantId,path:route(value,value.executionId,"legacy-release")}),[["executionId","executionId"]]),"agent-host-execution.legacy-release":operation(ReleaseLegacyHostExecutionSchema,LegacyHostExecutionReleaseSchema,value=>({method:"POST",tenantId:value.tenantId,path:route(value,value.executionId,"legacy-release"),body:Object.fromEntries(Object.entries(value).filter(([key6])=>!["tenantId","projectId","productionId","executionId"].includes(key6)))}),[["executionId","executionId"],["requestId","requestId"],["hostRequestId","hostRequestId"],["expectedRevision","expectedRevision"],["snapshotFingerprint","snapshotFingerprint"],["evidenceRef","evidenceRef"],["evidenceSha256","evidenceSha256"]]),"agent-host-execution.start":operation(StartAgentHostExecutionSchema,AgentHostExecutionViewSchema,value=>({method:"POST",tenantId:value.tenantId,path:route(value),body:Object.fromEntries(Object.entries(value).filter(([key6])=>!["tenantId","projectId","productionId"].includes(key6)))}),[["requestId","requestId"],["bindingId","snapshot.binding.bindingId"],["studioInputArtifactId","snapshot.input.intake.artifactId"],["expectedProductionRevision","snapshot.input.productionRevision"],["expectedBindingRevision","snapshot.binding.revision"],["expectedConfigurationVersion","snapshot.binding.configurationVersion"]]),"agent-host-execution.get":operation(AgentHostExecutionGetSchema,AgentHostExecutionViewSchema,value=>({method:"GET",tenantId:value.tenantId,path:route(value,value.executionId)}),[["executionId","executionId"]]),"agent-host-execution.query":operation(AgentHostExecutionQuerySchema,AgentHostExecutionPageSchema,value=>({method:"GET",tenantId:value.tenantId,path:route(value),query:{limit:value.limit,beforeId:value.beforeId}})),"agent-host-execution.events":operation(AgentHostExecutionEventQuerySchema,AgentHostExecutionEventPageSchema,value=>({method:"GET",tenantId:value.tenantId,path:route(value,value.executionId,"events"),query:{limit:value.limit,beforeRevision:value.beforeRevision}}),[["executionId","items.*.executionId"]]),"agent-host-execution.dispatch":mutation2("dispatch"),"agent-host-execution.reconcile":mutation2("reconcile"),"agent-host-execution.cancel":mutation2("cancel")};var route2=(v,...suffix)=>path("projects",v.projectId,"native-tool-grants",...suffix);var nativeToolAuthorityOperations={"native-tool-grant.configure":operation(ConfigureNativeToolGrantSchema,NativeToolGrantViewSchema,v=>({method:"POST",tenantId:v.tenantId,path:route2(v),body:Object.fromEntries(Object.entries(v).filter(([k])=>!["tenantId","projectId"].includes(k)))}),[["bindingId","bindingId"],["expectedBindingRevision","bindingRevision"],["expectedConfigurationVersion","configurationVersion"],["runtimeKey","runtimeKey"],["installationId","installationId"],["installationRevisionId","installationRevisionId"],["publicKey.x","publicKey.x"],["publicKey.y","publicKey.y"]]),"native-tool-grant.get":operation(NativeToolGrantGetSchema,NativeToolGrantViewSchema,v=>({method:"GET",tenantId:v.tenantId,path:route2(v,v.grantId)}),[["grantId","grantId"]]),"native-tool-grant.revoke":operation(RevokeNativeToolGrantSchema,NativeToolGrantViewSchema,v=>({method:"POST",tenantId:v.tenantId,path:route2(v,v.grantId,"revoke"),body:{requestId:v.requestId,expectedRevision:v.expectedRevision}}),[["grantId","grantId"]])};function productionRead(input,output,suffix,query=()=>({}),identity4=[]){return operation(input,output,value=>({method:"GET",tenantId:value.tenantId,path:path("productions",value.productionId,...suffix(value)),query:query(value)}),identity4)}function productionWrite(input,output,suffix,options={}){return operation(input,output,value=>({method:"POST",tenantId:value.tenantId,path:path("productions",value.productionId,...suffix(value)),body:Object.fromEntries(Object.entries(value).filter(([key6])=>key6!=="productionId"&&(options.tenantInBody||key6!=="tenantId")&&!options.pathFields?.includes(key6)))}),options.identity,options.readOnly===void 0?{}:{readOnly:options.readOnly})}var compositionOperations={"composition.render.query":productionRead(CompositionRenderQuerySchema,CompositionRenderPageSchema,()=>["compositions","renders"],i=>({limit:i.limit,next:i.next,shotId:i.shotId,role:i.role}),[["shotId","items.*.render.sourceIdentity.shotId"],["role","items.*.render.sourceIdentity.role"]]),"composition.capabilities":productionRead(CompositionScopeSchema,CompositionCapabilitiesSchema,()=>["compositions","capabilities"]),"composition.brief":productionRead(CompositionBriefQuerySchema,CompositionAuthoringBriefSchema,()=>["compositions","brief"],i=>({...i.shotId?{shotId:i.shotId}:{}})),"composition.put-input":productionWrite(PutCompositionInputSchema,CompositionInputReceiptSchema,()=>["compositions","inputs"]),"composition.making.validate":productionWrite(ValidateCompositionMakingSchema,CompositionMakingValidationSchema,()=>["compositions","making","validate"],{readOnly:true,identity:[["projectId","projectId"],["expectedProductionRevision","authoring.productionRevision"],["basis.briefVersionId","authoring.basis.briefVersionId"],["basis.storyVersionId","authoring.basis.storyVersionId"],["basis.planVersionId","authoring.basis.planVersionId"],["basis.shotId","authoring.basis.shotId"],["proposal.makingIntent","proposal.makingIntent"]]}),"composition.validate":productionWrite(ValidateCompositionSchema,CompositionValidationReceiptSchema,()=>["compositions","validate"],{readOnly:true}),"composition.create":productionWrite(CreateCompositionSchema,CompositionReceiptSchema,()=>["compositions"]),"composition.revise":productionWrite(ReviseCompositionSchema,CompositionReceiptSchema,()=>["compositions","revise"],{identity:[["compositionId","version.compositionId"]]}),"composition.get":productionRead(CompositionGetSchema,CompositionViewSchema,i=>["compositions",i.compositionId],i=>({versionId:i.versionId}),[["compositionId","version.compositionId"],["versionId","version.id"]]),"composition.history":productionRead(CompositionHistorySchema,CompositionPageSchema,i=>["compositions",i.compositionId,"versions"],i=>({limit:i.limit,beforeVersion:i.beforeVersion}),[["compositionId","items.*.version.compositionId"]]),"composition.render":productionWrite(CompositionRenderStartSchema,CompositionRenderReceiptSchema,()=>["compositions","renders"],{identity:[["versionId","compositionVersionId"]]}),"composition.render.get":productionRead(CompositionRenderGetSchema,CompositionRenderViewSchema,i=>["compositions","renders",i.renderId],void 0,[["renderId","receipt.renderId"]]),"composition.render.cancel":productionWrite(CompositionRenderGetSchema,CompositionRenderCancellationSchema,i=>["compositions","renders",i.renderId,"cancel"],{pathFields:["renderId"]}),"composition.sample":productionWrite(CompositionSampleStartSchema,CompositionSampleReceiptSchema,()=>["compositions","samples"],{identity:[["renderId","renderId"]]}),"composition.observe":productionRead(CompositionObserveGetSchema,CompositionObservationViewSchema,i=>["compositions","renders",i.renderId,"observations",i.evidenceId],void 0,[["renderId","renderId"],["evidenceId","evidence.evidenceId"]])};var cancellation=InterfaceCancellationReceiptSchema;var assemblyOperations={"timeline.basis":productionRead(TimelineScopeSchema,TimelineBasisSchema,()=>["timeline","basis"]),"timeline.build":productionWrite(BuildTimelineSchema,TimelineBuildReceiptSchema,()=>["timeline"]),"timeline.current":productionRead(TimelineScopeSchema,TimelineViewSchema,()=>["timeline","current"]),"timeline.get":productionRead(TimelineGetSchema,TimelineViewSchema,i=>["timeline","versions",i.versionId],void 0,[["versionId","version.id"]]),"timeline.query":productionRead(TimelineQuerySchema,TimelinePageSchema,()=>["timeline","versions"],pageQuery),"rough-cut.admission-receipt":productionWrite(RoughCutStartSchema,RoughCutAdmissionSchema,()=>["rough-cuts","admission-receipt"],{tenantInBody:true,readOnly:true,identity:[["timelineVersionId","timelineVersionId"],["timelineFingerprint","timelineFingerprint"]]}),"rough-cut.start":productionWrite(RoughCutStartSchema,RoughCutAdmissionSchema,()=>["rough-cuts"],{tenantInBody:true,identity:[["timelineVersionId","timelineVersionId"],["timelineFingerprint","timelineFingerprint"]]}),"rough-cut.get":productionRead(RoughCutGetSchema,RoughCutViewSchema,i=>["rough-cuts",i.renderId],void 0,[["renderId","renderId"]]),"rough-cut.query":productionRead(RoughCutQuerySchema,RoughCutPageSchema,()=>["rough-cuts"],pageQuery),"rough-cut.cancel":productionWrite(RoughCutGetSchema,cancellation,i=>["rough-cuts",i.renderId,"cancel"],{pathFields:["renderId"]}),"rough-cut.review.target":productionRead(RoughCutReviewScopeSchema,RoughCutReviewTargetSchema,i=>["rough-cut-review",i.renderId],void 0,[["renderId","renderId"]]),"rough-cut.review.record":productionWrite(RecordRoughCutReviewSchema,RoughCutReviewReceiptSchema,i=>["rough-cut-review",i.renderId],{pathFields:["renderId"],identity:[["renderId","review.renderId"]]}),"rough-cut.review.query":productionRead(RoughCutReviewQuerySchema,RoughCutReviewPageSchema,i=>["rough-cut-review",i.renderId,"history"],pageQuery,[["renderId","items.*.renderId"]]),"rough-cut.finding.query":productionRead(RoughCutFindingQuerySchema,RoughCutFindingPageSchema,()=>["rough-cut-review","findings"],i=>({...pageQuery(i),renderId:i.renderId}),[["renderId","items.*.renderId"]]),"final-ready.get":productionRead(TimelineScopeSchema,FinalReadyViewSchema,()=>["final-ready"]),"final-ready.decide":productionWrite(DecideFinalReadySchema,FinalReadyReceiptSchema,()=>["final-ready","decisions"],{identity:[["renderId","decision.renderId"],["reviewId","decision.reviewId"]]}),"final-ready.revoke":productionWrite(RevokeFinalReadySchema,FinalReadyReceiptSchema,()=>["final-ready","revoke"]),"final-ready.query":productionRead(FinalReadyQuerySchema,FinalReadyPageSchema,()=>["final-ready","decisions"],pageQuery),"final-render.eligibility":productionRead(TimelineScopeSchema,FinalRenderEligibilitySchema,()=>["final-renders","eligibility"]),"final-render.admission-receipt":productionWrite(FinalRenderStartSchema,FinalRenderAdmissionSchema,()=>["final-renders","admission-receipt"],{tenantInBody:true,readOnly:true,identity:[["timelineVersionId","timelineVersionId"],["timelineFingerprint","timelineFingerprint"]]}),"final-render.start":productionWrite(FinalRenderStartSchema,FinalRenderAdmissionSchema,()=>["final-renders"],{tenantInBody:true,identity:[["selectionId","selectionId"],["timelineVersionId","timelineVersionId"],["timelineFingerprint","timelineFingerprint"]]}),"final-render.get":productionRead(FinalRenderGetSchema,FinalRenderViewSchema,i=>["final-renders",i.renderId],void 0,[["renderId","renderId"]]),"final-render.query":productionRead(FinalRenderQuerySchema,FinalRenderPageSchema,()=>["final-renders"],pageQuery),"final-render.cancel":productionWrite(FinalRenderGetSchema,cancellation,i=>["final-renders",i.renderId,"cancel"],{pathFields:["renderId"]})};var Context=EditorContextInputSchema.extend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Validate=ValidateEditorProposalSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.scope.tenantId.toLowerCase());var editorOperations={"editor.context":operation(Context,EditorContextResultSchema,i=>({method:"POST",tenantId:i.scope.tenantId,path:path("projects",i.scope.projectId,"productions",i.scope.productionId,"editor-intelligence","context"),body:{scope:i.scope,timelineVersionId:i.timelineVersionId}}),[["scope.tenantId","basis.scope.tenantId"],["scope.projectId","basis.scope.projectId"],["scope.productionId","basis.scope.productionId"],["timelineVersionId","timeline.version.id"]],{readOnly:true}),"editor.validate":operation(Validate,EditorValidationResultSchema,i=>({method:"POST",tenantId:i.basis.scope.tenantId,path:path("projects",i.basis.scope.projectId,"productions",i.basis.scope.productionId,"editor-intelligence","proposals","validate"),body:{basis:i.basis,proposal:i.proposal}}),[["basis.scope.tenantId","basis.scope.tenantId"],["basis.scope.projectId","basis.scope.projectId"],["basis.scope.productionId","basis.scope.productionId"],["basis.timelineVersionId","basis.timelineVersionId"],["basis.contextFingerprint","basis.contextFingerprint"]],{readOnly:true})};var Context2=ReviewIntelligenceContextInputSchema.extend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Validate2=ValidateReviewIntelligenceSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.scope.tenantId.toLowerCase());var FinalContext=FinalOutputReviewContextInputSchema.extend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var reviewerOperations={"reviewer.final-output-context":operation(FinalContext,FinalOutputReviewContextResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("projects",i.scope.projectId,"productions",i.scope.productionId,"review-intelligence","final-output","context"),body:{scope:i.scope,renderId:i.renderId}}),[["scope","basis.scope"],["renderId","basis.renderId"],["renderId","deliveryTarget.renderId"]],{readOnly:true}),"reviewer.context":operation(Context2,ReviewIntelligenceContextResultSchema,i=>({method:"POST",tenantId:i.scope.tenantId,path:path("projects",i.scope.projectId,"productions",i.scope.productionId,"review-intelligence","context"),body:{scope:i.scope,target:i.target}}),[["scope.tenantId","basis.scope.tenantId"],["scope.projectId","basis.scope.projectId"],["scope.productionId","basis.scope.productionId"],["target.kind","basis.target.kind"],["target.renderId","basis.target.renderId"],["target.generationId","basis.target.generationId"],["scope.tenantId","reviewTarget.target.tenantId"],["scope.projectId","reviewTarget.target.projectId"],["scope.productionId","reviewTarget.target.productionId"],["target.kind","reviewTarget.kind"],["target.renderId","reviewTarget.target.renderId"],["target.generationId","reviewTarget.target.generationId"]],{readOnly:true}),"reviewer.validate":operation(Validate2,ReviewIntelligenceValidationResultSchema,i=>({method:"POST",tenantId:i.basis.scope.tenantId,path:path("projects",i.basis.scope.projectId,"productions",i.basis.scope.productionId,"review-intelligence","proposals","validate"),body:{basis:i.basis,proposal:i.proposal}}),[["basis.scope.tenantId","basis.scope.tenantId"],["basis.scope.projectId","basis.scope.projectId"],["basis.scope.productionId","basis.scope.productionId"],["basis.target.kind","basis.target.kind"],["basis.target.renderId","basis.target.renderId"],["basis.target.generationId","basis.target.generationId"],["basis.contextFingerprint","basis.contextFingerprint"],["basis.scope.tenantId","recordDraft.input.tenantId"],["basis.scope.productionId","recordDraft.input.productionId"],["basis.target.kind","recordDraft.kind"],["basis.target.renderId","recordDraft.input.renderId"],["basis.target.generationId","recordDraft.input.generationId"]],{readOnly:true})};var Context3=RepairStrategyContextInputSchema.extend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Validate3=ValidateRepairStrategySchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.scope.tenantId.toLowerCase());var Review1Validate=ValidateReview1RepairStrategySchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.input.tenantId.toLowerCase());var repairStrategyOperations={"repair-strategy.review1.context":operation(Review1RepairSourceQuerySchema,Review1RepairStrategyContextSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("projects",i.projectId,"productions",i.productionId,"repair-strategy","review1","context"),body:i}),[["tenantId","basis.input.tenantId"],["projectId","basis.input.projectId"],["productionId","basis.input.productionId"],["generationId","basis.input.generationId"],["reviewId","basis.input.reviewId"],["requirementKey","basis.input.requirementKey"]],{readOnly:true}),"repair-strategy.review1.validate":operation(Review1Validate,Review1RepairStrategyValidationSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("projects",i.basis.input.projectId,"productions",i.basis.input.productionId,"repair-strategy","review1","proposals","validate"),body:{basis:i.basis,proposal:i.proposal,...i.budget?{budget:i.budget}:{}}}),[["basis","basis"],["proposal.selectedAlternativeId","selectedAlternativeId"]],{readOnly:true}),"repair-strategy.context":operation(Context3,RepairStrategyContextResultSchema,i=>({method:"POST",tenantId:i.scope.tenantId,path:path("projects",i.scope.projectId,"productions",i.scope.productionId,"repair-strategy","context"),body:{scope:i.scope,findingId:i.findingId}}),[["scope.tenantId","basis.scope.tenantId"],["scope.projectId","basis.scope.projectId"],["scope.productionId","basis.scope.productionId"],["findingId","finding.id"]],{readOnly:true}),"repair-strategy.validate":operation(Validate3,RepairStrategyValidationResultSchema,i=>({method:"POST",tenantId:i.basis.scope.tenantId,path:path("projects",i.basis.scope.projectId,"productions",i.basis.scope.productionId,"repair-strategy","proposals","validate"),body:{basis:i.basis,proposal:i.proposal}}),[["basis.scope.tenantId","basis.scope.tenantId"],["basis.scope.projectId","basis.scope.projectId"],["basis.scope.productionId","basis.scope.productionId"],["basis.findingId","finding.id"],["basis.contextFingerprint","basis.contextFingerprint"],["proposal.selectedAlternativeId","selectedAlternativeId"]],{readOnly:true})};var ownedRequest=(action,i)=>{const{projectId,...body}=i;return{method:"POST",tenantId:i.tenantId,path:path("projects",projectId,"productions",i.productionId,"repairs",action),body}};var Author=AuthorRepairPlanSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.strategy.basis.scope.tenantId.toLowerCase());var canonicalRepairOperations={"canonical-repair.author-review1":operation(AuthorReview1RepairSchema,RepairAuthorReceiptSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("projects",i.projectId,"productions",i.productionId,"repairs","author-review1"),body:i}),[["reviewId","decision.sourceReviewId"],["generationId","decision.review1Source.generationId"],["mediaType","decision.review1Source.mediaType"],["requirementKey","decision.review1Source.requirement.key"]]),"canonical-repair.proof-review1":operation(RecordReview1RepairProofSchema.extend({projectId:ProjectIdSchema}),RepairProofReceiptSchema,i=>ownedRequest("proof-review1",i),[["attemptId","event.attemptId"],["generationId","event.generationId"],["reviewId","event.reviewId"]]),"canonical-repair.author":operation(Author,RepairAuthorReceiptSchema,i=>{const{tenantId,...body}=i;const s=i.strategy.basis.scope;return{method:"POST",tenantId,path:path("projects",s.projectId,"productions",s.productionId,"repairs","author"),body}},[["strategy.basis.scope.tenantId","decision.tenantId"],["strategy.basis.scope.projectId","decision.projectId"],["strategy.basis.scope.productionId","decision.productionId"],["strategy.basis.findingId","decision.basis.findingId"],["strategy.basis.contextFingerprint","decision.basis.contextFingerprint"],["strategy.proposal.selectedAlternativeId","decision.selectedAlternativeId"]]),"canonical-repair.get":operation(RepairPlanScopeSchema.extend({projectId:ProjectIdSchema}),RepairPlanViewSchema,i=>ownedRequest("get",i),[["planId","decision.id"]],{readOnly:true}),"canonical-repair.execute":operation(ExecuteRepairSchema.extend({projectId:ProjectIdSchema}),RepairProgressSchema,i=>ownedRequest("execute",i),[["planId","view.decision.id"]]),"canonical-repair.proof":operation(RecordRepairProofSchema.extend({projectId:ProjectIdSchema}),RepairProofReceiptSchema,i=>ownedRequest("proof",i),[["attemptId","event.attemptId"],["renderId","event.renderId"],["reviewId","event.reviewId"]])};var programmaticReviewOperations={"programmatic-review.target":productionRead(ProgrammaticVideoReviewScopeSchema,ProgrammaticVideoReviewTargetSchema,i=>["video-review","programmatic",i.renderId],void 0,[["renderId","renderId"]]),"programmatic-review.record":productionWrite(RecordProgrammaticVideoReviewSchema,ProgrammaticVideoReviewReceiptSchema,i=>["video-review","programmatic",i.renderId],{pathFields:["renderId"],identity:[["renderId","review.renderId"],["representationId","review.representationId"],["checksumSha256","review.checksumSha256"]]}),"programmatic-review.query":productionRead(ProgrammaticVideoReviewQuerySchema,ProgrammaticVideoReviewPageSchema,i=>["video-review","programmatic",i.renderId,"history"],pageQuery,[["renderId","items.*.renderId"]]),"programmatic-review.decide":productionWrite(DecideProgrammaticShotSchema,ShotDecisionReceiptSchema.extend({decision:ProgrammaticShotAcceptanceDecisionSchema}),i=>["video-review","programmatic",i.renderId,"decisions"],{pathFields:["renderId"],identity:[["renderId","decision.renderId"],["reviewId","decision.reviewId"],["action","decision.action"]]})};var Context4=SourceReviewContextInputSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var compositionSourceOperations={"composition.source.inspect":productionWrite(CompositionSourceInspectSchema,CompositionSourceInspectionSchema,()=>["compositions","source","inspect"],{readOnly:true,identity:[["compositionId","composition.version.compositionId"],["versionId","composition.version.id"],["fingerprint","composition.version.fingerprint"],["file","window.file"],["startLine","selection.startLine"]]}),"reviewer.source-context":operation(Context4,SourceReviewContextSchema,i=>({method:"POST",tenantId:i.scope.tenantId,path:path("projects",i.scope.projectId,"productions",i.scope.productionId,"review-intelligence","source","context"),body:{scope:i.scope,source:i.source,...i.renderId?{renderId:i.renderId}:{}}}),[["scope.tenantId","basis.input.scope.tenantId"],["scope.projectId","source.composition.version.projectId"],["scope.productionId","source.composition.version.productionId"],["source.compositionId","source.composition.version.compositionId"],["source.versionId","source.composition.version.id"],["source.fingerprint","source.composition.version.fingerprint"],["source.file","source.window.file"],["source.startLine","source.selection.startLine"],["renderId","render.receipt.renderId"]],{readOnly:true})};var Compare=ProgrammaticCompareSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Context5=ProgrammaticRecommendationContextInputSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Validate4=ValidateProgrammaticRecommendationSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.input.scope.tenantId.toLowerCase());var programmaticExplorationOperations={"exploration.programmatic.compare":operation(Compare,ProgrammaticComparisonSchema,i=>({method:"POST",tenantId:i.scope.tenantId,path:path("projects",i.scope.projectId,"productions",i.scope.productionId,"visual-exploration","programmatic","compare"),body:{scope:i.scope,items:i.items}}),[["scope.tenantId","scope.tenantId"],["scope.projectId","scope.projectId"],["scope.productionId","scope.productionId"],["scope.shotId","scope.shotId"],["items","selection"]],{readOnly:true}),"exploration.programmatic.recommendation.context":operation(Context5,ProgrammaticRecommendationContextSchema,i=>({method:"POST",tenantId:i.scope.tenantId,path:path("projects",i.scope.projectId,"productions",i.scope.productionId,"exploration-recommendation","programmatic","context"),body:{scope:i.scope,items:i.items,criteria:i.criteria}}),[["scope.tenantId","basis.input.scope.tenantId"],["scope.projectId","basis.input.scope.projectId"],["scope.productionId","basis.input.scope.productionId"],["scope.shotId","basis.input.scope.shotId"],["items","basis.input.items"]],{readOnly:true}),"exploration.programmatic.recommendation.validate":operation(Validate4,ProgrammaticRecommendationValidationSchema,i=>({method:"POST",tenantId:i.basis.input.scope.tenantId,path:path("projects",i.basis.input.scope.projectId,"productions",i.basis.input.scope.productionId,"exploration-recommendation","programmatic","proposals","validate"),body:{basis:i.basis,proposal:i.proposal}}),[["basis.contextFingerprint","basis.contextFingerprint"],["basis.input.scope.tenantId","basis.input.scope.tenantId"],["basis.input.scope.projectId","basis.input.scope.projectId"],["basis.input.scope.productionId","basis.input.scope.productionId"],["basis.input.items","basis.input.items"],["proposal.decision.kind","decision.kind"],["proposal.decision.label","decision.label"]],{readOnly:true})};var targetIdentity=prefix=>Object.keys(DeliveryTargetSchema.shape).map(key6=>["target."+key6,prefix+"."+key6]);var deliveryOperations={"delivery.policy.configure":productionWrite(ConfigureDeliveryPolicySchema,DeliveryPolicyReceiptSchema,()=>["deliveries","policy"],{tenantInBody:true}),"delivery.policy.get":productionRead(TimelineScopeSchema,DeliveryPolicyVersionSchema,()=>["deliveries","policy"]),"delivery.snapshot":productionRead(TimelineScopeSchema,DeliverySnapshotSchema,()=>["deliveries","snapshot"]),"delivery.target":productionRead(RoughCutGetSchema,DeliveryTargetSchema,i=>["deliveries","targets",i.renderId],void 0,[["renderId","renderId"]]),"delivery.start":productionWrite(StartDeliveryValidationSchema,DeliveryAdmissionSchema,()=>["deliveries"],{tenantInBody:true,identity:targetIdentity("target")}),"delivery.get":productionRead(DeliveryValidationGetSchema,DeliveryValidationViewSchema,i=>["deliveries",i.validationId],void 0,[["validationId","admission.validationId"]]),"delivery.approve":productionWrite(DecideDeliveryApprovalSchema,DeliveryDecisionReceiptSchema,i=>["deliveries",i.validationId,"approval"],{tenantInBody:true,pathFields:["validationId"],identity:[...targetIdentity("approval.target"),["reviewId","approval.reviewId"],["policyFingerprint","approval.policyFingerprint"],["action","approval.action"]]}),"delivery.cancel":productionWrite(DeliveryValidationGetSchema,cancellation,i=>["deliveries",i.validationId,"cancel"],{pathFields:["validationId"]}),"delivery.manifest":productionRead(DeliveryManifestGetSchema,RegisteredDeliveryManifestSchema,i=>["deliveries","manifests",i.manifestId],void 0,[["manifestId","link.id"]])};var prepare=PrepareShotRequestSchema.extend({projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema});var shotPreparationOperations={"shot-preparation.prepare":operation(prepare,PrepareShotResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("projects",i.projectId,"productions",i.productionId,"shots",i.shotId,"preparations"),body:Object.fromEntries(Object.entries(i).filter(([k])=>!["projectId","productionId","shotId"].includes(k)))}),[["projectId","preparation.basis.projectId"],["shotId","preparation.basis.shotId"],["expectedPlanVersionId","preparation.basis.planVersionId"],["expectedPlanVersion","preparation.basis.planVersion"],["expectedShotPlanningRevision","preparation.basis.shotPlanningRevision"],["target","preparation.target"]]),"shot-preparation.get":productionRead(PreparationGetInputSchema,PreparationViewSchema,i=>["shot-preparations",i.preparationId],void 0,[["preparationId","preparation.id"]]),"shot-preparation.active":productionRead(PreparationActiveInputSchema,PreparationViewSchema,i=>["shots",i.shotId,"preparations","active"],i=>({mediaType:i.mediaType}),[["shotId","preparation.basis.shotId"],["mediaType","preparation.target.mediaType"]]),"shot-preparation.query":productionRead(PreparationQueryInputSchema,PreparationQueryPageSchema,()=>["shot-preparations"],i=>({...pageQuery(i),shotId:i.shotId,mediaType:i.mediaType}),[["shotId","items.*.preparation.basis.shotId"],["mediaType","items.*.preparation.target.mediaType"]])};var generationOperations={"keyframe.device.quote":productionWrite(KeyframeStartInputSchema,GenerationCostQuoteSchema.nullable(),()=>["keyframe-generations","device","quote"],{tenantInBody:true,readOnly:true}),"keyframe.device.start":productionWrite(KeyframeDeviceStartInputSchema,KeyframeAdmissionSchema,()=>["keyframe-generations","device"],{tenantInBody:true,identity:[["contractId","contractId"]]}),"keyframe.start":productionWrite(KeyframeStartInputSchema,KeyframeAdmissionSchema,()=>["keyframe-generations"],{tenantInBody:true,identity:[["contractId","contractId"]]}),"keyframe.get":productionRead(KeyframeGetInputSchema,KeyframeGenerationViewSchema,i=>["keyframe-generations",i.generationId],void 0,[["generationId","generationId"]]),"keyframe.query":productionRead(KeyframeQueryInputSchema,KeyframeQueryPageSchema,()=>["keyframe-generations"],i=>({...pageQuery(i),shotId:i.shotId}),[["shotId","items.*.shotId"]]),"keyframe.cancel":productionWrite(KeyframeGetInputSchema,InterfaceCancellationReceiptSchema,i=>["keyframe-generations",i.generationId,"cancel"],{pathFields:["generationId"]}),"video.start":productionWrite(VideoStartInputSchema,VideoAdmissionSchema,()=>["video-generations"],{tenantInBody:true,identity:[["contractId","contractId"]]}),"video.device.quote":productionWrite(VideoStartInputSchema,GenerationCostQuoteSchema.nullable(),()=>["video-generations","device","quote"],{tenantInBody:true,readOnly:true}),"video.device.start":productionWrite(VideoDeviceStartInputSchema,VideoAdmissionSchema,()=>["video-generations","device"],{tenantInBody:true,identity:[["contractId","contractId"]]}),"video.get":productionRead(VideoGetInputSchema,VideoGenerationViewSchema,i=>["video-generations",i.generationId],void 0,[["generationId","generationId"]]),"video.query":productionRead(VideoQueryInputSchema,VideoQueryPageSchema,()=>["video-generations"],i=>({...pageQuery(i),shotId:i.shotId}),[["shotId","items.*.shotId"]]),"video.cancel":productionWrite(VideoGetInputSchema,InterfaceCancellationReceiptSchema,i=>["video-generations",i.generationId,"cancel"],{pathFields:["generationId"]})};var keyframeReviewOperations={"keyframe-review.target":productionRead(KeyframeReviewScopeSchema,KeyframeReviewTargetSchema,i=>["keyframe-review",i.generationId],void 0,[["generationId","generationId"]]),"keyframe-review.record":productionWrite(RecordKeyframeReviewSchema,KeyframeReviewReceiptSchema,i=>["keyframe-review",i.generationId],{pathFields:["generationId"],identity:[["generationId","review.generationId"],["candidateId","review.candidateId"],["representationId","review.representationId"],["checksumSha256","review.checksumSha256"]]}),"keyframe-review.query":productionRead(KeyframeReviewQuerySchema,KeyframeReviewPageSchema,i=>["keyframe-review",i.generationId,"history"],pageQuery,[["generationId","items.*.generationId"]]),"keyframe-review.decide":productionWrite(DecideKeyframeSchema,KeyframeDecisionReceiptSchema,i=>["keyframe-review",i.generationId,"decisions"],{pathFields:["generationId"],identity:[["generationId","decision.generationId"],["candidateId","decision.candidateId"],["reviewId","decision.reviewId"],["action","decision.action"]]}),"keyframe-reference.get":productionRead(KeyframeReferenceScopeSchema,KeyframeReferenceViewSchema,i=>["keyframe-review","references",i.shotId,i.framePurpose],void 0,[["shotId","shotId"],["framePurpose","framePurpose"]]),"keyframe-reference.query":productionRead(KeyframeDecisionQuerySchema,KeyframeDecisionPageSchema,i=>["keyframe-review","references",i.shotId,i.framePurpose,"history"],pageQuery,[["shotId","items.*.shotId"],["framePurpose","items.*.framePurpose"]]),"keyframe-reference.revoke":productionWrite(RevokeKeyframeSchema,KeyframeDecisionReceiptSchema,i=>["keyframe-review","references",i.shotId,i.framePurpose,"revoke"],{pathFields:["shotId","framePurpose"],identity:[["shotId","decision.shotId"],["framePurpose","decision.framePurpose"],["acceptanceId","decision.previousAcceptanceId"]]})};var videoReviewOperations={"video-review.target":productionRead(VideoReviewScopeSchema,VideoReviewTargetSchema,i=>["video-review",i.generationId],void 0,[["generationId","generationId"]]),"video-review.record":productionWrite(RecordVideoReviewSchema,VideoReviewReceiptSchema,i=>["video-review",i.generationId],{pathFields:["generationId"],identity:[["generationId","review.generationId"],["candidateId","review.candidateId"],["representationId","review.representationId"],["checksumSha256","review.checksumSha256"]]}),"video-review.query":productionRead(VideoReviewQuerySchema,VideoReviewPageSchema,i=>["video-review",i.generationId,"history"],pageQuery,[["generationId","items.*.generationId"]]),"video-review.decide":productionWrite(DecideVideoShotSchema,ShotDecisionReceiptSchema.extend({decision:GeneratedShotAcceptanceDecisionSchema}),i=>["video-review",i.generationId,"decisions"],{pathFields:["generationId"],identity:[["generationId","decision.generationId"],["candidateId","decision.candidateId"],["reviewId","decision.reviewId"],["action","decision.action"]]}),"shot-acceptance.get":productionRead(ShotAcceptanceScopeSchema,ShotAcceptanceViewSchema,i=>["video-review","shots",i.shotId,"acceptance"],void 0,[["shotId","shotId"]]),"shot-acceptance.query":productionRead(ShotDecisionQuerySchema,ShotDecisionPageSchema,i=>["video-review","shots",i.shotId,"decisions"],pageQuery,[["shotId","items.*.shotId"]]),"shot-acceptance.revoke":productionWrite(RevokeShotAcceptanceSchema,ShotDecisionReceiptSchema,i=>["video-review","shots",i.shotId,"revoke"],{pathFields:["shotId"],identity:[["shotId","decision.shotId"],["acceptanceId","decision.previousAcceptanceId"]]})};import{z as z69}from"zod";var providerOperations={"provider.model.get":operation(ProviderModelGetSchema,ProviderModelViewSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("provider-models",i.id),query:{version:i.version}}),[["id","id"],["version","version"]]),"provider.model.query":operation(ProviderTenantInputSchema,ProviderModelPageSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("provider-models")})),"provider.model.configure":operation(ConfigureProviderModelSchema,ProviderModelViewSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("provider-models","configure"),body:i}),[["definition.profile.id","id"],["definition.profile.version","version"]]),"provider.model.disable":operation(DisableProviderModelSchema,z69.strictObject({disabled:z69.literal(true)}),i=>({method:"POST",tenantId:i.tenantId,path:path("provider-models","disable"),body:i})),"provider.configure":operation(ConfigureProviderInputSchema,ProviderConnectionViewSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("provider-connections","configure"),body:i}),[["connectionId","connectionId"],["configuration","configuration"]]),"provider.query":operation(ProviderTenantInputSchema,ProviderConnectionPageSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("provider-connections")})),"provider.models":operation(ProviderTenantInputSchema,ProviderModelsViewSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("provider-connections","models")})),"provider.keyframe-default.set":operation(SetKeyframeDefaultSchema,ProviderDefaultViewSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("provider-connections","keyframe-default"),body:i}),[["selection","selection"]]),"provider.disable":operation(ProviderConnectionCommandSchema,z69.strictObject({disabled:z69.literal(true)}),i=>({method:"POST",tenantId:i.tenantId,path:path("provider-connections","disable"),body:i})),"provider.revoke":operation(ProviderCredentialRevokeSchema,z69.strictObject({revoked:z69.literal(true)}),i=>({method:"POST",tenantId:i.tenantId,path:path("provider-connections","revoke"),body:i}))};import{z as z70}from"zod";var observationOperations={"media-observation.device.quote":productionWrite(QwenAsrDeviceQuoteInputSchema,QwenAsrCostQuoteSchema,()=>["media-observations","device","quote"],{readOnly:true}),"media-observation.device.start":productionWrite(QwenAsrDeviceStartSchema,QwenAsrDeviceAdmissionSchema,()=>["media-observations","device"]),"media-observation.device.get":productionRead(ObservationGetSchema,QwenAsrDeviceViewSchema,q=>["media-observations","device",q.observationId],void 0,[["observationId","observationId"]]),"media-observation.start-local":productionWrite(LocalObservationStartSchema,LocalObservationAdmissionSchema,()=>["media-observations","local"]),"media-observation.get-local":productionRead(ObservationGetSchema,LocalObservationViewSchema,q=>["media-observations","local",q.observationId],void 0,[["observationId","observationId"]]),"production-guidance.context":productionRead(ObservationScopeSchema,ProductionGuidanceContextSchema,()=>["media-observations","context"]),"media-observation.options":productionRead(ObservationScopeSchema,ObservationOptionsSchema,()=>["media-observations","options"]),"media-observation.start":productionWrite(ObservationStartSchema,ObservationAdmissionSchema,()=>["media-observations"]),"media-observation.get":productionRead(ObservationGetSchema,ObservationViewSchema,q=>["media-observations",q.observationId],void 0,[["observationId","observationId"]]),"media-observation.cancel":productionWrite(ObservationGetSchema,z70.strictObject({cancellationRequested:z70.boolean()}),q=>["media-observations",q.observationId,"cancel"],{pathFields:["observationId"]})};import{z as z71}from"zod";var speechOperations={"speech.device.quote":productionWrite(SpeechStartSchema,SpeechCostQuoteSchema.nullable(),()=>["speech-generations","device","quote"],{readOnly:true}),"speech.device.start":productionWrite(SpeechDeviceStartSchema,SpeechAdmissionSchema,()=>["speech-generations","device"]),"speech.start-local":productionWrite(LocalSpeechStartSchema,LocalSpeechAdmissionSchema,()=>["speech-generations","local"]),"speech.get-local":productionRead(SpeechGetSchema,LocalSpeechGenerationViewSchema,q=>["speech-generations","local",q.generationId],void 0,[["generationId","generationId"]]),"speech.options":productionRead(SpeechScopeSchema,SpeechOptionsSchema,()=>["speech-generations","options"]),"speech.start":productionWrite(SpeechStartSchema,SpeechAdmissionSchema,()=>["speech-generations"]),"speech.get":productionRead(SpeechGetSchema,SpeechGenerationViewSchema,q=>["speech-generations",q.generationId],void 0,[["generationId","generationId"]]),"speech.cancel":productionWrite(SpeechGetSchema,z71.strictObject({cancellationRequested:z71.boolean()}),q=>["speech-generations",q.generationId,"cancel"],{pathFields:["generationId"]})};var voiceProfileOperations={"voice-profile.set-reference":operation(VoiceProfileSetReferenceSchema,VoiceProfileReceiptSchema,({voiceProfileId,...body})=>({method:"POST",tenantId:body.tenantId,path:path("voice-profiles",voiceProfileId,"reference"),body}),[["voiceProfileId","voiceProfileId"]]),"voice-profile.reference":operation(VoiceReferenceGetSchema,VoiceReferenceSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("voice-profiles",i.voiceProfileId,"references",i.referenceId)}),[["voiceProfileId","voiceProfileId"],["referenceId","id"]],{readOnly:true}),"voice-profile.create":operation(VoiceProfileCreateSchema,VoiceProfileReceiptSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("voice-profiles"),body:i})),"voice-profile.revise":operation(VoiceProfileReviseSchema,VoiceProfileReceiptSchema,({voiceProfileId,...body})=>({method:"POST",tenantId:body.tenantId,path:path("voice-profiles",voiceProfileId,"draft"),body}),[["voiceProfileId","voiceProfileId"]]),"voice-profile.publish":operation(VoiceProfilePublishSchema,VoiceProfileReceiptSchema,({voiceProfileId,...body})=>({method:"POST",tenantId:body.tenantId,path:path("voice-profiles",voiceProfileId,"publish"),body}),[["voiceProfileId","voiceProfileId"]]),"voice-profile.set-enabled":operation(VoiceProfileSetEnabledSchema,VoiceProfileReceiptSchema,({voiceProfileId,...body})=>({method:"POST",tenantId:body.tenantId,path:path("voice-profiles",voiceProfileId,"availability"),body}),[["voiceProfileId","voiceProfileId"],["enabled","enabled"]]),"voice-profile.list":operation(VoiceProfileListSchema,VoiceProfilePageSchema,({tenantId,...query})=>({method:"GET",tenantId,path:path("voice-profiles"),query}),[],{readOnly:true}),"voice-profile.get":operation(VoiceProfileScopeSchema,VoiceProfileViewSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("voice-profiles",i.voiceProfileId)}),[["voiceProfileId","voiceProfileId"]],{readOnly:true}),"voice-profile.version":operation(VoiceProfileVersionQuerySchema,VoiceProfileVersionSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("voice-profiles",i.voiceProfileId,"versions",String(i.version))}),[["voiceProfileId","ref.voiceProfileRef"],["tenantId","ref.ownerTenantRef"],["version","ref.version"]],{readOnly:true})};var voiceReviewOperations={"voice-review.target":operation(VoiceReviewTargetQuerySchema,VoiceReviewTargetSchema,({tenantId,voiceProfileId,...query})=>({method:"GET",tenantId,path:path("voice-profiles",voiceProfileId,"review-target"),query}),[["voiceProfileId","voiceProfileId"],["audioVersionId","audioVersionId"]],{readOnly:true}),"voice-review.record":operation(RecordVoiceReviewSchema,VoiceReviewReceiptSchema,({voiceProfileId,...body})=>({method:"POST",tenantId:body.tenantId,path:path("voice-profiles",voiceProfileId,"reviews"),body}),[["voiceProfileId","review.voiceProfileId"],["audioVersionId","review.audioVersionId"],["referenceId","review.basis.reference.id"]]),"voice-review.get":operation(VoiceReviewGetSchema,VoiceReviewViewSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("voice-profiles",i.voiceProfileId,"reviews",i.reviewId)}),[["voiceProfileId","review.voiceProfileId"],["reviewId","review.id"]],{readOnly:true})};var soundMakingPlanOperations={"sound-plan.context":productionRead(SoundPlanScopeSchema,SoundPlanContextSchema,()=>["sound-making-plan","context"],()=>({}),[["tenantId","tenantId"],["productionId","productionId"]]),"sound-plan.get":productionRead(SoundPlanGetSchema,SoundPlanViewSchema,()=>["sound-making-plan"],q=>({versionId:q.versionId}),[["tenantId","version.tenantId"],["productionId","version.productionId"],["versionId","version.id"]]),"sound-plan.validate":productionWrite(SoundPlanValidateSchema,SoundPlanValidationSchema,()=>["sound-making-plan","validate"],{readOnly:true}),"sound-plan.accept":productionWrite(SoundPlanAcceptSchema,SoundPlanReceiptSchema,()=>["sound-making-plan"],{identity:[["tenantId","version.tenantId"],["productionId","version.productionId"]]})};import{z as z72}from"zod";var post2=(input,output,action,identity4=[],readOnly=false)=>operation(input,output,i=>({method:"POST",tenantId:i.tenantId,path:path("lifecycle-events",action),body:i}),identity4,{readOnly});var lifecycleEventOperations={"production.feedback":post2(ProductionFeedbackInputSchema,ProductionFeedbackResultSchema,"feedback",[],true),"production.events.read":post2(ReadProductionEventsSchema,ProductionEventReadSchema,"read",[],true),"webhook.configure":post2(ConfigureWebhookSchema,WebhookSubscriptionSchema,"configure",[["subscriptionId","subscriptionId"]]),"webhook.secret.prepare":post2(PrepareWebhookSecretSchema,WebhookSecretReferenceSchema,"secret-prepare",[["subscriptionId","subscriptionId"],["secretRef","secretRef"]]),"webhook.configure-reference":post2(ConfigureWebhookReferenceSchema,WebhookSubscriptionSchema,"configure-reference",[["subscriptionId","subscriptionId"]]),"webhook.disable":post2(DisableWebhookSchema,WebhookSubscriptionSchema,"disable",[["subscriptionId","subscriptionId"]]),"webhook.replay":post2(ReplayWebhookSchema,WebhookReplayReceiptSchema,"replay",[["eventId","eventId"]]),"lifecycle-event.capabilities":post2(LifecycleEventScopeSchema,LifecycleEventCapabilitiesSchema,"capabilities",[],true),"lifecycle-event.subscriptions":post2(QueryLifecycleEventsSchema.safeExtend({kind:z72.literal("subscriptions")}),WebhookSubscriptionPageSchema,"query",[["subscriptionId","items.*.subscriptionId"]],true),"lifecycle-event.events":post2(QueryLifecycleEventsSchema.safeExtend({kind:z72.literal("events")}),ExternalLifecycleEventPageSchema,"query",[],true),"lifecycle-event.deliveries":post2(QueryLifecycleEventsSchema.safeExtend({kind:z72.literal("deliveries")}),WebhookDeliveryPageSchema,"query",[["subscriptionId","items.*.subscriptionId"],["deliveryId","items.*.deliveryId"]],true),"lifecycle-event.attempts":post2(QueryLifecycleEventsSchema.safeExtend({kind:z72.literal("attempts")}),WebhookAttemptPageSchema,"query",[],true)};import{z as z75}from"zod";import{z as z73}from"zod";var FederationHandoffInputSchema=FederationSubscriptionGetSchema.extend({expectedRevision:z73.int().positive().optional()}).strict();var FederationHandoffSchema=FederationSubscriptionResultSchema.safeExtend({contract:z73.literal("nvs-agent-event-handoff/1"),source:z73.string().min(1).max(2048),notificationProfile:z73.literal("eventsdk/1.2"),receiptProfile:z73.literal("eventsdk/1.1"),status:z73.enum(["READY","NOT_ACTIVE"]),defaultReceive:z73.literal(false),wake:z73.literal("RECEIVER_OWNED"),adoption:z73.literal("RECEIVER_OWNER_GOAL_REQUIRED"),cursorMeaning:z73.literal("NVS_SOURCE_COMMIT_POSITION_NOT_RECEIVER_SEQUENCE"),resultReferenceOperation:z73.literal("federation.result.reference"),resultReadOperation:z73.literal("federation.result.read"),receiptMeaning:z73.literal("LOCAL_APPLIED_IS_NOT_AGENT_ADOPTION"),events:z73.array(z73.strictObject({type:ExternalEventTypeSchema,wireType:z73.string(),dataSchema:z73.string()})).max(14)}).strict().refine(v=>v.status==="READY"===(v.subscription.effective==="ACTIVE")).refine(v=>v.status==="NOT_ACTIVE"?v.events.length===0:new Set(v.events.map(e=>e.type)).size===v.events.length&&v.events.length===v.subscription.eventTypes.length&&v.events.every(e=>v.subscription.eventTypes.includes(e.type)&&e.wireType===`com.nativestudio.${e.type}.v1`&&e.dataSchema===`urn:nativestudio:events:${e.type}:v1`));import{z as z74}from"zod";function federationPublicationContract(type){return{type,wireType:`com.nativestudio.${type}.v1`,dataschema:`urn:nativestudio:events:${type}:v1`,defaultEnabled:false}}var FEDERATION_EVENT_CATALOG=Object.freeze(EXTERNAL_EVENT_TYPES.map(type=>Object.freeze(federationPublicationContract(type))));var readOperation=z74.enum(["federation.result.reference","federation.result.read","federation.inbound.signals","delivery.get","delivery.manifest"]);var eventDescription=z74.strictObject({wireType:z74.string().min(1).max(256),dataschema:z74.url().max(2048),trigger:z74.string().min(1).max(512),readOperations:z74.array(readOperation).min(1).max(4)});var jsonSchema2=z74.record(z74.string(),z74.json());var outbound=eventDescription.extend({nativeType:ExternalEventTypeSchema,effect:z74.literal("LIFECYCLE_NOTICE")}).refine(event2=>{const contract=federationPublicationContract(event2.nativeType);return event2.wireType===contract.wireType&&event2.dataschema===contract.dataschema});var inbound=eventDescription.extend({wireType:z74.literal(RESOURCE_CHANGE_TYPE),dataschema:z74.literal(RESOURCE_CHANGE_SCHEMA),dataSchema:jsonSchema2,effect:z74.literal("REFRESH_HINT")});var FederationEventDefinitionsSchema=FederationScopeSchema.extend({contract:z74.literal("nvs-event-definitions/1"),cloudEventsSpecVersion:z74.literal("1.0"),profile:z74.literal("eventsdk/1.2"),outboundDataSchema:jsonSchema2,outbound:z74.array(outbound).length(EXTERNAL_EVENT_TYPES.length).refine(events=>new Set(events.map(event2=>event2.nativeType)).size===events.length),inbound:z74.array(inbound).length(1)}).strict();var digest3=z75.string().regex(/^sha256:[a-f0-9]{64}$/);var FederationContractInputSchema=FederationHandoffInputSchema.extend({expectedRevision:z75.int().positive(),expectedSource:z75.string().min(1).max(2048).optional(),expectedCatalogDigest:digest3.optional()}).strict();var event=z75.strictObject({type:z75.string().min(1).max(256),dataschema:z75.string().min(1).max(2048),description:z75.string().min(1).max(1024),dataSchema:z75.record(z75.string(),z75.json()),resourceAccess:z75.strictObject({providerPath:z75.literal("/v1/federation/result-read"),tools:z75.tuple([z75.literal("federation_result_reference"),z75.literal("federation_result_read")])})});var FederationNativeCatalogSchema=z75.unknown().refine(value=>{try{canonicalFederationCatalogJson(value);return true}catch{return false}}).pipe(z75.strictObject({schemaVersion:z75.literal(1),serviceRef:z75.literal("native-video-studio"),events:z75.array(event).min(1).max(14)}));var FederationContractSchema=FederationHandoffSchema.safeExtend({producerContract:z75.literal("nvs-producer-contract/1"),catalog:FederationNativeCatalogSchema.nullable(),catalogDigest:digest3.nullable(),maxCatalogBytes:z75.literal(131072),maxEventBytes:z75.literal(32768),maxResultValueBytes:z75.literal(32768),qualification:z75.literal("NVS_CONTRACT_ONLY")}).refine(v=>v.status==="NOT_ACTIVE"?v.catalog===null&&v.catalogDigest===null:!!v.catalog&&!!v.catalogDigest&&v.catalog.events.length===v.events.length&&new Set(v.catalog.events.map(e=>e.type)).size===v.events.length&&v.catalog.events.every(entry=>v.events.some(e=>e.wireType===entry.type&&e.dataSchema===entry.dataschema)));var federationPost=(input,output,action,readOnly,bindings=[])=>operation(input,output,i=>({method:"POST",path:path("federation",action),tenantId:i.tenantId,body:i}),[["tenantId","tenantId"],["productionId","productionId"],...bindings],{readOnly});import{z as z77}from"zod";import{z as z76}from"zod";var clean=v=>Array.from(v).every(char=>{const code=char.codePointAt(0);return code>=32&&code!==127&&(code<55296||code>57343)});var text4=max=>z76.string().min(1).max(max).refine(clean);var hash2=z76.string().regex(/^[a-f0-9]{64}$/);var FederationReceiptOriginSchema=z76.strictObject({schemaVersion:z76.literal(1),sourceService:text4(256),bindingId:z76.uuid().toLowerCase(),source:text4(2048).refine(v=>URL.canParse(v)&&!/\s/u.test(v)),sourceTenant:text4(256),eventId:text4(256),deliveryId:hash2,digest:hash2,logicalDigest:hash2,connectionRef:text4(256),grantRef:text4(256),grantVersion:z76.int().min(1).max(2147483647),consumerRef:text4(256),targetScope:text4(128),deliveryRef:text4(2048)});var ref2=z77.string().min(1).max(256).refine(v=>Array.from(v).every(c=>{const p=c.codePointAt(0);return p>=32&&p!==127&&(p<55296||p>57343)}));var uuid3=z77.uuid().toLowerCase();var id6=z77.string().regex(/^[a-f0-9]{64}$/);var receiptRouteInput=FederationScopeSchema.extend({routeId:uuid3,bindingId:uuid3,requestId:ref2,expectedRevision:z77.int().nonnegative(),grantRef:ref2,grantVersion:z77.int().min(1).max(2147483647),notBefore:z77.iso.datetime(),expiresAt:z77.iso.datetime(),state:z77.enum(["ACTIVE","PAUSED","REVOKED"]),receiptProfile:z77.literal("eventsdk/1.1")}).strict();var FederationReceiptRouteConfigureSchema=receiptRouteInput.refine(orderedFederationWindow);var FederationReceiptRouteSchema=receiptRouteInput.omit({requestId:true,expectedRevision:true}).extend({revision:z77.int().positive(),source:z77.string().min(1).max(2048),connectionRef:ref2,remoteService:z77.string().min(1).max(256),remoteTenant:ref2,peerSource:z77.string().min(1).max(2048),effective:z77.enum(["ACTIVE","PAUSED","REVOKED","EXPIRED","BLOCKED"])}).strict();var FederationReceiptDeliverySchema=FederationScopeSchema.extend({id:id6,routeId:uuid3,inboxId:uuid3,eventId:ref2,receiptRef:ref2,receiptRevision:z77.int().positive(),grantRef:ref2,grantVersion:z77.int().positive(),state:z77.enum(["PENDING","UNKNOWN","PUBLISHED","HOLD"]),attempts:z77.int().nonnegative(),generation:z77.int().nonnegative(),recoveryCount:z77.int().min(0).max(3),reason:ref2.nullable(),originDelivery:FederationReceiptOriginSchema.optional(),ack:z77.strictObject({stream:ref2,sequence:z77.int().positive(),duplicate:z77.boolean()}).nullable()}).strict().refine(v=>!v.originDelivery||v.originDelivery.targetScope===v.tenantId+"/"+v.productionId);var FederationReceiptQuerySchema=FederationScopeSchema.extend({kind:z77.enum(["routes","deliveries"]),routeId:uuid3.optional(),inboxId:uuid3.optional(),originDeliveryId:id6.optional(),after:ref2.optional(),limit:z77.int().min(1).max(50).default(20)}).strict().refine(v=>v.kind==="deliveries"||!v.inboxId&&!v.originDeliveryId).refine(v=>!v.after||(v.kind==="routes"?z77.uuid().safeParse(v.after).success:id6.safeParse(v.after).success));var FederationReceiptQueryResultSchema=z77.discriminatedUnion("kind",[FederationScopeSchema.extend({kind:z77.literal("routes"),items:z77.array(FederationReceiptRouteSchema).max(50),next:uuid3.nullable()}).strict(),FederationScopeSchema.extend({kind:z77.literal("deliveries"),items:z77.array(FederationReceiptDeliverySchema).max(50),next:id6.nullable()}).strict()]).refine(v=>v.items.every(item=>item.tenantId===v.tenantId&&item.productionId===v.productionId));var FederationReceiptRecoverSchema=FederationScopeSchema.extend({routeId:uuid3,deliveryId:id6,requestId:ref2,expectedGeneration:z77.int().nonnegative(),expectedAttempts:z77.int().positive(),reason:ref2,acknowledgeDuplicateRisk:z77.literal(true)}).strict();var FederationReceiptRecoverySchema=FederationScopeSchema.extend({routeId:uuid3,deliveryId:id6,requestId:ref2,recoveryId:uuid3,attempts:z77.int().positive(),generation:z77.int().positive(),recoveryCount:z77.int().min(1).max(3),effect:z77.literal("TRANSPORT_ONLY")}).strict();var FederationReceiptCommandInputSchema=FederationScopeSchema.extend({requestId:ref2}).strict();var FederationReceiptCommandSchema=FederationReceiptCommandInputSchema.extend({result:z77.union([FederationReceiptRouteSchema,FederationReceiptRecoverySchema]).nullable()}).strict().refine(v=>!v.result||v.result.tenantId===v.tenantId&&v.result.productionId===v.productionId);var federationExchangeOperations={"federation.subscription.contract":federationPost(FederationContractInputSchema,FederationContractSchema,"subscription-contract",true,[["subscriptionId","subscription.subscriptionId"]]),"federation.result.reference":federationPost(FederationResultLocatorSchema,FederationResultReferenceSchema,"result-reference",true),"federation.result.read":federationPost(FederationResultReadSchema,FederationResultSnapshotSchema,"result-read",true,[["source","source"]]),"federation.receipt-route.configure":federationPost(FederationReceiptRouteConfigureSchema,FederationReceiptRouteSchema,"receipt-route-configure",false,[["routeId","routeId"],["bindingId","bindingId"]]),"federation.receipt.query":federationPost(FederationReceiptQuerySchema,FederationReceiptQueryResultSchema,"receipt-query",true,[["kind","kind"]]),"federation.receipt.command":federationPost(FederationReceiptCommandInputSchema,FederationReceiptCommandSchema,"receipt-command",true),"federation.receipt.recover":federationPost(FederationReceiptRecoverSchema,FederationReceiptRecoverySchema,"receipt-recover",false,[["routeId","routeId"],["deliveryId","deliveryId"]]),"federation.subscription.handoff":federationPost(FederationHandoffInputSchema,FederationHandoffSchema,"subscription-handoff",true,[["subscriptionId","subscription.subscriptionId"]])};var federationEventLinkOperations={"federation.link.receiver":federationPost(EventLinkScopeSchema,EventReceiverPortalSchema,"link-receiver",true),"federation.link.targets":federationPost(EventLinkScopeSchema,EventLinkTargetsSchema,"link-targets",true),"federation.link.start":federationPost(EventLinkStartInputSchema,EventLinkStartSchema,"link-start",false,[["requestId","requestId"],["targetId","targetId"],["eventType","eventType"]]),"federation.link.get":federationPost(EventLinkRequestInputSchema,EventLinkViewSchema,"link-get",true,[["requestId","requestId"]]),"federation.link.confirm":federationPost(EventLinkConfirmInputSchema,EventLinkConfirmedSchema,"link-confirm",false,[["requestId","requestId"],["expiresAt","route.expiresAt"],["publicationMode","route.publicationMode"]]),"federation.link.cancel":federationPost(EventLinkRequestInputSchema,EventLinkCancelledSchema,"link-cancel",false,[["requestId","requestId"]])};import{z as z78}from"zod";var PEER_RECEIPT_SCHEMA="https://eventsdk.dev/schemas/v1/business-receipt.schema.json";var PUBLISHED_DELIVERY_NAMESPACE="native-video-studio";var PUBLISHED_DELIVERY_PREFIX="urn:nativestudio:published-delivery:v1:";var clean2=v=>Array.from(v).every(c=>{const n=c.codePointAt(0);return n>=32&&n!==127&&(n<55296||n>57343)});var text5=n=>z78.string().min(1).max(n).refine(clean2);var ref3=text5(256);var uuid4=z78.uuid().toLowerCase();var uri=text5(2048).refine(v=>URL.canParse(v)&&!/\s/u.test(v));var hash3=z78.string().regex(/^[a-f0-9]{64}$/);function publishedDeliveryReceiptRef(deliveryId,digest5){return PUBLISHED_DELIVERY_PREFIX+hash3.parse(deliveryId)+":"+hash3.parse(digest5)}var PeerTerminalReceiptSchema=z78.strictObject({receiptRef:ref3,originSource:uri,originEventId:ref3,deliveryRef:text5(2048),consumerRef:ref3,targetScope:text5(2048),disposition:z78.enum(["APPLIED","REJECTED"]),recordedAt:z78.iso.datetime({offset:true}),revision:z78.int().min(1).max(2147483647),reasonCode:ref3.optional(),resultRef:z78.strictObject({sourceSystem:ref3,resourceType:ref3,resourceId:text5(2048),revision:ref3,digest:ref3,evidenceRef:text5(2048).optional()}).optional()});var receiptInboundInput=FederationScopeSchema.extend({contractVersion:z78.literal(2),remoteService:ref3,bindingId:uuid4,routeId:uuid4,requestId:ref3,expectedRevision:z78.int().min(0),source:uri,remoteTenant:ref3,peerType:ref3.refine(v=>!/\s/u.test(v)),consumerRef:ref3,peerConsumerRef:ref3,peerTargetScope:text5(2048),grantRef:ref3,grantVersion:z78.int().min(1).max(2147483647),notBefore:z78.iso.datetime({offset:true}),expiresAt:z78.iso.datetime({offset:true}),state:z78.enum(["ACTIVE","PAUSED","REVOKED"])}).strict();var ReceiptInboundConfigureSchema=receiptInboundInput.refine(orderedFederationWindow);var ReceiptInboundBindingSchema=receiptInboundInput.omit({requestId:true,expectedRevision:true}).extend({installationSource:uri,remoteService:ref3,contractVersion:z78.union([z78.literal(1),z78.literal(2)]).default(1),connectionRef:ref3,direction:z78.literal("INBOUND"),profile:z78.literal("eventsdk/1.1"),revision:z78.int().positive(),effective:z78.enum(["ACTIVE","PAUSED","REVOKED","EXPIRED","BLOCKED"])}).strict().refine(b=>b.state==="ACTIVE"?b.effective!=="PAUSED":b.effective===b.state).refine(orderedFederationWindow);var CurrentReceiptInboundBindingSchema=ReceiptInboundBindingSchema.safeExtend({contractVersion:z78.literal(2)});var ReceiptObservationSchema=FederationScopeSchema.extend({id:uuid4,bindingId:uuid4,routeId:uuid4,originalEventId:uuid4,originalDeliveryId:hash3,originalDigest:hash3,peerSource:uri,peerTenant:ref3,receiptRef:ref3,receiptRevision:z78.int().positive(),peerConsumerRef:ref3,peerTargetScope:text5(2048),disposition:z78.enum(["APPLIED","REJECTED"]),peerRecordedAt:z78.iso.datetime({offset:true}),receivedAt:z78.iso.datetime(),hasResultRef:z78.boolean(),meaning:z78.literal("PEER_REPORTED_ONLY")}).strict();var ReceiptInboundQuarantineSchema=FederationScopeSchema.extend({id:uuid4,bindingId:uuid4,deliveryRef:text5(2048),reasonCode:ref3,recordedAt:z78.iso.datetime()}).strict();var ReceiptInboundQuerySchema=FederationScopeSchema.extend({kind:z78.enum(["bindings","observations","quarantine"]),bindingId:uuid4.optional(),originalDeliveryId:hash3.optional(),limit:z78.int().min(1).max(50).default(25),after:uuid4.optional()}).strict().refine(v=>!v.originalDeliveryId||v.kind==="observations");var page2=FederationScopeSchema.extend({next:uuid4.nullable()});var ReceiptInboundQueryResultSchema=z78.discriminatedUnion("kind",[page2.extend({kind:z78.literal("bindings"),items:z78.array(ReceiptInboundBindingSchema).max(50)}).strict(),page2.extend({kind:z78.literal("observations"),items:z78.array(ReceiptObservationSchema).max(50)}).strict(),page2.extend({kind:z78.literal("quarantine"),items:z78.array(ReceiptInboundQuarantineSchema).max(50)}).strict()]).refine(v=>v.items.every(item=>item.tenantId===v.tenantId&&item.productionId===v.productionId));var ReceiptInboundCatalogSchema=FederationScopeSchema.extend({defaultReceive:z78.literal(false),meaning:z78.literal("PEER_REPORTED_ONLY"),bindings:z78.array(CurrentReceiptInboundBindingSchema).max(32)}).strict().refine(v=>v.bindings.every(b=>b.tenantId===v.tenantId&&b.productionId===v.productionId&&b.effective==="ACTIVE"));var ReceiptInboundCommandInputSchema=FederationScopeSchema.extend({requestId:ref3}).strict();var ReceiptInboundCommandSchema=ReceiptInboundCommandInputSchema.extend({result:ReceiptInboundBindingSchema.nullable()}).strict().refine(v=>!v.result||v.result.tenantId===v.tenantId&&v.result.productionId===v.productionId);import{z as z81}from"zod";import{z as z79}from"zod";var uuid5=z79.uuid().toLowerCase();var hash4=z79.string().regex(/^[a-f0-9]{64}$/);var source2=ReceiptInboundBindingSchema.shape.installationSource;var FederationDeliveryInspectInputSchema=FederationScopeSchema.extend({routeId:uuid5,eventId:uuid5,deliveryId:hash4,expectedSource:source2.optional(),expectedDigest:hash4.optional(),receiptBindingId:uuid5.optional()}).strict();var FederationInspectedDeliverySchema=FederationDeliverySchema.extend({source:source2,digest:hash4,connectionRef:ReceiptInboundBindingSchema.shape.connectionRef,grantRef:ReceiptInboundBindingSchema.shape.grantRef,grantVersion:ReceiptInboundBindingSchema.shape.grantVersion}).strict().refine(d=>d.acknowledgement===(d.state==="PUBLISHED"?"BROKER_STORED":"NOT_CONFIRMED")).refine(d=>d.state!=="PUBLISHED"||d.attempts>0);var FederationDeliveryInspectionSchema=FederationScopeSchema.extend({contract:z79.literal("nvs-federation-delivery-inspection/1"),asOf:z79.iso.datetime(),source:source2,delivery:FederationInspectedDeliverySchema,receiptBinding:ReceiptInboundBindingSchema.nullable(),receiptObservation:ReceiptObservationSchema.nullable(),receiptStatus:z79.enum(["NOT_REQUESTED","NOT_OBSERVED","PEER_REPORTED"]),meaning:z79.literal("NATIVE_TRANSPORT_AND_PEER_REPORT_ONLY")}).strict().refine(v=>{const d=v.delivery,b=v.receiptBinding,o=v.receiptObservation;if(d.tenantId!==v.tenantId||d.productionId!==v.productionId||d.source!==v.source)return false;if(!b)return!o&&v.receiptStatus==="NOT_REQUESTED";if(b.tenantId!==v.tenantId||b.productionId!==v.productionId||b.routeId!==d.routeId||b.installationSource!==v.source)return false;if(!o)return v.receiptStatus==="NOT_OBSERVED";return v.receiptStatus==="PEER_REPORTED"&&d.attempts>0&&o.tenantId===v.tenantId&&o.productionId===v.productionId&&o.bindingId===b.bindingId&&o.routeId===d.routeId&&o.originalDeliveryId===d.deliveryId&&o.originalEventId===d.eventId&&o.originalDigest===d.digest&&o.peerSource===b.source&&o.peerTenant===b.remoteTenant&&o.peerConsumerRef===b.peerConsumerRef&&o.peerTargetScope===b.peerTargetScope});import{z as z80}from"zod";var digest4=z80.string().regex(/^sha256:[a-f0-9]{64}$/);var ReceiptAcceptanceInputSchema=FederationScopeSchema.extend({bindingId:z80.uuid().toLowerCase(),expectedRevision:z80.int().positive(),expectedSource:ReceiptInboundBindingSchema.shape.installationSource.optional(),expectedDigest:digest4.optional()}).strict();function createReceiptAcceptanceDocument(raw){const b=CurrentReceiptInboundBindingSchema.parse(raw);return{contract:"nvs-receipt-acceptance/1",bindingId:b.bindingId,bindingRevision:b.revision,tenantId:b.tenantId,productionId:b.productionId,routeId:b.routeId,receiver:{serviceRef:"native-video-studio",source:b.installationSource,consumerRef:b.consumerRef},wire:{specversion:"1.0",profile:"eventsdk/1.1",kind:"RECEIPT",source:b.source,serviceorigin:b.remoteService,sourcetenant:b.remoteTenant,audience:"native-video-studio",type:b.peerType,dataschema:PEER_RECEIPT_SCHEMA,datacontenttype:"application/json",connectionref:b.connectionRef,grantref:b.grantRef,grantversion:b.grantVersion},notBefore:b.notBefore,expiresAt:b.expiresAt,dataSchema:z80.record(z80.string(),z80.json()).parse(z80.toJSONSchema(PeerTerminalReceiptSchema.extend({originSource:z80.literal(b.installationSource),consumerRef:z80.literal(b.peerConsumerRef),targetScope:z80.literal(b.peerTargetScope)}),{target:"draft-2020-12",io:"input"})),association:{rule:"EXACT_ATTEMPTED_NATIVE_OUTBOX_DELIVERY",resourcenamespace:PUBLISHED_DELIVERY_NAMESPACE,resourceRefPrefix:PUBLISHED_DELIVERY_PREFIX,resourceRefComponents:["deliveryId","fullEnvelopeSha256"],resourceRefDelimiter:":",resourceRefPattern:"^"+PUBLISHED_DELIVERY_PREFIX+"[a-f0-9]{64}:[a-f0-9]{64}$",digestAlgorithm:"SHA-256",digestEncoding:"LOWERCASE_HEX",correlationid:"ORIGINAL_NATIVE_EVENT_ID",causationid:"ORIGINAL_NATIVE_EVENT_ID",originEventId:"ORIGINAL_NATIVE_EVENT_ID"},sourceProof:{profile:"eventsdk-origin/1",required:true},maxWireBytes:32768,meaning:"PEER_REPORTED_ONLY",qualification:"NVS_RECEIVER_POLICY_ONLY"}}var boundedDocument=z80.unknown().refine(v=>{try{canonicalFederationReadJson(v);return true}catch{return false}}).pipe(z80.record(z80.string(),z80.json()));var ReceiptAcceptanceSchema=FederationScopeSchema.extend({contract:z80.literal("nvs-receipt-acceptance/1"),source:ReceiptInboundBindingSchema.shape.installationSource,binding:ReceiptInboundBindingSchema,status:z80.enum(["POLICY_ACTIVE","NOT_ACTIVE"]),document:boundedDocument.nullable(),digest:digest4.nullable(),maxDocumentBytes:z80.literal(65536),qualification:z80.literal("NVS_RECEIVER_POLICY_ONLY")}).strict().refine(v=>{try{const b=v.binding;if(b.tenantId!==v.tenantId||b.productionId!==v.productionId||b.installationSource!==v.source)return false;if(b.contractVersion!==2||b.effective!=="ACTIVE")return v.status==="NOT_ACTIVE"&&v.document===null&&v.digest===null;return v.status==="POLICY_ACTIVE"&&v.document!==null&&v.digest!==null&&canonicalFederationReadJson(v.document)===canonicalFederationReadJson(createReceiptAcceptanceDocument(b))}catch{return false}});var ReceiptHandoffInputSchema=FederationDeliveryInspectInputSchema.omit({receiptBindingId:true,expectedDigest:true,expectedSource:true}).extend({bindingId:ReceiptAcceptanceInputSchema.shape.bindingId,expectedRevision:ReceiptAcceptanceInputSchema.shape.expectedRevision,expectedSource:ReceiptInboundBindingSchema.shape.installationSource,expectedDeliveryDigest:FederationDeliveryInspectInputSchema.shape.deliveryId,expectedAcceptanceDigest:ReceiptAcceptanceInputSchema.shape.expectedDigest}).strict();function receiptHandoffStatus(i,a){if(i.receiptStatus==="PEER_REPORTED")return"PEER_REPORTED";if(i.delivery.attempts===0)return"ORIGINAL_NOT_ATTEMPTED";if(a.status!=="POLICY_ACTIVE")return"POLICY_NOT_ACTIVE";return"AWAITING_PEER_REPORT"}function receiptBindingInObservedWindow(i){const b=i.receiptBinding,observed=Date.parse(i.asOf);return b!==null&&Date.parse(b.notBefore)<=observed&&observed<Date.parse(b.expiresAt)}function association(i){return{resourcenamespace:PUBLISHED_DELIVERY_NAMESPACE,resourceref:publishedDeliveryReceiptRef(i.delivery.deliveryId,i.delivery.digest),correlationid:i.delivery.eventId,causationid:i.delivery.eventId}}var reply=FederationScopeSchema.extend({contract:z81.literal("nvs-receipt-handoff/1"),source:ReceiptInboundBindingSchema.shape.installationSource,inspection:FederationDeliveryInspectionSchema,acceptance:ReceiptAcceptanceSchema,status:z81.enum(["PEER_REPORTED","ORIGINAL_NOT_ATTEMPTED","POLICY_NOT_ACTIVE","AWAITING_PEER_REPORT"]),association:z81.strictObject({resourcenamespace:z81.literal(PUBLISHED_DELIVERY_NAMESPACE),resourceref:z81.string().min(1).max(256),correlationid:z81.uuid().toLowerCase(),causationid:z81.uuid().toLowerCase()}).nullable(),maxReplyBytes:z81.literal(131072),qualification:z81.literal("NVS_READ_SNAPSHOT_ONLY")}).strict().refine(v=>{try{const i=v.inspection,a=v.acceptance;if(!i.receiptBinding||i.source!==v.source||a.source!==v.source||i.tenantId!==v.tenantId||i.productionId!==v.productionId||a.tenantId!==v.tenantId||a.productionId!==v.productionId||a.status==="POLICY_ACTIVE"&&!receiptBindingInObservedWindow(i)||canonicalFederationReadJson(i.receiptBinding)!==canonicalFederationReadJson(a.binding)||v.status!==receiptHandoffStatus(i,a))return false;return v.status==="AWAITING_PEER_REPORT"?canonicalFederationReadJson(v.association)===canonicalFederationReadJson(association(i)):v.association===null}catch{return false}});var ReceiptHandoffSchema=z81.unknown().refine(v=>{try{canonicalFederationCatalogJson(v);return true}catch{return false}},{abort:true}).pipe(reply);var federationReceiptInboundOperations={"federation.receipt-inbound.handoff":federationPost(ReceiptHandoffInputSchema,ReceiptHandoffSchema,"receipt-inbound-handoff",true,[["bindingId","acceptance.binding.bindingId"],["routeId","inspection.delivery.routeId"],["eventId","inspection.delivery.eventId"],["deliveryId","inspection.delivery.deliveryId"]]),"federation.receipt-inbound.contract":federationPost(ReceiptAcceptanceInputSchema,ReceiptAcceptanceSchema,"receipt-inbound-contract",true,[["bindingId","binding.bindingId"]]),"federation.receipt-inbound.configure":federationPost(ReceiptInboundConfigureSchema,CurrentReceiptInboundBindingSchema,"receipt-inbound-configure",false,[["bindingId","bindingId"],["routeId","routeId"]]),"federation.receipt-inbound.catalog":federationPost(FederationScopeSchema,ReceiptInboundCatalogSchema,"receipt-inbound-catalog",true),"federation.receipt-inbound.query":federationPost(ReceiptInboundQuerySchema,ReceiptInboundQueryResultSchema,"receipt-inbound-query",true,[["kind","kind"]]),"federation.receipt-inbound.command":federationPost(ReceiptInboundCommandInputSchema,ReceiptInboundCommandSchema,"receipt-inbound-command",true)};var federationDeliveryInspectionOperations={"federation.delivery.inspect":federationPost(FederationDeliveryInspectInputSchema,FederationDeliveryInspectionSchema,"delivery-inspect",true,[["routeId","delivery.routeId"],["eventId","delivery.eventId"],["deliveryId","delivery.deliveryId"]])};var federationOperations={...federationEventLinkOperations,...federationDeliveryInspectionOperations,...federationReceiptInboundOperations,...federationExchangeOperations,"federation.inbound.catalog":federationPost(FederationScopeSchema,InboundCatalogSchema,"inbound-catalog",true),"federation.inbound.configure":federationPost(InboundBindingConfigureSchema,CurrentInboundBindingSchema,"inbound-configure",false,[["bindingId","bindingId"],["source","source"]]),"federation.inbound.query":federationPost(InboundQuerySchema,InboundQueryResultSchema,"inbound-query",true,[["kind","kind"]]),"federation.inbound.signals":federationPost(InboundSignalsQuerySchema,InboundSignalsPageSchema,"inbound-signals",true),"federation.inbound.signal-changes":federationPost(InboundSignalChangesQuerySchema,InboundSignalChangesPageSchema,"inbound-signal-changes",true),"federation.inbound.receipt":federationPost(InboundReceiptInputSchema,InboundReceiptSchema,"inbound-receipt",true,[["kind","kind"]]),"federation.inbound.replay":federationPost(InboundReplaySchema,InboundReplayResultSchema,"inbound-replay",false,[["inboxId","inboxId"],["requestId","requestId"]]),"federation.observe":federationPost(FederationScopeSchema,FederationObservationSchema,"observe",true),"federation.recover":federationPost(FederationRecoverSchema,FederationRecoverySchema,"recover",false,[["routeId","routeId"],["requestId","requestId"],["kind","kind"]]),"federation.catalog":federationPost(FederationScopeSchema,FederationCatalogSchema,"catalog",true),"federation.event-definitions":federationPost(FederationScopeSchema,FederationEventDefinitionsSchema,"event-definitions",true),"federation.route.configure":federationPost(FederationRouteConfigureSchema,FederationRouteSchema,"route-configure",false,[["routeId","routeId"],["grantRef","grantRef"],["grantVersion","grantVersion"],["remoteService","remoteService"],["remoteTenant","remoteTenant"]]),"federation.subscription.set":federationPost(FederationSubscriptionSetSchema,FederationSubscriptionResultSchema,"subscription-set",false,[["subscriptionId","subscription.subscriptionId"],["routeId","subscription.routeId"],["subscriberKind","subscription.subscriberKind"],["subscriberRef","subscription.subscriberRef"]]),"federation.subscription.get":federationPost(FederationSubscriptionGetSchema,FederationSubscriptionResultSchema,"subscription-get",true,[["subscriptionId","subscription.subscriptionId"]]),"federation.query":federationPost(FederationQuerySchema,FederationQueryResultSchema,"query",true,[["kind","kind"]]),"federation.receipt":federationPost(FederationReceiptInputSchema,FederationReceiptSchema,"receipt",true,[["requestId","requestId"]])};var renderTicket=resource=>operation(TenantRenderMediaInputSchema,TenantRenderMediaTicketSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,resource,i.renderId,"media-ticket"),query:{role:i.role}}),[["renderId","renderId"],["role","role"],["role","ticket.object.role"]],{readOnly:true});var mediaDescriptorOperations={"rough-cut.media-ticket":renderTicket("rough-cuts"),"final-render.media-ticket":renderTicket("final-renders"),"composition.render.media-target":descriptorOperation(CompositionRenderGetSchema,CompositionRenderMediaDescriptorSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,"compositions","renders",i.renderId,"media-target")}),i=>path("productions",i.productionId,"compositions","renders",i.renderId,"media")),"delivery.download":descriptorOperation(TimelineScopeSchema,InterfaceDeliveryDownloadDescriptorSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,"deliveries","download")}),(i,o)=>o.method==="POST"?tenantMediaDownloadPath:path("productions",i.productionId,"deliveries","media")),"temporal-evidence.download":descriptorOperation(TemporalEvidenceMediaSchema,InterfaceDownloadDescriptorSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,"temporal-evidence",i.evidenceId,"media",i.kind,"descriptor"),query:i.kind==="FRAME"?{ordinal:i.ordinal}:{}}),i=>path("productions",i.productionId,"temporal-evidence",i.evidenceId,"media",i.kind)+(i.kind==="FRAME"?"?ordinal="+i.ordinal:"")),"video.options":operation(VideoOptionsInputSchema,VideoOptionsSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("video-options")}),[],{readOnly:true})};var referencePreviewOperations={"studio.capabilities":mcpOperation(StudioCapabilitiesInputSchema,StudioCapabilitiesSchema,true),"reference-preview.start":operation(StartReferencePreviewSchema,ReferencePreviewAdmissionSchema,i=>{const{tenantId,productionId,...body}=i;return{method:"POST",tenantId,path:path("productions",productionId,"reference-previews"),body}},[["sourceArtifactId","sourceArtifactId"],["expectedBriefVersion","briefVersion"]],{readOnly:false}),"reference-preview.status":operation(ReferencePreviewOperationInputSchema,OperationSummarySchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,"reference-previews",i.operationId,"status"),query:{projectId:i.projectId}}),[["operationId","id"]],{readOnly:true}),"reference-preview.get":operation(ReferencePreviewOperationInputSchema,ReferencePreviewReadResultSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,"reference-previews",i.operationId),query:{projectId:i.projectId}}),[],{readOnly:true}),"reference-preview.cancel":operation(ReferencePreviewOperationInputSchema,ReferencePreviewCancelResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:path("productions",i.productionId,"reference-previews",i.operationId,"cancel"),body:{projectId:i.projectId}}),[],{readOnly:false})};var Context6=ExplorationContextInputSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Plan=ValidateExplorationPlanSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.tenantId.toLowerCase());var Compare2=ExplorationCompareInputSchema.extend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Recommendation=ExplorationRecommendationContextInputSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.scope.tenantId.toLowerCase());var Validate5=ValidateExplorationRecommendationSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.input.scope.tenantId.toLowerCase());var route3=(s,family,...suffix)=>path("projects",s.projectId,"productions",s.productionId,family,...suffix);var ownerOperations={"exploration.context":operation(Context6,ExplorationContextResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:route3(i.scope,"visual-exploration","context"),body:{scope:i.scope,preparationIds:i.preparationIds}}),[["scope.tenantId","basis.tenantId","SUCCESS"],["scope.projectId","basis.projectId","SUCCESS"],["scope.productionId","basis.productionId","SUCCESS"],["scope.shotId","basis.shotId","SUCCESS"]],{readOnly:true}),"exploration.plan.validate":operation(Plan,ExplorationValidationResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:route3(i.basis,"visual-exploration","plans","validate"),body:{basis:i.basis,plan:i.plan}}),[["basis","basis","SUCCESS"]],{readOnly:true}),"exploration.compare":operation(Compare2,ExplorationComparisonResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:route3(i.scope,"visual-exploration","compare"),body:{scope:i.scope,items:i.items}}),[["scope","scope"]],{readOnly:true}),"exploration.recommendation.context":operation(Recommendation,ExplorationRecommendationContextResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:route3(i.scope,"exploration-recommendation","context"),body:{scope:i.scope,items:i.items,criteria:i.criteria}}),[["scope","basis.input.scope"],["items","basis.input.items"],["criteria","basis.input.criteria"]],{readOnly:true}),"exploration.recommendation.validate":operation(Validate5,ExplorationRecommendationValidationResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:route3(i.basis.input.scope,"exploration-recommendation","proposals","validate"),body:{basis:i.basis,proposal:i.proposal}}),[["basis","basis"],["proposal.decision.kind","decision.kind"],["proposal.decision.label","decision.label"]],{readOnly:true})};var visualExplorationOperations=ownerOperations;import{z as z82}from"zod";var ownerOperations2={"imported-visual.query":productionRead(ImportedVisualOriginalQuerySchema,ImportedVisualOriginalPageSchema,()=>["imported-visuals","originals"],i=>({limit:i.limit,afterSourceId:i.afterSourceId,shotId:i.shotId}),[["shotId","items.*.shotId"]]),"imported-visual.register-source":productionWrite(LegacyImportedVisualProjectSourceSchema,ImportedVisualOriginalViewSchema,()=>["imported-visuals","originals","from-source"],{identity:[["projectId","projectId"],["shotId","shotId"]]}),"imported-visual.start-from-source":productionWrite(ImportedVisualFromProjectSourceSchema,DirectOriginalSubmitSchema,()=>["imported-visuals","originals","from-source","v1"]),"imported-visual.register":operation(LegacyImportedVisualUploadSchema,ImportedVisualOriginalViewSchema,i=>{const{contentBase64,tenantId,productionId,...fields}=i;return{method:"POST",tenantId,path:path("productions",productionId,"imported-visuals","originals","bytes"),importedVideo:{bytes:Buffer.from(contentBase64,"base64"),metadata:Buffer.from(JSON.stringify(fields)).toString("base64url")}}},[["shotId","shotId"]]),"imported-visual.revise":productionWrite(LegacyImportedVisualRevisionSchema,ImportedVisualOriginalViewSchema,i=>["imported-visuals","originals",i.sourceId,"revisions"],{pathFields:["sourceId"],identity:[["sourceId","sourceId"],["shotId","shotId"]]}),"imported-visual.original":productionRead(ImportedVisualOriginalGetSchema,ImportedVisualOriginalViewSchema,i=>["imported-visuals","originals",i.sourceId],i=>({version:i.version}),[["sourceId","sourceId"],["version","version"]]),"imported-visual.history":productionRead(ImportedVisualOriginalHistoryQuerySchema,ImportedVisualOriginalHistorySchema,i=>["imported-visuals","originals",i.sourceId,"history"],i=>({limit:i.limit,beforeVersion:i.beforeVersion}),[["sourceId","sourceId"],["sourceId","items.*.sourceId"]]),"imported-visual.normalize":productionWrite(ImportedVisualNormalizeStartSchema,ImportedVisualAdmissionSchema,()=>["imported-visuals","normalizations"],{identity:[["sourceId","sourceId"],["sourceVersionId","sourceVersionId"]]}),"imported-visual.get":productionRead(ImportedVisualGetSchema,ImportedVisualNormalizationViewSchema,i=>["imported-visuals","normalizations",i.normalizationId],void 0,[["normalizationId","normalizationId"]]),"imported-visual.review.target":productionRead(ImportedVisualGetSchema,ImportedVisualReviewTargetSchema,i=>["imported-visuals","normalizations",i.normalizationId,"review-target"],void 0,[["normalizationId","normalizationId"]]),"imported-visual.review.record":productionWrite(ImportedVisualReviewSchema,ImportedVideoReviewReceiptSchema,i=>["imported-visuals","normalizations",i.normalizationId,"reviews"],{pathFields:["normalizationId"],identity:[["normalizationId","review.normalizationId"],["representationId","review.representationId"],["checksumSha256","review.checksumSha256"]]}),"imported-visual.decide":productionWrite(ImportedVisualDecisionSchema,ShotDecisionReceiptSchema,i=>["imported-visuals","normalizations",i.normalizationId,"decisions"],{pathFields:["normalizationId"],identity:[["normalizationId","decision.normalizationId"],["reviewId","decision.reviewId"]]}),"imported-visual.cancel":productionWrite(ImportedVisualGetSchema,z82.strictObject({cancellationRequested:z82.boolean()}),i=>["imported-visuals","normalizations",i.normalizationId,"cancel"],{pathFields:["normalizationId"]})};var importedVisualOperations=ownerOperations2;var versionPath=i=>["source-sync-audios","shots",i.shotId,"versions",i.versionId];var ownerOperations3={"source-sync.start":productionWrite(SourceSyncRuntimeStartSchema,SourceSyncRuntimeAdmissionSchema,()=>["source-sync-audios","requests"]),"source-sync.get":productionRead(SourceSyncRuntimeScopeSchema,SourceSyncRuntimeViewSchema,i=>["source-sync-audios","requests",i.requestId],void 0,[["requestId","requestId"]]),"source-sync.cancel":productionWrite(SourceSyncRuntimeScopeSchema,ImportedVisualCancellationSchema,i=>["source-sync-audios","requests",i.requestId,"cancel"],{pathFields:["requestId"]}),"source-sync.audio":productionRead(SourceSyncAudioGetSchema,WavExportResultSchema,i=>[...versionPath(i),"audio"]),"source-sync.version":productionRead(SourceSyncAudioGetSchema,SourceSyncAudioViewSchema,versionPath,void 0,[["versionId","version.id"],["shotId","version.shotId"]]),"source-sync.review.target":productionRead(SourceSyncAudioGetSchema,SourceSyncReviewTargetSchema,i=>[...versionPath(i),"review-target"],void 0,[["versionId","version.id"],["shotId","version.shotId"]]),"source-sync.review.record":productionWrite(SourceSyncReviewInputSchema,SourceSyncReviewRecordSchema,i=>[...versionPath(i),"reviews"],{pathFields:["shotId","versionId"],identity:[["versionId","versionId"],["shotId","shotId"],["audio","audio"],["visual","visual"]]}),"source-sync.review.get":productionRead(SourceSyncReviewGetSchema,SourceSyncReviewRecordSchema,i=>[...versionPath(i),"reviews",i.reviewId],void 0,[["versionId","versionId"],["shotId","shotId"],["reviewId","id"]])};var sourceSyncOperations=ownerOperations3;var Writer=ValidateWriterProposalSchema.extend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.tenantId.toLowerCase());var Director=ValidateDirectorProposalSchema.safeExtend({tenantId:TenantIdSchema}).refine(i=>i.tenantId.toLowerCase()===i.basis.tenantId.toLowerCase());var projectProduction2=(scope7,...suffix)=>path("projects",scope7.projectId,"productions",scope7.productionId,...suffix);var planningIntelligenceOperations={"brief.active":operation(WriterScopeSchema,WriterBriefResultSchema,i=>({method:"GET",tenantId:i.tenantId,path:projectProduction2(i,"brief-versions","active")})),"writer.validate":operation(Writer,WriterValidationResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:projectProduction2(i.basis,"writer-proposals","validate"),body:{basis:i.basis,proposal:i.proposal,...i.revisionReason?{revisionReason:i.revisionReason}:{}}}),[["basis","basis","SUCCESS"]],{readOnly:true}),"director.context":operation(DirectorScopeSchema,DirectorContextResultSchema,i=>({method:"GET",tenantId:i.tenantId,path:projectProduction2(i,"director","context")})),"director.validate":operation(Director,DirectorValidationResultSchema,i=>({method:"POST",tenantId:i.tenantId,path:projectProduction2(i.basis,"director-proposals","validate"),body:{basis:i.basis,proposal:i.proposal,...i.revisionReason?{revisionReason:i.revisionReason}:{}}}),[["basis","basis","SUCCESS"]],{readOnly:true}),"consistency-profile.get":productionRead(ConsistencyProfileScopeSchema,ConsistencyProfileViewSchema,()=>["consistency-profile"]),"consistency-profile.version":productionRead(ConsistencyProfileVersionQuerySchema,ConsistencyProfileVersionSchema,i=>["consistency-profile","versions",i.profileId],void 0,[["profileId","id"]]),"consistency-profile.configure":productionWrite(ConfigureConsistencyProfileSchema,ConsistencyProfileReceiptSchema,()=>["consistency-profile"],{tenantInBody:true})};var audioCaptionOperations={"caption.transcript_draft":productionWrite(CaptionTranscriptPlanSchema,CaptionTranscriptDraftSchema,()=>["captions","transcript-draft"],{readOnly:true}),"caption.author_transcript":productionWrite(AuthorTranscriptCaptionsSchema,CaptionReceiptSchema,()=>["captions","from-transcript"]),"audio.export":operation(AudioGetSchema,AudioExportResultSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,"audio",i.purpose,"versions",i.versionId,"export-data")}),[],{readOnly:true}),"caption.export":operation(CaptionExportSchema,CaptionExportResultSchema,i=>({method:"GET",tenantId:i.tenantId,path:path("productions",i.productionId,"captions","versions",i.versionId,"export-data"),query:{format:i.format}}),[],{readOnly:true}),"audio.basis":productionRead(AudioReadScopeSchema,AudioBasisSchema,i=>["audio",i.purpose,"basis"],void 0,[["purpose","purpose"]]),"audio.current":productionRead(AudioReadScopeSchema,AudioViewSchema,i=>["audio",i.purpose,"current"],void 0,[["purpose","version.purpose"]]),"audio.get":productionRead(AudioGetSchema,AudioViewSchema,i=>["audio",i.purpose,"versions",i.versionId],void 0,[["versionId","version.id"],["purpose","version.purpose"]]),"audio.query":productionRead(AudioQuerySchema,AudioPageSchema,i=>["audio",i.purpose,"versions"],pageQuery,[["purpose","items.*.version.purpose"]]),"audio.import":productionWrite(AudioImportRequestSchema,AudioReceiptSchema,i=>["audio",i.purpose],{pathFields:["purpose"],identity:[["purpose","version.purpose"]]}),"caption.basis":productionRead(CaptionScopeSchema,CaptionBasisSchema,()=>["captions","basis"]),"caption.current":productionRead(CaptionScopeSchema,CaptionViewSchema,()=>["captions","current"]),"caption.get":productionRead(CaptionGetSchema,CaptionViewSchema,i=>["captions","versions",i.versionId],void 0,[["versionId","version.id"]]),"caption.query":productionRead(CaptionQuerySchema,CaptionPageSchema,()=>["captions","versions"],pageQuery),"caption.author":productionWrite(AuthorCaptionsSchema,CaptionReceiptSchema,()=>["captions"])};var discoveryOperations={"artifact.query":operation(ArtifactDiscoveryQuerySchema,ArtifactDiscoveryPageSchema,input=>({method:"GET",tenantId:input.tenantId,path:path("artifact-discovery"),query:{...pageQuery(input),projectId:input.projectId,productionId:input.productionId,artifactId:input.artifactId,mediaCategory:input.mediaCategory,family:input.family,search:input.search,lifecycle:input.lifecycle}}),[["artifactId","items.*.artifactId"]])};var temporalEvidenceOperations={"temporal-evidence.read-video":productionWrite(OriginalVideoReadSchema,OriginalVideoResultSchema,()=>["temporal-evidence","original-video"],{tenantInBody:true,readOnly:true,identity:[["tenantId","source.tenantId"],["productionId","source.productionId"],["artifactId","source.artifactId"],["representationId","source.representationId"],["checksumSha256","source.checksumSha256"]]}),"temporal-evidence.target":productionWrite(TemporalEvidenceTargetSchema,TemporalEvidenceSourceSchema,()=>["temporal-evidence","target"],{tenantInBody:true,readOnly:true,identity:[["artifactId","artifactId"],["representationId","representationId"],["checksumSha256","checksumSha256"]]}),"temporal-evidence.start":productionWrite(TemporalEvidenceStartSchema,TemporalEvidenceAdmissionSchema,()=>["temporal-evidence"],{tenantInBody:true,identity:[["artifactId","source.artifactId"],["representationId","source.representationId"],["checksumSha256","source.checksumSha256"]]}),"temporal-evidence.get":productionRead(TemporalEvidenceGetSchema,TemporalEvidenceViewSchema,i=>["temporal-evidence",i.evidenceId],void 0,[["evidenceId","evidenceId"]]),"temporal-evidence.cancel":productionWrite(TemporalEvidenceGetSchema,cancellation,i=>["temporal-evidence",i.evidenceId,"cancel"],{pathFields:["evidenceId"]})};function seriesPath(projectId,...suffix){return path("projects",projectId,"series-standards",...suffix)}var seriesPost=(group,...suffix)=>({tenantId,projectId,...body})=>({method:"POST",tenantId,path:seriesPath(projectId,group,...suffix),body});var seriesStandardOperations={"series.list":operation(SeriesStandardListSchema,SeriesStandardPageSchema,i=>({method:"GET",tenantId:i.tenantId,path:seriesPath(i.projectId),query:{after:i.after,limit:i.limit}})),"series.get":operation(SeriesStandardQuerySchema,SeriesStandardVersionSchema,i=>({method:"GET",tenantId:i.tenantId,path:seriesPath(i.projectId,i.seriesId),query:{version:i.version}}),[["seriesId","seriesId"],["version","version"]]),"series.publish":operation(PublishSeriesStandardSchema,PublishSeriesStandardReceiptSchema,({tenantId,projectId,...body})=>({method:"POST",tenantId,path:seriesPath(projectId),body}),[["seriesId","standard.seriesId"],["idempotencyKey","idempotencyKey"],["brand.ownerProjectId","standard.brand.ownerProjectId"],["brand.brandId","standard.brand.brandId"],["brand.version","standard.brand.version"],["brand.grantId","standard.brand.grantId"],["brand.variantId","standard.brand.variantId"],["brand.selectedClaimIds","standard.brand.selectedClaimIds"]]),"series.bind":operation(BindSeriesStandardSchema,BindSeriesStandardReceiptSchema,({tenantId,projectId,...body})=>({method:"POST",tenantId,path:seriesPath(projectId,"bindings"),body}),[["seriesId","binding.standard.seriesId"],["version","binding.standard.version"],["characterVariantIds","binding.characterVariantIds"],["idempotencyKey","idempotencyKey"]]),"series.binding":operation(ProductionSeriesQuerySchema,ProductionSeriesBindingSchema,i=>({method:"GET",tenantId:i.tenantId,path:seriesPath(i.projectId,"bindings",i.productionId),query:{productionRevision:i.productionRevision,atRevision:i.atRevision}}),[["productionRevision","productionRevision"]]),"series.receipt":operation(SeriesStandardReceiptQuerySchema,SeriesStandardReceiptSchema,({tenantId,projectId,idempotencyKey:idempotencyKey2})=>({method:"POST",tenantId,path:seriesPath(projectId,"receipts","query"),body:{idempotencyKey:idempotencyKey2}}),[["idempotencyKey","idempotencyKey"]],{readOnly:true}),"series.canon.record":operation(RecordSeriesCanonSchema,SeriesCanonSchema,seriesPost("canon","record"),[["idempotencyKey","idempotencyKey"],["seriesId","seriesId"],["branchId","branchId"],["bindingRevision","bindingRevision"],["seriesVersion","seriesVersion"],["relation","relation"]]),"series.canon.get":operation(SeriesCanonQuerySchema,SeriesCanonSchema,seriesPost("canon","query"),[["seriesId","seriesId"],["branchId","branchId"],["ordinal","ordinal"]],{readOnly:true}),"series.canon.receipt":operation(SeriesCanonReceiptQuerySchema,SeriesCanonSchema,seriesPost("canon","receipts","query"),[["idempotencyKey","idempotencyKey"]],{readOnly:true}),"series.improvement.command":operation(SeriesImprovementCommandSchema,SeriesImprovementReceiptSchema,seriesPost("improvements","commands"),[["action","action"],["seriesId","seriesId"],["proposalId","proposalId"],["idempotencyKey","idempotencyKey"],["baseVersion","proposal.baseVersion"]]),"series.improvement.query":operation(SeriesImprovementQuerySchema,SeriesImprovementViewSchema,seriesPost("improvements","query"),[["action","action"],["seriesId","seriesId"],["proposalId","proposalId"]],{readOnly:true}),"series.improvement.receipt":operation(SeriesImprovementReceiptQuerySchema,SeriesImprovementReceiptSchema,seriesPost("improvements","receipts","query"),[["idempotencyKey","idempotencyKey"]],{readOnly:true})};function improvementResponseMatches(value){const root=value;const sameScope=item=>item.tenantId===root.tenantId&&item.projectId===root.projectId&&item.seriesId===root.seriesId;if(root.action==="LIST")return root.items.every(sameScope);const{proposal,decision}=root;return sameScope(proposal)&&proposal.proposalId===root.proposalId&&(root.action==="GET"||(root.action==="PROPOSE"?decision===null:decision?.action===root.action))&&(!decision||sameScope(decision)&&decision.proposalId===proposal.proposalId&&(decision.action==="DECLINE"||sameScope(decision.published)&&decision.published.version===proposal.baseVersion+1))}function assertSeriesResponseVersions(operation2,input,result){if(operation2==="series.binding"&&typeof input.atRevision==="number"){if(result.productionRevision<=input.atRevision)return;throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}if(operation2==="series.publish"){const receipt=result;if(receipt.standard.version===Number(input.expectedVersion)+1)return}else if(operation2==="series.bind"){const{binding}=result;if(binding.productionRevision===Number(input.expectedProductionRevision)+1&&binding.profileVersion===Number(input.expectedProfileVersion)+1)return}else if(operation2==="series.canon.record"){if(result.ordinal===Number(input.expectedHeadOrdinal)+1)return}else if(operation2.startsWith("series.improvement.")){if(improvementResponseMatches(result))return;if(operation2!=="series.improvement.command")throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}else return;throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}function brandRequest(suffix){return({tenantId,projectId,...body})=>({method:"POST",tenantId,path:path("projects",projectId,"series-standards","brand",...suffix),body})}var enterpriseBrandOperations={"series.brand.command":operation(EnterpriseBrandCommandSchema,EnterpriseBrandReceiptSchema,brandRequest(["commands"]),[["action","action"],["idempotencyKey","idempotencyKey"]]),"series.brand.get":operation(EnterpriseBrandQuerySchema,EnterpriseBrandViewSchema,brandRequest(["query"]),[["action","action"]],{readOnly:true}),"series.brand.receipt":operation(EnterpriseBrandReceiptQuerySchema,EnterpriseBrandReceiptSchema,brandRequest(["receipts","query"]),[["idempotencyKey","idempotencyKey"]],{readOnly:true})};var sameUuid=(left,right)=>typeof right==="string"&&left.toLowerCase()===right.toLowerCase();function assertEnterpriseBrandResponse(key6,input,value){if(!Object.hasOwn(enterpriseBrandOperations,key6))return;const output=value;const owner="publication"in output?output.publication:output.grant;const ownerProjectId=input.ownerProjectId??input.projectId;const variantIds=Array.isArray(input.variantIds)?input.variantIds:void 0;const grantMatches=!("grant"in output)||(input.grantId===void 0||sameUuid(output.grant.grantId,input.grantId))&&(input.consumerProjectId===void 0||sameUuid(output.grant.consumerProjectId,input.consumerProjectId))&&(input.expiresAt===void 0||output.grant.expiresAt===input.expiresAt)&&(!variantIds||output.grant.variantIds.length===variantIds.length&&output.grant.variantIds.every((id7,index)=>sameUuid(id7,variantIds[index])))&&(key6!=="series.brand.command"||output.grant.revokedAt!==null===(output.action==="REVOKE"))&&(key6!=="series.brand.get"||sameUuid(output.grant.projectId,input.projectId)||sameUuid(output.grant.consumerProjectId,input.projectId));const valid=sameUuid(owner.tenantId,input.tenantId)&&sameUuid(owner.projectId,ownerProjectId)&&(input.brandId===void 0||sameUuid(owner.brandId,input.brandId))&&(input.version===void 0||owner.version===input.version)&&(input.expectedVersion===void 0||owner.version===Number(input.expectedVersion)+1)&&grantMatches&&(output.action!=="PUBLICATION"||sameUuid(owner.projectId,input.projectId)||typeof output.grantId==="string"&&sameUuid(output.grantId,input.grantId));if(!valid)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE",key6==="series.brand.command"?"UNKNOWN":"NO_WRITE")}import{createHash as createHash7}from"node:crypto";import{z as z83}from"zod";var render=RoughCutGetSchema.omit({tenantId:true});var mediaInput=z83.discriminatedUnion("kind",[AudioGetSchema.omit({tenantId:true}).extend({kind:z83.literal("AUDIO")}),CaptionExportSchema.omit({tenantId:true}).extend({kind:z83.literal("CAPTION")}),ArtifactDiscoveryMediaSchema.omit({tenantId:true}).extend({kind:z83.literal("DISCOVERED_ARTIFACT"),contentType:DiscoveryContentTypeSchema}),AudioGetSchema.omit({tenantId:true}).extend({kind:z83.literal("AUDIO_WAV")}),CaptionGetSchema.omit({tenantId:true}).extend({kind:z83.enum(["CAPTION_JSON","CAPTION_SRT"])}),TemporalEvidenceGetSchema.omit({tenantId:true}).extend({kind:z83.literal("TEMPORAL_FRAME"),ordinal:z83.int().nonnegative().max(63)}),TemporalEvidenceGetSchema.omit({tenantId:true}).extend({kind:z83.enum(["TEMPORAL_SHEET","TEMPORAL_MANIFEST"])}),VideoGetInputSchema.omit({tenantId:true}).extend({kind:z83.enum(["VIDEO_GENERATION","VIDEO_GENERATION_POSTER"])}),render.extend({kind:z83.literal("CODE_VIDEO")}),render.extend({kind:z83.enum(["ROUGH_CUT_VIDEO","ROUGH_CUT_POSTER","FINAL_VIDEO","FINAL_POSTER"])}),TimelineScopeSchema.omit({tenantId:true}).extend({kind:z83.literal("DELIVERED_VIDEO")}),DeliveryManifestGetSchema.omit({tenantId:true}).extend({kind:z83.literal("DELIVERY_MANIFEST")})]);var expectedInput=z83.strictObject({checksumSha256:z83.string().regex(/^[0-9a-f]{64}$/),byteSize:z83.int().positive().max(128*1024*1024).optional()});async function readNativeMedia(transport,tenantId,raw,expected,options){if(!raw||raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==tenantId.toLowerCase()))sdkInputError();const parsed=mediaInput.safeParse(Object.fromEntries(Object.entries(raw).filter(([key6])=>key6!=="tenantId"))),identity4=expectedInput.safeParse({checksumSha256:expected?.checksumSha256,byteSize:expected?.byteSize});if(!parsed.success||!identity4.success)sdkInputError();const input=parsed.data;let suffix,contentType;if(input.kind==="DISCOVERED_ARTIFACT"){suffix=[];contentType=input.contentType}else if(input.kind==="AUDIO"||input.kind==="AUDIO_WAV"){suffix=["audio",input.purpose,"versions",input.versionId,"export"];contentType="audio/wav"}else if("versionId"in input){suffix=["captions","versions",input.versionId,"export"];contentType=(input.kind==="CAPTION"?input.format==="JSON":input.kind==="CAPTION_JSON")?"application/json":"application/x-subrip"}else if("evidenceId"in input){const kind=input.kind==="TEMPORAL_FRAME"?"FRAME":input.kind==="TEMPORAL_SHEET"?"SHEET":"MANIFEST";if(!TemporalEvidenceMediaSchema.safeParse({tenantId,productionId:input.productionId,evidenceId:input.evidenceId,kind,...input.kind==="TEMPORAL_FRAME"?{ordinal:input.ordinal}:{}}).success)sdkInputError();suffix=["temporal-evidence",input.evidenceId,"media",kind];contentType=kind==="MANIFEST"?"application/json":"image/png"}else if("generationId"in input){suffix=["video-generations",input.generationId,input.kind==="VIDEO_GENERATION"?"media":"poster"];contentType=input.kind==="VIDEO_GENERATION"?"video/mp4":"image/png"}else if(input.kind==="DELIVERED_VIDEO"){suffix=["deliveries","media"];contentType="video/mp4"}else if(input.kind==="CODE_VIDEO"){suffix=["compositions","renders",input.renderId,"media"];contentType="video/mp4"}else if(input.kind==="DELIVERY_MANIFEST"){suffix=["deliveries","manifests",input.manifestId,"download"];contentType="application/json"}else{const poster=input.kind.endsWith("POSTER");suffix=[input.kind.startsWith("ROUGH_CUT")?"rough-cuts":"final-renders",input.renderId,poster?"poster":"media"];contentType=poster?"image/png":"video/mp4"}const result=await transport.binary({method:"GET",tenantId,path:input.kind==="DISCOVERED_ARTIFACT"?path("projects",input.projectId,"artifacts",input.artifactId,"representations",input.representationId,"media"):path("productions",input.productionId,...suffix),...input.kind==="TEMPORAL_FRAME"?{query:{ordinal:input.ordinal}}:{},...input.kind==="CAPTION"?{query:{format:input.format}}:{},...input.kind==="CAPTION_JSON"||input.kind==="CAPTION_SRT"?{query:{format:input.kind==="CAPTION_JSON"?"JSON":"SRT"}}:{}},[contentType],Math.min(identity4.data.byteSize??128*1024*1024,input.kind==="AUDIO"||input.kind==="AUDIO_WAV"?12582912:input.kind.startsWith("CAPTION")?131072:128*1024*1024),options);const checksumSha256=createHash7("sha256").update(result.bytes).digest("hex");if(checksumSha256!==identity4.data.checksumSha256||identity4.data.byteSize!==void 0&&result.bytes.byteLength!==identity4.data.byteSize||result.etag&&result.etag!==`"${checksumSha256}"`)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{...result,checksumSha256}}var identity3=TenantMediaDownloadSchema.extend({checksumSha256:LocalDigestSchema,byteSize:MediaObjectVersionSchema.shape.byteSize});async function readImmutableMedia(transport,tenantId,raw,options={}){if(!raw||Object.hasOwn(raw,"tenantId"))sdkInputError();const input=identity3.safeParse({...raw,tenantId});if(!input.success)sdkInputError();const{checksumSha256,byteSize,...scope7}=input.data;const timeout=AbortSignal.timeout(12e4);const signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;const ticket=await transport.json({method:"POST",readOnly:true,tenantId,path:tenantMediaDownloadPath,body:scope7},MediaObjectTicketSchema,{signal});if(ticket.method!=="GET"||ticket.object.tenantId!==scope7.tenantId||ticket.object.projectId!==scope7.projectId||ticket.object.checksumSha256!==checksumSha256||ticket.object.byteSize!==byteSize)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{...await downloadImmutableObject(ticket,{signal}),representationId:scope7.representationId}}var sdkOperations=Object.freeze({...coreOperations,...deviceManagementOperations,...deviceLibraryOperations,...navigationOperations,...discoveryOperations,...agentHostOperations,...agentHostExecutionOperations,...nativeToolAuthorityOperations,...compositionOperations,...assemblyOperations,...editorOperations,...reviewerOperations,...repairStrategyOperations,...canonicalRepairOperations,...programmaticReviewOperations,...compositionSourceOperations,...programmaticExplorationOperations,...deliveryOperations,...shotPreparationOperations,...generationOperations,...keyframeReviewOperations,...videoReviewOperations,...providerOperations,...speechOperations,...voiceProfileOperations,...shareOperations,...voiceReviewOperations,...observationOperations,...soundMakingPlanOperations,...lifecycleEventOperations,...federationOperations,...temporalEvidenceOperations,...audioCaptionOperations,...planningIntelligenceOperations,...importedVisualOperations,...sourceSyncOperations,...visualExplorationOperations,...referencePreviewOperations,...mediaDescriptorOperations,...seriesStandardOperations,...enterpriseBrandOperations});var NativeStudioAgentClient=class{deviceRenders=new NativeStudioDeviceRenders(this);navigation=new NativeStudioNavigationFacade(this);tenantId;directSources;transport;constructor(config){const tenant2=TenantIdSchema.safeParse(config.tenantId);if(!tenant2.success)sdkInputError();this.tenantId=tenant2.data.toLowerCase();this.transport=new NativeStudioHttpTransport(config);this.directSources=new NativeStudioDirectSources(this.tenantId,this.transport)}async call(key6,raw,options={}){if(!Object.hasOwn(sdkOperations,key6)||!raw||typeof raw!=="object"||Array.isArray(raw))sdkInputError();if(raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==this.tenantId))sdkInputError();const spec=sdkOperations[key6];if(spec.request===null)throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","CAPABILITY_UNAVAILABLE","NO_WRITE");const parsed=spec.input.safeParse({...raw,tenantId:this.tenantId});if(!parsed.success)sdkInputError(inputIssues(parsed.error,spec.input));if((key6==="rough-cut.start"||key6==="final-render.start")&&"deviceExecution"in parsed.data&&DeviceRenderTargetSchema.safeParse(parsed.data.deviceExecution).data?.validationMode){try{const advertised=await this.transport.json({method:"GET",tenantId:this.tenantId,path:path("local-execution","tenant-media","capabilities")},TenantMediaCapabilitySchema,options);if(advertised.tenantId!==this.tenantId)throw Error()}catch{throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","BLOCKED","NO_WRITE")}}const request=spec.request(parsed.data);const result=await this.transport.json({...request,readOnly:spec.readOnly},spec.output,options);assertManagementReceipt(key6,parsed.data,result);assertResponseBindings(result,parsed.data,spec.identity,spec.readOnly?"GET":request.method,spec.expectedPath?spec.expectedPath(parsed.data,result):void 0,spec.identityWhenPresent);assertSeriesResponseVersions(key6,parsed.data,result);assertEnterpriseBrandResponse(key6,parsed.data,result);if(key6==="temporal-evidence.read-video")assertOriginalVideoBytes(result);if(key6==="reference-preview.get")assertPreviewBytes(result);if(key6==="source-sync.audio"||key6==="audio.export"||key6==="caption.export")assertExportBytes(result,key6==="caption.export"&&"format"in parsed.data?String(parsed.data.format):void 0);return result}async sourceMedia(raw,options={},expected){if(Object.hasOwn(raw,"tenantId"))sdkInputError();const parsed=SourceLibraryMediaSchema.safeParse({...raw,tenantId:this.tenantId});if(!parsed.success)sdkInputError();const input=parsed.data;const result=await this.transport.binary({method:"GET",tenantId:this.tenantId,path:path("projects",input.projectId,"source-artifacts",input.artifactId,"media")},["image/png","image/jpeg","image/webp","text/plain","application/json"],8*1024*1024,options);const checksumSha256=createHash8("sha256").update(result.bytes).digest("hex");if(result.etag&&result.etag!==`"${checksumSha256}"`||expected&&(expected.checksumSha256!==checksumSha256||expected.byteSize!==result.bytes.byteLength))throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{...result,checksumSha256}}media(input,expected,options={}){return readNativeMedia(this.transport,this.tenantId,input,expected,options)}immutableMedia(input,options={}){return readImmutableMedia(this.transport,this.tenantId,input,options)}async keyframeMedia(raw,expected,options={}){if(!raw||Object.hasOwn(raw,"tenantId")||!/^[a-f0-9]{64}$/.test(expected?.checksumSha256??"")||expected?.byteSize!==void 0&&(!Number.isSafeInteger(expected.byteSize)||expected.byteSize<1||expected.byteSize>8*1024*1024))sdkInputError();const parsed=KeyframeGetInputSchema.safeParse({...raw,tenantId:this.tenantId});if(!parsed.success)sdkInputError();const i=parsed.data,value=await this.transport.json({method:"GET",tenantId:this.tenantId,path:path("productions",i.productionId,"keyframe-generations",i.generationId,"media")},KeyframeMediaSchema,options);const bytes=Buffer.from(value.contentBase64,"base64"),checksumSha256=createHash8("sha256").update(bytes).digest("hex");if(bytes.toString("base64")!==value.contentBase64||bytes.length!==value.byteSize||checksumSha256!==value.checksumSha256||checksumSha256!==expected.checksumSha256||expected.byteSize!==void 0&&bytes.length!==expected.byteSize)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{bytes,checksumSha256,contentType:value.contentType}}};import{createHash as createHash9}from"node:crypto";import{z as z84}from"zod";var Input=z84.discriminatedUnion("kind",[KeyframeGetInputSchema.extend({kind:z84.literal("KEYFRAME")}),VideoGetInputSchema.extend({kind:z84.literal("VIDEO_POSTER")}),RoughCutGetSchema.extend({kind:z84.enum(["ROUGH_CUT_POSTER","FINAL_POSTER"])})]);var sdkImageMediaTools={KEYFRAME:"keyframe_media",VIDEO_POSTER:"video_poster",ROUGH_CUT_POSTER:"rough_cut_poster",FINAL_POSTER:"final_render_poster"};var Identity=z84.strictObject({checksumSha256:z84.string().regex(/^[0-9a-f]{64}$/),byteSize:z84.int().positive().max(16*1024*1024).optional()});var Metadata=KeyframeMediaSchema.omit({contentBase64:true});async function readMcpImageMedia(config,raw,expected,options){if(!raw||raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==config.tenantId))sdkInputError();const input=Input.safeParse({...raw,tenantId:config.tenantId}),identity4=Identity.safeParse(expected);if(!input.success||!identity4.success)sdkInputError();const{kind,...argumentsInput}=input.data;const timeout=AbortSignal.timeout(config.timeoutMs),signal=options.signal?AbortSignal.any([timeout,options.signal]):timeout;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let response;try{response=await abortable(config.client.callTool({name:sdkImageMediaTools[kind],arguments:argumentsInput},{signal,timeout:config.timeoutMs,nativeReadOnly:true}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{if(Buffer.byteLength(JSON.stringify(response),"utf8")>config.maxJsonBytes)throw Error();const envelope=z84.object({semanticStatus:InterfaceSemanticStatusSchema,data:z84.unknown().optional(),error:z84.object({code:z84.string()}).optional()}).parse(response.structuredContent);if(response.isError||envelope.semanticStatus!=="SUCCESS"){const status=["SUCCESS","ACCEPTED"].includes(envelope.semanticStatus)?"INTERNAL_OPERATIONAL_FAILURE":envelope.semanticStatus;throw new NativeStudioSdkError(envelope.error&&nativeFailureCodes.has(envelope.error.code)?envelope.error.code:status,status,"NO_WRITE")}const metadata=Metadata.parse(envelope.data),images=response.content.filter(c=>c.type==="image");if(images.length!==1||response.content.length!==1)throw Error();const block=images[0],bytes=Buffer.from(block.data,"base64"),checksumSha256=createHash9("sha256").update(bytes).digest("hex");if(bytes.toString("base64")!==block.data||bytes.length!==metadata.byteSize||block.mimeType!==metadata.contentType||checksumSha256!==metadata.checksumSha256||checksumSha256!==identity4.data.checksumSha256||identity4.data.byteSize!==void 0&&bytes.length!==identity4.data.byteSize)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{...metadata,bytes}}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}var sdkMcpTools=Object.freeze({"series.list":"series_list","series.get":"series_get","series.publish":"series_publish","series.bind":"series_bind","series.binding":"series_binding","series.receipt":"series_receipt","series.brand.command":"series_brand_command","series.brand.get":"series_brand_get","series.brand.receipt":"series_brand_receipt","series.canon.record":"series_canon_record","series.canon.get":"series_canon_get","series.canon.receipt":"series_canon_receipt","series.improvement.command":"series_improvement_command","series.improvement.query":"series_improvement_query","series.improvement.receipt":"series_improvement_receipt","federation.link.receiver":"federation_link_receiver","federation.link.targets":"federation_link_targets","federation.link.start":"federation_link_start","federation.link.get":"federation_link_get","federation.link.confirm":"federation_link_confirm","federation.link.cancel":"federation_link_cancel","federation.delivery.inspect":"federation_delivery_inspect","federation.receipt-inbound.configure":"federation_receipt_inbound_configure","federation.receipt-inbound.contract":"federation_receipt_inbound_contract","federation.receipt-inbound.handoff":"federation_receipt_inbound_handoff","federation.receipt-inbound.catalog":"federation_receipt_inbound_catalog","federation.receipt-inbound.query":"federation_receipt_inbound_query","federation.receipt-inbound.command":"federation_receipt_inbound_command","federation.catalog":"federation_catalog","federation.event-definitions":"federation_event_definitions","federation.observe":"federation_observe","federation.result.reference":"federation_result_reference","federation.result.read":"federation_result_read","federation.receipt-route.configure":"federation_receipt_route_configure","federation.receipt.query":"federation_receipt_query","federation.receipt.command":"federation_receipt_command","federation.receipt.recover":"federation_receipt_recover","federation.subscription.handoff":"federation_subscription_handoff","federation.subscription.contract":"federation_subscription_contract","federation.inbound.catalog":"federation_inbound_catalog","federation.inbound.configure":"federation_inbound_configure","federation.inbound.query":"federation_inbound_query","federation.inbound.signals":"federation_inbound_signals","federation.inbound.signal-changes":"federation_inbound_signal_changes","federation.inbound.receipt":"federation_inbound_receipt","federation.inbound.replay":"federation_inbound_replay","federation.recover":"federation_recover","federation.route.configure":"federation_route_configure","federation.subscription.set":"federation_subscription_set","federation.subscription.get":"federation_subscription_get","federation.query":"federation_query","federation.receipt":"federation_receipt","workspace.devices.list":"workspace_devices_list","device.status":"device_status","device.enroll":"device_enroll","device.enrollment.issue":"device_enrollment_issue","device.enrollment.lookup":"device_enrollment_lookup","device.revoke":"device_revoke","device.management-receipt":"device_management_receipt","workspace.get":"workspace_get","workspace.caller":"workspace_caller","workspace.status":"workspace_status","workspace.query":"workspace_query","device-library.query":"device_library_query","device-library.admit":"device_library_admit","device-library.receipt":"device_library_receipt","devices.list":"list_devices","studio.capability.groups":"studio_capability_groups","studio.capability.query":"studio_capability_query","studio.capability.invoke":"studio_capability_invoke","studio.start":"studio_start","studio.media.readiness":"studio_media_readiness","studio.capability.search":"studio_capability_search","studio.capability.describe":"studio_capability_describe","studio.navigate":"studio_navigate","sound-plan.context":"sound_plan_context","sound-plan.get":"sound_plan_get","sound-plan.validate":"sound_plan_validate","sound-plan.accept":"sound_plan_accept","media-observation.options":"media_observation_options","media-observation.start":"media_observation_start","media-observation.start-local":"media_observation_start_local","media-observation.get-local":"media_observation_get_local","media-observation.device.quote":"media_observation_device_quote","media-observation.device.start":"media_observation_device_start","media-observation.device.get":"media_observation_device_get","media-observation.get":"media_observation_get","media-observation.cancel":"media_observation_cancel","production-guidance.context":"production_guidance_context","speech.options":"speech_options","provider.model.get":"provider_model_get","speech.start":"speech_start","speech.device.quote":"speech_device_quote","speech.device.start":"speech_device_start","speech.start-local":"speech_start_local","speech.get-local":"speech_get_local","speech.get":"speech_get","speech.cancel":"speech_cancel","provider.model.query":"provider_model_catalog_query","provider.model.configure":"provider_model_configure","provider.model.disable":"provider_model_disable","artifact.query":"artifact_discovery_query","imported-visual.query":"imported_visual_query","imported-visual.start-from-source":"imported_visual_start_from_source","imported-visual.review.target":"imported_visual_review_target","imported-visual.review.record":"imported_visual_review","source-sync.review.target":"source_sync_review_target","source-sync.review.record":"source_sync_review","source-sync.review.get":"source_sync_review_get","temporal-evidence.read-video":"temporal_evidence_read_video","temporal-evidence.target":"temporal_evidence_target","temporal-evidence.start":"temporal_evidence_start","temporal-evidence.get":"temporal_evidence_get","temporal-evidence.cancel":"temporal_evidence_cancel","visual-sequence.register":"visual_sequence_register","visual-sequence.start-registration":"visual_sequence_start_registration","visual-sequence.get":"visual_sequence_get","visual-sequence.query":"visual_sequence_query","project.create":"project_create","production.create":"production_create","production.terminate":"production_terminate","project.query":"project_query","project.get":"project_get","source.query":"source_query","source.ingest":"source_ingest","source.text":"source_read","production.query":"production_query","production.snapshot":"production_snapshot","brief.accept":"brief_accept","story.accept":"story_accept","scene-shot-plan.accept":"scene_shot_plan_accept","story.query":"story_query","story.active":"story_active","scene-shot-plan.query":"scene_shot_plan_query","scene-shot-plan.active":"scene_shot_plan_active","operation.query":"operation_query","operation.get":"operation_get","agent-host.get":"agent_host_binding_get","agent-host.readiness":"agent_host_readiness","agent-host.history":"agent_host_binding_history","agent-host.configure":null,"agent-host.selection.update":"agent_host_selection_update","agent-host.revoke":"agent_host_binding_revoke","agent-host-execution.start":"agent_host_execution_start","agent-host.contract":"agent_host_contract","agent-host-execution.get":"agent_host_execution_get","agent-host-execution.query":"agent_host_execution_query","agent-host-execution.events":"agent_host_execution_events","agent-host-execution.dispatch":"agent_host_execution_dispatch","agent-host-execution.reconcile":"agent_host_execution_reconcile","agent-host-execution.legacy-release":"agent_host_execution_legacy_release","agent-host-execution.legacy-release.get":"agent_host_execution_legacy_release_get","agent-host-execution.cancel":"agent_host_execution_cancel","native-tool-grant.configure":"native_tool_grant_configure","native-tool-grant.get":"native_tool_grant_get","native-tool-grant.revoke":"native_tool_grant_revoke","composition.capabilities":"composition_capabilities","composition.brief":"composition_brief","composition.put-input":"composition_put_input","composition.making.validate":"composition_making_validate","composition.validate":"composition_validate","composition.create":"composition_create","composition.revise":"composition_revise","composition.get":"composition_get","composition.history":"composition_history","composition.render":"composition_render","composition.render.get":"composition_render_get","composition.render.query":"composition_render_query","composition.render.cancel":"composition_render_cancel","composition.sample":"composition_sample","composition.observe":"composition_observe","timeline.basis":"timeline_basis","timeline.build":"timeline_build","timeline.current":"timeline_current","timeline.get":"timeline_get","timeline.query":"timeline_query","rough-cut.start":"rough_cut_start","rough-cut.admission-receipt":"rough_cut_admission_receipt","rough-cut.get":"rough_cut_get","rough-cut.query":"rough_cut_query","rough-cut.cancel":"rough_cut_cancel","rough-cut.media-ticket":"rough_cut_media_ticket","rough-cut.review.target":"rough_cut_review_target","rough-cut.review.record":"rough_cut_review_record","rough-cut.review.query":"rough_cut_review_query","rough-cut.finding.query":"rough_cut_finding_query","final-ready.get":"final_ready_get","final-ready.decide":"final_ready_decide","final-ready.revoke":"final_ready_revoke","final-ready.query":"final_ready_query","final-render.eligibility":"final_render_eligibility","final-render.start":"final_render_start","final-render.admission-receipt":"final_render_admission_receipt","final-render.get":"final_render_get","final-render.query":"final_render_query","final-render.cancel":"final_render_cancel","final-render.media-ticket":"final_render_media_ticket","editor.context":"editor_context","editor.validate":"editor_validate","reviewer.final-output-context":"reviewer_final_output_context","reviewer.context":"reviewer_context","reviewer.validate":"reviewer_proposal_validate","repair-strategy.review1.context":"repair_strategy_review1_context","repair-strategy.review1.validate":"repair_strategy_review1_validate","repair-strategy.context":"repair_strategy_context","repair-strategy.validate":"repair_strategy_validate","canonical-repair.author":"repair_author","canonical-repair.author-review1":"repair_author_review1","canonical-repair.proof-review1":"repair_proof_review1","canonical-repair.get":"repair_get","canonical-repair.execute":"repair_execute","canonical-repair.proof":"repair_proof","programmatic-review.target":"composition_review_target","programmatic-review.record":"composition_review_record","programmatic-review.query":"composition_review_query","programmatic-review.decide":"composition_acceptance_decide","composition.source.inspect":"composition_source_inspect","reviewer.source-context":"reviewer_source_context","exploration.programmatic.compare":"exploration_programmatic_compare","exploration.programmatic.recommendation.context":"exploration_programmatic_recommendation_context","exploration.programmatic.recommendation.validate":"exploration_programmatic_recommendation_validate","delivery.policy.configure":"delivery_configure","delivery.policy.get":"delivery_policy","delivery.snapshot":"delivery_snapshot","delivery.target":"delivery_target","delivery.start":"delivery_start","delivery.get":"delivery_get","delivery.approve":"delivery_approve","delivery.cancel":"delivery_cancel","delivery.manifest":"delivery_manifest","shot-preparation.prepare":"shot_prepare","shot-preparation.get":"shot_preparation_get","shot-preparation.active":"shot_preparation_active","shot-preparation.query":"shot_preparation_query","keyframe.start":"keyframe_start","keyframe.device.quote":"keyframe_device_quote","keyframe.device.start":"keyframe_device_start","keyframe.get":"keyframe_get","imported-visual.register-source":"imported_visual_register_source","imported-visual.register":"imported_visual_register","imported-visual.revise":"imported_visual_revise","imported-visual.original":"imported_visual_original","imported-visual.history":"imported_visual_history","imported-visual.normalize":"imported_visual_normalize","imported-visual.get":"imported_visual_get","imported-visual.decide":"imported_visual_decide","imported-visual.cancel":"imported_visual_cancel","source-sync.start":"source_sync_start","source-sync.get":"source_sync_get","source-sync.cancel":"source_sync_cancel","source-sync.version":"source_sync_version","exploration.context":"exploration_context","exploration.plan.validate":"exploration_plan_validate","exploration.compare":"exploration_compare","exploration.recommendation.context":"exploration_recommendation_context","exploration.recommendation.validate":"exploration_recommendation_validate","composition.render.media-target":"composition_render_media","delivery.download":"delivery_download","temporal-evidence.download":"temporal_evidence_download","video.options":"video_options","studio.capabilities":"studio_capabilities","reference-preview.start":"reference_preview_start","reference-preview.status":"reference_preview_status","reference-preview.get":"reference_preview_get","reference-preview.cancel":"reference_preview_cancel","brief.active":"brief_active","writer.validate":"writer_proposal_validate","director.context":"director_context","director.validate":"director_proposal_validate","consistency-profile.get":"consistency_profile_get","share.create":"share_create","share.get":"share_get","share.list":"share_list","share.revoke":"share_revoke","share.link":"share_link","share.receipt":"share_receipt","voice-profile.create":"voice_profile_create","voice-profile.revise":"voice_profile_revise","voice-profile.publish":"voice_profile_publish","voice-profile.set-enabled":"voice_profile_set_enabled","voice-profile.list":"voice_profile_list","voice-profile.get":"voice_profile_get","voice-profile.version":"voice_profile_version","voice-profile.set-reference":"voice_profile_set_reference","voice-profile.reference":"voice_profile_reference","voice-review.target":"voice_review_target","voice-review.record":"voice_review_record","voice-review.get":"voice_review_get","consistency-profile.version":"consistency_profile_version","consistency-profile.configure":"consistency_profile_configure","audio.export":"audio_export","caption.export":"caption_export","source-sync.audio":"source_sync_audio","audio.basis":"audio_basis","audio.current":"audio_current","audio.get":"audio_get","audio.query":"audio_query","audio.import":"audio_import","caption.basis":"caption_basis","caption.current":"caption_current","caption.get":"caption_get","caption.query":"caption_query","caption.author":"caption_author","caption.transcript_draft":"caption_transcript_draft","caption.author_transcript":"caption_author_transcript","keyframe.query":"keyframe_query","keyframe.cancel":"keyframe_cancel","video.start":"video_start","video.device.quote":"video_device_quote","video.device.start":"video_device_start","video.get":"video_get","video.query":"video_query","video.cancel":"video_cancel","keyframe-review.target":"keyframe_review_target","keyframe-review.record":"keyframe_review_record","keyframe-review.query":"keyframe_review_query","keyframe-review.decide":"keyframe_reference_decide","keyframe-reference.get":"keyframe_reference_get","keyframe-reference.query":"keyframe_reference_query","keyframe-reference.revoke":"keyframe_reference_revoke","video-review.target":"video_review_target","video-review.record":"video_review_record","video-review.query":"video_review_query","video-review.decide":"shot_acceptance_decide","shot-acceptance.get":"shot_acceptance_get","shot-acceptance.query":"shot_acceptance_query","shot-acceptance.revoke":"shot_acceptance_revoke","provider.configure":null,"provider.query":"provider_connection_query","provider.models":"provider_model_query","provider.keyframe-default.set":"provider_keyframe_default_set","provider.disable":"provider_connection_disable","provider.revoke":"provider_credential_revoke","webhook.configure":null,"webhook.secret.prepare":null,"webhook.configure-reference":"webhook_configure","webhook.disable":"webhook_disable","webhook.replay":"webhook_replay","production.feedback":"production_feedback","production.events.read":"production_events_read","lifecycle-event.capabilities":"lifecycle_events_capabilities","lifecycle-event.subscriptions":"lifecycle_events_query","lifecycle-event.events":"lifecycle_events_query","lifecycle-event.deliveries":"lifecycle_events_query","lifecycle-event.attempts":"lifecycle_events_query"});var nestedScope=new Set(["writer.validate","exploration.context","exploration.plan.validate","exploration.compare","exploration.recommendation.context","exploration.recommendation.validate","director.validate","editor.context","editor.validate","reviewer.final-output-context","reviewer.context","reviewer.validate","reviewer.source-context","repair-strategy.context","repair-strategy.validate","repair-strategy.review1.validate","exploration.programmatic.compare","exploration.programmatic.recommendation.context","exploration.programmatic.recommendation.validate","canonical-repair.author"]);var projectInPath=new Set(["canonical-repair.proof-review1","canonical-repair.get","canonical-repair.execute","canonical-repair.proof"]);function sdkMcpInput(key6,input){return Object.fromEntries(Object.entries(input).filter(([k])=>!(k==="tenantId"&&nestedScope.has(key6))&&!(k==="projectId"&&projectInPath.has(key6))))}function schemaNode(value,root){if(root.$schema!==void 0&&root.$schema!=="https://json-schema.org/draft/2020-12/schema")return null;const seen=new Set;const scoped=node=>["$id","$anchor","$dynamicAnchor","$dynamicRef","$recursiveAnchor","$recursiveRef","$vocabulary"].some(key6=>key6 in node);while(value&&typeof value==="object"&&!Array.isArray(value)){const node=value;if(scoped(node))return null;if("$ref"in node&&typeof node.$ref!=="string")return null;if(typeof node.$ref!=="string")return node;if(seen.has(value)||!node.$ref.startsWith("#/"))return null;seen.add(value);let target2=root;for(const part of node.$ref.slice(2).split("/")){const key6=part.replaceAll("~1","/").replaceAll("~0","~");if(!target2||typeof target2!=="object"||!Object.hasOwn(target2,key6))return null;if(scoped(target2))return null;target2=target2[key6]}value=target2}return null}import{z as z85}from"zod";var definitions=new WeakMap;function inputDefinition(name,input){let names=definitions.get(input);if(!names){names=new Map;definitions.set(input,names)}let definition=names.get(name);if(!definition){try{definition={name,inputSchema:z85.toJSONSchema(input,{io:"input",reused:"ref"})};if(Buffer.byteLength(JSON.stringify(definition))>160*1024)throw Error()}catch{throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","BLOCKED","NO_WRITE")}names.set(name,definition)}return definition}import{createHash as createHash10}from"node:crypto";import{z as z86}from"zod";var expectedSchema=z86.strictObject({checksumSha256:z86.string().regex(/^[a-f0-9]{64}$/),byteSize:z86.int().positive().max(16*1024*1024).optional()});async function readMcpEvidenceImage(config,raw,expected,options){if(!raw||raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==config.tenantId))sdkInputError();const input=TemporalEvidenceImageSchema.safeParse({...raw,tenantId:config.tenantId}),identity4=expectedSchema.safeParse({checksumSha256:expected?.checksumSha256,byteSize:expected?.byteSize});if(!input.success||!identity4.success)sdkInputError();const deadline=AbortSignal.timeout(config.timeoutMs),signal=options.signal?AbortSignal.any([options.signal,deadline]):deadline;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let reply2;try{reply2=await abortable(config.client.callTool({name:"temporal_evidence_read_image",arguments:input.data},{signal,timeout:config.timeoutMs,nativeReadOnly:true}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{if(Buffer.byteLength(JSON.stringify(reply2),"utf8")>config.maxJsonBytes)throw Error();const texts=reply2.content.filter(block2=>block2.type==="text"),images=reply2.content.filter(block2=>block2.type==="image");const carrier=reply2.structuredContent!==void 0?reply2.structuredContent:texts.length===1?JSON.parse(texts[0].text):void 0;const envelope=z86.object({semanticStatus:InterfaceSemanticStatusSchema,data:z86.unknown().optional(),error:z86.object({code:z86.string()}).optional()}).parse(carrier);if(reply2.isError)throw new NativeStudioSdkError(envelope.error&&nativeFailureCodes.has(envelope.error.code)?envelope.error.code:envelope.semanticStatus,envelope.semanticStatus==="SUCCESS"||envelope.semanticStatus==="ACCEPTED"?"INTERNAL_OPERATIONAL_FAILURE":envelope.semanticStatus,"REJECTED");if(envelope.semanticStatus!=="SUCCESS"||images.length!==1||(reply2.structuredContent!==void 0?reply2.content.length!==1||texts.length!==0:reply2.content.length!==2||texts.length!==1))throw Error();const metadata=TemporalEvidenceImageMetadataSchema.parse(envelope.data);assertResponseBindings(metadata,input.data,[["evidenceId","evidenceId"],["kind","kind"],["ordinal","ordinal"]],"GET");const block=images[0],bytes=Buffer.from(block.data,"base64"),checksumSha256=createHash10("sha256").update(bytes).digest("hex");if(block.mimeType!==metadata.contentType||bytes.toString("base64")!==block.data||bytes.byteLength!==metadata.byteSize||checksumSha256!==metadata.checksumSha256||checksumSha256!==identity4.data.checksumSha256||identity4.data.byteSize!==void 0&&bytes.byteLength!==identity4.data.byteSize)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{...metadata,bytes}}catch(e){if(e instanceof NativeStudioSdkError)throw e;throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}import{createHash as createHash11}from"node:crypto";import{z as z87}from"zod";var inputSchema=z87.discriminatedUnion("kind",[AudioGetSchema.extend({kind:z87.literal("AUDIO_WAV")}),CaptionGetSchema.extend({kind:z87.enum(["CAPTION_JSON","CAPTION_SRT"])}),SourceSyncAudioGetSchema.extend({kind:z87.literal("SOURCE_SYNC_WAV")})]);var expectedSchema2=z87.strictObject({checksumSha256:z87.string().regex(/^[0-9a-f]{64}$/),byteSize:z87.int().positive().max(12582912).optional()});var outputSchema=z87.strictObject({semanticStatus:z87.literal("SUCCESS"),data:z87.strictObject({contentType:z87.enum(["audio/wav","application/json","application/x-subrip"]),checksumSha256:z87.string().regex(/^[0-9a-f]{64}$/),representationId:z87.uuid().optional(),byteSize:z87.int().positive().max(12582912).optional(),contentBase64:z87.string().max(16777216).optional(),text:z87.string().max(131072).optional()})});async function readMcpAuxiliaryMedia(config,raw,expected,options){if(!raw||raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==config.tenantId))sdkInputError();const parsed=inputSchema.safeParse({...raw,tenantId:config.tenantId}),identity4=expectedSchema2.safeParse(expected);if(!parsed.success||!identity4.success)sdkInputError();const{kind,...arguments_}=parsed.data;const name=kind==="AUDIO_WAV"?"audio_export":kind==="SOURCE_SYNC_WAV"?"source_sync_audio":"caption_export";const contentType=kind.endsWith("WAV")?"audio/wav":kind==="CAPTION_JSON"?"application/json":"application/x-subrip";const deadline=AbortSignal.timeout(config.timeoutMs),signal=options.signal?AbortSignal.any([options.signal,deadline]):deadline;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let reply2;try{reply2=await abortable(config.client.callTool({name,arguments:{...arguments_,...kind.startsWith("CAPTION")?{format:kind==="CAPTION_JSON"?"JSON":"SRT"}:{}}},{signal,timeout:config.timeoutMs,nativeReadOnly:true}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{if(Buffer.byteLength(JSON.stringify(reply2),"utf8")>config.maxJsonBytes||reply2.isError)throw Error();const texts=reply2.content.filter(x=>x.type==="text");const result=outputSchema.parse(reply2.structuredContent??(texts.length===1?JSON.parse(texts[0].text):void 0)).data;const wav=contentType==="audio/wav";if(result.contentType!==contentType||(wav?result.text!==void 0||result.contentBase64===void 0:result.contentBase64!==void 0||result.text===void 0))throw Error();const bytes=wav?Buffer.from(result.contentBase64,"base64"):Buffer.from(result.text,"utf8");const checksumSha256=createHash11("sha256").update(bytes).digest("hex");if(wav&&bytes.toString("base64")!==result.contentBase64||bytes.length>(wav?12582912:131072)||checksumSha256!==result.checksumSha256||checksumSha256!==identity4.data.checksumSha256||result.byteSize!==void 0&&bytes.length!==result.byteSize||identity4.data.byteSize!==void 0&&bytes.length!==identity4.data.byteSize)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{bytes,contentType,checksumSha256,etag:null}}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}import{createHash as createHash12}from"node:crypto";import{z as z88}from"zod";var inputSchema2=z88.discriminatedUnion("kind",[KeyframeGetInputSchema.extend({kind:z88.literal("KEYFRAME")}),VideoGetInputSchema.extend({kind:z88.literal("VIDEO_POSTER")}),RoughCutGetSchema.extend({kind:z88.literal("ROUGH_CUT_POSTER")}),FinalRenderGetSchema.extend({kind:z88.literal("FINAL_POSTER")}),ReferencePreviewOperationInputSchema.extend({kind:z88.literal("REFERENCE_PREVIEW")})]);var sdkMcpImageTools=Object.freeze({KEYFRAME:"keyframe_media",VIDEO_POSTER:"video_poster",ROUGH_CUT_POSTER:"rough_cut_poster",FINAL_POSTER:"final_render_poster",REFERENCE_PREVIEW:"reference_preview_get"});var identitySchema=z88.strictObject({checksumSha256:z88.string().regex(/^[a-f0-9]{64}$/),byteSize:z88.int().positive().max(16*1024*1024).optional()});var metadataSchema=z88.strictObject({contentType:z88.enum(["image/png","image/jpeg","image/webp"]),checksumSha256:identitySchema.shape.checksumSha256,byteSize:z88.int().positive().max(16*1024*1024)});async function readMcpImage(config,raw,expected,options){if(!raw||raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==config.tenantId))sdkInputError();const input=inputSchema2.safeParse({...raw,tenantId:config.tenantId}),identity4=identitySchema.safeParse(expected);if(!input.success||!identity4.success)sdkInputError();const{kind,...arguments_}=input.data;const deadline=AbortSignal.timeout(config.timeoutMs),signal=options.signal?AbortSignal.any([options.signal,deadline]):deadline;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let reply2;try{reply2=await abortable(config.client.callTool({name:sdkMcpImageTools[kind],arguments:arguments_},{signal,timeout:config.timeoutMs,nativeReadOnly:true}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{if(Buffer.byteLength(JSON.stringify(reply2),"utf8")>config.maxJsonBytes)throw Error();const texts=reply2.content.filter(b=>b.type==="text"),images=reply2.content.filter(b=>b.type==="image");const carrier=reply2.structuredContent??(texts.length===1?JSON.parse(texts[0].text):void 0);const envelope=z88.object({semanticStatus:InterfaceSemanticStatusSchema,data:z88.unknown().optional(),error:z88.object({code:z88.string()}).optional()}).parse(carrier);if(reply2.isError)throw new NativeStudioSdkError(envelope.error&&nativeFailureCodes.has(envelope.error.code)?envelope.error.code:"RESPONSE_INVALID",envelope.semanticStatus==="SUCCESS"?"INTERNAL_OPERATIONAL_FAILURE":envelope.semanticStatus,"NO_WRITE");if(envelope.semanticStatus!=="SUCCESS"||images.length!==1||reply2.content.length!==(kind==="REFERENCE_PREVIEW"?2:1)||texts.length!==(kind==="REFERENCE_PREVIEW"?1:0))throw Error();const metadata=kind==="REFERENCE_PREVIEW"?ReferencePreviewResultSchema.parse(envelope.data):metadataSchema.parse(envelope.data);const block=images[0],bytes=Buffer.from(block.data,"base64"),checksumSha256=createHash12("sha256").update(bytes).digest("hex");if(block.mimeType!==metadata.contentType||bytes.toString("base64")!==block.data||bytes.length>(kind==="KEYFRAME"?8:16)*1024*1024||bytes.length!==metadata.byteSize||checksumSha256!==metadata.checksumSha256||checksumSha256!==identity4.data.checksumSha256||identity4.data.byteSize!==void 0&&bytes.length!==identity4.data.byteSize||"contentBase64"in metadata&&metadata.contentBase64!==block.data)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{bytes,contentType:metadata.contentType,checksumSha256,etag:null}}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}function memberCapabilityPort(client,tenantId){return{async callTool(params,options){const{nativeReadOnly,capabilityVersion,...requestOptions}=options??{};const direct=McpEntryToolNames.some(name2=>name2===params.name);if(!direct&&nativeReadOnly===void 0)throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","BLOCKED","NO_WRITE");const name=nativeReadOnly?"studio_capability_query":"studio_capability_invoke";const request=direct?params:{name,arguments:{tenantId,tool:params.name,arguments:params.arguments??{},...capabilityVersion&&{capabilityVersion}}};const response=await client.callTool(request,{...requestOptions,...!direct?{toolDefinition:inputDefinition(name,CapabilityInvocationInputSchema)}:{}});if(direct&&!params.name.startsWith("studio_capability_"))return response;const gateway=request.name==="studio_capability_query"||request.name==="studio_capability_invoke";if(!gateway)return response;const parsed=CapabilityInvocationOutputSchema.safeParse(response.structuredContent);const target2=direct?params.arguments?.tool:params.name;if(!parsed.success){if(response.isError&&isNativeDenial(response.structuredContent))return response;throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",nativeReadOnly?"NO_WRITE":"UNKNOWN")}if(parsed.data.tool!==target2)throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",nativeReadOnly?"NO_WRITE":"UNKNOWN");if(direct&&!response.isError)return response;return{...response,structuredContent:parsed.data.result}}}}function isNativeDenial(value){return value!==null&&typeof value==="object"&&"semanticStatus"in value&&"error"in value}var NativeStudioMcpClient=class{constructor(config){this.config=config;const tenant2=TenantIdSchema.safeParse(config.tenantId);if(!tenant2.success||typeof config.client?.callTool!=="function")sdkInputError();this.tenantId=tenant2.data.toLowerCase();if(config.mode!=="native")this.config={...config,client:memberCapabilityPort(config.client,this.tenantId)};this.timeout=config.timeoutMs??3e4;this.limit=config.maxJsonBytes??16*1024*1024;if(!Number.isSafeInteger(this.timeout)||this.timeout<1||this.timeout>3e5||!Number.isSafeInteger(this.limit)||this.limit<1024||this.limit>32*1024*1024)sdkInputError()}config;deviceRenders=new NativeStudioDeviceRenders(this);navigation=new NativeStudioNavigationFacade(this);tenantId;timeout;limit;imageMedia(input,expected,options={}){return readMcpImageMedia({...this.config,tenantId:this.tenantId,timeoutMs:this.timeout,maxJsonBytes:this.limit},input,expected,options)}evidenceImage(input,expected,options={}){return readMcpEvidenceImage({...this.config,tenantId:this.tenantId,timeoutMs:this.timeout,maxJsonBytes:this.limit},input,expected,options)}auxiliaryMedia(input,expected,options={}){return readMcpAuxiliaryMedia({...this.config,tenantId:this.tenantId,timeoutMs:this.timeout,maxJsonBytes:this.limit},input,expected,options)}image(input,expected,options={}){return readMcpImage({...this.config,tenantId:this.tenantId,timeoutMs:this.timeout,maxJsonBytes:this.limit},input,expected,options)}async call(key6,raw,options={}){if(!Object.hasOwn(sdkOperations,key6)||!raw||typeof raw!=="object"||Array.isArray(raw))sdkInputError();if(raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==this.tenantId))sdkInputError();const limit=options.maxJsonBytes??this.limit;if(!Number.isSafeInteger(limit)||limit<1024||limit>this.limit)sdkInputError();const tool=sdkMcpTools[key6];if(tool===null)throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","CAPABILITY_UNAVAILABLE","NO_WRITE");let capabilityVersion=options.capabilityVersion;if(capabilityVersion!==void 0){if(!CapabilityVersionSchema.safeParse(capabilityVersion).success)sdkInputError();if(this.config.mode==="native"||McpEntryToolNames.some(name=>name===tool))throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","CAPABILITY_UNAVAILABLE","NO_WRITE")}const spec=sdkOperations[key6],parsed=spec.input.safeParse({...raw,tenantId:this.tenantId});if(!parsed.success)sdkInputError(inputIssues(parsed.error,spec.input));const input=parsed.data;if(Buffer.byteLength(JSON.stringify(input),"utf8")>18*1024*1024)sdkInputError();const request=spec.request===null?{method:spec.readOnly?"GET":"POST"}:spec.request(input);const write2=request.method==="POST"&&!spec.readOnly,outcome=write2?"UNKNOWN":"NO_WRITE";const signal=options.signal?AbortSignal.any([options.signal,AbortSignal.timeout(this.timeout)]):AbortSignal.timeout(this.timeout);if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");if((key6==="rough-cut.start"||key6==="final-render.start")&&"deviceExecution"in input&&input.deviceExecution){const target2=DeviceRenderTargetSchema.parse(input.deviceExecution);const description=await this.navigation.describe({tool},{signal});const root=description.definition.inputSchema;const properties=schemaNode(root,root)?.properties;const policy=properties&&typeof properties==="object"?properties.deviceExecution:void 0;const policyFields=schemaNode(policy,root)?.properties;if(!schemaNode(policy,root)||target2.validationMode&&(!policyFields||typeof policyFields!=="object"||!Object.hasOwn(policyFields,"validationMode")))throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","BLOCKED","NO_WRITE");if(this.config.mode!=="native")capabilityVersion??=description.capabilityVersion;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE")}const definition=inputDefinition(tool,spec.input);let result;try{result=await abortable(this.config.client.callTool({name:tool,arguments:sdkMcpInput(key6,input)},{signal,timeout:this.timeout,toolDefinition:definition,nativeReadOnly:!write2,...capabilityVersion&&{capabilityVersion}}),signal)}catch{throw new NativeStudioSdkError(write2?"OUTCOME_UNKNOWN":signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE",outcome)}let value;try{if(Buffer.byteLength(JSON.stringify(result),"utf8")>limit)throw new Error;if("structuredContent"in result&&result.structuredContent!==void 0)value=result.structuredContent;else if("content"in result&&result.content.length===1&&result.content[0]?.type==="text")value=JSON.parse(result.content[0].text);else throw new Error}catch{throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",outcome)}const envelope=value&&typeof value==="object"&&!Array.isArray(value)?value:{};if("isError"in result&&result.isError){const status=InterfaceSemanticStatusSchema.safeParse(envelope.semanticStatus);const semantic=status.success&&!["SUCCESS","ACCEPTED","NO_CHANGE"].includes(status.data)?status.data:"INTERNAL_OPERATIONAL_FAILURE";const error=envelope.error&&typeof envelope.error==="object"&&!Array.isArray(envelope.error)?envelope.error:void 0;const code=error?.code;const valid=status.success&&!["SUCCESS","ACCEPTED","NO_CHANGE"].includes(status.data);const suppliedVersion=capabilityVersion??(McpCapabilityGatewayNames.some(name=>name===tool)&&"capabilityVersion"in input?input.capabilityVersion:void 0);const reportedMismatch=capabilityMismatch(code,semantic,error?.details);const mismatch=reportedMismatch?.kind==="CAPABILITY_DEFINITION"&&(reportedMismatch.expectedVersion===reportedMismatch.actualVersion||suppliedVersion!==void 0&&reportedMismatch.actualVersion!==suppliedVersion)?void 0:reportedMismatch;const known=valid&&typeof code==="string"&&nativeFailureCodes.has(code)&&(code!=="CAPABILITY_VERSION_MISMATCH"||!!mismatch);throw new NativeStudioSdkError(known&&typeof code==="string"?code:semantic,semantic,failureOutcome(write2,semantic,valid&&error?.outcome==="UNKNOWN"?"UNKNOWN":known?error?.outcome:void 0),null,[],mismatch)}if(envelope.semanticStatus==="NOT_FOUND"&&envelope.data===void 0)throw new NativeStudioSdkError("NOT_FOUND","NOT_FOUND",write2?"REJECTED":"NO_WRITE");const schema=spec.output;for(const candidate of[value,envelope.data,envelope.data&&typeof envelope.data==="object"&&!Array.isArray(envelope.data)?{...envelope.data,semanticStatus:envelope.semanticStatus}:void 0]){const parsedOutput=schema.safeParse(candidate);if(parsedOutput.success){if(key6==="reference-preview.get")assertPreviewBytes(parsedOutput.data);if(key6==="temporal-evidence.read-video")assertOriginalVideoBytes(parsedOutput.data);if(key6==="audio.export"||key6==="caption.export"||key6==="source-sync.audio")assertExportBytes(parsedOutput.data,key6==="caption.export"&&"format"in input?String(input.format):void 0);assertManagementReceipt(key6,input,parsedOutput.data);assertResponseBindings(parsedOutput.data,input,spec.identity,write2?"POST":"GET",spec.expectedPath?spec.expectedPath(input,parsedOutput.data):void 0,spec.identityWhenPresent);assertSeriesResponseVersions(key6,input,parsedOutput.data);assertEnterpriseBrandResponse(key6,input,parsedOutput.data);return parsedOutput.data}}throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",outcome)}};var NativeStudioNavigationClient=class{constructor(config){this.config=config;if(typeof config.client?.callTool!=="function")sdkInputError();this.native=new NativeStudioMcpClient({...config,client:{callTool:async(params,options)=>{const definition=this.definitions.get(params.name);const result=await config.client.callTool(params,{...options,...definition?{toolDefinition:definition}:{}});if(params.name==="studio_capability_describe"&&!result.isError){const parsed=CapabilityDescribeSchema.safeParse(result.structuredContent);const projectId=params.arguments?.projectId;if(parsed.success&&parsed.data.tenantId.toLowerCase()===config.tenantId.toLowerCase()&&parsed.data.tool===params.arguments?.tool){this.contexts.set(parsed.data.schemaCursor,{tool:parsed.data.tool,...typeof projectId==="string"?{projectId}:{}});if(this.contexts.size>32)this.contexts.delete(this.contexts.keys().next().value)}}return result}}})}config;native;definitions=new Map;contexts=new Map;async entrypoints(options={}){const value=await this.native.call("studio.capability.groups",{includeDefinitions:true},options);const tools=value.definitions;const required=this.config.mode==="native"?NavigationToolNames:McpEntryToolNames.filter(name=>name!=="studio_capability_invoke");const names=new Set(this.config.mode==="native"?[...NavigationToolNames,"nvs_open_execution"]:McpEntryToolNames);if(!tools||tools.some(tool=>!names.has(tool.name)||tool.inputSchema.type!=="object")||new Set(tools.map(tool=>tool.name)).size!==tools.length||Buffer.byteLength(JSON.stringify(tools))>(this.config.mode==="native"?160*1024:24*1024)||required.some(name=>!tools.some(tool=>tool.name===name)))this.invalid();this.definitions.clear();this.contexts.clear();for(const tool of tools)this.remember(tool);return{tools}}async selectedSchema(reference3,expectedTool,options={}){if(!reference3||reference3.length>2048||!/^[a-zA-Z0-9_-]{1,120}$/.test(expectedTool))sdkInputError();const context=this.contexts.get(reference3);if(context&&context.tool!==expectedTool)this.invalid();const projectId=options.projectId??context?.projectId;const description=await this.native.call("studio.capability.describe",{tool:expectedTool,schemaCursor:reference3,...projectId?{projectId}:{}},options);return this.selectDescription(description,expectedTool,{...projectId?{projectId}:{}})}selectDescription(raw,expectedTool,options={}){const parsed=CapabilityDescribeSchema.safeParse(raw);if(!parsed.success||parsed.data.tenantId.toLowerCase()!==this.config.tenantId.toLowerCase()||parsed.data.tool!==expectedTool)this.invalid();const description=parsed.data;const definition=description.definition;if(definition.name!==expectedTool)this.invalid();const selected=definition;this.remember(selected);this.contexts.set(description.schemaCursor,{tool:expectedTool,...options.projectId?{projectId:options.projectId}:{}});if(this.contexts.size>32)this.contexts.delete(this.contexts.keys().next().value);return description}remember(tool){if(!PublicToolDefinitionSchema.safeParse(tool).success||tool.inputSchema?.type!=="object"||Buffer.byteLength(JSON.stringify(tool))>160*1024)this.invalid();this.definitions.delete(tool.name);this.definitions.set(tool.name,structuredClone(tool));if(this.definitions.size>32)this.definitions.delete(this.definitions.keys().next().value)}invalid(){throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}};export{WorkspaceDeviceListInputSchema,WorkspaceDeviceListSchema,LocalLibraryCommandStatusSchema,renderDeviceSelection,NavigationGroupIdSchema,NavigationGroups,navigationGroup,NavigationProfile,NavigationProfileKey,NavigationToolNames,CapabilityDescribeInputSchema,CapabilityGroupsSchema,CapabilityDescribeSchema,DeviceDiscoveryInputSchema,DeviceRenderIntentSchema,PreparedDeviceRenderSchema,DeviceRenderAdmissionSchema,NativeStudioDeviceRenders,NativeStudioNavigationFacade,sdkOperations,NativeStudioAgentClient,sdkImageMediaTools,sdkMcpTools,NativeStudioMcpClient,NativeStudioNavigationClient};