sonilo 0.14.0 → 0.15.0

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/dist/index.d.cts CHANGED
@@ -511,6 +511,50 @@ interface DubbingResult extends BaseTaskResult {
511
511
  */
512
512
  outputs?: Record<string, string>;
513
513
  }
514
+ interface VideoAnalysisParams {
515
+ /** Exactly one of `video` / `videoUrl`. */
516
+ video?: VideoInput;
517
+ /** Exactly one of `video` / `videoUrl`. */
518
+ videoUrl?: string;
519
+ /** Optional guidance for the analysis, at most 2000 characters. */
520
+ prompt?: string;
521
+ /**
522
+ * How many independent creative briefs to author for the same video
523
+ * (1-5, default 1). Billed per brief.
524
+ */
525
+ variantsNum?: number;
526
+ }
527
+ /** One time-aligned section of the analyzed video, with the scoring
528
+ * direction for that stretch. Bounds are whole seconds — the backend
529
+ * truncates any fractional upstream bound before it reaches the envelope. */
530
+ interface AnalysisSegment {
531
+ start: number;
532
+ end: number;
533
+ /** The backend always emits one, defaulting to the string `"none"`. */
534
+ label: string;
535
+ prompt: string;
536
+ }
537
+ /** One independent creative brief for the whole video. Only the generation
538
+ * prompt is public — the upstream's title/summary/tags are internal display
539
+ * copy the API deliberately does not resell. */
540
+ interface AnalysisVariation {
541
+ prompt: string;
542
+ }
543
+ /**
544
+ * The only Sonilo result with no media artifact at all: video-analysis
545
+ * generates nothing and there is nothing to download. The payload is the
546
+ * work order — `segments` for a time-aligned plan, and one `prompt` per
547
+ * requested variation, each ready to pass to videoToMusic, videoToSfx,
548
+ * videoToSound or their video-to-video counterparts.
549
+ *
550
+ * Both lists are optional because a `processing` or `failed` poll carries
551
+ * neither.
552
+ */
553
+ interface VideoAnalysisResult extends BaseTaskResult {
554
+ segments?: AnalysisSegment[];
555
+ variations?: AnalysisVariation[];
556
+ duration_seconds?: number;
557
+ }
514
558
 
515
559
  declare class Account {
516
560
  private readonly client;
@@ -648,6 +692,28 @@ declare class Dubbing {
648
692
  generate(params: DubbingParams, opts?: WaitOptions): Promise<DubbingResult>;
649
693
  }
650
694
 
695
+ /** Analyze a video and get back a creative brief for scoring it. Async only.
696
+ *
697
+ * This endpoint generates nothing — no audio, no video, no artifact to
698
+ * download. The result is the work order: `segments` (a time-aligned section
699
+ * plan) plus one `prompt` per requested variation, each ready to hand
700
+ * straight to videoToMusic, videoToSfx, videoToSound or their
701
+ * video-to-video counterparts.
702
+ *
703
+ * The method is `analyze`, not `generate`, for that reason: every other
704
+ * resource's `generate` returns something you download, and this one never
705
+ * does.
706
+ *
707
+ * The 1-5 bound on `variantsNum` and the 2000-character bound on `prompt`
708
+ * are deliberately not checked here — the backend owns them, and a hardcoded
709
+ * copy would make this SDK reject values a later API widens. */
710
+ declare class VideoAnalysis {
711
+ private readonly client;
712
+ constructor(client: SoniloClient);
713
+ submit(params: VideoAnalysisParams): Promise<SfxTask>;
714
+ analyze(params: VideoAnalysisParams, opts?: WaitOptions): Promise<VideoAnalysisResult>;
715
+ }
716
+
651
717
  interface SoniloClientOptions {
652
718
  /** Defaults to the SONILO_API_KEY environment variable (Node.js only). */
653
719
  apiKey?: string;
@@ -687,6 +753,7 @@ declare class SoniloClient {
687
753
  readonly videoToVideoSound: VideoToVideoSound;
688
754
  readonly audioDucking: AudioDucking;
689
755
  readonly dubbing: Dubbing;
756
+ readonly videoAnalysis: VideoAnalysis;
690
757
  constructor(options?: SoniloClientOptions);
691
758
  /**
692
759
  * Perform an authenticated request; throws a typed error on non-2xx.
@@ -768,6 +835,6 @@ declare class RequestTimeoutError extends SoniloError {
768
835
  declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
769
836
 
770
837
  /** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
771
- declare const VERSION = "0.14.0";
838
+ declare const VERSION = "0.15.0";
772
839
 
773
- export { APIError, type AccountServices, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
840
+ export { APIError, type AccountServices, type AnalysisSegment, type AnalysisVariation, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoAnalysisParams, type VideoAnalysisResult, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
package/dist/index.d.ts CHANGED
@@ -511,6 +511,50 @@ interface DubbingResult extends BaseTaskResult {
511
511
  */
512
512
  outputs?: Record<string, string>;
513
513
  }
514
+ interface VideoAnalysisParams {
515
+ /** Exactly one of `video` / `videoUrl`. */
516
+ video?: VideoInput;
517
+ /** Exactly one of `video` / `videoUrl`. */
518
+ videoUrl?: string;
519
+ /** Optional guidance for the analysis, at most 2000 characters. */
520
+ prompt?: string;
521
+ /**
522
+ * How many independent creative briefs to author for the same video
523
+ * (1-5, default 1). Billed per brief.
524
+ */
525
+ variantsNum?: number;
526
+ }
527
+ /** One time-aligned section of the analyzed video, with the scoring
528
+ * direction for that stretch. Bounds are whole seconds — the backend
529
+ * truncates any fractional upstream bound before it reaches the envelope. */
530
+ interface AnalysisSegment {
531
+ start: number;
532
+ end: number;
533
+ /** The backend always emits one, defaulting to the string `"none"`. */
534
+ label: string;
535
+ prompt: string;
536
+ }
537
+ /** One independent creative brief for the whole video. Only the generation
538
+ * prompt is public — the upstream's title/summary/tags are internal display
539
+ * copy the API deliberately does not resell. */
540
+ interface AnalysisVariation {
541
+ prompt: string;
542
+ }
543
+ /**
544
+ * The only Sonilo result with no media artifact at all: video-analysis
545
+ * generates nothing and there is nothing to download. The payload is the
546
+ * work order — `segments` for a time-aligned plan, and one `prompt` per
547
+ * requested variation, each ready to pass to videoToMusic, videoToSfx,
548
+ * videoToSound or their video-to-video counterparts.
549
+ *
550
+ * Both lists are optional because a `processing` or `failed` poll carries
551
+ * neither.
552
+ */
553
+ interface VideoAnalysisResult extends BaseTaskResult {
554
+ segments?: AnalysisSegment[];
555
+ variations?: AnalysisVariation[];
556
+ duration_seconds?: number;
557
+ }
514
558
 
515
559
  declare class Account {
516
560
  private readonly client;
@@ -648,6 +692,28 @@ declare class Dubbing {
648
692
  generate(params: DubbingParams, opts?: WaitOptions): Promise<DubbingResult>;
649
693
  }
650
694
 
695
+ /** Analyze a video and get back a creative brief for scoring it. Async only.
696
+ *
697
+ * This endpoint generates nothing — no audio, no video, no artifact to
698
+ * download. The result is the work order: `segments` (a time-aligned section
699
+ * plan) plus one `prompt` per requested variation, each ready to hand
700
+ * straight to videoToMusic, videoToSfx, videoToSound or their
701
+ * video-to-video counterparts.
702
+ *
703
+ * The method is `analyze`, not `generate`, for that reason: every other
704
+ * resource's `generate` returns something you download, and this one never
705
+ * does.
706
+ *
707
+ * The 1-5 bound on `variantsNum` and the 2000-character bound on `prompt`
708
+ * are deliberately not checked here — the backend owns them, and a hardcoded
709
+ * copy would make this SDK reject values a later API widens. */
710
+ declare class VideoAnalysis {
711
+ private readonly client;
712
+ constructor(client: SoniloClient);
713
+ submit(params: VideoAnalysisParams): Promise<SfxTask>;
714
+ analyze(params: VideoAnalysisParams, opts?: WaitOptions): Promise<VideoAnalysisResult>;
715
+ }
716
+
651
717
  interface SoniloClientOptions {
652
718
  /** Defaults to the SONILO_API_KEY environment variable (Node.js only). */
653
719
  apiKey?: string;
@@ -687,6 +753,7 @@ declare class SoniloClient {
687
753
  readonly videoToVideoSound: VideoToVideoSound;
688
754
  readonly audioDucking: AudioDucking;
689
755
  readonly dubbing: Dubbing;
756
+ readonly videoAnalysis: VideoAnalysis;
690
757
  constructor(options?: SoniloClientOptions);
691
758
  /**
692
759
  * Perform an authenticated request; throws a typed error on non-2xx.
@@ -768,6 +835,6 @@ declare class RequestTimeoutError extends SoniloError {
768
835
  declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
769
836
 
770
837
  /** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
771
- declare const VERSION = "0.14.0";
838
+ declare const VERSION = "0.15.0";
772
839
 
773
- export { APIError, type AccountServices, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
840
+ export { APIError, type AccountServices, type AnalysisSegment, type AnalysisVariation, type AudioChunkEvent, type AudioDuckingParams, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type DuckingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoAnalysisParams, type VideoAnalysisResult, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type VideoToVideoSoundParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
package/dist/index.js CHANGED
@@ -750,8 +750,40 @@ var Dubbing = class {
750
750
  }
751
751
  };
752
752
 
753
+ // src/resources/videoAnalysis.ts
754
+ var VideoAnalysis = class {
755
+ constructor(client) {
756
+ this.client = client;
757
+ }
758
+ async submit(params) {
759
+ if (params.video === void 0 === (params.videoUrl === void 0)) {
760
+ throw new SoniloError("Provide exactly one of video or videoUrl");
761
+ }
762
+ const form = new FormData();
763
+ if (params.video !== void 0) {
764
+ const { blob, filename } = await toUploadBlob(params.video);
765
+ form.set("video", blob, filename);
766
+ } else {
767
+ form.set("video_url", params.videoUrl);
768
+ }
769
+ if (params.prompt !== void 0) form.set("prompt", params.prompt);
770
+ if (params.variantsNum !== void 0) {
771
+ form.set("variants_num", String(params.variantsNum));
772
+ }
773
+ const res = await this.client.request("/v1/video-analysis", {
774
+ method: "POST",
775
+ body: form
776
+ });
777
+ return await res.json();
778
+ }
779
+ async analyze(params, opts) {
780
+ const task = await this.submit(params);
781
+ return this.client.tasks.wait(task.task_id, opts);
782
+ }
783
+ };
784
+
753
785
  // src/version.ts
754
- var VERSION = "0.14.0";
786
+ var VERSION = "0.15.0";
755
787
 
756
788
  // src/client.ts
757
789
  var DEFAULT_BASE_URL = "https://api.sonilo.com";
@@ -784,6 +816,7 @@ var SoniloClient = class {
784
816
  this.videoToVideoSound = new VideoToVideoSound(this);
785
817
  this.audioDucking = new AudioDucking(this);
786
818
  this.dubbing = new Dubbing(this);
819
+ this.videoAnalysis = new VideoAnalysis(this);
787
820
  }
788
821
  /**
789
822
  * Perform an authenticated request; throws a typed error on non-2xx.