@nativestudio/sdk 0.0.0-stage → 0.3.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPATIBILITY.json +14 -0
- package/LICENSE +201 -0
- package/dist/BUNDLED_DEPENDENCIES.json +1 -0
- package/dist/_chunks/chunk-34GRMUSM.js +1 -0
- package/dist/_chunks/chunk-3SWFHYZF.js +1 -0
- package/dist/_chunks/chunk-CJEQNH37.js +1 -0
- package/dist/_chunks/chunk-DIPWMH32.js +1 -0
- package/dist/_chunks/chunk-HTUTYIRU.js +1 -0
- package/dist/_chunks/chunk-RK3YLCZP.js +1 -0
- package/dist/_chunks/chunk-VPYAXWXY.js +1 -0
- package/dist/_types/contracts/accepted-shot.d.ts +27 -0
- package/dist/_types/contracts/accepted-visual-source.d.ts +120 -0
- package/dist/_types/contracts/agent-execution-lifecycle.d.ts +749 -0
- package/dist/_types/contracts/agent-execution-oauth.d.ts +71 -0
- package/dist/_types/contracts/agent-execution-registration.d.ts +240 -0
- package/dist/_types/contracts/agent-execution-selection.d.ts +107 -0
- package/dist/_types/contracts/agent-host-execution.d.ts +706 -0
- package/dist/_types/contracts/agent-host-generic-transport.d.ts +12 -0
- package/dist/_types/contracts/agent-host.d.ts +226 -0
- package/dist/_types/contracts/artifact-discovery.d.ts +242 -0
- package/dist/_types/contracts/artifact.d.ts +188 -0
- package/dist/_types/contracts/audio.d.ts +335 -0
- package/dist/_types/contracts/brief.d.ts +178 -0
- package/dist/_types/contracts/caption-render.d.ts +20 -0
- package/dist/_types/contracts/caption-transcript.d.ts +102 -0
- package/dist/_types/contracts/captions.d.ts +420 -0
- package/dist/_types/contracts/clip-framing.d.ts +14 -0
- package/dist/_types/contracts/clip-transition.d.ts +6 -0
- package/dist/_types/contracts/composition-authoring-guide.d.ts +160 -0
- package/dist/_types/contracts/composition-authoring.d.ts +744 -0
- package/dist/_types/contracts/composition-finding-locality.d.ts +24 -0
- package/dist/_types/contracts/composition-frame-render.d.ts +226 -0
- package/dist/_types/contracts/composition-making.d.ts +390 -0
- package/dist/_types/contracts/composition-observation.d.ts +239 -0
- package/dist/_types/contracts/composition-render-base.d.ts +293 -0
- package/dist/_types/contracts/composition-render-observation.d.ts +278 -0
- package/dist/_types/contracts/composition-render.d.ts +406 -0
- package/dist/_types/contracts/composition-repair.d.ts +451 -0
- package/dist/_types/contracts/composition-source-review.d.ts +1042 -0
- package/dist/_types/contracts/consistency-profile.d.ts +845 -0
- package/dist/_types/contracts/continuity-evaluation.d.ts +48 -0
- package/dist/_types/contracts/delivery-completion.d.ts +210 -0
- package/dist/_types/contracts/delivery-manifest.d.ts +72 -0
- package/dist/_types/contracts/delivery-operations.d.ts +1151 -0
- package/dist/_types/contracts/delivery-output-profile.d.ts +12 -0
- package/dist/_types/contracts/delivery-summary.d.ts +220 -0
- package/dist/_types/contracts/delivery-validation.d.ts +206 -0
- package/dist/_types/contracts/device-render.d.ts +77 -0
- package/dist/_types/contracts/director-proposal.d.ts +1067 -0
- package/dist/_types/contracts/editor-intelligence.d.ts +3374 -0
- package/dist/_types/contracts/exploration-recommendation.d.ts +519 -0
- package/dist/_types/contracts/external-agent-access.d.ts +93 -0
- package/dist/_types/contracts/final-ready.d.ts +301 -0
- package/dist/_types/contracts/final-render-profile.d.ts +59 -0
- package/dist/_types/contracts/final-render.d.ts +2810 -0
- package/dist/_types/contracts/foundation.d.ts +1 -0
- package/dist/_types/contracts/generation-contract.d.ts +268 -0
- package/dist/_types/contracts/generation-cost.d.ts +70 -0
- package/dist/_types/contracts/health.d.ts +6 -0
- package/dist/_types/contracts/human-identity.d.ts +162 -0
- package/dist/_types/contracts/hyperframe-profile.d.ts +5 -0
- package/dist/_types/contracts/ids.d.ts +41 -0
- package/dist/_types/contracts/index.d.ts +126 -0
- package/dist/_types/contracts/interface/common.d.ts +56 -0
- package/dist/_types/contracts/interface/execution-output.d.ts +99 -0
- package/dist/_types/contracts/interface/index.d.ts +7 -0
- package/dist/_types/contracts/interface/media-output.d.ts +90 -0
- package/dist/_types/contracts/interface/operation.d.ts +61 -0
- package/dist/_types/contracts/interface/output.d.ts +15 -0
- package/dist/_types/contracts/interface/production-snapshot.d.ts +654 -0
- package/dist/_types/contracts/interface/query.d.ts +315 -0
- package/dist/_types/contracts/keyframe-generation.d.ts +378 -0
- package/dist/_types/contracts/keyframe-reference.d.ts +31 -0
- package/dist/_types/contracts/keyframe-review.d.ts +753 -0
- package/dist/_types/contracts/lifecycle-event-projections.d.ts +191 -0
- package/dist/_types/contracts/lifecycle-events.d.ts +156 -0
- package/dist/_types/contracts/listening-evidence.d.ts +37 -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 +992 -0
- package/dist/_types/contracts/local-execution/canonical.d.ts +2 -0
- package/dist/_types/contracts/local-execution/common.d.ts +49 -0
- package/dist/_types/contracts/local-execution/completion.d.ts +124 -0
- package/dist/_types/contracts/local-execution/components.d.ts +45 -0
- package/dist/_types/contracts/local-execution/descriptor.d.ts +38 -0
- package/dist/_types/contracts/local-execution/device-authority.d.ts +31 -0
- package/dist/_types/contracts/local-execution/device-inventory.d.ts +76 -0
- package/dist/_types/contracts/local-execution/device-workspace.d.ts +11 -0
- package/dist/_types/contracts/local-execution/device.d.ts +102 -0
- package/dist/_types/contracts/local-execution/external-generation.d.ts +199 -0
- package/dist/_types/contracts/local-execution/index.d.ts +37 -0
- package/dist/_types/contracts/local-execution/ipc.d.ts +3730 -0
- package/dist/_types/contracts/local-execution/library-command.d.ts +620 -0
- package/dist/_types/contracts/local-execution/library-result.d.ts +408 -0
- package/dist/_types/contracts/local-execution/library.d.ts +873 -0
- package/dist/_types/contracts/local-execution/lifecycle.d.ts +519 -0
- package/dist/_types/contracts/local-execution/local-navigation.d.ts +929 -0
- package/dist/_types/contracts/local-execution/management.d.ts +400 -0
- package/dist/_types/contracts/local-execution/media-recipe.d.ts +207 -0
- package/dist/_types/contracts/local-execution/media-validation-request.d.ts +232 -0
- package/dist/_types/contracts/local-execution/media-validation.d.ts +262 -0
- package/dist/_types/contracts/local-execution/object-transfer.d.ts +155 -0
- package/dist/_types/contracts/local-execution/offline.d.ts +59 -0
- package/dist/_types/contracts/local-execution/preview.d.ts +243 -0
- package/dist/_types/contracts/local-execution/processor-capability.d.ts +39 -0
- package/dist/_types/contracts/local-execution/processor-direct.d.ts +290 -0
- package/dist/_types/contracts/local-execution/processor-recipes.d.ts +1122 -0
- package/dist/_types/contracts/local-execution/processor.d.ts +6173 -0
- package/dist/_types/contracts/local-execution/project-source-direct.d.ts +201 -0
- package/dist/_types/contracts/local-execution/qwen-tts.d.ts +31 -0
- package/dist/_types/contracts/local-execution/recognition.d.ts +170 -0
- package/dist/_types/contracts/local-execution/speech.d.ts +95 -0
- package/dist/_types/contracts/local-execution/tool-selection.d.ts +55 -0
- package/dist/_types/contracts/local-execution/whisper.d.ts +24 -0
- package/dist/_types/contracts/local-execution/work.d.ts +149 -0
- package/dist/_types/contracts/local-execution/workspace.d.ts +141 -0
- package/dist/_types/contracts/matrix-parameter-rule.d.ts +23 -0
- package/dist/_types/contracts/media-category.d.ts +11 -0
- package/dist/_types/contracts/media-export.d.ts +23 -0
- package/dist/_types/contracts/media-observation.d.ts +2080 -0
- package/dist/_types/contracts/model-capability-matrix.d.ts +118 -0
- package/dist/_types/contracts/native-tool-authority-failure.d.ts +38 -0
- package/dist/_types/contracts/native-tool-authority.d.ts +110 -0
- package/dist/_types/contracts/native-tool-execution.d.ts +287 -0
- package/dist/_types/contracts/native-tool-gateway.d.ts +41 -0
- package/dist/_types/contracts/native-video-audio.d.ts +62 -0
- package/dist/_types/contracts/navigation-context.d.ts +253 -0
- package/dist/_types/contracts/navigation-groups.d.ts +51 -0
- package/dist/_types/contracts/navigation.d.ts +248 -0
- package/dist/_types/contracts/observation-profile.d.ts +99 -0
- package/dist/_types/contracts/planning-input.d.ts +177 -0
- package/dist/_types/contracts/principal.d.ts +26 -0
- package/dist/_types/contracts/production-creation.d.ts +66 -0
- package/dist/_types/contracts/production-termination.d.ts +51 -0
- package/dist/_types/contracts/production.d.ts +111 -0
- package/dist/_types/contracts/programmatic-composition.d.ts +762 -0
- package/dist/_types/contracts/programmatic-exploration.d.ts +1822 -0
- package/dist/_types/contracts/programmatic-video-review.d.ts +894 -0
- package/dist/_types/contracts/project-library.d.ts +173 -0
- package/dist/_types/contracts/project.d.ts +93 -0
- package/dist/_types/contracts/provider-catalog.d.ts +421 -0
- package/dist/_types/contracts/provider-models.d.ts +3388 -0
- package/dist/_types/contracts/provider.d.ts +207 -0
- package/dist/_types/contracts/reference-preview.d.ts +55 -0
- package/dist/_types/contracts/repair-lifecycle.d.ts +2564 -0
- package/dist/_types/contracts/repair-plan.d.ts +646 -0
- package/dist/_types/contracts/repair-strategy.d.ts +1432 -0
- package/dist/_types/contracts/review-intelligence-evidence.d.ts +136 -0
- package/dist/_types/contracts/review-intelligence-final-output.d.ts +883 -0
- package/dist/_types/contracts/review-intelligence.d.ts +573 -0
- package/dist/_types/contracts/review1-repair-source.d.ts +452 -0
- package/dist/_types/contracts/review1-repair-strategy.d.ts +491 -0
- package/dist/_types/contracts/review1-repair.d.ts +36 -0
- package/dist/_types/contracts/rough-cut-manifest.d.ts +352 -0
- package/dist/_types/contracts/rough-cut-profile.d.ts +46 -0
- package/dist/_types/contracts/rough-cut-review.d.ts +459 -0
- package/dist/_types/contracts/rough-cut.d.ts +1260 -0
- package/dist/_types/contracts/scene-shot-plan.d.ts +882 -0
- package/dist/_types/contracts/sdk-discovery.d.ts +66 -0
- package/dist/_types/contracts/shot-direction.d.ts +113 -0
- package/dist/_types/contracts/shot-preparation-basis.d.ts +356 -0
- package/dist/_types/contracts/shot-preparation.d.ts +2285 -0
- package/dist/_types/contracts/shot-sound-instruction.d.ts +58 -0
- package/dist/_types/contracts/sound-making-plan.d.ts +1586 -0
- package/dist/_types/contracts/source-sound-policy.d.ts +10 -0
- package/dist/_types/contracts/source-workspace.d.ts +62 -0
- package/dist/_types/contracts/speech-cost.d.ts +81 -0
- package/dist/_types/contracts/speech.d.ts +573 -0
- package/dist/_types/contracts/story.d.ts +98 -0
- package/dist/_types/contracts/temporal-evidence-operation.d.ts +380 -0
- package/dist/_types/contracts/temporal-evidence-reference.d.ts +18 -0
- package/dist/_types/contracts/temporal-evidence.d.ts +248 -0
- package/dist/_types/contracts/tenant.d.ts +7 -0
- package/dist/_types/contracts/timeline-audio.d.ts +98 -0
- package/dist/_types/contracts/timeline-graphics.d.ts +80 -0
- package/dist/_types/contracts/timeline-manifest.d.ts +704 -0
- package/dist/_types/contracts/timeline-source-sound.d.ts +353 -0
- package/dist/_types/contracts/timeline-v2.d.ts +1267 -0
- package/dist/_types/contracts/timeline-version-reader.d.ts +2955 -0
- package/dist/_types/contracts/timeline-visual-layers.d.ts +1249 -0
- package/dist/_types/contracts/timeline.d.ts +142 -0
- package/dist/_types/contracts/transcription.d.ts +80 -0
- package/dist/_types/contracts/video-generation.d.ts +676 -0
- package/dist/_types/contracts/video-review.d.ts +1871 -0
- package/dist/_types/contracts/visual-exploration.d.ts +1586 -0
- package/dist/_types/contracts/visual-layer-render.d.ts +2820 -0
- package/dist/_types/contracts/visual-layer.d.ts +112 -0
- package/dist/_types/contracts/visual-sequence.d.ts +143 -0
- package/dist/_types/contracts/workspace.d.ts +32 -0
- package/dist/_types/contracts/writer-proposal.d.ts +268 -0
- package/dist/_types/sdk/account.d.ts +109 -0
- package/dist/_types/sdk/auxiliary-media.d.ts +43 -0
- package/dist/_types/sdk/catalog/agent-host-execution.d.ts +1551 -0
- package/dist/_types/sdk/catalog/agent-host.d.ts +344 -0
- package/dist/_types/sdk/catalog/assembly.d.ts +32 -0
- package/dist/_types/sdk/catalog/audio-caption.d.ts +1382 -0
- package/dist/_types/sdk/catalog/canonical-repair.d.ts +4584 -0
- package/dist/_types/sdk/catalog/carriers.d.ts +31 -0
- package/dist/_types/sdk/catalog/composition-source.d.ts +1556 -0
- package/dist/_types/sdk/catalog/composition.d.ts +19 -0
- package/dist/_types/sdk/catalog/core.d.ts +3172 -0
- package/dist/_types/sdk/catalog/delivery.d.ts +14 -0
- package/dist/_types/sdk/catalog/device-library.d.ts +992 -0
- package/dist/_types/sdk/catalog/device-management.d.ts +462 -0
- package/dist/_types/sdk/catalog/discovery.d.ts +83 -0
- package/dist/_types/sdk/catalog/editor.d.ts +25 -0
- package/dist/_types/sdk/catalog/generation.d.ts +1218 -0
- package/dist/_types/sdk/catalog/imported-visual.d.ts +2541 -0
- package/dist/_types/sdk/catalog/keyframe-review.d.ts +859 -0
- package/dist/_types/sdk/catalog/lifecycle-events.d.ts +329 -0
- package/dist/_types/sdk/catalog/mcp.d.ts +269 -0
- package/dist/_types/sdk/catalog/media-descriptors.d.ts +264 -0
- package/dist/_types/sdk/catalog/media-observation.d.ts +1975 -0
- package/dist/_types/sdk/catalog/native-tool-authority.d.ts +281 -0
- package/dist/_types/sdk/catalog/navigation.d.ts +579 -0
- package/dist/_types/sdk/catalog/planning-intelligence.d.ts +2031 -0
- package/dist/_types/sdk/catalog/programmatic-exploration.d.ts +329 -0
- package/dist/_types/sdk/catalog/programmatic-review.d.ts +1106 -0
- package/dist/_types/sdk/catalog/provider.d.ts +4477 -0
- package/dist/_types/sdk/catalog/reference-preview.d.ts +180 -0
- package/dist/_types/sdk/catalog/repair-strategy.d.ts +182 -0
- package/dist/_types/sdk/catalog/reviewer.d.ts +278 -0
- package/dist/_types/sdk/catalog/shot-preparation.d.ts +53 -0
- package/dist/_types/sdk/catalog/sound-making-plan.d.ts +8 -0
- package/dist/_types/sdk/catalog/source-sync.d.ts +823 -0
- package/dist/_types/sdk/catalog/spec.d.ts +45 -0
- package/dist/_types/sdk/catalog/speech.d.ts +795 -0
- package/dist/_types/sdk/catalog/temporal-evidence.d.ts +393 -0
- package/dist/_types/sdk/catalog/video-review.d.ts +2149 -0
- package/dist/_types/sdk/catalog/visual-exploration.d.ts +10566 -0
- package/dist/_types/sdk/client.d.ts +96 -0
- package/dist/_types/sdk/desktop-catalogue.d.ts +25 -0
- package/dist/_types/sdk/desktop-previews.d.ts +118 -0
- package/dist/_types/sdk/desktop-releases.d.ts +75 -0
- package/dist/_types/sdk/device-renders.d.ts +3374 -0
- package/dist/_types/sdk/direct-source.d.ts +147 -0
- package/dist/_types/sdk/errors.d.ts +14 -0
- package/dist/_types/sdk/evidence-image.d.ts +22 -0
- package/dist/_types/sdk/image-media.d.ts +43 -0
- package/dist/_types/sdk/immutable-media.d.ts +24 -0
- package/dist/_types/sdk/index.d.ts +24 -0
- package/dist/_types/sdk/local-runtime/components.d.ts +2 -0
- package/dist/_types/sdk/local-runtime/device-client.d.ts +187 -0
- package/dist/_types/sdk/local-runtime/library.d.ts +268 -0
- package/dist/_types/sdk/local-runtime/workspace.d.ts +186 -0
- package/dist/_types/sdk/local-runtime-client.d.ts +2616 -0
- package/dist/_types/sdk/mcp-client.d.ts +57 -0
- package/dist/_types/sdk/mcp-image.d.ts +52 -0
- package/dist/_types/sdk/media.d.ts +104 -0
- package/dist/_types/sdk/navigation-client.d.ts +89 -0
- package/dist/_types/sdk/navigation-facade.d.ts +467 -0
- package/dist/_types/sdk/observe.d.ts +51 -0
- package/dist/_types/sdk/runtime-authority.d.ts +103 -0
- package/dist/_types/sdk/transport/http.d.ts +39 -0
- package/dist/account.d.ts +1 -0
- package/dist/account.js +1 -0
- package/dist/desktop-previews.d.ts +1 -0
- package/dist/desktop-previews.js +1 -0
- package/dist/desktop-releases.d.ts +1 -0
- package/dist/desktop-releases.js +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/local-runtime.d.ts +1 -0
- package/dist/local-runtime.js +1 -0
- package/dist/native/Bootstrap.ps1 +90 -0
- package/dist/native/JobNative.cs +137 -0
- package/dist/native/JobRunner.cs +381 -0
- package/dist/native/NativeMain.cs +161 -0
- package/dist/native/PipeBridge.cs +260 -0
- package/dist/native/PrivateAccess.cs +152 -0
- package/dist/runtime-authority.d.ts +1 -0
- package/dist/runtime-authority.js +1 -0
- package/package.json +44 -3
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AudioReceiptSchema,CaptionRenderStyleSchema,CompositionFrameTechnicalSchema,CompositionRenderManifestReaderSchema,CompositionRenderResourcesSchema,CompositionRenderTechnicalSchema,DeliveryPhysicalChecksSchema,DeliveryTargetSchema,DeviceRenderReceiptSchema,DeviceRenderTargetSchema,FinalRenderAdmissionSchema,FinalRenderManifestReaderSchema,FinalRenderStartSchema,FinalRenderTechnicalSchema,HYPERFRAME_CACHED_RENDER_PROFILE,ImportedSynchronousAudioExtractionSchema,ImportedSynchronousAudioSourceSchema,KeyframeObservationSchema,LegacyCaptionRenderStyleSchema,LocalDigestSchema,LocalIdSchema,LocalPackageVersionSchema,LocalPlacementPolicySchema,LocalProjectScopeSchema,LocalRevisionSchema,LocalTimeSchema,LocalWhisperIdentitySchema,LocalWhisperToolSelectionSchema,LocalWorkScopeSchema,MAX_SHOT_REVIEW_REQUIREMENTS,MacSpeechIdentitySchema,MediaCategorySchema,MediaObjectTicketSchema,MediaObjectVersionSchema,NativeRuntimePublicKeySchema,ObservationSourceSchema,ProgrammaticVideoReviewTargetSchema,QwenSpeechEvidenceSchema,QwenSpeechRecipeSchema,ReadyArtifactRegistrationSchema,RegisterVisualSequenceSchema,RegularCaptionRenderStyleSchema,ResolvedReferenceSchema,ReviewEvidenceMediaSchema,ReviewIntelligenceBasisSchema,ReviewIntelligenceContextResultSchema,RoughCutAdmissionSchema,RoughCutManifestReaderSchema,RoughCutRequirementSchema,RoughCutStartSchema,RoughCutTechnicalSchema,SourceInputMetadataSchema,SourceSyncAudioGetSchema,SourceSyncAudioReceiptSchema,SourceSyncAudioStartSchema,SourceSyncAudioVersionSchema,SpeechSynthesisEvidenceSchema,SpeechSynthesisRecipeSchema,TemporalEvidenceManifestSchema,TemporalSamplingPlanSchema,TenantProcessorKindSchema,TimelineScopeSchema,TranscriptSchema,ValidateReviewIntelligenceSchema,VideoObservationSchema,VideoReviewRecordSchema,VideoReviewRequirementSchema,VideoTechnicalMetadataSchema,VisualFrameSequenceSchema,VisualLayerCompositionSchema,VisualLayerPolicySchema,VisualRequirementSchema,VisualSequenceManifestSchema,processorFamilies}from"./chunk-DIPWMH32.js";import{OperationIdSchema,TenantIdSchema}from"./chunk-VPYAXWXY.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";import{z}from"zod";var LocalDevicePlatformSchema=z.strictObject({os:z.enum(["darwin","linux","win32"]),architecture:z.enum(["x64","arm64"])});var EnrollLocalDeviceSchema=z.strictObject({tenantId:LocalIdSchema,requestId:LocalIdSchema,label:z.string().trim().min(1).max(120),platform:LocalDevicePlatformSchema,runtimeVersion:LocalPackageVersionSchema,publicKey:NativeRuntimePublicKeySchema});var LocalDeviceViewSchema=EnrollLocalDeviceSchema.omit({requestId:true}).extend({deviceId:LocalIdSchema,revision:LocalRevisionSchema,enrolledByPrincipalId:LocalIdSchema,createdAt:LocalTimeSchema,verifiedAt:LocalTimeSchema.nullable(),revokedAt:LocalTimeSchema.nullable()}).refine(v=>[v.verifiedAt,v.revokedAt].every(time=>time===null||Date.parse(time)>=Date.parse(v.createdAt)));var LocalDeviceChallengeSchema=z.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z.string().min(1).max(2048),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema}).refine(v=>{const ttl=Date.parse(v.expiresAt)-Date.parse(v.issuedAt);return ttl>0&&ttl<=3e5});var LocalDeviceProofClaimsSchema=z.strictObject({protocol:z.literal("NVS_LOCAL_DEVICE_PROOF_V1"),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z.string().min(1).max(2048),jti:LocalIdSchema,iat:z.int().nonnegative(),exp:z.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var ProveLocalDeviceSchema=z.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,assertion:z.string().max(4096).regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var RevokeLocalDeviceSchema=z.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,requestId:LocalIdSchema,expectedRevision:LocalRevisionSchema});import{z as z2}from"zod";var WorkspaceDeviceListInputSchema=z2.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema.optional(),after:LocalIdSchema.optional(),limit:z2.int().min(1).max(50).default(25)});var WorkspaceDeviceInventoryItemSchema=z2.strictObject({deviceId:LocalIdSchema,label:z2.string().trim().min(1).max(120),platform:LocalDevicePlatformSchema,runtimeVersion:LocalPackageVersionSchema.nullable(),runtimeVersionObservedAt:LocalTimeSchema.nullable(),revision:LocalRevisionSchema,createdAt:LocalTimeSchema,verifiedAt:LocalTimeSchema.nullable(),revokedAt:LocalTimeSchema.nullable(),lastSeenAt:LocalTimeSchema.nullable(),connection:z2.enum(["UNVERIFIED","REVOKED","OWNER_UNAVAILABLE","CONNECTED","DISCONNECTED"])}).refine(value=>value.runtimeVersion===null===(value.runtimeVersionObservedAt===null),{message:"Runtime version and observation time must be present together"});var WorkspaceDeviceListSchema=z2.strictObject({tenantId:LocalIdSchema,observedAt:LocalTimeSchema,items:z2.array(WorkspaceDeviceInventoryItemSchema).max(50),nextCursor:LocalIdSchema.nullable()});import{z as z3}from"zod";var LocalOfflineSnapshotSchema=z3.strictObject({projectId:z3.uuid(),title:z3.string().min(1).max(200),savedAt:LocalTimeSchema,expiresAt:LocalTimeSchema,productions:z3.array(z3.strictObject({id:z3.uuid(),title:z3.string().max(200)})).max(40),possiblyTruncated:z3.boolean()}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=8192);var text=z3.string().max(4e3).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=8192);var LocalOfflineCallSchema=z3.discriminatedUnion("action",[z3.strictObject({action:z3.enum(["list","forget"]),key:LocalDigestSchema}),z3.strictObject({action:z3.literal("retain"),key:LocalDigestSchema,snapshot:LocalOfflineSnapshotSchema}),z3.strictObject({action:z3.literal("draft"),key:LocalDigestSchema,projectId:z3.uuid(),text,expectedRevision:z3.int().nonnegative()})]);var LocalOfflinePageSchema=z3.strictObject({historical:z3.literal(true),items:z3.array(z3.strictObject({snapshot:LocalOfflineSnapshotSchema,draft:z3.strictObject({text,revision:z3.int().nonnegative()})})).max(3)});import{z as z4}from"zod";var localLibraryProfile={protocol:"NVS_LOCAL_LIBRARY_V1",inspection:"LOCAL_FILE_DECODE_V1",publication:"COMMITTED_SOURCE_READBACK_V1"};var LocalLibraryContentTypeSchema=z4.enum(["video/mp4","image/png","image/jpeg","image/webp","audio/wav","text/plain","application/json","application/pdf","application/octet-stream"]);var LocalLibraryVersionSchema=z4.strictObject({fileId:LocalIdSchema,versionId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z4.int().nonnegative().max(128*1024*1024),contentType:LocalLibraryContentTypeSchema});var LocalLibraryReferenceSchema=LocalProjectScopeSchema.extend({deviceId:LocalIdSchema,...LocalLibraryVersionSchema.shape});var LocalLibraryMetadataSchema=z4.strictObject({label:z4.string().trim().min(1).max(255)});var LocalLibraryAccessCommandSchema=z4.strictObject({reference:LocalLibraryReferenceSchema,requestId:LocalIdSchema,expectedRevision:z4.int().nonnegative(),metadata:LocalLibraryMetadataSchema.nullable(),allowInspect:z4.boolean(),allowPublish:z4.boolean(),expiresAt:LocalTimeSchema});var LocalLibraryAccessReceiptSchema=LocalLibraryAccessCommandSchema.extend({revision:z4.int().positive(),recordedAt:LocalTimeSchema});var LocalLibraryAccessQuerySchema=z4.strictObject({reference:LocalLibraryReferenceSchema,requestId:LocalIdSchema});var LocalLibraryAccessCurrentSchema=z4.strictObject({reference:LocalLibraryReferenceSchema});var LocalLibraryAccessStateSchema=z4.strictObject({state:z4.enum(["LOCAL_ONLY","PENDING","SYNCED","UNKNOWN","REJECTED"]),desired:LocalLibraryAccessCommandSchema.nullable(),confirmed:LocalLibraryAccessReceiptSchema.nullable()});var LocalLibraryItemSchema=z4.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema,title:z4.string().trim().min(1).max(255),createdAt:LocalTimeSchema,revision:z4.int().positive(),access:LocalLibraryAccessStateSchema});var pageFields={after:LocalDigestSchema.nullable().default(null),limit:z4.int().min(1).max(16).default(16)};var LocalLibraryQuerySchema=LocalProjectScopeSchema.extend({projectId:LocalIdSchema.optional(),deviceId:LocalIdSchema,ownerKey:LocalDigestSchema.optional(),search:z4.string().trim().min(1).max(200).optional(),mediaCategory:MediaCategorySchema.optional(),...pageFields});var LocalLibraryPageSchema=z4.strictObject({items:z4.array(LocalLibraryItemSchema).max(16),nextCursor:LocalDigestSchema.nullable()});var LocalLibraryProjectionSchema=z4.strictObject({reference:LocalLibraryReferenceSchema,metadata:LocalLibraryMetadataSchema.nullable(),accessRevision:z4.int().positive(),allowInspect:z4.boolean(),allowPublish:z4.boolean(),expiresAt:LocalTimeSchema});var LocalLibraryProjectionPageSchema=z4.strictObject({items:z4.array(LocalLibraryProjectionSchema).max(16),nextCursor:LocalDigestSchema.nullable()});var LocalLibraryProjectionQuerySchema=LocalLibraryQuerySchema.omit({ownerKey:true}).extend({projectId:LocalIdSchema});var LocalLibraryImportSchema=z4.strictObject({requestId:LocalIdSchema,reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema,title:z4.string().trim().min(1).max(255)});var LocalLibraryImportReceiptQuerySchema=LocalProjectScopeSchema.extend({deviceId:LocalIdSchema,requestId:LocalIdSchema,ownerKey:LocalDigestSchema.optional()});var LocalLibraryReadSchema=z4.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema.optional(),offset:z4.int().nonnegative(),length:z4.int().min(1).max(128*1024)});var LocalLibraryReadReplySchema=z4.strictObject({reference:LocalLibraryReferenceSchema,offset:z4.int().nonnegative(),contentBase64:z4.string().max(174764).regex(/^[A-Za-z0-9+/]*={0,2}$/),complete:z4.boolean()});var LocalLibraryGetSchema=z4.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema.optional()});var LocalLibraryAccessInputSchema=z4.strictObject({command:LocalLibraryAccessCommandSchema,expectedLocalRevision:z4.int().positive(),ownerKey:LocalDigestSchema.optional()});var LocalLibraryCallSchema=z4.discriminatedUnion("action",[LocalLibraryQuerySchema.extend({action:z4.literal("list")}),LocalLibraryGetSchema.extend({action:z4.literal("get")}),LocalLibraryProjectionQuerySchema.extend({action:z4.literal("scoped-list")}),z4.strictObject({action:z4.literal("scoped-get"),reference:LocalLibraryReferenceSchema}),z4.strictObject({action:z4.literal("usage"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryReadSchema.extend({action:z4.literal("read")}),LocalLibraryAccessInputSchema.extend({action:z4.literal("access")}),LocalLibraryAccessQuerySchema.extend({action:z4.literal("sync"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryAccessQuerySchema.extend({action:z4.literal("resume-access"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryImportReceiptQuerySchema.extend({action:z4.literal("import-receipt")})]);var LocalLibraryCapabilitySchema=z4.strictObject({protocol:z4.literal("NVS_LOCAL_LIBRARY_V1"),available:z4.boolean(),profileDigest:LocalDigestSchema});var LocalLibraryUsageSchema=z4.strictObject({fileCount:z4.int().nonnegative(),totalBytes:z4.int().nonnegative(),quotaBytes:z4.int().positive(),availableDiskBytes:z4.int().nonnegative()});import{z as z5}from"zod";var QualifiedLocalAgentVersionSchema=z5.enum(["0.164.0","0.165.0"]);var LocalAgentGrantSchema=z5.strictObject({protocol:z5.literal("NVS_CODEX_REVIEW_GRANT_V1"),binary:z5.string().min(1).max(4096).refine(v=>/^(?:\/|[A-Za-z]:[\\/])/.test(v)),binaryDigest:z5.string().regex(/^[a-f0-9]{64}$/),version:QualifiedLocalAgentVersionSchema,model:z5.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/),reasoningEffort:z5.enum(["low","medium","high","xhigh"]).optional(),reviewerLabel:z5.string().trim().min(1).max(100),inference:z5.literal("REMOTE_OPENAI"),remoteUseApproved:z5.literal(true),imageDisclosureApproved:z5.literal(true).optional(),mediaDisclosureApproved:z5.literal(true).optional(),projects:z5.array(LocalProjectScopeSchema).min(1).max(100),expiresAt:z5.iso.datetime({offset:true})});import{z as z6}from"zod";var LocalAgentMediaInputSchema=z6.strictObject({profile:z6.literal("NVS_AGENT_DERIVED_EVIDENCE_V1"),contentType:z6.enum(["image/png","image/jpeg","image/webp","video/mp4"]),byteSize:z6.int().positive().max(134217728),width:z6.int().positive().max(4096),height:z6.int().positive().max(4096),durationMs:z6.int().positive().max(6e4).optional(),frameRate:z6.union([z6.literal(24),z6.literal(30)]).optional(),hasAudio:z6.boolean().optional()}).refine(v=>v.contentType==="video/mp4"?!!v.durationMs&&!!v.frameRate:!v.durationMs&&!v.frameRate&&v.hasAudio===void 0);var sha=z6.string().regex(/^[a-f0-9]{64}$/);var LocalAgentEvidenceReceiptSchema=z6.strictObject({protocol:z6.literal("NVS_AGENT_DERIVED_EVIDENCE_V1"),draftId:z6.uuid(),media:ReviewEvidenceMediaSchema,ffmpegDigest:sha,ffprobeDigest:sha,attachment:z6.strictObject({checksumSha256:sha,byteSize:z6.int().positive().max(8388608),width:z6.int().positive().max(4096),height:z6.int().positive().max(4096)}),timestampsMs:z6.array(z6.number().nonnegative().max(6e4)).max(6),audio:z6.strictObject({sampleRateHz:z6.literal(48e3),channels:z6.literal(1),samples:z6.int().positive().max(2881024),peak:z6.number().min(0).max(1),rms:z6.number().min(0).max(1),clippedSamples:z6.int().nonnegative().max(2881024)}).nullable(),limitations:z6.tuple([z6.literal("SAMPLED_FRAMES_ARE_NOT_FULL_PLAYBACK"),z6.literal("AUDIO_STATISTICS_ARE_NOT_LISTENING_OR_TRANSCRIPTION")])});var LocalAgentDiscoverySchema=z6.strictObject({candidate:z6.strictObject({binary:z6.string().min(1).max(4096),binaryDigest:sha,version:z6.string().regex(/^\d+\.\d+\.\d+$/),qualified:z6.boolean()}).nullable(),configured:LocalAgentGrantSchema.nullable()});import{z as z7}from"zod";var executable=z7.strictObject({path:z7.string().min(1).max(4096),digest:LocalDigestSchema});var mediaTools={ffmpeg:executable,ffprobe:executable};var LocalCompositionBrowserSelectionSchema=executable.extend({digest:z7.literal(HYPERFRAME_CACHED_RENDER_PROFILE.browserSha256)});var LocalInstalledToolSelectionSchema=z7.strictObject({mode:z7.literal("INSTALLED"),...mediaTools,compositionBrowser:LocalCompositionBrowserSelectionSchema.optional(),whisper:LocalWhisperToolSelectionSchema.optional()});var LocalToolSelectionSchema=z7.discriminatedUnion("mode",[z7.strictObject({mode:z7.literal("MANAGED"),...mediaTools}),LocalInstalledToolSelectionSchema]);import{z as z8}from"zod";var LocalRuntimeDescriptorSchema=z8.strictObject({protocol:z8.literal("NVS_RUNTIME_DESCRIPTOR_V1"),version:LocalPackageVersionSchema,node:z8.strictObject({major:z8.literal(24),minMinor:z8.literal(12)}),platform:LocalDevicePlatformSchema,ipcProtocol:z8.literal("NVS_LOCAL_IPC_V1"),workProtocol:z8.enum(["NVS_LOCAL_WORK_V1","NVS_LOCAL_WORK_V2"]),journalSchema:z8.literal(1),rendererDigest:LocalDigestSchema,profileDigest:LocalDigestSchema,compatibleRenderers:z8.array(z8.strictObject({rendererDigest:LocalDigestSchema,profileDigest:LocalDigestSchema})).max(4).optional()});var LocalReleaseAssetSchema=z8.strictObject({url:z8.string().url().max(2048),byteSize:z8.int().positive().max(256*1024*1024),sha512:z8.string().length(128).regex(/^[0-9a-f]{128}$/)});import{z as z9}from"zod";var RuntimeCaptionAssets={"NotoSansSC.ttf":LegacyCaptionRenderStyleSchema.shape.fontSha256.value,"NativeStudioSC-Regular.ttf":RegularCaptionRenderStyleSchema.shape.fontSha256.value,"OFL.txt":"092c580f54ee69841e94731e91f63f5d2d2a793550f4827cec485656e462f1bd"};var LocalComponentBytesSchema=z9.strictObject({byteSize:z9.int().positive().max(64*1024*1024),sha512:z9.string().length(128).regex(/^[0-9a-f]{128}$/)});var LocalRuntimeComponentSchema=LocalComponentBytesSchema.extend({protocol:z9.literal("NVS_PRODUCT_COMPONENT_V2"),version:LocalPackageVersionSchema,descriptor:LocalRuntimeDescriptorSchema.omit({platform:true}),resources:z9.strictObject({captions:LocalComponentBytesSchema})}).refine(v=>v.version===v.descriptor.version);import{z as z10}from"zod";var LocalSessionConnectorSchema=z10.strictObject({protocol:z10.literal("NVS_LOCAL_CONNECTOR_V1"),stateDirectory:z10.string().min(1).max(4096),credential:z10.string().length(43).regex(/^[A-Za-z0-9_-]{43}$/),expiresAt:LocalTimeSchema,tenantId:z10.uuid(),deviceId:z10.uuid()});var LocalManagementInventorySchema=z10.strictObject({runtimeRevision:z10.int().positive(),descriptor:LocalRuntimeDescriptorSchema,activeProcesses:z10.int().nonnegative(),pendingExecutions:z10.int().nonnegative(),pendingRequests:z10.int().nonnegative(),pendingRenderers:z10.array(LocalDigestSchema).max(64)});var LocalReleaseSchema=z10.strictObject({descriptor:LocalRuntimeDescriptorSchema,package:LocalReleaseAssetSchema,tools:z10.strictObject({ffmpeg:LocalReleaseAssetSchema.extend({sha256:LocalDigestSchema}),ffprobe:LocalReleaseAssetSchema.extend({sha256:LocalDigestSchema})}).nullable(),resources:z10.strictObject({captions:LocalReleaseAssetSchema.extend({byteSize:LocalComponentBytesSchema.shape.byteSize})}).optional()});var LocalBundledReleaseSchema=LocalReleaseSchema.extend({package:LocalComponentBytesSchema.extend({source:z10.literal("CLI")})});var LocalReleaseCatalogueSchema=z10.strictObject({protocol:z10.literal("NVS_LOCAL_RELEASE_CATALOGUE_V1"),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema,releases:z10.array(LocalReleaseSchema).min(1).max(32)}).refine(v=>Date.parse(v.expiresAt)>Date.parse(v.issuedAt)&&Date.parse(v.expiresAt)-Date.parse(v.issuedAt)<=7*864e5&&new Set(v.releases.map(r=>[r.descriptor.version,r.descriptor.platform.os,r.descriptor.platform.architecture].join(":"))).size===v.releases.length);var LocalSignedCatalogueSchema=z10.strictObject({catalogue:LocalReleaseCatalogueSchema,signature:z10.string().length(86).regex(/^[A-Za-z0-9_-]{85}[AQgw]$/)});var LocalToolChoiceSchema=z10.discriminatedUnion("mode",[z10.strictObject({mode:z10.literal("MANAGED")}),LocalInstalledToolSelectionSchema.extend({captionAssetsDirectory:z10.string().min(1).max(4096).optional()})]);var LocalUpdatePlanSchema=z10.strictObject({protocol:z10.literal("NVS_LOCAL_UPDATE_PLAN_V1"),planId:LocalIdSchema,installationRevision:z10.int().nonnegative(),runtimeRevision:z10.int().positive().nullable(),catalogueFingerprint:LocalDigestSchema.nullable(),trustFingerprint:LocalDigestSchema.optional(),release:z10.union([LocalReleaseSchema,LocalBundledReleaseSchema]),toolSelection:LocalToolChoiceSchema.optional(),fingerprint:LocalDigestSchema,createdAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var LocalClientNextActionSchema=z10.strictObject({surface:z10.enum(["CLI","LOCAL_IPC","REMOTE"]),operation:z10.enum(["runtime.status","local.configure","local.install","local.start","local.connect","local.grant","local.status","local.doctor","local.stop","local.update.check","local.update.prepare","local.update.apply","local.update.reconcile","execution.inspect","rough_cut_get","operation_get"]),availability:z10.enum(["AVAILABLE","BLOCKED"]),reason:z10.enum(["READY","INSTALL_REQUIRED","AUTHORIZATION_REQUIRED","VERSION_INCOMPATIBLE","UPDATE_AVAILABLE","RECOVERY_REQUIRED","USER_APPROVAL_REQUIRED","TRUST_REQUIRED","UNAVAILABLE"])});import{z as z11}from"zod";var LocalResourcePolicySchema=z11.strictObject({acceptNewWork:z11.boolean().default(true),mode:z11.enum(["CONTINUOUS","IDLE_ONLY"]).default("CONTINUOUS"),idleAfterSeconds:z11.int().min(30).max(3600).default(300),maxConcurrentJobs:z11.int().min(1).max(2).default(1),cpuCores:z11.union([z11.literal(1),z11.literal(2)]).default(2),memoryMiB:z11.int().min(512).max(4096).default(4096),cacheQuotaBytes:z11.int().min(512*1024*1024).max(32*1024*1024*1024).default(1024*1024*1024)});var LocalResourceSettingsSchema=z11.strictObject({revision:z11.int().nonnegative(),policy:LocalResourcePolicySchema});var LocalExecutionProgressSchema=z11.strictObject({stage:z11.enum(["WAITING","DOWNLOADING","EXECUTING","UPLOADING","AWAITING_ACCEPTANCE","COMPLETE","RECOVERY_REQUIRED","FENCED"]),downloadedBytes:z11.int().nonnegative(),sourceBytes:z11.int().nonnegative(),uploadedBytes:z11.int().nonnegative(),outputBytes:z11.int().nonnegative(),lastError:z11.strictObject({code:z11.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),observedAt:LocalTimeSchema}).nullable()});var LocalStorageInspectionSchema=z11.strictObject({cacheBytes:z11.int().nonnegative(),protectedBytes:z11.int().nonnegative(),reclaimableBytes:z11.int().nonnegative(),transferBytes:z11.int().nonnegative(),journalBytes:z11.int().nonnegative(),reviewBytes:z11.int().nonnegative().optional(),ownerStagingBytes:z11.int().nonnegative().optional(),availableDiskBytes:z11.int().nonnegative(),quotaBytes:z11.int().positive(),overQuota:z11.boolean()});var LocalWorkspaceInspectionSchema=z11.strictObject({settings:LocalResourceSettingsSchema,storage:LocalStorageInspectionSchema,scheduling:z11.strictObject({state:z11.enum(["READY","PAUSED","WAITING_FOR_IDLE","AT_CAPACITY","DRAINING"]),activeJobs:z11.int().nonnegative(),idleObservationCurrent:z11.boolean()})});var LocalDiagnosticsSchema=z11.strictObject({protocol:z11.literal("NVS_LOCAL_DIAGNOSTICS_V1"),createdAt:LocalTimeSchema,runtimeVersion:z11.string().min(1).max(80),runtimeRevision:LocalRevisionSchema,settings:LocalResourceSettingsSchema,storage:LocalStorageInspectionSchema,recordCounts:z11.record(z11.string().regex(/^[A-Z_]{1,40}$/),z11.int().nonnegative()),failures:z11.array(z11.strictObject({taskFingerprint:z11.string().regex(/^[a-f0-9]{64}$/),code:z11.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),observedAt:LocalTimeSchema})).max(32)});function canonicalLocalJson(value){if(value===null||typeof value==="string"||typeof value==="boolean")return JSON.stringify(value);if(typeof value==="number"&&Number.isFinite(value))return JSON.stringify(value);if(Array.isArray(value))return"["+value.map(canonicalLocalJson).join(",")+"]";if(typeof value==="object")return"{"+Object.entries(value).filter(([,v])=>v!==void 0).sort(([a],[b])=>a<b?-1:a>b?1:0).map(([k,v])=>JSON.stringify(k)+":"+canonicalLocalJson(v)).join(",")+"}";throw new Error("Fingerprint input must be finite JSON data")}import{z as z12}from"zod";var sha2=z12.string().regex(/^[a-f0-9]{64}$/);var qualifiedVersion=QualifiedLocalAgentVersionSchema;var LocalAgentSnapshotSchema=z12.strictObject({basis:ReviewIntelligenceBasisSchema,productionRevision:z12.int().positive(),reviewVersion:z12.int().nonnegative(),executionClass:z12.enum(["LIVE","TEST_ONLY"]),media:ReviewEvidenceMediaSchema,requirements:z12.array(z12.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema])).min(1).max(64),evidence:LocalAgentMediaInputSchema.optional(),image:z12.strictObject({contentType:z12.literal("image/png"),byteSize:z12.int().positive().max(8388608),width:z12.int().positive().max(4096),height:z12.int().positive().max(4096)}).optional()}).refine(v=>!v.image||!v.evidence&&v.basis.target.kind==="IMAGE").refine(v=>v.basis.target.kind==="IMAGE"||!v.evidence||v.evidence.contentType==="video/mp4").refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=32768).refine(v=>new Set(v.requirements.map(r=>r.key)).size===v.requirements.length);var LocalAgentProbeSchema=z12.strictObject({configured:z12.boolean(),available:z12.boolean(),reason:z12.enum(["GRANT_REQUIRED","READY","RUNTIME_UNAVAILABLE","GRANT_EXPIRED"]),grantFingerprint:sha2.nullable(),inference:z12.literal("REMOTE_OPENAI")});var LocalAgentPlanSchema=z12.strictObject({protocol:z12.enum(["NVS_LOCAL_AGENT_REVIEW_V1","NVS_LOCAL_AGENT_REVIEW_V2"]),id:z12.uuid(),grantFingerprint:sha2,snapshot:LocalAgentSnapshotSchema,expiresAt:z12.iso.datetime({offset:true}),fingerprint:sha2});var LocalAgentMetadataAnswerSchema=z12.strictObject({summary:z12.string().trim().min(1).max(1500),observations:z12.array(z12.strictObject({key:z12.string().min(1).max(220),observed:z12.string().trim().min(1).max(1e3)})).min(1).max(64)});var LocalAgentPixelAnswerSchema=z12.strictObject({summary:z12.string().trim().min(1).max(1500),imageReadback:z12.string().trim().min(1).max(800),observations:z12.array(KeyframeObservationSchema.omit({region:true}).extend({key:z12.string().min(1).max(220)})).min(1).max(64)});var LocalAgentAnswerSchema=z12.union([LocalAgentMetadataAnswerSchema,LocalAgentPixelAnswerSchema]).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=96*1024);var LocalAgentImageReceiptSchema=z12.strictObject({protocol:z12.literal("NVS_LOCAL_AGENT_IMAGE_V1"),draftId:z12.uuid(),media:ReviewEvidenceMediaSchema,byteSize:z12.int().positive().max(8388608),contentType:z12.literal("image/png"),width:z12.int().positive().max(4096),height:z12.int().positive().max(4096)});var LocalAgentReviewViewSchema=z12.strictObject({plan:LocalAgentPlanSchema,revision:z12.int().positive(),phase:z12.enum(["PREPARED","RUNNING","RESULT_PENDING","UNKNOWN"]),answer:LocalAgentAnswerSchema.nullable(),imageReceipt:LocalAgentImageReceiptSchema.optional(),evidenceReceipt:LocalAgentEvidenceReceiptSchema.optional(),provenance:z12.strictObject({adapter:z12.enum(["CODEX_METADATA_V1","CODEX_MEDIA_V2"]),binaryDigest:sha2,version:qualifiedVersion,model:z12.string().max(100),reasoningEffort:z12.enum(["low","medium","high","xhigh"]).optional(),reviewerLabel:z12.string().max(100),inference:z12.literal("REMOTE_OPENAI"),evidence:z12.enum(["METADATA_ONLY","IMAGE_PIXELS","VIDEO_FRAMES"])})}).refine(v=>{const image=v.plan.snapshot.image,receipt=v.imageReceipt;if(receipt&&(!image||receipt.draftId!==v.plan.id||canonicalLocalJson(receipt.media)!==canonicalLocalJson(v.plan.snapshot.media)||canonicalLocalJson({contentType:receipt.contentType,byteSize:receipt.byteSize,width:receipt.width,height:receipt.height})!==canonicalLocalJson(image)))return false;if(v.phase==="RESULT_PENDING"!==!!v.answer)return false;const derived=v.plan.snapshot.evidence,receipt2=v.evidenceReceipt;if(v.provenance.adapter!==(derived?"CODEX_MEDIA_V2":"CODEX_METADATA_V1"))return false;if(receipt2&&(!derived||receipt2.draftId!==v.plan.id||canonicalLocalJson(receipt2.media)!==canonicalLocalJson(v.plan.snapshot.media)))return false;if(v.answer&&!!(image||derived)!=="imageReadback"in v.answer)return false;const pixels=v.phase==="RESULT_PENDING"&&!!(image||derived);return v.provenance.evidence===(pixels?derived?.contentType==="video/mp4"?"VIDEO_FRAMES":"IMAGE_PIXELS":"METADATA_ONLY")&&(!pixels||(derived?!!receipt2:!!receipt))});function localAgentSnapshotFromContext(raw,includeImage=false){const c=ReviewIntelligenceContextResultSchema.parse(raw);if(c.reviewTarget.kind!=="IMAGE"||c.basis.target.kind!=="IMAGE"||c.ownerContext.semanticStatus!=="SUCCESS")throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");const t=c.reviewTarget.target,scope=c.basis.scope;if(!t.runtimeSucceeded||t.candidate.availability!=="AVAILABLE"||t.candidate.freshness!=="CURRENT_BASIS"||!t.productionRunnable||t.freshness!=="CURRENT_BASIS"||t.generationId!==c.basis.target.generationId||t.tenantId!==scope.tenantId||t.projectId!==scope.projectId||t.productionId!==scope.productionId||c.ownerContext.basis.tenantId!==scope.tenantId||c.ownerContext.basis.projectId!==scope.projectId||c.ownerContext.basis.productionId!==scope.productionId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");return LocalAgentSnapshotSchema.parse({basis:c.basis,productionRevision:c.ownerContext.basis.productionRevision,reviewVersion:t.reviewVersion,executionClass:t.executionClass,media:{artifactId:t.candidate.artifactId,representationId:t.candidate.representationId,checksumSha256:t.candidate.checksumSha256},requirements:t.requirements,...includeImage?{image:{contentType:t.candidate.contentType,byteSize:t.candidate.byteSize,width:t.candidate.width,height:t.candidate.height}}:{}})}function localAgentNativeProposal(raw){const v=LocalAgentReviewViewSchema.parse(raw);if(v.plan.snapshot.basis.target.kind!=="IMAGE"||v.plan.snapshot.evidence)throw Error("LOCAL_AGENT_MEDIA_PROPOSAL_REQUIRED");if(v.phase!=="RESULT_PENDING"||!v.answer)throw Error("LOCAL_AGENT_RESULT_UNAVAILABLE");const keys=new Set(v.answer.observations.map(o=>o.key));if(keys.size!==v.answer.observations.length||keys.size!==v.plan.snapshot.requirements.length||v.plan.snapshot.requirements.some(r=>!keys.has(r.key)))throw Error("LOCAL_AGENT_RESULT_UNAVAILABLE");const p=v.provenance;const pixels=p.evidence==="IMAGE_PIXELS";return ValidateReviewIntelligenceSchema.parse({basis:v.plan.snapshot.basis,proposal:{origin:{kind:"EXTERNAL_AGENT_HOST",label:p.reviewerLabel},summary:`${pixels?"IMAGE_PIXELS":"METADATA_ONLY; no visual inspection"}. Codex ${p.version}; model ${p.model}; effort ${p.reasoningEffort??"DEFAULT"}; binary ${p.binaryDigest}; draft ${v.plan.id}; plan ${v.plan.fingerprint}. ${v.answer.summary}`,evidence:pixels?[{id:"original_image",label:"Verified ORIGINAL PNG attachment",producer:"EXTERNAL_AGENT_HOST",kind:"IMAGE_PIXELS",media:v.plan.snapshot.media}]:[],review:{kind:"IMAGE",observations:v.answer.observations.map(o=>({...o,status:pixels&&"status"in o?o.status:"NOT_OBSERVABLE",confidence:pixels&&"confidence"in o?o.confidence:"UNCERTAIN",evidenceIds:pixels?["original_image"]:[]}))}}})}import{z as z16}from"zod";import{z as z15}from"zod";import{z as z13}from"zod";var pixel=z13.int().nonnegative().max(4096);var dimension=z13.int().positive().max(4096);var frame=z13.int().nonnegative().max(1800);var sample=z13.int().nonnegative().max(288e4);var rectangle=z13.strictObject({x:pixel,y:pixel,width:dimension,height:dimension});var window=z13.strictObject({start:sample,count:sample});var source=z13.strictObject({representationId:z13.uuid(),checksum:LocalDigestSchema,byteSize:z13.int().positive().max(134217728)});var LocalMediaRecipeSchema=z13.strictObject({protocol:z13.literal("NVS_RESOLVED_MEDIA_RECIPE_V2"),family:z13.enum(["ROUGH_CUT_RENDER","FINAL_RENDER"]),width:dimension,height:dimension,totalFrames:z13.int().min(900).max(1800),crf:z13.union([z13.literal(18),z13.literal(23)]),algorithm:z13.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),clips:z13.array(z13.strictObject({representationId:z13.uuid(),technical:VideoTechnicalMetadataSchema,sourceInMs:z13.int().nonnegative().max(6e4),sourceOutMs:z13.int().positive().max(6e4),startFrame:frame,frameCount:z13.int().positive().max(1800),overlapFrames:frame,crop:rectangle.nullable(),viewport:rectangle})).min(1).max(32),caption:z13.strictObject({style:CaptionRenderStyleSchema,references:z13.array(z13.strictObject({representationId:z13.uuid(),expectedUtf8:z13.string().max(65536)})).length(2),cues:z13.array(z13.strictObject({ordinal:z13.int().nonnegative().max(512),startFrame:frame,endFrame:frame,fontSize:z13.int().min(16).max(256),margin:pixel,text:z13.string().min(1).max(2e3)})).min(1).max(512)}).nullable(),audio:z13.strictObject({algorithm:z13.literal("PCM_WINDOW_MIX_AAC_V1"),tracks:z13.array(source.extend({channels:z13.union([z13.literal(1),z13.literal(2)]),sampleCount:z13.int().positive().max(288e4),sourceIn:sample,sourceOut:sample,start:sample,count:sample,gain:z13.int().nonnegative().max(1e3),duck:z13.int().nonnegative().max(1e3),duckWindows:z13.array(window).max(512)})).min(1).max(266)}).nullable(),graphics:z13.array(source.extend({contentType:z13.enum(["image/png","image/webp"]),sourceWidth:dimension,sourceHeight:dimension,width:dimension,height:dimension,x:pixel,y:pixel,startFrame:frame,endFrame:frame,opacity:z13.number().min(.1).max(1)})).max(8),visual:z13.strictObject({policy:VisualLayerPolicySchema.optional(),composition:VisualLayerCompositionSchema,plans:z13.array(z13.strictObject({id:z13.uuid(),startFrame:frame,endFrame:frame,width:dimension,height:dimension,x:pixel,y:pixel,opacityPermille:z13.int().min(0).max(1e3)})).max(8)}).nullable()}).superRefine((r,ctx)=>{if(r.width%2||r.height%2||r.clips.some(c=>c.viewport.x+c.viewport.width>r.width||c.viewport.y+c.viewport.height>r.height||c.sourceOutMs<=c.sourceInMs)||r.audio?.tracks.some(t=>t.sourceIn>=t.sourceOut||t.sourceOut>t.sampleCount||t.start+t.count>r.totalFrames*1600))ctx.addIssue({code:"custom",message:"Invalid bounded execution geometry or sample window"})});import{z as z14}from"zod";var identity={deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema};var WorkspaceDeviceAuthoritySchema=z14.strictObject({...identity,authority:z14.literal("WORKSPACE_DEVICE_V1")});var LocalDeviceExecutionTargetSchema=z14.discriminatedUnion("kind",[WorkspaceDeviceAuthoritySchema.extend({kind:z14.literal("DEVICE")}),z14.strictObject({kind:z14.literal("SERVER")})]);var TenantDeviceTargetSchema=WorkspaceDeviceAuthoritySchema.extend({keyFingerprint:LocalDigestSchema});function sameDeviceAuthority(a,b){return a.deviceId===b.deviceId&&a.deviceRevision===b.deviceRevision&&a.authority===b.authority}var previewProfile=z15.strictObject({kind:z15.literal("ROUGH_CUT_PREVIEW_V1"),profileId:z15.literal("PREVIEW_H264_480P_V1"),contractDigest:LocalDigestSchema});var studioProfile=z15.strictObject({kind:z15.literal("STUDIO_MEDIA_V2"),profileId:z15.literal("STUDIO_MEDIA_V2"),contractDigest:LocalDigestSchema});var LocalExecutionProfileSchema=z15.discriminatedUnion("kind",[previewProfile,studioProfile]);var LocalToolchainSchema=z15.strictObject({platform:LocalDevicePlatformSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema,ffmpeg:z15.strictObject({version:z15.string().min(1).max(160),binaryDigest:LocalDigestSchema}),ffprobe:z15.strictObject({version:z15.string().min(1).max(160),binaryDigest:LocalDigestSchema}),profile:LocalExecutionProfileSchema,supported:z15.array(z15.strictObject({profile:LocalExecutionProfileSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema})).max(4).optional()});var frozen=LocalWorkScopeSchema.extend({protocol:z15.literal("NVS_LOCAL_WORK_V1"),operationId:OperationIdSchema,renderId:LocalIdSchema,productionRevision:LocalRevisionSchema,executionClass:z15.enum(["LIVE","TEST_ONLY"]),policy:LocalPlacementPolicySchema,profile:previewProfile,manifest:RoughCutManifestReaderSchema,manifestFingerprint:LocalDigestSchema,sources:z15.array(z15.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z15.int().positive(),contentType:z15.string().min(1).max(100)})).min(1).max(512)});var studio=frozen.extend({protocol:z15.literal("NVS_LOCAL_WORK_V2"),profile:studioProfile,manifest:z15.union([RoughCutManifestReaderSchema,FinalRenderManifestReaderSchema]),recipe:LocalMediaRecipeSchema,recipeFingerprint:LocalDigestSchema});var LocalFrozenWorkSchema=z15.discriminatedUnion("protocol",[frozen,studio]).superRefine((v,ctx)=>{const t=v.manifest.timeline;if(t.tenantId!==v.tenantId||t.projectId!==v.projectId||t.productionId!==v.productionId||t.executionClass!==v.executionClass)ctx.addIssue({code:"custom",message:"Frozen manifest scope/class mismatch"});if(v.protocol==="NVS_LOCAL_WORK_V2"&&(v.manifest.schemaVersion===3!==!!v.recipe.visual||v.manifest.schemaVersion===3&&v.manifest.profile.visualLayerPolicy!==(v.recipe.visual?.policy??"STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1")))ctx.addIssue({code:"custom",message:"Recipe must preserve the frozen visual policy"});if(new Set(v.sources.map(s=>s.representationId)).size!==v.sources.length)ctx.addIssue({code:"custom",message:"Duplicate source representation"});if(v.protocol==="NVS_LOCAL_WORK_V2"&&(v.recipe.width!==v.manifest.profile.width||v.recipe.height!==v.manifest.profile.height||v.recipe.totalFrames!==v.manifest.totalFrames||v.recipe.family==="FINAL_RENDER"!=="selection"in v.manifest))ctx.addIssue({code:"custom",message:"Recipe must match its native render family and geometry"})});var LocalLeaseBindingSchema=LocalWorkScopeSchema.extend({attemptId:LocalIdSchema,assignmentRevision:LocalRevisionSchema,workerId:z15.string().min(1).max(200),workFingerprint:LocalDigestSchema,toolchainFingerprint:LocalDigestSchema});var target=LocalDeviceExecutionTargetSchema;var LocalExecutionLeaseSchema=LocalLeaseBindingSchema.extend({target,issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema}).refine(v=>Date.parse(v.expiresAt)>Date.parse(v.issuedAt));var LocalWorkAssignmentSchema=z15.strictObject({work:LocalFrozenWorkSchema,lease:LocalExecutionLeaseSchema,toolchain:LocalToolchainSchema,tenantMediaValidation:z15.literal(true).optional()}).superRefine(({work,lease,toolchain,tenantMediaValidation},ctx)=>{if(["tenantId","projectId","productionId","runtimeJobId"].some(k=>work[k]!==lease[k]))ctx.addIssue({code:"custom",message:"Assignment work scope mismatch"});if(tenantMediaValidation&&(work.protocol!=="NVS_LOCAL_WORK_V2"||work.policy.mode!=="local-only"))ctx.addIssue({code:"custom",message:"Invalid tenant validation assignment"});const p=work.policy,t=lease.target;if(p.mode==="cloud-only"&&t.kind!=="SERVER"||p.mode==="local-only"&&t.kind!=="DEVICE"||t.kind==="DEVICE"&&(p.mode==="cloud-only"||p.deviceId!==t.deviceId))ctx.addIssue({code:"custom",message:"Assignment contradicts placement policy"});if(work.profile.contractDigest!==toolchain.profile.contractDigest)ctx.addIssue({code:"custom",message:"Unqualified execution profile"})});var LocalExecutionListInputSchema=LocalProjectScopeSchema.extend({after:z16.string().length(64).regex(/^[0-9a-f]{64}$/).nullable().default(null),limit:z16.int().min(1).max(16).default(8),includeCompleted:z16.boolean().optional(),includeProgress:z16.boolean().optional()});var LocalExecutionInspectInputSchema=LocalWorkScopeSchema.extend({includeProgress:z16.boolean().optional()});var LocalIpcCallSchema=z16.discriminatedUnion("operation",[z16.strictObject({operation:z16.literal("library.capability")}),z16.strictObject({operation:z16.literal("library.call"),input:LocalLibraryCallSchema}),z16.strictObject({operation:z16.literal("agent.discover"),binary:z16.string().min(1).max(4096).optional()}),z16.strictObject({operation:z16.literal("offline.workspace"),input:LocalOfflineCallSchema}),z16.strictObject({operation:z16.literal("workspace.inspect")}),z16.strictObject({operation:z16.literal("workspace.configure"),policy:LocalResourcePolicySchema,expectedRevision:z16.int().nonnegative()}),z16.strictObject({operation:z16.literal("workspace.activity"),idleSeconds:z16.int().min(0).max(86400),observedAt:z16.iso.datetime()}),z16.strictObject({operation:z16.literal("storage.clean")}),z16.strictObject({operation:z16.literal("diagnostics.read")}),z16.strictObject({operation:z16.literal("agent.grant"),grant:LocalAgentGrantSchema,approval:z16.string().regex(/^[a-f0-9]{64}$/)}),z16.strictObject({operation:z16.literal("agent.probe")}),z16.strictObject({operation:z16.literal("agent.revoke"),approval:z16.string().regex(/^[a-f0-9]{64}$/)}),z16.strictObject({operation:z16.literal("agent.prepare"),snapshot:LocalAgentSnapshotSchema}),z16.strictObject({operation:z16.literal("agent.start"),id:z16.uuid(),expectedRevision:LocalRevisionSchema,approval:z16.string().regex(/^[a-f0-9]{64}$/)}),z16.strictObject({operation:z16.literal("agent.inspect"),id:z16.uuid()}),z16.strictObject({operation:z16.literal("runtime.status"),includeDevice:z16.literal(true).optional()}),z16.strictObject({operation:z16.literal("runtime.doctor")}),z16.strictObject({operation:z16.literal("runtime.inventory")}),z16.strictObject({operation:z16.literal("session.issue"),tenantId:z16.uuid(),deviceId:z16.uuid(),expiresAt:z16.iso.datetime({offset:true})}),z16.strictObject({operation:z16.literal("runtime.stop"),expectedRuntimeRevision:LocalRevisionSchema}),z16.strictObject({operation:z16.literal("execution.inspect"),input:LocalExecutionInspectInputSchema}),z16.strictObject({operation:z16.literal("execution.list"),input:LocalExecutionListInputSchema}),z16.strictObject({operation:z16.literal("update.check")}),z16.strictObject({operation:z16.literal("update.prepare"),targetVersion:LocalPackageVersionSchema,expectedRuntimeRevision:LocalRevisionSchema}),z16.strictObject({operation:z16.literal("update.apply"),planId:LocalIdSchema,targetVersion:LocalPackageVersionSchema,expectedRuntimeRevision:LocalRevisionSchema})]);var LocalNextActionSchema=z16.strictObject({call:LocalIpcCallSchema,availability:z16.enum(["AVAILABLE","BLOCKED"]),reason:z16.enum(["READY","INSTALL_REQUIRED","AUTHORIZATION_REQUIRED","VERSION_INCOMPATIBLE","UPDATE_AVAILABLE","RECOVERY_REQUIRED"])});var LocalIpcRequestSchema=z16.strictObject({protocol:z16.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema,call:LocalIpcCallSchema});var LocalVersionReportSchema=z16.strictObject({component:z16.enum(["CLI","SDK","MCP","RUNTIME","MEDIA_TOOLS"]),installedVersion:LocalPackageVersionSchema.nullable(),runningVersion:LocalPackageVersionSchema.nullable(),availableVersion:LocalPackageVersionSchema.nullable(),executablePath:z16.string().min(1).max(4096).nullable(),installOwner:z16.enum(["NPM_GLOBAL","PROJECT","NPX","MANAGED","TARBALL","UNKNOWN"])});var LocalRuntimeStatusSchema=z16.strictObject({protocol:z16.literal("NVS_LOCAL_IPC_V1"),runtimeRevision:LocalRevisionSchema,state:z16.enum(["IDLE","EXECUTING","DRAINING","RECOVERY_REQUIRED"]),journalSchemaVersion:z16.literal(1),workProtocols:z16.array(z16.enum(["NVS_LOCAL_WORK_V1","NVS_LOCAL_WORK_V2"])).min(1).max(2),versions:z16.array(LocalVersionReportSchema).max(8),deviceAuthority:z16.strictObject({tenantId:z16.uuid(),deviceId:z16.uuid(),origin:z16.url()}).optional(),deviceCapabilities:z16.strictObject({deviceRevision:LocalRevisionSchema,tenantMediaValidation:z16.boolean(),tenantMediaProcessing:z16.boolean(),processorCapabilities:z16.array(TenantProcessorKindSchema).max(TenantProcessorKindSchema.options.length)}).optional(),nextActions:z16.array(LocalNextActionSchema).max(8)});var LocalDoctorReportSchema=z16.strictObject({mode:z16.enum(["MANAGED","INSTALLED"]),availability:z16.enum(["AVAILABLE","UNAVAILABLE"]),reason:z16.enum(["QUALIFIED_PROCESS_TOOLS","MANAGED_TOOLS_MISSING","TOOL_QUALIFICATION_FAILED"]),nativeExecutionReady:z16.boolean(),executionProfiles:z16.array(z16.enum(["ROUGH_CUT_PREVIEW_V1","STUDIO_MEDIA_V2"])).max(2).optional(),tools:z16.array(z16.strictObject({name:z16.enum(["FFMPEG","FFPROBE"]),path:z16.string().min(1).max(4096),version:z16.string().min(1).max(200),digest:z16.string().regex(/^[0-9a-f]{64}$/)})).max(2)});var LocalExecutionInspectionSchema=z16.strictObject({binding:LocalLeaseBindingSchema,revision:LocalRevisionSchema,phase:z16.enum(["STAGED","RUNNING","RECOVERY_REQUIRED","OUTPUT_PENDING","RECEIPT_RECORDED","FENCED"]),checkpoint:z16.enum(["ADOPTED","SOURCES_READY","PROCESS_STARTED","OUTPUT_STAGED"]),progress:LocalExecutionProgressSchema.optional()});var LocalExecutionPageSchema=z16.strictObject({items:z16.array(LocalExecutionInspectionSchema).max(16),nextCursor:z16.string().length(64).regex(/^[0-9a-f]{64}$/).nullable()});var LocalIpcErrorCodeSchema=z16.enum(["FORBIDDEN","INVALID_INPUT","FRAME_LIMIT","BUSY","AUTHORIZATION_REQUIRED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","AGENT_APPROVAL_REQUIRED","AGENT_RUNTIME_UNAVAILABLE","AGENT_LOGIN_REQUIRED","AGENT_VERSION_UNQUALIFIED","AGENT_GRANT_REQUIRED","AGENT_OUTCOME_UNKNOWN","AGENT_IMAGE_REQUIRED","AGENT_IMAGE_INVALID","AGENT_IMAGE_BUDGET_EXCEEDED","AGENT_IMAGE_AUTHORIZATION_REQUIRED","CACHE_QUOTA_EXCEEDED","LIBRARY_NOT_FOUND","LIBRARY_CONFLICT","LIBRARY_BYTES_INVALID","LIBRARY_ACCESS_DENIED","LIBRARY_SYNC_REQUIRED","LIBRARY_SYNC_UNAVAILABLE","LIBRARY_QUOTA_EXCEEDED"]);var LocalIpcResponseSchema=z16.discriminatedUnion("semanticStatus",[z16.strictObject({protocol:z16.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema,semanticStatus:z16.literal("SUCCESS"),data:z16.union([LocalLibraryCapabilitySchema,LocalLibraryUsageSchema,LocalLibraryItemSchema,LocalLibraryPageSchema,LocalLibraryProjectionSchema,LocalLibraryProjectionPageSchema,LocalLibraryReadReplySchema,LocalWorkspaceInspectionSchema,LocalDiagnosticsSchema,LocalOfflinePageSchema,LocalRuntimeStatusSchema,LocalDoctorReportSchema,LocalExecutionInspectionSchema.nullable(),z16.strictObject({state:z16.literal("DRAINING"),inventory:LocalManagementInventorySchema.optional(),backupPath:z16.string().min(1).max(4096).optional()}),LocalSessionConnectorSchema,LocalManagementInventorySchema,LocalExecutionPageSchema,LocalAgentProbeSchema,LocalAgentDiscoverySchema,LocalAgentReviewViewSchema])}),z16.strictObject({protocol:z16.literal("NVS_LOCAL_IPC_V1"),requestId:LocalIdSchema.nullable(),semanticStatus:z16.enum(["BLOCKED","INVALID_INPUT"]),error:z16.strictObject({code:LocalIpcErrorCodeSchema})})]);import{z as z18}from"zod";import{z as z17}from"zod";var QwenDeviceCredentialScopeSchema=z17.strictObject({tenantId:LocalIdSchema,connectionId:LocalIdSchema,connectionVersion:z17.int().positive(),workspace:z17.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)});var QwenDeviceCredentialIdentitySchema=QwenDeviceCredentialScopeSchema.extend({proofSha256:LocalDigestSchema});var QwenDeviceCredentialSelectionSchema=QwenDeviceCredentialScopeSchema.extend({privateKeyFile:z17.string().min(1).max(4096)});var qwenSource=ResolvedReferenceSchema.pick({artifactId:true,representationId:true,checksumSha256:true,contentType:true,role:true}).extend({byteSize:MediaObjectVersionSchema.shape.byteSize.max(8*1024*1024)});var keyframeBytes=z17.strictObject({checksumSha256:LocalDigestSchema,byteSize:MediaObjectVersionSchema.shape.byteSize.max(8*1024*1024),width:z17.int().positive().max(4096),height:z17.int().positive().max(4096)});var externalKeyframe=z17.literal("KEYFRAME_GENERATE");var QwenKeyframeRecipeSchema=z17.strictObject({processor:externalKeyframe,generationId:LocalIdSchema,credential:QwenDeviceCredentialIdentitySchema,quoteFingerprint:LocalDigestSchema,prompt:z17.string().trim().min(1).refine(value=>new TextEncoder().encode(value).length<=1300),aspectRatio:z17.enum(["16:9","9:16"]),sources:z17.array(qwenSource).min(1).max(3)});var QwenKeyframeEvidenceSchema=z17.strictObject({processor:externalKeyframe,providerExecutionId:z17.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),providerResultId:LocalDigestSchema,image:keyframeBytes});var QwenVideoRecipeSchema=QwenKeyframeRecipeSchema.extend({processor:z17.literal("VIDEO_GENERATE"),prompt:z17.string().trim().min(1).max(2e4),mode:z17.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),durationSeconds:z17.int().min(2).max(30),sources:z17.array(qwenSource).min(1).max(10)});var QwenVideoTaskIdSchema=z17.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var QwenVideoEvidenceSchema=z17.strictObject({processor:z17.literal("VIDEO_GENERATE"),providerExecutionId:QwenVideoTaskIdSchema,providerResultId:QwenVideoTaskIdSchema,video:VideoTechnicalMetadataSchema.extend({videoCodec:z17.literal("h264"),frameRate:z17.literal(30),hasAudio:z17.literal(false),frameCount:z17.int().positive().max(902)}),poster:keyframeBytes});var ExternalGenerationReservationMarkerSchema=z17.strictObject({protocol:z17.literal("NVS_TENANT_EXTERNAL_GENERATION_V1"),tenantId:LocalIdSchema,projectId:LocalIdSchema,productionId:LocalIdSchema,runtimeJobId:LocalIdSchema,shotId:LocalIdSchema,preparationId:LocalIdSchema,contractId:LocalIdSchema,workload:z17.enum(["KEYFRAME_GENERATE","VIDEO_GENERATE"]),policyRevision:z17.int().positive(),contractFingerprint:LocalDigestSchema,originRequestFingerprint:LocalDigestSchema,bindingFingerprint:LocalDigestSchema,inputsFingerprint:LocalDigestSchema,quoteFingerprint:LocalDigestSchema});function checkProcessorDeclaration(enabled,kinds,context){if(enabled!==!!kinds?.length||kinds&&new Set(kinds).size!==kinds.length)context.addIssue({code:"custom",path:["processorCapabilities"],message:"Explicit unique processor capabilities must match processing enablement"})}var StartLocalPreviewSchema=RoughCutStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema,localProfile:z18.literal("STUDIO_MEDIA_V2").optional()});var LocalDeviceScopeSchema=z18.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema});var LocalDeviceSessionSchema=z18.strictObject({...LocalDeviceScopeSchema.shape,expiresAt:LocalTimeSchema,credential:z18.string().length(43).regex(/^[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var LocalDeviceHeartbeatSchema=LocalDeviceScopeSchema.extend({runtimeVersion:LocalPackageVersionSchema,toolchain:LocalToolchainSchema,available:z18.boolean(),maxConcurrentJobs:z18.int().min(1).max(2).optional(),validationProfileDigest:LocalDigestSchema.optional(),processorProfileDigest:LocalDigestSchema.optional(),localLibraryProfileDigest:LocalDigestSchema.optional(),macSpeechIdentity:MacSpeechIdentitySchema.optional(),whisperIdentity:LocalWhisperIdentitySchema.optional(),qwenIdentities:z18.array(QwenDeviceCredentialIdentitySchema).min(1).max(16).optional(),processorCapabilities:z18.array(TenantProcessorKindSchema).min(1).max(TenantProcessorKindSchema.options.length).optional()}).superRefine((value,context)=>checkProcessorDeclaration(!!value.processorProfileDigest,value.processorCapabilities,context));var ClaimLocalPreviewSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema,deviceId:LocalIdSchema,tenantMediaValidation:z18.literal(true).optional()});var LocalOutputStageSchema=LocalLeaseBindingSchema.extend({uploadRequestId:LocalIdSchema,role:z18.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z18.int().positive().max(128*1024*1024)});var LocalOutputTicketSchema=z18.strictObject({receiptId:LocalIdSchema,role:z18.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z18.int().positive(),uploaded:z18.boolean()});var LocalSourceRequestSchema=LocalLeaseBindingSchema.extend({representationId:LocalIdSchema});var LocalProofChallengeRequestSchema=LocalDeviceScopeSchema.extend({deviceRevision:z18.int().positive()});var LocalPreviewPlacementViewSchema=z18.strictObject({target:z18.enum(["DEVICE","SERVER"]),reason:z18.enum(["LOCAL_AVAILABLE","CLOUD_ONLY","OFFLINE","UNQUALIFIED","BUSY","LEASE_RECOVERY"]),policy:LocalPlacementPolicySchema});var LocalDeviceTransportConfigurationSchema=z18.strictObject({endpoint:z18.string().url().max(2048),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:z18.int().positive(),privateKeyFile:z18.string().min(1).max(4096),platform:LocalDevicePlatformSchema,tenantMediaValidation:z18.literal(true).optional(),tenantMediaProcessing:z18.literal(true).optional(),processorCapabilities:z18.array(TenantProcessorKindSchema).min(1).max(TenantProcessorKindSchema.options.length).optional(),compositionBrowser:z18.string().min(1).max(4096).optional(),macSpeechIdentity:MacSpeechIdentitySchema.optional(),whisperIdentity:LocalWhisperIdentitySchema.optional(),whisperTools:LocalWhisperToolSelectionSchema.optional(),qwenDeviceCredentials:z18.array(QwenDeviceCredentialSelectionSchema).max(16).optional(),qwenIdentities:LocalDeviceHeartbeatSchema.shape.qwenIdentities}).superRefine((value,context)=>checkProcessorDeclaration(value.tenantMediaProcessing===true,value.processorCapabilities,context));var LocalPreviewAdmissionSchema=RoughCutAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var StartLocalFinalRenderSchema=FinalRenderStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema});var LocalFinalRenderAdmissionSchema=FinalRenderAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var LocalClaimReceiptSchema=z18.strictObject({found:z18.boolean(),assignment:LocalWorkAssignmentSchema.nullable()});var LocalWorkStateSchema=z18.strictObject({binding:LocalLeaseBindingSchema,status:z18.enum(["ACTIVE","FENCED","OUTCOME_UNKNOWN"]),assignment:LocalWorkAssignmentSchema.nullable()});import{z as z19}from"zod";var LocalMcpToolNameSchema=z19.enum(["local_navigate","local_capability_describe","local_runtime_status","local_execution_list","local_execution_inspect","local_update_check","local_library_list","local_library_get"]);var LocalMcpActionSchema=z19.strictObject({tool:LocalMcpToolNameSchema,arguments:z19.record(z19.string(),z19.unknown()),availability:z19.enum(["AVAILABLE","BLOCKED"]).optional(),reason:z19.string().max(100).optional()});var LocalMcpNavigationSchema=z19.strictObject({location:z19.literal("LOCAL"),state:z19.enum(["UNAVAILABLE","IDLE","EXECUTING","DRAINING","RECOVERY_REQUIRED"]),deviceAuthority:LocalRuntimeStatusSchema.shape.deviceAuthority,groups:z19.array(z19.strictObject({id:z19.string().max(40),label:z19.string().max(100),tools:z19.array(LocalMcpToolNameSchema).max(6)})).max(4),nextActions:z19.array(z19.union([LocalMcpActionSchema,LocalClientNextActionSchema])).max(16)});var LocalMcpExecutionPageSchema=LocalExecutionPageSchema.extend({nextActions:z19.array(LocalMcpActionSchema).max(16)});var LocalMcpInspectionSchema=z19.strictObject({location:z19.literal("LOCAL"),execution:LocalExecutionInspectionSchema.nullable(),nextActions:z19.array(LocalMcpActionSchema).max(4)});var LocalMcpUpdateSchema=z19.strictObject({location:z19.literal("LOCAL"),running:z19.array(LocalVersionReportSchema).max(8),available:z19.array(LocalRuntimeDescriptorSchema).max(32),nextActions:z19.array(LocalClientNextActionSchema).max(4)});var LocalMcpDescriptionSchema=z19.strictObject({location:z19.literal("LOCAL"),tool:LocalMcpToolNameSchema,schema:z19.object({name:LocalMcpToolNameSchema,description:z19.string(),inputSchema:z19.record(z19.string(),z19.unknown())}).passthrough()});var LocalMcpFailureSchema=z19.strictObject({semanticStatus:z19.enum(["BLOCKED","INVALID_INPUT"]),error:z19.strictObject({code:z19.enum(["AUTHORIZATION_REQUIRED","FORBIDDEN","LOCAL_RUNTIME_UNAVAILABLE","RELEASE_UNAVAILABLE","VERSION_INCOMPATIBLE","INVALID_INPUT","LOCAL_CAPABILITY_UNAVAILABLE"]),outcome:z19.literal("NO_WRITE")}),nextActions:z19.array(LocalClientNextActionSchema).max(4)});var LocalMcpOutputSchemas={local_library_list:LocalLibraryProjectionPageSchema.extend({location:z19.literal("LOCAL")}),local_library_get:z19.strictObject({location:z19.literal("LOCAL"),item:LocalLibraryProjectionSchema.nullable()}),local_navigate:LocalMcpNavigationSchema,local_capability_describe:LocalMcpDescriptionSchema,local_runtime_status:LocalRuntimeStatusSchema.omit({nextActions:true}).extend({nextActions:z19.array(LocalMcpActionSchema).max(8)}),local_execution_list:LocalMcpExecutionPageSchema,local_execution_inspect:LocalMcpInspectionSchema,local_update_check:LocalMcpUpdateSchema};function localAgentMediaSnapshot(raw){const c=ReviewIntelligenceContextResultSchema.parse(raw),r=c.reviewTarget,t=r.target,scope=c.basis.scope;if(c.ownerContext.semanticStatus!=="SUCCESS"||!t.productionRunnable||t.freshness!=="CURRENT_BASIS"||t.tenantId!==scope.tenantId||t.projectId!==scope.projectId||t.productionId!==scope.productionId||c.ownerContext.basis.tenantId!==scope.tenantId||c.ownerContext.basis.projectId!==scope.projectId||c.ownerContext.basis.productionId!==scope.productionId||r.kind!==c.basis.target.kind)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");let media,descriptor;if(r.kind==="ROUGH_CUT"){if(!r.target.inspectable||c.basis.target.kind!=="ROUGH_CUT"||r.target.renderId!==c.basis.target.renderId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");media=r.target.basis;descriptor={...r.target.technical,contentType:"video/mp4"}}else if(r.kind==="PROGRAMMATIC"){if(!r.target.runtimeSucceeded||r.target.media.availability!=="AVAILABLE"||c.basis.target.kind!=="PROGRAMMATIC"||r.target.renderId!==c.basis.target.renderId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");media=r.target.media;descriptor=r.target.media}else{if(!r.target.runtimeSucceeded||r.target.candidate.availability!=="AVAILABLE"||r.target.candidate.freshness!=="CURRENT_BASIS"||!("generationId"in c.basis.target)||r.target.generationId!==c.basis.target.generationId)throw Error("LOCAL_AGENT_CONTEXT_UNAVAILABLE");media=r.target.candidate;descriptor=r.target.candidate}const video=descriptor.contentType==="video/mp4";return LocalAgentSnapshotSchema.parse({basis:c.basis,productionRevision:c.ownerContext.basis.productionRevision,reviewVersion:t.reviewVersion,executionClass:t.executionClass,media:{artifactId:media.artifactId,representationId:media.representationId,checksumSha256:media.checksumSha256},requirements:t.requirements,evidence:{profile:"NVS_AGENT_DERIVED_EVIDENCE_V1",contentType:descriptor.contentType,byteSize:descriptor.byteSize,width:descriptor.width,height:descriptor.height,...video&&"durationMs"in descriptor?{durationMs:descriptor.durationMs,frameRate:descriptor.frameRate,hasAudio:descriptor.hasAudio}:{}}})}function localAgentMediaProposal(raw){const v=LocalAgentReviewViewSchema.parse(raw),s=v.plan.snapshot;if(!s.evidence)return localAgentNativeProposal(v);if(v.phase!=="RESULT_PENDING"||!v.answer||!v.evidenceReceipt||s.basis.target.kind==="ROUGH_CUT")throw Error("LOCAL_AGENT_FULL_TEMPORAL_INSPECTION_REQUIRED");const video=s.evidence.contentType==="video/mp4",p=v.provenance,id3=video?"sampled_frames":"normalized_image";const observations=v.answer.observations.map(o=>{const requirement=s.requirements.find(r=>r.key===o.key);if(!requirement)throw Error("LOCAL_AGENT_RESULT_UNAVAILABLE");const sound="family"in requirement&&requirement.family==="SOUND"||/^(audio|sound):/.test(requirement.key);return{...o,status:video||!("status"in o)?"NOT_OBSERVABLE":o.status,confidence:video||!("confidence"in o)?"UNCERTAIN":o.confidence,observed:video?sound?"This draft has no listening evidence.":"Sampled frames are advisory. This draft has no playback coverage.":o.observed,evidenceIds:video&&sound?[]:[id3],..."interval"in requirement&&requirement.interval?{interval:requirement.interval}:{}}});return ValidateReviewIntelligenceSchema.parse({basis:s.basis,proposal:{origin:{kind:"EXTERNAL_AGENT_HOST",label:p.reviewerLabel},summary:`Advisory ${video?"sampled frame observations. Full playback, listening and transcription are unavailable":"normalized original image"}. ${p.inference} via ${p.adapter} using Codex ${p.version}, model ${p.model}, effort ${p.reasoningEffort??"DEFAULT"}, binary ${p.binaryDigest}. Source ${s.media.checksumSha256}, attachment ${v.evidenceReceipt.attachment.checksumSha256}, draft ${v.plan.id}, plan ${v.plan.fingerprint}. ${v.answer.summary}`,evidence:observations.some(o=>o.evidenceIds.length)?[{id:id3,label:video?"Ordered verified source frame samples":"Verified normalized source image",producer:"EXTERNAL_AGENT_HOST",media:s.media,...video?{kind:"VIDEO_FRAMES",timestampsMs:v.evidenceReceipt.timestampsMs}:{kind:"IMAGE_PIXELS"}}]:[],review:{kind:s.basis.target.kind,observations}}})}import{z as z20}from"zod";var LocalManagementCommandSchema=z20.discriminatedUnion("kind",[z20.strictObject({kind:z20.literal("ENROLL"),input:EnrollLocalDeviceSchema}),z20.strictObject({kind:z20.literal("REVOKE_DEVICE"),input:RevokeLocalDeviceSchema}),z20.strictObject({kind:z20.literal("PREVIEW"),input:StartLocalPreviewSchema}),z20.strictObject({kind:z20.literal("FINAL_RENDER"),input:StartLocalFinalRenderSchema})]);var LocalManagementResultSchema=z20.union([LocalDeviceViewSchema,LocalPreviewAdmissionSchema,LocalFinalRenderAdmissionSchema,z20.strictObject({semanticStatus:z20.literal("SUCCESS")})]);var LocalManagementReceiptSchema=z20.strictObject({fingerprint:z20.string().regex(/^[a-f0-9]{64}$/),result:LocalManagementResultSchema.nullable()});var localManagementRoutes={ENROLL:"devices/enroll",REVOKE_DEVICE:"devices/revoke",PREVIEW:"previews",FINAL_RENDER:"final-renders"};var LocalDeviceManagementCommandSchema=LocalManagementCommandSchema;var ScopedLocalManagementReceiptSchema=z20.strictObject({tenantId:LocalIdSchema,command:LocalDeviceManagementCommandSchema}).refine(value=>value.tenantId.toLowerCase()===value.command.input.tenantId.toLowerCase(),{message:"Management receipt must use the authorized tenant"});import{z as z21}from"zod";var TenantMediaComputeModeSchema=z21.enum(["STAGE_ONE","TENANT_TRUSTED_VALIDATOR"]);var tenantRenderValidationProfile={protocol:"NVS_TENANT_MEDIA_REPORT_V1",inspection:"STUDIO_DECODE_READBACK_V1"};var TenantMediaWorkSchema=LocalWorkScopeSchema.extend({protocol:z21.literal("NVS_TENANT_MEDIA_WORK_V1"),family:z21.enum(["ROUGH_CUT_RENDER","FINAL_RENDER"]),validationMode:z21.literal("TENANT_TRUSTED_VALIDATOR"),operationId:OperationIdSchema,originRequestFingerprint:LocalDigestSchema,basisFingerprint:LocalDigestSchema,policyRevision:LocalRevisionSchema,target:TenantDeviceTargetSchema,renderProfileDigest:LocalDigestSchema,validationProfileDigest:LocalDigestSchema,audioRequired:z21.boolean()});var renderChecks=["CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","POSTER_DECODE"];var renderCheck=z21.strictObject({key:z21.enum(renderChecks),result:z21.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"])});var TenantMediaValidationBodySchema=LocalLeaseBindingSchema.extend({schemaVersion:z21.literal(1),work:TenantMediaWorkSchema,originRequestFingerprint:LocalDigestSchema,requestId:LocalIdSchema,validationRequestId:LocalIdSchema,outputs:z21.array(MediaObjectVersionSchema).length(2),checks:z21.array(renderCheck).length(renderChecks.length),technical:RoughCutTechnicalSchema.nullable()}).superRefine((report,ctx)=>{const{work,outputs,checks}=report;if(work.tenantId!==report.tenantId||work.projectId!==report.projectId||work.productionId!==report.productionId||work.runtimeJobId!==report.runtimeJobId||work.originRequestFingerprint!==report.originRequestFingerprint)ctx.addIssue({code:"custom",path:["work"],message:"Work scope mismatch"});if(!outputs.some(output2=>output2.role==="VIDEO")||!outputs.some(output2=>output2.role==="POSTER")||new Set(outputs.map(output2=>output2.versionId)).size!==2||outputs.some(output2=>output2.tenantId!==report.tenantId||output2.projectId!==report.projectId))ctx.addIssue({code:"custom",path:["outputs"],message:"Exact video and poster versions required"});if(new Set(checks.map(check=>check.key)).size!==renderChecks.length||checks.some(check=>check.result==="NOT_APPLICABLE"!==(check.key==="AUDIO_DECODE"&&!work.audioRequired)))ctx.addIssue({code:"custom",path:["checks"],message:"Exact applicable checks required"});const video=outputs.find(output2=>output2.role==="VIDEO");if(checks.every(check=>check.result==="PASS"||check.result==="NOT_APPLICABLE")&&!report.technical||report.technical&&(report.technical.checksumSha256!==video?.checksumSha256||report.technical.byteSize!==video?.byteSize||report.technical.hasAudio!==work.audioRequired))ctx.addIssue({code:"custom",path:["technical"],message:"Exact inspected video required"})});var TenantMediaValidationReportSchema=TenantMediaValidationBodySchema.safeExtend({reportFingerprint:LocalDigestSchema,signature:z21.string().regex(/^[A-Za-z0-9_-]{86}$/)});import{z as z32}from"zod";import{z as z22}from"zod";var IMPORTED_VISUAL_PROFILE_ID="IMPORTED_H264_SDR_CFR30_VISUAL_V1";var IMPORTED_VISUAL_MAX_BYTES=128*1024*1024;var Hash=z22.string().regex(/^[0-9a-f]{64}$/);var PositiveInteger=z22.int().positive().max(1e9);var ImportedVisualRationalSchema=z22.strictObject({numerator:PositiveInteger,denominator:PositiveInteger});var geometry=limit=>z22.strictObject({width:z22.int().min(2).max(limit).multipleOf(2),height:z22.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=z22.strictObject({ffmpegVersion:z22.string().startsWith("ffmpeg version ").max(512),ffprobeVersion:z22.string().startsWith("ffprobe version ").max(512)});var ImportedVisualSourceInputSchema=z22.strictObject({contentType:z22.literal("video/mp4"),checksumSha256:Hash,byteSize:z22.int().min(32).max(IMPORTED_VISUAL_MAX_BYTES),executionClass:z22.enum(["LIVE","TEST_ONLY"])});var ImportedVisualSourceRangeSchema=z22.strictObject({clock:z22.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z22.int().min(0).max(1799),endFrame:z22.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=z22.strictObject({schemaVersion:z22.literal(1),profileId:z22.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceInputSchema,sourceRange:ImportedVisualSourceRangeSchema,output:geometry(1920),audioPolicy:z22.enum(["REQUIRE_NO_AUDIO","SILENT_DERIVATIVE"]),expectedToolchain:ImportedVisualToolchainSchema});var ImportedVisualSourceMetadataSchema=z22.strictObject({...ImportedVisualSourceInputSchema.shape,geometry:geometry(3840),videoCodec:z22.literal("h264"),pixelFormat:z22.literal("yuv420p"),sampleAspectRatio:z22.literal("1:1"),rotationDegrees:z22.literal(0),startPts:z22.literal(0),timeBase:ImportedVisualRationalSchema,frameRate:ImportedVisualRationalSchema,frameCount:z22.int().min(1).max(3600),durationTicks:z22.int().positive().max(6e10),availableCfr30Frames:z22.int().min(0).max(1800),color:z22.strictObject({range:z22.enum(["tv","unknown"]),space:z22.enum(["bt709","unknown"]),transfer:z22.enum(["bt709","unknown"]),primaries:z22.enum(["bt709","unknown"])}),audio:z22.strictObject({codec:z22.literal("aac"),sampleRateHz:z22.union([z22.literal(44100),z22.literal(48e3)]),channels:z22.union([z22.literal(1),z22.literal(2)]),startPts:z22.int(),timeBase:ImportedVisualRationalSchema,durationTicks:z22.int().positive().max(6e10)}).nullable(),fullDecode:z22.literal(true),cfrTimestampsVerified:z22.literal(true)}).superRefine((v,ctx)=>{if(![v.durationTicks,v.timeBase.numerator,v.timeBase.denominator,v.frameRate.numerator,v.frameRate.denominator,v.frameCount,v.availableCfr30Frames].every(Number.isSafeInteger)||v.timeBase.denominator<=0||v.frameRate.numerator<=0||v.frameRate.denominator<=0)return;const ticks=BigInt(v.durationTicks)*BigInt(v.timeBase.numerator);const base2=BigInt(v.timeBase.denominator);const declaredFrames=ticks*BigInt(v.frameRate.numerator);const expectedFrames=BigInt(v.frameCount)*base2*BigInt(v.frameRate.denominator);if(ticks>60n*base2||declaredFrames!==expectedFrames||BigInt(v.availableCfr30Frames)!==ticks*30n/base2||v.audio&&BigInt(v.audio.durationTicks)*BigInt(v.audio.timeBase.numerator)>60n*BigInt(v.audio.timeBase.denominator))ctx.addIssue({code:"custom",message:"Media clock/count/duration metadata is inconsistent"})});var ImportedVisualInspectionSchema=z22.strictObject({profileId:z22.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,evidenceScope:z22.literal("TECHNICAL_MEDIA_ONLY")});var ImportedVisualNormalizationReceiptSchema=z22.strictObject({schemaVersion:z22.literal(1),request:ImportedVisualNormalizationRequestSchema,original:ImportedVisualSourceMetadataSchema,output:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,frameMap:z22.array(z22.strictObject({outputFrame:z22.int().min(0).max(359),sourceFrame:z22.int().min(0).max(3599),sourcePts:z22.int().min(0).max(6e10)})).min(1).max(360),audioDisposition:z22.enum(["NO_AUDIO_PRESENT","REMOVED_FROM_DERIVATIVE_ONLY"]),evidenceScope:z22.literal("TECHNICAL_MEDIA_ONLY")}).superRefine((v,ctx)=>{const count=v.request.sourceRange.endFrame-v.request.sourceRange.startFrame;const source3=v.original;if(![source3.frameRate.numerator,source3.frameRate.denominator,source3.timeBase.numerator,source3.timeBase.denominator,v.request.sourceRange.startFrame].every(Number.isSafeInteger)||source3.frameRate.numerator<=0||source3.frameRate.denominator<=0)return;const rounded=i=>(2n*BigInt(i)*30n*BigInt(source3.frameRate.denominator)+BigInt(source3.frameRate.numerator))/(2n*BigInt(source3.frameRate.numerator));const exactFrameMap=v.frameMap.every((m,i)=>{if(!Number.isSafeInteger(m.sourcePts)||!Number.isSafeInteger(m.sourceFrame))return false;const absoluteFrame=BigInt(v.request.sourceRange.startFrame+i);return BigInt(m.sourcePts)*BigInt(source3.timeBase.numerator)*BigInt(source3.frameRate.numerator)===BigInt(m.sourceFrame)*BigInt(source3.timeBase.denominator)*BigInt(source3.frameRate.denominator)&&rounded(m.sourceFrame)<=absoluteFrame&&(m.sourceFrame+1===source3.frameCount||rounded(m.sourceFrame+1)>absoluteFrame)});if(!exactFrameMap||v.request.sourceRange.endFrame>source3.availableCfr30Frames||v.output.geometry.width>source3.geometry.width||v.output.geometry.height>source3.geometry.height||v.output.geometry.width*source3.geometry.height!==v.output.geometry.height*source3.geometry.width)ctx.addIssue({code:"custom",message:"Receipt frame mapping or geometry violates the pinned profile"});if(v.output.frameCount!==count||v.frameMap.length!==count||v.frameMap.some((m,i)=>m.outputFrame!==i||m.sourceFrame>=v.original.frameCount)||v.output.frameRate.numerator!==30||v.output.frameRate.denominator!==1||v.output.audio||v.original.checksumSha256!==v.request.source.checksumSha256||v.original.byteSize!==v.request.source.byteSize||v.original.executionClass!==v.request.source.executionClass||v.output.executionClass!==v.original.executionClass||v.output.geometry.width!==v.request.output.width||v.output.geometry.height!==v.request.output.height||v.toolchain.ffmpegVersion!==v.request.expectedToolchain.ffmpegVersion||v.toolchain.ffprobeVersion!==v.request.expectedToolchain.ffprobeVersion||v.audioDisposition!==(v.original.audio?"REMOVED_FROM_DERIVATIVE_ONLY":"NO_AUDIO_PRESENT")||v.original.audio&&v.request.audioPolicy!=="SILENT_DERIVATIVE"){ctx.addIssue({code:"custom",message:"Normalization receipt does not match its exact request/source/output"})}});import{z as z23}from"zod";var Uuid=z23.uuid();var Hash2=z23.string().regex(/^[0-9a-f]{64}$/);var ImportedVisualOriginalRegisterSchema=z23.strictObject({deviceId:z23.uuid().toLowerCase().optional(),projectSourceArtifactId:z23.uuid().optional(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,expectedProductionRevision:z23.int().nonnegative(),source:z23.strictObject({contentType:z23.literal("video/mp4"),checksumSha256:Hash2,byteSize:z23.int().min(32).max(128*1024*1024),executionClass:z23.enum(["LIVE","TEST_ONLY"])}),declaredProvenance:z23.strictObject({originalName:z23.string().trim().min(1).max(255).optional(),authorship:z23.string().trim().min(1).max(500).optional(),license:z23.string().trim().min(1).max(500).optional()}),idempotencyKey:z23.string().trim().min(1).max(200)});var ImportedVisualFromProjectSourceSchema=ImportedVisualOriginalRegisterSchema.omit({source:true,projectSourceArtifactId:true}).extend({projectSourceArtifactId:Uuid});var ImportedVisualOriginalReviseSchema=ImportedVisualOriginalRegisterSchema.extend({sourceId:Uuid,expectedVersion:z23.int().positive()});var ImportedVisualNormalizeStartSchema=z23.strictObject({deviceExecution:DeviceRenderTargetSchema.optional(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,expectedProductionRevision:z23.int().nonnegative(),request:ImportedVisualNormalizationRequestSchema,idempotencyKey:z23.string().trim().min(1).max(200)});var ImportedVisualGetSchema=z23.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid});var ImportedVisualReviewSchema=z23.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,representationId:Uuid,checksumSha256:Hash2,expectedReviewVersion:z23.int().nonnegative(),observations:z23.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z23.string().trim().min(1).max(2500),idempotencyKey:z23.string().trim().min(1).max(200)});var ImportedVisualDecisionSchema=z23.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,reviewId:Uuid,expectedAcceptanceVersion:z23.int().nonnegative(),action:z23.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z23.boolean().default(false),reason:z23.string().trim().min(1).max(2500),idempotencyKey:z23.string().trim().min(1).max(200)});var ImportedVisualOriginalViewSchema=z23.strictObject({sourceId:Uuid,versionId:Uuid,version:z23.int().positive(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,artifactId:Uuid,representationId:Uuid,metadata:ImportedVisualSourceMetadataSchema,declaredProvenance:ImportedVisualOriginalRegisterSchema.shape.declaredProvenance.optional(),executionClass:z23.enum(["LIVE","TEST_ONLY"]),current:z23.boolean(),createdAt:z23.iso.datetime({offset:true})});var ImportedVisualNormalizationViewSchema=z23.strictObject({normalizationId:Uuid,runtimeJobId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,lifecycle:z23.string(),cancellationRequested:z23.boolean(),receipt:ImportedVisualNormalizationReceiptSchema.nullable(),output:z23.strictObject({artifactId:Uuid,representationId:Uuid,posterArtifactId:Uuid,posterRepresentationId:Uuid}).nullable()});import{z as z24}from"zod";var id=z24.uuid().toLowerCase();var SourceSyncRuntimeStartSchema=SourceSyncAudioStartSchema.extend({deviceId:id.optional()});var SourceSyncRuntimePublicationSchema=SourceSyncRuntimeStartSchema.transform(({deviceId,...publication})=>{void deviceId;return publication});var SourceSyncRuntimeScopeSchema=z24.strictObject({tenantId:id,productionId:id,requestId:id});var SourceSyncRuntimeAdmissionSchema=z24.strictObject({requestId:id,runtimeJobId:id,productionRevision:z24.int().positive()});var SourceSyncRuntimeViewSchema=SourceSyncRuntimeAdmissionSchema.extend({normalizationId:id,lifecycle:z24.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),cancellationRequested:z24.boolean(),output:SourceSyncAudioReceiptSchema.nullable()});import{z as z25}from"zod";var id2=z25.uuid().toLowerCase();var hash=z25.string().regex(/^[0-9a-f]{64}$/);var SourceSyncMediaIdentitySchema=z25.strictObject({artifactId:id2,representationId:id2,checksumSha256:hash});var sampleRange=z25.strictObject({startSample:z25.int().nonnegative(),endSample:z25.int().positive()}).refine(v=>v.endSample>v.startSample);var frameRange=z25.strictObject({startFrame:z25.int().nonnegative(),endFrame:z25.int().positive()}).refine(v=>v.endFrame>v.startFrame);var SourceSyncListeningEvidenceSchema=z25.discriminatedUnion("kind",[z25.strictObject({id:z25.string().trim().min(1).max(100),kind:z25.literal("AUDIO_LISTENING"),media:SourceSyncMediaIdentitySchema,coverage:z25.array(sampleRange).min(1).max(64),producer:z25.string().trim().min(1).max(200)}),z25.strictObject({id:z25.string().trim().min(1).max(100),kind:z25.literal("VIDEO_PLAYBACK"),media:SourceSyncMediaIdentitySchema,coverage:z25.array(frameRange).min(1).max(64),producer:z25.string().trim().min(1).max(200)})]);var SourceSyncObservationSchema=z25.strictObject({key:z25.enum(["AUDIBILITY","AUDIO_VISUAL_ALIGNMENT"]),status:z25.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE"]),confidence:z25.enum(["CLEAR","UNCERTAIN"]),observed:z25.string().trim().min(1).max(2e3),evidenceIds:z25.array(z25.string().trim().min(1).max(100)).max(64)});var SourceSyncReviewTargetSchema=z25.strictObject({version:SourceSyncAudioVersionSchema,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,sampleCount:z25.int().positive(),frameCount:z25.int().positive().max(360),currentReviewVersion:z25.int().nonnegative(),declarationScope:z25.literal("ATTRIBUTED_OBSERVATIONS_NOT_LISTENING_ATTESTATION")});var SourceSyncReviewInputSchema=SourceSyncAudioGetSchema.extend({tenantId:id2,productionId:id2,shotId:id2,versionId:id2,expectedReviewVersion:z25.int().nonnegative(),audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z25.array(SourceSyncListeningEvidenceSchema).max(64),observations:z25.array(SourceSyncObservationSchema).length(2),summary:z25.string().trim().min(1).max(4e3),idempotencyKey:z25.string().trim().min(1).max(200)});var SourceSyncReviewRecordSchema=z25.strictObject({id:id2,versionId:id2,reviewVersion:z25.int().positive(),tenantId:id2,productionId:id2,shotId:id2,audio:SourceSyncMediaIdentitySchema,visual:SourceSyncMediaIdentitySchema,evidence:z25.array(SourceSyncListeningEvidenceSchema).max(64),observations:z25.array(SourceSyncObservationSchema).length(2),outcome:z25.enum(["PASS","FAIL","NEEDS_REVIEW"]),summary:z25.string(),createdByPrincipalId:id2,executionClass:z25.enum(["LIVE","TEST_ONLY"]),createdAt:z25.iso.datetime({offset:true})});var SourceSyncReviewGetSchema=SourceSyncAudioGetSchema.extend({tenantId:id2,productionId:id2,shotId:id2,versionId:id2,reviewId:id2});import{z as z26}from"zod";var ImportedVideoReviewRecordSchema=VideoReviewRecordSchema.omit({generationId:true,candidateId:true,preparationId:true,contractId:true,contractFingerprint:true}).extend({sourceKind:z26.literal("IMPORTED"),normalizationId:z26.uuid(),sourceId:z26.uuid(),sourceVersionId:z26.uuid(),planVersionId:z26.uuid(),shotPlanningRevision:z26.int().positive()});var ImportedVideoReviewReceiptSchema=z26.strictObject({semanticStatus:z26.literal("SUCCESS"),review:ImportedVideoReviewRecordSchema,productionRevision:z26.int().positive()});import{z as z27}from"zod";var ImportedVisualCancellationSchema=z27.strictObject({cancellationRequested:z27.boolean()});var ImportedVisualAdmissionSchema=z27.strictObject({semanticStatus:z27.literal("ACCEPTED"),normalizationId:z27.uuid(),runtimeJobId:z27.uuid(),sourceId:z27.uuid(),sourceVersionId:z27.uuid(),productionRevision:z27.int().positive(),deviceExecution:DeviceRenderReceiptSchema.optional()});var ImportedVisualReviewTargetSchema=ProgrammaticVideoReviewTargetSchema.omit({renderId:true,compositionId:true,compositionVersionId:true,compositionVersion:true,compositionFingerprint:true,renderManifestFingerprint:true}).extend({sourceKind:z27.literal("IMPORTED"),normalizationId:z27.uuid(),sourceId:z27.uuid(),sourceVersionId:z27.uuid(),latestReview:ImportedVideoReviewRecordSchema.nullable()});import{z as z28}from"zod";var ImportedVisualOriginalGetSchema=z28.strictObject({tenantId:z28.uuid(),productionId:z28.uuid(),sourceId:z28.uuid(),version:z28.int().positive().optional()});var ImportedVisualOriginalHistoryQuerySchema=z28.strictObject({tenantId:z28.uuid(),productionId:z28.uuid(),sourceId:z28.uuid(),beforeVersion:z28.int().positive().optional(),limit:z28.int().min(1).max(50).default(20)});var ImportedVisualOriginalHistorySchema=z28.strictObject({sourceId:z28.uuid(),items:z28.array(ImportedVisualOriginalViewSchema).max(50),nextBeforeVersion:z28.int().positive().nullable()});var ImportedVisualOriginalQuerySchema=z28.strictObject({tenantId:z28.uuid().toLowerCase(),productionId:z28.uuid().toLowerCase(),shotId:z28.uuid().toLowerCase().optional(),afterSourceId:z28.uuid().toLowerCase().optional(),limit:z28.int().min(1).max(50).default(20)});var ImportedVisualOriginalPageSchema=z28.strictObject({tenantId:z28.uuid(),productionId:z28.uuid(),items:z28.array(ImportedVisualOriginalViewSchema).max(50),nextAfterSourceId:z28.uuid().nullable()}).refine(p=>p.nextAfterSourceId===null||p.items.at(-1)?.sourceId===p.nextAfterSourceId);import{z as z29}from"zod";var Content=z29.string().min(44).max(178956972).refine(value=>{if(value.length%4||/[^A-Za-z0-9+/=]/.test(value))return false;const padding=value.endsWith("==")?2:value.endsWith("=")?1:0;return value.indexOf("=")===(padding?value.length-padding:-1)},"Invalid base64").refine(value=>{const alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return value.endsWith("==")?alphabet.indexOf(value.at(-3))%16===0:value.endsWith("=")?alphabet.indexOf(value.at(-2))%4===0:true},"Noncanonical base64");var ImportedVisualOriginalUploadSchema=ImportedVisualOriginalRegisterSchema.extend({contentBase64:Content});var ImportedVisualOriginalRevisionUploadSchema=ImportedVisualOriginalReviseSchema.extend({contentBase64:Content});var LegacyImportedVisualUploadSchema=ImportedVisualOriginalUploadSchema.omit({deviceId:true});var LegacyImportedVisualRevisionSchema=ImportedVisualOriginalRevisionUploadSchema.omit({deviceId:true});var LegacyImportedVisualProjectSourceSchema=ImportedVisualFromProjectSourceSchema.omit({deviceId:true});import{z as z30}from"zod";var DirectOriginalCommandSchema=z30.discriminatedUnion("operation",[z30.strictObject({operation:z30.literal("REGISTER"),input:ImportedVisualOriginalRegisterSchema}),z30.strictObject({operation:z30.literal("REVISE"),input:ImportedVisualOriginalReviseSchema})]);var DirectOriginalKeySchema=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({intakeId:LocalIdSchema});var DirectOriginalAdmissionSchema=z30.strictObject({state:z30.literal("SUBMITTED"),tenantId:z30.uuid(),projectId:z30.uuid(),productionId:z30.uuid(),intakeId:z30.uuid(),runtimeJobId:z30.uuid(),operationId:OperationIdSchema});var accepted=z30.strictObject({state:z30.literal("ACCEPTED"),original:ImportedVisualOriginalViewSchema});var DirectOriginalStageSchema=z30.discriminatedUnion("state",[accepted,DirectOriginalAdmissionSchema,DirectOriginalKeySchema.extend({state:z30.literal("UPLOAD"),ticket:MediaObjectTicketSchema,uploaded:z30.boolean()})]);var DirectOriginalSubmitSchema=z30.discriminatedUnion("state",[accepted,DirectOriginalAdmissionSchema]);import{z as z31}from"zod";var DirectProjectSourceCommandSchema=z31.strictObject({projectId:LocalIdSchema,metadata:SourceInputMetadataSchema.extend({tenantId:LocalIdSchema.pipe(TenantIdSchema),idempotencyKey:z31.string().trim().min(1).max(200)}),checksumSha256:LocalDigestSchema,byteSize:z31.int().positive().max(8*1024*1024),requestedDeviceId:LocalIdSchema.optional()}).refine(({metadata})=>metadata.kind==="REFERENCE_VIDEO"?metadata.contentType==="video/mp4":metadata.kind==="REFERENCE_IMAGE"&&["image/png","image/jpeg","image/webp"].includes(metadata.contentType));var DirectProjectSourceKeySchema=LocalProjectScopeSchema.extend({intakeId:LocalIdSchema});var DirectProjectSourceAdmissionSchema=DirectProjectSourceKeySchema.extend({state:z31.literal("SUBMITTED"),productionId:LocalIdSchema,runtimeJobId:LocalIdSchema,operationId:OperationIdSchema});var accepted2=z31.strictObject({state:z31.literal("ACCEPTED"),registration:ReadyArtifactRegistrationSchema});var DirectProjectSourceStageSchema=z31.discriminatedUnion("state",[accepted2,DirectProjectSourceAdmissionSchema,DirectProjectSourceKeySchema.extend({state:z31.literal("UPLOAD"),ticket:MediaObjectTicketSchema,uploaded:z31.boolean()})]);var DirectProjectSourceSubmitSchema=z31.discriminatedUnion("state",[accepted2,DirectProjectSourceAdmissionSchema]);var LocalLibraryDestinationSchema=z32.discriminatedUnion("kind",[z32.strictObject({kind:z32.literal("ORIGINAL"),command:DirectOriginalCommandSchema}),z32.strictObject({kind:z32.literal("PROJECT_SOURCE"),command:DirectProjectSourceCommandSchema})]);function localLibraryInspectable(reference){if(reference.contentType==="video/mp4")return reference.byteSize>=32;return["image/png","image/jpeg","image/webp"].includes(reference.contentType)&&reference.byteSize>0&&reference.byteSize<=8*1024*1024}var sameId=(left,right)=>left.toLowerCase()===right.toLowerCase();function destinationMatches(destination,reference){if(destination.kind==="ORIGINAL"){const{input}=destination.command;return sameId(input.tenantId,reference.tenantId)&&sameId(input.projectId,reference.projectId)&&(!input.deviceId||sameId(input.deviceId,reference.deviceId))&&input.source.contentType===reference.contentType&&input.source.byteSize===reference.byteSize&&input.source.checksumSha256===reference.checksumSha256}const{command:command2}=destination;return sameId(command2.metadata.tenantId,reference.tenantId)&&sameId(command2.projectId,reference.projectId)&&(!command2.requestedDeviceId||sameId(command2.requestedDeviceId,reference.deviceId))&&command2.metadata.contentType===reference.contentType&&command2.byteSize===reference.byteSize&&command2.checksumSha256===reference.checksumSha256}var command=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({requestId:LocalIdSchema,reference:LocalLibraryReferenceSchema,accessRevision:z32.int().positive()});var LocalLibraryCommandSchema=z32.discriminatedUnion("action",[command.extend({action:z32.literal("INSPECT")}),command.extend({action:z32.literal("PUBLISH"),destination:LocalLibraryDestinationSchema})]).superRefine((value,ctx)=>{if(value.reference.tenantId!==value.tenantId||value.reference.projectId!==value.projectId)ctx.addIssue({code:"custom",message:"Exact local file project required"});if(!localLibraryInspectable(value.reference))ctx.addIssue({code:"custom",message:"A qualified media file version is required"});if(value.action!=="PUBLISH")return;const d=value.destination;if(d.kind==="ORIGINAL"){const input=d.command.input;if(!sameId(input.tenantId,value.tenantId)||!sameId(input.projectId,value.projectId)||!sameId(input.productionId,value.productionId)||input.deviceId&&!sameId(input.deviceId,value.reference.deviceId)||input.source.byteSize!==value.reference.byteSize||input.source.checksumSha256!==value.reference.checksumSha256||input.source.contentType!==value.reference.contentType)ctx.addIssue({code:"custom",message:"Original must bind exact local file and native Production"})}else if(!sameId(d.command.metadata.tenantId,value.tenantId)||!sameId(d.command.projectId,value.projectId)||d.command.requestedDeviceId&&!sameId(d.command.requestedDeviceId,value.reference.deviceId)||d.command.byteSize!==value.reference.byteSize||d.command.checksumSha256!==value.reference.checksumSha256||d.command.metadata.contentType!==value.reference.contentType)ctx.addIssue({code:"custom",message:"Project SOURCE must bind exact local file"})});var LocalLibraryCommandQuerySchema=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({requestId:LocalIdSchema});var LocalLibraryAdmissionSchema=LocalWorkScopeSchema.extend({state:z32.literal("SUBMITTED"),requestId:LocalIdSchema,operationId:OperationIdSchema,reference:LocalLibraryReferenceSchema,accessRevision:z32.int().positive()});var LocalLibraryInspectionSchema=z32.discriminatedUnion("kind",[z32.strictObject({kind:z32.literal("VIDEO"),metadata:ImportedVisualSourceMetadataSchema}),z32.strictObject({kind:z32.literal("IMAGE"),checksumSha256:LocalDigestSchema,byteSize:z32.int().positive().max(8*1024*1024),width:z32.int().positive().max(4096),height:z32.int().positive().max(4096)})]);var LocalLibraryInspectRecipeSchema=z32.strictObject({processor:z32.literal("LOCAL_MEDIA_INSPECT"),reference:LocalLibraryReferenceSchema,accessRevision:z32.int().positive(),libraryProfileDigest:LocalDigestSchema}).refine(({reference})=>localLibraryInspectable(reference),"Qualified local inspection required");var LocalLibraryPublishRecipeSchema=z32.strictObject({processor:z32.literal("LOCAL_MEDIA_PUBLISH"),reference:LocalLibraryReferenceSchema,accessRevision:z32.int().positive(),libraryProfileDigest:LocalDigestSchema,destination:LocalLibraryDestinationSchema,object:MediaObjectVersionSchema.extend({role:z32.literal("SOURCE")})}).refine(({reference,object,destination})=>localLibraryInspectable(reference)&&destinationMatches(destination,reference)&&object.tenantId===reference.tenantId&&object.projectId===reference.projectId&&object.checksumSha256===reference.checksumSha256&&object.byteSize===reference.byteSize,"Publication must use the exact local file version and native destination");var LocalLibraryInspectEvidenceSchema=z32.strictObject({processor:z32.literal("LOCAL_MEDIA_INSPECT"),inspection:LocalLibraryInspectionSchema});var LocalLibraryPublishEvidenceSchema=z32.strictObject({processor:z32.literal("LOCAL_MEDIA_PUBLISH"),inspection:LocalLibraryInspectionSchema});import{z as z36}from"zod";import{z as z33}from"zod";var identity2=z33.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema});var ProcessorCompositionAllocationSchema=z33.strictObject({sequence:identity2,frames:z33.array(identity2).min(1).max(360)}).refine(({sequence,frames})=>{const entries=[sequence,...frames];return new Set(entries.map(entry=>entry.artifactId)).size===entries.length&&new Set(entries.map(entry=>entry.representationId)).size===entries.length});var processorCompositionFields={manifest:CompositionRenderManifestReaderSchema,allocation:ProcessorCompositionAllocationSchema.nullable()};var base={processor:z33.literal("COMPOSITION_RENDER"),resources:CompositionRenderResourcesSchema};var ProcessorCompositionVideoEvidenceSchema=z33.strictObject({...base,format:z33.literal("MP4"),technical:CompositionRenderTechnicalSchema});var ProcessorCompositionSequenceEvidenceSchema=z33.strictObject({...base,format:z33.literal("RGBA_SEQUENCE"),technical:CompositionFrameTechnicalSchema,sequence:VisualFrameSequenceSchema});var ProcessorCompositionEvidenceSchema=z33.discriminatedUnion("format",[ProcessorCompositionVideoEvidenceSchema,ProcessorCompositionSequenceEvidenceSchema]);import{z as z35}from"zod";import{z as z34}from"zod";var TranscribeAudioRecipeSchema=z34.strictObject({processor:z34.literal("TRANSCRIBE_AUDIO"),source:ObservationSourceSchema.extend({contentType:z34.literal("audio/wav")}),identity:LocalWhisperIdentitySchema});var TranscribeAudioEvidenceSchema=z34.strictObject({processor:z34.literal("TRANSCRIBE_AUDIO"),identity:LocalWhisperIdentitySchema,transcript:TranscriptSchema.refine(transcript=>transcript.timing==="UNAVAILABLE"),inputPcmSha256:LocalDigestSchema,inputPcmByteSize:z34.int().min(44).max(1920044)});var QwenAsrRecipeSchema=z34.strictObject({processor:z34.literal("TRANSCRIBE_EXTERNAL_QWEN"),observationId:LocalIdSchema,quoteFingerprint:LocalDigestSchema,credential:QwenDeviceCredentialIdentitySchema,source:TranscribeAudioRecipeSchema.shape.source,parameters:z34.strictObject({context:z34.string().max(2e3).refine(value=>!value.includes("\0")).optional(),language:z34.string().regex(/^[a-zA-Z][a-zA-Z0-9-]{1,19}$/).optional(),enable_itn:z34.boolean().optional()})});var asrTokens=z34.int().min(0).max(1e7).optional();var QwenAsrEvidenceSchema=z34.strictObject({processor:z34.literal("TRANSCRIBE_EXTERNAL_QWEN"),providerRequestId:z34.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),model:z34.literal("qwen3-asr-flash-2026-02-10"),usage:z34.strictObject({seconds:z34.int().min(0).max(60).optional(),prompt_tokens:asrTokens,completion_tokens:asrTokens,total_tokens:asrTokens}),transcript:TranscriptSchema.options[0]});var sourceReference=z35.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema,byteSize:MediaObjectVersionSchema.shape.byteSize,checksumSha256:LocalDigestSchema,contentType:z35.string().min(1).max(100)});var source2=sourceReference.extend({contentType:z35.literal("video/mp4")});var normalize=z35.strictObject({processor:z35.literal("IMPORTED_VISUAL_NORMALIZE"),source:source2,request:ImportedVisualNormalizationRequestSchema}).refine(({request,source:source3})=>request.source.byteSize===source3.byteSize&&request.source.checksumSha256===source3.checksumSha256,"Original representation must match the normalization request");var audio=z35.strictObject({processor:z35.literal("SOURCE_SYNC_AUDIO"),source:source2,input:ImportedVisualSourceInputSchema,extraction:ImportedSynchronousAudioExtractionSchema}).refine(value=>value.source.checksumSha256===value.input.checksumSha256&&value.source.checksumSha256===value.extraction.originalChecksumSha256&&value.source.representationId===value.extraction.originalRepresentationId&&value.source.artifactId===value.extraction.originalArtifactId&&value.source.byteSize===value.input.byteSize);var temporal=z35.strictObject({processor:z35.literal("TEMPORAL_SAMPLE"),source:source2,plan:TemporalSamplingPlanSchema}).refine(value=>value.source.checksumSha256===value.plan.source.checksumSha256&&value.source.representationId===value.plan.source.representationId&&value.source.artifactId===value.plan.source.artifactId&&value.source.byteSize===value.plan.source.byteSize);var delivery=z35.strictObject({processor:z35.literal("DELIVERY_VALIDATE"),recipe:LocalMediaRecipeSchema.refine(value=>value.family==="FINAL_RENDER"),target:DeliveryTargetSchema.pick({representationId:true,checksumSha256:true,byteSize:true,artifactId:true}).extend({contentType:z35.literal("video/mp4")}),policy:z35.strictObject({requiredAudio:z35.boolean(),requiredCaptions:z35.boolean(),requiredGraphics:z35.boolean()}),engineVersion:z35.string().min(1).max(200),sources:z35.array(sourceReference).min(1).max(512),manifestBasisFingerprint:LocalDigestSchema}).refine(({sources,target:target2})=>new Set([target2.representationId,...sources.map(v=>v.representationId)]).size===sources.length+1);var composition=z35.strictObject({processor:z35.literal("COMPOSITION_RENDER"),...processorCompositionFields,sources:z35.array(sourceReference).min(1).max(64)}).refine(({manifest,allocation,sources})=>{const inputs=manifest.version.inputs;return(manifest.schemaVersion===1?allocation===null:allocation?.frames.length===manifest.frameCount)&&new Set(inputs.map(input=>input.representationId)).size===sources.length&&new Set(sources.map(source3=>source3.representationId)).size===sources.length&&inputs.every(input=>sources.some(source3=>source3.representationId===input.representationId&&source3.artifactId===input.artifactId&&source3.checksumSha256===input.checksumSha256&&source3.byteSize===input.byteSize&&source3.contentType===input.contentType))});var directOriginal=z35.strictObject({processor:z35.literal("IMPORT_ORIGINAL"),command:DirectOriginalCommandSchema,object:MediaObjectVersionSchema.extend({role:z35.literal("SOURCE")})}).refine(({command:{input},object})=>input.tenantId===object.tenantId&&input.projectId===object.projectId&&input.source.checksumSha256===object.checksumSha256&&input.source.byteSize===object.byteSize);var projectSource=z35.strictObject({processor:z35.literal("IMPORT_PROJECT_SOURCE"),metadata:SourceInputMetadataSchema.extend({idempotencyKey:z35.string().trim().min(1).max(200)}),projectId:LocalIdSchema,object:MediaObjectVersionSchema.extend({role:z35.literal("SOURCE")})}).refine(({metadata,projectId,object})=>metadata.tenantId===object.tenantId&&projectId===object.projectId&&object.byteSize<=8*1024*1024&&(metadata.kind==="REFERENCE_VIDEO"?metadata.contentType==="video/mp4":metadata.kind==="REFERENCE_IMAGE"&&["image/png","image/jpeg","image/webp"].includes(metadata.contentType)));var visualSequence=z35.strictObject({processor:z35.literal("REGISTER_VISUAL_SEQUENCE"),input:RegisterVisualSequenceSchema,manifest:VisualSequenceManifestSchema,sources:z35.array(sourceReference).min(1).max(360)}).refine(({input,manifest,sources})=>input.tenantId===manifest.tenantId&&input.projectId===manifest.projectId&&input.productionId===manifest.productionId&&new Set(sources.map(source3=>source3.representationId)).size===sources.length&&manifest.frames.every(frame2=>sources.some(source3=>source3.artifactId===frame2.artifactId&&source3.representationId===frame2.representationId&&source3.byteSize===frame2.byteSize&&source3.checksumSha256===frame2.checksumSha256&&source3.contentType==="image/png")));var TenantProcessorRecipeSchema=z35.discriminatedUnion("processor",[normalize,audio,temporal,delivery,composition,directOriginal,projectSource,LocalLibraryInspectRecipeSchema,LocalLibraryPublishRecipeSchema,visualSequence,SpeechSynthesisRecipeSchema,QwenSpeechRecipeSchema,TranscribeAudioRecipeSchema,QwenAsrRecipeSchema,QwenKeyframeRecipeSchema,QwenVideoRecipeSchema]);var TenantProcessorWorkSchema=TenantMediaWorkSchema.omit({audioRequired:true,renderProfileDigest:true}).extend({protocol:z36.literal("NVS_TENANT_PROCESSOR_V1"),family:z36.enum(["ARTIFACT_INGEST","TEMPORAL_SAMPLE","DELIVERY_VALIDATE","COMPOSITION_RENDER","AUDIO_GENERATE","OBSERVE","KEYFRAME_GENERATE","VIDEO_GENERATE"]),processor:TenantProcessorKindSchema,recipeFingerprint:LocalDigestSchema,toolchainFingerprint:LocalDigestSchema,externalGeneration:ExternalGenerationReservationMarkerSchema.optional()}).refine(value=>processorFamilies[value.processor]===value.family&&(value.processor==="KEYFRAME_GENERATE"||value.processor==="VIDEO_GENERATE")===!!value.externalGeneration);var TenantComputeWorkSchema=z36.discriminatedUnion("protocol",[TenantMediaWorkSchema,TenantProcessorWorkSchema]);var importedNormalizationValidationProfile={processor:"IMPORTED_VISUAL_NORMALIZE",protocol:"NVS_TENANT_PROCESSOR_REPORT_V1",inspection:"IMPORTED_MP4_AND_POSTER_READBACK_V1"};var ClaimTenantProcessorSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema});var TenantProcessorAssignmentSchema=z36.strictObject({work:TenantProcessorWorkSchema,recipe:TenantProcessorRecipeSchema,lease:LocalExecutionLeaseSchema,toolchain:LocalToolchainSchema}).superRefine(({work,recipe,lease},ctx)=>{const target2=lease.target;if((recipe.processor==="LOCAL_MEDIA_INSPECT"||recipe.processor==="LOCAL_MEDIA_PUBLISH")&&(recipe.reference.tenantId!==work.tenantId||recipe.reference.projectId!==work.projectId||recipe.reference.deviceId!==work.target.deviceId||recipe.processor==="LOCAL_MEDIA_PUBLISH"&&recipe.destination.kind==="ORIGINAL"&&recipe.destination.command.input.productionId.toLowerCase()!==work.productionId))ctx.addIssue({code:"custom",message:"Local file reference must match native target and scope"});if(recipe.processor!==work.processor||lease.tenantId!==work.tenantId||lease.projectId!==work.projectId||lease.productionId!==work.productionId||lease.runtimeJobId!==work.runtimeJobId||lease.toolchainFingerprint!==work.toolchainFingerprint||target2.kind!=="DEVICE"||!sameDeviceAuthority(target2,work.target))ctx.addIssue({code:"custom",message:"Assignment must match the frozen device work"})});var TenantProcessorClaimReceiptSchema=z36.strictObject({found:z36.boolean(),assignment:TenantProcessorAssignmentSchema.nullable()});var StageTenantProcessorOutputSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,role:z36.enum(["VIDEO","POSTER","AUDIO","FRAME","SHEET","MANIFEST"]),ordinal:z36.int().nonnegative().max(359).default(0),checksumSha256:LocalDigestSchema,byteSize:MediaObjectVersionSchema.shape.byteSize});var PrepareTenantProcessorReportSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputVersionIds:z36.array(LocalIdSchema).max(362).refine(ids=>ids.length===new Set(ids).size)});var TenantProcessorReportRequestSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,validationRequestId:LocalIdSchema,work:TenantProcessorWorkSchema,outputs:z36.array(MediaObjectVersionSchema).max(362)});var poster=z36.strictObject({checksumSha256:LocalDigestSchema,byteSize:z36.int().min(1).max(2*1024*1024),width:z36.int().min(1).max(320),height:z36.int().min(1).max(320)});var TenantProcessorEvidenceSchema=z36.discriminatedUnion("processor",[LocalLibraryInspectEvidenceSchema,LocalLibraryPublishEvidenceSchema,z36.strictObject({processor:z36.literal("IMPORTED_VISUAL_NORMALIZE"),receipt:ImportedVisualNormalizationReceiptSchema,posterEvidence:poster}),z36.strictObject({processor:z36.literal("SOURCE_SYNC_AUDIO"),provenance:ImportedSynchronousAudioSourceSchema}),z36.strictObject({processor:z36.literal("TEMPORAL_SAMPLE"),manifest:TemporalEvidenceManifestSchema}),z36.strictObject({processor:z36.literal("DELIVERY_VALIDATE"),checks:DeliveryPhysicalChecksSchema,technical:FinalRenderTechnicalSchema.nullable()}),ProcessorCompositionEvidenceSchema,SpeechSynthesisEvidenceSchema,QwenSpeechEvidenceSchema,TranscribeAudioEvidenceSchema,QwenAsrEvidenceSchema,QwenKeyframeEvidenceSchema,QwenVideoEvidenceSchema,z36.strictObject({processor:z36.literal("IMPORT_ORIGINAL"),metadata:ImportedVisualSourceMetadataSchema}),z36.strictObject({processor:z36.literal("IMPORT_PROJECT_SOURCE"),validated:z36.strictObject({checksumSha256:LocalDigestSchema,byteSize:z36.int().positive().max(8*1024*1024),width:z36.int().positive().max(4096),height:z36.int().positive().max(4096),video:ImportedVisualSourceMetadataSchema.optional()})}),z36.strictObject({processor:z36.literal("REGISTER_VISUAL_SEQUENCE"),evidence:z36.strictObject({checksumSha256:VisualFrameSequenceSchema.shape.checksumSha256,width:VisualFrameSequenceSchema.shape.width,height:VisualFrameSequenceSchema.shape.height,frames:VisualFrameSequenceSchema.shape.frames,byteSize:z36.int().positive().max(2*1024*1024)})})]);var TenantProcessorReportBodySchema=TenantProcessorReportRequestSchema.extend({schemaVersion:z36.literal(1),evidence:TenantProcessorEvidenceSchema}).superRefine(({work,outputs,evidence,...binding},ctx)=>{if(work.tenantId!==binding.tenantId||work.projectId!==binding.projectId||work.productionId!==binding.productionId||work.runtimeJobId!==binding.runtimeJobId||work.toolchainFingerprint!==binding.toolchainFingerprint||evidence.processor!==work.processor||new Set(outputs.map(value=>value.versionId)).size!==outputs.length||outputs.some(object=>object.tenantId!==work.tenantId||object.projectId!==work.projectId)||!matchesEvidence(outputs,evidence))ctx.addIssue({code:"custom",message:"Report must bind the exact processor and committed media versions"})});function matchesEvidence(outputs,evidence){const matches=(index,role,expected)=>{const output2=outputs[index];return output2?.role===role&&output2.checksumSha256===expected.checksumSha256&&output2.byteSize===expected.byteSize};switch(evidence.processor){case"IMPORTED_VISUAL_NORMALIZE":return outputs.length===2&&matches(0,"VIDEO",evidence.receipt.output)&&matches(1,"POSTER",evidence.posterEvidence);case"SOURCE_SYNC_AUDIO":return outputs.length===1&&matches(0,"AUDIO",{checksumSha256:evidence.provenance.wavChecksumSha256,byteSize:evidence.provenance.wavByteSize});case"SPEECH_SYNTHESIZE":case"SPEECH_EXTERNAL_QWEN":return outputs.length===2&&matches(0,"AUDIO",evidence.source)&&matches(1,"AUDIO",evidence.normalized);case"TEMPORAL_SAMPLE":{const frames=evidence.manifest.frames;return outputs.length===frames.length+2&&frames.every((value,index)=>matches(index,"FRAME",value))&&matches(frames.length,"SHEET",evidence.manifest.sheet)&&outputs.at(-1)?.role==="MANIFEST"}case"DELIVERY_VALIDATE":case"TRANSCRIBE_AUDIO":case"TRANSCRIBE_EXTERNAL_QWEN":case"LOCAL_MEDIA_INSPECT":case"LOCAL_MEDIA_PUBLISH":case"IMPORT_ORIGINAL":case"IMPORT_PROJECT_SOURCE":return outputs.length===0;case"REGISTER_VISUAL_SEQUENCE":return outputs.length===1&&matches(0,"MANIFEST",evidence.evidence);case"KEYFRAME_GENERATE":return outputs.length===1&&matches(0,"FRAME",evidence.image);case"VIDEO_GENERATE":return outputs.length===2&&matches(0,"VIDEO",evidence.video)&&matches(1,"POSTER",evidence.poster);case"COMPOSITION_RENDER":if(evidence.format==="MP4")return outputs.length===1&&matches(0,"VIDEO",evidence.technical);return outputs.length===evidence.technical.frames.length+1&&evidence.technical.frames.every((value,index)=>matches(index,"FRAME",value))&&outputs.at(-1)?.role==="MANIFEST"&&outputs.at(-1)?.checksumSha256===evidence.sequence.checksumSha256}}var TenantProcessorReportSchema=TenantProcessorReportBodySchema.safeExtend({reportFingerprint:LocalDigestSchema,signature:z36.string().regex(/^[A-Za-z0-9_-]{86}$/)});var TenantProcessorReceiptQuerySchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema});var TenantProcessorStateSchema=z36.strictObject({binding:LocalLeaseBindingSchema,state:z36.enum(["FENCED","PENDING"])});var TenantProcessorFailureSchema=LocalLeaseBindingSchema.extend({code:z36.literal("INVALID_SOURCE")});var TenantProcessorProviderOutcomeSchema=LocalLeaseBindingSchema.extend({outcome:z36.enum(["UNKNOWN","REJECTED","WAITING","INVALID_RESULT"]),providerExecutionId:QwenVideoTaskIdSchema.optional()}).refine(value=>!["WAITING","INVALID_RESULT"].includes(value.outcome)||!!value.providerExecutionId);var TenantProcessorProviderTaskSchema=LocalLeaseBindingSchema.extend({providerExecutionId:QwenVideoTaskIdSchema.optional()});var TenantProcessorInvalidSpeechSchema=LocalLeaseBindingSchema.extend(QwenSpeechEvidenceSchema.pick({providerRequestId:true,audioId:true}).shape);var TenantProcessorReceiptSchema=TenantProcessorReceiptQuerySchema.extend({operationId:TenantProcessorWorkSchema.shape.operationId,reportFingerprint:LocalDigestSchema,result:z36.union([z36.strictObject({localMediaInspectionId:LocalIdSchema}),z36.strictObject({normalizationId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema,posterArtifactId:LocalIdSchema,posterRepresentationId:LocalIdSchema}),SourceSyncAudioReceiptSchema,z36.strictObject({generationId:LocalIdSchema,audio:AudioReceiptSchema}),z36.strictObject({observationId:LocalIdSchema}),z36.strictObject({generationId:LocalIdSchema,candidateId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema}),z36.strictObject({evidenceId:LocalIdSchema,frameSetArtifactId:LocalIdSchema,contactSheetArtifactId:LocalIdSchema}),z36.strictObject({deliveryValidationId:LocalIdSchema,reviewId:LocalIdSchema}),z36.strictObject({renderId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema}),ImportedVisualOriginalViewSchema,ReadyArtifactRegistrationSchema,z36.strictObject({requestId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema})])});import{z as z37}from"zod";var LocalLibraryCommandStatusSchema=z37.strictObject({admission:LocalLibraryAdmissionSchema,lifecycle:z37.enum(["READY","WAITING","RUNNING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),receipt:TenantProcessorReceiptSchema.nullable(),inspection:LocalLibraryInspectionSchema.nullable(),failureSummary:z37.string().max(500).nullable()}).superRefine(({admission,receipt},ctx)=>{if(receipt&&(receipt.tenantId!==admission.tenantId||receipt.projectId!==admission.projectId||receipt.productionId!==admission.productionId||receipt.runtimeJobId!==admission.runtimeJobId||receipt.operationId!==admission.operationId))ctx.addIssue({code:"custom",message:"Original native receipt must match admitted local file work"})});import{z as z38}from"zod";var LocalWorkspaceDeviceSchema=z38.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema});var LocalDeviceWorkScopesSchema=z38.array(LocalProjectScopeSchema).max(64);import{z as z39}from"zod";var output=z39.discriminatedUnion("role",[z39.strictObject({role:z39.literal("VIDEO"),receiptId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z39.int().positive().max(128*1024*1024),contentType:z39.literal("video/mp4")}),z39.strictObject({role:z39.literal("POSTER"),receiptId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z39.int().positive().max(2*1024*1024),contentType:z39.literal("image/png")})]);var LocalCompletionSubmissionSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputs:z39.array(output).length(2),technical:RoughCutTechnicalSchema}).superRefine((v,ctx)=>{const video=v.outputs.find(o=>o.role==="VIDEO");if(new Set(v.outputs.map(o=>o.role)).size!==2||new Set(v.outputs.map(o=>o.receiptId)).size!==2||!video||video.checksumSha256!==v.technical.checksumSha256||video.byteSize!==v.technical.byteSize)ctx.addIssue({code:"custom",message:"Exact video/poster receipts required"})});var LocalVerifiedUploadSchema=z39.strictObject({binding:LocalLeaseBindingSchema,output,verifiedAt:LocalTimeSchema});var LocalCompletionReceiptSchema=LocalLeaseBindingSchema.extend({submissionFingerprint:LocalDigestSchema.optional(),semanticStatus:z39.literal("SUCCESS"),requestId:LocalIdSchema,renderId:LocalIdSchema,operationId:OperationIdSchema,artifactId:LocalIdSchema,videoRepresentationId:LocalIdSchema,posterRepresentationId:LocalIdSchema,checksumSha256:LocalDigestSchema,acceptedAt:LocalTimeSchema});var GetLocalCompletionReceiptSchema=LocalLeaseBindingSchema.pick({tenantId:true,projectId:true,productionId:true,runtimeJobId:true}).extend({requestId:LocalIdSchema});import{z as z40}from"zod";var PrepareTenantMediaValidationSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputReceiptIds:z40.array(LocalIdSchema).length(2).refine(ids=>new Set(ids).size===2)});var TenantMediaValidationRequestSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,validationRequestId:LocalIdSchema,work:TenantMediaWorkSchema,outputs:z40.array(MediaObjectVersionSchema).length(2)});var TenantMediaValidationReadbackSchema=z40.strictObject({request:TenantMediaValidationRequestSchema,tickets:z40.array(MediaObjectTicketSchema).length(2)});var TenantMediaDownloadSchema=LocalProjectScopeSchema.extend({representationId:LocalIdSchema});var TenantMediaOutputStageSchema=z40.strictObject({ticket:MediaObjectTicketSchema,uploaded:z40.boolean()});var TenantRenderMediaInputSchema=TimelineScopeSchema.extend({renderId:z40.uuid(),role:z40.enum(["VIDEO","POSTER"])});var TenantRenderMediaTicketSchema=TenantRenderMediaInputSchema.extend({representationId:z40.uuid(),ticket:MediaObjectTicketSchema.extend({object:MediaObjectVersionSchema.extend({tenantId:z40.uuid(),projectId:z40.uuid(),versionId:z40.uuid()})})});var TenantMediaCapabilitySchema=z40.strictObject({tenantId:LocalIdSchema,validationMode:z40.literal("TENANT_TRUSTED_VALIDATOR")});import{createHash}from"node:crypto";import{z as z41}from"zod";var success=z41.strictObject({semanticStatus:z41.literal("SUCCESS")});var same=(a,b)=>canonicalLocalJson(a??null)===canonicalLocalJson(b??null);function resultMatches(command2,raw){const schema=command2.kind==="ENROLL"?LocalDeviceViewSchema:command2.kind==="PREVIEW"?LocalPreviewAdmissionSchema:command2.kind==="FINAL_RENDER"?LocalFinalRenderAdmissionSchema:success;const parsed=schema.safeParse(raw);if(!parsed.success)return false;const result=parsed.data,original=command2.input;for(const key of["tenantId","projectId","deviceId","productionId","timelineVersionId"])if(key in original&&key in result&&String(result[key]).toLowerCase()!==String(original[key]).toLowerCase())return false;if(command2.kind==="ENROLL")return result.revokedAt===null&&["publicKey","label","platform","runtimeVersion"].every(key=>same(original[key],result[key]));if(command2.kind==="PREVIEW"||command2.kind==="FINAL_RENDER")return same(original.timelineFingerprint,result.timelineFingerprint)&&same(command2.input.placement,result.placement.policy);return true}function checkedManagementReceipt(rawCommand,rawReceipt){const command2=LocalDeviceManagementCommandSchema.parse(rawCommand);const receipt=LocalManagementReceiptSchema.parse(rawReceipt);if(receipt.fingerprint!==createHash("sha256").update(canonicalLocalJson(command2)).digest("hex")||receipt.result!==null&&!resultMatches(command2,receipt.result))throw new NativeStudioSdkError("LOCAL_RECEIPT_INVALID","BLOCKED","NO_WRITE");return receipt}function assertManagementReceipt(key,input,result){if(key==="device.management-receipt")checkedManagementReceipt(input.command,result);else if(key==="device.enroll"){const command2=LocalDeviceManagementCommandSchema.parse({kind:"ENROLL",input});if(!resultMatches(command2,result))throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}}export{EnrollLocalDeviceSchema,LocalDeviceViewSchema,LocalDeviceChallengeSchema,RevokeLocalDeviceSchema,WorkspaceDeviceListInputSchema,WorkspaceDeviceListSchema,LocalOfflineCallSchema,LocalOfflinePageSchema,localLibraryProfile,LocalLibraryContentTypeSchema,LocalLibraryReferenceSchema,LocalLibraryItemSchema,LocalLibraryQuerySchema,LocalLibraryPageSchema,LocalLibraryProjectionSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryImportSchema,LocalLibraryImportReceiptQuerySchema,LocalLibraryReadReplySchema,LocalLibraryGetSchema,LocalLibraryCallSchema,LocalLibraryCapabilitySchema,LocalLibraryUsageSchema,LocalAgentGrantSchema,LocalAgentDiscoverySchema,LocalCompositionBrowserSelectionSchema,LocalToolSelectionSchema,LocalRuntimeDescriptorSchema,RuntimeCaptionAssets,LocalComponentBytesSchema,LocalRuntimeComponentSchema,LocalSessionConnectorSchema,LocalManagementInventorySchema,LocalReleaseSchema,LocalBundledReleaseSchema,LocalSignedCatalogueSchema,LocalToolChoiceSchema,LocalUpdatePlanSchema,LocalClientNextActionSchema,LocalResourcePolicySchema,LocalResourceSettingsSchema,LocalExecutionProgressSchema,LocalStorageInspectionSchema,LocalWorkspaceInspectionSchema,LocalDiagnosticsSchema,canonicalLocalJson,LocalAgentSnapshotSchema,LocalAgentProbeSchema,LocalAgentReviewViewSchema,localAgentSnapshotFromContext,localAgentNativeProposal,LocalExecutionListInputSchema,LocalExecutionInspectInputSchema,LocalIpcRequestSchema,LocalRuntimeStatusSchema,LocalDoctorReportSchema,LocalExecutionInspectionSchema,LocalExecutionPageSchema,LocalIpcResponseSchema,StartLocalPreviewSchema,LocalDeviceSessionSchema,LocalDeviceTransportConfigurationSchema,LocalPreviewAdmissionSchema,StartLocalFinalRenderSchema,LocalFinalRenderAdmissionSchema,LocalMcpFailureSchema,LocalMcpOutputSchemas,localAgentMediaSnapshot,localAgentMediaProposal,LocalManagementCommandSchema,LocalManagementResultSchema,LocalManagementReceiptSchema,localManagementRoutes,LocalDeviceManagementCommandSchema,ScopedLocalManagementReceiptSchema,tenantRenderValidationProfile,TenantMediaDownloadSchema,TenantRenderMediaInputSchema,TenantRenderMediaTicketSchema,TenantMediaCapabilitySchema,ImportedVisualFromProjectSourceSchema,ImportedVisualNormalizeStartSchema,ImportedVisualGetSchema,ImportedVisualReviewSchema,ImportedVisualDecisionSchema,ImportedVisualOriginalViewSchema,ImportedVisualNormalizationViewSchema,SourceSyncRuntimeStartSchema,SourceSyncRuntimeScopeSchema,SourceSyncRuntimeAdmissionSchema,SourceSyncRuntimeViewSchema,SourceSyncReviewTargetSchema,SourceSyncReviewInputSchema,SourceSyncReviewRecordSchema,SourceSyncReviewGetSchema,ImportedVideoReviewReceiptSchema,ImportedVisualCancellationSchema,ImportedVisualAdmissionSchema,ImportedVisualReviewTargetSchema,ImportedVisualOriginalGetSchema,ImportedVisualOriginalHistoryQuerySchema,ImportedVisualOriginalHistorySchema,ImportedVisualOriginalQuerySchema,ImportedVisualOriginalPageSchema,LegacyImportedVisualUploadSchema,LegacyImportedVisualRevisionSchema,LegacyImportedVisualProjectSourceSchema,DirectOriginalCommandSchema,DirectOriginalStageSchema,DirectOriginalSubmitSchema,DirectProjectSourceCommandSchema,DirectProjectSourceStageSchema,DirectProjectSourceSubmitSchema,LocalLibraryCommandSchema,LocalLibraryCommandQuerySchema,LocalLibraryAdmissionSchema,importedNormalizationValidationProfile,LocalLibraryCommandStatusSchema,checkedManagementReceipt,assertManagementReceipt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ContinuationSchema,DeliveryOutputProfileSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,TenantIdSchema}from"./chunk-VPYAXWXY.js";import{z as z3}from"zod";import{z as z2}from"zod";import{z}from"zod";var ProductionLifecycleSchema=z.enum(["ACTIVE","COMPLETED","FAILED","CANCELLED"]);var ProductionPhaseSchema=z.enum(["INTAKE","PLANNING","PREPARING_GENERATION","GENERATING","SHOT_REVIEW","ASSEMBLING","ROUGH_CUT_REVIEW","FINAL_READY","FINAL_RENDERING","DELIVERY_VALIDATION"]);var ProductionConditionSchema=z.enum(["RUNNABLE","RUNNING","WAITING_PROVIDER","WAITING_HUMAN","BLOCKED","RETRYING"]);var CreateProductionInputSchema=z.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,principalId:PrincipalIdSchema});var ProductionStateSchema=z.object({lifecycle:ProductionLifecycleSchema,phase:ProductionPhaseSchema,condition:ProductionConditionSchema,revision:z.int().positive(),blockingReason:z.string().min(1).nullable(),waitingReason:z.string().min(1).nullable()});var ProductionSchema=z.object({id:ProductionIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,state:ProductionStateSchema,activeBriefVersion:z.int().positive().nullable().default(null),activeStoryVersion:z.int().positive().nullable().default(null),activeSceneShotPlanVersion:z.int().positive().nullable().default(null),createdByPrincipalId:PrincipalIdSchema,createdAt:z.iso.datetime({offset:true}),updatedAt:z.iso.datetime({offset:true})});var ProjectLifecycleSchema=z2.enum(["ACTIVE","ARCHIVED"]);var CreateProjectInputSchema=z2.object({tenantId:TenantIdSchema,principalId:PrincipalIdSchema,idempotencyKey:z2.string().trim().min(1).max(200),name:z2.string().trim().min(1).max(200)});var CreateProjectRequestSchema=CreateProjectInputSchema.omit({principalId:true}).strict();var ProjectSchema=z2.object({id:ProjectIdSchema,tenantId:TenantIdSchema,name:z2.string().min(1),lifecycle:ProjectLifecycleSchema,defaultActiveProductionId:ProductionIdSchema.nullable(),revision:z2.int().positive(),createdByPrincipalId:PrincipalIdSchema,createdAt:z2.iso.datetime({offset:true}),updatedAt:z2.iso.datetime({offset:true})});var CreatedProjectResultSchema=z2.object({project:ProjectSchema,production:ProductionSchema});var ProjectLibraryQuerySchema=z3.strictObject({tenantId:TenantIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProjectLibraryScopeSchema=z3.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var ProjectLibraryPageSchema=z3.strictObject({items:z3.array(ProjectSchema).max(100),page:QueryPageInfoSchema});var ProjectWorkspaceSchema=z3.strictObject({project:ProjectSchema,productions:z3.array(ProductionSchema).max(100),possiblyTruncated:z3.boolean()});var SourceLibraryQuerySchema=ProjectLibraryQuerySchema.extend({projectId:ProjectIdSchema.optional()});var SourceLibraryItemSchema=z3.strictObject({artifactId:z3.uuid(),representationId:z3.uuid(),projectId:ProjectIdSchema,kind:z3.enum(["REFERENCE_IMAGE","REFERENCE_VIDEO","PRODUCT_INFORMATION"]),originalName:z3.string().max(255),checksumSha256:z3.string().regex(/^[0-9a-f]{64}$/),contentType:z3.enum(["image/png","image/jpeg","image/webp","text/plain","application/json","video/mp4"]),byteSize:z3.int().positive().max(8388608),width:z3.int().positive().nullable(),height:z3.int().positive().nullable(),createdAt:z3.iso.datetime({offset:true})});var SourceLibraryPageSchema=z3.strictObject({items:z3.array(SourceLibraryItemSchema).max(100),page:QueryPageInfoSchema});var SourceLibraryMediaSchema=ProjectLibraryScopeSchema.extend({artifactId:z3.uuid()});var StudioInputContentSchema=z3.strictObject({schemaVersion:z3.literal(1),productionId:z3.uuid(),projectTitle:z3.string().trim().min(1).max(200),name:z3.string().trim().max(300),intent:z3.string().trim().min(1).max(2e3),aspectRatio:z3.enum(["16:9","9:16"]),targetDurationSeconds:z3.int().min(30).max(60),outputProfile:DeliveryOutputProfileSchema,sourceArtifactIds:z3.array(z3.uuid()).max(12)});import{z as z4}from"zod";var HumanEmailSchema=z4.string().trim().max(254).toLowerCase().pipe(z4.email()).refine(v=>/^[\x21-\x7e]+$/.test(v),"Use an ASCII email address");var HumanPasswordSchema=z4.string().max(512).superRefine((v,c)=>{const points=[...v];const control=points.some(c2=>c2.codePointAt(0)<32||c2.codePointAt(0)===127);if(points.length<15||points.length>128||control)c.addIssue({code:"custom",message:"Password must contain 15\u2013128 characters"})});var HumanCodePurposeSchema=z4.enum(["REGISTER","RESET_PASSWORD","LINK_EMAIL"]);var HumanCodeRequestSchema=z4.strictObject({email:HumanEmailSchema,purpose:HumanCodePurposeSchema});var HumanCodeRequestedSchema=z4.strictObject({accepted:z4.literal(true),challengeId:z4.uuid(),retryAfterSeconds:z4.literal(60),expiresInSeconds:z4.literal(600)});var proof={challengeId:z4.uuid(),email:HumanEmailSchema,code:z4.string().regex(/^\d{6}$/),password:HumanPasswordSchema};var HumanRegisterSchema=z4.strictObject({...proof,displayName:z4.string().trim().min(1).max(80)});var HumanResetSchema=z4.strictObject(proof);var HumanLoginSchema=z4.strictObject({email:HumanEmailSchema,password:z4.string().max(512),rememberMe:z4.boolean().optional()});var HumanTenantSchema=z4.strictObject({id:z4.uuid(),displayName:z4.string().max(200)});var HumanAccountSchema=z4.strictObject({principalId:z4.uuid(),displayName:z4.string().max(200),email:HumanEmailSchema.nullable(),tenants:z4.array(HumanTenantSchema).max(100)});var HumanDesktopSessionSchema=z4.strictObject({tenantId:z4.uuid(),scopeKey:z4.string().regex(/^[a-f0-9]{64}$/),expiresAt:z4.int().positive(),sessionExpiresAt:z4.int().positive().optional(),rememberMe:z4.boolean(),account:HumanAccountSchema.omit({tenants:true})}).refine(({rememberMe,expiresAt,sessionExpiresAt})=>sessionExpiresAt===void 0||rememberMe&&sessionExpiresAt>=expiresAt,"Desktop persistence requires consent and the session deadline");var ShortHumanSessionSchema=z4.strictObject({accessToken:z4.string().regex(/^nvsh_[A-Za-z0-9_-]{43}$/),expiresAt:z4.iso.datetime(),account:HumanAccountSchema});var HumanRefreshTokenSchema=z4.string().regex(/^nvshr_[A-Za-z0-9_-]{43}$/);var HumanRefreshSchema=z4.strictObject({refreshToken:HumanRefreshTokenSchema});var HumanSessionSchema=ShortHumanSessionSchema.extend({refreshToken:HumanRefreshTokenSchema.optional(),sessionId:z4.uuid().optional(),sessionExpiresAt:z4.iso.datetime().optional()}).refine(session=>{const{refreshToken,sessionId,sessionExpiresAt,expiresAt}=session;if(!refreshToken)return sessionId===void 0&&sessionExpiresAt===void 0;return!!sessionId&&!!sessionExpiresAt&&Date.parse(expiresAt)<=Date.parse(sessionExpiresAt)},"Persistent session requires its exact identity and absolute expiry");var HumanIdentityAvailabilitySchema=z4.strictObject({passwordLogin:z4.boolean(),emailVerification:z4.boolean()});var HumanIdentityFailureSchema=z4.strictObject({code:z4.enum(["INVALID_INPUT","INVALID_CREDENTIALS","INVALID_CODE","RATE_LIMITED","MAIL_UNAVAILABLE","UNAVAILABLE","UNAUTHENTICATED","CONFLICT"])});var CliAccountRedirectSchema=z4.string().max(256).refine(value=>{try{const url=new URL(value);return url.protocol==="http:"&&url.hostname==="127.0.0.1"&&Number(url.port)>0&&!url.username&&!url.password&&!url.search&&!url.hash&&/^\/account-callback\/[a-f0-9-]{36}$/.test(url.pathname)&&url.href===value}catch{return false}},"Owned loopback account callback required");var proofKey=z4.string().regex(/^[A-Za-z0-9_-]{43}$/);var CliAccountRequestIdSchema=z4.uuid();var CliAccountStartSchema=z4.strictObject({redirectUri:CliAccountRedirectSchema,state:proofKey,codeChallenge:proofKey});var CliAccountStartedSchema=z4.strictObject({requestId:z4.uuid(),expiresAt:z4.iso.datetime()});var CliAccountPreviewSchema=CliAccountStartedSchema.extend({redirectUri:CliAccountRedirectSchema});var CliAccountDecisionSchema=z4.strictObject({requestId:z4.uuid(),approved:z4.boolean(),expectedPrincipalId:z4.uuid()});var CliAccountExchangeSchema=z4.strictObject({requestId:z4.uuid(),code:proofKey,codeVerifier:proofKey,redirectUri:CliAccountRedirectSchema});var CliAccountSessionSchema=ShortHumanSessionSchema.extend({credentialPurpose:z4.literal("CLI_ACCOUNT")});var CliAccountIdentitySchema=z4.strictObject({credentialPurpose:z4.literal("CLI_ACCOUNT"),account:HumanAccountSchema});export{ProductionStateSchema,ProductionSchema,CreateProjectRequestSchema,ProjectSchema,CreatedProjectResultSchema,ProjectLibraryQuerySchema,ProjectLibraryScopeSchema,ProjectLibraryPageSchema,ProjectWorkspaceSchema,SourceLibraryQuerySchema,SourceLibraryItemSchema,SourceLibraryPageSchema,SourceLibraryMediaSchema,StudioInputContentSchema,HumanTenantSchema,CliAccountStartSchema,CliAccountStartedSchema,CliAccountExchangeSchema,CliAccountSessionSchema,CliAccountIdentitySchema};
|