Skip to content

feat: videoAnalysis resource and CLI command - #55

Merged
spencer-zqian merged 1 commit into
mainfrom
feat/video-analysis
Aug 17, 2026
Merged

feat: videoAnalysis resource and CLI command#55
spencer-zqian merged 1 commit into
mainfrom
feat/video-analysis

Conversation

@spencer-zqian

Copy link
Copy Markdown
Contributor

Propagates POST /v1/video-analysis to the core client and the CLI.

What's new

  • client.videoAnalysis.submit() / .analyze(), taking exactly one of video / videoUrl plus optional prompt and variantsNum.
  • New exported types: VideoAnalysisParams, VideoAnalysisResult, AnalysisSegment, AnalysisVariation.
  • sonilo video-analysis --video clip.mp4 --prompt ... --variants 2.

Why the surface differs from every other endpoint

video-analysis is the first Sonilo product whose result is not media: it generates nothing and there is no file to download. The result is a work order — a time-aligned segments plan plus one prompt per requested variation, each ready to hand straight to videoToMusic, videoToSfx, videoToSound or their video-to-video counterparts.

So:

  • the method is analyze(), not generate(), and VideoAnalysisResult carries no download helper;
  • the CLI prints the brief to stdout as JSON so it can be piped into the next command, and writes a file only when --output asks for one.

Notes

  • segments and variations are both optional on the result type: a processing or failed poll carries neither, so callers guard with ?? [].
  • The 1-5 variantsNum bound and the 2000-char prompt bound are not re-checked client-side; the backend owns them.
  • changeset status bumps only sonilo and sonilo-cli at minor — sonilo-video-kit is untouched.

Testing

npm test -w sonilo (195), npm test -w sonilo-cli (162), npm run lint — all green. 10 new tests cover the request builder, file upload, polling, arg parsing, and both CLI output paths.

Note on ordering

This branch is based on origin/main and does not include #54's changeset. If #54 merges first, both changesets land in the same Version Packages PR, which is what you want — otherwise the whoami fix ships unversioned again.

Propagates POST /v1/video-analysis to the core client and the CLI.

video-analysis is the first Sonilo product whose result is not media: it
generates nothing and there is no file to download. The result is a work
order — a time-aligned `segments` plan plus one `prompt` per requested
variation, each ready to hand straight to videoToMusic, videoToSfx,
videoToSound or their video-to-video counterparts.

That shapes the surface in two places:

- The resource method is `analyze()`, not `generate()`, and
  VideoAnalysisResult carries no download helper. Every other resource
  returns something you save; this one never does, so persisting the brief
  is the caller's business.
- The CLI prints the brief to stdout as JSON so it can be piped into the
  next command, and writes a file only when --output asks for one. Every
  other command's default is a media file on disk.

`segments` and `variations` are both optional on the result type because a
processing or failed poll carries neither — callers guard with `?? []`
rather than asserting them.

The 1-5 variantsNum bound and the 2000-char prompt bound are deliberately
not re-checked client-side — the backend owns them, and a hardcoded copy
would make this SDK reject values a later API widens.
@sapient-app

sapient-app Bot commented Aug 17, 2026

Copy link
Copy Markdown

Lightsage docs evals

Waiting for the staging docs URL before running evals.

Lightsage will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes.

Commit: 0c113bc
Status: waiting for staging docs URL

@spencer-zqian
spencer-zqian merged commit a01f3fe into main Aug 17, 2026
1 check passed
@spencer-zqian
spencer-zqian deleted the feat/video-analysis branch August 17, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant