hermoso 0.1.384 → 0.1.387

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
@@ -5,7 +5,7 @@ scripts. Research the ads already winning in a market, generate finished image &
5
5
  composited in, copy + CTA included), publish them to your own social channels, and build & manage the ad
6
6
  campaigns behind them, all over [MCP](https://modelcontextprotocol.io) tools, a CLI, or installable Claude skills.
7
7
 
8
- **901 tools.** `tools/list` is always the authoritative set; `hermoso_capabilities` (free) returns the live model
8
+ **906 tools.** `tools/list` is always the authoritative set; `hermoso_capabilities` (free) returns the live model
9
9
  catalog with exact per-render credit costs plus the full capability map.
10
10
 
11
11
  **Most of it costs nothing.** Publishing and scheduling posts, building and managing paid campaigns, analytics
@@ -231,7 +231,7 @@ block entirely if you signed in above; it is there for CI, where the process can
231
231
 
232
232
  Then ask your agent: *“Generate an image ad with Hermoso.”*
233
233
 
234
- ### What the 901 tools cover
234
+ ### What the 906 tools cover
235
235
 
236
236
  **Ad spy / research** — `find_competitors`, `competitor_teardown`, `pull_competitor_ads`, `research_ads`; the
237
237
  Meta / Google / LinkedIn ad libraries (`search_meta_ads`, `search_google_ads`, `search_linkedin_ads`); organic
package/mcp/client.mjs CHANGED
@@ -454,6 +454,8 @@ export async function apiUploadUrl(p, url, { fileName = '' } = {}) {
454
454
  export async function apiSSE(p, body = {}) {
455
455
  const res = await fetchWrite(`${API_BASE}${withBrandScope(p)}`, { method: 'POST', headers: headers({ Accept: 'text/event-stream' }), body: JSON.stringify(body) });
456
456
  if (!res.ok) { let e; try { e = (await res.json()).error; } catch {} throw Object.assign(new Error(e || `HTTP ${res.status}`), { status: res.status }); }
457
+ // A server that answered with plain JSON (an older revision) is read as JSON, never as an empty stream.
458
+ if (!/text\/event-stream/i.test(res.headers.get('content-type') || '')) { const j = await res.json(); return j && Object.prototype.hasOwnProperty.call(j, 'data') ? j.data : j; }
457
459
  const reader = res.body.getReader(); const dec = new TextDecoder();
458
460
  let buf = '', done = null, error = null; const progress = [];
459
461
  for (;;) {
@@ -125,21 +125,32 @@ export function plannerBrief(product, { brief = '', angles = [] } = {}) {
125
125
  ].filter(Boolean).join('\n');
126
126
  }
127
127
 
128
- // One render's prompt: the planner's visual brief, then the exact words, then the logo rule. The words are QUOTED so
129
- // the model prints them as given; a static whose headline is misspelled is not finished.
130
- export function staticAdPrompt(v, { logo = 'server', productPhoto = false } = {}) {
128
+ // One render's prompt: the planner's visual brief, then the slot's layout (when the batch assigned one), then the
129
+ // exact words, then the product and logo rules. The words are QUOTED so the model prints them as given; a static
130
+ // whose headline is misspelled is not finished. `layout` = {directive, type, cta} from lib/static-variety.mjs (the
131
+ // server assigns it); without one the old single generic typography line is used.
132
+ // ONE PRODUCT, TWO HANDS (2026-10-06): the first live batch put two sticks in one frame (one in hand, one floating)
133
+ // and gave a 9:16 a third hand. Both are image-MODEL failures a sensible plan cannot prevent, so they are stated once
134
+ // here, not in the planner: one unit of the product unless the layout is a flat lay or a set, and every hand belongs
135
+ // to a visible arm, at most two per person.
136
+ export function staticAdPrompt(v, { logo = 'server', productPhoto = false, layout = null, ratioNote = '' } = {}) {
131
137
  const x = v && typeof v === 'object' ? v : {};
132
138
  const lines = [String(x.prompt || x.visual || '').trim()];
139
+ const L = layout && typeof layout === 'object' ? layout : null;
140
+ if (L && L.directive) lines.push(`Layout: ${String(L.directive).trim()}.${L.type ? ` Headline set in ${String(L.type).trim()}, in the brand's colours.` : ''}${L.cta ? ` Set ${String(L.cta).trim()}.` : ''}${ratioNote ? ` ${ratioNote}` : ''}`);
141
+ else if (ratioNote) lines.push(ratioNote);
133
142
  const words = [
134
143
  x.headline ? `headline "${String(x.headline).trim()}"` : '',
135
144
  x.supporting ? `supporting line "${String(x.supporting).trim()}"` : '',
136
145
  x.cta ? `call to action "${String(x.cta).trim()}"` : '',
137
146
  ].filter(Boolean);
138
- if (words.length) lines.push(`On-image text, spelled exactly as given and nothing else: ${words.join(', ')}. Bold ad typography with a clear hierarchy, crisp and correctly spelled. A finished, ready-to-run static ad.`);
147
+ if (words.length) lines.push(`On-image text, spelled exactly as given and nothing else: ${words.join(', ')}.${L ? '' : ' Bold ad typography with a clear hierarchy, crisp and correctly spelled.'} A finished, ready-to-run static ad.`);
148
+ if (L) lines.push('Show the product once (one unit as it is sold) unless the layout is a flat lay or a set of its range; any person has at most two hands and every hand in frame belongs to a visible arm.');
139
149
  if (productPhoto) lines.push('The first reference image is the REAL product: keep its shape, colours and label exactly.');
140
- if (logo === 'attached') lines.push("The LAST reference image is the brand's REAL logo. Place exactly that logo, unchanged, small and clean in the layout. Never redraw or re-letter it.");
141
- else if (logo === 'server') lines.push("Place the brand's real logo small and clean in the layout.");
142
- else lines.push('Do not draw or invent any logo or wordmark.');
150
+ // THE LOGO IS LAID ON, NEVER PAINTED (2026-10-06): 'overlay' (and the old 'attached' / 'server') add nothing here. The
151
+ // render goes with brandLogo:true, and the image route tells the model to keep a corner clear and lays the brand's real
152
+ // logo file over the finished ad (lib/logo-intent.mjs). The model is never handed the logo to re-draw.
153
+ if (!['overlay', 'in_scene', 'auto', 'attached', 'server'].includes(logo)) lines.push('Do not draw or invent any logo or wordmark.');
143
154
  return lines.filter(Boolean).join('\n\n');
144
155
  }
145
156
 
package/mcp/tools.mjs CHANGED
@@ -27,7 +27,7 @@ import { withHints, videoChoiceText, videoChoiceHints, neutralCreditsText, credi
27
27
  // ./openai-extensions.mjs. Same twin-safe specifier rule.
28
28
  import { registerLibraryApp, installEntrypointIcons, chatgptExtOn, EXT_PREFS_KEY } from './openai-extensions.mjs';
29
29
  // STATIC ADS AT SCALE (2026-10-06): the pure catalog/plan/prompt helpers behind make_static_ads. Same twin-safe specifier rule.
30
- import { STATIC_BATCH, resolveProducts, heroImageOf, normalizeRatios, clampCount, plannerBrief, staticAdPrompt, renderList, splitForQueue, planFromItems, perAdCredits } from './static-batch.mjs';
30
+ import { STATIC_BATCH, normalizeRatios, renderList } from './static-batch.mjs';
31
31
 
32
32
  const JOB_TIMEOUT = +(process.env.HERMOSO_JOB_TIMEOUT_MS || process.env.HEIST_JOB_TIMEOUT_MS || 10 * 60 * 1000);
33
33
  // /generated/x.mp4 → a URL THE CALLER can open. `API_BASE` is the base this layer CALLS the app on, and on the hosted
@@ -329,7 +329,7 @@ export const MCP_INSTRUCTIONS = [
329
329
  '• CREATE (finished ads): render_ad (Studio quality pipeline) or generate_image / generate_video / generate_avatar render on their own; plan_ad authors a board first when the ad wants one and render_ad takes it; get_brand (what we already know) / draft_brand (onboard one) / update_brand (patch a field) manage the saved brand, which the create tools hydrate by themselves; list_creators / save_creator / delete_creator (the reusable saved CAST — re-cast the same face instead of generating a new person every time; render_ad’s `creator` stars one of them in the ad); make_template_ad (native HTML formats); make_thumbnail (YouTube / Shorts / Instagram video thumbnails + covers — use it for any thumbnail or video-cover ask, never generate_image); clone_static / recast_motion / reframe_video / upscale_video / dub_video / change_voice / finish_video / fix_beat / hook_variants / stitch_video; plan_variations + score_ad.',
330
330
  '• RAW MODEL PLAYGROUND: generate_image / generate_video (useBrand:false) for prompt-only renders, generate_voice for text-to-speech, generate_text for the writing models — against any of 30+ image / video / voice / writing model ids (exact costs in hermoso_capabilities), no ad framing.',
331
331
  '• ACCOUNT & WORKSPACES: hermoso_credits, billing_status, buy_credits (one-click top-up / first-purchase link), upgrade_plan / set_auto_reload (admin), list_jobs / get_job; list_brands / create_brand / use_brand / delete_brand (one account holds MANY profiles: brands, clients or creators, so an agency runs every client through here, each with its own brand details, memory, Library and connectors; create_brand → draft_brand onboards a new one, delete_brand is confirm-gated); get_settings / update_settings (the LANGUAGE every ad, script, plan and answer is written in — set it once and every render obeys it — plus app appearance and the weekly competitor-watch email); list_team / invite_member / remove_member / set_role.',
332
- '• PUBLISH & MANAGE YOUR CHANNELS (the user’s connected accounts, over this MCP): Meta — post_to_meta (FB/IG/Threads), upload_file (post ANY external/local file), list_meta_ads + meta_insights (read campaigns/ad sets/ads + performance, broken down by age/gender/placement/country), preview_meta_ad (see the real ad per placement, 24h links), estimate_meta_reach (audience size before you spend), list_meta_audiences / create_meta_audience (retargeting + lookalikes), create_meta_campaign / create_meta_ad / upload_meta_asset (build), update_meta_object / delete_meta_object / set_meta_campaign_status (edit/delete/activate — spend + deletes confirm-gated), manage_meta_post (edit/delete a post); Instagram DM automations — save_instagram_dm_automation / test_instagram_dm_automation / list_instagram_dm_automations / delete_instagram_dm_automation (a keyword comment, DM, story reply or ig.me link gets an automatic private reply); DM automations on Instagram, Facebook (Page comments, ads, Messenger) and X — save_dm_automation / test_dm_automation / list_dm_automations / delete_dm_automation (X is billed in credits per event and send); X — x_chat_settings / update_x_chat_settings (who may DM the brand on X); Microsoft Advertising (Bing Ads) — list_microsoft_ads_campaigns, microsoft_ads_report, microsoft_ads_geo_search, create_microsoft_ads_campaign / create_microsoft_ads_ad_group / create_microsoft_ads_ad / add_microsoft_ads_keywords (all created Paused), set_microsoft_ads_budget / set_microsoft_ads_status (spend confirm-gated); ChatGPT Ads (OpenAI Advertiser API) — list_openai_ads_campaigns, openai_ads_report, openai_ads_geo_search, create_openai_ads_campaign / create_openai_ads_ad_group / create_openai_ads_ad (all created PAUSED), update_openai_ads_object, set_openai_ads_budget / set_openai_ads_status (spend + archive confirm-gated). Connected by pasting an API key; ONE creative format, a text plus image card — no video; Pinterest — list_pinterest_boards then post_to_pinterest (the user picks the board); Google Business Profile — list_business_locations, post_to_google_business, list_google_business_posts, delete_google_business_post, google_business_insights, get_business_location / update_business_location (read and CHANGE what the listing says — hours, phone, website, description, categories, name, address; the edit is live on Search and Maps, so the unconfirmed call writes nothing and shows the before-and-after), google_business_account (whose account it is on and whether that role can edit it); Google Drive (ONE connection covering Drive, Sheets and Docs) — save_to_drive, list_drive_files, get_drive_file, update_drive_file, delete_drive_file, create_drive_folder, plus create_sheet / append_to_sheet / read_sheet and create_doc / append_to_doc / read_doc (Hermoso-created files, plus any file the user hands over with the Google file picker in the app); Microsoft OneDrive — save_to_onedrive, list_onedrive_files, get_onedrive_file, update_onedrive_file, delete_onedrive_file, create_onedrive_folder (full CRUD over the user’s OneDrive); MANAGING THE CONNECTIONS — list_connectors, list_connector_accounts + set_connector_accounts (which Pages / ad accounts / company Pages this profile may post to and spend from — fails closed, an empty choice shares nothing), leave_connector (remove just YOUR OWN account from a connector several teammates have each joined — theirs keep working) · disconnect_connector (confirm-gated: reconnecting needs a browser). Full read+write control over the user’s own channels, not just generation. LINKING a NEW account is the one step that is not headless (an OAuth consent screen) — send the user to Workspace ▸ Connectors in the app.',
332
+ '• PUBLISH & MANAGE YOUR CHANNELS (the user’s connected accounts, over this MCP): Meta — post_to_meta (FB/IG/Threads), upload_file (post ANY external/local file), list_meta_ads + meta_insights (read campaigns/ad sets/ads + performance, broken down by age/gender/placement/country), preview_meta_ad (see the real ad per placement, 24h links), estimate_meta_reach (audience size before you spend), list_meta_audiences / create_meta_audience (retargeting + lookalikes), create_meta_campaign / create_meta_ad / upload_meta_asset (build), update_meta_object / delete_meta_object / set_meta_campaign_status (edit/delete/activate — spend + deletes confirm-gated), manage_meta_post (edit/delete a post); DM automations (a keyword comment, DM, story reply or ig.me link gets an automatic private reply) — save_dm_automation / test_dm_automation / list_dm_automations / delete_dm_automation on Instagram, Facebook (Page comments, ads, Messenger) and X (X billed in credits per event and send), and the Instagram-only save_instagram_dm_automation / test_instagram_dm_automation / list_instagram_dm_automations / delete_instagram_dm_automation; X — x_chat_settings / update_x_chat_settings (who may DM the brand on X); Microsoft Advertising (Bing Ads) — list_microsoft_ads_campaigns, microsoft_ads_report, microsoft_ads_geo_search, create_microsoft_ads_campaign / create_microsoft_ads_ad_group / create_microsoft_ads_ad / add_microsoft_ads_keywords (all created Paused), set_microsoft_ads_budget / set_microsoft_ads_status (spend confirm-gated); ChatGPT Ads (OpenAI Advertiser API) — list_openai_ads_campaigns, openai_ads_report, openai_ads_geo_search, create_openai_ads_campaign / create_openai_ads_ad_group / create_openai_ads_ad (all created PAUSED), update_openai_ads_object, set_openai_ads_budget / set_openai_ads_status (spend + archive confirm-gated). Connected by API key; ONE creative format (a text + image card, no video); Pinterest — list_pinterest_boards then post_to_pinterest (the user picks the board); Google Business Profile — list_business_locations, post_to_google_business, list_google_business_posts, delete_google_business_post, google_business_insights, get_business_location / update_business_location (read and CHANGE what the listing says — hours, phone, website, description, categories, name, address; the edit is live on Search and Maps, so the unconfirmed call writes nothing and shows the before-and-after), google_business_account (whose account it is on and whether that role can edit it); Google Drive (ONE connection covering Drive, Sheets and Docs) — save_to_drive, list_drive_files, get_drive_file, update_drive_file, delete_drive_file, create_drive_folder, plus create_sheet / append_to_sheet / read_sheet and create_doc / append_to_doc / read_doc (Hermoso-created files, plus any file the user hands over with the Google file picker in the app); Microsoft OneDrive — save_to_onedrive, list_onedrive_files, get_onedrive_file, update_onedrive_file, delete_onedrive_file, create_onedrive_folder; MANAGING THE CONNECTIONS — list_connectors, list_connector_accounts + set_connector_accounts (which Pages / ad accounts / company Pages this profile may post to and spend from — fails closed, an empty choice shares nothing), leave_connector (remove just YOUR OWN account from a connector several teammates have each joined — theirs keep working) · disconnect_connector (confirm-gated: reconnecting needs a browser). LINKING a NEW account is the one step that is not headless (an OAuth consent screen) — send the user to Workspace ▸ Connectors in the app.',
333
333
  'YOUR ROSTER IS CORE-FIRST, AND NOTHING IS MISSING OR UNFINISHED. What you are LISTED is the core tools plus whatever this connection asked for or you have switched on; the rest of the product \u2014 hundreds of tools across research, creation, publishing, paid campaigns, analytics and channel administration \u2014 is held out of the LIST on SIZE ALONE. IT IS ALL CALLABLE RIGHT NOW. find_tools({query}) searches EVERY tool, listed or not, and each row carries its parameters, its credit cost and its recent health; call_tool({name, args}) then runs it through the same handler, the same account and the same permissions; a direct tools/call to a name you already know works too. This route needs no reload and works on every host, including claude.ai and ChatGPT, which fix their tool list when the connection is made. enable_tools({groups:[\u2026]}) additionally LISTS a group for hosts that re-list \u2014 free and instant: the MOMENT the user asks to build, budget, target, report on or change a campaign, enable_tools({groups:[\'ads\']}); for sessions, conversions, revenue by channel or how their site ranks, enable_tools({groups:[\'analytics\']}); to read, moderate, reply to, measure or delete something ALREADY on a channel, enable_tools({groups:[\'channel_admin\']}). IF THE TOOLS DO NOT APPEAR after that call \u2014 some clients cache their tool list for the whole conversation \u2014 do NOT tell the user the capability does not exist and do not keep retrying: just use call_tool, which does not depend on the roster changing at all. Reconnecting with `?tools=all` on the server URL lists everything at connect time. NEVER tell a user Hermoso cannot manage their campaigns or read their analytics, cannot read a comment, answer a DM or pull a channel\u2019s numbers, because you cannot see the tool \u2014 look it up with find_tools and run it with call_tool. The full set of group names is: core, research, create, channels, channel_admin, analytics, files, workspace, ads \u2014 or \'all\'.',
334
334
  // HINTS (2026-09-17). The advice was always in the prose; this says the keyed copy exists so a client that
335
335
  // prefers structure does not have to parse a sentence to find it.
@@ -2269,7 +2269,7 @@ export const widgetHostHides = (name, widgetHost) => (widgetHost
2269
2269
  // self-describing schema, and the default roster sits at its token ceiling. find_tools finds these, call_tool or a
2270
2270
  // direct tools/call runs them, and enable_tools({groups:['create']}) (or 'all', or ?tools=all) lists them. post_edit's description names
2271
2271
  // edit_timeline, and edit_timeline's names video_frames, so a caller that starts from post_edit reaches both.
2272
- export const ON_DEMAND_TOOLS = new Set(['edit_timeline', 'video_frames', 'recast_hook', 'face_check', 'list_templates', 'finish_draft', 'make_static_ads']); // make_static_ads (2026-10-06): plan_variations' description names it, so a caller planning variants reaches it; // recast_hook and face_check (2026-09-24): hook_variants names recast_hook, and recast_hook's reply names face_check // finish_draft (2026-10-03): every 480p Seedance 2.5 video reply names it (draftLine)
2272
+ export const ON_DEMAND_TOOLS = new Set(['edit_timeline', 'video_frames', 'recast_hook', 'face_check', 'list_templates', 'finish_draft', 'make_static_ads', 'list_products', 'add_product', 'refresh_products', 'update_product', 'remove_product']); // make_static_ads (2026-10-06): plan_variations' description names it, so a caller planning variants reaches it; // recast_hook and face_check (2026-09-24): hook_variants names recast_hook, and recast_hook's reply names face_check // finish_draft (2026-10-03): every 480p Seedance 2.5 video reply names it (draftLine)
2273
2273
 
2274
2274
  // ── A TOOL NAME A HOST STILL HOLDS MUST KEEP ANSWERING (2026-09-14) ─────────────────────────────────────────────
2275
2275
  // ChatGPT users get the tool roster OpenAI SNAPSHOTTED at review time, never a live tools/list (memory:
@@ -5788,7 +5788,7 @@ function buildTools(rawServer, opts = {}, sink = null) {
5788
5788
  }, wrap(async (a) => {
5789
5789
  if (a.redo && a.redo.id) {
5790
5790
  const r = a.redo;
5791
- const d = await apiPost('/api/schedule/refill/redo', { id: r.id, feedback: r.feedback || '', part: r.change || 'both', remember: r.remember !== false, confirm: r.confirm === true });
5791
+ const d = await (r.confirm === true ? apiSSE : apiPost)('/api/schedule/refill/redo', { id: r.id, feedback: r.feedback || '', part: r.change || 'both', remember: r.remember !== false, confirm: r.confirm === true }); // streamed when it renders: past the edge's 100s limit (2026-10-06)
5792
5792
  if (d.needsConfirm) return ok(`${d.summary}\nAsk the user before spending; call run_post_refill again with redo.confirm:true only on a yes.`, d);
5793
5793
  return ok([d.summary || '', d.draft ? `The new version (${d.draft.id}, ${d.draft.kind}, ${d.draft.at}):\n ${String(d.draft.message || '').replace(/\n+/g, ' / ').slice(0, 300)}\n ${d.draft.media || ''}\nIt is still a draft: approve it with run_post_refill approve.` : ''].filter(Boolean).join('\n'), d);
5794
5794
  }
@@ -5802,12 +5802,13 @@ function buildTools(rawServer, opts = {}, sink = null) {
5802
5802
  d.discarded ? `Discarded ${d.discarded} draft(s).` : '',
5803
5803
  d.edited ? `Edited ${d.edited} draft(s).` : '',
5804
5804
  (d.editErrors || []).length ? `Edits refused: ${d.editErrors.map(x => `${x.draftId} — ${x.error}`).join(' · ')}` : '',
5805
+ (d.editNotes || []).length ? d.editNotes.map(x => `${x.draftId}: ${x.note}`).join('\n') : '',
5805
5806
  (d.unknown || []).length ? `No such draft: ${d.unknown.join(', ')}` : '',
5806
5807
  (d.learned || []).length ? `Saved for future batches: ${d.learned.map((x) => `"${x}"`).join(', ')}.` : '',
5807
5808
  `${d.remaining} draft(s) still waiting for approval.`,
5808
5809
  ].filter(Boolean).join('\n'), d);
5809
5810
  }
5810
- const d = await apiPost('/api/schedule/refill/run', { dryRun: a.dryRun === false ? false : true, force: !!a.force });
5811
+ const d = await (a.dryRun === false ? apiSSE : apiPost)('/api/schedule/refill/run', { dryRun: a.dryRun === false ? false : true, force: !!a.force }); // a live run renders for minutes: streamed past the edge's 100s limit (2026-10-06)
5811
5812
  const lines = (d.posts || []).map((p, i) => ` ${i + 1}. ${p.at} → ${(p.channels || []).map(c => `${c}[${(p.visibilityByChannel || {})[c] || 'public'}]`).join(', ')}\n ${String(p.message || '').replace(/\n+/g, ' / ').slice(0, 220)}\n new ${p.kind}: ${p.media || `(made when it runs live) ${String(p.asset?.scene || '').slice(0, 160)}`} · ${p.asset?.credits || 0} credits`);
5812
5813
  const q = (d.queued || []).filter(x => x && x.id).length, qFail = (d.queued || []).filter(x => x && x.error);
5813
5814
  return ok([
@@ -17989,24 +17990,26 @@ function buildTools(rawServer, opts = {}, sink = null) {
17989
17990
  model: z.string().optional().describe('image model id from hermoso_capabilities. A model whose `refs.mode` is "edit" there (gpt-image-2.5) takes your refImages on ITS OWN editor, up to its `refs.max`, instead of the default compositor'),
17990
17991
  imageSize: z.string().optional().describe('pixel-size preset for models that support it: 1K/2K, and 4K on the models hermoso_capabilities lists with a 4K imageSize price (a 4K ask on any other model is refused, free) — omit for the default'),
17991
17992
  fixLabel: z.boolean().optional().describe('default true: when the saved brand\'s product photo rides in this render, the product\'s label on the finished image is READ and compared with the photo, and re-printed from the photo at close range ONLY if it came out wrong (a label that is already right costs only the check, a credit or two; a re-print adds about ten). The reply says whether the label was checked, fixed or left as rendered (`labelPass`). Pass false when the user wants the packaging left exactly as generated: nothing is checked or re-printed.'),
17993
+ logoPlacement: z.enum(['auto', 'overlay', 'in_scene', 'none']).optional().describe('overlay: the real logo file laid flat (lockup, corner). in_scene: ON something in the scene (cup, shirt, sign, moving or angled), from the file, then checked. auto (default): from the prompt, none unless asked'),
17992
17994
  mask: z.string().optional().describe('MASKED EDIT — change ONE region of an image and keep the rest: a local path or URL of a mask image for refImages[0] (the image being edited). Either convention works and the reply says which it read: TRANSPARENT pixels = change, or, on a mask with no transparency, WHITE = change and black = keep. Any size; it is scaled to the image. The mask GUIDES the edit rather than stencilling it: the new content can blend a little past its edge. Runs on the model hermoso_capabilities marks `refs.mask` (gpt-image-2.5): leave `model` empty or name that one — any other named model is refused, free. Needs refImages; the result keeps the source image\'s own frame, so aspectRatio is not applied.'),
17993
17995
  },
17994
17996
  outputSchema: {
17995
17997
  image: z.string().optional().describe('the served absolute URL of the finished image'),
17996
17998
  model: z.string().optional().describe('the product-facing label of the model that rendered it'),
17997
17999
  productCheck: z.any().optional().describe('present when the brand\'s product photo was attached: {verdict: match|mismatch|unclear|absent, wordmark, issues[]} — the render compared against the real product photo. mismatch/absent means the product in the image is NOT the brand\'s product; say so, never present it as done'),
18000
+ logoCheck: z.any().optional().describe('after an in_scene logo: {verdict: match|drift|absent|unclear, where, issues[], note}'),
17998
18001
  labelPass: z.any().optional().describe('present when the product\'s label lines were known: {status: checked (read and already right, left as rendered) | fixed (read wrong and re-printed from the photo) | left (not re-printed: label faces away, product not found, or the pass could not run) | off (fixLabel:false), read, expected[], note}. Tell the user the note.'),
17999
18002
  },
18000
18003
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
18001
18004
  _meta: openaiMeta(AD_RESULT_URI, 'Rendering your ad image…', 'Ad image ready'),
18002
- }, wrap(async ({ prompt, refImages, useBrand, aspectRatio, model, imageSize, raw, mask, fixLabel }) => {
18005
+ }, wrap(async ({ prompt, refImages, useBrand, aspectRatio, model, imageSize, raw, mask, fixLabel, logoPlacement }) => {
18003
18006
  const refs = refImages?.length ? (await Promise.all(refImages.map(toRef))).filter(Boolean) : undefined;
18004
18007
  const maskRef = mask ? await toRef(mask) : undefined; // a local mask file travels the same way a local reference does
18005
18008
  // `raw === true` only — a raw render is opt-in and must be stated properly, so a truthy stray value never
18006
18009
  // silently turns off the brand pipeline on an on-brand ad (the same rule lib/raw-passthrough.mjs's predicate uses).
18007
18010
  // A MASKED EDIT IS AN EDIT OF THE CALLER'S OWN IMAGE: the saved brand's product photos must not be hydrated in front
18008
18011
  // of it, so a mask implies useBrand:false (the server also refuses a mask with no refImages, free).
18009
- const _imgBody = { prompt, refImages: refs, useBrand: maskRef ? false : useBrand !== false, aspectRatio, model, imageSize, ...(maskRef ? { mask: maskRef } : {}), ...(raw === true ? { raw: true } : {}), ...(fixLabel === false ? { fixLabel: false } : {}) }; // fixLabel:false only when stated: the label check is ON by default
18012
+ const _imgBody = { prompt, refImages: refs, useBrand: maskRef ? false : useBrand !== false, aspectRatio, model, imageSize, ...(maskRef ? { mask: maskRef } : {}), ...(raw === true ? { raw: true } : {}), ...(fixLabel === false ? { fixLabel: false } : {}), ...(logoPlacement ? { logoPlacement } : {}) }; // fixLabel:false only when stated: the label check is ON by default
18010
18013
  // A CALLER WITH A WAIT BUDGET GETS A QUEUED JOB (2026-09-21, R321). Only `/v1/tools/generate_image?wait=` sets
18011
18014
  // `waitMs`; every other caller renders inside the request exactly as before. The server does the same brand-photo
18012
18015
  // handling either way, then queues the ordinary image job; awaitRenderJob waits what the caller allowed and hands
@@ -18147,6 +18150,7 @@ function buildTools(rawServer, opts = {}, sink = null) {
18147
18150
  restrainedGrade: z.boolean().optional().describe('true for a calm / premium / muted look instead of the default punchy poster grade'),
18148
18151
  logo: z.string().optional().describe('a brand logo URL or path to place into the composition'),
18149
18152
  logo3d: z.boolean().optional().describe('first turn the flat logo into a volumetric 3D render (one extra billed image), then composite that'),
18153
+ logoPlacement: z.enum(['auto', 'overlay', 'in_scene']).optional().describe('overlay: the real logo file laid flat, exact. in_scene: placed into the composition from the file, then checked. auto (default): in_scene with logo3d, else overlay'),
18150
18154
  split: z.object({ mode: z.enum(['plain', 'before_after', 'versus', 'custom']), panels: z.array(z.string()).optional() }).passthrough().optional().describe('split/panel LAYOUT — only when the user asks for one ("split", "before/after", "versus screen"). "X vs Y" as a SCENE stays one unified frame'),
18151
18155
  reference: z.object({}).passthrough().optional().describe("fields YOU extracted by eye from a reference thumbnail. Extract ALL of: brief (one dense sentence on the concept), subject (pose/action generically, NEVER a specific identity), elements, location, composition, background, split (boolean), split_count, person_count (0-3), emotion (one of the 11 presets or 'other'), emotion_detail (one vivid sentence covering eyes, brows, mouth, head angle). emotion + emotion_detail carry the reference's actual facial performance, which is the single biggest CTR lever on a face; split/split_count reproduce its panel structure. The reference image itself is never sent to the model"),
18152
18156
  tweak: z.object({ kind: z.string(), value: z.string() }).describe('surgical pixel-faithful edit of a FINISHED thumbnail (needs sourceImage): kind emotion / background / background_color / rim_light, or any other kind with the edit in words as value').optional(),
@@ -21256,29 +21260,33 @@ function memoryNoteVerdict(text) {
21256
21260
  return ok(text, d);
21257
21261
  }));
21258
21262
 
21259
- // STATIC ADS AT SCALE (2026-10-06). The ads-studio shape in one call: products × count → finished statics,
21260
- // each a different selling angle with its headline and CTA on the image. Planning runs on the same batch planner the
21261
- // web Studio's make_variations fans out from (/api/batch/plan); every render is the ordinary QUEUED image job
21262
- // (/api/generate/image queue:true), so brand photos, the product check and the label pass behave exactly as in
21263
- // generate_image and nothing is held inside this request. Pure half: ./static-batch.mjs.
21263
+ // STATIC ADS AT SCALE (2026-10-06). The ads-studio shape in one call: products × count → finished statics, each a
21264
+ // different selling angle AND a different layout (the server assigns every ad in a batch a distinct layout archetype,
21265
+ // type treatment and CTA style before planning — lib/static-variety.mjs), headline and CTA on the image. ONE
21266
+ // implementation: POST /api/static-ads, the same route the web Ads Studio page calls, so the catalog match, the
21267
+ // fresh-price rule, the layouts and the queue behave identically on every surface. Pure half: ./static-batch.mjs.
21264
21268
  server.registerTool('make_static_ads', {
21265
21269
  title: 'Make static ads at scale',
21266
- description: "Make a BATCH of finished static image ads for one or several products in one call: each ad a genuinely different selling angle (offer, material or ingredient story, how it is used, a lifestyle moment, an objection, proof the brand really has) with its headline, supporting line and CTA printed on the image, the brand's real product photo and logo composited in. `products` names products from the saved brand's catalog (get_brand lists them; ['all'] takes every product with a photo; omit for the hero product; a name not in the catalog is still advertised, drawn from its words). `count` is ads PER PRODUCT (1-20). `aspectRatios` any of 1:1, 4:5, 9:16 (each ad is rendered natively once per ratio). `brief` steers (a sale, a season, an audience) and is never turned into a price, discount or claim the brand does not state; `angles` names the angles to spread across. ALWAYS PRICED FIRST: dryRun:true returns the plan and the quote for the planning call only; then pass that `plan` back (no dryRun) to render exactly it without planning again. Renders are QUEUED jobs, at most " + STATIC_BATCH.QUEUE_PER_CALL + " per call: anything past that comes back as `remaining`, to send again as `plan` once some finish. Read each job with get_job; never describe an ad before its URL arrives. For variants of ONE finished ad use headline_variants / resize_ad; to copy a competitor's static use clone_static.",
21270
+ description: "Make a BATCH of finished static image ads for one or several products in one call: each ad a genuinely different selling angle (offer, material or ingredient story, how it is used, a lifestyle moment, an objection, proof the brand really has) AND a different layout (editorial still life, poster headline, packshot on colour, in hand, flat lay, split compare, native phone photo and more; never one look repeated across a batch), with its headline, supporting line and CTA printed on the image and the product's real photo and the brand's real logo composited in. `products` names products from the brand's product catalog by id or name (list_products; add one from its page link with add_product; ['all'] takes every product with a photo; omit for the hero product). A product's price is printed only when it was read from its live page within the last hour: older rows are re-read first, and a page that cannot be read means no price on that ad. `count` is ads PER PRODUCT (1-20). `aspectRatios` any of 1:1, 4:5, 9:16 (each ad is composed natively once per ratio, so the ratios are different pictures with the same words; for one picture in several sizes render one ratio and use resize_ad). `brief` steers (a sale, a season, an audience) and is never turned into a price, discount or claim the brand does not state; `angles` names the angles to spread across; `layouts` (free words) replaces the layout set. ALWAYS PRICED FIRST: dryRun:true returns the plan and the quote; then pass that `plan` (and its `batchId`) back to render exactly it without planning again. Renders are QUEUED jobs, at most " + STATIC_BATCH.QUEUE_PER_CALL + " per call: the rest comes back as `remaining`, to send again as `plan` once some finish. Read each job with get_job; never describe an ad before its URL arrives. For variants of ONE finished ad use headline_variants / resize_ad; to copy a competitor's static use clone_static.",
21267
21271
  inputSchema: {
21268
- products: z.array(z.string()).optional().describe("product names from the saved brand's catalog (get_brand), ['all'] for every product with a photo, or omit for the hero product"),
21272
+ products: z.array(z.string()).optional().describe("product ids or names from list_products, ['all'] for every product with a photo, or omit for the hero product"),
21269
21273
  count: z.number().int().min(1).max(STATIC_BATCH.COUNT_MAX).optional().describe(`ads per product, 1-${STATIC_BATCH.COUNT_MAX} (default ${STATIC_BATCH.COUNT_DEFAULT})`),
21270
21274
  aspectRatios: z.array(z.enum(['1:1', '4:5', '9:16'])).optional().describe("canvases; every ad is rendered once per ratio (default ['4:5'])"),
21271
21275
  brief: z.string().optional().describe('what to lean into: a sale the brand is really running, a season, an audience, a tone'),
21272
21276
  angles: z.array(z.string()).optional().describe("the selling angles to spread across, e.g. ['price or offer', 'material story', 'how it is used', 'lifestyle moment']; omit and the planner picks a spread"),
21277
+ layouts: z.array(z.string()).optional().describe('your own layout descriptions in words, used slot by slot instead of the built-in layout set'),
21273
21278
  language: z.string().optional().describe('language of the on-image copy (default English)'),
21274
21279
  model: z.string().optional().describe('image model id from hermoso_capabilities; omit for the default'),
21275
21280
  brandId: z.string().optional().describe('a profile id/name from list_brands; omit for the active profile (passing it pins it like use_brand)'),
21276
21281
  plan: z.array(z.any()).optional().describe('the `plan` (or `remaining`) a previous call returned: render exactly those ads, no new planning'),
21282
+ batchId: z.string().optional().describe('the batchId a previous call returned, so the rest lands in the same batch'),
21277
21283
  dryRun: z.boolean().optional().describe('true = plan and quote only, nothing rendered'),
21284
+ logoPlacement: z.enum(['auto', 'overlay', 'in_scene', 'none']).optional().describe('overlay (default): the real logo file laid flat on each ad. in_scene: printed on something in the ad, then checked. none. auto: from each visual'),
21278
21285
  },
21279
21286
  outputSchema: {
21280
- plan: z.array(z.any()).optional().describe('[{product, image, variants:[{angle, headline, supporting, cta, prompt}]}]'),
21281
- jobs: z.array(z.any()).optional().describe('one queued image job per ad × ratio: {id, product, angle, headline, aspectRatio}'),
21287
+ batchId: z.string().optional(),
21288
+ plan: z.array(z.any()).optional().describe('[{productId, product, image, price, variants:[{angle, headline, supporting, cta, prompt, layout}]}]'),
21289
+ jobs: z.array(z.any()).optional().describe('one queued image job per ad × ratio: {id, product, angle, headline, layout, aspectRatio}'),
21282
21290
  remaining: z.array(z.any()).optional().describe('the part of the plan not queued this call — pass it back as `plan`'),
21283
21291
  perAdCredits: z.number().nullable().optional(),
21284
21292
  totalCredits: z.number().nullable().optional(),
@@ -21286,64 +21294,92 @@ function memoryNoteVerdict(text) {
21286
21294
  notes: z.array(z.string()).optional(),
21287
21295
  },
21288
21296
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
21289
- }, wrap(async ({ products, count, aspectRatios, brief, angles, language, model, brandId, plan, dryRun }) => {
21290
- const brand = await activeBrand(brandId);
21291
- const ratios = normalizeRatios(aspectRatios);
21292
- const notes = [];
21293
- let thePlan = Array.isArray(plan) && plan.length ? plan.filter((p) => p && Array.isArray(p.variants) && p.variants.length) : null;
21294
- if (!thePlan) {
21295
- const targets = resolveProducts(brand, products);
21296
- if (!targets.length) throw Object.assign(new Error('Name the product to advertise in `products` (or save a brand first with draft_brand). Nothing was charged.'), { _userInput: true });
21297
- const n = clampCount(count);
21298
- thePlan = [];
21299
- for (const t of targets) {
21300
- if (!t.matched && !t.hero) notes.push(`"${t.name}" is not in the brand's catalog, so its ads are drawn from its name with no product photo of its own.`);
21301
- const d = await apiPost('/api/batch/plan', { product: plannerBrief(t.name, { brief, angles }), count: n, language: language || '' });
21302
- const vs = (d?.variants || []).slice(0, n).map((v) => ({ angle: v.angle || '', headline: v.headline || '', supporting: v.supporting || '', cta: v.cta || '', prompt: v.prompt || '' }));
21303
- thePlan.push({ product: t.name, image: t.image || '', hero: !!t.hero, variants: vs });
21304
- }
21305
- }
21306
- const list = renderList(thePlan, ratios);
21307
- let status = null; try { status = await apiGet('/api/generate/status'); } catch {}
21308
- const per = perAdCredits(status, model);
21309
- const total = per == null ? null : per * list.length;
21310
- const quote = per == null ? 'the per-ad price could not be read just now (each render reserves its own price when queued)' : `about ${per} credits per ad, plus about 3 where the product label is checked · about ${total}-${total + 3 * list.length} for ${list.length}`;
21311
- const lines = thePlan.flatMap((p) => p.variants.map((v, i) => `${p.product} #${i + 1} [${v.angle}] "${v.headline}" · ${v.cta}`));
21312
- if (dryRun) {
21313
- return { content: [{ type: 'text', text: `PLAN (nothing rendered): ${list.length} ad${list.length === 1 ? '' : 's'} (${ratios.join(', ')}).\n${lines.join('\n')}\nQuote: ${quote}.${notes.length ? '\n' + notes.join('\n') : ''}\nTo render exactly these, call make_static_ads again with plan set to this plan and the same aspectRatios.` }], structuredContent: { plan: thePlan, perAdCredits: per, totalCredits: total, dryRun: true, ...(notes.length ? { notes } : {}) } };
21297
+ }, wrap(async ({ products, count, aspectRatios, brief, angles, layouts, language, model, brandId, plan, batchId, dryRun, logoPlacement }) => {
21298
+ if (brandId) await activeBrand(brandId);
21299
+ const d = await apiPost('/api/static-ads', { products, count, aspectRatios, brief, angles, layouts, language, model, plan, batchId, dryRun: !!dryRun, ...(logoPlacement ? { logoPlacement } : {}) });
21300
+ const thePlan = Array.isArray(d?.plan) ? d.plan : [];
21301
+ const ratios = Array.isArray(d?.aspectRatios) ? d.aspectRatios : normalizeRatios(aspectRatios);
21302
+ const per = d?.perAdCredits ?? null, total = d?.totalCredits ?? null;
21303
+ const adsN = d?.ads ?? renderList(thePlan, ratios).length;
21304
+ const quote = per == null ? 'the per-ad price could not be read just now (each render reserves its own price when queued)' : `about ${per} credits per ad, plus about 3 where the product label is checked · about ${total}-${d?.totalCreditsHigh ?? total} for ${adsN}`;
21305
+ const notes = Array.isArray(d?.notes) ? d.notes : [];
21306
+ const lines = thePlan.flatMap((p) => (p.variants || []).map((v, i) => `${p.product}${p.price ? ` (${p.price})` : ''} #${i + 1} ${v.layout?.label ? `{${v.layout.label}} ` : ''}[${v.angle}] "${v.headline}" · ${v.cta}`));
21307
+ if (d?.dryRun) {
21308
+ return { content: [{ type: 'text', text: `PLAN (nothing rendered): ${adsN} ad${adsN === 1 ? '' : 's'} (${ratios.join(', ')}), batch ${d.batchId}.\n${lines.join('\n')}\nQuote: ${quote}.${notes.length ? '\n' + notes.join('\n') : ''}\nTo render exactly these, call make_static_ads again with plan set to this plan, batchId ${d.batchId} and the same aspectRatios.` }], structuredContent: { batchId: d.batchId, plan: thePlan, perAdCredits: per, totalCredits: total, dryRun: true, ...(notes.length ? { notes } : {}) } };
21314
21309
  }
21315
- if (total != null) {
21316
- let bal = null; try { bal = (await apiGet('/api/credits'))?.balance; } catch {}
21317
- if (bal != null && Number.isFinite(+bal) && +bal < total) throw Object.assign(new Error(`This batch needs about ${total} credits (${list.length} ads at about ${per}) and the balance is ${bal}. Nothing was charged. Ask for fewer ads, or top up (buy_credits).`), { status: 402, _userInput: true });
21318
- }
21319
- const { now, later } = splitForQueue(list);
21320
- const heroImg = heroImageOf(brand);
21321
- const logo = typeof brand?.logo === 'string' && /^https?:\/\//i.test(brand.logo) && !/\.svg(\?|#|$)/i.test(brand.logo) ? brand.logo : '';
21322
- const jobs = [];
21323
- let stoppedAt = null;
21324
- for (let i = 0; i < now.length; i++) {
21325
- const it = now[i];
21326
- const isHero = it.image ? it.image === heroImg : true;
21327
- let body;
21328
- if (isHero && (it.image || brand)) {
21329
- body = { prompt: staticAdPrompt(it.variant, { logo: 'server' }), useBrand: true }; // the server attaches the hero photo + the real logo
21330
- } else if (it.image) {
21331
- body = { prompt: staticAdPrompt(it.variant, { logo: logo ? 'attached' : 'none', productPhoto: true }), refImages: [it.image, ...(logo ? [logo] : [])], useBrand: true };
21332
- } else {
21333
- body = logo ? { prompt: staticAdPrompt(it.variant, { logo: 'attached' }), refImages: [logo], useBrand: true } : { prompt: staticAdPrompt(it.variant, { logo: 'none' }), useBrand: false };
21334
- }
21335
- try {
21336
- const q = await apiPost('/api/generate/image', { ...body, aspectRatio: it.aspectRatio, ...(model ? { model } : {}), queue: true });
21337
- jobs.push({ id: q.jobId, product: it.product, angle: it.variant.angle, headline: it.variant.headline, aspectRatio: it.aspectRatio });
21338
- } catch (e) {
21339
- if (e && (e.status === 429 || e.status === 402) && jobs.length) { stoppedAt = i; notes.push(e.status === 429 ? 'The render queue is full, so the rest was not queued.' : String(e.message || '')); break; }
21340
- throw e;
21341
- }
21342
- }
21343
- const left = [...(stoppedAt == null ? [] : now.slice(stoppedAt)), ...later];
21344
- const remaining = left.length ? planFromItems(left) : [];
21345
- const text = `Queued ${jobs.length} static ad${jobs.length === 1 ? '' : 's'} (${quote}).\n${jobs.map((j, i) => `${i + 1}. ${j.product} [${j.angle}] "${j.headline}" ${j.aspectRatio} → job ${j.id}`).join('\n')}${remaining.length ? `\n${left.length} more not queued yet: call make_static_ads again with plan set to \`remaining\` and the same aspectRatios once some of these finish.` : ''}${notes.length ? '\n' + notes.join('\n') : ''}\nRead each with get_job until it reports done; there is no image until then.`;
21346
- return { content: [{ type: 'text', text }], structuredContent: { plan: thePlan, jobs, ...(remaining.length ? { remaining } : {}), perAdCredits: per, totalCredits: total, ...(notes.length ? { notes } : {}) } };
21310
+ const jobs = Array.isArray(d?.jobs) ? d.jobs : [];
21311
+ const remaining = Array.isArray(d?.remaining) ? d.remaining : [];
21312
+ const text = `Queued ${jobs.length} static ad${jobs.length === 1 ? '' : 's'} in batch ${d?.batchId} (${quote}).\n${jobs.map((j, i) => `${i + 1}. ${j.product} {${j.layout || 'Static'}} [${j.angle}] "${j.headline}" ${j.aspectRatio} → job ${j.id}`).join('\n')}${remaining.length ? `\n${d.remainingAds || 'Some'} more not queued yet: call make_static_ads again with plan set to \`remaining\`, batchId ${d.batchId} and the same aspectRatios once some of these finish (the web Ads Studio page also queues them while it is open).` : ''}${notes.length ? '\n' + notes.join('\n') : ''}\nRead each with get_job until it reports done; there is no image until then.`;
21313
+ return { content: [{ type: 'text', text }], structuredContent: { batchId: d?.batchId, plan: thePlan, jobs, ...(remaining.length ? { remaining } : {}), perAdCredits: per, totalCredits: total, ...(notes.length ? { notes } : {}) } };
21314
+ }));
21315
+
21316
+ // THE PRODUCT CATALOG (2026-10-06): a cache of each product's live page — title, link, price, currency, description,
21317
+ // photos and its own selling points, with when it was last read there. Free (plain page reads, no model). The page
21318
+ // always wins: a re-read overwrites what we held (except what the user typed), and a failed read is said, never
21319
+ // treated as fresh. Same routes as the web Ads Studio page's product grid.
21320
+ const productLine = (p) => `${p.id} · ${p.title}${p.priceLabel ? ` · ${p.priceLabel}${p.priceCurrent ? '' : ' (not current)'}` : ''} · ${p.images?.length || 0} photo${p.images?.length === 1 ? '' : 's'} · ${p.checked}${p.lastError ? ` · last read FAILED: ${p.lastError}` : ''}${p.url ? ` · ${p.url}` : ''}`;
21321
+ const productsText = (d, head) => `${head}\n${(d?.products || []).map(productLine).join('\n') || 'No products yet: add one from its page link with add_product, or refresh_products with sync:true to import the store catalog.'}`;
21322
+ server.registerTool('list_products', {
21323
+ title: 'List the product catalog',
21324
+ description: "The brand's product catalog: each product's id, title, page link, price (and whether it is current), photos, its own selling points and audience, and when it was last checked against its live page. Free. `refresh:'stale'` re-reads rows older than a day first, `refresh:'all'` re-reads every page. Use the ids with make_static_ads.",
21325
+ inputSchema: { refresh: z.enum(['stale', 'all']).optional().describe("re-read product pages before listing: 'stale' (older than a day) or 'all'"), brandId: z.string().optional().describe('a profile id/name from list_brands; omit for the active profile') },
21326
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
21327
+ }, wrap(async ({ refresh, brandId }) => {
21328
+ if (brandId) await activeBrand(brandId);
21329
+ const d = await apiGet(`/api/products${refresh ? `?refresh=${refresh}` : ''}`);
21330
+ return ok(productsText(d, `${d?.count || 0} product${d?.count === 1 ? '' : 's'}. A price prints on an ad only when it was read from the live page within ${d?.freshForPricesMinutes || 60} minutes.${(d?.failed || []).length ? ` ${d.failed.length} page${d.failed.length === 1 ? '' : 's'} could not be re-read.` : ''}`), d);
21331
+ }));
21332
+ server.registerTool('add_product', {
21333
+ title: 'Add a product from a link',
21334
+ description: "Add a product to the brand's catalog from its product-page link: reads the page's own data (name, every photo, price and currency, description, its bullet-point selling points), no model, 0 credits. Re-adding a link updates the row (the live page wins). Without a url, `title` adds one by hand. `audience` and `sellingPoints` you pass are kept through later re-reads.",
21335
+ inputSchema: {
21336
+ url: z.string().optional().describe('the product page link'),
21337
+ title: z.string().optional().describe('to add a product by hand (no link)'),
21338
+ images: z.array(z.string()).optional().describe('photo urls for a hand-added product'),
21339
+ price: z.string().optional().describe('hand-added only; never printed as current unless read from a page'),
21340
+ currency: z.string().optional(),
21341
+ description: z.string().optional(),
21342
+ sellingPoints: z.array(z.string()).optional(),
21343
+ audience: z.string().optional().describe('who this product is for'),
21344
+ brandId: z.string().optional(),
21345
+ },
21346
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
21347
+ }, wrap(async ({ brandId, ...a }) => {
21348
+ if (brandId) await activeBrand(brandId);
21349
+ const d = await apiPost('/api/products', a);
21350
+ const p = d?.product;
21351
+ return ok(p ? `Added: ${productLine(p)}${p.sellingPoints?.length ? `\nSelling points: ${p.sellingPoints.join('; ')}` : ''}${d.changed?.length ? `\nChanged since last read: ${d.changed.join(', ')}` : ''}` : 'Nothing added.', d);
21352
+ }));
21353
+ server.registerTool('refresh_products', {
21354
+ title: 'Re-check products against their pages',
21355
+ description: "Re-read product pages now (all products with a page, or `ids`) and update the catalog: the live page wins, a failed read is recorded and said. `sync:true` instead imports the whole store catalog (the brand's connected Shopify store, else its website's public catalog), merging into existing rows. Free.",
21356
+ inputSchema: { ids: z.array(z.string()).optional(), sync: z.boolean().optional().describe('import the store catalog instead of re-reading pages'), brandId: z.string().optional() },
21357
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
21358
+ }, wrap(async ({ ids, sync, brandId }) => {
21359
+ if (brandId) await activeBrand(brandId);
21360
+ const d = sync ? await apiPost('/api/products/sync', {}) : await apiPost('/api/products/refresh', ids && ids.length ? { ids } : {});
21361
+ const head = sync ? `Imported ${d?.synced || 0} products from ${d?.from || 'the store'}.` : `Re-read ${(d?.refreshed || []).length} page${(d?.refreshed || []).length === 1 ? '' : 's'}${(d?.refreshed || []).filter((r) => r.changed?.length).length ? ` (${d.refreshed.filter((r) => r.changed?.length).map((r) => `${r.id}: ${r.changed.join(', ')}`).join('; ')})` : ', nothing changed'}.${(d?.failed || []).length ? ` FAILED: ${d.failed.map((f) => `${f.title}: ${f.error}`).join('; ')}` : ''}${d?.noPage ? ` ${d.noPage} product${d.noPage === 1 ? ' has' : 's have'} no page to re-read.` : ''}`;
21362
+ return ok(productsText(d, head), d);
21363
+ }));
21364
+ server.registerTool('update_product', {
21365
+ title: 'Edit a product',
21366
+ description: "Edit a catalog product's title, description, selling points, audience or page link. What you set here is kept through later page re-reads. Free.",
21367
+ inputSchema: { id: z.string(), title: z.string().optional(), description: z.string().optional(), sellingPoints: z.array(z.string()).optional(), audience: z.string().optional(), url: z.string().optional(), brandId: z.string().optional() },
21368
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
21369
+ }, wrap(async ({ id, brandId, ...a }) => {
21370
+ if (brandId) await activeBrand(brandId);
21371
+ const d = await apiPost(`/api/products/${encodeURIComponent(id)}`, a);
21372
+ return ok(`Updated: ${productLine(d.product)}`, d);
21373
+ }));
21374
+ server.registerTool('remove_product', {
21375
+ title: 'Remove a product',
21376
+ description: "Remove one product from the brand's catalog (its ads already made stay in the Library). Free.",
21377
+ inputSchema: { id: z.string(), brandId: z.string().optional() },
21378
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
21379
+ }, wrap(async ({ id, brandId }) => {
21380
+ if (brandId) await activeBrand(brandId);
21381
+ const d = await apiDelete(`/api/products/${encodeURIComponent(id)}`);
21382
+ return ok(`Removed ${id}. ${d?.count ?? 0} product${d?.count === 1 ? '' : 's'} left.`, d);
21347
21383
  }));
21348
21384
 
21349
21385
  // ---------- research analysis & creative remix (webapp Create-chat parity — the last four app-only chat tools, now headless) ----------
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "hermoso",
3
- "version": "0.1.384",
3
+ "version": "0.1.387",
4
4
  "mcpName": "io.github.hermoso-ai/hermoso",
5
- "description": "Marketing on autopilot, run from your own AI agent. 901 tools. Publishing, scheduling, ad campaign management, comments, DMs and analytics cost no credits on every plan; credits are only for generating creative and for Ad Spy research. AD PLATFORMS: Meta, Google Ads, TikTok Ads, LinkedIn Ads, Reddit Ads, X Ads, Pinterest Ads, Snapchat Ads, Microsoft Advertising, Apple Search Ads, ChatGPT Ads and AppLovin Ads, plus product feeds in Google Merchant Center. PUBLISHING AND SCHEDULING: Facebook, Instagram, Threads, TikTok, YouTube, X, LinkedIn, Pinterest, Bluesky and Telegram. INSTAGRAM DM AUTOMATIONS: a keyword comment, a DM, a story reply or an ig.me link gets an automatic private reply from the brand. AD RESEARCH: the Meta, Google and LinkedIn ad libraries plus organic TikTok, Instagram, YouTube, Threads and Reddit. ANALYTICS: Google Analytics 4, Google Search Console and every connected platform's own post and campaign insights. Also brand onboarding, 50+ image and video generation models, ad scoring, competitor teardowns, Google Drive and OneDrive, a CLI and installable Claude skills.",
5
+ "description": "Marketing on autopilot, run from your own AI agent. 906 tools. Publishing, scheduling, ad campaign management, comments, DMs and analytics cost no credits on every plan; credits are only for generating creative and for Ad Spy research. AD PLATFORMS: Meta, Google Ads, TikTok Ads, LinkedIn Ads, Reddit Ads, X Ads, Pinterest Ads, Snapchat Ads, Microsoft Advertising, Apple Search Ads, ChatGPT Ads and AppLovin Ads, plus product feeds in Google Merchant Center. PUBLISHING AND SCHEDULING: Facebook, Instagram, Threads, TikTok, YouTube, X, LinkedIn, Pinterest, Bluesky and Telegram. INSTAGRAM DM AUTOMATIONS: a keyword comment, a DM, a story reply or an ig.me link gets an automatic private reply from the brand. AD RESEARCH: the Meta, Google and LinkedIn ad libraries plus organic TikTok, Instagram, YouTube, Threads and Reddit. ANALYTICS: Google Analytics 4, Google Search Console and every connected platform's own post and campaign insights. Also brand onboarding, 50+ image and video generation models, ad scoring, competitor teardowns, Google Drive and OneDrive, a CLI and installable Claude skills.",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "hermoso": "bin/hermoso.mjs"