@nativestudio/cli 0.3.0-rc.1 → 0.3.0-rc.4
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.
- package/COMPATIBILITY.json +7 -7
- package/README.md +45 -4
- package/components/runtime.json +3 -3
- package/components/runtime.tgz +0 -0
- package/dist/_chunks/{chunk-25EDDZQA.js → chunk-6LU6GJKW.js} +1 -1
- package/dist/_chunks/chunk-CA54SKBO.js +1 -0
- package/dist/_chunks/chunk-D533YC7J.js +1 -0
- package/dist/_chunks/{chunk-G42IS5JF.js → chunk-DXJQWTLG.js} +1 -1
- package/dist/_chunks/{chunk-MSOMVWKN.js → chunk-FU3524Z6.js} +1 -1
- package/dist/_chunks/chunk-JLOHTDP6.js +1 -0
- package/dist/_chunks/chunk-KB2GVAN7.js +1 -0
- package/dist/_chunks/{chunk-RUMDDTON.js → chunk-KNFUMWDY.js} +1 -1
- package/dist/_chunks/chunk-PBEHCYR7.js +1 -0
- package/dist/_chunks/chunk-RNOIRNC3.js +1 -0
- package/dist/_chunks/chunk-VDQOSVZY.js +1 -0
- package/dist/_chunks/chunk-XZP6RNGC.js +1 -0
- package/dist/_chunks/chunk-YKOJPJZR.js +1 -0
- package/dist/_chunks/{files-TBJVDQWU.js → files-TTIQ7LYJ.js} +1 -1
- package/dist/_chunks/local-main-GSL2FQOG.js +1 -0
- package/dist/_chunks/local-mcp-VYHO4ZE3.js +1 -0
- package/dist/_chunks/{main-4SNF5EKE.js → main-KLXOK7QK.js} +2 -2
- package/dist/_chunks/mcp-P7W623FE.js +1 -0
- package/dist/_chunks/oauth-WJ36KWAC.js +1 -0
- package/dist/_chunks/project-connect-W7V3OALV.js +1 -0
- package/dist/_chunks/render-main-ZW6UJHGN.js +1 -0
- package/dist/_chunks/src-BXLFLNRG.js +1 -0
- package/dist/_chunks/{stdio-main-JEADWO7U.js → stdio-main-4Z2JVCMO.js} +1 -1
- package/dist/_types/cli/local/desktop-contract.d.ts +1455 -0
- package/dist/_types/cli/local/desktop-device-contract.d.ts +1165 -0
- package/dist/_types/cli/local/desktop-device-navigation.d.ts +3 -0
- package/dist/_types/cli/local/desktop-device-owner.d.ts +275 -0
- package/dist/_types/cli/local/desktop-device-state.d.ts +230 -0
- package/dist/_types/cli/local/desktop-owner.d.ts +554 -1
- package/dist/_types/cli/local/ledger.d.ts +62 -10
- package/dist/_types/cli/local/manager.d.ts +515 -22
- package/dist/_types/cli/local/mcp-tools.d.ts +77 -14
- package/dist/_types/cli/local/project-render-tools.d.ts +522 -0
- package/dist/_types/cli/local/releases.d.ts +11 -2
- package/dist/_types/cli/local-management.d.ts +4 -0
- package/dist/_types/cli/local-navigation.d.ts +1 -0
- package/dist/_types/contracts/delivery-manifest.d.ts +63 -27
- package/dist/_types/contracts/delivery-operations.d.ts +21 -9
- package/dist/_types/contracts/device-render.d.ts +10 -0
- package/dist/_types/contracts/exploration-recommendation.d.ts +84 -36
- package/dist/_types/contracts/final-render.d.ts +9 -0
- package/dist/_types/contracts/index.d.ts +1 -0
- package/dist/_types/contracts/local-execution/agent-context.d.ts +365 -0
- package/dist/_types/contracts/local-execution/agent-evidence.d.ts +79 -0
- package/dist/_types/contracts/local-execution/agent-grant.d.ts +31 -0
- package/dist/_types/contracts/local-execution/agent-review.d.ts +733 -46
- package/dist/_types/contracts/local-execution/device.d.ts +10 -2
- package/dist/_types/contracts/local-execution/index.d.ts +6 -0
- package/dist/_types/contracts/local-execution/ipc.d.ts +1762 -40
- package/dist/_types/contracts/local-execution/lifecycle.d.ts +76 -6
- package/dist/_types/contracts/local-execution/local-navigation.d.ts +115 -13
- package/dist/_types/contracts/local-execution/management.d.ts +394 -0
- package/dist/_types/contracts/local-execution/media-recipe.d.ts +203 -0
- package/dist/_types/contracts/local-execution/offline.d.ts +59 -0
- package/dist/_types/contracts/local-execution/preview.d.ts +7607 -159
- package/dist/_types/contracts/local-execution/work.d.ts +7674 -294
- package/dist/_types/contracts/local-execution/workspace.d.ts +136 -0
- package/dist/_types/contracts/programmatic-exploration.d.ts +42 -18
- package/dist/_types/contracts/repair-strategy.d.ts +42 -18
- package/dist/_types/contracts/review-intelligence-final-output.d.ts +42 -18
- package/dist/_types/contracts/review-intelligence.d.ts +84 -36
- package/dist/_types/contracts/rough-cut-manifest.d.ts +7 -3
- package/dist/_types/contracts/rough-cut-profile.d.ts +12 -3
- package/dist/_types/contracts/rough-cut-review.d.ts +126 -54
- package/dist/_types/contracts/rough-cut.d.ts +85 -32
- package/dist/_types/contracts/visual-layer-render.d.ts +21 -9
- package/dist/_types/sdk/local-runtime/device-client.d.ts +138 -2
- package/dist/_types/sdk/local-runtime/workspace.d.ts +181 -0
- package/dist/_types/sdk/local-runtime-client.d.ts +1298 -60
- package/dist/entry.js +1 -1
- package/dist/local-management.js +1 -1
- package/dist/local-navigation.js +1 -1
- package/dist/native/JobNative.cs +10 -0
- package/dist/native/JobRunner.cs +24 -3
- package/dist/native/NativeMain.cs +15 -0
- package/package.json +1 -1
- package/dist/_chunks/chunk-E57YVMQ4.js +0 -1
- package/dist/_chunks/chunk-EAZKDCLD.js +0 -1
- package/dist/_chunks/chunk-GIEYSDCG.js +0 -1
- package/dist/_chunks/chunk-HLKERZIE.js +0 -1
- package/dist/_chunks/chunk-QC7RLTGU.js +0 -1
- package/dist/_chunks/chunk-U2UKGYGF.js +0 -1
- package/dist/_chunks/local-main-SOERK22D.js +0 -1
- package/dist/_chunks/local-mcp-JLPXXIDW.js +0 -1
- package/dist/_chunks/mcp-EIMXNRH3.js +0 -1
- package/dist/_chunks/oauth-257CEUQH.js +0 -1
- package/dist/_chunks/project-connect-6MH2QG6G.js +0 -1
- package/dist/_chunks/src-7F6ZEU3U.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CreateProjectRequestSchema,CreatedProjectResultSchema,ProductionSchema,ProductionStateSchema,ProjectLibraryPageSchema,ProjectLibraryQuerySchema,ProjectLibraryScopeSchema,ProjectWorkspaceSchema,SourceLibraryMediaSchema,SourceLibraryPageSchema,SourceLibraryQuerySchema,StudioInputContentSchema}from"./chunk-GJ7BZJLW.js";import{AcceptBriefRequestSchema,AcceptBriefResultSchema,AcceptSceneShotPlanRequestSchema,AcceptSceneShotPlanResultSchema,AcceptStoryRequestSchema,AcceptStoryResultSchema,AcceptedVisualSourceReferenceSchema,AgentHostBindingSchema,AgentHostCurrentSchema,AgentHostHistoryPageSchema,AgentHostHistoryQuerySchema,AgentHostReadinessSchema,AgentHostScopeSchema,AgentHostSelectionSchema,AudioBasisSchema,AudioGetSchema,AudioImportRequestSchema,AudioPageSchema,AudioQuerySchema,AudioReceiptSchema,AudioScopeSchema,AudioSnapshotSchema,AudioViewSchema,AuthorCaptionsSchema,AuthorTranscriptCaptionsSchema,BoundaryRequirementSchema,BriefContentSchema,BuildTimelineSchema,BuildTimelineShapeSchema,CaptionBasisSchema,CaptionContentSchema,CaptionExportSchema,CaptionGetSchema,CaptionPageSchema,CaptionQuerySchema,CaptionReceiptSchema,CaptionScopeSchema,CaptionSnapshotSchema,CaptionTranscriptDraftSchema,CaptionTranscriptPlanSchema,CaptionViewSchema,ClipTransitionSchema,CompositionFindingLocalitySchema,ConfigureAgentHostSchema,ConfigureConsistencyProfileSchema,ConfigureNativeToolGrantSchema,ConfigureProviderInputSchema,ConfigureProviderModelSchema,ConsistencyProfileReceiptSchema,ConsistencyProfileScopeSchema,ConsistencyProfileVersionQuerySchema,ConsistencyProfileVersionSchema,ConsistencyProfileViewSchema,ConstraintSetSchema,ContentFingerprintSchema,DecideFinalReadySchema,DecideKeyframeSchema,DecideProgrammaticShotSchema,DecideVideoShotSchema,DeliveryApprovalSchema,DeliveryCheckKeySchema,DeliveryManifestLinkSchema,DeliveryPolicyInputSchema,DeliveryPolicySchema,DeliveryTargetSchema,DeliveryValidationReviewSchema,DeviceRenderReceiptSchema,DeviceRenderTargetSchema,DirectorBasisSchema,DirectorContextResultSchema,DirectorScopeSchema,DirectorValidationResultSchema,DisableProviderModelSchema,ExactEvidenceReferenceSchema,FinalDeliveryReceiptSchema,FinalReadyPageSchema,FinalReadyQuerySchema,FinalReadyReceiptSchema,FinalReadyViewSchema,FinalRenderAdmissionSchema,FinalRenderEligibilitySchema,FinalRenderGetSchema,FinalRenderManifestReaderSchema,FinalRenderPageSchema,FinalRenderQuerySchema,FinalRenderSnapshotSchema,FinalRenderStartSchema,FinalRenderTechnicalSchema,FinalRenderViewSchema,GeneratedShotAcceptanceDecisionSchema,GenerationContractIdSchema,GenerationCostQuoteSchema,KeyframeAdmissionSchema,KeyframeDecisionPageSchema,KeyframeDecisionQuerySchema,KeyframeDecisionReceiptSchema,KeyframeGenerationViewSchema,KeyframeGetInputSchema,KeyframeMediaSchema,KeyframeObservationSchema,KeyframeProviderProfileSchema,KeyframeQueryInputSchema,KeyframeQueryPageSchema,KeyframeReferenceScopeSchema,KeyframeReferenceViewSchema,KeyframeReviewPageSchema,KeyframeReviewQuerySchema,KeyframeReviewReceiptSchema,KeyframeReviewScopeSchema,KeyframeReviewSummarySchema,KeyframeReviewTargetSchema,KeyframeStartInputSchema,KeyframeSummarySchema,MAX_SHOT_REVIEW_REQUIREMENTS,NativeRuntimeProofRequestSchema,NativeRuntimePublicKeySchema,NativeToolGrantGetSchema,NativeToolGrantViewSchema,ObservationAdmissionSchema,ObservationGetSchema,ObservationOptionsSchema,ObservationScopeSchema,ObservationStartSchema,ObservationViewSchema,PreparationBasisSchema,PreparationBlockerSchema,PreparationIdSchema,PreparationTargetSchema,ProductionGuidanceContextSchema,ProgrammaticShotAcceptanceDecisionSchema,ProgrammaticVideoReviewPageSchema,ProgrammaticVideoReviewQuerySchema,ProgrammaticVideoReviewReceiptSchema,ProgrammaticVideoReviewScopeSchema,ProgrammaticVideoReviewTargetSchema,ProviderConnectionCommandSchema,ProviderConnectionPageSchema,ProviderConnectionViewSchema,ProviderCredentialRevokeSchema,ProviderDefaultViewSchema,ProviderModelGetSchema,ProviderModelPageSchema,ProviderModelViewSchema,ProviderModelsViewSchema,ProviderSelectionSchema,ProviderTenantInputSchema,RecordKeyframeReviewSchema,RecordProgrammaticVideoReviewSchema,RecordRoughCutReviewSchema,RecordVideoReviewSchema,ReferenceBindingInputSchema,ReferenceRoleSchema,ReferenceSetSchema,ReviewEvidenceKeySchema,ReviewIntelligenceContextInputSchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema,RevokeAgentHostSchema,RevokeFinalReadySchema,RevokeKeyframeSchema,RevokeNativeToolGrantSchema,RevokeShotAcceptanceSchema,RoughCutAdmissionSchema,RoughCutFindingPageSchema,RoughCutFindingQuerySchema,RoughCutFindingViewSchema,RoughCutGetSchema,RoughCutPageSchema,RoughCutProfileIdSchema,RoughCutQuerySchema,RoughCutReviewPageSchema,RoughCutReviewQuerySchema,RoughCutReviewReceiptSchema,RoughCutReviewRecordSchema,RoughCutReviewScopeSchema,RoughCutReviewSnapshotSchema,RoughCutReviewTargetSchema,RoughCutSnapshotSchema,RoughCutStartSchema,RoughCutViewSchema,SceneShotPlanVersionSchema,SetKeyframeDefaultSchema,ShotAcceptanceScopeSchema,ShotAcceptanceViewSchema,ShotDecisionPageSchema,ShotDecisionQuerySchema,ShotDecisionReceiptSchema,ShotIntentSchema,ShotPlanEntrySchema,SoundPlanAcceptSchema,SoundPlanContextSchema,SoundPlanGetSchema,SoundPlanReceiptSchema,SoundPlanScopeSchema,SoundPlanValidateSchema,SoundPlanValidationSchema,SoundPlanViewSchema,SourceSyncAudioGetSchema,SourceSyncAudioReceiptSchema,SourceSyncAudioStartSchema,SourceSyncAudioVersionSchema,SourceSyncAudioViewSchema,SpeechAdmissionSchema,SpeechGenerationViewSchema,SpeechGetSchema,SpeechOptionsSchema,SpeechScopeSchema,SpeechStartSchema,StoryContentSchema,StoryVersionSchema,TimelineAudioInputSchema,TimelineBasisSchema,TimelineBuildReceiptSchema,TimelineGetSchema,TimelineGraphicInputSchema,TimelineManifestReaderSchema,TimelinePageSchema,TimelineQuerySchema,TimelineScopeSchema,TimelineSnapshotSchema,TimelineViewSchema,TimelineVisualLayerInputSchema,UpdateAgentHostSelectionSchema,ValidateDirectorProposalSchema,ValidateReviewIntelligenceSchema,ValidateWriterProposalSchema,VideoAdmissionSchema,VideoGenerationViewSchema,VideoGetInputSchema,VideoObservationSchema,VideoProviderProfileSchema,VideoQueryInputSchema,VideoQueryPageSchema,VideoReviewPageSchema,VideoReviewQuerySchema,VideoReviewReceiptSchema,VideoReviewRecordSchema,VideoReviewRequirementSchema,VideoReviewScopeSchema,VideoReviewTargetSchema,VideoStartInputSchema,VideoSummarySchema,VisualFrameSequenceSchema,VisualRequirementSchema,WriterBriefResultSchema,WriterScopeSchema,WriterValidationResultSchema}from"./chunk-PBEHCYR7.js";import{ArtifactIdSchema,ArtifactRelationIdSchema,ArtifactRepresentationIdSchema,ContinuationSchema,DeliveryOutputProfileSchema,InterfaceSemanticStatusSchema,NextActionSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,TenantIdSchema,WorkSummarySchema}from"./chunk-VPYAXWXY.js";import{NativeStudioSdkError,sdkInputError}from"./chunk-6NVIN2NI.js";import{z as z64}from"zod";import{z}from"zod";var OperationTargetSchema=z.object({type:z.string().min(1).max(120),id:z.string().min(1).max(2048),version:z.int().positive().nullable()});var OperationSummarySchema=z.object({id:OperationIdSchema,productionId:ProductionIdSchema,semanticStatus:InterfaceSemanticStatusSchema,targets:z.array(OperationTargetSchema).max(100),work:WorkSummarySchema,blockers:z.array(z.string().min(1).max(1e3)).max(100),nextActions:z.array(NextActionSchema).max(50),startedAt:z.iso.datetime({offset:true}),updatedAt:z.iso.datetime({offset:true})});import{z as z4}from"zod";import{z as z3}from"zod";import{z as z2}from"zod";var sha=z2.string().regex(/^[0-9a-f]{64}$/);var DeliveryManifestBasisSchema=z2.strictObject({schemaVersion:z2.literal(1),evaluatorVersion:z2.literal("DELIVERY_V1"),target:DeliveryTargetSchema,policyVersionId:z2.uuid(),policyVersion:z2.int().positive(),policy:DeliveryPolicySchema,policyFingerprint:sha,finalRenderRuntimeJobId:z2.uuid(),finalRenderManifest:FinalRenderManifestReaderSchema,finalRenderTechnical:FinalRenderTechnicalSchema,roughCutReview:RoughCutReviewRecordSchema,artifacts:z2.array(z2.strictObject({artifactId:z2.uuid(),family:z2.string().min(1).max(100),origin:z2.string().min(1).max(100),checksumSha256:sha})).min(1).max(2e3),relations:z2.array(z2.strictObject({id:z2.uuid(),sourceArtifactId:z2.uuid(),targetArtifactId:z2.uuid(),relationType:z2.string().min(1).max(100)})).max(4e3)}).superRefine((basis,ctx)=>{const t=basis.target,m=basis.finalRenderManifest;if(t.selectionId!==m.selection.id||t.selectionVersion!==m.selectionVersion||t.timelineVersionId!==m.timeline.id||t.timelineFingerprint!==m.timeline.fingerprint||t.tenantId!==m.timeline.tenantId||t.projectId!==m.timeline.projectId||t.productionId!==m.timeline.productionId||t.executionClass!==m.timeline.executionClass||t.checksumSha256!==basis.finalRenderTechnical.checksumSha256||t.byteSize!==basis.finalRenderTechnical.byteSize||basis.finalRenderTechnical.hasAudio!==m.profile.hasAudio||basis.roughCutReview.id!==m.selection.reviewId||basis.roughCutReview.basisFingerprint!==m.selection.basisFingerprint||!basis.artifacts.some(a=>a.artifactId===t.artifactId&&a.checksumSha256===t.checksumSha256)||new Set(basis.artifacts.map(a=>a.artifactId)).size!==basis.artifacts.length||new Set(basis.relations.map(r=>r.id)).size!==basis.relations.length||basis.relations.some(r=>!basis.artifacts.some(a=>a.artifactId===r.sourceArtifactId)||!basis.artifacts.some(a=>a.artifactId===r.targetArtifactId)))ctx.addIssue({code:"custom",message:"Manifest must identify exact render, Review-2 and provenance"})});var ProductionDeliveryManifestSchema=DeliveryManifestBasisSchema.safeExtend({reviewId:z2.uuid(),productionRevision:z2.int().positive(),completedAt:z2.iso.datetime({offset:true})});var DeliveryManifestGetSchema=TimelineScopeSchema.extend({manifestId:z2.uuid()});var RegisteredDeliveryManifestSchema=z2.strictObject({link:DeliveryManifestLinkSchema,body:ProductionDeliveryManifestSchema}).refine(v=>v.link.reviewId===v.body.reviewId&&v.link.policyFingerprint===v.body.policyFingerprint&&Object.keys(DeliveryTargetSchema.shape).every(key10=>v.link.target[key10]===v.body.target[key10]),"Manifest registration must match exact body");var sha2=z3.string().regex(/^[0-9a-f]{64}$/);var mutation=TimelineScopeSchema.extend({expectedProductionRevision:z3.int().positive(),idempotencyKey:z3.string().trim().min(1).max(200)});var ConfigureDeliveryPolicySchema=mutation.extend({expectedPolicyVersion:z3.int().nonnegative(),policy:DeliveryPolicyInputSchema});var DeliveryPolicyVersionSchema=TimelineScopeSchema.extend({id:z3.uuid(),projectId:z3.uuid(),version:z3.int().positive(),policy:DeliveryPolicySchema,policyFingerprint:sha2,createdByPrincipalId:z3.uuid(),createdAt:z3.iso.datetime({offset:true})});var DeliveryPolicyReceiptSchema=z3.strictObject({policy:DeliveryPolicyVersionSchema,productionRevision:z3.int().positive()});var StartDeliveryValidationSchema=mutation.extend({target:DeliveryTargetSchema,expectedPolicyVersion:z3.int().nonnegative()}).refine(v=>v.target.tenantId===v.tenantId&&v.target.productionId===v.productionId,"Exact delivery target must match command scope");var DeliveryValidationGetSchema=TimelineScopeSchema.extend({validationId:z3.uuid()});var DecideDeliveryApprovalSchema=mutation.extend({validationId:z3.uuid(),reviewId:z3.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha2,action:z3.enum(["APPROVE","REJECT"])}).refine(v=>v.target.tenantId===v.tenantId&&v.target.productionId===v.productionId,"Exact approval target must match command scope");var DeliveryAdmissionSchema=z3.strictObject({semanticStatus:z3.literal("ACCEPTED"),validationId:z3.uuid(),runtimeJobId:z3.uuid(),operationId:z3.string().min(1),target:DeliveryTargetSchema,policyVersionId:z3.uuid(),policyVersion:z3.int().positive(),policyFingerprint:sha2,manifestBasisFingerprint:sha2,evaluatorVersion:z3.literal("DELIVERY_V1"),productionRevision:z3.int().positive()});var DeliveryFindingSchema=z3.strictObject({id:z3.uuid(),reviewId:z3.uuid(),target:DeliveryTargetSchema,key:DeliveryCheckKeySchema,detail:z3.string().trim().min(1).max(1e3),blocking:z3.literal(true),createdAt:z3.iso.datetime({offset:true})});var DeliveryCompletionBlockerSchema=z3.enum(["VALIDATION_FAILED","EXACT_OUTPUT_CHANGED","DELIVERY_POLICY_CHANGED","FINAL_READY_STALE","ARTIFACT_UNAVAILABLE","PROVENANCE_INCOMPLETE","MANIFEST_NOT_REGISTERED","MANIFEST_BINDING_MISMATCH","BLOCKING_FINDINGS","TEST_EVIDENCE_DISABLED","APPROVAL_BINDING_MISMATCH","APPROVAL_REJECTED"]);var DeliveryReviewReceiptSchema=z3.strictObject({review:DeliveryValidationReviewSchema,action:z3.enum(["COMPLETE","WAITING_HUMAN","BLOCK"]),blockers:z3.array(DeliveryCompletionBlockerSchema).max(12),productionRevision:z3.int().positive()});var DeliveryDecisionReceiptSchema=z3.strictObject({approval:DeliveryApprovalSchema,finalDelivery:FinalDeliveryReceiptSchema.nullable(),productionRevision:z3.int().positive(),condition:z3.enum(["RUNNABLE","BLOCKED"])});var DeliveryValidationViewSchema=z3.strictObject({admission:DeliveryAdmissionSchema,policy:DeliveryPolicyVersionSchema,manifestBasis:DeliveryManifestBasisSchema,runtimeStatus:z3.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),current:z3.boolean(),reviewReceipt:DeliveryReviewReceiptSchema.nullable(),findings:z3.array(DeliveryFindingSchema).max(16),approval:DeliveryApprovalSchema.nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});var DeliverySnapshotSchema=TimelineScopeSchema.extend({productionRevision:z3.int().positive(),policy:DeliveryPolicyVersionSchema.nullable(),currentValidationId:z3.uuid().nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});var DeliverySummarySchema=z4.strictObject({policy:DeliveryPolicyVersionSchema.nullable(),validation:z4.strictObject({id:z4.uuid(),runtimeStatus:DeliveryValidationViewSchema.shape.runtimeStatus,current:z4.boolean(),reviewId:z4.uuid().nullable(),result:z4.enum(["PASS","FAIL"]).nullable(),action:z4.enum(["COMPLETE","WAITING_HUMAN","BLOCK"]).nullable(),blockingChecks:z4.array(DeliveryCheckKeySchema).max(16),approvalAction:z4.enum(["APPROVE","REJECT"]).nullable()}).nullable(),finalDelivery:FinalDeliveryReceiptSchema.nullable()});import{z as z8}from"zod";import{z as z7}from"zod";import{z as z6}from"zod";import{z as z5}from"zod";var ShotSoundContentSchema=z5.strictObject({model:z5.strictObject({modelProfileId:z5.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z5.int().positive(),connectionId:z5.uuid()}).optional(),nativeAudio:z5.boolean(),cues:z5.array(z5.strictObject({id:z5.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z5.enum(["DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT","NARRATION"]),startMs:z5.int().nonnegative().max(3e4),endMs:z5.int().positive().max(3e4),text:z5.string().trim().min(1).max(6e3).optional(),exactSpeech:z5.boolean(),lipSync:z5.enum(["REQUIRED","NONE"])}).refine(v=>v.endMs>v.startMs)).max(64)});var ShotSoundInstructionSchema=z5.strictObject({soundPlanVersionId:z5.uuid().toLowerCase(),fingerprint:z5.string().regex(/^[0-9a-f]{64}$/),content:ShotSoundContentSchema});var GenerationContractSchema=z6.strictObject({id:GenerationContractIdSchema,schemaVersion:z6.literal(1),preparationId:PreparationIdSchema,target:PreparationTargetSchema,basis:PreparationBasisSchema,mode:z6.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),creativeInstruction:z6.strictObject({sound:ShotSoundInstructionSchema.optional(),shot:ShotIntentSchema,scenePurpose:z6.string().min(1).max(800),locationContext:z6.string().max(300).optional(),timeContext:z6.string().max(300).optional(),productPresentationGoal:z6.string().min(1).max(1e3),styleTone:z6.string().max(300).optional(),entryBoundary:z6.array(BoundaryRequirementSchema).max(48),exitBoundary:z6.array(BoundaryRequirementSchema).max(48)}),acceptedShotReferences:z6.array(AcceptedVisualSourceReferenceSchema).max(24).default([]),constraintSetFingerprint:ContentFingerprintSchema,referenceSetFingerprint:ContentFingerprintSchema,output:z6.strictObject({aspectRatio:z6.enum(["16:9","9:16"]),targetDurationSeconds:z6.number().min(.5).max(30).nullable(),workingResolution:z6.null(),frameRate:z6.null(),finalDeliveryProfile:DeliveryOutputProfileSchema}),requiredCapabilities:z6.strictObject({referenceConditioning:z6.literal(true),referenceRoles:z6.array(ReferenceRoleSchema).min(1).max(8),startFrameControl:z6.boolean(),endFrameControl:z6.boolean(),nativeAudio:z6.boolean().optional()}),fingerprint:ContentFingerprintSchema}).superRefine((value,context)=>{const invalid=message=>context.addIssue({code:"custom",message});if(value.target.mediaType==="IMAGE"&&value.acceptedShotReferences.length)invalid("Image generation cannot depend on accepted video Shots");if(value.target.mediaType==="IMAGE"&&(value.mode!=="REFERENCE_TO_IMAGE"||value.output.targetDurationSeconds!==null||value.requiredCapabilities.startFrameControl||value.requiredCapabilities.endFrameControl))invalid("Image generation cannot claim video duration or frame-control semantics");if(value.target.mediaType==="VIDEO"&&(value.mode==="REFERENCE_TO_IMAGE"||value.output.targetDurationSeconds===null))invalid("Video generation requires video mode and duration");const roles=value.requiredCapabilities.referenceRoles;if(!roles.some(role=>role==="PRODUCT_IDENTITY"||role==="PRODUCT_PACKSHOT"))invalid("Product identity requires concrete reference conditioning");if(value.requiredCapabilities.startFrameControl&&!roles.includes("START_FRAME_ANCHOR"))invalid("Start-frame control requires an exact anchor role");if(value.requiredCapabilities.endFrameControl&&!roles.includes("END_FRAME_ANCHOR"))invalid("End-frame control requires an exact anchor role");if(value.mode==="FIRST_LAST_FRAME_TO_VIDEO"&&(!value.requiredCapabilities.startFrameControl||!value.requiredCapabilities.endFrameControl))invalid("First/last mode requires both anchor capabilities")});var PrepareShotRequestSchema=z7.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z7.int().positive(),expectedPlanVersionId:SceneShotPlanVersionIdSchema,expectedPlanVersion:z7.int().positive(),expectedShotPlanningRevision:z7.int().positive(),expectedPreparationVersion:z7.int().nonnegative(),idempotencyKey:z7.string().trim().min(1).max(200),target:PreparationTargetSchema,referenceBindings:z7.array(ReferenceBindingInputSchema).max(12).default([])});var PreparationVersionSchema=z7.strictObject({id:PreparationIdSchema,version:z7.int().positive(),basis:PreparationBasisSchema,target:PreparationTargetSchema,constraints:ConstraintSetSchema,referenceSet:ReferenceSetSchema,canonicalSources:z7.array(ExactEvidenceReferenceSchema).max(64),acceptedShotReferences:z7.array(AcceptedVisualSourceReferenceSchema).max(24).default([]),blockers:z7.array(PreparationBlockerSchema).max(2048),contract:GenerationContractSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z7.iso.datetime({offset:true})}).superRefine((value,context)=>{const invalid=message=>context.addIssue({code:"custom",message});if(value.constraints.preparationId!==value.id||value.referenceSet.preparationId!==value.id||value.constraints.version!==value.version||value.referenceSet.version!==value.version)invalid("Resolved snapshot identity must match preparation");if(value.contract!==null!==(value.blockers.length===0))invalid("A preparation contract exists only for an unblocked preflight");if(value.contract&&(value.contract.preparationId!==value.id||JSON.stringify(value.contract.basis)!==JSON.stringify(value.basis)||JSON.stringify(value.contract.target)!==JSON.stringify(value.target)||value.contract.constraintSetFingerprint!==value.constraints.fingerprint||value.contract.referenceSetFingerprint!==value.referenceSet.fingerprint||JSON.stringify(value.contract.acceptedShotReferences)!==JSON.stringify(value.acceptedShotReferences)))invalid("Generation Contract must freeze the exact preparation basis and snapshots")});var PrepareShotResultSchema=z7.strictObject({semanticStatus:z7.literal("SUCCESS"),preparation:PreparationVersionSchema,productionRevision:z7.int().positive()});var PreparationViewSchema=z7.strictObject({preparation:PreparationVersionSchema,freshness:z7.enum(["CURRENT_BASIS","STALE_BASIS"]),superseded:z7.boolean(),freshnessReasons:z7.array(z7.enum(["PLAN_CHANGED","SHOT_CHANGED","REFERENCE_UNAVAILABLE","CONSISTENCY_PROFILE_CHANGED","SOUND_PLAN_CHANGED","SUPERSEDED","KEYFRAME_SELECTION_CHANGED","PREDECESSOR_ACCEPTANCE_CHANGED"])).max(8),execution:z7.strictObject({eligibleVideoSelections:z7.array(ProviderSelectionSchema).max(1600).optional(),available:z7.boolean(),reasons:z7.array(z7.enum(["STALE_BASIS","PREPARATION_BLOCKED","PRODUCTION_NOT_RUNNABLE","PROVIDER_CAPABILITY_UNAVAILABLE","VIDEO_SELECTION_REQUIRED"])).min(0).max(4)})});var PreparationQueryInputSchema=z7.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),mediaType:z7.enum(["IMAGE","VIDEO"]).optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var PreparationQueryPageSchema=z7.strictObject({items:z7.array(PreparationViewSchema),page:QueryPageInfoSchema});var PreparationGetInputSchema=z7.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,preparationId:PreparationIdSchema});var PreparationActiveInputSchema=z7.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,mediaType:z7.enum(["IMAGE","VIDEO"])});var PreparationSummarySchema=z7.strictObject({latest:z7.int().nonnegative(),current:z7.int().nonnegative(),stale:z7.int().nonnegative(),contractValid:z7.int().nonnegative(),preflightBlocked:z7.int().nonnegative(),executionAvailable:z7.int().nonnegative()});var NullableVersionSchema=z8.int().positive().nullable();var ProductionBlockerSchema=z8.object({code:z8.string().min(1).max(120),summary:z8.string().min(1).max(1e3),targetType:z8.string().min(1).max(80),targetId:z8.string().min(1).max(2048)});var ProductionSnapshotSchema=z8.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,state:ProductionStateSchema,planning:z8.object({activeBriefVersion:NullableVersionSchema,activeStoryVersion:NullableVersionSchema,activeSceneShotPlanVersion:NullableVersionSchema}),preparation:PreparationSummarySchema.optional(),keyframes:KeyframeSummarySchema.optional(),keyframeReview:KeyframeReviewSummarySchema.optional(),videos:VideoSummarySchema.optional(),captions:CaptionSnapshotSchema.optional(),audio:AudioSnapshotSchema.optional(),shots:z8.object({planned:z8.int().nonnegative(),ready:z8.int().nonnegative(),generating:z8.int().nonnegative(),candidates:z8.int().nonnegative(),accepted:z8.int().nonnegative(),blocked:z8.int().nonnegative(),stale:z8.int().nonnegative()}),findings:z8.object({open:z8.int().nonnegative(),blocking:z8.int().nonnegative(),warnings:z8.int().nonnegative()}),timeline:z8.object({currentVersion:NullableVersionSchema,stale:z8.boolean(),...TimelineSnapshotSchema.omit({currentVersion:true,stale:true}).partial().shape}),roughCut:RoughCutSnapshotSchema.partial().required({latestVersion:true,reviewState:true}),review2:RoughCutReviewSnapshotSchema.optional(),final:z8.object({ready:FinalReadyViewSchema.optional(),render:FinalRenderSnapshotSchema.optional(),renderState:z8.string().min(1).max(120).nullable(),delivery:DeliverySummarySchema.optional(),deliveryValidationState:z8.string().min(1).max(120).nullable()}),work:WorkSummarySchema,activeOperations:z8.array(OperationSummarySchema).max(20),blockers:z8.array(ProductionBlockerSchema).max(100),latestDecisions:z8.array(z8.string().min(1).max(1e3)).max(50),nextActions:z8.array(NextActionSchema).max(50),generatedAt:z8.iso.datetime({offset:true})});import{z as z9}from"zod";var ProductionQueryInputSchema=z9.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema.optional(),search:z9.string().trim().min(1).max(200).optional(),attention:z9.enum(["NEEDS_YOU","WORKING","FINISHED"]).optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProductionQueryPageSchema=z9.object({items:z9.array(ProductionSchema),page:QueryPageInfoSchema});var OperationQueryInputSchema=z9.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var OperationQueryPageSchema=z9.object({items:z9.array(OperationSummarySchema),page:QueryPageInfoSchema});var StoryQueryInputSchema=z9.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var StoryQueryPageSchema=z9.object({items:z9.array(StoryVersionSchema),page:QueryPageInfoSchema});var SceneShotPlanQueryInputSchema=z9.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var SceneShotPlanQueryPageSchema=z9.object({items:z9.array(SceneShotPlanVersionSchema),page:QueryPageInfoSchema});import{z as z10}from"zod";var InterfaceCancellationDataSchema=z10.strictObject({cancellationAccepted:z10.boolean()});var InterfaceCancellationReceiptSchema=InterfaceCancellationDataSchema.extend({semanticStatus:z10.literal("SUCCESS")});import{z as z16}from"zod";import{z as z15}from"zod";import{z as z11}from"zod";var AgentExecutionContractDigest="834d35515b14007b7900b09bb8e2988169fe6400c77109dba0f793a628c32c90";var key=z11.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var AgentHostGenericInstallationTransportSchema=z11.strictObject({protocol:z11.literal("AGENT_STACK_GENERIC_INSTALLATION_V3"),installationId:key,installationRevisionId:key,slotKey:z11.string().regex(/^[a-z0-9_-]{1,64}$/),contractDigest:z11.literal(AgentExecutionContractDigest),capabilityDigest:z11.string().regex(/^[a-f0-9]{64}$/)});import{z as z12}from"zod";var id=z12.uuid();var sha3=z12.string().regex(/^[0-9a-f]{64}$/);var AgentHostExecutionScopeSchema=z12.strictObject({tenantId:id,projectId:id,productionId:id});var StartAgentHostExecutionSchema=AgentHostExecutionScopeSchema.extend({requestId:id,studioInputArtifactId:id,bindingId:id,expectedProductionRevision:z12.int().positive(),expectedBindingRevision:z12.int().positive(),expectedConfigurationVersion:z12.int().positive()});var AgentHostExecutionGetSchema=AgentHostExecutionScopeSchema.extend({executionId:id});var AgentHostExecutionQuerySchema=AgentHostExecutionScopeSchema.extend({limit:z12.int().min(1).max(100).default(20),beforeId:id.optional()});var AgentHostExecutionSourceSchema=z12.strictObject({artifactId:id,representationId:id,checksumSha256:sha3,byteSize:z12.int().positive().max(8388608),contentType:z12.string().min(1).max(100),kind:z12.enum(["PRODUCT_INFORMATION","REFERENCE_IMAGE","REFERENCE_VIDEO"])});var AgentHostExecutionInputSchema=AgentHostExecutionScopeSchema.extend({protocol:z12.literal("NATIVESTUDIO_PRODUCTION_V1"),executionId:id,hostRequestId:id,productionRevision:z12.int().positive(),studioInput:StudioInputContentSchema,intake:AgentHostExecutionSourceSchema,sources:z12.array(AgentHostExecutionSourceSchema).max(12)}).refine(v=>v.studioInput.productionId===v.productionId&&v.studioInput.sourceArtifactIds.length===v.sources.length&&new Set(v.sources.map(s=>s.artifactId)).size===v.sources.length&&v.sources.every((s,index)=>s.artifactId===v.studioInput.sourceArtifactIds[index])&&!v.sources.some(s=>s.artifactId===v.intake.artifactId));var NativeInstallationTransportSchema=z12.strictObject({protocol:z12.literal("AGENT_STACK_NATIVE_INSTALLATION_V2"),installationId:z12.string().regex(/^[A-Za-z0-9_-]{1,160}$/),installationRevisionId:z12.string().regex(/^[A-Za-z0-9_-]{1,160}$/),slotKey:z12.string().regex(/^[a-z0-9_-]{1,64}$/)});var AgentHostInstallationTransportSchema=z12.discriminatedUnion("protocol",[NativeInstallationTransportSchema,AgentHostGenericInstallationTransportSchema]);var AgentHostNativeToolAuthoritySchema=AgentHostExecutionScopeSchema.extend({protocol:z12.literal("NATIVESTUDIO_AGENT_TOOLS_V1"),authorityRef:id,executionId:id,hostRequestId:id,bindingId:id,configurationVersion:z12.int().positive(),inputFingerprint:sha3,capabilityDigest:sha3,expiresAt:z12.iso.datetime({offset:true}),executionClass:z12.enum(["LIVE","TEST_ONLY"]),transport:AgentHostInstallationTransportSchema.optional()});var AgentHostExecutionSnapshotSchema=z12.strictObject({binding:AgentHostBindingSchema,input:AgentHostExecutionInputSchema,authority:AgentHostNativeToolAuthoritySchema}).refine(v=>v.binding.tenantId===v.input.tenantId&&v.binding.projectId===v.input.projectId&&v.binding.enabled&&v.authority.tenantId===v.input.tenantId&&v.authority.projectId===v.input.projectId&&v.authority.productionId===v.input.productionId&&v.authority.executionId===v.input.executionId&&v.authority.hostRequestId===v.input.hostRequestId&&v.authority.bindingId===v.binding.bindingId&&v.authority.configurationVersion===v.binding.configurationVersion);var AgentHostTaskObservationSchema=z12.strictObject({requestId:id,runKey:z12.string().regex(/^[A-Za-z0-9_-]{1,160}$/),status:z12.enum(["accepted","running","succeeded","failed","cancelled","unknown"]),agentKey:z12.string().min(1).max(64),agentVersion:z12.int().positive(),modelOptionKey:z12.string().min(1).max(64),cancelRequested:z12.boolean(),createdAt:z12.iso.datetime({offset:true}),updatedAt:z12.iso.datetime({offset:true}),timing:z12.strictObject({acceptedAt:z12.iso.datetime({offset:true}),deadlineAt:z12.iso.datetime({offset:true}),limitSource:z12.literal("TASK_POLICY")}).nullable()});var AgentHostDispatchPhaseSchema=z12.enum(["ADMITTED","SENDING","OUTCOME_UNKNOWN","OBSERVING","REJECTED","CANCELLED_BEFORE_SUBMISSION"]);var AgentHostExecutionViewSchema=AgentHostExecutionScopeSchema.extend({executionId:id,requestId:id,requestedByPrincipalId:id,hostRequestId:id,revision:z12.int().positive(),snapshotFingerprint:sha3,snapshot:AgentHostExecutionSnapshotSchema,dispatchPhase:AgentHostDispatchPhaseSchema,active:z12.boolean(),observation:AgentHostTaskObservationSchema.nullable(),cancelRequestId:id.nullable(),errorCode:z12.string().regex(/^[A-Z_]{1,80}$/).nullable(),createdAt:z12.iso.datetime({offset:true}),updatedAt:z12.iso.datetime({offset:true})}).refine(v=>v.snapshot.input.executionId===v.executionId&&v.snapshot.input.hostRequestId===v.hostRequestId&&v.snapshot.input.tenantId===v.tenantId&&v.snapshot.input.projectId===v.projectId&&v.snapshot.input.productionId===v.productionId&&(!v.observation||v.observation.requestId===v.hostRequestId&&v.observation.agentKey===v.snapshot.binding.selection.agentKey&&v.observation.agentVersion===v.snapshot.binding.selection.agentVersion&&v.observation.modelOptionKey===v.snapshot.binding.selection.modelOptionKey));var AgentHostExecutionPageSchema=z12.strictObject({items:z12.array(AgentHostExecutionViewSchema).max(100),hasMore:z12.boolean(),nextBeforeId:id.nullable()}).refine(v=>v.hasMore===(v.nextBeforeId!==null)&&(!v.hasMore||v.nextBeforeId===v.items.at(-1)?.executionId)&&new Set(v.items.map(item=>item.executionId)).size===v.items.length);var AgentHostExecutionEventSchema=z12.strictObject({id,executionId:id,revision:z12.int().positive(),action:z12.enum(["ADMIT","CLAIM","RECOVER_UNKNOWN","OBSERVE","REJECT","CANCEL_REQUEST","CANCEL_UNSENT"]),createdByPrincipalId:id,observation:AgentHostTaskObservationSchema.nullable(),errorCode:z12.string().regex(/^[A-Z_]{1,80}$/).nullable(),createdAt:z12.iso.datetime({offset:true})});var AgentHostExecutionEventQuerySchema=AgentHostExecutionGetSchema.extend({limit:z12.int().min(1).max(100).default(20),beforeRevision:z12.int().positive().optional()});var AgentHostExecutionEventPageSchema=z12.strictObject({items:z12.array(AgentHostExecutionEventSchema).max(100),hasMore:z12.boolean(),nextBeforeRevision:z12.int().positive().nullable()}).refine(v=>v.hasMore===(v.nextBeforeRevision!==null)&&(!v.hasMore||v.nextBeforeRevision===v.items.at(-1)?.revision)&&v.items.every((item,index)=>!index||item.revision<v.items[index-1].revision));var AgentHostExecutionFailureSchema=z12.strictObject({semanticStatus:z12.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z12.strictObject({code:z12.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","REVISION_CONFLICT","REQUEST_CONFLICT","SOURCE_UNAVAILABLE","TOOL_AUTHORITY_UNAVAILABLE","ACTIVE_EXECUTION_EXISTS","LEASE_LOST","BINDING_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),message:z12.literal("Agent Host execution did not complete")})});import{z as z13}from"zod";var id2=z13.uuid().regex(/^[0-9a-f-]{36}$/);var key2=z13.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest=z13.string().regex(/^[a-f0-9]{64}$/);var https=z13.url().max(2048).refine(v=>{const u=new URL(v);return u.protocol==="https:"&&!u.username&&!u.password&&!u.search&&!u.hash});var AgentExecutionLimitsSchema=z13.strictObject({grantMaxSeconds:z13.int().positive().max(30*86400),executionMaxSeconds:z13.int().min(10).max(21600),leaseMaxSeconds:z13.int().positive(),renewWindowSeconds:z13.int().positive(),renewBeforeSeconds:z13.int().positive(),assertionSeconds:z13.literal(60),clockSkewSeconds:z13.literal(5)}).refine(v=>v.renewBeforeSeconds<=v.renewWindowSeconds&&v.renewWindowSeconds<v.leaseMaxSeconds&&v.leaseMaxSeconds<=v.executionMaxSeconds);var AgentExecutionCapabilitiesSchema=z13.strictObject({protocol:z13.literal("delegated-mcp-execution"),protocolVersion:z13.literal(1),contractDigest:z13.literal(AgentExecutionContractDigest),issuer:https.refine(v=>new URL(v).origin===v),resource:https,endpoints:z13.strictObject({capabilities:https,authorize:https,token:https,identity:https,bind:https,bindingQuery:https,access:https,accessQuery:https,leaseRenew:https,leaseQuery:https,close:https}),supportedProfiles:z13.tuple([z13.literal("stateless-json-v1")]),limits:AgentExecutionLimitsSchema}).refine(v=>new URL(v.resource).origin===v.issuer&&Object.values(v.endpoints).every(e=>new URL(e).origin===v.issuer));var AgentExecutionDescriptorSchema=z13.strictObject({schemaVersion:z13.literal(1),runtimeKey:key2,installationId:key2,displayName:z13.string().min(1).max(160),redirectUri:https,publicJwk:NativeRuntimePublicKeySchema});var AgentExecutionProfileSchema=z13.strictObject({schemaVersion:z13.literal(1),profileKey:key2,revision:z13.int().positive(),capabilities:AgentExecutionCapabilitiesSchema,capabilityDigest:digest,nativeToolCapabilityDigest:digest,redirectOrigins:z13.array(https.refine(v=>new URL(v).origin===v)).min(1).max(16),scopes:z13.array(z13.string().regex(/^[A-Za-z0-9:_-]{1,128}$/)).min(1).max(32),bootstrap:z13.strictObject({slotKey:z13.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),entryTool:z13.string().regex(/^[A-Za-z0-9_.-]{1,128}$/),argumentsMode:z13.literal("task-input")})});var AgentExecutionRegistrationSchema=AgentExecutionDescriptorSchema.extend({clientId:key2,registrationRevision:z13.int().positive(),issuer:https,resource:https,keyId:z13.string().regex(/^[A-Za-z0-9_-]{43}$/),protocol:z13.literal("delegated-mcp-execution"),protocolVersion:z13.literal(1),contractDigest:z13.literal(AgentExecutionContractDigest),capabilityDigest:digest});var ApproveAgentExecutionRegistrationSchema=AgentHostScopeSchema.extend({requestId:id2,bindingId:id2,expectedBindingRevision:z13.int().positive(),expectedConfigurationVersion:z13.int().positive(),profileKey:key2,expectedProfileRevision:z13.int().positive(),descriptor:AgentExecutionDescriptorSchema});var AgentExecutionRegistrationGetSchema=AgentHostScopeSchema.extend({clientId:id2});var RevokeAgentExecutionRegistrationSchema=AgentExecutionRegistrationGetSchema.extend({requestId:id2,expectedRevision:z13.int().positive()});var AgentExecutionRegistrationViewSchema=AgentExecutionRegistrationGetSchema.extend({schemaVersion:z13.literal(1),revision:z13.int().positive(),enabled:z13.boolean(),bindingId:id2,bindingRevision:z13.int().positive(),configurationVersion:z13.int().positive(),profile:AgentExecutionProfileSchema,registration:AgentExecutionRegistrationSchema,approvedByPrincipalId:id2,createdAt:z13.iso.datetime(),revokedAt:z13.iso.datetime().nullable()}).refine(v=>v.clientId===v.registration.clientId&&v.enabled===(v.revokedAt===null)&&v.registration.capabilityDigest===v.profile.capabilityDigest&&v.registration.resource===v.profile.capabilities.resource&&v.registration.issuer===v.profile.capabilities.issuer);import{z as z14}from"zod";var id3=z14.uuid();var opaque=z14.string().min(1).max(4096);var digest2=z14.string().regex(/^[a-f0-9]{64}$/);var AgentExecutionConsentSchema=z14.strictObject({response_type:z14.literal("code"),client_id:id3,redirect_uri:z14.url().max(2048),resource:z14.url().max(2048),scope:z14.string().min(1).max(4096),state:z14.string().min(1).max(512),code_challenge:z14.string().regex(/^[A-Za-z0-9_-]{43}$/),code_challenge_method:z14.literal("S256")});var ApproveAgentExecutionConsentSchema=AgentHostScopeSchema.extend({profileKey:z14.string().regex(/^[A-Za-z0-9_-]{1,160}$/),requestId:id3,consent:AgentExecutionConsentSchema,expiresInSeconds:z14.int().min(60).max(30*86400)});var AgentExecutionGrantSchema=z14.strictObject({protocolVersion:z14.literal(1),clientId:id3,registrationRevision:z14.int().positive(),resource:z14.url().max(2048),grantRef:id3,grantRevision:z14.int().positive(),expiresAt:z14.iso.datetime(),scopes:z14.array(z14.string().min(1).max(128)).min(1).max(32)});var AgentExecutionTokenFormSchema=z14.discriminatedUnion("grant_type",[z14.strictObject({grant_type:z14.literal("authorization_code"),client_id:id3,resource:z14.url().max(2048),registration_revision:z14.string().regex(/^[1-9][0-9]{0,14}$/),code:opaque,code_verifier:z14.string().regex(/^[A-Za-z0-9._~-]{43,128}$/),redirect_uri:z14.url().max(2048),client_assertion_type:z14.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque}),z14.strictObject({grant_type:z14.literal("refresh_token"),client_id:id3,resource:z14.url().max(2048),registration_revision:z14.string().regex(/^[1-9][0-9]{0,14}$/),refresh_token:opaque,client_assertion_type:z14.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque})]);var AgentExecutionAssertionSchema=z14.strictObject({iss:id3,sub:id3,aud:z14.url().max(2048),iat:z14.int().nonnegative(),exp:z14.int().positive(),jti:id3,requestDigest:digest2}).refine(v=>v.exp===v.iat+60);var id4=z15.uuid();var key3=z15.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest3=z15.string().regex(/^[a-f0-9]{64}$/);var time=z15.iso.datetime();var AgentExecutionIdentitySchema=z15.strictObject({authorityRef:key3,executionId:key3,installationId:key3,installationRevisionId:key3,invocationId:id4,inputDigest:digest3});var AgentExecutionLeaseSchema=z15.strictObject({protocolVersion:z15.literal(1),bindingId:key3,executionId:key3,leaseRevision:z15.int().positive(),expiresAt:time,hardExpiresAt:time,renewedAt:time,renewBeforeSeconds:z15.int().positive()});var AgentExecutionBindingReceiptSchema=AgentExecutionIdentitySchema.extend({protocolVersion:z15.literal(1),bindingId:key3,grantRef:key3,grantRevision:z15.int().positive(),hardExpiresAt:time,boundAt:time,lease:AgentExecutionLeaseSchema});var AgentExecutionAccessMetadataSchema=z15.strictObject({protocolVersion:z15.literal(1),bindingId:key3,executionId:key3,accessGeneration:z15.int().positive(),expiresAt:time});var AgentExecutionPayloadSchemas={identity:z15.strictObject({}),bind:AgentExecutionIdentitySchema.extend({deadlineAt:time}),bindingQuery:z15.strictObject({authorityRef:key3,executionId:key3,originalRequestId:id4}),access:z15.strictObject({bindingId:key3,executionId:key3,expectedAccessGeneration:z15.int().nonnegative()}),accessQuery:z15.strictObject({bindingId:key3,executionId:key3,originalRequestId:id4}),leaseRenew:z15.strictObject({bindingId:key3,executionId:key3,expectedLeaseRevision:z15.int().positive()}),leaseQuery:z15.strictObject({bindingId:key3,executionId:key3,originalRequestId:id4}),close:z15.strictObject({bindingId:key3,executionId:key3,reason:z15.enum(["FINISHED","CANCELLED","ABORTED"])})};var envelope=z15.strictObject({protocolVersion:z15.literal(1),contractDigest:z15.literal(AgentExecutionContractDigest),capabilityDigest:digest3,requestId:id4,clientId:id4,registrationRevision:z15.int().positive(),resource:z15.url().max(2048),grantRef:id4,grantRevision:z15.int().positive(),payload:z15.unknown(),clientAssertion:z15.string().min(1).max(4096)});var AgentExecutionRequestSchemas={identity:envelope.extend({payload:AgentExecutionPayloadSchemas.identity}),bind:envelope.extend({payload:AgentExecutionPayloadSchemas.bind}),bindingQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.bindingQuery}),access:envelope.extend({payload:AgentExecutionPayloadSchemas.access}),accessQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.accessQuery}),leaseRenew:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseRenew}),leaseQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseQuery}),close:envelope.extend({payload:AgentExecutionPayloadSchemas.close})};var AgentExecutionQualificationSchema=z15.strictObject({protocol:z15.literal("NVS_GENERIC_EXECUTION_QUALIFICATION_V1"),transport:AgentHostGenericInstallationTransportSchema,selection:AgentHostSelectionSchema,checkedAt:time,executionClass:z15.enum(["LIVE","TEST_ONLY"])});var AgentExecutionPermitSchema=z15.strictObject({schemaVersion:z15.literal(1),proof:AgentHostNativeToolAuthoritySchema,input:AgentHostExecutionInputSchema,inputDigest:digest3,guidance:z15.strictObject({version:z15.string().min(1).max(100),instructions:z15.string().min(1).max(2e4)}),registration:AgentExecutionRegistrationViewSchema,grant:AgentExecutionGrantSchema,qualification:AgentExecutionQualificationSchema,requestedByPrincipalId:id4,createdAt:time}).refine(v=>v.proof.transport?.protocol==="AGENT_STACK_GENERIC_INSTALLATION_V3"&&v.proof.tenantId===v.registration.tenantId&&v.proof.projectId===v.registration.projectId&&v.proof.productionId===v.input.productionId&&v.proof.executionId===v.input.executionId&&v.proof.hostRequestId===v.input.hostRequestId&&v.proof.bindingId===v.registration.bindingId&&v.proof.configurationVersion===v.registration.configurationVersion&&v.proof.capabilityDigest===v.registration.profile.nativeToolCapabilityDigest&&v.proof.transport.capabilityDigest===v.registration.profile.capabilityDigest&&v.grant.clientId===v.registration.clientId&&v.grant.resource===v.registration.registration.resource&&v.grant.registrationRevision===v.registration.registration.registrationRevision&&v.qualification.transport.installationId===v.proof.transport.installationId&&v.qualification.transport.installationRevisionId===v.proof.transport.installationRevisionId&&v.qualification.transport.capabilityDigest===v.proof.transport.capabilityDigest&&v.qualification.transport.slotKey===v.proof.transport.slotKey&&Date.parse(v.proof.expiresAt)<=Date.parse(v.grant.expiresAt)&&v.input.tenantId===v.proof.tenantId&&v.input.projectId===v.proof.projectId&&v.registration.enabled&&v.proof.transport.installationId===v.registration.registration.installationId&&v.proof.transport.slotKey===v.registration.profile.bootstrap.slotKey&&v.proof.executionClass===v.qualification.executionClass);var AgentExecutionBindingSchema=z15.strictObject({protocol:z15.literal("delegated-mcp-execution"),protocolVersion:z15.literal(1),contractDigest:z15.literal(AgentExecutionContractDigest),capabilityDigest:digest3,issuer:z15.url(),resource:z15.url(),slotKey:z15.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),registration:AgentExecutionRegistrationViewSchema.shape.registration,grant:AgentExecutionGrantSchema,endpoints:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.endpoints,limits:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.limits,bootstrap:AgentExecutionRegistrationViewSchema.shape.profile.shape.bootstrap,transportPolicy:z15.strictObject({profile:z15.literal("stateless-json-v1")}),runtimePolicy:z15.strictObject({sandbox:z15.literal("read-only"),webSearch:z15.literal("disabled"),localExecution:z15.literal("disabled"),toolExposure:z15.literal("direct"),maxTurns:z15.literal(1)})});var AgentExecutionInstallationObservationSchema=z15.strictObject({schemaVersion:z15.literal(3),installationId:key3,installationRevisionId:key3,slotKey:z15.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),binding:AgentExecutionBindingSchema,identity:AgentExecutionGrantSchema.extend({decision:z15.enum(["ALLOW","DRAIN","DENY","UNKNOWN"]),observedAt:time}),checkedAt:time});var AgentExecutionBootstrapInputSchema=z15.strictObject({nativeStudio:AgentHostExecutionInputSchema.safeExtend({nativeToolAuthority:AgentHostNativeToolAuthoritySchema})});var task=AgentExecutionBootstrapInputSchema.shape.nativeStudio;var AgentExecutionBootstrapResultSchema=z16.strictObject({schemaVersion:z16.literal(1),protocol:z16.literal("NVS_EXECUTION_CONTEXT_V1"),executionId:task.shape.executionId,hostRequestId:task.shape.hostRequestId,inputDigest:z16.string().regex(/^[a-f0-9]{64}$/),task,guidance:AgentExecutionPermitSchema.shape.guidance,outputContract:z16.strictObject({version:z16.literal("NVS_HOST_REPORT_V1"),authoritative:z16.literal(false),instructions:z16.string().min(1).max(2e4)})});import{z as z19}from"zod";import{z as z18}from"zod";import{z as z17}from"zod";var ArtifactLifecycleSchema=z17.enum(["CREATING","PROCESSING","READY","INVALID","ARCHIVED"]);var ArtifactMetadataSchema=z17.object({id:ArtifactIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),family:z17.string().trim().min(1),origin:z17.string().trim().min(1),lifecycle:ArtifactLifecycleSchema,createdByPrincipalId:PrincipalIdSchema,checksumSha256:z17.string().regex(/^[0-9a-f]{64}$/).nullable(),contentType:z17.string().trim().min(1).nullable(),primaryRepresentationId:ArtifactRepresentationIdSchema.nullable(),mediaMetadata:z17.record(z17.string(),z17.unknown()),createdAt:z17.iso.datetime({offset:true}),readyAt:z17.iso.datetime({offset:true}).nullable()});var ArtifactRepresentationSchema=z17.object({id:ArtifactRepresentationIdSchema,tenantId:TenantIdSchema,artifactId:ArtifactIdSchema,role:z17.string().trim().min(1),storageDriver:z17.string().trim().min(1),storageLocator:z17.record(z17.string(),z17.unknown()),checksumSha256:z17.string().regex(/^[0-9a-f]{64}$/),contentType:z17.string().trim().min(1),byteSize:z17.string().regex(/^\d+$/),width:z17.int().positive().nullable(),height:z17.int().positive().nullable(),durationMs:z17.string().regex(/^\d+$/).nullable(),frameRate:z17.string().nullable(),videoCodec:z17.string().nullable(),audioCodec:z17.string().nullable(),hasAudio:z17.boolean().nullable(),sampleRateHz:z17.int().positive().nullable(),audioChannels:z17.int().positive().nullable(),createdAt:z17.iso.datetime({offset:true})});var ArtifactRelationSchema=z17.object({id:ArtifactRelationIdSchema,tenantId:TenantIdSchema,sourceArtifactId:ArtifactIdSchema,targetArtifactId:ArtifactIdSchema,relationType:z17.string().trim().min(1),createdByPrincipalId:PrincipalIdSchema,createdAt:z17.iso.datetime({offset:true})});var RegisterReadyArtifactInputSchema=z17.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),principalId:PrincipalIdSchema,family:z17.string().trim().min(1),origin:z17.string().trim().min(1),representation:z17.object({role:z17.string().trim().min(1),storageDriver:z17.string().trim().min(1),storageLocator:z17.record(z17.string(),z17.unknown()),checksumSha256:z17.string().regex(/^[0-9a-f]{64}$/),contentType:z17.string().trim().min(1),byteSize:z17.string().regex(/^\d+$/),width:z17.int().positive().nullable(),height:z17.int().positive().nullable(),durationMs:z17.string().regex(/^\d+$/).nullable(),frameRate:z17.string().nullable(),videoCodec:z17.string().nullable(),audioCodec:z17.string().nullable(),hasAudio:z17.boolean().nullable(),sampleRateHz:z17.int().positive().nullable(),audioChannels:z17.int().positive().nullable()}),mediaMetadata:z17.record(z17.string(),z17.unknown()).default({}),provenance:z17.array(z17.object({targetArtifactId:ArtifactIdSchema,relationType:z17.string().trim().min(1)})).default([])});var ReadyArtifactRegistrationSchema=z17.object({artifact:ArtifactMetadataSchema,primaryRepresentation:ArtifactRepresentationSchema,relations:z17.array(ArtifactRelationSchema)});var SourceInputMetadataSchema=z17.strictObject({idempotencyKey:z17.string().trim().min(1).max(200).optional(),tenantId:TenantIdSchema,kind:z17.enum(["PRODUCT_INFORMATION","REFERENCE_IMAGE","REFERENCE_VIDEO"]),contentType:z17.enum(["text/plain","application/json","image/png","image/jpeg","image/webp","video/mp4"]),originalName:z17.string().trim().min(1).max(255).optional()});var UploadSourceInputRequestSchema=SourceInputMetadataSchema.extend({contentBase64:z17.string().min(4).max(11184812).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var key4=z18.string().trim().min(1).max(200);var ScopedSourceInputSchema=SourceInputMetadataSchema.extend({projectId:ProjectIdSchema,idempotencyKey:key4});var ScopedSourceUploadSchema=UploadSourceInputRequestSchema.extend({projectId:ProjectIdSchema,idempotencyKey:key4});var SourceReadSchema=SourceLibraryMediaSchema.extend({offsetBytes:z18.int().min(0).max(8388608).default(0),maxTextBytes:z18.int().min(4).max(65536).default(16384)});var SourceTextWindowSchema=SourceLibraryMediaSchema.extend({contentType:z18.enum(["text/plain","application/json"]),checksumSha256:z18.string().regex(/^[0-9a-f]{64}$/),totalBytes:z18.int().positive().max(8388608),offsetBytes:z18.int().nonnegative(),byteLength:z18.int().nonnegative().max(65536),nextOffsetBytes:z18.int().nonnegative().nullable(),text:z18.string().max(65536)});var InterfaceImageMetadataSchema=KeyframeMediaSchema.omit({contentBase64:true});var InterfacePosterMetadataSchema=InterfaceImageMetadataSchema.extend({contentType:z19.literal("image/png")});var InterfaceDownloadDescriptorSchema=z19.strictObject({method:z19.literal("GET"),path:z19.string().min(1).max(2048),tenantId:TenantIdSchema,authentication:z19.literal("BEARER_AND_TENANT_HEADER"),contentType:z19.enum(["video/mp4","image/png","application/json"]),checksumSha256:z19.string().regex(/^[0-9a-f]{64}$/),byteSize:z19.int().positive().max(128*1024*1024)});var SourceReadResultSchema=z19.union([SourceTextWindowSchema,SourceLibraryMediaSchema.extend(InterfaceImageMetadataSchema.shape).strict(),SourceLibraryMediaSchema.extend({contentType:z19.literal("video/mp4"),checksumSha256:z19.string().regex(/^[0-9a-f]{64}$/),byteSize:z19.int().positive().max(8388608),importOperation:z19.literal("imported-visual.register-source")}).strict()]);import{z as z20}from"zod";var StartReferencePreviewSchema=z20.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sourceArtifactId:ArtifactIdSchema,expectedBriefVersion:z20.int().positive(),idempotencyKey:z20.string().regex(/^[A-Za-z0-9_-]{8,80}$/)});var ReferencePreviewAdmissionSchema=z20.strictObject({semanticStatus:z20.literal("ACCEPTED"),operationId:OperationIdSchema,productionId:ProductionIdSchema,sourceArtifactId:ArtifactIdSchema,briefVersion:z20.int().positive()});var ReferencePreviewResultSchema=z20.strictObject({semanticStatus:z20.literal("SUCCESS"),sourceArtifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,contentType:z20.literal("image/png"),checksumSha256:z20.string().regex(/^[0-9a-f]{64}$/),width:z20.int().positive(),height:z20.int().positive(),byteSize:z20.int().positive(),contentBase64:z20.string().min(4)});var ReferencePreviewOperationInputSchema=z20.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,operationId:OperationIdSchema});import{z as z21}from"zod";var StudioCapabilitiesInputSchema=z21.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema.optional()});var StudioCapabilitiesSchema=z21.strictObject({semanticStatus:z21.literal("SUCCESS"),capabilities:z21.array(z21.strictObject({capability:z21.string().min(1).max(120),tool:z21.string().min(1).max(120).optional(),availability:z21.enum(["AVAILABLE","UNAVAILABLE"]),reason:z21.string().min(1).max(1e3).nullable()})).max(512)});var VideoOptionsSchema=z21.array(z21.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600);import{z as z22}from"zod";var WorkspaceHealthSchema=z22.object({service:z22.string().min(1),status:z22.literal("ok")});import{z as z23}from"zod";var PrincipalKindSchema=z23.enum(["HUMAN","AGENT","SERVICE","WORKER"]);var PrincipalSchema=z23.object({id:PrincipalIdSchema,kind:PrincipalKindSchema,issuer:z23.string().trim().min(1),subject:z23.string().trim().min(1),displayName:z23.string().trim().min(1).nullable()});var TenantMembershipSchema=z23.object({tenantId:TenantIdSchema,principalId:PrincipalIdSchema});import{z as z24}from"zod";var TenantSchema=z24.object({id:TenantIdSchema,displayName:z24.string().trim().min(1).nullable(),createdAt:z24.iso.datetime({offset:true})});import{z as z25}from"zod";var Key=z25.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var Intent=z25.string().trim().min(1).max(600);var ExplorationScopeSchema=DirectorScopeSchema.extend({shotId:ShotIdSchema});var ExplorationBasisSchema=DirectorBasisSchema.safeExtend({shotId:ShotIdSchema,shotPlanningRevision:z25.int().positive()});var ExplorationContextInputSchema=z25.strictObject({scope:ExplorationScopeSchema,preparationIds:z25.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=z25.strictObject({selection:ProviderSelectionSchema.nullable(),profile:z25.discriminatedUnion("mediaType",[KeyframeProviderProfileSchema,VideoProviderProfileSchema])});var Missing=z25.strictObject({semanticStatus:z25.literal("NEEDS_INPUT"),missingPrerequisites:z25.array(z25.enum(["ACTIVE_BRIEF","ACTIVE_STORY","ACTIVE_SCENE_SHOT_PLAN"])).min(1).max(3)});var ExplorationContextResultSchema=z25.discriminatedUnion("semanticStatus",[z25.strictObject({semanticStatus:z25.literal("SUCCESS"),advisory:z25.literal(true),basis:ExplorationBasisSchema,owner:DirectorContextResultSchema.options[0],preparations:z25.array(z25.strictObject({view:PreparationViewSchema,eligibleOptions:z25.array(ExplorationOptionSchema).max(24),eligibleOptionCount:z25.int().nonnegative(),optionsTruncated:z25.boolean()})).max(6)}),Missing]);var ImageDraft=KeyframeStartInputSchema.omit({idempotencyKey:true});var VideoDraft=VideoStartInputSchema.omit({idempotencyKey:true});var ExplorationCommandSchema=z25.strictObject({commandKey:Key,purpose:Intent,mediaType:z25.enum(["IMAGE","VIDEO"]),preparationId:PreparationIdSchema,contractId:ImageDraft.shape.contractId,contractFingerprint:ImageDraft.shape.contractFingerprint,selection:ProviderSelectionSchema.nullable(),profile:ExplorationProfileIdentitySchema});var ValidateExplorationPlanSchema=z25.strictObject({basis:ExplorationBasisSchema,plan:z25.strictObject({origin:z25.strictObject({kind:z25.literal("EXTERNAL_AGENT_HOST"),label:z25.string().trim().min(1).max(100)}),objective:Intent,comparisonCriteria:z25.array(Intent).min(1).max(8),unknowns:z25.array(z25.string().trim().min(1).max(300)).max(8),maximumGenerationCommands:z25.int().min(1).max(6),commands:z25.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=z25.discriminatedUnion("mediaType",[z25.strictObject({commandKey:Key,mediaType:z25.literal("IMAGE"),request:ImageDraft}),z25.strictObject({commandKey:Key,mediaType:z25.literal("VIDEO"),request:VideoDraft})]);var ExplorationValidationResultSchema=z25.discriminatedUnion("semanticStatus",[z25.strictObject({semanticStatus:z25.literal("SUCCESS"),advisory:z25.literal(true),basis:ExplorationBasisSchema,plan:ValidateExplorationPlanSchema.shape.plan,generationDrafts:z25.array(ExplorationDraftSchema).min(1).max(6),limitations:z25.array(z25.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=z25.strictObject({scope:ExplorationScopeSchema,items:z25.array(z25.strictObject({label:Key,mediaType:z25.enum(["IMAGE","VIDEO"]),generationId:z25.uuid()})).min(2).max(6)});var ExplorationComparisonResultSchema=z25.strictObject({semanticStatus:z25.literal("SUCCESS"),advisory:z25.literal(true),scope:ExplorationScopeSchema,items:z25.array(z25.discriminatedUnion("mediaType",[z25.strictObject({label:Key,mediaType:z25.literal("IMAGE"),generation:KeyframeGenerationViewSchema,handoff:z25.strictObject({mediaRead:KeyframeReviewScopeSchema,reviewTarget:KeyframeReviewScopeSchema}).nullable()}),z25.strictObject({label:Key,mediaType:z25.literal("VIDEO"),generation:VideoGenerationViewSchema,handoff:z25.strictObject({mediaRead:VideoReviewScopeSchema,reviewTarget:VideoReviewScopeSchema}).nullable()})])).min(2).max(6),limitations:z25.tuple([z25.literal("OWNER_STATES_ARE_NOT_VISUAL_SCORES"),z25.literal("REVIEW_AND_ACCEPTANCE_REMAIN_EXPLICIT")])});import{z as z26}from"zod";var sha4=z26.string().regex(/^[0-9a-f]{64}$/);var FinalOutputReviewContextInputSchema=z26.strictObject({scope:DirectorScopeSchema,renderId:z26.uuid()});var FinalOutputReviewBasisSchema=FinalOutputReviewContextInputSchema.extend({contextFingerprint:sha4});var FinalOutputReviewContextResultSchema=z26.strictObject({semanticStatus:z26.literal("SUCCESS"),advisory:z26.literal(true),basis:FinalOutputReviewBasisSchema,ownerContext:DirectorContextResultSchema,deliveryTarget:DeliveryTargetSchema,deliverySnapshot:DeliverySnapshotSchema,validation:DeliveryValidationViewSchema.nullable(),manifest:RegisteredDeliveryManifestSchema.nullable(),limitations:z26.array(z26.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 z35}from"zod";import{z as z34}from"zod";import{z as z27}from"zod";var sha5=z27.string().regex(/^[0-9a-f]{64}$/);var name=z27.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/);var CompositionPathSchema=z27.string().max(240).regex(/^[A-Za-z0-9_-][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.-]+)*$/).refine(v=>!v.split("/").some(p=>p==="."||p===".."));var CompositionScopeSchema=z27.strictObject({tenantId:z27.uuid(),productionId:z27.uuid()});var CompositionBasisPinSchema=z27.strictObject({briefVersionId:z27.uuid(),storyVersionId:z27.uuid(),planVersionId:z27.uuid(),shotId:z27.uuid().nullable()});var CompositionBindingSchema=z27.strictObject({name,purpose:z27.enum(["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK","DATA","FONT","IMAGE","VIDEO"]),artifactId:z27.uuid(),representationId:z27.uuid(),checksumSha256:sha5,declaredOrigin:z27.enum(["CODE","AI","HUMAN","IMPORTED","UNKNOWN"])});var parameter=z27.discriminatedUnion("type",[z27.strictObject({name,type:z27.literal("STRING"),value:z27.string().max(4e3),maxLength:z27.int().min(0).max(4e3)}).refine(v=>v.value.length<=v.maxLength),z27.strictObject({name,type:z27.literal("NUMBER"),value:z27.number().finite(),minimum:z27.number().finite(),maximum:z27.number().finite()}).refine(v=>v.minimum<=v.value&&v.value<=v.maximum),z27.strictObject({name,type:z27.literal("BOOLEAN"),value:z27.boolean()})]);var CompositionContentSchema=z27.strictObject({schemaVersion:z27.literal(1),provider:z27.literal("HYPERFRAME"),dialect:z27.literal("HYPERFRAME_HTML_GSAP_V1"),role:z27.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),executionClass:z27.enum(["LIVE","TEST_ONLY"]),intent:z27.string().trim().min(1).max(2e3),viewport:z27.strictObject({width:z27.int().min(1).max(8192),height:z27.int().min(1).max(8192)}),clock:z27.strictObject({numerator:z27.int().positive(),denominator:z27.int().positive(),frameCount:z27.int().positive().max(2147483647)}),entrypoint:CompositionPathSchema,parameterSchemaVersion:z27.literal(1),parameters:z27.array(parameter).max(64),bindings:z27.array(CompositionBindingSchema).min(3).max(64),dependencies:z27.array(z27.strictObject({name:z27.string().regex(/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/),version:z27.string().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),integrity:z27.string().regex(/^sha(?:256|384|512)-[A-Za-z0-9+/]+={0,2}$/)})).min(1).max(64),randomSeed:z27.int().nonnegative().max(4294967295).nullable()}).superRefine((c,ctx)=>{for(const list of[c.parameters,c.bindings,c.dependencies])if(new Set(list.map(x=>x.name)).size!==list.length)ctx.addIssue({code:"custom",message:"Names must be unique within each input group"});for(const purpose of["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK"])if(c.bindings.filter(x=>x.purpose===purpose).length!==1)ctx.addIssue({code:"custom",path:["bindings"],message:"Exactly one "+purpose+" binding is required"});if(c.bindings.find(x=>x.purpose==="SOURCE")?.declaredOrigin!=="CODE")ctx.addIssue({code:"custom",path:["bindings"],message:"Programmatic source must retain CODE provenance"});for(const p of["@hyperframes/engine","@hyperframes/producer","gsap"])if(!c.dependencies.some(x=>x.name===p))ctx.addIssue({code:"custom",path:["dependencies"],message:"Missing authoring dependency: "+p})});var CompositionSourceBundleSchema=z27.strictObject({schemaVersion:z27.literal(1),entrypoint:CompositionPathSchema,files:z27.array(z27.strictObject({path:CompositionPathSchema,contentType:z27.enum(["text/html","text/css","text/javascript","image/svg+xml","application/json"]),content:z27.string().max(1048576)})).min(1).max(128)}).superRefine((b,ctx)=>{if(new Set(b.files.map(x=>x.path)).size!==b.files.length)ctx.addIssue({code:"custom",message:"Source paths must be unique"});if(!b.files.some(x=>x.path===b.entrypoint&&x.contentType==="text/html"))ctx.addIssue({code:"custom",message:"Entrypoint must resolve to a declared HTML file"})});var SubmitCompositionSchema=CompositionScopeSchema.extend({compositionId:z27.uuid().nullable(),expectedVersion:z27.int().nonnegative(),previousVersionId:z27.uuid().nullable(),expectedProductionRevision:z27.int().positive(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,idempotencyKey:z27.string().trim().min(1).max(200)}).superRefine((i,ctx)=>{if(i.expectedVersion===0!==(i.compositionId===null&&i.previousVersionId===null)||i.expectedVersion>0&&(!i.compositionId||!i.previousVersionId))ctx.addIssue({code:"custom",message:"Create and exact-version revision identities must not be mixed"});if(i.content.role==="PRIMARY_VISUAL"&&!i.basis.shotId)ctx.addIssue({code:"custom",message:"Primary visual must bind a planned Shot"})});var CompositionGetSchema=CompositionScopeSchema.extend({compositionId:z27.uuid(),versionId:z27.uuid().optional()});var CompositionHistorySchema=CompositionScopeSchema.extend({compositionId:z27.uuid(),limit:z27.int().min(1).max(100).default(20),beforeVersion:z27.int().positive().optional()});var CompositionInputFactSchema=CompositionBindingSchema.extend({contentType:z27.string().min(1),byteSize:z27.int().positive().max(67108864),registeredOrigin:z27.string().min(1),executionClass:z27.enum(["LIVE","TEST_ONLY"]).nullable()});var CompositionVersionSchema=CompositionScopeSchema.extend({id:z27.uuid(),compositionId:z27.uuid(),projectId:z27.uuid(),version:z27.int().positive(),previousVersionId:z27.uuid().nullable(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,inputs:z27.array(CompositionInputFactSchema).min(3).max(64),fingerprint:sha5,createdByPrincipalId:z27.uuid(),createdAt:z27.iso.datetime({offset:true})}).refine(v=>v.version===1===(v.previousVersionId===null));var CompositionReceiptSchema=z27.strictObject({semanticStatus:z27.literal("SUCCESS"),version:CompositionVersionSchema,productionRevision:z27.int().positive()});var CompositionViewSchema=z27.strictObject({version:CompositionVersionSchema,isCurrent:z27.boolean(),basisStatus:z27.enum(["CURRENT","STALE"]),inputStatus:z27.enum(["AVAILABLE","UNAVAILABLE"]),byteReadback:z27.literal("NOT_CHECKED")});var CompositionPageSchema=z27.strictObject({items:z27.array(CompositionViewSchema).max(100),hasMore:z27.boolean(),nextBeforeVersion:z27.int().positive().nullable()});var CompositionDependencyManifestSchema=z27.object({dependencies:z27.record(z27.string(),z27.string())});var CompositionDependencyLockSchema=z27.object({lockfileVersion:z27.literal(3),packages:z27.record(z27.string(),z27.object({version:z27.string().optional(),integrity:z27.string().optional(),dependencies:z27.record(z27.string(),z27.string()).optional()}))});import{z as z30}from"zod";import{z as z28}from"zod";var Text=z28.string().trim().min(1).max(600);var Method=z28.enum(["HUMAN","AI","CODE"]);var Key2=z28.string().regex(/^[a-z][a-z0-9_.:-]{0,99}$/);var CompositionAuthoringObligationsSchema=z28.strictObject({schemaVersion:z28.literal(1),basis:CompositionBasisPinSchema,productionRevision:z28.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:z28.array(Key2).min(1).max(384).refine(v=>new Set(v).size===v.length,"Obligation keys must be unique"),semantics:z28.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=z28.strictObject({alternativeId:z28.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z28.string().trim().min(1).max(120),method:z28.enum(["HUMAN","AI","CODE","HYBRID"]),contributions:z28.array(z28.strictObject({method:Method,role:z28.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),intent:Text})).min(1).max(6),rationale:Text,tradeoffs:z28.array(Text).max(6),obligationKeys:z28.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:z28.uuid(),expectedProductionRevision:z28.int().positive(),basis:CompositionBasisPinSchema,proposal:z28.strictObject({origin:z28.strictObject({kind:z28.literal("EXTERNAL_AGENT_HOST"),label:z28.string().trim().min(1).max(100)}),makingIntent:z28.enum(["REAL_WORLD_CAPTURE","GENERATED_SCENE","PROGRAMMATIC_EXPLANATION"]),unknowns:z28.array(z28.string().trim().min(1).max(300)).max(8),alternatives:z28.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:z28.literal("SUCCESS"),advisory:z28.literal(true),projectId:z28.uuid(),authoring:CompositionAuthoringObligationsSchema,proposal:ValidateCompositionMakingSchema.shape.proposal,limitations:z28.tuple([z28.literal("STRATEGY_IS_AGENT_ADVICE_NOT_CANONICAL_SELECTION"),z28.literal("SOURCE_METHOD_IS_NOT_PROVENANCE_OR_PROVIDER_ELIGIBILITY"),z28.literal("AUTHORING_AND_RENDER_RECHECK_CURRENT_BASIS"),z28.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 z29}from"zod";var CompositionAuthoringRequirementsSchema=z29.strictObject({videoFrameCache:z29.strictObject({profileId:z29.literal("HYPERFRAME_1080P30_FRAME_CACHE_V2"),media:z29.literal("MANAGED_MP4_H264_CFR30_SDR_YUV420P"),maxVideos:z29.literal(4),maxDimension:z29.literal(1920),maxPixels:z29.literal(2073600),maxSourceSeconds:z29.literal(60),playbackRate:z29.literal(1),loop:z29.literal(false),sourceOffset:z29.literal("ZERO_BASED_FRAME_ALIGNED"),srcPattern:z29.literal("/inputs/{inputName}.mp4"),attributes:z29.tuple([z29.literal("id"),z29.literal("src"),z29.literal("data-start"),z29.literal("data-duration")]),dynamicVideoSupported:z29.literal(false),nativePlaybackAndCanvasSamplingSupported:z29.literal(false)}).optional(),semantics:z29.literal("REQUIREMENTS_NOT_RUNTIME_OR_REVIEW_EVIDENCE"),dependencies:CompositionContentSchema.shape.dependencies,html:z29.strictObject({entrypoint:z29.literal("index.html"),stageSelector:z29.literal("#stage"),timelineRegistry:z29.literal("window.__timelines"),readinessPromise:z29.literal("window.__nativeReady"),gsapScript:z29.literal("/_native/gsap.min.js"),managedInputsScript:z29.literal("/native-inputs.js"),rootAttributes:z29.tuple([z29.literal("data-composition-id"),z29.literal("data-width"),z29.literal("data-height"),z29.literal("data-duration")]),timing:z29.literal("PAUSED_GSAP_TIMELINE_WITH_DURATION_MATCHING_LOCAL_CLOCK")})});var jsonSchema=z29.record(z29.string().max(120),z29.json());var CompositionAuthoringGuideSchema=z29.strictObject({inputTool:z29.literal("composition_put_input"),inputField:z29.literal("contentUtf8"),encoding:z29.literal("UTF8_JSON"),schemas:z29.strictObject({SOURCE:jsonSchema,DEPENDENCY_MANIFEST:jsonSchema,DEPENDENCY_LOCK:jsonSchema}),rendererRequirements:CompositionAuthoringRequirementsSchema.nullable(),dependencyInputs:z29.strictObject({dependencies:CompositionContentSchema.shape.dependencies,manifest:CompositionDependencyManifestSchema,lock:CompositionDependencyLockSchema}).nullable().optional(),validation:z29.literal("NATIVE_OWNER_RECHECKS_BYTES_BASIS_AND_SEMANTIC_REFINEMENTS")}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=65536);var CreateCompositionSchema=SubmitCompositionSchema.safeExtend({compositionId:z30.null(),expectedVersion:z30.literal(0),previousVersionId:z30.null()});var ReviseCompositionSchema=SubmitCompositionSchema.safeExtend({compositionId:z30.uuid(),expectedVersion:z30.int().positive(),previousVersionId:z30.uuid()});var CompositionBriefQuerySchema=CompositionScopeSchema.extend({shotId:z30.uuid().nullable().default(null)});var CompositionAuthoringBriefSchema=CompositionScopeSchema.extend({projectId:z30.uuid(),productionRevision:z30.int().positive(),planningStatus:z30.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:z30.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=z30.strictObject({authoringValidation:z30.literal("PASS"),basis:CompositionBasisPinSchema,productionRevision:z30.int().positive(),contentFingerprint:z30.string().regex(/^[0-9a-f]{64}$/),inputCount:z30.int().min(3).max(64),byteReadback:z30.literal("VERIFIED"),rendererValidation:z30.literal("NOT_EXECUTED"),renderAvailability:z30.enum(["AVAILABLE","UNAVAILABLE"]),nextActions:z30.array(z30.enum(["CREATE_COMPOSITION","REVISE_COMPOSITION"])).max(2)});var PutCompositionInputSchema=CompositionScopeSchema.extend({name:CompositionBindingSchema.shape.name,purpose:z30.enum(["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK","DATA"]),declaredOrigin:CompositionBindingSchema.shape.declaredOrigin,executionClass:z30.enum(["LIVE","TEST_ONLY"]),contentUtf8:z30.string().min(1).max(8388608),idempotencyKey:z30.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=z30.strictObject({binding:CompositionBindingSchema,projectId:z30.uuid(),contentType:z30.literal("application/json"),byteSize:z30.int().positive().max(8388608),executionClass:z30.enum(["LIVE","TEST_ONLY"]),inputStatus:z30.enum(["AVAILABLE","UNAVAILABLE"]),byteReadback:z30.literal("VERIFIED_AT_REGISTRATION")});var CompositionCapabilitySchema=z30.strictObject({capability:z30.string().min(1).max(80),tool:z30.string().nullable(),availability:z30.enum(["AVAILABLE","UNAVAILABLE"]),reason:z30.string().nullable()});var CompositionCapabilitiesSchema=z30.strictObject({provider:z30.literal("HYPERFRAME"),dialect:z30.literal("HYPERFRAME_HTML_GSAP_V1"),planningStatus:CompositionAuthoringBriefSchema.shape.planningStatus,capabilities:z30.array(CompositionCapabilitySchema).max(18),inputLimitsMiB:z30.strictObject({SOURCE:z30.literal(8),DEPENDENCY_MANIFEST:z30.literal(8),DEPENDENCY_LOCK:z30.literal(8),DATA:z30.literal(8),FONT:z30.literal(32),IMAGE:z30.literal(8),VIDEO:z30.literal(64)}),clockSemantics:z30.literal("RATIONAL_FPS_HALF_OPEN_FRAMES"),rendererValidation:z30.enum(["C3_PENDING","PER_REQUEST_CONFORMANCE"]),authoringGuide:CompositionAuthoringGuideSchema.optional()});var CompositionFailureSchema=z30.strictObject({semanticStatus:z30.enum(["INVALID_INPUT","NOT_FOUND","REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z30.strictObject({code:z30.string().max(80),message:z30.string().max(2e3)}),retryable:z30.boolean(),nextActions:z30.array(z30.string().max(80)).max(4),diagnostics:z30.array(z30.strictObject({code:z30.string().max(80),message:z30.string().max(2e3)})).max(32)});import{z as z33}from"zod";import{z as z31}from"zod";var HyperframeLegacyRenderProfileSchema=z31.strictObject({id:z31.literal("HYPERFRAME_1080P30_FULL_PAINT_V1"),adapter:z31.literal("native-hyperframe-v1"),engine:z31.literal("0.8.134"),producer:z31.literal("0.8.134"),gsap:z31.literal("3.15.0"),node:z31.string().min(1).max(80),browser:z31.string().min(1).max(160),browserSha256:z31.string().regex(/^[0-9a-f]{64}$/),ffmpeg:z31.string().min(1).max(240),maxFrames:z31.literal(360),timeoutMs:z31.literal(6e5),maxRssBytes:z31.literal(3221225472),maxScratchBytes:z31.literal(3221225472),maxOutputBytes:z31.literal(134217728),maxCpuMs:z31.literal(6e5),capture:z31.literal("PNG_SOFTWARE_SCREENSHOT_FULL_PAINT"),encode:z31.literal("H264_YUV420P_CRF18_THREADS2_NO_AUDIO")});var HyperframeCachedRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z31.literal("HYPERFRAME_1080P30_FRAME_CACHE_V2"),adapter:z31.literal("native-hyperframe-cache-v2"),encode:z31.literal("H264_YUV420P_CRF18_VERYFAST_THREADS2_NO_AUDIO")});var HyperframeRenderProfileSchema=z31.discriminatedUnion("id",[HyperframeLegacyRenderProfileSchema,HyperframeCachedRenderProfileSchema]);var CompositionRenderStartSchema=CompositionGetSchema.extend({versionId:z31.uuid(),fingerprint:z31.string().regex(/^[0-9a-f]{64}$/),expectedProductionRevision:z31.int().positive(),profileId:z31.enum(["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2","HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"]),idempotencyKey:z31.string().trim().min(1).max(200)});var CompositionRenderGetSchema=CompositionScopeSchema.extend({renderId:z31.uuid()});var CompositionRenderManifestSchema=z31.strictObject({schemaVersion:z31.literal(1),version:CompositionVersionSchema,profile:HyperframeRenderProfileSchema,firstFrame:z31.literal(0),frameCount:z31.int().min(1).max(360)}).superRefine((m,ctx)=>{if(m.frameCount!==m.version.content.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728)ctx.addIssue({code:"custom",message:"Exact frame count and aggregate input budget required"})});var CompositionRenderReceiptSchema=z31.strictObject({semanticStatus:z31.literal("ACCEPTED"),renderId:z31.uuid(),runtimeJobId:z31.uuid(),compositionVersionId:z31.uuid(),manifestFingerprint:z31.string().regex(/^[0-9a-f]{64}$/),productionRevision:z31.int().positive()});var CompositionRenderTechnicalSchema=z31.strictObject({width:z31.literal(1920),height:z31.literal(1080),frameRate:z31.literal(30),frameCount:z31.int().min(1).max(360),durationMs:z31.number().positive(),contentType:z31.literal("video/mp4"),videoCodec:z31.literal("h264"),pixelFormat:z31.literal("yuv420p"),hasAudio:z31.literal(false),fullDecode:z31.literal(true),checksumSha256:z31.string().regex(/^[0-9a-f]{64}$/),byteSize:z31.int().min(1).max(134217728),decodedFramesSha256:z31.string().regex(/^[0-9a-f]{64}$/)});var CompositionRenderResourcesSchema=z31.strictObject({sampleIntervalMs:z31.literal(100),sampledTreePeakRssBytes:z31.int().nonnegative(),sampledTreeCpuMs:z31.number().nonnegative(),observedPids:z31.int().nonnegative(),scratchPeakBytes:z31.int().nonnegative(),wallMs:z31.number().nonnegative(),processGroupCleaned:z31.literal(true)});import{z as z32}from"zod";var HyperframeAlphaRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z32.literal("HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"),adapter:z32.literal("native-hyperframe-alpha-v1"),encode:z32.literal("RGBA_PNG_SEQUENCE_30_V1"),maxOutputBytes:z32.literal(67108864),maxDecodedBytes:z32.literal(536870912)});var CompositionFrameRenderManifestSchema=z32.strictObject({...CompositionRenderManifestSchema.shape,schemaVersion:z32.literal(2),profile:HyperframeAlphaRenderProfileSchema}).superRefine((m,context)=>{const c=m.version.content;if(m.frameCount!==c.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728||c.role!=="VISUAL_LAYER"||c.viewport.width>1920||c.viewport.height>1920||c.viewport.width*c.viewport.height>1920*1080||c.viewport.width*c.viewport.height*m.frameCount*4>m.profile.maxDecodedBytes||c.clock.numerator!==30||c.clock.denominator!==1)context.addIssue({code:"custom",message:"Qualified CODE alpha geometry/role/clock/decoded budget mismatch"})});var CompositionFrameTechnicalSchema=z32.strictObject({profileId:z32.literal("RGBA_PNG_SEQUENCE_30_V1"),width:z32.int().min(1).max(1920),height:z32.int().min(1).max(1920),frameRate:z32.literal(30),frameCount:z32.int().min(1).max(360),alpha:z32.literal("STRAIGHT_RGBA"),fullDecode:z32.literal(true),frames:z32.array(z32.strictObject({ordinal:z32.int().min(0).max(359),checksumSha256:z32.string().regex(/^[0-9a-f]{64}$/),byteSize:z32.int().min(1).max(16777216)})).min(1).max(360)}).superRefine((value,context)=>{if(value.frames.length!==value.frameCount||value.frames.some((f,i)=>f.ordinal!==i)||value.width*value.height>1920*1080||value.width*value.height*value.frameCount*4>536870912||value.frames.reduce((n,f)=>n+f.byteSize,0)>67108864)context.addIssue({code:"custom",message:"CODE frame order/geometry/byte budget mismatch"})});var CompositionFrameRenderOutputSchema=z32.strictObject({sequence:VisualFrameSequenceSchema,technical:CompositionFrameTechnicalSchema,resources:CompositionRenderResourcesSchema}).superRefine((output,context)=>{if(output.sequence.width!==output.technical.width||output.sequence.height!==output.technical.height||output.sequence.frameCount!==output.technical.frameCount||output.sequence.frames.some((frame,i)=>frame.ordinal!==output.technical.frames[i]?.ordinal||frame.checksumSha256!==output.technical.frames[i]?.checksumSha256||frame.byteSize!==output.technical.frames[i]?.byteSize))context.addIssue({code:"custom",message:"CODE frame output must identify the exact native sequence"})});var CompositionRenderManifestReaderSchema=z33.discriminatedUnion("schemaVersion",[CompositionRenderManifestSchema,CompositionFrameRenderManifestSchema]);var CompositionRenderViewSchema=z33.strictObject({sourceIdentity:z33.strictObject({tenantId:z33.uuid(),projectId:z33.uuid(),productionId:z33.uuid(),compositionId:z33.uuid(),versionId:z33.uuid(),fingerprint:z33.string().regex(/^[0-9a-f]{64}$/),shotId:z33.uuid().nullable(),role:z33.enum(["PRIMARY_VISUAL","VISUAL_LAYER"])}).optional(),frameOutput:CompositionFrameRenderOutputSchema.optional(),receipt:CompositionRenderReceiptSchema,lifecycle:z33.string().min(1).max(80),cancellationRequested:z33.boolean(),failureClassification:z33.string().min(1).max(80).nullable(),output:z33.strictObject({artifactId:z33.uuid(),representationId:z33.uuid(),technical:CompositionRenderTechnicalSchema,resources:CompositionRenderResourcesSchema}).nullable()}).superRefine((view,context)=>{if(view.sourceIdentity&&view.sourceIdentity.versionId!==view.receipt.compositionVersionId)context.addIssue({code:"custom",message:"Render source identity must bind the admitted exact version"});if(view.frameOutput&&view.output!==null)context.addIssue({code:"custom",message:"CODE frame output must match its render Production and exclude an MP4 output"})});var CompositionRenderCancellationSchema=z33.strictObject({cancellationRequested:z33.boolean()});var ParameterValue=z34.strictObject({kind:z34.literal("PARAMETER_VALUE"),name:CompositionBindingSchema.shape.name,value:z34.union([z34.string().max(4e3),z34.number().finite(),z34.boolean()])});var Binding=CompositionBindingSchema.extend({purpose:z34.enum(["SOURCE","DATA","FONT","IMAGE","VIDEO"])});var CompositionRepairConsumerSchema=z34.discriminatedUnion("role",[z34.strictObject({role:z34.literal("PRIMARY_VISUAL"),clipOrdinal:z34.int().min(1).max(200)}),z34.strictObject({role:z34.literal("VISUAL_LAYER"),visualLayerId:z34.uuid()})]);var Consumers=z34.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=z34.discriminatedUnion("kind",[ParameterValue,z34.strictObject({kind:z34.literal("BINDING_REPLACE"),binding:Binding})]);var ReviseCompositionRepairActionSchema=z34.strictObject({kind:z34.literal("REVISE_COMPOSITION"),localityIndex:z34.int().min(0).max(207),patches:z34.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=z34.strictObject({locality:CompositionFindingLocalitySchema,composition:CompositionViewSchema,render:CompositionRenderViewSchema});var{idempotencyKey,...revisionShape}=ReviseCompositionSchema.shape;var RevisionDraft=z34.strictObject(revisionShape).refine(v=>v.content.role!=="PRIMARY_VISUAL"||v.basis.shotId!==null,"Primary repair retains an exact planned Shot");var CompositionRepairHandoffSchema=z34.strictObject({kind:z34.literal("COMPOSITION_REVISE"),locality:CompositionFindingLocalitySchema,input:RevisionDraft,renderProfileId:z34.enum(["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2","HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"]),sourceReviewRequired:z34.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=z35.string().trim().min(1).max(2e3);var key5=z35.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var RepairStrategyContextInputSchema=z35.strictObject({scope:DirectorScopeSchema,findingId:z35.uuid()});var RepairStrategyBasisSchema=RepairStrategyContextInputSchema.extend({contextFingerprint:z35.string().regex(/^[0-9a-f]{64}$/)});var RepairStrategyActionSchema=z35.discriminatedUnion("kind",[ReviseCompositionRepairActionSchema,z35.strictObject({kind:z35.literal("TRIM_CLIP"),ordinal:z35.int().min(1).max(200),sourceInMs:z35.int().nonnegative().max(30150),sourceOutMs:z35.int().positive().max(30150)}),z35.strictObject({kind:z35.literal("REVISE_CAPTIONS"),content:CaptionContentSchema}),z35.strictObject({kind:z35.literal("ADJUST_TRANSITION"),ordinal:z35.int().min(2).max(200),transition:ClipTransitionSchema}),z35.strictObject({kind:z35.literal("ADJUST_AUDIO_COMPOSITION"),audio:TimelineAudioInputSchema}),z35.strictObject({kind:z35.literal("ACKNOWLEDGE_WARNINGS"),acknowledgements:z35.array(z35.strictObject({key:z35.string().min(1).max(220),reason:text})).min(1).max(300)}),z35.strictObject({kind:z35.literal("REGENERATE_SHOT"),shotId:z35.uuid()}),z35.strictObject({kind:z35.literal("REQUEST_HUMAN_INPUT"),question:text}),z35.strictObject({kind:z35.literal("REQUEST_CANONICAL_CHANGE"),requestedChange:text})]);var RepairStrategyAlternativeSchema=z35.strictObject({id:key5,rationale:text,whySmallerChangeInsufficient:text,action:RepairStrategyActionSchema});var ValidateRepairStrategySchema=z35.strictObject({basis:RepairStrategyBasisSchema,proposal:z35.strictObject({origin:z35.strictObject({kind:z35.literal("EXTERNAL_AGENT_HOST"),label:z35.string().trim().min(1).max(100)}),summary:text,alternatives:z35.array(RepairStrategyAlternativeSchema).min(1).max(6),selectedAlternativeId:key5})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Repair Strategy input exceeds the 1 MiB JSON budget");var RepairStrategyContextResultSchema=z35.strictObject({compositionRepairAvailable:z35.boolean().optional(),semanticStatus:z35.literal("SUCCESS"),advisory:z35.literal(true),basis:RepairStrategyBasisSchema,ownerContext:DirectorContextResultSchema,finding:RoughCutFindingViewSchema,reviewTarget:RoughCutReviewTargetSchema,finalReady:FinalReadyViewSchema,eligibility:z35.strictObject({ready:z35.boolean(),reasons:z35.array(z35.enum(["FINDING_NOT_OPEN","TARGET_STALE","MEDIA_UNAVAILABLE","PRODUCTION_UNAVAILABLE","REVIEW_CHANGED","FINDING_BASIS_CHANGED"])).max(6)})});var RepairStrategyHandoffSchema=z35.discriminatedUnion("kind",[CompositionRepairHandoffSchema,z35.strictObject({kind:z35.literal("TIMELINE_BUILD"),input:BuildTimelineShapeSchema.omit({idempotencyKey:true})}),z35.strictObject({kind:z35.literal("CAPTION_AUTHOR"),input:AuthorCaptionsSchema.omit({idempotencyKey:true})}),z35.strictObject({kind:z35.literal("FINAL_READY_DECIDE"),input:DecideFinalReadySchema.omit({idempotencyKey:true})}),z35.strictObject({kind:z35.literal("REGENERATION_INTENT"),preparationQuery:PreparationActiveInputSchema,admission:z35.literal("EXPLICIT_NATIVE_PREPARATION_AND_SELECTION_REQUIRED")}),z35.strictObject({kind:z35.literal("HUMAN_INPUT_INTENT"),question:text}),z35.strictObject({kind:z35.literal("CANONICAL_CHANGE_INTENT"),requestedChange:text})]);var RepairStrategyValidationResultSchema=z35.strictObject({semanticStatus:z35.literal("SUCCESS"),advisory:z35.literal(true),basis:RepairStrategyBasisSchema,proposal:ValidateRepairStrategySchema.shape.proposal,finding:RoughCutFindingViewSchema,alternatives:z35.array(z35.strictObject({alternativeId:key5,affectedScope:RoughCutFindingViewSchema.shape.affectedScope,handoff:RepairStrategyHandoffSchema,materialChange:z35.boolean(),preservedAcceptanceIds:z35.array(z35.uuid()).max(200),followUp:z35.array(z35.enum(["REVOKE_FINAL_READY_AND_REFRESH","REFRESH_TIMELINE_BASIS","ATTACH_NEW_CAPTION","REFRESH_AND_PREPARE_SHOT","EXPLICIT_VIDEO_GENERATION","REVIEW_1","SHOT_ACCEPTANCE","REBUILD_TIMELINE","ROUGH_CUT_RENDER","REVIEW_2","FINAL_READY_DECISION","AUTHORIZED_PLANNING_DECISION","COMPOSITION_REVISE","COMPOSITION_RENDER"])).max(10)})).min(1).max(6),selectedAlternativeId:key5,limitations:z35.tuple([z35.literal("NO_CANONICAL_REPAIR_LIFECYCLE_OR_WRITE"),z35.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z35.literal("CREATIVE_RATIONALE_IS_NOT_VERIFIED"),z35.literal("OWNER_RECHECKS_CAS_IDEMPOTENCY_AND_EXECUTION_CLASS"),z35.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(id9=>!proposed.includes(id9)))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 z36}from"zod";var text2=z36.string().trim().min(1).max(2e3);var key6=z36.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var EditorContextInputSchema=z36.strictObject({scope:DirectorScopeSchema,timelineVersionId:z36.uuid()});var EditorBasisSchema=EditorContextInputSchema.extend({contextFingerprint:z36.string().regex(/^[0-9a-f]{64}$/)});var EditorAlternativeSchema=z36.strictObject({id:key6,rationale:text2,pacingIntent:text2,action:z36.discriminatedUnion("kind",[z36.strictObject({kind:z36.literal("BUILD_TIMELINE"),clips:BuildTimelineSchema.shape.clips}),z36.strictObject({kind:z36.literal("EDIT_GRAPHICS"),graphics:z36.array(TimelineGraphicInputSchema).min(1).max(8)}),z36.strictObject({kind:z36.literal("EDIT_VISUAL_LAYERS"),visualLayers:z36.array(TimelineVisualLayerInputSchema).min(1).max(8)}),z36.strictObject({kind:z36.literal("EDIT_AUDIO_COMPOSITION"),audio:TimelineAudioInputSchema}),z36.strictObject({kind:z36.literal("REVISE_CAPTIONS"),content:CaptionContentSchema}),z36.strictObject({kind:z36.literal("REQUEST_COMPOSITION_CAPABILITY"),concern:z36.enum(["TRANSITION","AUDIO_VISUAL_ALIGNMENT","VOICE_TIMING","CAPTION_RETIMING"]),requestedChange:text2}),z36.strictObject({kind:z36.literal("REQUEST_HUMAN_INPUT"),question:text2})])});var ValidateEditorProposalSchema=z36.strictObject({basis:EditorBasisSchema,proposal:z36.strictObject({origin:z36.strictObject({kind:z36.literal("EXTERNAL_AGENT_HOST"),label:z36.string().trim().min(1).max(100)}),summary:text2,alternatives:z36.array(EditorAlternativeSchema).min(1).max(6),selectedAlternativeId:key6})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Editor Intelligence input exceeds the 1 MiB JSON budget");var EditorContextResultSchema=z36.strictObject({semanticStatus:z36.literal("SUCCESS"),advisory:z36.literal(true),basis:EditorBasisSchema,ownerContext:DirectorContextResultSchema,timeline:TimelineViewSchema,timelineBasis:TimelineBasisSchema,finalReady:FinalReadyViewSchema,eligibility:z36.strictObject({ready:z36.boolean(),reasons:z36.array(z36.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=z36.strictObject({kind:z36.literal("PRODUCTION"),interval:z36.strictObject({startMs:z36.literal(0),endMs:z36.int().positive().max(603e4)}),shotIds:z36.array(z36.uuid()).min(1).max(200),dimensions:z36.array(z36.enum(["PACING","ORDERING","CUT_CONTINUITY","PRODUCT_PRESENTATION","CAPTION_TIMING_VISIBILITY","AUDIO_VISUAL_ALIGNMENT","BASIC_MIX"])).min(4).max(7),requirement:z36.literal("COMPLETE_NEW_OUTPUT_INSPECTION")});var EditorHandoffSchema=z36.discriminatedUnion("kind",[z36.strictObject({kind:z36.literal("TIMELINE_BUILD"),input:BuildTimelineShapeSchema.omit({idempotencyKey:true}),preview:TimelineManifestReaderSchema,assemblyStatus:z36.enum(["DRAFT","ASSEMBLY_READY"]),changedOrdinals:z36.array(z36.int().positive().max(200)).max(200),changedGraphicArtifactIds:z36.array(z36.uuid()).max(8),changedAudioPurposes:z36.array(z36.enum(["VOICEOVER","MUSIC"])).max(2),preservedAcceptanceIds:z36.array(z36.uuid()).max(200),reviewScope:ReviewScope,followUp:z36.array(z36.enum(["NATIVE_TIMELINE_BUILD","COMPLETE_TIMELINE","ROUGH_CUT_RENDER","REVIEW_2","FINAL_READY_DECISION"])).min(4).max(5)}),z36.strictObject({kind:z36.literal("CAPTION_AUTHOR"),input:AuthorCaptionsSchema.omit({idempotencyKey:true}),attachment:z36.strictObject({expectedTimelineVersion:z36.int().positive(),preserveCurrentComposition:z36.literal(true),composition:z36.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:z36.tuple([z36.literal("NATIVE_CAPTION_AUTHOR"),z36.literal("ATTACH_NEW_CAPTION_TO_TIMELINE"),z36.literal("ROUGH_CUT_RENDER"),z36.literal("REVIEW_2"),z36.literal("FINAL_READY_DECISION")])}),z36.strictObject({kind:z36.literal("COMPOSITION_CAPABILITY_INTENT"),concern:z36.enum(["TRANSITION","AUDIO_VISUAL_ALIGNMENT","VOICE_TIMING","CAPTION_RETIMING"]),requestedChange:text2,admission:z36.literal("EXPLICIT_CANONICAL_CAPABILITY_REQUIRED")}),z36.strictObject({kind:z36.literal("HUMAN_INPUT_INTENT"),question:text2})]);var EditorValidationResultSchema=z36.strictObject({semanticStatus:z36.literal("SUCCESS"),advisory:z36.literal(true),basis:EditorBasisSchema,proposal:ValidateEditorProposalSchema.shape.proposal,alternatives:z36.array(z36.strictObject({alternativeId:key6,handoff:EditorHandoffSchema})).min(1).max(6),selectedAlternativeId:key6,limitations:z36.tuple([z36.literal("NO_TIMELINE_WRITE_RENDER_OR_PROVIDER_CALL"),z36.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z36.literal("CREATIVE_RATIONALE_IS_NOT_VERIFIED"),z36.literal("OWNER_RECHECKS_CAS_IDEMPOTENCY_AND_EXECUTION_CLASS"),z36.literal("EDIT_REQUIRES_NEW_OUTPUT_INSPECTION_AND_REVIEW")])});import{z as z37}from"zod";var sha6=z37.string().regex(/^[0-9a-f]{64}$/);var TemporalEvidenceSourceSchema=z37.strictObject({tenantId:z37.uuid(),projectId:z37.uuid(),productionId:z37.uuid(),artifactId:z37.uuid(),representationId:z37.uuid(),checksumSha256:sha6,byteSize:z37.int().positive().max(128*1024*1024),width:z37.int().min(16).max(4096),height:z37.int().min(16).max(4096),durationMs:z37.int().positive().max(6e4),frameRate:z37.number().min(1).max(60),frameCount:z37.int().positive().max(3600),videoCodec:z37.literal("h264"),executionClass:z37.enum(["LIVE","TEST_ONLY"])}).refine(v=>Math.abs(v.frameCount/v.frameRate*1e3-v.durationMs)<=150,"Exact frame count, duration and rate must agree");var TemporalRiskWindowSchema=z37.strictObject({startMs:z37.int().nonnegative().max(6e4),endMs:z37.int().positive().max(6e4),reason:z37.enum(["TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])}).refine(v=>v.endMs>v.startMs,"Risk window must advance");var TemporalSamplingProfileSchema=z37.strictObject({id:z37.literal("ADAPTIVE_TEMPORAL_V1"),motion:z37.enum(["NORMAL","HIGH"]),lockedIdentity:z37.boolean(),windows:z37.array(TemporalRiskWindowSchema).max(32)});var TemporalSampleSchema=z37.strictObject({ordinal:z37.int().nonnegative().max(63),frameIndex:z37.int().nonnegative().max(3599),timestampMs:z37.number().nonnegative().max(6e4),reasons:z37.array(z37.enum(["START","END","INTERIOR","HIGH_MOTION","LOCKED_IDENTITY","TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])).min(1).max(9)});var TemporalSamplingPlanSchema=z37.strictObject({schemaVersion:z37.literal(1),source:TemporalEvidenceSourceSchema,profile:TemporalSamplingProfileSchema,samples:z37.array(TemporalSampleSchema).min(1).max(64),frameWidth:z37.int().min(16).max(320),frameHeight:z37.int().min(16).max(320),columns:z37.int().min(1).max(4),rows:z37.int().min(1).max(16),gutterPx:z37.literal(8)}).superRefine((p,ctx)=>{const s=p.samples;if(s[0]?.frameIndex!==0||s.at(-1)?.frameIndex!==p.source.frameCount-1||p.rows!==Math.ceil(s.length/p.columns)||p.columns!==Math.min(4,s.length)||s.some((v,i)=>v.ordinal!==i||v.frameIndex>=p.source.frameCount||Math.abs(v.timestampMs-v.frameIndex*1e3/p.source.frameRate)>.001||i>0&&v.frameIndex<=s[i-1].frameIndex||new Set(v.reasons).size!==v.reasons.length)||p.profile.windows.some(w=>w.endMs>p.source.durationMs))ctx.addIssue({code:"custom",message:"Temporal samples must preserve exact bounded source order, time and layout"})});var ExtractedTemporalFrameSchema=z37.strictObject({sample:TemporalSampleSchema,checksumSha256:sha6,byteSize:z37.int().positive().max(2*1024*1024),width:z37.int().positive().max(320),height:z37.int().positive().max(320),contentType:z37.literal("image/png")});var TemporalEvidenceManifestSchema=z37.strictObject({schemaVersion:z37.literal(1),plan:TemporalSamplingPlanSchema,engineVersion:z37.string().min(1).max(200),frames:z37.array(ExtractedTemporalFrameSchema).min(1).max(64),sheet:z37.strictObject({checksumSha256:sha6,byteSize:z37.int().positive().max(16*1024*1024),width:z37.int().positive().max(1320),height:z37.int().positive().max(5256),contentType:z37.literal("image/png")})}).superRefine((m,ctx)=>{const p=m.plan;if(m.frames.length!==p.samples.length||m.frames.some((f,i)=>JSON.stringify(f.sample)!==JSON.stringify(p.samples[i])||f.width!==p.frameWidth||f.height!==p.frameHeight)||m.sheet.width!==p.columns*p.frameWidth+(p.columns+1)*p.gutterPx||m.sheet.height!==p.rows*p.frameHeight+(p.rows+1)*p.gutterPx)ctx.addIssue({code:"custom",message:"Evidence frames and sheet must match the exact sampling plan"})});import{z as z38}from"zod";var scope={tenantId:z38.uuid(),productionId:z38.uuid()};var TemporalEvidenceTargetSchema=z38.strictObject({...scope,artifactId:z38.uuid(),representationId:z38.uuid(),checksumSha256:z38.string().regex(/^[0-9a-f]{64}$/)});var OriginalVideoReadSchema=TemporalEvidenceTargetSchema;var OriginalVideoResultSchema=z38.strictObject({source:TemporalEvidenceSourceSchema,contentType:z38.literal("video/mp4"),dataBase64:z38.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:z38.int().positive(),idempotencyKey:z38.string().trim().min(1).max(128)});var TemporalEvidenceGetSchema=z38.strictObject({...scope,evidenceId:z38.uuid()});var TemporalEvidenceAdmissionSchema=z38.strictObject({semanticStatus:z38.literal("ACCEPTED"),evidenceId:z38.uuid(),runtimeJobId:z38.uuid(),operationId:z38.string().min(1),source:TemporalEvidenceSourceSchema,planFingerprint:z38.string().regex(/^[0-9a-f]{64}$/),productionRevision:z38.int().positive()});var TemporalEvidenceOutputSchema=z38.strictObject({frameSetArtifactId:z38.uuid(),manifestRepresentationId:z38.uuid(),frameRepresentationIds:z38.array(z38.uuid()).min(1).max(64),contactSheetArtifactId:z38.uuid(),sheetRepresentationId:z38.uuid(),manifest:TemporalEvidenceManifestSchema,createdAt:z38.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=z38.strictObject({evidenceId:z38.uuid(),runtimeJobId:z38.uuid(),operationId:z38.string().min(1),source:TemporalEvidenceSourceSchema,planFingerprint:z38.string().regex(/^[0-9a-f]{64}$/),runtimeState:z38.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),output:TemporalEvidenceOutputSchema.nullable()});var TemporalEvidenceMediaSchema=TemporalEvidenceGetSchema.extend({kind:z38.enum(["FRAME","SHEET","MANIFEST"]),ordinal:z38.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:z38.enum(["FRAME","SHEET"])});var TemporalEvidenceImageMetadataSchema=TemporalEvidenceImageSchema.safeExtend({contentType:z38.literal("image/png"),checksumSha256:z38.string().regex(/^[0-9a-f]{64}$/),byteSize:z38.int().positive().max(16*1024*1024)});import{z as z39}from"zod";var Text2=z39.string().trim().min(1).max(1e3);var bounded=(value,bytes)=>new TextEncoder().encode(JSON.stringify(value)).byteLength<=bytes;var ExplorationComparisonCriterionSchema=z39.strictObject({key:ReviewEvidenceKeySchema,description:Text2,modality:z39.enum(["VISUAL","TEMPORAL"])});var ExplorationRecommendationContextInputSchema=ExplorationCompareInputSchema.extend({criteria:z39.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=z39.strictObject({input:ExplorationRecommendationContextInputSchema,contextFingerprint:z39.string().regex(/^[0-9a-f]{64}$/)});var ExplorationRecommendationCandidateSchema=z39.strictObject({label:ReviewEvidenceKeySchema,readiness:z39.enum(["REVIEWABLE","UNAVAILABLE"]),reasons:z39.array(z39.enum(["NO_CANDIDATE","STALE_BASIS","PRODUCTION_NOT_RUNNABLE","OUTPUT_NOT_INSPECTABLE"])).max(4),reviewContext:ReviewIntelligenceContextResultSchema.nullable()});var ExplorationRecommendationContextResultSchema=z39.strictObject({semanticStatus:z39.literal("SUCCESS"),advisory:z39.literal(true),basis:ExplorationRecommendationBasisSchema,comparison:ExplorationComparisonResultSchema,candidates:z39.array(ExplorationRecommendationCandidateSchema).min(2).max(6),limitations:z39.tuple([z39.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z39.literal("NO_IMPLICIT_MEDIA_OR_MODEL_CALL")])}).refine(v=>bounded(v,2*1024*1024),"Recommendation context exceeds 2 MiB");var ExplorationComparisonJudgmentSchema=z39.strictObject({label:ReviewEvidenceKeySchema,criterionKey:ReviewEvidenceKeySchema,judgment:z39.enum(["FAVORABLE","UNFAVORABLE","UNCERTAIN","NOT_OBSERVABLE"]),rationale:Text2,evidenceIds:z39.array(ReviewEvidenceKeySchema).max(16)});var ExplorationRecommendationDecisionSchema=z39.discriminatedUnion("kind",[z39.strictObject({kind:z39.literal("RECOMMEND"),label:ReviewEvidenceKeySchema,rationale:Text2,notSelected:z39.array(z39.strictObject({label:ReviewEvidenceKeySchema,reason:Text2})).min(1).max(5)}),z39.strictObject({kind:z39.literal("NO_RECOMMENDATION"),reason:Text2})]);var ValidateExplorationRecommendationSchema=z39.strictObject({basis:ExplorationRecommendationBasisSchema,proposal:z39.strictObject({origin:z39.strictObject({kind:z39.literal("EXTERNAL_AGENT_HOST"),label:z39.string().trim().min(1).max(100)}),summary:z39.string().trim().min(1).max(2e3),assessments:z39.array(z39.strictObject({label:ReviewEvidenceKeySchema,reviewProposal:ValidateReviewIntelligenceSchema.shape.proposal})).max(6),judgments:z39.array(ExplorationComparisonJudgmentSchema).max(48),decision:ExplorationRecommendationDecisionSchema,unknowns:z39.array(z39.string().trim().min(1).max(300)).max(8)})}).refine(v=>bounded(v,1024*1024),"Recommendation input exceeds 1 MiB");var ExplorationRecommendationValidationResultSchema=z39.strictObject({semanticStatus:z39.literal("SUCCESS"),advisory:z39.literal(true),basis:ExplorationRecommendationBasisSchema,origin:ValidateExplorationRecommendationSchema.shape.proposal.shape.origin,summary:z39.string(),judgments:z39.array(ExplorationComparisonJudgmentSchema).max(48),decision:ExplorationRecommendationDecisionSchema,unknowns:z39.array(z39.string()).max(8),reviews:z39.array(z39.strictObject({label:ReviewEvidenceKeySchema,validation:ReviewIntelligenceValidationResultSchema})).max(6),limitations:z39.tuple([z39.literal("HOST_PREFERENCE_IS_NOT_CANONICAL_SELECTION"),z39.literal("EVIDENCE_DECLARATIONS_ARE_NOT_ATTESTED_INSPECTION"),z39.literal("RULE_PREVIEWS_ARE_NOT_CANONICAL_REVIEWS"),z39.literal("EXPLICIT_RECORD_AND_SEPARATE_ACCEPTANCE_REQUIRED"),z39.literal("OWNER_RECHECKS_CURRENTNESS_CAS_AND_EXECUTION_CLASS")])}).refine(v=>bounded(v,4*1024*1024),"Recommendation result exceeds 4 MiB");import{z as z41}from"zod";import{z as z40}from"zod";var Review1FindingSchema=z40.strictObject({id:z40.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,mediaType:z40.enum(["IMAGE","VIDEO"]),framePurpose:z40.string().max(40).optional(),generationId:z40.uuid(),candidateId:z40.uuid(),reviewId:z40.uuid(),artifactId:z40.uuid(),representationId:z40.uuid(),checksumSha256:z40.string().regex(/^[0-9a-f]{64}$/),preparationId:z40.uuid(),contractId:z40.uuid(),contractFingerprint:z40.string().regex(/^[0-9a-f]{64}$/),executionClass:z40.enum(["LIVE","TEST_ONLY"]),requirement:z40.union([VideoReviewRequirementSchema,VisualRequirementSchema]),observation:z40.union([VideoObservationSchema,KeyframeObservationSchema]),blocking:z40.boolean(),severity:z40.enum(["BLOCKING","WARNING"]),basisFingerprint:z40.string().regex(/^[0-9a-f]{64}$/),createdAt:z40.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:z40.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","SUPERSEDED"]),proofReviewId:z40.uuid().nullable()});var Review1RepairSourceSchema=z40.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=z40.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,mediaType:z40.enum(["IMAGE","VIDEO"]),generationId:z40.uuid(),reviewId:z40.uuid(),requirementKey:z40.string().min(1).max(220)});var sha7=z41.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=z41.strictObject({maxSemanticAttempts:z41.int().min(1).max(20),maxElapsedMs:z41.int().min(1).max(864e5),currency:z41.literal("USD"),maxCostMicros:z41.int().min(0).max(1e9),maxConsecutiveNoImprovement:z41.int().min(1).max(20)});var RepairPlanScopeSchema=z41.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,planId:z41.uuid()});var AuthorRepairPlanSchema=z41.strictObject({strategy:ValidateRepairStrategySchema,expectedProductionRevision:z41.int().positive(),expectedCaseVersion:z41.int().nonnegative(),budget:SemanticRepairBudgetSchema,idempotencyKey:z41.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=z41.strictObject({id:z41.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,caseId:z41.uuid(),caseVersion:z41.int().positive(),basis:RepairStrategyBasisSchema,sourceReviewId:z41.uuid(),sourceRenderId:z41.uuid().nullable(),review1Source:Review1FindingSchema.optional(),sourceBasisFingerprint:sha7,affectedScopeFingerprint:sha7,obligationFingerprint:sha7,proposal:ValidateRepairStrategySchema.shape.proposal,selectedAlternativeId:z41.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),handoff:RepairStrategyHandoffSchema,budget:SemanticRepairBudgetSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z41.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=z41.strictObject({id:z41.uuid(),planId:z41.uuid(),caseId:z41.uuid(),ordinal:z41.int().min(1).max(20),executionIdentity:z41.string().trim().min(1).max(200),strategyFingerprint:sha7,startedAt:z41.iso.datetime({offset:true}),reservedCostMicros:z41.int().min(0).max(1e9),chargedCostMicros:z41.int().min(0).max(1e9).nullable(),currency:z41.literal("USD"),outcome:z41.enum(["IN_FLIGHT","AWAITING_REVIEW","IMPROVED","NO_IMPROVEMENT","OPERATIONAL_FAILURE","WAIVED"])});var RecordRepairProofSchema=RepairPlanScopeSchema.extend({attemptId:z41.uuid(),renderId:z41.uuid(),reviewId:z41.uuid(),expectedProductionRevision:z41.int().positive(),idempotencyKey:z41.string().trim().min(1).max(200)});import{z as z42}from"zod";var AuthorReview1RepairSchema=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),reason:z42.string().trim().min(1).max(2e3),expectedProductionRevision:z42.int().positive(),expectedCaseVersion:z42.int().nonnegative(),budget:SemanticRepairBudgetSchema,idempotencyKey:z42.string().trim().min(1).max(200)});var RecordReview1RepairProofSchema=RepairPlanScopeSchema.extend({attemptId:z42.uuid(),generationId:z42.uuid(),reviewId:z42.uuid(),expectedProductionRevision:z42.int().positive(),idempotencyKey:z42.string().trim().min(1).max(200)});import{z as z43}from"zod";var ExecuteRepairSchema=RepairPlanScopeSchema.extend({expectedProductionRevision:z43.int().positive(),expectedCaseVersion:z43.int().positive(),idempotencyKey:z43.string().trim().min(1).max(200),generation:VideoStartInputSchema.omit({idempotencyKey:true}).optional(),keyframeGeneration:KeyframeStartInputSchema.omit({idempotencyKey:true}).optional()});var RepairAttemptEventSchema=z43.strictObject({id:z43.uuid(),attemptId:z43.uuid(),version:z43.int().positive(),outcome:SemanticRepairAttemptSchema.shape.outcome.exclude(["IN_FLIGHT"]),renderId:z43.uuid().nullable(),reviewId:z43.uuid().nullable(),generationId:z43.uuid().optional(),recordedAt:z43.iso.datetime({offset:true})});var RepairAttemptViewSchema=SemanticRepairAttemptSchema.extend({costQuote:GenerationCostQuoteSchema.optional(),events:z43.array(RepairAttemptEventSchema).max(40)});var RepairCaseViewSchema=z43.strictObject({id:z43.uuid(),version:z43.int().positive(),issueKey:z43.string().regex(/^[0-9a-f]{64}$/),budget:SemanticRepairBudgetSchema,openedAt:z43.iso.datetime({offset:true})});var RepairPlanViewSchema=z43.strictObject({review1Finding:Review1FindingViewSchema.optional(),decision:RepairDecisionSchema,repairCase:RepairCaseViewSchema,attempts:z43.array(RepairAttemptViewSchema).max(20)});var RepairAuthorReceiptSchema=z43.strictObject({semanticStatus:z43.literal("SUCCESS"),decision:RepairDecisionSchema,productionRevision:z43.int().positive()});var RepairExecutionReceiptSchema=z43.strictObject({costQuote:GenerationCostQuoteSchema.optional(),semanticStatus:z43.literal("ACCEPTED"),attempt:SemanticRepairAttemptSchema,decision:RepairDecisionSchema,productionRevision:z43.int().positive(),generation:ExecuteRepairSchema.shape.generation.nullable(),keyframeGeneration:ExecuteRepairSchema.shape.keyframeGeneration.nullable().optional()});var RepairProgressSchema=z43.strictObject({view:RepairPlanViewSchema,stage:z43.enum(["WAITING_INPUT","WAITING_GENERATION","WAITING_COMPOSITION_RENDER","WAITING_SOURCE_ACCEPTANCE","WAITING_RENDER","AWAITING_REVIEW","WAIVED","OPERATIONAL_FAILURE","IMPROVED","NO_IMPROVEMENT"]),renderId:z43.uuid().nullable(),generationId:z43.uuid().nullable()});var RepairProofReceiptSchema=z43.strictObject({semanticStatus:z43.literal("SUCCESS"),event:RepairAttemptEventSchema,productionRevision:z43.int().positive()});import{z as z44}from"zod";var EXTERNAL_EVENT_TYPES=["production.started","production.failed","production.cancelled","finding.opened","artifact.created","shot.candidate_ready","shot.accepted","review.completed","rough_cut.ready","final_render.ready","approval.required","production.completed","delivery.validation_failed"];var ExternalEventTypeSchema=z44.enum(EXTERNAL_EVENT_TYPES);var LifecycleEventScopeSchema=z44.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema}).strict();var ExternalLifecycleEventSchema=z44.object({schemaVersion:z44.literal(1),eventId:z44.uuid(),tenantId:TenantIdSchema,productionId:ProductionIdSchema,projectId:z44.uuid(),type:ExternalEventTypeSchema,target:z44.object({type:z44.string().min(1).max(60),id:z44.uuid()}).strict(),occurredAt:z44.iso.datetime(),basis:z44.object({productionRevision:z44.number().int().positive()}).strict(),payload:z44.object({sourceEventType:z44.string().min(1).max(100),artifactId:z44.uuid().optional(),candidateId:z44.uuid().optional(),reviewId:z44.uuid().optional(),findingId:z44.uuid().optional(),shotId:z44.uuid().optional(),manifestId:z44.uuid().optional(),validationId:z44.uuid().optional(),action:z44.string().max(40).optional(),result:z44.string().max(40).optional(),executionClass:z44.enum(["LIVE","TEST_ONLY"]).optional()}).strict()}).strict();var WebhookEndpointSchema=z44.url().max(2048).refine(value=>{const u=new URL(value);return u.protocol==="https:"&&!u.username&&!u.password&&!u.hash&&(!u.port||u.port==="443")&&!u.hostname.startsWith("[")});var ConfigureWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z44.uuid(),expectedRevision:z44.number().int().nonnegative(),idempotencyKey:z44.string().min(1).max(128),endpoint:WebhookEndpointSchema,eventTypes:z44.array(ExternalEventTypeSchema).min(1).max(EXTERNAL_EVENT_TYPES.length).refine(v=>new Set(v).size===v.length),signingSecret:z44.string().min(32).max(256)}).strict();var DisableWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z44.uuid(),expectedRevision:z44.number().int().positive(),idempotencyKey:z44.string().min(1).max(128)}).strict();var ReplayWebhookSchema=DisableWebhookSchema.extend({eventId:z44.uuid()}).strict();var QueryLifecycleEventsSchema=LifecycleEventScopeSchema.extend({kind:z44.enum(["subscriptions","events","deliveries","attempts"]),subscriptionId:z44.uuid().optional(),deliveryId:z44.uuid().optional(),after:z44.uuid().optional(),limit:z44.number().int().min(1).max(50).default(20)}).strict().refine(v=>v.kind!=="attempts"||!!v.deliveryId);var WebhookSubscriptionSchema=LifecycleEventScopeSchema.extend({subscriptionId:z44.uuid(),version:z44.number().int().positive(),revision:z44.number().int().positive(),state:z44.enum(["ACTIVE","DISABLED","DEGRADED"]),endpoint:WebhookEndpointSchema,eventTypes:z44.array(ExternalEventTypeSchema),updatedAt:z44.iso.datetime()}).strict();import{z as z45}from"zod";var WebhookReplayReceiptSchema=z45.strictObject({deliveryId:z45.uuid(),eventId:z45.uuid(),runtimeJobId:z45.uuid()});var WebhookDeliveryViewSchema=z45.strictObject({deliveryId:z45.uuid(),eventId:z45.uuid(),subscriptionId:z45.uuid(),subscriptionVersion:z45.int().positive(),replayNumber:z45.int().nonnegative(),runtimeJobId:z45.uuid(),lifecycle:z45.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),runtimeAttempts:z45.int().nonnegative(),wakeAt:z45.iso.datetime({offset:true}).nullable()});var WebhookAttemptViewSchema=z45.strictObject({attemptId:z45.uuid(),runtimeAttemptId:z45.uuid(),outcome:z45.enum(["STARTED","ACKNOWLEDGED","TRANSIENT","PERMANENT","SKIPPED"]),responseStatus:z45.int().min(100).max(599).nullable(),startedAt:z45.iso.datetime({offset:true}),endedAt:z45.iso.datetime({offset:true}).nullable()});var page={next:z45.uuid().nullable()};var WebhookSubscriptionPageSchema=z45.strictObject({...page,items:z45.array(WebhookSubscriptionSchema).max(50)});var ExternalLifecycleEventPageSchema=z45.strictObject({...page,items:z45.array(ExternalLifecycleEventSchema).max(50)});var WebhookDeliveryPageSchema=z45.strictObject({...page,items:z45.array(WebhookDeliveryViewSchema).max(50)});var WebhookAttemptPageSchema=z45.strictObject({...page,items:z45.array(WebhookAttemptViewSchema).max(50)});var LifecycleEventCapabilitiesSchema=z45.strictObject({eventTypes:z45.array(ExternalEventTypeSchema).max(13),unavailableNativeEvents:z45.array(z45.enum(["production.failed","production.cancelled","finding.opened"])).max(3),delivery:z45.literal("AT_LEAST_ONCE"),payload:z45.literal("QUERY_NOTIFICATION"),scope:z45.literal("PRODUCTION"),automaticOutboundAttempts:z45.literal(3),manualReplaysPerEvent:z45.literal(3),projectOnlyArtifacts:z45.literal("UNAVAILABLE"),orderingGuaranteed:z45.literal(false),signature:z45.literal("HMAC_SHA256_TIMESTAMP_DOT_EXACT_BODY")});import{z as z46}from"zod";var sha8=z46.string().regex(/^[0-9a-f]{64}$/);var CompositionSourceInspectSchema=CompositionGetSchema.extend({versionId:z46.uuid(),fingerprint:sha8,file:CompositionPathSchema.optional(),startLine:z46.int().min(1).max(8388609).default(1),lineLimit:z46.int().min(1).max(200).default(80)});var CompositionSourceInspectionSchema=z46.strictObject({composition:CompositionViewSchema,source:CompositionInputFactSchema,byteReadback:z46.literal("VERIFIED"),selection:z46.strictObject({file:CompositionPathSchema.nullable(),startLine:z46.int().positive(),lineLimit:z46.int().min(1).max(200)}),files:z46.array(z46.strictObject({path:CompositionPathSchema,contentType:z46.string().max(80),byteSize:z46.int().nonnegative().max(8388608),lineCount:z46.int().positive().max(8388609)})).min(1).max(128),window:z46.strictObject({file:CompositionPathSchema,startLine:z46.int().positive(),lines:z46.array(z46.strictObject({number:z46.int().positive(),text:z46.string().max(65536)})).max(200),hasMore:z46.boolean(),nextLine:z46.int().positive().nullable()}).nullable(),limitations:z46.tuple([z46.literal("SOURCE_INSPECTION_IS_NOT_OUTPUT_REVIEW"),z46.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED")])});var SourceReviewContextInputSchema=z46.strictObject({scope:DirectorScopeSchema,source:CompositionSourceInspectSchema,renderId:z46.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=z46.strictObject({semanticStatus:z46.literal("SUCCESS"),advisory:z46.literal(true),basis:z46.strictObject({input:SourceReviewContextInputSchema,contextFingerprint:sha8}),ownerContext:DirectorContextResultSchema,source:CompositionSourceInspectionSchema,render:CompositionRenderViewSchema.nullable(),outputReviewTarget:ProgrammaticVideoReviewTargetSchema.nullable(),limitations:z46.tuple([z46.literal("SOURCE_REASONING_DOES_NOT_CERTIFY_OUTPUT_QUALITY"),z46.literal("INDEPENDENT_OUTPUT_REVIEW_AND_ACCEPTANCE_REQUIRED"),z46.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED")])});import{z as z47}from"zod";var key7=z47.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ProgrammaticCompareSchema=z47.strictObject({scope:ExplorationScopeSchema,items:z47.array(z47.strictObject({label:key7,renderId:z47.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=z47.strictObject({semanticStatus:z47.literal("SUCCESS"),advisory:z47.literal(true),scope:ExplorationScopeSchema,selection:ProgrammaticCompareSchema.shape.items,items:z47.array(z47.strictObject({label:key7,sourceKind:z47.literal("PROGRAMMATIC"),composition:CompositionViewSchema,render:CompositionRenderViewSchema,reviewTarget:ProgrammaticVideoReviewTargetSchema.nullable()})).min(2).max(6),limitations:z47.tuple([z47.literal("OWNER_STATES_ARE_NOT_VISUAL_SCORES"),z47.literal("REVIEW_AND_ACCEPTANCE_REMAIN_EXPLICIT")])}).superRefine((v,c)=>{if(v.items.length!==v.selection.length||v.items.some((item,i)=>item.label!==v.selection[i].label||item.render.receipt.renderId!==v.selection[i].renderId))c.addIssue({code:"custom",message:"Programmatic comparison retains every exact selected label/render"});for(const item of v.items){const owner=item.composition.version,target=item.reviewTarget;if(owner.tenantId!==v.scope.tenantId||owner.projectId!==v.scope.projectId||owner.productionId!==v.scope.productionId||owner.basis.shotId!==v.scope.shotId||owner.content.role!=="PRIMARY_VISUAL"||owner.id!==item.render.receipt.compositionVersionId||target&&(target.renderId!==item.render.receipt.renderId||target.compositionVersionId!==owner.id||target.tenantId!==v.scope.tenantId||target.projectId!==v.scope.projectId||target.productionId!==v.scope.productionId||target.shotId!==v.scope.shotId))c.addIssue({code:"custom",message:"Programmatic comparison retains exact native source/output scope"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=2*1024*1024,"Programmatic comparison exceeds2MiB");var ProgrammaticRecommendationContextInputSchema=ProgrammaticCompareSchema.safeExtend({criteria:z47.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=z47.strictObject({input:ProgrammaticRecommendationContextInputSchema,contextFingerprint:z47.string().regex(/^[0-9a-f]{64}$/)});var ProgrammaticRecommendationContextSchema=z47.strictObject({semanticStatus:z47.literal("SUCCESS"),advisory:z47.literal(true),basis:ProgrammaticRecommendationBasisSchema,comparison:ProgrammaticComparisonSchema,candidates:z47.array(ExplorationRecommendationCandidateSchema).min(2).max(6),limitations:z47.tuple([z47.literal("READS_ARE_NOT_ATOMIC_OR_RESERVED"),z47.literal("NO_IMPLICIT_MEDIA_OR_MODEL_CALL")])}).superRefine((v,c)=>{if(JSON.stringify(v.basis.input.scope)!==JSON.stringify(v.comparison.scope)||JSON.stringify(v.basis.input.items)!==JSON.stringify(v.comparison.selection)||v.candidates.length!==v.comparison.items.length||v.candidates.some((candidate,i)=>candidate.label!==v.comparison.items[i].label))c.addIssue({code:"custom",message:"Programmatic Recommendation keeps exact comparison scope/selection"});for(const candidate of v.candidates){const target=candidate.reviewContext?.reviewTarget;const item=v.comparison.items.find(i=>i.label===candidate.label);if(target&&(target.kind!=="PROGRAMMATIC"||target.target.renderId!==item?.render.receipt.renderId||target.target.compositionVersionId!==item.composition.version.id))c.addIssue({code:"custom",message:"Candidate assessment binds the exact native CODE output"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=2*1024*1024,"Programmatic recommendation context exceeds2MiB");var ValidateProgrammaticRecommendationSchema=z47.strictObject({basis:ProgrammaticRecommendationBasisSchema,proposal:ValidateExplorationRecommendationSchema.shape.proposal}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=1024*1024,"Programmatic recommendation input exceeds1MiB");var ProgrammaticRecommendationValidationSchema=z47.strictObject({...ExplorationRecommendationValidationResultSchema.shape,basis:ProgrammaticRecommendationBasisSchema}).superRefine((v,c)=>{const s=v.basis.input.scope;for(const assessment of v.reviews){const item=v.basis.input.items.find(i=>i.label===assessment.label),draft=assessment.validation.recordDraft;if(!item||draft.kind!=="PROGRAMMATIC"||draft.input.renderId!==item.renderId||draft.input.tenantId!==s.tenantId||draft.input.productionId!==s.productionId||assessment.validation.basis.scope.projectId!==s.projectId)c.addIssue({code:"custom",message:"Recommendation review draft binds exact CODE output and scope"})}}).refine(i=>new TextEncoder().encode(JSON.stringify(i)).byteLength<=4*1024*1024,"Programmatic recommendation result exceeds4MiB");import{z as z48}from"zod";var CompositionRenderQuerySchema=CompositionScopeSchema.extend({limit:z48.int().min(1).max(24).default(12),next:ContinuationSchema.optional(),shotId:z48.uuid().optional(),role:z48.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]).default("PRIMARY_VISUAL")});var CompositionRenderObservationSchema=z48.strictObject({render:CompositionRenderViewSchema,createdAt:z48.iso.datetime({offset:true}),version:z48.int().positive(),executionClass:z48.enum(["LIVE","TEST_ONLY"]),freshness:z48.enum(["CURRENT_BASIS","STALE_BASIS"]),available:z48.boolean(),review:z48.strictObject({result:z48.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),reviewId:z48.uuid().nullable(),acceptanceId:z48.uuid().nullable(),accepted:z48.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=z48.strictObject({items:z48.array(CompositionRenderObservationSchema).max(24),page:QueryPageInfoSchema}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=4194304,"Render observation page exceeds 4 MiB");var CompositionRenderMediaDescriptorSchema=z48.strictObject({path:z48.string().regex(/^\/v1\/productions\/[0-9a-f-]{36}\/compositions\/renders\/[0-9a-f-]{36}\/media$/i),contentType:z48.literal("video/mp4"),checksumSha256:z48.string().regex(/^[0-9a-f]{64}$/),byteSize:z48.int().positive().max(134217728),authentication:z48.literal("BEARER_AND_TENANT_HEADER")});import{z as z49}from"zod";var CompositionSampleStartSchema=CompositionRenderGetSchema.extend({expectedProductionRevision:z49.int().positive(),profile:TemporalSamplingProfileSchema,idempotencyKey:z49.string().trim().min(1).max(128)});var CompositionObserveGetSchema=CompositionRenderGetSchema.extend({evidenceId:z49.uuid()});var RenderObservationIdentitySchema=z49.strictObject({renderId:z49.uuid(),compositionVersionId:z49.uuid(),artifactId:z49.uuid(),representationId:z49.uuid(),checksumSha256:z49.string().regex(/^[0-9a-f]{64}$/)});var CompositionSampleReceiptSchema=RenderObservationIdentitySchema.extend({evidence:TemporalEvidenceAdmissionSchema,nextActions:z49.tuple([z49.literal("READ_OBSERVATION")])});var CompositionFrameObservationSchema=z49.strictObject({ordinal:z49.int().nonnegative().max(63),frameIndex:z49.int().nonnegative().max(3599),timestampMs:z49.number().nonnegative().max(6e4),checksumSha256:z49.string().regex(/^[0-9a-f]{64}$/),representationId:z49.uuid(),diagnostic:z49.literal("FRAME_EVIDENCE_READY")});var CompositionObservationViewSchema=RenderObservationIdentitySchema.extend({evidence:TemporalEvidenceViewSchema,frames:z49.array(CompositionFrameObservationSchema).max(64),contactSheetArtifactId:z49.uuid().nullable(),nextActions:z49.array(z49.enum(["READ_OBSERVATION","READ_FRAME_MEDIA","REVISE_COMPOSITION","RENDER_REVISION"])).min(1).max(4)});var HYPERFRAME_RENDER_PROFILE={id:"HYPERFRAME_1080P30_FULL_PAINT_V1",adapter:"native-hyperframe-v1",engine:"0.8.134",producer:"0.8.134",gsap:"3.15.0",node:"v24.21.0",browser:"Google Chrome for Testing 154.0.8037.57",browserSha256:"60c03e8882f4bb47459a905ede1074e1e746c5b765e437c288e460320540a8a3",ffmpeg:"ffmpeg version 8.0.1-3ubuntu2 Copyright (c) 2000-2025 the FFmpeg developers",maxFrames:360,timeoutMs:6e5,maxRssBytes:3221225472,maxScratchBytes:3221225472,maxOutputBytes:134217728,maxCpuMs:6e5,capture:"PNG_SOFTWARE_SCREENSHOT_FULL_PAINT",encode:"H264_YUV420P_CRF18_THREADS2_NO_AUDIO"};var HYPERFRAME_ALPHA_RENDER_PROFILE={...HYPERFRAME_RENDER_PROFILE,id:"HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1",adapter:"native-hyperframe-alpha-v1",encode:"RGBA_PNG_SEQUENCE_30_V1",maxOutputBytes:67108864,maxDecodedBytes:536870912};var HYPERFRAME_CACHED_RENDER_PROFILE={...HYPERFRAME_RENDER_PROFILE,id:"HYPERFRAME_1080P30_FRAME_CACHE_V2",adapter:"native-hyperframe-cache-v2",encode:"H264_YUV420P_CRF18_VERYFAST_THREADS2_NO_AUDIO"};var scope2={projectId:ProjectIdSchema,productionId:ProductionIdSchema};var ScopedAcceptBriefSchema=AcceptBriefRequestSchema.extend(scope2);var ScopedAcceptStorySchema=AcceptStoryRequestSchema.extend(scope2);var ScopedAcceptSceneShotPlanSchema=AcceptSceneShotPlanRequestSchema.extend(scope2);import{z as z50}from"zod";var id5=z50.uuid();var ActivateAgentExecutionSchema=AgentHostScopeSchema.extend({profileKey:z50.string().regex(/^[A-Za-z0-9_-]{1,160}$/),requestId:id5,bindingId:id5,expectedBindingRevision:z50.int().positive(),expectedConfigurationVersion:z50.int().positive(),clientId:id5,grantRef:id5,installationRevisionId:z50.string().regex(/^[A-Za-z0-9_-]{1,160}$/)});var AgentExecutionSelectionSchema=z50.strictObject({registration:AgentExecutionRegistrationViewSchema,grant:AgentExecutionGrantSchema,installationRevisionId:z50.string().regex(/^[A-Za-z0-9_-]{1,160}$/)}).refine(v=>v.grant.clientId===v.registration.clientId&&v.grant.registrationRevision===v.registration.registration.registrationRevision&&v.grant.resource===v.registration.registration.resource);import{z as z51}from"zod";var NativeToolAuthorityFailureSchema=z51.strictObject({semanticStatus:z51.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z51.strictObject({code:z51.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","BINDING_UNAVAILABLE","REQUEST_CONFLICT","REVISION_CONFLICT","GRANT_CONFLICT","GRANT_EXPIRED","GRANT_REVOKED","PROOF_INVALID","PROOF_REPLAY","CHALLENGE_EXPIRED","PERMIT_UNAVAILABLE","QUALIFICATION_UNAVAILABLE","CREDENTIAL_INVALID","CREDENTIAL_EXPIRED","CREDENTIAL_UNAVAILABLE","CREDENTIAL_LIMIT","HOST_RUN_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),message:z51.literal("Native tool authority operation did not complete")})});import{z as z52}from"zod";var NativeToolGatewayDescriptorSchema=z52.strictObject({name:z52.string().regex(/^[a-z][a-z0-9_]{0,99}$/),inputSchemaFingerprint:z52.string().regex(/^[a-f0-9]{64}$/),scope:z52.enum(["PRODUCTION","PROJECT_READ"]),readOnly:z52.boolean()});var NativeToolGatewayManifestSchema=z52.strictObject({protocol:z52.literal("NATIVESTUDIO_NATIVE_MCP_V1"),policy:z52.literal("NVS_PROJECT_READ_PRODUCTION_WRITE_V1"),tools:z52.array(NativeToolGatewayDescriptorSchema).min(1).max(256)}).refine(v=>v.tools.every((tool,index)=>index===0||v.tools[index-1].name<tool.name));var NativeToolGatewayContractSchema=z52.strictObject({manifest:NativeToolGatewayManifestSchema,capabilityDigest:z52.string().regex(/^[a-f0-9]{64}$/)});import{z as z53}from"zod";var id6=z53.uuid().regex(/^[0-9a-f-]{36}$/);var sha9=z53.string().regex(/^[a-f0-9]{64}$/);var key8=z53.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var NativeRuntimeQualificationSchema=z53.strictObject({protocol:z53.literal("NATIVESTUDIO_RUNTIME_TOOLS_V1"),runtimeKey:key8,installationId:key8,installationRevisionId:key8,resource:z53.url().max(2048),publicKeyFingerprint:sha9,bindingId:id6,configurationVersion:z53.int().positive(),selection:AgentHostSelectionSchema,capabilityDigest:sha9,executionClass:z53.enum(["LIVE","TEST_ONLY"]),transport:AgentHostInstallationTransportSchema.optional()});var NativeToolPermitSchema=z53.strictObject({proof:AgentHostNativeToolAuthoritySchema,input:AgentHostExecutionInputSchema,grant:NativeToolGrantViewSchema,qualification:NativeRuntimeQualificationSchema,requestedByPrincipalId:id6,createdAt:z53.iso.datetime({offset:true})}).refine(v=>v.proof.tenantId===v.input.tenantId&&v.proof.projectId===v.input.projectId&&v.proof.productionId===v.input.productionId&&v.proof.executionId===v.input.executionId&&v.proof.hostRequestId===v.input.hostRequestId&&v.grant.tenantId===v.input.tenantId&&v.grant.projectId===v.input.projectId&&v.grant.enabled&&v.grant.verifiedAt!==null&&v.proof.bindingId===v.grant.bindingId&&v.proof.configurationVersion===v.grant.configurationVersion&&v.qualification.runtimeKey===v.grant.runtimeKey&&v.qualification.installationId===v.grant.installationId&&v.qualification.installationRevisionId===v.grant.installationRevisionId&&v.qualification.resource===v.grant.resource&&v.qualification.bindingId===v.grant.bindingId&&v.qualification.configurationVersion===v.grant.configurationVersion&&v.qualification.capabilityDigest===v.proof.capabilityDigest&&v.qualification.executionClass===v.proof.executionClass&&(v.proof.transport===void 0?v.qualification.transport===void 0:v.qualification.transport?.protocol===v.proof.transport.protocol&&v.qualification.transport.installationId===v.proof.transport.installationId&&v.qualification.transport.installationRevisionId===v.proof.transport.installationRevisionId&&v.qualification.transport.slotKey===v.proof.transport.slotKey&&(v.proof.transport.protocol!=="AGENT_STACK_GENERIC_INSTALLATION_V3"||v.qualification.transport.protocol==="AGENT_STACK_GENERIC_INSTALLATION_V3"&&v.qualification.transport.contractDigest===v.proof.transport.contractDigest&&v.qualification.transport.capabilityDigest===v.proof.transport.capabilityDigest)&&v.proof.transport.installationId===v.grant.installationId&&v.proof.transport.installationRevisionId===v.grant.installationRevisionId)&&Date.parse(v.proof.expiresAt)<=Date.parse(v.grant.expiresAt));var NativeToolPermitGetSchema=AgentHostExecutionScopeSchema.extend({authorityRef:id6});var NativeExecutionProofClaimsSchema=AgentHostExecutionScopeSchema.extend({iss:key8,sub:key8,aud:z53.url().max(2048),grantId:id6,grantRevision:z53.int().positive(),installationRevisionId:key8,authorityRef:id6,executionId:id6,hostRequestId:id6,inputFingerprint:sha9,runKey:key8,jti:id6,iat:z53.int().nonnegative(),exp:z53.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeToolCredentialExchangeSchema=NativeToolPermitGetSchema.extend({assertion:z53.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).max(8192).meta({writeOnly:true})});var NativeToolCredentialMetadataSchema=NativeToolPermitGetSchema.extend({protocol:z53.literal("NATIVESTUDIO_NATIVE_CREDENTIAL_V1"),tokenId:id6,grantId:id6,grantRevision:z53.int().positive(),executionId:id6,hostRequestId:id6,runKey:key8,jti:id6,assertionFingerprint:sha9,tokenFingerprint:sha9,issuedAt:z53.iso.datetime({offset:true}),expiresAt:z53.iso.datetime({offset:true})});var NativeToolCredentialReplySchema=z53.strictObject({tokenType:z53.literal("Bearer"),accessToken:z53.string().regex(/^nvst_[0-9a-f-]{36}\.[A-Za-z0-9_-]{43}$/).meta({readOnly:true}),tokenId:id6,resource:z53.url().max(2048),expiresAt:z53.iso.datetime({offset:true})}).refine(v=>v.accessToken.startsWith(`nvst_${v.tokenId}.`));var NativeToolSessionSchema=NativeToolPermitGetSchema.extend({authorityProtocol:z53.literal("NVS_GENERIC_EXECUTION_V1").optional(),tokenId:id6,executionId:id6,hostRequestId:id6,grantId:id6,grantRevision:z53.int().positive(),runKey:key8,runtimePrincipalId:id6,approvedByPrincipalId:id6,requestedByPrincipalId:id6,capabilityDigest:sha9,resource:z53.url().max(2048),issuer:z53.url().max(2048),subject:z53.string().max(200),executionClass:z53.enum(["LIVE","TEST_ONLY"]),expiresAt:z53.iso.datetime({offset:true})});import{z as z54}from"zod";var CreateProductionRequestSchema=z54.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,idempotencyKey:z54.string().trim().min(1).max(200)});var CreatedProductionResultSchema=CreatedProjectResultSchema;import{z as z55}from"zod";var VisualSequenceScopeSchema=z55.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var RegisterVisualSequenceSchema=VisualSequenceScopeSchema.extend({productionId:ProductionIdSchema.nullable(),idempotencyKey:z55.string().trim().min(1).max(200),width:z55.int().min(1).max(1920),height:z55.int().min(1).max(1920),frameArtifactIds:z55.array(ArtifactIdSchema).min(1).max(360)}).refine(v=>v.width*v.height<=1920*1080&&new Set(v.frameArtifactIds).size===v.frameArtifactIds.length,"Sequence requires bounded geometry and unique ordered frame Artifacts");var VisualSequenceGetSchema=VisualSequenceScopeSchema.extend({artifactId:ArtifactIdSchema});var VisualSequenceViewSchema=z55.strictObject({sequence:VisualFrameSequenceSchema,freshness:z55.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z55.array(z55.enum(["SEQUENCE_UNAVAILABLE","FRAME_UNAVAILABLE"])).max(2),createdAt:z55.iso.datetime({offset:true})});var VisualSequenceQuerySchema=VisualSequenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VisualSequencePageSchema=z55.strictObject({items:z55.array(VisualSequenceViewSchema).max(100),page:QueryPageInfoSchema});var{checksumSha256:_checksum,...manifestShape}=VisualFrameSequenceSchema.shape;var VisualSequenceManifestSchema=z55.strictObject(manifestShape).superRefine((value,context)=>{if(!VisualFrameSequenceSchema.safeParse({...value,checksumSha256:"0".repeat(64)}).success)context.addIssue({code:"custom",message:"Invalid canonical frame sequence manifest"})});import{z as z56}from"zod";var sha10=z56.string().regex(/^[0-9a-f]{64}$/);var WavExportResultSchema=z56.strictObject({contentType:z56.literal("audio/wav"),checksumSha256:sha10,byteSize:z56.int().min(44).max(12582912),contentBase64:z56.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]+={0,2}$/)});var AudioExportResultSchema=WavExportResultSchema.extend({representationId:z56.uuid()});var CaptionExportResultSchema=z56.strictObject({contentType:z56.enum(["application/json","application/x-subrip"]),checksumSha256:sha10,representationId:z56.uuid(),text:z56.string().min(1).max(131072)});import{z as z57}from"zod";var tenant=TenantIdSchema.transform(v=>v.toLowerCase());var project=ProjectIdSchema.transform(v=>v.toLowerCase());var production=ProductionIdSchema.transform(v=>v.toLowerCase());var artifact=ArtifactIdSchema.transform(v=>v.toLowerCase());var representation=ArtifactRepresentationIdSchema.transform(v=>v.toLowerCase());var DiscoverableArtifactFamilySchema=z57.enum(["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=z57.enum(["image/png","image/jpeg","image/webp","video/mp4","audio/wav","audio/mpeg","application/json","text/plain","application/x-subrip"]);var ArtifactDiscoveryQuerySchema=z57.strictObject({tenantId:tenant,projectId:project.optional(),productionId:production.optional(),family:DiscoverableArtifactFamilySchema.optional(),search:z57.string().trim().min(1).max(200).optional(),lifecycle:z57.enum(["READY","ARCHIVED"]).default("READY"),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ArtifactDiscoveryMediaSchema=z57.strictObject({tenantId:tenant,projectId:project,artifactId:artifact,representationId:representation});var ArtifactDiscoveryItemSchema=z57.strictObject({artifactId:ArtifactIdSchema,projectId:ProjectIdSchema,projectName:z57.string().min(1).max(200),productionId:ProductionIdSchema.nullable(),representationId:ArtifactRepresentationIdSchema,family:DiscoverableArtifactFamilySchema,lifecycle:z57.enum(["READY","ARCHIVED"]),origin:z57.string().min(1).max(120),contentType:DiscoveryContentTypeSchema,checksumSha256:z57.string().regex(/^[a-f0-9]{64}$/),byteSize:z57.int().positive(),width:z57.int().positive().nullable(),height:z57.int().positive().nullable(),durationMs:z57.int().nonnegative().nullable(),createdAt:z57.iso.datetime({offset:true}),originalName:z57.string().max(255).nullable(),executionClass:z57.enum(["LIVE","TEST_ONLY","UNKNOWN"]),mediaAvailable:z57.boolean(),sourceVersionId:z57.uuid().nullable(),normalizationId:z57.uuid().nullable()});var ArtifactDiscoveryPageSchema=z57.strictObject({items:z57.array(ArtifactDiscoveryItemSchema).max(100),page:QueryPageInfoSchema});import{z as z58}from"zod";var ExternalGrantQuerySchema=z58.strictObject({tenantId:z58.uuid()});var ExternalGrantPageSchema=z58.strictObject({items:z58.array(z58.strictObject({grantId:z58.uuid(),projectId:z58.uuid(),displayName:z58.string().max(100),scopes:z58.array(z58.enum(["nvs:read","nvs:write"])).min(1).max(2),expiresAt:z58.iso.datetime()})).max(100),possiblyTruncated:z58.boolean()});var ExternalAccessScopeSchema=z58.enum(["nvs:read","nvs:write"]);var ExternalProjectScopeSchema=z58.strictObject({tenantId:z58.uuid(),projectId:z58.uuid()});var redirect=z58.string().min(1).max(2048).superRefine((value,ctx)=>{try{const u=new URL(value);if(u.username||u.password||u.hash||!(u.protocol==="https:"||u.protocol==="http:"&&["127.0.0.1","[::1]"].includes(u.hostname)||u.protocol==="workbuddy:"))throw Error()}catch{ctx.addIssue({code:"custom",message:"Invalid registered callback"})}});var RegisterExternalClientSchema=ExternalProjectScopeSchema.extend({displayName:z58.string().trim().min(1).max(100),redirectUris:z58.array(redirect).min(1).max(16).refine(v=>new Set(v).size===v.length)});var DynamicExternalClientSchema=z58.object({client_name:z58.string().trim().min(1).max(100).default("External MCP client"),redirect_uris:z58.array(redirect).min(1).max(16).refine(v=>new Set(v).size===v.length),token_endpoint_auth_method:z58.literal("none").default("none"),grant_types:z58.array(z58.enum(["authorization_code","refresh_token"])).min(1).max(2).optional(),response_types:z58.array(z58.literal("code")).length(1).optional(),application_type:z58.enum(["native","web"]).optional()});var ExternalAuthorizationSchema=z58.strictObject({response_type:z58.literal("code"),client_id:z58.uuid(),redirect_uri:redirect,resource:z58.url().max(2048),scope:z58.string().max(100).refine(value=>{const scopes=value.split(" ");return scopes.includes("nvs:read")&&new Set(scopes).size===scopes.length&&scopes.every(s=>ExternalAccessScopeSchema.safeParse(s).success)}),state:z58.string().min(16).max(1024),code_challenge:z58.string().regex(/^[A-Za-z0-9_-]{43}$/),code_challenge_method:z58.literal("S256")});var commonToken={client_id:z58.uuid(),resource:z58.url().max(2048)};var ExternalTokenRequestSchema=z58.discriminatedUnion("grant_type",[z58.strictObject({...commonToken,grant_type:z58.literal("authorization_code"),code:z58.string().regex(/^nvsc_[A-Za-z0-9_-]{43}$/),redirect_uri:redirect,code_verifier:z58.string().regex(/^[A-Za-z0-9._~-]{43,128}$/)}),z58.strictObject({...commonToken,grant_type:z58.literal("refresh_token"),refresh_token:z58.string().regex(/^nvsr_[A-Za-z0-9_-]{43}$/)})]);var ExternalRevocationSchema=z58.strictObject({client_id:z58.uuid(),token:z58.string().regex(/^(nvsa_|nvsr_)[A-Za-z0-9_-]{43}$/),token_type_hint:z58.enum(["access_token","refresh_token"]).optional()});import{z as z59}from"zod";var TerminateProductionSchema=z59.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,outcome:z59.enum(["FAILED","CANCELLED"]),expectedProductionRevision:z59.int().positive(),reason:z59.string().trim().min(1).max(1e3),idempotencyKey:z59.string().trim().min(1).max(200)});var ProductionTerminationReceiptSchema=z59.strictObject({decisionId:z59.uuid(),productionId:ProductionIdSchema,projectId:ProjectIdSchema,state:ProductionStateSchema});import{z as z60}from"zod";var text3=z60.string().trim().min(1).max(600);var key9=z60.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var Review1RepairSourceResultSchema=z60.strictObject({input:Review1RepairSourceQuerySchema,source:Review1RepairSourceSchema,productionRevision:z60.int().positive(),caseVersion:z60.int().nonnegative(),budget:SemanticRepairBudgetSchema.nullable()}).superRefine((v,c)=>{const fields=["tenantId","projectId","productionId","mediaType","generationId","reviewId"];if(fields.some(key10=>v.input[key10]!==v.source[key10])||v.input.requirementKey!==v.source.requirement.key)c.addIssue({code:"custom",message:"Native source must match the exact scoped Review obligation"})});var Review1RepairStrategyBasisSchema=z60.strictObject({input:Review1RepairSourceQuerySchema,contextFingerprint:z60.string().regex(/^[0-9a-f]{64}$/)});var Review1RepairStrategyContextSchema=z60.strictObject({semanticStatus:z60.literal("SUCCESS"),advisory:z60.literal(true),basis:Review1RepairStrategyBasisSchema,owner:Review1RepairSourceResultSchema});var ValidateReview1RepairStrategySchema=z60.strictObject({basis:Review1RepairStrategyBasisSchema,budget:SemanticRepairBudgetSchema.optional(),proposal:z60.strictObject({origin:z60.strictObject({kind:z60.literal("EXTERNAL_AGENT_HOST"),label:z60.string().trim().min(1).max(100)}),summary:text3,alternatives:z60.array(z60.strictObject({id:key9,rationale:text3,whySmallerChangeInsufficient:text3,action:z60.discriminatedUnion("kind",[z60.strictObject({kind:z60.literal("REGENERATE_SHOT")}),z60.strictObject({kind:z60.literal("REQUEST_HUMAN_INPUT"),question:text3}),z60.strictObject({kind:z60.literal("REQUEST_CANONICAL_CHANGE"),requestedChange:text3})])})).min(1).max(6),selectedAlternativeId:key9})}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).byteLength<=1024*1024,"Review-1 strategy exceeds 1 MiB");var Review1RepairStrategyValidationSchema=z60.strictObject({semanticStatus:z60.literal("SUCCESS"),advisory:z60.literal(true),basis:Review1RepairStrategyBasisSchema,proposal:ValidateReview1RepairStrategySchema.shape.proposal,alternatives:z60.array(z60.strictObject({alternativeId:key9,handoff:z60.discriminatedUnion("kind",[z60.strictObject({kind:z60.literal("AUTHOR_REVIEW1_REPAIR"),input:AuthorReview1RepairSchema.omit({idempotencyKey:true})}),z60.strictObject({kind:z60.literal("HUMAN_INPUT_INTENT"),question:text3}),z60.strictObject({kind:z60.literal("CANONICAL_CHANGE_INTENT"),requestedChange:text3})])})).min(1).max(6),selectedAlternativeId:key9,followUp:z60.union([z60.tuple([]),z60.tuple([z60.literal("EXPLICIT_NATIVE_AUTHORING"),z60.literal("OWNER_BUDGET_AND_COST_ADMISSION"),z60.literal("EXPLICIT_NATIVE_EXECUTION"),z60.literal("INDEPENDENT_REVIEW_1_AND_NATIVE_PROOF")])])});import{z as z62}from"zod";import{z as z61}from"zod";var NavigationGroupIdSchema=z61.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_/],["administration",/^(?:provider_|tenant_|oauth_|credential_|native_tool_|agent_host_|webhook_)/],["review",/(?:^|_)(?:review|reviewer|finding|repair)(?:_|$)/],["navigation",/^(?:studio_|operation_|production_(?:query|snapshot)|job_(?:get|query)|production_guidance_)/],["materials",/^(?:project_|source_|artifact_|reference_|visual_sequence_|imported_visual_|source_sync_)/],["planning",/^(?:brief_|story_|scene_|shot_|writer_|director_|exploration_|consistency_|making_|sound_plan_|planning_|editor_)/],["delivery",/^(?:timeline_|composition_|rough_cut_|final_|delivery_|caption_|audio_)/],["execution",/^(?:production_|keyframe_|video_|generation_|speech_|media_observation_|temporal_evidence_|lifecycle_)/]];function navigationGroup(tool){return namespaces.find(([,pattern])=>pattern.test(tool))?.[0]??"unclassified"}var NavigationProfile="contextual-v1";var NavigationProfileKey="io.nativestudio/discovery-profile";var NavigationToolNames=["studio_start","studio_capability_search","studio_capability_describe","studio_capability_groups","studio_navigate"];var Scope=z62.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema.optional()});var ToolName=z62.string().regex(/^[a-zA-Z0-9_-]{1,120}$/);var StudioStartInputSchema=ProductionQueryInputSchema.extend({limit:z62.int().min(1).max(5).default(5)}).strict();var StudioStartSchema=z62.object({tenantId:TenantIdSchema,choices:ProductionQueryPageSchema.shape.items.max(5),page:ProductionQueryPageSchema.shape.page,selection:z62.enum(["NONE","ONE","CHOOSE"]),guidance:z62.literal("Select an explicit Production ID, then call studio_navigate. Never infer an ID.")}).strict();var CapabilitySummarySchema=z62.object({tool:ToolName,title:z62.string().max(500),description:z62.string().max(6e3),family:z62.string().min(1).max(120),group:NavigationGroupIdSchema.optional(),readOnly:z62.boolean(),registration:z62.literal("REGISTERED")}).strict();var CapabilitySearchInputSchema=Scope.extend({query:z62.string().trim().min(1).max(240),family:z62.string().regex(/^[a-z0-9_-]{1,120}$/).optional(),group:NavigationGroupIdSchema.optional(),limit:z62.int().min(1).max(8).default(5),next:z62.string().min(1).max(2048).optional()}).strict();var CapabilitySearchSchema=z62.object({tenantId:TenantIdSchema,catalogVersion:z62.string().regex(/^[a-f0-9]{64}$/),outcome:z62.enum(["MATCHES","AMBIGUOUS","NO_MATCH"]),candidates:z62.array(CapabilitySummarySchema.extend({matchedTerms:z62.array(z62.string().max(120)).max(24)})).max(8),page:z62.object({hasMore:z62.boolean(),next:z62.string().max(2048).nullable()}).strict(),guidance:z62.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:z62.string().min(1).max(2048).optional()}).strict();var CapabilityGroupsInputSchema=Scope.strict();var CapabilityGroupsSchema=z62.object({tenantId:TenantIdSchema,catalogVersion:z62.string().regex(/^[a-f0-9]{64}$/),groups:z62.array(z62.object({id:NavigationGroupIdSchema,title:z62.string().max(120),description:z62.string().max(500),count:z62.int().nonnegative(),readOnlyCount:z62.int().nonnegative()}).strict()).max(9)}).strict();var JsonSchema=z62.record(z62.string(),z62.unknown());var PublicToolDefinitionSchema=z62.object({name:ToolName,title:z62.string().optional(),description:z62.string().optional(),inputSchema:JsonSchema,outputSchema:JsonSchema.optional(),annotations:JsonSchema.optional(),execution:JsonSchema.optional(),_meta:JsonSchema.optional(),icons:z62.array(JsonSchema).optional()}).strict();var CapabilityDescribeSchema=CapabilitySummarySchema.extend({tenantId:TenantIdSchema,catalogVersion:z62.string().regex(/^[a-f0-9]{64}$/),inputSchema:JsonSchema,outputSchema:JsonSchema.nullable(),outputContract:z62.enum(["DECLARED","NOT_DECLARED"]),schemaCursor:z62.string().min(1).max(2048),definition:PublicToolDefinitionSchema.optional(),guidance:z62.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:z62.string().trim().min(1).max(240).optional(),actionLimit:z62.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:z62.string().min(1).max(2048).optional().describe("Opaque actions.page.next; keep the same goal and actionLimit. Changed native state requires a fresh first page.")}).strict();import{z as z63}from"zod";var Evidence=z63.object({path:z63.string().min(1).max(120)}).strict();var StudioNavigationSchema=z63.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,evidence:z63.object({source:z63.literal("production_snapshot"),revision:z63.int().positive(),generatedAt:z63.iso.datetime({offset:true})}).strict(),state:ProductionSnapshotSchema.shape.state.extend({blockingReason:z63.string().max(1e3).nullable(),waitingReason:z63.string().max(1e3).nullable()}),stateReasonsTruncated:z63.object({blockingReason:z63.boolean(),waitingReason:z63.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:z63.object({total:z63.int().nonnegative(),truncated:z63.boolean(),items:z63.array(ProductionSnapshotSchema.shape.blockers.element.extend({evidence:Evidence})).max(10)}).strict(),actions:z63.object({total:z63.int().nonnegative(),truncated:z63.boolean(),items:z63.array(NextActionSchema.extend({tool:z63.string().min(1).max(120).nullable(),registration:z63.enum(["REGISTERED","NOT_ON_SURFACE"]),readOnly:z63.boolean().nullable(),purpose:z63.string().max(500).nullable(),group:NavigationGroupIdSchema.nullable(),context:z63.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,revision:z63.int().positive()}).strict(),inputHints:z63.object({knownInputs:z63.partialRecord(z63.enum(["tenantId","projectId","productionId","shotId","sceneId","findingId","operationId","artifactId"]),z63.string().min(1).max(2048)),schemaFingerprint:z63.string().regex(/^[a-f0-9]{64}$/).nullable(),requiredInputs:z63.array(z63.string()).max(128),missingInputs:z63.array(z63.string()).max(128),schemaInspectionRequired:z63.literal(true)}).strict().nullable(),recommendation:z63.array(z63.enum(["NATIVE_AVAILABLE","NATIVE_UNAVAILABLE","GOAL_MATCH","INSPECT_SCHEMA","NOT_ON_SURFACE"])).max(4),inspect:z63.object({tool:z63.literal("studio_capability_describe"),arguments:CapabilityDescribeInputSchema}).strict().nullable(),evidence:Evidence})).max(8),page:z63.object({hasMore:z63.boolean(),next:z63.string().max(2048).nullable()}).strict()}).strict(),operations:z63.object({total:z63.int().nonnegative(),truncated:z63.boolean(),items:z63.array(OperationSummarySchema.pick({id:true,productionId:true,semanticStatus:true,startedAt:true,updatedAt:true}).extend({inspect:z63.object({tool:z63.literal("operation_get"),arguments:z63.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema,operationId:OperationSummarySchema.shape.id}).strict()}).strict().nullable(),targetCount:z63.int().nonnegative(),blockerCount:z63.int().nonnegative(),evidence:Evidence})).max(5)}).strict(),related:CapabilitySearchSchema.nullable(),guidance:z63.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();var intent=z64.strictObject({productionId:z64.uuid(),idempotencyKey:z64.string().trim().min(1).max(200),deviceId:z64.uuid().optional()});var DeviceRenderIntentSchema=z64.discriminatedUnion("kind",[intent.extend({kind:z64.literal("preview"),profileId:RoughCutProfileIdSchema.optional()}),intent.extend({kind:z64.literal("final")})]);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 DeviceRenderAdmissionSchema=z64.union([RoughCutAdmissionSchema.extend({deviceExecution:DeviceRenderReceiptSchema}),FinalRenderAdmissionSchema.extend({deviceExecution:DeviceRenderReceiptSchema})]);var NativeStudioDeviceRenders=class{constructor(caller){this.caller=caller}caller;async prepare(raw,options){const input=DeviceRenderIntentSchema.parse(raw);const scope3={tenantId:this.caller.tenantId,productionId:input.productionId};const base={...scope3,idempotencyKey:input.idempotencyKey,deviceExecution:{mode:"tenant-device-only",...input.deviceId?{deviceId:input.deviceId}:{}}};if(input.kind==="final"){const e=await this.caller.call("final-render.eligibility",scope3,options);if(!e.renderable||!e.profile||!e.finalReady.selection)throw new NativeStudioSdkError("STALE_BASIS","STALE_BASIS","NO_WRITE");const selection=e.finalReady.selection;return PreparedDeviceRenderSchema.parse({kind:"final",command:{...base,selectionId:selection.id,expectedFinalReadyVersion:e.finalReady.version,timelineVersionId:selection.timelineVersionId,timelineFingerprint:selection.timelineFingerprint,expectedProductionRevision:e.productionRevision,profileId:e.profile.id,audioPolicy:e.profile.audioPolicy,captionPolicy:e.profile.captionPolicy}})}const[basis,current]=await Promise.all([this.caller.call("timeline.basis",scope3,options),this.caller.call("timeline.current",scope3,options)]);if(!basis.runnable||!current.isCurrent||current.assemblyStatus!=="ASSEMBLY_READY"||current.freshness!=="CURRENT_BASIS"||basis.currentTimelineVersion!==current.version.version)throw new NativeStudioSdkError("STALE_BASIS","STALE_BASIS","NO_WRITE");return PreparedDeviceRenderSchema.parse({kind:"preview",command:{...base,timelineVersionId:current.version.id,timelineFingerprint:current.version.fingerprint,expectedProductionRevision:basis.productionRevision,profileId:input.profileId??"PREVIEW_H264_480P_V1"}})}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)}};import{createHash as createHash4}from"node:crypto";import{createHash}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")||createHash("sha256").update(bytes).digest("hex")!==v.checksumSha256)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}import{createHash as createHash2}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"||createHash2("sha256").update(bytes).digest("hex")!==v.source.checksumSha256)throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}import{z as z65}from"zod";function operation(input,output,request,identity=[],options={}){return Object.freeze({input,output,request,identity,readOnly:options.readOnly,expectedPath:void 0,identityWhenPresent:options.identityWhenPresent??[]})}function path(...parts){return"/v1/"+parts.map(value=>encodeURIComponent(value)).join("/")}function pageQuery(input){return{limit:input.limit,next:input.next}}function mcpOperation(input,output,readOnly,identity=[],expectedPath){return Object.freeze({input,output,request:null,readOnly,identity,expectedPath,identityWhenPresent:[]})}var production2=z65.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var sourceUpload=UploadSourceInputRequestSchema.extend({projectId:ProjectIdSchema,idempotencyKey:z65.string().trim().min(1).max(200)});var projectProduction=(p,prod,suffix)=>path("projects",p,"productions",prod,suffix);var coreOperations={"visual-sequence.register":operation(RegisterVisualSequenceSchema,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"]]),"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 navigationOperations={"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"]])};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(([key10])=>!["tenantId","projectId"].includes(key10)))}),[["bindingId","bindingId"]])}var agentHostOperations={"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=(scope3,...suffix)=>path("projects",scope3.projectId,"productions",scope3.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.start":operation(StartAgentHostExecutionSchema,AgentHostExecutionViewSchema,value=>({method:"POST",tenantId:value.tenantId,path:route(value),body:Object.fromEntries(Object.entries(value).filter(([key10])=>!["tenantId","projectId","productionId"].includes(key10)))}),[["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=()=>({}),identity=[]){return operation(input,output,value=>({method:"GET",tenantId:value.tenantId,path:path("productions",value.productionId,...suffix(value)),query:query(value)}),identity)}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(([key10])=>key10!=="productionId"&&(options.tenantInBody||key10!=="tenantId")&&!options.pathFields?.includes(key10)))}),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.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.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(key10=>["target."+key10,prefix+"."+key10]);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.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.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 z66}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,z66.strictObject({disabled:z66.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,z66.strictObject({disabled:z66.literal(true)}),i=>({method:"POST",tenantId:i.tenantId,path:path("provider-connections","disable"),body:i})),"provider.revoke":operation(ProviderCredentialRevokeSchema,z66.strictObject({revoked:z66.literal(true)}),i=>({method:"POST",tenantId:i.tenantId,path:path("provider-connections","revoke"),body:i}))};import{z as z67}from"zod";var observationOperations={"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,z67.strictObject({cancellationRequested:z67.boolean()}),q=>["media-observations",q.observationId,"cancel"],{pathFields:["observationId"]})};import{z as z68}from"zod";var speechOperations={"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,z68.strictObject({cancellationRequested:z68.boolean()}),q=>["speech-generations",q.generationId,"cancel"],{pathFields:["generationId"]})};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 z69}from"zod";var post=(input,output,action,identity=[],readOnly=false)=>operation(input,output,i=>({method:"POST",tenantId:i.tenantId,path:path("lifecycle-events",action),body:i}),identity,{readOnly});var lifecycleEventOperations={"webhook.configure":post(ConfigureWebhookSchema,WebhookSubscriptionSchema,"configure",[["subscriptionId","subscriptionId"]]),"webhook.disable":post(DisableWebhookSchema,WebhookSubscriptionSchema,"disable",[["subscriptionId","subscriptionId"]]),"webhook.replay":post(ReplayWebhookSchema,WebhookReplayReceiptSchema,"replay",[["eventId","eventId"]]),"lifecycle-event.capabilities":post(LifecycleEventScopeSchema,LifecycleEventCapabilitiesSchema,"capabilities",[],true),"lifecycle-event.subscriptions":post(QueryLifecycleEventsSchema.safeExtend({kind:z69.literal("subscriptions")}),WebhookSubscriptionPageSchema,"query",[["subscriptionId","items.*.subscriptionId"]],true),"lifecycle-event.events":post(QueryLifecycleEventsSchema.safeExtend({kind:z69.literal("events")}),ExternalLifecycleEventPageSchema,"query",[],true),"lifecycle-event.deliveries":post(QueryLifecycleEventsSchema.safeExtend({kind:z69.literal("deliveries")}),WebhookDeliveryPageSchema,"query",[["subscriptionId","items.*.subscriptionId"],["deliveryId","items.*.deliveryId"]],true),"lifecycle-event.attempts":post(QueryLifecycleEventsSchema.safeExtend({kind:z69.literal("attempts")}),WebhookAttemptPageSchema,"query",[],true)};import{z as z70}from"zod";var mediaDescriptorOperations={"composition.render.media-target":mcpOperation(CompositionRenderGetSchema,CompositionRenderMediaDescriptorSchema,true,[],i=>path("productions",i.productionId,"compositions","renders",i.renderId,"media")),"delivery.download":mcpOperation(TimelineScopeSchema,InterfaceDownloadDescriptorSchema,true,[],i=>path("productions",i.productionId,"deliveries","media")),"temporal-evidence.download":mcpOperation(TemporalEvidenceMediaSchema,InterfaceDownloadDescriptorSchema,true,[],i=>path("productions",i.productionId,"temporal-evidence",i.evidenceId,"media",i.kind)+(i.kind==="FRAME"?"?ordinal="+i.ordinal:"")),"video.options":mcpOperation(z70.strictObject({tenantId:TenantIdSchema}),z70.array(z70.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(200),true)};import{z as z71}from"zod";var NotFound=z71.strictObject({semanticStatus:z71.literal("NOT_FOUND")});var Accepted=z71.strictObject({semanticStatus:z71.literal("ACCEPTED")});var referencePreviewOperations={"studio.capabilities":mcpOperation(StudioCapabilitiesInputSchema,StudioCapabilitiesSchema,true),"reference-preview.start":mcpOperation(StartReferencePreviewSchema,ReferencePreviewAdmissionSchema,false,[["sourceArtifactId","sourceArtifactId"],["expectedBriefVersion","briefVersion"]]),"reference-preview.status":mcpOperation(ReferencePreviewOperationInputSchema,OperationSummarySchema,true,[["operationId","id"]]),"reference-preview.get":mcpOperation(ReferencePreviewOperationInputSchema,z71.union([ReferencePreviewResultSchema,Accepted]),true),"reference-preview.cancel":mcpOperation(ReferencePreviewOperationInputSchema,z71.union([Accepted,NotFound]),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,"exploration.validate":ownerOperations["exploration.plan.validate"]};import{z as z80}from"zod";import{z as z72}from"zod";var IMPORTED_VISUAL_PROFILE_ID="IMPORTED_H264_SDR_CFR30_VISUAL_V1";var IMPORTED_VISUAL_MAX_BYTES=128*1024*1024;var Hash=z72.string().regex(/^[0-9a-f]{64}$/);var PositiveInteger=z72.int().positive().max(1e9);var ImportedVisualRationalSchema=z72.strictObject({numerator:PositiveInteger,denominator:PositiveInteger});var geometry=limit=>z72.strictObject({width:z72.int().min(2).max(limit).multipleOf(2),height:z72.int().min(2).max(limit).multipleOf(2)}).refine(({width,height})=>width*9===height*16||width*16===height*9,"Only exact 16:9 or 9:16 geometry is supported");var ImportedVisualToolchainSchema=z72.strictObject({ffmpegVersion:z72.string().startsWith("ffmpeg version ").max(512),ffprobeVersion:z72.string().startsWith("ffprobe version ").max(512)});var ImportedVisualSourceInputSchema=z72.strictObject({contentType:z72.literal("video/mp4"),checksumSha256:Hash,byteSize:z72.int().min(32).max(IMPORTED_VISUAL_MAX_BYTES),executionClass:z72.enum(["LIVE","TEST_ONLY"])});var ImportedVisualSourceRangeSchema=z72.strictObject({clock:z72.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z72.int().min(0).max(1799),endFrame:z72.int().min(1).max(1800)}).refine(v=>v.endFrame>v.startFrame&&v.endFrame-v.startFrame<=360,"The half-open interval must contain 1 to 360 frames");var ImportedVisualNormalizationRequestSchema=z72.strictObject({schemaVersion:z72.literal(1),profileId:z72.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceInputSchema,sourceRange:ImportedVisualSourceRangeSchema,output:geometry(1920),audioPolicy:z72.enum(["REQUIRE_NO_AUDIO","SILENT_DERIVATIVE"]),expectedToolchain:ImportedVisualToolchainSchema});var ImportedVisualSourceMetadataSchema=z72.strictObject({...ImportedVisualSourceInputSchema.shape,geometry:geometry(3840),videoCodec:z72.literal("h264"),pixelFormat:z72.literal("yuv420p"),sampleAspectRatio:z72.literal("1:1"),rotationDegrees:z72.literal(0),startPts:z72.literal(0),timeBase:ImportedVisualRationalSchema,frameRate:ImportedVisualRationalSchema,frameCount:z72.int().min(1).max(3600),durationTicks:z72.int().positive().max(6e10),availableCfr30Frames:z72.int().min(0).max(1800),color:z72.strictObject({range:z72.enum(["tv","unknown"]),space:z72.enum(["bt709","unknown"]),transfer:z72.enum(["bt709","unknown"]),primaries:z72.enum(["bt709","unknown"])}),audio:z72.strictObject({codec:z72.literal("aac"),sampleRateHz:z72.union([z72.literal(44100),z72.literal(48e3)]),channels:z72.union([z72.literal(1),z72.literal(2)]),startPts:z72.int(),timeBase:ImportedVisualRationalSchema,durationTicks:z72.int().positive().max(6e10)}).nullable(),fullDecode:z72.literal(true),cfrTimestampsVerified:z72.literal(true)}).superRefine((v,ctx)=>{if(![v.durationTicks,v.timeBase.numerator,v.timeBase.denominator,v.frameRate.numerator,v.frameRate.denominator,v.frameCount,v.availableCfr30Frames].every(Number.isSafeInteger)||v.timeBase.denominator<=0||v.frameRate.numerator<=0||v.frameRate.denominator<=0)return;const ticks=BigInt(v.durationTicks)*BigInt(v.timeBase.numerator);const base=BigInt(v.timeBase.denominator);const declaredFrames=ticks*BigInt(v.frameRate.numerator);const expectedFrames=BigInt(v.frameCount)*base*BigInt(v.frameRate.denominator);if(ticks>60n*base||declaredFrames!==expectedFrames||BigInt(v.availableCfr30Frames)!==ticks*30n/base||v.audio&&BigInt(v.audio.durationTicks)*BigInt(v.audio.timeBase.numerator)>60n*BigInt(v.audio.timeBase.denominator))ctx.addIssue({code:"custom",message:"Media clock/count/duration metadata is inconsistent"})});var ImportedVisualInspectionSchema=z72.strictObject({profileId:z72.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,evidenceScope:z72.literal("TECHNICAL_MEDIA_ONLY")});var ImportedVisualNormalizationReceiptSchema=z72.strictObject({schemaVersion:z72.literal(1),request:ImportedVisualNormalizationRequestSchema,original:ImportedVisualSourceMetadataSchema,output:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,frameMap:z72.array(z72.strictObject({outputFrame:z72.int().min(0).max(359),sourceFrame:z72.int().min(0).max(3599),sourcePts:z72.int().min(0).max(6e10)})).min(1).max(360),audioDisposition:z72.enum(["NO_AUDIO_PRESENT","REMOVED_FROM_DERIVATIVE_ONLY"]),evidenceScope:z72.literal("TECHNICAL_MEDIA_ONLY")}).superRefine((v,ctx)=>{const count=v.request.sourceRange.endFrame-v.request.sourceRange.startFrame;const source=v.original;if(![source.frameRate.numerator,source.frameRate.denominator,source.timeBase.numerator,source.timeBase.denominator,v.request.sourceRange.startFrame].every(Number.isSafeInteger)||source.frameRate.numerator<=0||source.frameRate.denominator<=0)return;const rounded=i=>(2n*BigInt(i)*30n*BigInt(source.frameRate.denominator)+BigInt(source.frameRate.numerator))/(2n*BigInt(source.frameRate.numerator));const exactFrameMap=v.frameMap.every((m,i)=>{if(!Number.isSafeInteger(m.sourcePts)||!Number.isSafeInteger(m.sourceFrame))return false;const absoluteFrame=BigInt(v.request.sourceRange.startFrame+i);return BigInt(m.sourcePts)*BigInt(source.timeBase.numerator)*BigInt(source.frameRate.numerator)===BigInt(m.sourceFrame)*BigInt(source.timeBase.denominator)*BigInt(source.frameRate.denominator)&&rounded(m.sourceFrame)<=absoluteFrame&&(m.sourceFrame+1===source.frameCount||rounded(m.sourceFrame+1)>absoluteFrame)});if(!exactFrameMap||v.request.sourceRange.endFrame>source.availableCfr30Frames||v.output.geometry.width>source.geometry.width||v.output.geometry.height>source.geometry.height||v.output.geometry.width*source.geometry.height!==v.output.geometry.height*source.geometry.width)ctx.addIssue({code:"custom",message:"Receipt frame mapping or geometry violates the pinned profile"});if(v.output.frameCount!==count||v.frameMap.length!==count||v.frameMap.some((m,i)=>m.outputFrame!==i||m.sourceFrame>=v.original.frameCount)||v.output.frameRate.numerator!==30||v.output.frameRate.denominator!==1||v.output.audio||v.original.checksumSha256!==v.request.source.checksumSha256||v.original.byteSize!==v.request.source.byteSize||v.original.executionClass!==v.request.source.executionClass||v.output.executionClass!==v.original.executionClass||v.output.geometry.width!==v.request.output.width||v.output.geometry.height!==v.request.output.height||v.toolchain.ffmpegVersion!==v.request.expectedToolchain.ffmpegVersion||v.toolchain.ffprobeVersion!==v.request.expectedToolchain.ffprobeVersion||v.audioDisposition!==(v.original.audio?"REMOVED_FROM_DERIVATIVE_ONLY":"NO_AUDIO_PRESENT")||v.original.audio&&v.request.audioPolicy!=="SILENT_DERIVATIVE"){ctx.addIssue({code:"custom",message:"Normalization receipt does not match its exact request/source/output"})}});import{z as z73}from"zod";var Uuid=z73.uuid();var Hash2=z73.string().regex(/^[0-9a-f]{64}$/);var ImportedVisualOriginalRegisterSchema=z73.strictObject({projectSourceArtifactId:z73.uuid().optional(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,expectedProductionRevision:z73.int().nonnegative(),source:z73.strictObject({contentType:z73.literal("video/mp4"),checksumSha256:Hash2,byteSize:z73.int().min(32).max(128*1024*1024),executionClass:z73.enum(["LIVE","TEST_ONLY"])}),declaredProvenance:z73.strictObject({originalName:z73.string().trim().min(1).max(255).optional(),authorship:z73.string().trim().min(1).max(500).optional(),license:z73.string().trim().min(1).max(500).optional()}),idempotencyKey:z73.string().trim().min(1).max(200)});var ImportedVisualFromProjectSourceSchema=ImportedVisualOriginalRegisterSchema.omit({source:true,projectSourceArtifactId:true}).extend({projectSourceArtifactId:Uuid});var ImportedVisualOriginalReviseSchema=ImportedVisualOriginalRegisterSchema.extend({sourceId:Uuid,expectedVersion:z73.int().positive()});var ImportedVisualNormalizeStartSchema=z73.strictObject({tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,expectedProductionRevision:z73.int().nonnegative(),request:ImportedVisualNormalizationRequestSchema,idempotencyKey:z73.string().trim().min(1).max(200)});var ImportedVisualGetSchema=z73.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid});var ImportedVisualReviewSchema=z73.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,representationId:Uuid,checksumSha256:Hash2,expectedReviewVersion:z73.int().nonnegative(),observations:z73.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z73.string().trim().min(1).max(2500),idempotencyKey:z73.string().trim().min(1).max(200)});var ImportedVisualDecisionSchema=z73.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,reviewId:Uuid,expectedAcceptanceVersion:z73.int().nonnegative(),action:z73.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z73.boolean().default(false),reason:z73.string().trim().min(1).max(2500),idempotencyKey:z73.string().trim().min(1).max(200)});var ImportedVisualOriginalViewSchema=z73.strictObject({sourceId:Uuid,versionId:Uuid,version:z73.int().positive(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,artifactId:Uuid,representationId:Uuid,metadata:ImportedVisualSourceMetadataSchema,declaredProvenance:ImportedVisualOriginalRegisterSchema.shape.declaredProvenance.optional(),executionClass:z73.enum(["LIVE","TEST_ONLY"]),current:z73.boolean(),createdAt:z73.iso.datetime({offset:true})});var ImportedVisualNormalizationViewSchema=z73.strictObject({normalizationId:Uuid,runtimeJobId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,lifecycle:z73.string(),cancellationRequested:z73.boolean(),receipt:ImportedVisualNormalizationReceiptSchema.nullable(),output:z73.strictObject({artifactId:Uuid,representationId:Uuid,posterArtifactId:Uuid,posterRepresentationId:Uuid}).nullable()});import{z as z74}from"zod";var id7=z74.uuid().toLowerCase();var SourceSyncRuntimeScopeSchema=z74.strictObject({tenantId:id7,productionId:id7,requestId:id7});var SourceSyncRuntimeAdmissionSchema=z74.strictObject({requestId:id7,runtimeJobId:id7,productionRevision:z74.int().positive()});var SourceSyncRuntimeViewSchema=SourceSyncRuntimeAdmissionSchema.extend({normalizationId:id7,lifecycle:z74.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),cancellationRequested:z74.boolean(),output:SourceSyncAudioReceiptSchema.nullable()});import{z as z75}from"zod";var id8=z75.uuid().toLowerCase();var hash=z75.string().regex(/^[0-9a-f]{64}$/);var SourceSyncMediaIdentitySchema=z75.strictObject({artifactId:id8,representationId:id8,checksumSha256:hash});var sampleRange=z75.strictObject({startSample:z75.int().nonnegative(),endSample:z75.int().positive()}).refine(v=>v.endSample>v.startSample);var frameRange=z75.strictObject({startFrame:z75.int().nonnegative(),endFrame:z75.int().positive()}).refine(v=>v.endFrame>v.startFrame);var SourceSyncListeningEvidenceSchema=z75.discriminatedUnion("kind",[z75.strictObject({id:z75.string().trim().min(1).max(100),kind:z75.literal("AUDIO_LISTENING"),media:SourceSyncMediaIdentitySchema,coverage:z75.array(sampleRange).min(1).max(64),producer:z75.string().trim().min(1).max(200)}),z75.strictObject({id:z75.string().trim().min(1).max(100),kind:z75.literal("VIDEO_PLAYBACK"),media:SourceSyncMediaIdentitySchema,coverage:z75.array(frameRange).min(1).max(64),producer:z75.string().trim().min(1).max(200)})]);var SourceSyncObservationSchema=z75.strictObject({key:z75.enum(["AUDIBILITY","AUDIO_VISUAL_ALIGNMENT"]),status:z75.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE"]),confidence:z75.enum(["CLEAR","UNCERTAIN"]),observed:z75.string().trim().min(1).max(2e3),evidenceIds:z75.array(z75.string().trim().min(1).max(100)).max(64)});var SourceSyncReviewTargetSchema=z75.strictObject({version:SourceSyncAudioVersionSchema,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,sampleCount:z75.int().positive(),frameCount:z75.int().positive().max(360),currentReviewVersion:z75.int().nonnegative(),declarationScope:z75.literal("ATTRIBUTED_OBSERVATIONS_NOT_LISTENING_ATTESTATION")});var SourceSyncReviewInputSchema=SourceSyncAudioGetSchema.extend({tenantId:id8,productionId:id8,shotId:id8,versionId:id8,expectedReviewVersion:z75.int().nonnegative(),audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z75.array(SourceSyncListeningEvidenceSchema).max(64),observations:z75.array(SourceSyncObservationSchema).length(2),summary:z75.string().trim().min(1).max(4e3),idempotencyKey:z75.string().trim().min(1).max(200)});var SourceSyncReviewRecordSchema=z75.strictObject({id:id8,versionId:id8,reviewVersion:z75.int().positive(),tenantId:id8,productionId:id8,shotId:id8,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z75.array(SourceSyncListeningEvidenceSchema).max(64),observations:z75.array(SourceSyncObservationSchema).length(2),outcome:z75.enum(["PASS","FAIL","NEEDS_REVIEW"]),summary:z75.string(),createdByPrincipalId:id8,executionClass:z75.enum(["LIVE","TEST_ONLY"]),createdAt:z75.iso.datetime({offset:true})});var SourceSyncReviewGetSchema=SourceSyncAudioGetSchema.extend({tenantId:id8,productionId:id8,shotId:id8,versionId:id8,reviewId:id8});import{z as z76}from"zod";var ImportedVideoReviewRecordSchema=VideoReviewRecordSchema.omit({generationId:true,candidateId:true,preparationId:true,contractId:true,contractFingerprint:true}).extend({sourceKind:z76.literal("IMPORTED"),normalizationId:z76.uuid(),sourceId:z76.uuid(),sourceVersionId:z76.uuid(),planVersionId:z76.uuid(),shotPlanningRevision:z76.int().positive()});var ImportedVideoReviewReceiptSchema=z76.strictObject({semanticStatus:z76.literal("SUCCESS"),review:ImportedVideoReviewRecordSchema,productionRevision:z76.int().positive()});import{z as z77}from"zod";var ImportedVisualCancellationSchema=z77.strictObject({cancellationRequested:z77.boolean()});var ImportedVisualAdmissionSchema=z77.strictObject({semanticStatus:z77.literal("ACCEPTED"),normalizationId:z77.uuid(),runtimeJobId:z77.uuid(),sourceId:z77.uuid(),sourceVersionId:z77.uuid(),productionRevision:z77.int().positive()});var ImportedVisualReviewTargetSchema=ProgrammaticVideoReviewTargetSchema.omit({renderId:true,compositionId:true,compositionVersionId:true,compositionVersion:true,compositionFingerprint:true,renderManifestFingerprint:true}).extend({sourceKind:z77.literal("IMPORTED"),normalizationId:z77.uuid(),sourceId:z77.uuid(),sourceVersionId:z77.uuid(),latestReview:ImportedVideoReviewRecordSchema.nullable()});import{z as z78}from"zod";var ImportedVisualOriginalGetSchema=z78.strictObject({tenantId:z78.uuid(),productionId:z78.uuid(),sourceId:z78.uuid(),version:z78.int().positive().optional()});var ImportedVisualOriginalHistoryQuerySchema=z78.strictObject({tenantId:z78.uuid(),productionId:z78.uuid(),sourceId:z78.uuid(),beforeVersion:z78.int().positive().optional(),limit:z78.int().min(1).max(50).default(20)});var ImportedVisualOriginalHistorySchema=z78.strictObject({sourceId:z78.uuid(),items:z78.array(ImportedVisualOriginalViewSchema).max(50),nextBeforeVersion:z78.int().positive().nullable()});var ImportedVisualOriginalQuerySchema=z78.strictObject({tenantId:z78.uuid().toLowerCase(),productionId:z78.uuid().toLowerCase(),shotId:z78.uuid().toLowerCase().optional(),afterSourceId:z78.uuid().toLowerCase().optional(),limit:z78.int().min(1).max(50).default(20)});var ImportedVisualOriginalPageSchema=z78.strictObject({tenantId:z78.uuid(),productionId:z78.uuid(),items:z78.array(ImportedVisualOriginalViewSchema).max(50),nextAfterSourceId:z78.uuid().nullable()}).refine(p=>p.nextAfterSourceId===null||p.items.at(-1)?.sourceId===p.nextAfterSourceId);import{z as z79}from"zod";var Content=z79.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 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(ImportedVisualFromProjectSourceSchema,ImportedVisualOriginalViewSchema,()=>["imported-visuals","originals","from-source"],{identity:[["projectId","projectId"],["shotId","shotId"]]}),"imported-visual.register":operation(ImportedVisualOriginalUploadSchema,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(ImportedVisualOriginalRevisionUploadSchema,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,z80.strictObject({cancellationRequested:z80.boolean()}),i=>["imported-visuals","normalizations",i.normalizationId,"cancel"],{pathFields:["normalizationId"]})};var importedVisualOperations={...ownerOperations2,"imported-visual.review-target":ownerOperations2["imported-visual.review.target"],"imported-visual.review":ownerOperations2["imported-visual.review.record"]};var versionPath=i=>["source-sync-audios","shots",i.shotId,"versions",i.versionId];var ownerOperations3={"source-sync.start":productionWrite(SourceSyncAudioStartSchema,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":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,"source-sync.review.target":ownerOperations3["source-sync.review-target"],"source-sync.review.record":ownerOperations3["source-sync.review"],"source-sync.review.get":ownerOperations3["source-sync.review-get"]};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=(scope3,...suffix)=>path("projects",scope3.projectId,"productions",scope3.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":mcpOperation(AudioGetSchema,AudioExportResultSchema,true),"caption.export":mcpOperation(CaptionExportSchema,CaptionExportResultSchema,true),"audio.basis":productionRead(AudioScopeSchema,AudioBasisSchema,i=>["audio",i.purpose,"basis"],void 0,[["purpose","purpose"]]),"audio.current":productionRead(AudioScopeSchema,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,family:input.family,search:input.search,lifecycle:input.lifecycle}}))};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"]})};var scopeKeys=["tenantId","projectId","productionId"];function navigationResponseMatches(value){if(!value||typeof value!=="object")return true;const result=value;if(result.evidence?.source!=="production_snapshot")return true;if(!result.actions?.items||!result.operations?.items)return false;const same2=(a,b)=>typeof a==="string"&&typeof b==="string"&&a.toLowerCase()===b.toLowerCase();const hintsMatch=input=>!input||scopeKeys.every(key10=>input[key10]===void 0||same2(input[key10],result[key10]));return result.actions.items.every(action=>scopeKeys.every(key10=>same2(action.context[key10],result[key10]))&&action.context.revision===result.evidence.revision&&hintsMatch(action.inputHints?.knownInputs)&&hintsMatch(action.inspect?.arguments))&&result.operations.items.every(operation2=>hintsMatch(operation2.inspect?.arguments)&&(!operation2.inspect||operation2.inspect.arguments.operationId===operation2.id))}var envelopes=new Set(["choices","related","operations","items","project","production","productions","artifact","primaryRepresentation","relations","storyVersion","planVersion","version","manifest","timeline","basis","review","selection","decision","target","admission","policy","finalDelivery","receipt","render","evidence","source","sourceIdentity","preparation","link","body","latestReview","finalReady","approval","binding","snapshot","sequence","frames","frameOutput","acceptance","reference","candidate","connection","scope","profile","current","ownerContext","comparison","candidates","reviewContext","input","recordDraft","owner","output","result","briefVersion","deliveryTarget","deliverySnapshot","validation","preparations","view","generationDrafts","request","generation","handoff","mediaRead","reviewTarget","reviews"]);var uuid=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function same(left,right){if(Array.isArray(left)||Array.isArray(right))return Array.isArray(left)&&Array.isArray(right)&&left.length===right.length&&left.every((item,i)=>same(item,right[i]));if(left&&right&&typeof left==="object"&&typeof right==="object"){const a=left,b=right;const keys=Object.keys(a);return keys.length===Object.keys(b).length&&keys.every(key10=>Object.hasOwn(b,key10)&&same(a[key10],b[key10]))}return typeof left==="string"&&typeof right==="string"&&uuid.test(left)&&uuid.test(right)?left.toLowerCase()===right.toLowerCase():left===right}function scopeMatches(value,scope3,depth=0){if(!value||typeof value!=="object")return true;if(depth>12)return false;if(Array.isArray(value))return value.every(item=>scopeMatches(item,scope3,depth+1));const record=value;for(const key10 of["tenantId","projectId","productionId"])if(scope3[key10]!==void 0&&record[key10]!==void 0&&record[key10]!==null&&!same(record[key10],scope3[key10]))return false;return Object.entries(record).every(([key10,item])=>!envelopes.has(key10)||scopeMatches(item,scope3,depth+1))}function targetsMatch(value,parts,expected){if(!parts.length)return same(value,expected);const[part,...rest]=parts;if(part==="*")return Array.isArray(value)&&value.every(item=>targetsMatch(item,rest,expected));return!!value&&typeof value==="object"&&targetsMatch(value[part],rest,expected)}function deviceBound(request,result){const target=request;const receipt=result?.deviceExecution;return!!receipt&&receipt.mode===target.mode&&!!receipt.runtimeJobId&&(!target.deviceId||target.deviceId===receipt.deviceId)}function assertResponseBindings(result,input,identity,method,pathOrBindings,additionalBindings=[]){const expectedPath=typeof pathOrBindings==="string"?pathOrBindings:void 0;const identityWhenPresent=typeof pathOrBindings==="string"||pathOrBindings===void 0?additionalBindings:pathOrBindings;const record=result;const basis=input.basis;const basisInput=basis?.input;const nested=input.scope??basis?.scope??basisInput?.scope??basis;if(input.deviceExecution!==void 0&&!deviceBound(input.deviceExecution,result)||!scopeMatches(result,input)||!navigationResponseMatches(result)||nested!==void 0&&!scopeMatches(result,nested)||expectedPath!==void 0&&(typeof record?.path!=="string"||record.path.replace(/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}/gi,id9=>id9.toLowerCase())!==expectedPath.replace(/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}/gi,id9=>id9.toLowerCase()))||[...identity,...identityWhenPresent.filter(([,target])=>!!record&&Object.hasOwn(record,target))].some(([key10,target,whenStatus])=>{if(whenStatus!==void 0&&record?.semanticStatus!==whenStatus)return false;const expected=key10.split(".").reduce((value,field)=>value&&typeof value==="object"?value[field]:void 0,input);return expected!==void 0&&!targetsMatch(result,target.split("."),expected)})||Array.isArray(record?.items)&&typeof input.limit==="number"&&record.items.length>input.limit)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE",method==="POST"?"UNKNOWN":"NO_WRITE")}import{createHash as createHash3}from"node:crypto";import{z as z81}from"zod";var render=RoughCutGetSchema.omit({tenantId:true});var mediaInput=z81.discriminatedUnion("kind",[AudioGetSchema.omit({tenantId:true}).extend({kind:z81.literal("AUDIO")}),CaptionExportSchema.omit({tenantId:true}).extend({kind:z81.literal("CAPTION")}),ArtifactDiscoveryMediaSchema.omit({tenantId:true}).extend({kind:z81.literal("DISCOVERED_ARTIFACT"),contentType:DiscoveryContentTypeSchema}),AudioGetSchema.omit({tenantId:true}).extend({kind:z81.literal("AUDIO_WAV")}),CaptionGetSchema.omit({tenantId:true}).extend({kind:z81.enum(["CAPTION_JSON","CAPTION_SRT"])}),TemporalEvidenceGetSchema.omit({tenantId:true}).extend({kind:z81.literal("TEMPORAL_FRAME"),ordinal:z81.int().nonnegative().max(63)}),TemporalEvidenceGetSchema.omit({tenantId:true}).extend({kind:z81.enum(["TEMPORAL_SHEET","TEMPORAL_MANIFEST"])}),VideoGetInputSchema.omit({tenantId:true}).extend({kind:z81.enum(["VIDEO_GENERATION","VIDEO_GENERATION_POSTER"])}),render.extend({kind:z81.literal("CODE_VIDEO")}),render.extend({kind:z81.enum(["ROUGH_CUT_VIDEO","ROUGH_CUT_POSTER","FINAL_VIDEO","FINAL_POSTER"])}),TimelineScopeSchema.omit({tenantId:true}).extend({kind:z81.literal("DELIVERED_VIDEO")}),DeliveryManifestGetSchema.omit({tenantId:true}).extend({kind:z81.literal("DELIVERY_MANIFEST")})]);var expectedInput=z81.strictObject({checksumSha256:z81.string().regex(/^[0-9a-f]{64}$/),byteSize:z81.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(([key10])=>key10!=="tenantId"))),identity=expectedInput.safeParse({checksumSha256:expected?.checksumSha256,byteSize:expected?.byteSize});if(!parsed.success||!identity.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(identity.data.byteSize??128*1024*1024,input.kind==="AUDIO"||input.kind==="AUDIO_WAV"?12582912:input.kind.startsWith("CAPTION")?131072:128*1024*1024),options);const checksumSha256=createHash3("sha256").update(result.bytes).digest("hex");if(checksumSha256!==identity.data.checksumSha256||identity.data.byteSize!==void 0&&result.bytes.byteLength!==identity.data.byteSize||result.etag&&result.etag!==`"${checksumSha256}"`)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");return{...result,checksumSha256}}function abortable(promise,signal){if(signal.aborted){void promise.catch(()=>{});return Promise.reject(signal.reason)}return new Promise((resolve,reject)=>{const abort=()=>reject(signal.reason);signal.addEventListener("abort",abort,{once:true});promise.then(resolve,reject).finally(()=>signal.removeEventListener("abort",abort))})}async function boundedResponseBytes(response,limit,signal){const length=response.headers.get("content-length");if(length!==null&&(!/^\d+$/.test(length)||Number(length)>limit)){void response.body?.cancel().catch(()=>{});throw new NativeStudioSdkError("RESPONSE_TOO_LARGE","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}if(!response.body)return new Uint8Array;const reader=response.body.getReader();const chunks=[];let size=0;try{while(true){const next=await abortable(reader.read(),signal);if(next.done)break;size+=next.value.byteLength;if(size>limit)throw new NativeStudioSdkError("RESPONSE_TOO_LARGE","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN");chunks.push(next.value)}const result=new Uint8Array(size);let offset=0;for(const chunk of chunks){result.set(chunk,offset);offset+=chunk.byteLength}return result}finally{void reader.cancel().catch(()=>{});reader.releaseLock()}}var nativeFailureCodes=new Set([...NativeToolAuthorityFailureSchema.shape.error.shape.code.options,"REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","INVALID_INPUT","REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","PROVIDER_UNAVAILABLE","BUDGET_BLOCKED","CANCELLED","SUPERSEDED","INTERNAL_OPERATIONAL_FAILURE","IDEMPOTENCY_CONFLICT","INPUT_UNAVAILABLE","AUDIO_UNAVAILABLE","CAPTION_UNAVAILABLE","TEST_EVIDENCE_DENIED","CONFLICT","INVALID_MEDIA","LEASE_LOST","SOURCE_UNAVAILABLE","TOOL_AUTHORITY_UNAVAILABLE","ACTIVE_EXECUTION_EXISTS","BINDING_UNAVAILABLE","PROVIDER_CAPABILITY_UNAVAILABLE","REPLAY_EXHAUSTED"]);var statuses={400:["INVALID_INPUT"],413:["INVALID_INPUT"],415:["INVALID_INPUT"],401:["BLOCKED"],403:["BLOCKED"],404:["NOT_FOUND"],409:["REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","BUDGET_BLOCKED","CANCELLED","SUPERSEDED"],422:["INVALID_INPUT"],429:["BUDGET_BLOCKED","PROVIDER_UNAVAILABLE"]};async function nativeFailure(response,signal){try{if(response.headers.get("content-type")?.split(";")[0]?.trim()!=="application/json")return null;const bytes=await boundedResponseBytes(response,64*1024,signal);const raw=JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes));if(!raw||typeof raw!=="object"||Array.isArray(raw))return null;const record=raw;const status=InterfaceSemanticStatusSchema.safeParse(record.semanticStatus);if(!status.success||!(statuses[response.status]??(response.status>=500?["INTERNAL_OPERATIONAL_FAILURE","PROVIDER_UNAVAILABLE","CAPABILITY_UNAVAILABLE"]:[])).includes(status.data))return null;const error=record.error;const code=error&&typeof error==="object"?error.code:void 0;return{semanticStatus:status.data,code:typeof code==="string"&&nativeFailureCodes.has(code)?code:status.data}}catch{return null}finally{void response.body?.cancel().catch(()=>{})}}var NativeStudioHttpTransport=class{constructor(config){this.config=config;try{this.origin=new URL(config.baseUrl);if(this.origin.username||this.origin.password||this.origin.search||this.origin.hash||this.origin.pathname!=="/"||this.origin.protocol!=="https:"&&!(this.origin.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(this.origin.hostname)))sdkInputError()}catch{sdkInputError()}this.timeout=config.timeoutMs??3e4;this.jsonLimit=config.maxJsonBytes??16*1024*1024;if(!Number.isSafeInteger(this.timeout)||this.timeout<1||this.timeout>3e5||!Number.isSafeInteger(this.jsonLimit)||this.jsonLimit<1024||this.jsonLimit>32*1024*1024)sdkInputError()}config;origin;timeout;jsonLimit;async response(request,options){const write2=request.method==="POST"&&!request.readOnly;if(!request.path.startsWith("/v1/")||request.path.includes("?")||request.path.includes("#")||request.path.includes(".."))sdkInputError();const url=new URL(request.path,this.origin);if(url.origin!==this.origin.origin||!url.pathname.startsWith("/v1/")||!["GET","POST"].includes(request.method)||!TenantIdSchema.safeParse(request.tenantId).success)sdkInputError();for(const[key10,value]of Object.entries(request.query??{}))if(value!==void 0)url.searchParams.set(key10,String(value));let body;try{if(request.importedVideo){const v=request.importedVideo;if(request.method!=="POST"||request.body!==void 0||!/^\/v1\/productions\/[a-f0-9-]{36}\/imported-visuals\/originals\/bytes$/i.test(request.path)||!(v.bytes instanceof Uint8Array)||v.bytes.length<32||v.bytes.length>128*1024*1024||!/^[A-Za-z0-9_-]+$/.test(v.metadata)||v.metadata.length>8192)sdkInputError();body=new Uint8Array(v.bytes)}else body=request.body===void 0?void 0:JSON.stringify(request.body);if(typeof body==="string"&&new TextEncoder().encode(body).byteLength>18*1024*1024)sdkInputError()}catch{sdkInputError()}const timeout=AbortSignal.timeout(this.timeout);const signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let authorization;if(request.authentication==="runtime-proof"){if(request.method!=="POST"||!/^\/v1\/projects\/[0-9a-f-]{36}\/(?:native-tool-grants\/[0-9a-f-]{36}\/(?:proof|status)|productions\/[0-9a-f-]{36}\/native-tool-credentials\/exchange)$/.test(request.path))sdkInputError()}else{try{authorization=await abortable(Promise.resolve().then(()=>this.config.authorization(signal)),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"UNAUTHENTICATED","BLOCKED","NO_WRITE")}if(typeof authorization!=="string"||!/^Bearer [A-Za-z0-9._~+/-]+={0,2}$/.test(authorization)||authorization.length>16384)throw new NativeStudioSdkError("UNAUTHENTICATED","BLOCKED","NO_WRITE")}if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");try{const pending=Promise.resolve().then(()=>(this.config.fetch??fetch)(url,{method:request.method,redirect:"error",cache:"no-store",signal,headers:{...authorization===void 0?{}:{authorization},"x-native-tenant-id":request.tenantId,accept:"application/json",...request.body===void 0?{}:{"content-type":"application/json"},...request.importedVideo?{"content-type":"video/mp4","x-native-import-metadata":request.importedVideo.metadata}:{}},...body===void 0?{}:{body}}));void pending.then(late=>{if(signal.aborted)void late.body?.cancel().catch(()=>{})},()=>{});const response=await abortable(pending,signal);if(!response.ok){const status=response.status;const native=await nativeFailure(response,signal);const code=status===401?"UNAUTHENTICATED":status===403?"FORBIDDEN":status===404?"NOT_FOUND":status===400||status===413||status===415||status===422?"INVALID_INPUT":status===409?"REVISION_CONFLICT":"HTTP_FAILURE";const semanticStatus=status===401||status===403?"BLOCKED":status===404?"NOT_FOUND":status===400||status===413||status===415||status===422?"INVALID_INPUT":status===409?"REVISION_CONFLICT":"INTERNAL_OPERATIONAL_FAILURE";throw new NativeStudioSdkError(native?.code??code,native?.semanticStatus??semanticStatus,status>=500&&write2?"UNKNOWN":"REJECTED",status)}return{response,signal}}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError(write2?"OUTCOME_UNKNOWN":signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE",write2?"UNKNOWN":"NO_WRITE")}}async json(request,schema,options={}){const{response,signal}=await this.response(request,options);try{const contentType=response.headers.get("content-type")?.split(";")[0]?.trim();if(contentType!=="application/json"){void response.body?.cancel().catch(()=>{});throw new Error}const bytes=await boundedResponseBytes(response,this.jsonLimit,signal);return schema.parse(JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes)))}catch(error){if(error instanceof NativeStudioSdkError)throw new NativeStudioSdkError(error.code,error.semanticStatus,request.method==="POST"&&!request.readOnly?"UNKNOWN":"NO_WRITE",error.status);throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",request.method==="POST"&&!request.readOnly?"UNKNOWN":"NO_WRITE")}}async binary(request,contentTypes,limit,options={}){if(request.method!=="GET"||!Number.isSafeInteger(limit)||limit<1||limit>128*1024*1024)sdkInputError();const{response,signal}=await this.response(request,options);const contentType=response.headers.get("content-type")?.split(";")[0]?.trim()??"";if(!contentTypes.includes(contentType)){await response.body?.cancel().catch(()=>{});throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{return{bytes:await boundedResponseBytes(response,limit,signal),contentType,etag:response.headers.get("etag")}}catch(error){throw new NativeStudioSdkError(error instanceof NativeStudioSdkError?error.code:signal.aborted?"REQUEST_ABORTED":"RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}};var sdkOperations=Object.freeze({...coreOperations,...navigationOperations,...discoveryOperations,...agentHostOperations,...agentHostExecutionOperations,...nativeToolAuthorityOperations,...compositionOperations,...assemblyOperations,...editorOperations,...reviewerOperations,...repairStrategyOperations,...canonicalRepairOperations,...programmaticReviewOperations,...compositionSourceOperations,...programmaticExplorationOperations,...deliveryOperations,...shotPreparationOperations,...generationOperations,...keyframeReviewOperations,...videoReviewOperations,...providerOperations,...speechOperations,...observationOperations,...soundMakingPlanOperations,...lifecycleEventOperations,...temporalEvidenceOperations,...audioCaptionOperations,...planningIntelligenceOperations,...importedVisualOperations,...sourceSyncOperations,...visualExplorationOperations,...referencePreviewOperations,...mediaDescriptorOperations});var NativeStudioAgentClient=class{deviceRenders=new NativeStudioDeviceRenders(this);navigation=new NativeStudioNavigationFacade(this);tenantId;transport;constructor(config){const tenant2=TenantIdSchema.safeParse(config.tenantId);if(!tenant2.success)sdkInputError();this.tenantId=tenant2.data.toLowerCase();this.transport=new NativeStudioHttpTransport(config)}async call(key10,raw,options={}){if(!Object.hasOwn(sdkOperations,key10)||!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[key10];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();const request=spec.request(parsed.data);const result=await this.transport.json({...request,readOnly:spec.readOnly},spec.output,options);assertResponseBindings(result,parsed.data,spec.identity,spec.readOnly?"GET":request.method,void 0,spec.identityWhenPresent);if(key10==="temporal-evidence.read-video")assertOriginalVideoBytes(result);if(key10==="source-sync.audio")assertExportBytes(result);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=createHash4("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)}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=createHash4("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 createHash5}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]))||createHash5("sha256").update(bytes).digest("hex")!==v.checksumSha256)throw new NativeStudioSdkError("MEDIA_IDENTITY_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}import{createHash as createHash6}from"node:crypto";import{z as z82}from"zod";var Input=z82.discriminatedUnion("kind",[KeyframeGetInputSchema.extend({kind:z82.literal("KEYFRAME")}),VideoGetInputSchema.extend({kind:z82.literal("VIDEO_POSTER")}),RoughCutGetSchema.extend({kind:z82.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=z82.strictObject({checksumSha256:z82.string().regex(/^[0-9a-f]{64}$/),byteSize:z82.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}),identity=Identity.safeParse(expected);if(!input.success||!identity.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}),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 envelope2=z82.object({semanticStatus:InterfaceSemanticStatusSchema,data:z82.unknown().optional(),error:z82.object({code:z82.string()}).optional()}).parse(response.structuredContent);if(response.isError||envelope2.semanticStatus!=="SUCCESS"){const status=["SUCCESS","ACCEPTED"].includes(envelope2.semanticStatus)?"INTERNAL_OPERATIONAL_FAILURE":envelope2.semanticStatus;throw new NativeStudioSdkError(envelope2.error&&nativeFailureCodes.has(envelope2.error.code)?envelope2.error.code:status,status,"NO_WRITE")}const metadata=Metadata.parse(envelope2.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=createHash6("sha256").update(bytes).digest("hex");if(bytes.toString("base64")!==block.data||bytes.length!==metadata.byteSize||block.mimeType!==metadata.contentType||checksumSha256!==metadata.checksumSha256||checksumSha256!==identity.data.checksumSha256||identity.data.byteSize!==void 0&&bytes.length!==identity.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({"studio.capability.groups":"studio_capability_groups","studio.start":"studio_start","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.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.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.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","exploration.validate":"exploration_plan_validate","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.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-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.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.get":"rough_cut_get","rough-cut.query":"rough_cut_query","rough-cut.cancel":"rough_cut_cancel","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.get":"final_render_get","final-render.query":"final_render_query","final-render.cancel":"final_render_cancel","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.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.review-target":"imported_visual_review_target","imported-visual.review":"imported_visual_review","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","source-sync.review-target":"source_sync_review_target","source-sync.review":"source_sync_review","source-sync.review-get":"source_sync_review_get","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","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.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":"webhook_configure","webhook.disable":"webhook_disable","webhook.replay":"webhook_replay","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(["exploration.validate","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(key10,input){return Object.fromEntries(Object.entries(input).filter(([k])=>!(k==="tenantId"&&nestedScope.has(key10))&&!(k==="projectId"&&projectInPath.has(key10))))}import{createHash as createHash7}from"node:crypto";import{z as z83}from"zod";var expectedSchema=z83.strictObject({checksumSha256:z83.string().regex(/^[a-f0-9]{64}$/),byteSize:z83.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}),identity=expectedSchema.safeParse({checksumSha256:expected?.checksumSha256,byteSize:expected?.byteSize});if(!input.success||!identity.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 reply;try{reply=await abortable(config.client.callTool({name:"temporal_evidence_read_image",arguments:input.data},{signal,timeout:config.timeoutMs}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{if(Buffer.byteLength(JSON.stringify(reply),"utf8")>config.maxJsonBytes)throw Error();const texts=reply.content.filter(block2=>block2.type==="text"),images=reply.content.filter(block2=>block2.type==="image");const carrier=reply.structuredContent!==void 0?reply.structuredContent:texts.length===1?JSON.parse(texts[0].text):void 0;const envelope2=z83.object({semanticStatus:InterfaceSemanticStatusSchema,data:z83.unknown().optional(),error:z83.object({code:z83.string()}).optional()}).parse(carrier);if(reply.isError)throw new NativeStudioSdkError(envelope2.error&&nativeFailureCodes.has(envelope2.error.code)?envelope2.error.code:envelope2.semanticStatus,envelope2.semanticStatus==="SUCCESS"||envelope2.semanticStatus==="ACCEPTED"?"INTERNAL_OPERATIONAL_FAILURE":envelope2.semanticStatus,"REJECTED");if(envelope2.semanticStatus!=="SUCCESS"||images.length!==1||(reply.structuredContent!==void 0?reply.content.length!==1||texts.length!==0:reply.content.length!==2||texts.length!==1))throw Error();const metadata=TemporalEvidenceImageMetadataSchema.parse(envelope2.data);assertResponseBindings(metadata,input.data,[["evidenceId","evidenceId"],["kind","kind"],["ordinal","ordinal"]],"GET");const block=images[0],bytes=Buffer.from(block.data,"base64"),checksumSha256=createHash7("sha256").update(bytes).digest("hex");if(block.mimeType!==metadata.contentType||bytes.toString("base64")!==block.data||bytes.byteLength!==metadata.byteSize||checksumSha256!==metadata.checksumSha256||checksumSha256!==identity.data.checksumSha256||identity.data.byteSize!==void 0&&bytes.byteLength!==identity.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 createHash8}from"node:crypto";import{z as z84}from"zod";var inputSchema=z84.discriminatedUnion("kind",[AudioGetSchema.extend({kind:z84.literal("AUDIO_WAV")}),CaptionGetSchema.extend({kind:z84.enum(["CAPTION_JSON","CAPTION_SRT"])}),SourceSyncAudioGetSchema.extend({kind:z84.literal("SOURCE_SYNC_WAV")})]);var expectedSchema2=z84.strictObject({checksumSha256:z84.string().regex(/^[0-9a-f]{64}$/),byteSize:z84.int().positive().max(12582912).optional()});var outputSchema=z84.strictObject({semanticStatus:z84.literal("SUCCESS"),data:z84.strictObject({contentType:z84.enum(["audio/wav","application/json","application/x-subrip"]),checksumSha256:z84.string().regex(/^[0-9a-f]{64}$/),representationId:z84.uuid().optional(),byteSize:z84.int().positive().max(12582912).optional(),contentBase64:z84.string().max(16777216).optional(),text:z84.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}),identity=expectedSchema2.safeParse(expected);if(!parsed.success||!identity.success)sdkInputError();const{kind,...arguments_}=parsed.data;const name2=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 reply;try{reply=await abortable(config.client.callTool({name:name2,arguments:{...arguments_,...kind.startsWith("CAPTION")?{format:kind==="CAPTION_JSON"?"JSON":"SRT"}:{}}},{signal,timeout:config.timeoutMs}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{if(Buffer.byteLength(JSON.stringify(reply),"utf8")>config.maxJsonBytes||reply.isError)throw Error();const texts=reply.content.filter(x=>x.type==="text");const result=outputSchema.parse(reply.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=createHash8("sha256").update(bytes).digest("hex");if(wav&&bytes.toString("base64")!==result.contentBase64||bytes.length>(wav?12582912:131072)||checksumSha256!==result.checksumSha256||checksumSha256!==identity.data.checksumSha256||result.byteSize!==void 0&&bytes.length!==result.byteSize||identity.data.byteSize!==void 0&&bytes.length!==identity.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 createHash9}from"node:crypto";import{z as z85}from"zod";var inputSchema2=z85.discriminatedUnion("kind",[KeyframeGetInputSchema.extend({kind:z85.literal("KEYFRAME")}),VideoGetInputSchema.extend({kind:z85.literal("VIDEO_POSTER")}),RoughCutGetSchema.extend({kind:z85.literal("ROUGH_CUT_POSTER")}),FinalRenderGetSchema.extend({kind:z85.literal("FINAL_POSTER")}),ReferencePreviewOperationInputSchema.extend({kind:z85.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=z85.strictObject({checksumSha256:z85.string().regex(/^[a-f0-9]{64}$/),byteSize:z85.int().positive().max(16*1024*1024).optional()});var metadataSchema=z85.strictObject({contentType:z85.enum(["image/png","image/jpeg","image/webp"]),checksumSha256:identitySchema.shape.checksumSha256,byteSize:z85.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}),identity=identitySchema.safeParse(expected);if(!input.success||!identity.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 reply;try{reply=await abortable(config.client.callTool({name:sdkMcpImageTools[kind],arguments:arguments_},{signal,timeout:config.timeoutMs}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{if(Buffer.byteLength(JSON.stringify(reply),"utf8")>config.maxJsonBytes)throw Error();const texts=reply.content.filter(b=>b.type==="text"),images=reply.content.filter(b=>b.type==="image");const carrier=reply.structuredContent??(texts.length===1?JSON.parse(texts[0].text):void 0);const envelope2=z85.object({semanticStatus:InterfaceSemanticStatusSchema,data:z85.unknown().optional(),error:z85.object({code:z85.string()}).optional()}).parse(carrier);if(reply.isError)throw new NativeStudioSdkError(envelope2.error&&nativeFailureCodes.has(envelope2.error.code)?envelope2.error.code:"RESPONSE_INVALID",envelope2.semanticStatus==="SUCCESS"?"INTERNAL_OPERATIONAL_FAILURE":envelope2.semanticStatus,"NO_WRITE");if(envelope2.semanticStatus!=="SUCCESS"||images.length!==1||reply.content.length!==(kind==="REFERENCE_PREVIEW"?2:1)||texts.length!==(kind==="REFERENCE_PREVIEW"?1:0))throw Error();const metadata=kind==="REFERENCE_PREVIEW"?ReferencePreviewResultSchema.parse(envelope2.data):metadataSchema.parse(envelope2.data);const block=images[0],bytes=Buffer.from(block.data,"base64"),checksumSha256=createHash9("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!==identity.data.checksumSha256||identity.data.byteSize!==void 0&&bytes.length!==identity.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")}}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();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(key10,raw,options={}){if(!Object.hasOwn(sdkOperations,key10)||!raw||typeof raw!=="object"||Array.isArray(raw))sdkInputError();if(raw.tenantId!==void 0&&(typeof raw.tenantId!=="string"||raw.tenantId.toLowerCase()!==this.tenantId))sdkInputError();const tool=sdkMcpTools[key10];if(tool===null)throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","CAPABILITY_UNAVAILABLE","NO_WRITE");const spec=sdkOperations[key10],parsed=spec.input.safeParse({...raw,tenantId:this.tenantId});if(!parsed.success)sdkInputError();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((key10==="rough-cut.start"||key10==="final-render.start")&&"deviceExecution"in input&&input.deviceExecution){const description=await this.navigation.describe({tool},{signal});const properties=description.inputSchema.properties;if(!properties||typeof properties!=="object"||!Object.hasOwn(properties,"deviceExecution"))throw new NativeStudioSdkError("CAPABILITY_UNAVAILABLE","BLOCKED","NO_WRITE")}let result;try{result=await abortable(this.config.client.callTool({name:tool,arguments:sdkMcpInput(key10,input)},{signal,timeout:this.timeout}),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")>this.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 envelope2=value&&typeof value==="object"&&!Array.isArray(value)?value:{};if("isError"in result&&result.isError){const status=InterfaceSemanticStatusSchema.safeParse(envelope2.semanticStatus);const semantic=status.success&&!["SUCCESS","ACCEPTED"].includes(status.data)?status.data:"INTERNAL_OPERATIONAL_FAILURE";const code=envelope2.error&&typeof envelope2.error==="object"?envelope2.error.code:void 0;throw new NativeStudioSdkError(typeof code==="string"&&nativeFailureCodes.has(code)?code:semantic,semantic,semantic==="INTERNAL_OPERATIONAL_FAILURE"?outcome:"REJECTED")}if(envelope2.semanticStatus==="NOT_FOUND"&&envelope2.data===void 0)throw new NativeStudioSdkError("NOT_FOUND","NOT_FOUND",write2?"REJECTED":"NO_WRITE");const schema=spec.output;for(const candidate of[value,envelope2.data,envelope2.data&&typeof envelope2.data==="object"&&!Array.isArray(envelope2.data)?{...envelope2.data,semanticStatus:envelope2.semanticStatus}:void 0]){const parsedOutput=schema.safeParse(candidate);if(parsedOutput.success){if(key10==="reference-preview.get")assertPreviewBytes(parsedOutput.data);if(key10==="temporal-evidence.read-video")assertOriginalVideoBytes(parsedOutput.data);if(key10==="audio.export"||key10==="caption.export"||key10==="source-sync.audio")assertExportBytes(parsedOutput.data,key10==="caption.export"&&"format"in input?String(input.format):void 0);assertResponseBindings(parsedOutput.data,input,spec.identity,write2?"POST":"GET",spec.expectedPath?spec.expectedPath(input):void 0,spec.identityWhenPresent);return parsedOutput.data}}throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",outcome)}};var NativeStudioNavigationClient=class{constructor(config){this.config=config;if(typeof config.client?.listTools!=="function"||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 timeout=this.config.timeoutMs??3e4;const signal=options.signal?AbortSignal.any([options.signal,AbortSignal.timeout(timeout)]):AbortSignal.timeout(timeout);if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let value;try{value=await abortable(this.config.client.listTools(void 0,{signal,timeout,cacheMode:"bypass"}),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}if(!value||!Array.isArray(value.tools)||value.nextCursor||value.tools.length>512||value.tools.some(tool=>!PublicToolDefinitionSchema.safeParse(tool).success||tool.inputSchema?.type!=="object")||new Set(value.tools.map(t=>t.name)).size!==value.tools.length||Buffer.byteLength(JSON.stringify(value))>(this.config.maxJsonBytes??16*1024*1024))this.invalid();const names=new Set([...NavigationToolNames,"nvs_open_execution"]);const tools=value.tools.filter(tool=>names.has(tool.name));if(NavigationToolNames.some(name2=>!tools.some(tool=>tool.name===name2)))this.invalid();this.definitions.clear();this.contexts.clear();for(const tool of tools)this.remember(tool);return{tools}}async selectedSchema(reference,expectedTool,options={}){if(!reference||reference.length>2048||!/^[a-zA-Z0-9_-]{1,120}$/.test(expectedTool))sdkInputError();const context=this.contexts.get(reference);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:reference,...projectId?{projectId}:{}},options);const definition=description.definition;if(!definition||definition.name!==expectedTool||JSON.stringify(definition.inputSchema)!==JSON.stringify(description.inputSchema)||JSON.stringify(definition.outputSchema??null)!==JSON.stringify(description.outputSchema))this.invalid();const selected=definition;this.remember(selected);return{tools:[selected]}}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")}};var NativeStudioRuntimeAuthorityClient=class{tenantId;origin;transport;constructor(config){const tenant2=TenantIdSchema.safeParse(config.tenantId);if(!tenant2.success)sdkInputError();this.tenantId=tenant2.data.toLowerCase();if(config.maxJsonBytes!==void 0&&config.maxJsonBytes>65536)sdkInputError();try{this.origin=new URL(config.baseUrl);if(this.origin.protocol!=="https:")sdkInputError()}catch{sdkInputError()}this.transport=new NativeStudioHttpTransport({...config,maxJsonBytes:config.maxJsonBytes??65536,authorization:()=>{throw new Error("Runtime proof has no bearer credential")}})}input(schema,raw){if(!raw||typeof raw!=="object"||Array.isArray(raw))sdkInputError();const record=raw;if(record.tenantId!==void 0&&(typeof record.tenantId!=="string"||record.tenantId.toLowerCase()!==this.tenantId))sdkInputError();const parsed=schema.safeParse({...record,tenantId:this.tenantId});if(!parsed.success)sdkInputError();return parsed.data}resource(projectId,resource){if(resource!==new URL(`/mcp/native/v1/projects/${projectId}`,this.origin).href)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}async prove(raw,options={}){const value=this.input(NativeRuntimeProofRequestSchema,raw),result=await this.transport.json({method:"POST",tenantId:this.tenantId,path:path("projects",value.projectId,"native-tool-grants",value.grantId,"proof"),body:{assertion:value.assertion},authentication:"runtime-proof"},NativeToolGrantViewSchema,options);assertResponseBindings(result,value,[["grantId","grantId"]],"POST");this.resource(value.projectId,result.resource);return result}async status(raw,options={}){const value=this.input(NativeRuntimeProofRequestSchema,raw);try{const result=await this.transport.json({method:"POST",tenantId:this.tenantId,path:path("projects",value.projectId,"native-tool-grants",value.grantId,"status"),body:{assertion:value.assertion},authentication:"runtime-proof"},NativeToolGrantViewSchema,options);assertResponseBindings(result,value,[["grantId","grantId"]],"POST");this.resource(value.projectId,result.resource);return result}catch(error){if(error instanceof NativeStudioSdkError)throw new NativeStudioSdkError(error.code,error.semanticStatus,"NO_WRITE",error.status);throw error}}async exchange(raw,options={}){const value=this.input(NativeToolCredentialExchangeSchema,raw),result=await this.transport.json({method:"POST",tenantId:this.tenantId,path:path("projects",value.projectId,"productions",value.productionId,"native-tool-credentials","exchange"),body:{authorityRef:value.authorityRef,assertion:value.assertion},authentication:"runtime-proof"},NativeToolCredentialReplySchema,options);this.resource(value.projectId,result.resource);if(!result.accessToken.startsWith(`nvst_${result.tokenId}.`))throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN");return result}};import{setTimeout as delay}from"node:timers/promises";async function*queryPages(client,key10,input,options={}){const maxPages=options.maxPages??50,maxItems=options.maxItems??1e3;if(!Number.isSafeInteger(maxPages)||maxPages<1||maxPages>500||!Number.isSafeInteger(maxItems)||maxItems<1||maxItems>1e4)sdkInputError();const seen=new Set;let next=input.next,count=0;if(next)seen.add(next);for(let pageNumber=0;pageNumber<maxPages;pageNumber++){const page2=await client.call(key10,{...input,...next===void 0?{}:{next}},options);count+=page2.items.length;if(count>maxItems)throw new NativeStudioSdkError("OBSERVATION_LIMIT","WAITING_INPUT","NO_WRITE");if(page2.page.hasMore&&(!page2.page.next||seen.has(page2.page.next)))throw new NativeStudioSdkError("CONTINUATION_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE");yield page2;if(!page2.page.hasMore)return;next=page2.page.next;seen.add(next)}throw new NativeStudioSdkError("OBSERVATION_LIMIT","WAITING_INPUT","NO_WRITE")}async function waitForOperation(client,input,options={}){const maxPolls=options.maxPolls??60,timeoutMs=options.timeoutMs??9e4,intervalMs=options.intervalMs??1e3;if(!Number.isSafeInteger(maxPolls)||maxPolls<1||maxPolls>1e3||!Number.isSafeInteger(timeoutMs)||timeoutMs<1||timeoutMs>18e5||!Number.isSafeInteger(intervalMs)||intervalMs<10||intervalMs>1e4)sdkInputError();const deadline=AbortSignal.timeout(timeoutMs),signal=options.signal?AbortSignal.any([options.signal,deadline]):deadline;try{for(let poll=0;poll<maxPolls;poll++){const result=await client.call("operation.get",input,{signal});if(!["ACCEPTED","WAITING_PROVIDER","RETRYING"].includes(result.semanticStatus))return result;if(poll<maxPolls-1)await delay(intervalMs,void 0,{signal})}}catch(error){if(!deadline.aborted||options.signal?.aborted)throw error}throw new NativeStudioSdkError("OBSERVATION_LIMIT","WAITING_INPUT","NO_WRITE")}export{NavigationGroupIdSchema,NavigationGroups,navigationGroup,NavigationProfile,NavigationProfileKey,NavigationToolNames,CapabilityGroupsSchema,CapabilityDescribeSchema,DeviceRenderIntentSchema,PreparedDeviceRenderSchema,DeviceRenderAdmissionSchema,NativeStudioDeviceRenders,NativeStudioNavigationFacade,sdkOperations,NativeStudioAgentClient,sdkImageMediaTools,sdkMcpTools,NativeStudioMcpClient,NativeStudioNavigationClient,NativeStudioRuntimeAuthorityClient,queryPages,waitForOperation};
|