@koda-sl/baker-cli 0.401.0 → 0.403.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/README.md CHANGED
@@ -2670,7 +2670,7 @@ baker images ingest https://images.pexels.com/photos/13219418/pexels-photo-13219
2670
2670
  baker images ingest https://acme.com/hero.png --source firecrawl --external-url https://acme.com/pricing --context "competitor pricing hero"
2671
2671
  ```
2672
2672
 
2673
- `--source` is a closed set, validated before the request so a wrong value costs nothing: `uploaded`, `website`, `google_testimonial`, `trustpilot_testimonial`, `instagram`, `pexels`, `pixabay`, `magnific` (retired provider, kept for existing rows), `brandfetch`, `google_images`, `firecrawl`, `screenshotone`, `iconify`, `giphy`, `pinterest`, `ai_generated`, `layer_edit`. Use `website` for an asset pulled off a company's own site.
2673
+ `--source` is a closed set, validated before the request so a wrong value costs nothing: `uploaded`, `website`, `google_testimonial`, `trustpilot_testimonial`, `instagram`, `tiktok`, `linkedin`, `facebook`, `pexels`, `pixabay`, `magnific` (retired provider, kept for existing rows), `brandfetch`, `google_images`, `firecrawl`, `screenshotone`, `iconify`, `giphy`, `pinterest`, `ai_generated`, `layer_edit`. Use `website` for an asset pulled off a company's own site.
2674
2674
 
2675
2675
  Returns `{ imageId, deduped, contentHash }`. When `deduped: true`, an existing library row is returned — no new bytes are stored. Max ingest size 25MB.
2676
2676
 
@@ -3004,7 +3004,7 @@ Re-ingesting the same link returns the existing row with `deduped: true` instead
3004
3004
 
3005
3005
  | Flag | Purpose |
3006
3006
  |---|---|
3007
- | `--source` | Provenance. Inferred from the link's host when omitted, and that inference covers 20 video platforms — `youtube`, `instagram`, `tiktok`, `twitter`, `facebook`, `reddit`, `vimeo`, `dailymotion`, `twitch`, `bluesky`, `bilibili`, `vk`, `ok`, `pinterest`, `tumblr`, `snapchat`, `loom`, `streamable`, `newgrounds`, `rutube` — plus `uploaded` and `url`. A link from anywhere else still ingests, recorded as `url`. |
3007
+ | `--source` | Provenance. Inferred from the link's host when omitted, and that inference covers 21 video platforms — `youtube`, `instagram`, `tiktok`, `twitter`, `facebook`, `linkedin`, `reddit`, `vimeo`, `dailymotion`, `twitch`, `bluesky`, `bilibili`, `vk`, `ok`, `pinterest`, `tumblr`, `snapchat`, `loom`, `streamable`, `newgrounds`, `rutube` — plus `uploaded` and `url`. A link from anywhere else still ingests, recorded as `url`. |
3008
3008
  | `--external-id` | Dedupe key — re-running the same link returns the existing video. Derived from the link automatically on the download route. |
3009
3009
  | `--external-url` | Canonical page URL. Defaults to the input for a page URL. |
3010
3010
  | `--download` | Skip the direct attempt and always download. |
@@ -3036,6 +3036,16 @@ Requires `yt-dlp` on `PATH` (present in the Baker Runtime). Private, age-restric
3036
3036
 
3037
3037
  **yt-dlp goes stale, and that looks like a broken video.** Large platforms change their players every few weeks and an out-of-date `yt-dlp` then resolves *no* formats at all, failing with "Requested format is not available" or "Only images are available" rather than anything that names the real cause. The error classifies this case separately and says the link is probably fine. The Runtime image installs `yt-dlp` unpinned at build time (`packages/e2b-template/src/template.ts`), so it ages with the image — if platform ingests start failing across the board, rebuild the template before investigating anything else. Direct file URLs don't depend on `yt-dlp` at all and keep working regardless.
3038
3038
 
3039
+ ### `baker videos fetch <url> --out <dir>`
3040
+
3041
+ Download a video page (YouTube, TikTok, Vimeo, …) to a local `.mp4` without adding it to the library — the download half of `ingest`, with the same proxy fallback and duration check. `--max-seconds` lowers the length limit (default 3 hours); `--timeout-ms` bounds the download. By default it keeps the best quality the site offers; `--max-height 1080` keeps a version whose shorter side is at most that when there is one (a vertical Short keeps its 1080×1920) (a 4K master can be five times the bytes). Returns `{ file, durationSeconds, egress }`. The file is named after the video (e.g. `youtube-abc123.mp4`), so several fetches can share one folder; an existing file is never overwritten — a second copy gets a `-2` suffix. Nothing else is left in the folder.
3042
+
3043
+ ```bash
3044
+ baker videos fetch https://www.youtube.com/watch?v=abc123 --out ./clips
3045
+ ```
3046
+
3047
+ Baker's YouTube source sync runs this same command on a disposable machine, with `--max-height 1080`, because a YouTube file URL only works from the IP that requested it.
3048
+
3039
3049
  ### `baker videos delete <id>`
3040
3050
 
3041
3051
  Delete a video by ID.
@@ -3189,6 +3199,32 @@ baker avatars delete marta --archive
3189
3199
 
3190
3200
  ---
3191
3201
 
3202
+ ### Media Sources (`baker media-sources`)
3203
+
3204
+ Connect a public social account so its posts fill the image and video libraries: **Instagram**, **TikTok**, **YouTube** (videos and Shorts only), **LinkedIn** company pages and **Facebook** pages — or a **Google Drive folder** the user picks from the company's Google Drive connection. Each social sync reaches back up to a year, stops paging at the first page it already has, imports only what the library doesn't have yet, keeps carousels/albums/documents together as a set (`images group` / `videos group`), and passes the post caption to the analysis. A source is named by its key, `<platform>:<handle>`.
3205
+
3206
+ Connecting and removing apply immediately and show on the chat as an already-applied change.
3207
+
3208
+ | Command | What it does |
3209
+ |---|---|
3210
+ | `baker media-sources add <profile URL \| @handle> [--platform <p>] [--every never\|daily\|weekly\|monthly]` | Look the account up (must exist and be public) and connect it; the import starts in the background. `--platform` only for a bare handle. Idempotent. |
3211
+ | `baker media-sources list` | Every source: key, platform, label, auto-sync, and per library `{ status, stored, pending?, failed?, error? }`. |
3212
+ | `baker media-sources sync <key>` | Import new posts now. |
3213
+ | `baker media-sources schedule <key> --every <interval>` | Set the auto-sync cadence. |
3214
+ | `baker media-sources remove <key>` | Disconnect; imported media stays in the library. |
3215
+
3216
+ ```bash
3217
+ baker media-sources add https://www.tiktok.com/@acme
3218
+ baker media-sources add @acme --platform instagram --every daily
3219
+ baker media-sources list
3220
+ ```
3221
+
3222
+ YouTube downloads are the expensive import (a disposable machine per batch), so a YouTube sync takes the newest 25 videos it hasn't stored, skips videos over 20 minutes, and continues with older ones on the next sync.
3223
+
3224
+ A Google Drive folder is never added with `add`: the agent calls `request_connection` with `platform: "google-drive"` and `choose: "media-folder"`, and the user picks the folder in the chat card (or in Baker, Add source → Google Drive) — only the Baker team can for now. `add <drive link>` is refused with that `error.fix`; the card's result carries the new source's `mediaSourceKey`. Once connected it is managed by key like any source. Everything in it and its subfolders is imported in batches of 150 images and 20 videos (60 minutes / 5 GB at most each), new files arrive with each scheduled sync (weekly unless changed), and images are stored resized to 2560 px. Imported images from every source are resized the same way.
3225
+
3226
+ ---
3227
+
3192
3228
  ### Winning Ads (`baker winning-ads`)
3193
3229
 
3194
3230
  Search the **ad-dna** corpus of scored "winning" competitor ads for reference creatives to reproduce (e.g. with `baker canvas`), and manage the brands your library tracks (`follow` / `following` / `feed` / `unfollow`). Each result carries a presigned media URL (~1h TTL), the ad's DNA summary, and scores. The CLI authenticates with the normal `BAKER_API_KEY`; the Baker backend proxies the request to the ad-dna service with a server-held token — no extra credential in the sandbox.
@@ -6990,6 +6990,12 @@ function isVimeoAuthFailure(detail) {
6990
6990
  return VIMEO_AUTH_SIGNATURES.some((signature) => haystack.includes(signature));
6991
6991
  }
6992
6992
 
6993
+ // src/lib/ytDlpFormat.ts
6994
+ function videoFormatArgs(maxResolution) {
6995
+ const sort = maxResolution ? ["-S", `res:${maxResolution}`] : [];
6996
+ return ["--format", "bv*+ba/b", ...sort, "--merge-output-format", "mp4"];
6997
+ }
6998
+
6993
6999
  // src/lib/ytDlpPlayerClient.ts
6994
7000
  var YOUTUBE_FALLBACK_CLIENT_ARGS = ["--extractor-args", "youtube:player_client=android"];
6995
7001
  var MEDIA_FETCH_REFUSED = "unable to download video data";
@@ -7058,7 +7064,7 @@ async function runYtDlp(args) {
7058
7064
  if (args.audioOnly) {
7059
7065
  argv.push("-x", "--audio-format", "m4a");
7060
7066
  } else {
7061
- argv.push("--format", "bv*+ba/b", "--merge-output-format", "mp4");
7067
+ argv.push(...videoFormatArgs(args.maxHeight));
7062
7068
  }
7063
7069
  const cookieFile = await writeVimeoCookieFile(args.vimeoCookie, args.workDir);
7064
7070
  if (cookieFile) argv.push("--cookies", cookieFile);
@@ -11654,4 +11660,4 @@ export {
11654
11660
  defaultRegistry,
11655
11661
  createEngineFromEnv
11656
11662
  };
11657
- //# sourceMappingURL=chunk-U4OKU5EF.js.map
11663
+ //# sourceMappingURL=chunk-X7PLV5QH.js.map