@koda-sl/baker-cli 0.121.0-dev.3b02f951b → 0.121.0-dev.3bcc79f9c
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 +11 -83
- package/dist/{chunk-7WLX7E7H.js → chunk-GQIOFHVI.js} +43 -142
- package/dist/chunk-GQIOFHVI.js.map +1 -0
- package/dist/cli.js +2309 -4206
- package/dist/cli.js.map +1 -1
- package/dist/engine/index.d.ts +0 -1
- package/dist/engine/index.js +1 -2
- package/package.json +1 -1
- package/dist/chunk-5WRI5ZAA.js +0 -31
- package/dist/chunk-5WRI5ZAA.js.map +0 -1
- package/dist/chunk-7WLX7E7H.js.map +0 -1
- package/dist/chunk-AVJ3B6LC.js +0 -97
- package/dist/chunk-AVJ3B6LC.js.map +0 -1
- package/dist/chunk-ISFSUDEQ.js +0 -264
- package/dist/chunk-ISFSUDEQ.js.map +0 -1
- package/dist/chunk-K47Q73CK.js +0 -156
- package/dist/chunk-K47Q73CK.js.map +0 -1
- package/dist/chunk-YTEAWSEM.js +0 -39
- package/dist/chunk-YTEAWSEM.js.map +0 -1
- package/dist/client-PGOTU24X.js +0 -15
- package/dist/client-PGOTU24X.js.map +0 -1
- package/dist/env-TD4VXCQ7.js +0 -10
- package/dist/env-TD4VXCQ7.js.map +0 -1
- package/dist/output-2LGBISBQ.js +0 -18
- package/dist/output-2LGBISBQ.js.map +0 -1
- package/dist/shared-CQC3YRBA.js +0 -23
- package/dist/shared-CQC3YRBA.js.map +0 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Use `--output` to change format:
|
|
|
82
82
|
|
|
83
83
|
### Ad Platforms (`baker ads`)
|
|
84
84
|
|
|
85
|
-
Multi-platform ad commands.
|
|
85
|
+
Multi-platform ad data commands. Currently supports Google Ads, with Meta, LinkedIn, and TikTok coming.
|
|
86
86
|
|
|
87
87
|
---
|
|
88
88
|
|
|
@@ -687,39 +687,18 @@ baker ads google ads create --customer-id 1234567890 --ad-group-ref g_temp_<adgr
|
|
|
687
687
|
--headlines "Come back and save" --long-headline "Finish signing up and get 20% off" \
|
|
688
688
|
--descriptions "Fast setup, no card required" --business-name "Acme" --final-url https://example.com \
|
|
689
689
|
--marketing-images g_temp_<img_landscape> --square-marketing-images g_temp_<img_square> --logo-images g_temp_<img_logo>
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
baker ads google ads create --customer-id 1234567890 --ad-group-ref g_temp_<adgroup> --format video \
|
|
693
|
-
--video-assets g_temp_<video> --final-url https://example.com
|
|
694
|
-
# Demand Gen ad — image refs the same way
|
|
695
|
-
baker ads google ads create --customer-id 1234567890 --ad-group-ref g_temp_<adgroup> --format demandGen \
|
|
696
|
-
--headlines "Discover the app" --descriptions "Try it free today" --business-name "Acme" --final-url https://example.com \
|
|
697
|
-
--image-assets g_temp_<img> --square-image-assets g_temp_<img_square> --logo-image-assets g_temp_<img_logo>
|
|
698
|
-
# Update a staged/live asset in place (flat partial — set only what changed)
|
|
699
|
-
baker ads google assets update <assetId> --customer-id 1234567890 --link-text "New sitelink text" --final-urls https://example.com/new
|
|
700
|
-
|
|
701
|
-
# Performance Max — PMax has no ad format of its own; its copy/images stage as an asset group
|
|
702
|
-
baker ads google campaigns create --customer-id 1234567890 --name "PMax — Full Funnel" --channel-type PERFORMANCE_MAX --budget-ref g_temp_<budget>
|
|
703
|
-
baker ads google asset-groups create --customer-id 1234567890 --campaign-ref g_temp_<campaign> --name "Core" \
|
|
704
|
-
--headlines "Fast Widgets,Buy Online,Free Shipping" --long-headlines "The widget everyone is talking about" \
|
|
705
|
-
--descriptions "Best widgets around.,Ships tomorrow." --business-name "Acme" --final-urls https://example.com
|
|
706
|
-
baker ads google asset-groups update g_temp_<assetgroup> --status ENABLED
|
|
707
|
-
|
|
708
|
-
# Review / undo / amend staged changes
|
|
690
|
+
|
|
691
|
+
# Review / undo staged changes
|
|
709
692
|
baker ads google draft list # readable campaign ▸ ad group ▸ ad tree + completeness advisories
|
|
710
693
|
baker ads google draft list --json # raw JSON envelope for scripting
|
|
711
|
-
baker ads google draft show g_temp_ab12 # full staged payload — the receipt before publish
|
|
712
|
-
baker ads google draft amend g_temp_ab12 --patch '{"amountMicros": 60000000}' # update in place, never remove+recreate
|
|
713
694
|
baker ads google draft remove g_temp_ab12 # cascades to dependents
|
|
714
695
|
baker ads google draft clear
|
|
715
696
|
```
|
|
716
697
|
|
|
717
|
-
Command groups: `budgets`, `campaigns`, `ad-groups`, `keywords` (add/update/remove), `negative-keywords`, `keyword-lists`, `ads`, `assets
|
|
698
|
+
Command groups: `budgets`, `campaigns`, `ad-groups`, `keywords` (add/update/remove), `negative-keywords`, `keyword-lists`, `ads`, `assets`, `audiences`, `conversions`, `bidding-strategies`, `labels`, `campaign-criteria`, and `draft`. Amounts are in major currency units (converted to micros). Money/bids: `--amount`, `--cpc-bid`, `--target-cpa` take major units; `--target-roas` a ratio. Less-common ops accept a `--file <payload.json>` (flags override file keys). Updates target a resource name or bare id as the positional argument; a target that names an op staged earlier **amends it in place**.
|
|
718
699
|
|
|
719
700
|
**Reviewing the draft** — `baker ads google draft list` renders everything you've staged as a grouped campaign ▸ ad group ▸ ad tree (with the simulated/live mode banner and non-blocking completeness advisories), the CLI counterpart to the dashboard's Google Ads tab. Pass `--json` for the raw envelope. Aim for a fully built campaign — 2–4 ad groups, ≥5 keywords each, 2–4 RSAs with 8–12 headlines, ≥4 sitelinks / ≥3 callouts / ≥1 structured snippet, and ≥1 shared negative list; the advisories flag what's still thin.
|
|
720
701
|
|
|
721
|
-
**Amending a staged op** — `draft amend <ref> (--file patch.json | --patch '<json>')` merges a JSON patch into an already-staged op's payload (objects deep-merge, `null` deletes a key, arrays/scalars replace) and re-validates it in full. Always prefer this over removing and re-staging — it preserves the op's ref (so dependents don't break) and its position in the draft. `draft show <ref>` prints the full staged payload (including warnings/annotations) so you can verify a change looks right before publish.
|
|
722
|
-
|
|
723
702
|
**Batch keyword adds** — `keywords add`, `negative-keywords add`, and `keyword-lists add` take a whole batch in one command: comma-separate `--text` entries and/or pass `--file <list.txt>` (one keyword per line). A `:EXACT`/`:PHRASE`/`:BROAD` suffix per entry overrides the `--match-type` default. Batches stage all-or-nothing as one request (limit 500); each keyword still lands as its own draft op, so it stays individually removable/amendable.
|
|
724
703
|
|
|
725
704
|
---
|
|
@@ -883,36 +862,6 @@ baker ads meta pixels --account-id act_123
|
|
|
883
862
|
baker ads meta pixels --pixel-id 9988 --stats --days 7
|
|
884
863
|
```
|
|
885
864
|
|
|
886
|
-
#### Staged writes (`baker ads meta campaigns|adsets|ads|creatives|audiences|media|draft`)
|
|
887
|
-
|
|
888
|
-
Meta writes mirror the Google/LinkedIn model: they **never hit the Graph API when you run them**. Each op is validated at stage time (field shapes, budget rules, page/Instagram identity ownership, CBO/ABO exclusivity, status-transition legality), shows in the dashboard chat as a pending Meta change, and applies only when the chat is published. Meta has no atomic batch mutate, so ops apply **sequentially** on publish — one failure skips its dependents but the publish completes.
|
|
889
|
-
|
|
890
|
-
If the company's `metaAdsWriteEnabled` flag is off (the default), publish runs the identical lifecycle **simulated** — fake `sim_meta_*` ids, zero Meta calls. The stage response and `baker ads meta draft` show `mode: "simulated"`.
|
|
891
|
-
|
|
892
|
-
Chain a full ad from scratch with `meta_temp_*` refs (each create returns one):
|
|
893
|
-
|
|
894
|
-
```bash
|
|
895
|
-
# 1. (optional) upload creative media from the Baker library → publishes an image hash
|
|
896
|
-
baker ads meta media upload --account-id act_123 --kind image --image-id <bakerImageId> # → meta_temp_img
|
|
897
|
-
|
|
898
|
-
# 2. campaign → ad set → creative → ad
|
|
899
|
-
baker ads meta campaigns create --account-id act_123 --name "Q3 Prospecting" --objective OUTCOME_LEADS --daily-budget 50 # → meta_temp_camp
|
|
900
|
-
baker ads meta adsets create --account-id act_123 --campaign meta_temp_camp --name "US 25-54" \
|
|
901
|
-
--optimization-goal OFFSITE_CONVERSIONS --billing-event IMPRESSIONS --pixel-id 111 --custom-event-type LEAD \
|
|
902
|
-
--targeting-file targeting.json # → meta_temp_as
|
|
903
|
-
baker ads meta creatives create --account-id act_123 --page 555 --instagram-user 777 \
|
|
904
|
-
--message "Save money on pet insurance" --link https://example.com --headline "Best cover" \
|
|
905
|
-
--image-ref meta_temp_img --cta SHOP_NOW --standard-enhancements on # → meta_temp_cr
|
|
906
|
-
baker ads meta ads create --account-id act_123 --name "Ad 1" --adset meta_temp_as --creative meta_temp_cr
|
|
907
|
-
|
|
908
|
-
# review + edit before publish
|
|
909
|
-
baker ads meta draft
|
|
910
|
-
baker ads meta draft remove meta_temp_cr # removing a create cascades to dependents
|
|
911
|
-
baker ads meta draft clear
|
|
912
|
-
```
|
|
913
|
-
|
|
914
|
-
Status changes are `pause|resume|archive` subcommands on `campaigns`/`adsets`/`ads`. `duplicate` reconstructs a paused copy from the live snapshot (`--replace` also pauses the original once the copy publishes). Carousel/dynamic creatives and complex targeting go via `--file` (creativeType `carousel`/`dynamic`; full Meta targeting spec). Advantage+ Creative enhancements: `--standard-enhancements on|off`, or per-feature toggles via a `--file` `enhancements.features` map.
|
|
915
|
-
|
|
916
865
|
#### Smart defaults (so agents don't enumerate the API)
|
|
917
866
|
|
|
918
867
|
**`insights`** — the workhorse:
|
|
@@ -960,7 +909,7 @@ The HTTP backend exposes more endpoints (catalogs, ad-studies, ad-images, labels
|
|
|
960
909
|
|
|
961
910
|
- `spend` is a decimal string in account currency, not an integer.
|
|
962
911
|
- `effective_status` ≠ `status`. The dashboard shows effective_status (e.g. `WITH_ISSUES`, `PENDING_REVIEW`, `DISAPPROVED`, `ADSET_PAUSED`).
|
|
963
|
-
- Meta creatives are effectively immutable once attached. Editing copy/image/CTA =
|
|
912
|
+
- Meta creatives are effectively immutable once attached. Editing copy/image/CTA = create a new creative + reattach (writes are out of scope for now).
|
|
964
913
|
- Currency offsets are non-uniform (JPY/KRW = 1, KWD/BHD = 1000, most = 100). Read `account.currency` before doing budget math.
|
|
965
914
|
|
|
966
915
|
---
|
|
@@ -1075,7 +1024,7 @@ creatives create|update|pause|resume|duplicate
|
|
|
1075
1024
|
audiences create|upload
|
|
1076
1025
|
conversions create|update
|
|
1077
1026
|
lead-forms create|update
|
|
1078
|
-
draft [
|
|
1027
|
+
draft [remove <ref> | clear] # review/undo staged write ops
|
|
1079
1028
|
```
|
|
1080
1029
|
|
|
1081
1030
|
#### Staged writes
|
|
@@ -1118,21 +1067,10 @@ baker ads linkedin creatives duplicate 1458413484 --headline "New headline" --re
|
|
|
1118
1067
|
# Amend staged ops in place — `update <li_temp_ref>` merges into the staged create and re-validates
|
|
1119
1068
|
baker ads linkedin creatives update li_temp_x3 --headline "Sharper headline" --image-id <bakerImageId>
|
|
1120
1069
|
baker ads linkedin campaigns update li_temp_x2 --daily-budget 100 --currency EUR
|
|
1121
|
-
# --campaign re-parents a staged creative to a different ad set (rejected once the creative is live)
|
|
1122
|
-
baker ads linkedin creatives update li_temp_x3 --campaign li_temp_x2
|
|
1123
|
-
# campaigns update passes --group/--type/--locale/--associated-entity through when the target is li_temp_*
|
|
1124
|
-
# (they're create-only once live) — so amending a staged campaign can still change its group or type
|
|
1125
|
-
baker ads linkedin campaigns update li_temp_x2 --group li_temp_x1_alt
|
|
1126
1070
|
# A second update to the same real URN also merges into the already-staged update op.
|
|
1127
1071
|
|
|
1128
|
-
# Generic amend — merge a JSON patch into ANY staged op's payload (objects deep-merge, null deletes
|
|
1129
|
-
# a key, arrays/scalars replace); always prefer this over remove + re-create
|
|
1130
|
-
baker ads linkedin draft amend li_temp_x2 --patch '{"dailyBudget": {"amount": "100"}}'
|
|
1131
|
-
baker ads linkedin draft show li_temp_x2 # full staged payload — the receipt before publish
|
|
1132
|
-
|
|
1133
1072
|
# Review / undo before publish; after publish shows per-op results (applied/simulated/failed/skipped)
|
|
1134
|
-
baker ads linkedin draft
|
|
1135
|
-
baker ads linkedin draft list --json # raw JSON envelope for scripting
|
|
1073
|
+
baker ads linkedin draft
|
|
1136
1074
|
baker ads linkedin draft remove li_temp_x2 # removing a create cascades to dependents
|
|
1137
1075
|
baker ads linkedin draft clear
|
|
1138
1076
|
```
|
|
@@ -1142,7 +1080,7 @@ Notes:
|
|
|
1142
1080
|
- All write commands take `--file <json>` payloads; explicit flags override file keys. `baker schema ads.linkedin.campaigns.create` for exact args.
|
|
1143
1081
|
- Money flags (`--bid`, `--daily-budget`, `--total-budget`) require `--currency`.
|
|
1144
1082
|
- Creative media comes from the Baker library (`--image-id`/`--video-id` from `baker images`/`baker videos` — uploaded to LinkedIn at publish) or as LinkedIn URNs (`--image-urn`/`--video-urn`). Formats: `image|video|text|spotlight|follower|document|carousel|conversation|tla|jobs`; complex formats take `--file` with the full content object; conversation ads take `--file` with the message flow (`{message: {subject, body, senderName?, buttons[]}}` — buttons `NESTED` (with `nestedMessage`) or `LANDING_PAGE` (with `landingPageUrl`), ≤25 messages, bodies ≤500 chars, labels ≤25). Limits: headline ≤70, text-ad 25/75, intro soft-truncates at 600 chars. TLA sponsors an existing post via `--post-urn`.
|
|
1145
|
-
- Lead forms are file-first (`lead-forms create --file form.json`)
|
|
1083
|
+
- Lead forms are file-first (`lead-forms create --file form.json`): name, headline (≤60), privacyPolicyUrl, questions[] (≤12; playbook: ≤4 for completion).
|
|
1146
1084
|
|
|
1147
1085
|
#### `audit` — playbook diagnostic
|
|
1148
1086
|
|
|
@@ -2916,7 +2854,7 @@ Pick a `source` discriminator and declare the kind you expect. See [Ingestion](#
|
|
|
2916
2854
|
|
|
2917
2855
|
**Outputs:** `asset` → `<params.expect>` / content-determined (URL strategy table) or extension-inferred (path).
|
|
2918
2856
|
|
|
2919
|
-
**Path-source notes:** the canvas is **not portable** to another machine without the file. Cache key folds the file's `mtime:size`, so editing the file invalidates the cache automatically. Supported extensions: `png`, `jpg`/`jpeg`, `webp`, `gif`, `avif`, `svg`, `mp4`, `webm`, `mov`, `m4v`, `mp3`, `wav`, `m4a`, `ogg`, `flac`, `json`, `txt`, `md`, `markdown`, `html`/`htm`, `csv`, `ttf`, `otf`, `woff`, `woff2`. Unknown extensions fall back to magic-byte sniffing for common image formats (and an SVG content sniff), else `kind_mismatch`. **
|
|
2857
|
+
**Path-source notes:** the canvas is **not portable** to another machine without the file. Cache key folds the file's `mtime:size`, so editing the file invalidates the cache automatically. Supported extensions: `png`, `jpg`/`jpeg`, `webp`, `gif`, `avif`, `svg`, `mp4`, `webm`, `mov`, `m4v`, `mp3`, `wav`, `m4a`, `ogg`, `flac`, `json`, `txt`, `md`, `markdown`, `html`/`htm`, `csv`, `ttf`, `otf`, `woff`, `woff2`. Unknown extensions fall back to magic-byte sniffing for common image formats (and an SVG content sniff), else `kind_mismatch`. **SVG (`expect: "image"`) is rasterized to a transparent PNG on ingest** — brand logos are usually SVG, and image-generation models can't read SVG markup, so it's upscaled (longest edge near 2048px) with transparency preserved and the resulting asset carries `metadata.rasterized_from: "svg"`. **Video (`expect: "video"`) duration is probed from the file's ISO-BMFF (`mp4`/`mov`/`m4v`) header** and stamped as the canonical `duration_ms` (and `metadata.duration_ms`); other containers (e.g. `webm`) leave it unset. Downstream `video_deconstruct` uses this declared duration to size its ingest-poll timeout and preflight — without it those fall back to worst-case budgets and a single deconstruct step can hit the action time limit.
|
|
2920
2858
|
|
|
2921
2859
|
**Cost:** 0 engine credits for direct fetch + yt-dlp + local file. Handinger charges per scrape.
|
|
2922
2860
|
|
|
@@ -3928,7 +3866,7 @@ Turn a reference video into a **runnable, self-validated reproduction canvas** i
|
|
|
3928
3866
|
1. **`video_deconstruct`** (`~google/gemini-pro-latest`, full mode) — reverse-engineers the video into a scene-by-scene blueprint + word-level transcript, written next to the canvas as **`prompt.json`**. Each scene's `start_frame_prompt`/`end_frame_prompt` are inlined into the frame nodes (see below); `prompt.json` then rides along as the shared **global style reference** (palette, cast cohesion) and as provenance.
|
|
3929
3867
|
2. **recurring-element selection** (`~google/gemini-flash-latest`) — picks only the **recurring, identity-critical** elements (each `global.cast` person, a recurring animal, a showcased product, the brand logo) and the scene indices each appears in. One real reference image grounds each element across **every** frame it appears in, so the same actor stays consistent the whole video. This selection runs as a **second pass over a slimmed blueprint** (cast/branding + each scene's frame prompts only) — a long ad's full blueprint can exceed the engine's inline-prompt limit, so the heavy per-scene detail (dialogue, overlays, transcript) the selector never reads is dropped before the prompt.
|
|
3930
3868
|
|
|
3931
|
-
Before the deconstruct it runs a **local shot-cut pass** on the source file with **[PySceneDetect](https://www.scenedetect.com)** (`scenedetect` CLI, `detect-content` — the battle-tested HSV content detector, installed in the canvas sandbox) and passes the cut timestamps as `video_deconstruct`'s `shot_cuts`. The deconstruct snaps its scene boundaries onto those real cuts and **splits any scene that spans one**, so a scene's frames can never straddle a hard cut (the failure where a scene's start frame was the couch and its end frame the b-roll). Two knobs tuned for fast social ads: the content **threshold defaults to 18** (PySceneDetect's own default of 27 misses soft reframes) and the **minimum scene length is dropped to 0.25s** (its default ~0.6s merges away rapid montage flashes) — so super-fast cuts survive and become cheap still-holds downstream. The threshold is **adaptive**: if the first pass looks like a continuous shot shredded into many close micro-cuts (a talking-head selfie's natural motion), it re-runs at PySceneDetect's own default of 27 and
|
|
3869
|
+
Before the deconstruct it runs a **local shot-cut pass** on the source file with **[PySceneDetect](https://www.scenedetect.com)** (`scenedetect` CLI, `detect-content` — the battle-tested HSV content detector, installed in the canvas sandbox) and passes the cut timestamps as `video_deconstruct`'s `shot_cuts`. The deconstruct snaps its scene boundaries onto those real cuts and **splits any scene that spans one**, so a scene's frames can never straddle a hard cut (the failure where a scene's start frame was the couch and its end frame the b-roll). Two knobs tuned for fast social ads: the content **threshold defaults to 18** (PySceneDetect's own default of 27 misses soft reframes) and the **minimum scene length is dropped to 0.25s** (its default ~0.6s merges away rapid montage flashes) — so super-fast cuts survive and become cheap still-holds downstream. The threshold is **adaptive**: if the first pass looks like a continuous shot shredded into many close micro-cuts (a talking-head selfie's natural motion), it re-runs at PySceneDetect's own default of 27 and trusts that — real montage cuts survive it, motion artifacts don't. Pinning **`--shot-threshold N`** disables the re-check (lower = more cuts). The backend additionally coalesces residual same-shot slivers. If `scenedetect` is unavailable it warns loudly and degrades to LLM-only boundaries.
|
|
3932
3870
|
|
|
3933
3871
|
A shot longer than the video model's per-clip ceiling (Seedance's 15s, passed as `video_deconstruct`'s `max_clip_s`) is split into equal **continuation sub-scenes** that share their splice boundary exactly — so a long shot is reproduced in **full** (no truncation) and joins seamlessly. Each sub-scene carries `continues_previous`.
|
|
3934
3872
|
|
|
@@ -3936,17 +3874,9 @@ It then scaffolds the full pipeline like an **editing timeline**: each clip gets
|
|
|
3936
3874
|
|
|
3937
3875
|
**Composited scenes (split-screen / picture-in-picture / keyed presenter).** Real ads aren't always one full-frame shot — a frame can be **persistently divided** (b-roll on top, a presenter talking on the bottom) or **layer a presenter** over background footage (boxed in a corner, or green-screen keyed). The deconstruct now reports this per scene as `scene.composition` (`layout: split_screen | pip | keyed_overlay`, with one `region` per stream — each its own clean-plate frame + motion brief, the talking-head region flagged `is_presenter`). The scaffold reproduces a composited scene by building **one clip per region** (`s<i>_r0_*`, `s<i>_r1_*`, …) and compositing them with ffmpeg: a split-screen `vstack`/`hstack` (stack direction read from the region **panels**, so a top/bottom split always stacks vertically), or a picture-in-picture `overlay` of the presenter inset at its corner. A **keyed** presenter is first cut to transparency by `video_background_remove` (`s<i>_key`), then overlaid. The presenter region carries the native lip-synced voice; b-roll/render panels stay silent. To change a layout, edit `composition` in `prompt.json` and re-scaffold, or hand-edit the `s<i>_composite` ffmpeg args. Plain full-frame scenes (the default) are unaffected.
|
|
3938
3876
|
|
|
3939
|
-
**Typed region kinds & real screen surfaces.** Each composition region now carries a `kind` — `camera` (filmed footage, re-generated), `screen_capture` (app/site/document screen recording), `static_graphic` (designed text/graphic panel), or `generated` (3D/motion graphics) — plus an optional `nested` list for video-in-video (a Loom-style camera bubble inside a screen share). `kind` is authoritative for routing (prose keywords remain the fallback for older blueprints): `screen_capture`/`static_graphic` regions are **never generated by the video model** — the scene renders as a clean background plate (its clip prompt is scrubbed of all screen narration and forbids rendering UI) and the real surface is composited on the overlay layer. The route is decided **once per persistent layout run** (consecutive scenes sharing one composition signature), so a layout that runs unbroken across many scenes can't flip between pipelines on wording differences. A persistent surface seeds **ONE grouped stub** in `video-overlay-composition/index.html` spanning its whole window, with a per-scene **state timeline** — build one continuous screen recording/mockup, not one screenshot per scene. A `screen_capture` region also carries `surface_id`: a source video routinely **splices two unrelated screen recordings** under one persistent layout (a live app-processing capture, then an unrelated pre-made demo note) — the deconstruct assigns a stable id while the SAME recording continues and a new one when the on-screen content genuinely changes, so the run splits into **separate stubs** at the splice instead of asking for one screenshot that can't cover both. `baker canvas validate` additionally warns (`VIDEO_UI_IN_PROMPT`) if any clip prompt still narrates a screen surface, and (`VIDEO_BRANDMARK_IN_PROMPT`) if a generate prompt asks the model to paint a brand logo/wordmark (generation garbles marks; source the real one with `baker images logo` and composite it on the overlay layer).
|
|
3940
|
-
|
|
3941
|
-
**Designed graphics are rebuilt, not generated.** A `static_graphic` surface (a newspaper-collage panel, a meme card, a marketing composition) seeds a **GRAPHIC PANEL** stub — rebuild it as brand HTML or drop the design asset; it never gets the "screenshot the live page" instruction (there is no live page). A **full-frame** designed-graphic scene (the deconstruct emits one full-frame `static_graphic` region for meme/collage/motion-graphic beats) routes to a real design plate the same way screens do — no `image_generate`/`video_generate` — and dialogue over an all-graphic scene is voiceover by definition (nobody is on screen to lip-sync). A region typed `generated` whose own prose reads like a UI/designed panel is treated as a surface candidate too (the frame-grounded continuity checker delivers the verdict and corrects the kind), so one mistyped kind can't re-open the Seedance-paints-UI hole. Floating FX elements (hearts, sparkles, badges) ride the overlay layer: their narration is **scrubbed from clip briefs** and a categorical no-decorations directive is added, so the model can't bake a second, uneditable copy under the real composited one.
|
|
3942
|
-
|
|
3943
|
-
**Same-take continuity.** Scene boundaries that don't land on a detected shot cut are marked `continues_previous` (they're content beats inside one camera take — a genuinely cut-less video is ONE take), and a mid-take phrase clip **chains its start keyframe from the previous phrase's end keyframe**, so one continuous shot never jumps identity/pose at an invented boundary.
|
|
3944
|
-
|
|
3945
|
-
**Speech budgets use the speaker's observed pace.** `metadata.video.talking_scenes` stamps `est_speech_s` measured from the deconstruct's word timings plus `speech_words`; the `VIDEO_SPEECH_OVERRUN` check budgets a (re-authored) line at that real rate instead of a fixed words-per-second guess, so a fast talker's line that demonstrably fits its clip no longer fails validation. Numeral spelling for native clips applies **only to the spoken dialogue/transcript**, never to visual descriptions (a UI progress bar's "4%" stays "4%"). And on a blocking validation issue the canvas is **still written** (with the issues under `metadata.todo.blocking_validation_issues`) — the paid deconstruct is never discarded; fix in place and re-`validate`.
|
|
3946
|
-
|
|
3947
3877
|
**True output aspect, even when the video model can't generate it.** The scaffold resolves TWO ratios: the ad's **output** ratio (the source video's detected `aspect_ratio`, or **`--aspect`**, e.g. `4:5` → a 1080×1350 canvas) and the **generation** ratio — the nearest ratio the video model supports (Seedance has no 4:5, so clips + conditioning keyframes generate at `3:4`). When they differ the scaffold warns loudly, records `metadata.todo.aspect_remap`, normalizes **every clip** onto the output canvas (scale-to-fill, center-crop — keep subjects centered), sizes every ffmpeg plate/still/composite to the output dims, and stamps the copied overlay/caption compositions' `meta.json` to match. Nothing is silently dropped: an unknown ratio snaps to the nearest known one and stays explicit on every node.
|
|
3948
3878
|
|
|
3949
|
-
**Montage flashes held as stills
|
|
3879
|
+
**Montage flashes held as stills.** A rapid-cut beat shorter than ~2s with no spoken line is a **flash** — Seedance's shortest clip is 4s, so generating one (then trimming away most of it) burns credits for motion no viewer perceives. The scaffold instead **holds one keyframe as a still** for the scene length (a cheap ffmpeg loop, no billed `video_generate`), same look at a fraction of the cost. Talking/ambient beats keep a real clip (they need motion + native audio).
|
|
3950
3880
|
|
|
3951
3881
|
**The phrase model (voice cut at pauses, not at visual cuts).** The voice is grouped into **phrases** — runs of continuous speech with no real pause, which may span several visual scenes. A phrase is voiced ONCE (so a sentence the deconstruct split at a visual cut never breaks mid-word): if the speaker is **shown** anywhere in the phrase it's a single Seedance clip (`s<anchor>_clip`, native lip-sync + audio) re-voiced to the brand voice; if the speaker is **never shown** it's one ElevenLabs `tts` read. The picture is then assembled **scene by scene**: a scene that shows the speaker **slices its window** out of the phrase clip (`s<i>_seg`, an ffmpeg `-ss`/`-t` cut — video and audio come from the *same* clip, so lip-sync holds), and a **b-roll cutaway** gets its own silent clip while the phrase's voice plays underneath. "Shown" is decided by the **presenter element's per-scene presence**, not just who's speaking — a scene where a cast member narrates over b-roll (their element absent) is treated as a cutaway, so the talking head never appears where the original cut away. A presenter run longer than the **gateway-safe ~10s clip ceiling splits at a scene boundary** into contiguous takes (each its own clip + convert), so a sliced window never reads past its clip. (Seedance's *API* max is 15s, but the generation gateway frequently times out — **HTTP 524** — before it can deliver a clip longer than ~10s, so the scaffold never asks for one that long; 10s is a Seedance-allowed duration, so the split clip still snaps cleanly.) A b-roll cutaway *inside* a phrase lands at an **approximate** time (Seedance exposes no word timing) — nudge the scene boundary if it's off its beat.
|
|
3952
3882
|
|
|
@@ -4552,8 +4482,6 @@ This CLI is designed for AI agent consumption. Key patterns:
|
|
|
4552
4482
|
- **0.104.0**: `baker actions tags ...` commands now type their `/api/actions/tags...` request/response payloads from the shared `@baker/api` contract package instead of hand-written local interfaces. No command, flag, or output-shape changes.
|
|
4553
4483
|
- **0.105.0**: `baker images ...`, `baker videos ...`, and `baker testimonials ...` commands now type their `/api/{images,videos,testimonials}/...` request/response payloads from the shared `@baker/api` contract package instead of hand-written local interfaces. No command, flag, or output-shape changes.
|
|
4554
4484
|
- **0.106.0**: `baker ads linkedin` gains staged write commands — `campaign-groups`/`campaigns`/`creatives` create|update|pause|resume|(archive|)duplicate, `audiences create|upload`, `conversions create|update`, `lead-forms create|update`, plus `draft [remove|clear]` for review/undo. Ops validate at stage time, apply on chat publish, and run simulated (`urn:li:simulated:*`) unless LinkedIn writes are enabled for the company.
|
|
4555
|
-
- **0.116.0**: `lead-forms create` models the full Campaign Manager form — `locale`, form banner image (`formImageId`/`formImageUrn`), predefined profile-field questions (validated enum) vs custom questions (`SINGLE_LINE_TEXT`/`MULTIPLE_CHOICE` with `options`, ≤3 custom), `privacyPolicyText`, disclosure `consents[]` (≤5), tracking `hiddenFields[]` (≤20), and `thankYou` confirmation CTA + landing/appointment link. Staged preview surfaces best-practice warnings (no qualifying question, no confirmation, no consent). No breaking flag changes.
|
|
4556
|
-
- **0.119.0**: `draft amend`/`draft show` land on both `baker ads google` and `baker ads linkedin` — a generic JSON-merge-patch to update any staged op in place plus a full-payload receipt, replacing remove+recreate as the correction path. Google gains `assets update` and `asset-groups create|update` (Performance Max asset groups are now their own entity — `ads create --format performanceMaxAssetGroup` never worked and is gone); `ads create --format video` moves from a bare YouTube id to `--video-assets` refs (**breaking flag change** — stage the video as an asset first); `--format demandGen` gains `--image-assets`/`--square-image-assets`/`--logo-image-assets` and flag-building for headlines/descriptions. LinkedIn's `draft list` now renders a readable Campaign group ▸ Campaign ▸ Creative tree by default (`--json` for raw), `creatives update` gains `--campaign` (re-parent while staged), and `campaigns update` passes create-only fields (`--group`/`--type`/`--locale`/`--associated-entity`) through when amending a `li_temp_*` staged create instead of always stripping them.
|
|
4557
4485
|
|
|
4558
4486
|
## Publishing
|
|
4559
4487
|
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
5
26
|
|
|
6
27
|
// ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/810146e81bae4e3a061fe487864f2fde80c4b03b886877dc0f1fffbc6480b67e/node_modules/safe-stable-stringify/index.js
|
|
7
28
|
var require_safe_stable_stringify = __commonJS({
|
|
@@ -1804,11 +1825,7 @@ var VideoMeta = z.object({
|
|
|
1804
1825
|
// Advisory: the scene's visual length vs the estimated spoken length, so
|
|
1805
1826
|
// a reviewer can see a native line that may run past its cut. Not gated.
|
|
1806
1827
|
scene_s: z.number().optional(),
|
|
1807
|
-
est_speech_s: z.number().optional()
|
|
1808
|
-
// Word count of the line est_speech_s was measured for. Together they carry
|
|
1809
|
-
// the speaker's OBSERVED pace (from the deconstruct's word timings), so the
|
|
1810
|
-
// overrun check budgets re-authored lines at the real rate, not a wps guess.
|
|
1811
|
-
speech_words: z.number().optional()
|
|
1828
|
+
est_speech_s: z.number().optional()
|
|
1812
1829
|
}),
|
|
1813
1830
|
z.object({ scene: z.number(), lipsync_node: z.string() })
|
|
1814
1831
|
])
|
|
@@ -2338,9 +2355,7 @@ var STAGE_CODES = {
|
|
|
2338
2355
|
SPEECH_OVERRUN: "VIDEO_SPEECH_OVERRUN",
|
|
2339
2356
|
ASPECT_MISMATCH: "VIDEO_ASPECT_MISMATCH",
|
|
2340
2357
|
REFERENCE_MISSING: "VIDEO_REFERENCE_MISSING",
|
|
2341
|
-
SPAN_EXCEEDS_MODEL: "VIDEO_SPAN_EXCEEDS_MODEL"
|
|
2342
|
-
UI_IN_PROMPT: "VIDEO_UI_IN_PROMPT",
|
|
2343
|
-
BRANDMARK_IN_PROMPT: "VIDEO_BRANDMARK_IN_PROMPT"
|
|
2358
|
+
SPAN_EXCEEDS_MODEL: "VIDEO_SPAN_EXCEEDS_MODEL"
|
|
2344
2359
|
};
|
|
2345
2360
|
var SPAN_MODEL_SLACK_S = 0.25;
|
|
2346
2361
|
var VIDEO_TIME_SLACK_S = 0.75;
|
|
@@ -2719,8 +2734,6 @@ function checkVideoInvariants(ctx) {
|
|
|
2719
2734
|
}
|
|
2720
2735
|
checkSpeechOverrun(ctx, meta.talking_scenes);
|
|
2721
2736
|
checkAspectConsistency(ctx);
|
|
2722
|
-
checkUiInPrompt(ctx);
|
|
2723
|
-
checkBrandmarkInPrompt(ctx);
|
|
2724
2737
|
checkReferenceCompleteness(ctx, meta);
|
|
2725
2738
|
checkClipSpanFitsModel(ctx, meta);
|
|
2726
2739
|
}
|
|
@@ -2750,30 +2763,18 @@ function keywordTokens(text) {
|
|
|
2750
2763
|
if (!text) return [];
|
|
2751
2764
|
return text.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length >= 3 && !KEYWORD_STOPWORDS.has(t));
|
|
2752
2765
|
}
|
|
2753
|
-
function elementMentionKeywords(el) {
|
|
2754
|
-
const typeWords = ELEMENT_TYPE_KEYWORDS[el.type.toLowerCase()] ?? [];
|
|
2755
|
-
return [.../* @__PURE__ */ new Set([...typeWords, ...keywordTokens(el.label), ...keywordTokens(el.description)])];
|
|
2756
|
-
}
|
|
2757
2766
|
function keywordsForElement(el) {
|
|
2758
|
-
|
|
2767
|
+
const type = el.type.toLowerCase();
|
|
2768
|
+
const typeWords = ELEMENT_TYPE_KEYWORDS[type] ?? [];
|
|
2769
|
+
return [.../* @__PURE__ */ new Set([...typeWords, ...keywordTokens(el.label), ...keywordTokens(el.description)])];
|
|
2759
2770
|
}
|
|
2760
2771
|
function containsWord(text, word) {
|
|
2761
2772
|
const esc = word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2762
2773
|
return new RegExp(`\\b${esc}\\b`, "i").test(text);
|
|
2763
2774
|
}
|
|
2764
|
-
var FRAME_DESCRIPTION_START = "FRAME DESCRIPTION (this frame's editable prompt):";
|
|
2765
|
-
var FRAME_DESCRIPTION_END = "Render exactly what the FRAME DESCRIPTION";
|
|
2766
|
-
function frameDescriptionOf(prompt) {
|
|
2767
|
-
const i = prompt.indexOf(FRAME_DESCRIPTION_START);
|
|
2768
|
-
if (i < 0) return prompt;
|
|
2769
|
-
const rest = prompt.slice(i + FRAME_DESCRIPTION_START.length);
|
|
2770
|
-
const j = rest.indexOf(FRAME_DESCRIPTION_END);
|
|
2771
|
-
return j < 0 ? rest : rest.slice(0, j);
|
|
2772
|
-
}
|
|
2773
2775
|
function checkFrameReferences(ctx, node, index, keyworded) {
|
|
2774
|
-
const
|
|
2775
|
-
if (typeof
|
|
2776
|
-
const prompt = frameDescriptionOf(rawPrompt);
|
|
2776
|
+
const prompt = node.params?.prompt;
|
|
2777
|
+
if (typeof prompt !== "string" || prompt.length === 0) return;
|
|
2777
2778
|
const inputsBlob = JSON.stringify(node.inputs ?? {});
|
|
2778
2779
|
for (const { el, keywords } of keyworded) {
|
|
2779
2780
|
if (inputsBlob.includes(el.ref)) continue;
|
|
@@ -2823,24 +2824,13 @@ function checkClipSpanFitsModel(ctx, meta) {
|
|
|
2823
2824
|
});
|
|
2824
2825
|
}
|
|
2825
2826
|
}
|
|
2826
|
-
|
|
2827
|
-
var OBSERVED_WPS_MAX = 6;
|
|
2828
|
-
function secondsPerWord(stamped) {
|
|
2829
|
-
const est = stamped?.est_speech_s;
|
|
2830
|
-
const words = stamped?.speech_words;
|
|
2831
|
-
if (est && words && est > 0 && words > 0) {
|
|
2832
|
-
const wps = words / est;
|
|
2833
|
-
if (wps >= OBSERVED_WPS_MIN && wps <= OBSERVED_WPS_MAX) return est / words;
|
|
2834
|
-
}
|
|
2835
|
-
return 1 / SPEECH_WORDS_PER_SECOND;
|
|
2836
|
-
}
|
|
2837
|
-
function speechOverrunOf(node, secPerWord) {
|
|
2827
|
+
function speechOverrunOf(node) {
|
|
2838
2828
|
const params = node.params;
|
|
2839
2829
|
if (params?.generate_audio !== true) return null;
|
|
2840
2830
|
const line = nativeDialogueOf(params.prompt);
|
|
2841
2831
|
const duration = typeof params.duration === "number" ? params.duration : void 0;
|
|
2842
2832
|
if (!line || !duration) return null;
|
|
2843
|
-
const estSpeechS = line.split(/\s+/).filter(Boolean).length
|
|
2833
|
+
const estSpeechS = line.split(/\s+/).filter(Boolean).length / SPEECH_WORDS_PER_SECOND;
|
|
2844
2834
|
return estSpeechS > duration * SPEECH_OVERRUN_RATIO ? { estSpeechS, duration } : null;
|
|
2845
2835
|
}
|
|
2846
2836
|
function checkSpeechOverrun(ctx, talkingScenes) {
|
|
@@ -2849,7 +2839,7 @@ function checkSpeechOverrun(ctx, talkingScenes) {
|
|
|
2849
2839
|
const nativeClipRe = new RegExp(`^s${entry.scene}(_r\\d+)?_clip$`);
|
|
2850
2840
|
for (const n of ctx.canvas.nodes) {
|
|
2851
2841
|
if (!nativeClipRe.test(n.id) || n.type !== "video_generate") continue;
|
|
2852
|
-
const overrun = speechOverrunOf(n
|
|
2842
|
+
const overrun = speechOverrunOf(n);
|
|
2853
2843
|
if (!overrun) continue;
|
|
2854
2844
|
ctx.issues.push({
|
|
2855
2845
|
path: `nodes[${ctx.idToIndex.get(n.id) ?? -1}].params.prompt`,
|
|
@@ -2859,38 +2849,6 @@ function checkSpeechOverrun(ctx, talkingScenes) {
|
|
|
2859
2849
|
}
|
|
2860
2850
|
}
|
|
2861
2851
|
}
|
|
2862
|
-
var UI_IN_PROMPT_RE = /\bscreen[- ]?(?:recording|capture|grab|share)\b|\bapp (?:interface|screen)\b|\bphone screen overlay\b/i;
|
|
2863
|
-
function checkUiInPrompt(ctx) {
|
|
2864
|
-
for (const n of ctx.canvas.nodes) {
|
|
2865
|
-
if (n.type !== "video_generate") continue;
|
|
2866
|
-
const prompt = n.params?.prompt;
|
|
2867
|
-
if (typeof prompt !== "string" || !UI_IN_PROMPT_RE.test(prompt)) continue;
|
|
2868
|
-
ctx.issues.push({
|
|
2869
|
-
path: `nodes[${ctx.idToIndex.get(n.id) ?? -1}].params.prompt`,
|
|
2870
|
-
code: STAGE_CODES.UI_IN_PROMPT,
|
|
2871
|
-
severity: "warning",
|
|
2872
|
-
message: `"${n.id}" asks the video model to render a screen/UI surface \u2014 generative video garbles UI text and chrome. Composite the real screen on the overlay layer (screenshot / brand HTML) and keep this prompt to the background plate`,
|
|
2873
|
-
node_id: n.id,
|
|
2874
|
-
node_type: "video_generate"
|
|
2875
|
-
});
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
|
-
var BRANDMARK_IN_PROMPT_RE = /\b(?:logo|wordmark) (?:overlay|animation|sting|card|reveal)\b|\b(?:google|facebook|instagram|tiktok|youtube|amazon|apple|microsoft|whatsapp|netflix|spotify|excel|trustpilot) (?:logo|wordmark|branding)\b/i;
|
|
2879
|
-
function checkBrandmarkInPrompt(ctx) {
|
|
2880
|
-
for (const n of ctx.canvas.nodes) {
|
|
2881
|
-
if (n.type !== "video_generate" && n.type !== "image_generate") continue;
|
|
2882
|
-
const prompt = n.params?.prompt;
|
|
2883
|
-
if (typeof prompt !== "string" || !BRANDMARK_IN_PROMPT_RE.test(prompt)) continue;
|
|
2884
|
-
ctx.issues.push({
|
|
2885
|
-
path: `nodes[${ctx.idToIndex.get(n.id) ?? -1}].params.prompt`,
|
|
2886
|
-
code: STAGE_CODES.BRANDMARK_IN_PROMPT,
|
|
2887
|
-
severity: "warning",
|
|
2888
|
-
message: `"${n.id}" asks the model to render a brand logo/wordmark \u2014 generation garbles marks and third-party logos carry IP exposure. Source the real mark (baker images logo <domain>) and composite it on the overlay layer`,
|
|
2889
|
-
node_id: n.id,
|
|
2890
|
-
node_type: n.type
|
|
2891
|
-
});
|
|
2892
|
-
}
|
|
2893
|
-
}
|
|
2894
2852
|
function checkAspectConsistency(ctx) {
|
|
2895
2853
|
const clips = ctx.canvas.nodes.filter((n) => n.type === "video_generate");
|
|
2896
2854
|
if (clips.length < 2) return;
|
|
@@ -3693,7 +3651,7 @@ function safePathname(rawUrl) {
|
|
|
3693
3651
|
}
|
|
3694
3652
|
var ingestNode = defineNode({
|
|
3695
3653
|
id: "ingest",
|
|
3696
|
-
version: "1.
|
|
3654
|
+
version: "1.1.0",
|
|
3697
3655
|
category: "io",
|
|
3698
3656
|
location: "local",
|
|
3699
3657
|
summary: "Ingest an external URL or a local file into the asset store. Declare the kind you expect (image/video/audio/text/json/font); the node picks the strategy. For source=url: yt-dlp for video/audio (YouTube/TikTok/Vimeo/etc. and direct file URLs), Handinger for HTML/PDF pages \u2192 markdown, direct HTTP fetch for binary URLs (images, fonts) and raw .txt/.md. For source=path: read from the local filesystem and upload to R2.",
|
|
@@ -3736,9 +3694,6 @@ function runStrategy(strategy, params, ctx) {
|
|
|
3736
3694
|
}
|
|
3737
3695
|
}
|
|
3738
3696
|
async function execDirectFetch(params, ctx) {
|
|
3739
|
-
if (params.expect === "image") {
|
|
3740
|
-
return ingestImageUrl(params.url, ctx);
|
|
3741
|
-
}
|
|
3742
3697
|
const result = await callBackendExec({
|
|
3743
3698
|
nodeType: "ingest",
|
|
3744
3699
|
nodeVersion: ingestNode.version,
|
|
@@ -3749,37 +3704,6 @@ async function execDirectFetch(params, ctx) {
|
|
|
3749
3704
|
});
|
|
3750
3705
|
return assertAssetOutput(result, params.expect);
|
|
3751
3706
|
}
|
|
3752
|
-
async function ingestImageUrl(url, ctx) {
|
|
3753
|
-
const res = await fetch(url);
|
|
3754
|
-
if (!res.ok) {
|
|
3755
|
-
throw localExecError(ctx, `fetch ${url} \u2192 ${res.status}`);
|
|
3756
|
-
}
|
|
3757
|
-
const ab = await res.arrayBuffer();
|
|
3758
|
-
if (ab.byteLength > MAX_ASSET_BYTES) {
|
|
3759
|
-
throw localExecError(ctx, `file_too_large: ${url} is ${ab.byteLength} bytes (limit ${MAX_ASSET_BYTES})`);
|
|
3760
|
-
}
|
|
3761
|
-
let normalized;
|
|
3762
|
-
try {
|
|
3763
|
-
normalized = await toModelSafeImage(Buffer.from(ab));
|
|
3764
|
-
} catch (e) {
|
|
3765
|
-
throw localExecError(ctx, `${url}: ${e.message}`);
|
|
3766
|
-
}
|
|
3767
|
-
if (normalized.rasterizedFrom) {
|
|
3768
|
-
ctx.log(`ingest: normalized ${normalized.rasterizedFrom} URL -> PNG (${normalized.bytes.length}B)`);
|
|
3769
|
-
}
|
|
3770
|
-
return uploadAndIngest({
|
|
3771
|
-
bytes: normalized.bytes,
|
|
3772
|
-
kind: "image",
|
|
3773
|
-
mime: normalized.mime,
|
|
3774
|
-
metadata: {
|
|
3775
|
-
source_url: url,
|
|
3776
|
-
strategy: "direct_fetch",
|
|
3777
|
-
ingested_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3778
|
-
...normalized.rasterizedFrom ? { rasterized_from: normalized.rasterizedFrom } : {}
|
|
3779
|
-
},
|
|
3780
|
-
ctx
|
|
3781
|
-
});
|
|
3782
|
-
}
|
|
3783
3707
|
async function execHandinger(params, ctx) {
|
|
3784
3708
|
const result = await callBackendExec({
|
|
3785
3709
|
nodeType: "ingest",
|
|
@@ -3867,25 +3791,6 @@ async function rasterizeSvgToPng(bytes) {
|
|
|
3867
3791
|
}
|
|
3868
3792
|
return await sharp(bytes, { density }).png({ force: true, palette: false }).toBuffer();
|
|
3869
3793
|
}
|
|
3870
|
-
var MODEL_SAFE_IMAGE_MIMES = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/gif", "image/webp"]);
|
|
3871
|
-
async function toModelSafeImage(bytes) {
|
|
3872
|
-
const safe = sniffImageMime(bytes);
|
|
3873
|
-
if (safe && MODEL_SAFE_IMAGE_MIMES.has(safe)) {
|
|
3874
|
-
return { bytes, mime: safe };
|
|
3875
|
-
}
|
|
3876
|
-
if (sniffSvg(bytes)) {
|
|
3877
|
-
return { bytes: await rasterizeSvgToPng(bytes), mime: "image/png", rasterizedFrom: "svg" };
|
|
3878
|
-
}
|
|
3879
|
-
const { default: sharp } = await import("sharp");
|
|
3880
|
-
try {
|
|
3881
|
-
const img = sharp(bytes);
|
|
3882
|
-
const format = (await img.metadata()).format;
|
|
3883
|
-
const png = await img.png({ force: true }).toBuffer();
|
|
3884
|
-
return { bytes: png, mime: "image/png", rasterizedFrom: format ?? "unknown" };
|
|
3885
|
-
} catch (e) {
|
|
3886
|
-
throw new Error(`bytes are not a decodable image (${e.message})`);
|
|
3887
|
-
}
|
|
3888
|
-
}
|
|
3889
3794
|
function sniffImageMime(buf) {
|
|
3890
3795
|
if (buf.length < 4) return null;
|
|
3891
3796
|
if (buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71) return "image/png";
|
|
@@ -3997,20 +3902,17 @@ async function execLocalFile(params, ctx) {
|
|
|
3997
3902
|
ctx.log(`ingest: local file ${stats.size}B mime=${mime}`);
|
|
3998
3903
|
let outBytes = bytes;
|
|
3999
3904
|
let outMime = mime;
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
outMime = normalized.mime;
|
|
4005
|
-
rasterizedFrom = normalized.rasterizedFrom;
|
|
4006
|
-
if (rasterizedFrom) ctx.log(`ingest: normalized ${rasterizedFrom} -> PNG (${outBytes.length}B)`);
|
|
3905
|
+
if (mime === SVG_MIME) {
|
|
3906
|
+
outBytes = await rasterizeSvgToPng(bytes);
|
|
3907
|
+
outMime = "image/png";
|
|
3908
|
+
ctx.log(`ingest: rasterized SVG -> PNG (${outBytes.length}B)`);
|
|
4007
3909
|
}
|
|
4008
3910
|
const durationMs = probeVideoDurationMs(params.expect, outBytes, ctx);
|
|
4009
3911
|
const ref = await uploadAndIngest({
|
|
4010
3912
|
bytes: outBytes,
|
|
4011
3913
|
kind: params.expect,
|
|
4012
3914
|
mime: outMime,
|
|
4013
|
-
metadata: localFileMetadata({ absPath, fileSize: stats.size, mime, durationMs
|
|
3915
|
+
metadata: localFileMetadata({ absPath, fileSize: stats.size, mime, durationMs }),
|
|
4014
3916
|
ctx
|
|
4015
3917
|
});
|
|
4016
3918
|
return withProbedDuration(ref, durationMs);
|
|
@@ -4028,7 +3930,7 @@ function localFileMetadata(args) {
|
|
|
4028
3930
|
ingested_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4029
3931
|
file_size: args.fileSize,
|
|
4030
3932
|
original_filename: path3.basename(args.absPath),
|
|
4031
|
-
...args.
|
|
3933
|
+
...args.mime === SVG_MIME ? { rasterized_from: "svg" } : {},
|
|
4032
3934
|
...args.durationMs !== void 0 ? { duration_ms: args.durationMs } : {}
|
|
4033
3935
|
};
|
|
4034
3936
|
}
|
|
@@ -6773,7 +6675,6 @@ export {
|
|
|
6773
6675
|
isPersistedAssetRef,
|
|
6774
6676
|
collectAssetRefLikes,
|
|
6775
6677
|
sha256Hex,
|
|
6776
|
-
elementMentionKeywords,
|
|
6777
6678
|
BackendClient2 as BackendClient,
|
|
6778
6679
|
Engine2 as Engine,
|
|
6779
6680
|
LocalAssetStore2 as LocalAssetStore,
|
|
@@ -6784,4 +6685,4 @@ export {
|
|
|
6784
6685
|
defaultRegistry,
|
|
6785
6686
|
createEngineFromEnv
|
|
6786
6687
|
};
|
|
6787
|
-
//# sourceMappingURL=chunk-
|
|
6688
|
+
//# sourceMappingURL=chunk-GQIOFHVI.js.map
|