hermoso 0.1.425 → 0.1.426

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.
Files changed (2) hide show
  1. package/mcp/client.mjs +11 -3
  2. package/package.json +1 -1
package/mcp/client.mjs CHANGED
@@ -137,7 +137,7 @@ export function signInMessage(status, body, msg, isSignedOut = signedOut()) {
137
137
  }
138
138
 
139
139
  // unwrap the {data}|{error} envelope; throw a clean Error (with .status) on failure
140
- async function unwrap(res) {
140
+ async function unwrap(res, { read = false } = {}) {
141
141
  let body = null;
142
142
  try { body = await res.json(); } catch {}
143
143
  if (!res.ok) {
@@ -151,7 +151,15 @@ async function unwrap(res) {
151
151
  // WHAT THIS CALL WAS CHARGED (2026-10-19). A paid route answers {data, creditsUsed}, and the unwrap below drops the
152
152
  // sibling, so a synchronous paid tool's reply could never say what it cost. It is added to the running tool call's
153
153
  // tally (toolCtx), which wrap() in tools.mjs states once at the end of the reply. Free routes answer 0 or nothing.
154
- try { const c = body && typeof body === 'object' ? Number(body.creditsUsed) : NaN; const st = toolCtx.getStore(); if (st && Number.isFinite(c) && c > 0) st.apiCharged = (st.apiCharged || 0) + c; } catch {}
154
+ // Two shapes, both measured: a sibling {data, creditsUsed} (the research routes) and creditsUsed INSIDE data (generate_voice
155
+ // and the other generate routes; the first live run of this tally printed nothing on the CLI because of it). Inside-data
156
+ // counts only on a write: a GET that returns a record may carry a past charge, which is not this call's.
157
+ try {
158
+ const sib = body && typeof body === 'object' ? Number(body.creditsUsed) : NaN;
159
+ const inner = !read && body && body.data && typeof body.data === 'object' && !Array.isArray(body.data) ? Number(body.data.creditsUsed) : NaN;
160
+ const c = Number.isFinite(sib) ? sib : inner;
161
+ const st = toolCtx.getStore(); if (st && Number.isFinite(c) && c > 0) st.apiCharged = (st.apiCharged || 0) + c;
162
+ } catch {}
155
163
  return body && Object.prototype.hasOwnProperty.call(body, 'data') ? body.data : body;
156
164
  }
157
165
 
@@ -209,7 +217,7 @@ export async function apiGet(p, query) {
209
217
  const clean = query && Object.fromEntries(Object.entries(query).filter(([, v]) => v !== undefined && v !== null && v !== ''));
210
218
  const qs = clean && Object.keys(clean).length ? '?' + new URLSearchParams(clean).toString() : '';
211
219
  const res = await fetchRead(`${API_BASE}${withBrandScope(`${p}${qs}`)}`, { headers: headers() });
212
- return unwrap(res);
220
+ return unwrap(res, { read: true });
213
221
  }
214
222
 
215
223
  // ── A TRANSPORT FAILURE IS NOT A DEFECT, AND IT MUST NOT READ LIKE ONE (2026-08-31) ────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermoso",
3
- "version": "0.1.425",
3
+ "version": "0.1.426",
4
4
  "mcpName": "io.github.hermoso-ai/hermoso",
5
5
  "description": "AI marketing agent and AI ad generator, run from your own AI agent. 922 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, Telegram and Google Business Profile. 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",