Skip to content

feat(skills): add Atlas Cloud media generation - #99

Open
binyangzhu000-sudo wants to merge 2 commits into
spinabot:mainfrom
binyangzhu000-sudo:codex/atlas-cloud-media-skill
Open

binyangzhu000-sudo wants to merge 2 commits into
spinabot:mainfrom
binyangzhu000-sudo:codex/atlas-cloud-media-skill

Conversation

@binyangzhu000-sudo

@binyangzhu000-sudo binyangzhu000-sudo commented Aug 12, 2026 •

Copy link
Copy Markdown

Summary

  • Add a bundled Atlas Cloud media skill for executable image and video generation.
  • Submit asynchronous predictions, use bounded polling, validate HTTPS output URLs, and download media without forwarding API credentials.
  • Provide model overrides, model-specific parameters, safe 64 MiB downloads, documentation, and offline contract tests.

Related issues

None.

Type of change

  • fix — bug fix
  • feat — new feature
  • docs — documentation only
  • refactor / perf / test / chore / ci

Checklist

  • npm run typecheck passes
  • npm test passes
  • npm run build compiles
  • Added/updated tests for the change
  • No secrets, real personal data, or local absolute paths in the diff
  • PR title follows Conventional Commits

Notes for reviewers

  • The focused skill validation and 4 Python contract tests pass.
  • Real Atlas Cloud calls generated a 1024x1024 PNG with qwen-image-3.0/text-to-image and a valid MP4 with bytedance/seedance-2.0-fast/text-to-video; generated media is not committed.
  • The full test command emitted 998 passing assertions and no not ok result, but did not exit after more than seven minutes because the suite retained a Node handle, so the full-suite checkbox remains unchecked.
  • The implementation uses only the Python standard library and does not add runtime dependencies.

Signed-off-by: binyangzhu000-sudo <224954946+binyangzhu000-sudo@users.noreply.github.com>

@Bhasvanth-Dev9380 Bhasvanth-Dev9380 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks a lot for this! I went through it properly and the Atlas Cloud
integration is solid. I checked the endpoints, the model IDs, the response
shape and the size format against their docs and you got all of it right.

One request before we merge: would you be up for rewriting it in TypeScript?

The reason is just that Brigade pins Node >= 22.12, so Node is there on every
install, but Python isn't guaranteed. If someone doesn't have python3, the skill
quietly disappears from the agent's list and they never find out why. And where
python3 does exist it's often 3.9 (macOS system python), which is where your
timeout handling has a small gap.

There's already a node example in the repo if it helps:
skills/sherpa-onnx-tts/bin/sherpa-onnx-tts.

The other nice part is that a TS version lifts almost straight into
generate-video-tool.ts as a proper provider later — same fetch/Buffer idioms —
so the work would count twice instead of being rewritten.

Two small things worth carrying over while you're in there:

  • The download only checks Content-Length against the 64 MiB cap, not against
    bytes actually received, so a truncated download currently saves a partial
    file and reports success.
  • The poll ceiling works out to 5 minutes (150 x 2s), but your SKILL.md says
    video can take several minutes — ours is 12. Also worth printing the
    prediction id on timeout so a paid generation isn't lost.

Happy to merge once it's in TS. And if you have any thoughts on this, or you
think I'm wrong somewhere, please do get back — I'd rather hear it than have you
just go along with it. Really appreciate the effort you put in here.

Replace the Python script with a dependency-free Node ESM script so the skill
no longer depends on python3 being installed.

- Reject downloads whose received bytes differ from Content-Length (no partial
  file is saved) and clean up temp files on every failure path.
- Raise the polling ceiling to a 12 minute wall-clock default
  (--timeout) and print the prediction id on timeout or download failure.
- Add --resume <prediction-id> to fetch an already-paid generation.
- Port the contract tests to node:test under src/agents/skills.

Signed-off-by: binyangzhu000-sudo <224954946+binyangzhu000-sudo@users.noreply.github.com>
@binyangzhu000-sudo

Copy link
Copy Markdown
Author

Thanks @Bhasvanth-Dev9380, this is a fair point and I agree. Pushed a rewrite.

  • ✅ Node instead of Python. scripts/generate.py is replaced by scripts/generate.mjs (plain ESM, Node built-ins and global fetch, no dependencies), invoked as node {baseDir}/scripts/generate.mjs .... I dropped python3 from requires.bins, so the skill no longer disappears when Python is missing. One note on "TypeScript": skills ship as-is with no build step (like sherpa-onnx-tts), so the script itself is plain .mjs rather than .ts; the tests are TypeScript (src/agents/skills/atlas-cloud-media.test.ts, node:test) and run under npm test. It uses the same fetch/Buffer idioms, so lifting it into generate-video-tool.ts later should be straightforward. If you would rather have the logic as a real .ts module under src/ that the skill calls via dist/, I am happy to restructure it that way.
  • ✅ Truncated downloads. The body is now streamed to a temp file and the received byte count is compared with Content-Length (skipped only when a content-encoding is applied, since the header then counts encoded bytes). A mismatch fails with truncated: received N of M bytes and nothing is saved. The 64 MiB cap is still enforced on both the declared and the received size, and the temp file is removed on every failure path. Covered by tests.
  • ✅ Poll ceiling. It is now a wall-clock limit, 12 minutes by default (--timeout <seconds>), instead of 150 x 2s.
  • ✅ Prediction id on timeout. The timeout error, a failed-generation error, and a download failure after completion all include the prediction id. I also added --resume <prediction-id> so the id is actually useful: it skips submission, waits, and downloads.

Verified locally: typecheck passes; the 13 new tests pass; npm run build succeeds; a live run of the new script with the default image model against the real gateway produced a 1024x1024 PNG (file confirms), and a missing or invalid key gives a clear error and exit code 1. Not re-run this time: a live video generation (the video path shares the same submit/poll/download code and is unit-tested, but I did not spend another paid video job), and the full npm test (it was not exiting for me earlier; the existing src/agents/skills suite has 3 discovery failures that are identical with and without this change).

This branch has not been deployed

No deployments
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.

2 participants