@koda-sl/baker-cli 0.540.0 → 0.541.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -143,7 +143,7 @@ that prints its result beside `ok` rather than under `data` (`canvas validate`,
143
143
  ### The complete record: `--full`
144
144
 
145
145
  Commands with a compact default view declare `--full` to return every field
146
- (`baker ads meta ads|adsets|campaigns|audiences|creatives`, `images`, `winning-ads`, …). Every other command that
146
+ (`baker ads meta ads|adsets|campaigns|audiences|creatives|insights`, `images`, `winning-ads`, …). Every other command that
147
147
  prints the JSON envelope accepts `--full` too: it already prints everything it returns, so
148
148
  the flag changes nothing and a hint in the envelope says so (on stderr when the command
149
149
  printed a readable view instead). Commands that print no data envelope (`canvas run`,
@@ -1176,8 +1176,16 @@ baker ads meta insights --object act_123 --level campaign --intent revenue --dat
1176
1176
  # "Which creatives need a refresh?"
1177
1177
  baker ads meta insights --object act_123 --level ad --intent ranking --date-preset last_14d
1178
1178
 
1179
- # "Where do users drop off the funnel?"
1180
- baker ads meta insights --object act_123 --intent funnel
1179
+ # "Where do users drop off the funnel?" — each row adds result_type, results, cvr (% of link clicks), cost_per_result
1180
+ baker ads meta insights --object act_123 --level ad --intent funnel --output md
1181
+
1182
+ # "What does each CRM stage cost?" — --output md|csv prices each named type (cost_per.conversions.<type>)
1183
+ baker ads meta insights --object act_123 --level campaign --fields campaign_name,spend,conversions \
1184
+ --action-types Evaluando,Interesado --output md
1185
+
1186
+ # "How many sign-ups and leads per month?" — Meta's aliases collapse to one entry, engagement is left out
1187
+ baker ads meta insights --object act_123 --intent revenue --action-types complete_registration,lead \
1188
+ --time-increment monthly --since 2026-01-01 --until 2026-03-31 # --full returns Meta's raw action arrays
1181
1189
 
1182
1190
  # "Should we shift budget to Instagram?"
1183
1191
  baker ads meta insights --object act_123 --level adset \
@@ -34,7 +34,7 @@ Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedi
34
34
  },
35
35
  subCommands: {
36
36
  google: () => import("./google-UQLYCYSX.js").then((m) => m.googleCommand),
37
- meta: () => import("./meta-MBW5LM5V.js").then((m) => m.metaCommand),
37
+ meta: () => import("./meta-6IFYEOZL.js").then((m) => m.metaCommand),
38
38
  linkedin: () => import("./linkedin-YYNBLBM3.js").then((m) => m.linkedinCommand),
39
39
  x: () => import("./x-ROOD4SQH.js").then((m) => m.xCommand),
40
40
  chatgpt: () => import("./chatgpt-GINMQJBI.js").then((m) => m.chatgptCommand),
@@ -45,4 +45,4 @@ Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedi
45
45
  export {
46
46
  adsCommand
47
47
  };
48
- //# sourceMappingURL=ads-SJ6T366Q.js.map
48
+ //# sourceMappingURL=ads-LHI5X3M3.js.map
package/dist/cli.js CHANGED
@@ -463,7 +463,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
463
463
  capabilities: () => import("./capabilities-Y2UYDZZO.js").then((m) => m.capabilitiesCommand),
464
464
  actions: () => import("./actions-7ELREPKR.js").then((m) => m.actionsCommand),
465
465
  "scheduled-agents": () => import("./scheduled-agents-2NTFBABN.js").then((m) => m.scheduledAgentsCommand),
466
- ads: () => import("./ads-SJ6T366Q.js").then((m) => m.adsCommand),
466
+ ads: () => import("./ads-LHI5X3M3.js").then((m) => m.adsCommand),
467
467
  brand: () => import("./brand-YCYKIUIL.js").then((m) => m.brandCommand),
468
468
  analytics: () => import("./analytics-TBEIK33Y.js").then((m) => m.analyticsCommand),
469
469
  experiment: () => import("./experiment-2TTMKPVC.js").then((m) => m.experimentCommand),
@@ -35,6 +35,191 @@ import "./chunk-YQSBHWOI.js";
35
35
  // src/commands/ads/meta/insights.ts
36
36
  import { defineCommand } from "citty";
37
37
 
38
+ // src/commands/ads/meta/insights-actions.ts
39
+ var MIXED_ACTION_FIELDS = /* @__PURE__ */ new Set([
40
+ "actions",
41
+ "unique_actions",
42
+ "action_values",
43
+ "cost_per_action_type",
44
+ "cost_per_unique_action_type",
45
+ "conversions",
46
+ "conversion_values",
47
+ "cost_per_conversion"
48
+ ]);
49
+ var ENGAGEMENT_TYPES = /* @__PURE__ */ new Set([
50
+ "page_engagement",
51
+ "post_engagement",
52
+ "post",
53
+ "comment",
54
+ "like",
55
+ "photo_view",
56
+ "video_view",
57
+ "post_reaction",
58
+ "post_interaction_gross",
59
+ "post_interaction_net"
60
+ ]);
61
+ var ENGAGEMENT_PREFIX = "onsite_conversion.post_";
62
+ var COMBINED_TYPE = /_add_(?:\d+_s_calls|meta_leads)$/;
63
+ var ALIAS_PREFIXES = [
64
+ "omni_",
65
+ "offsite_conversion.fb_pixel_",
66
+ "onsite_web_app_",
67
+ "onsite_web_",
68
+ "app_custom_event.fb_mobile_"
69
+ ];
70
+ var LEAD_ALIASES = /* @__PURE__ */ new Set(["onsite_conversion.lead_grouped", "leadgen_grouped"]);
71
+ function canonicalType(type) {
72
+ if (LEAD_ALIASES.has(type)) return "lead";
73
+ if (type.startsWith("offsite_conversion.fb_pixel_custom")) return type;
74
+ const prefix = ALIAS_PREFIXES.find((p) => type.startsWith(p));
75
+ return prefix ? type.slice(prefix.length) : type;
76
+ }
77
+ function isNoise(type) {
78
+ return ENGAGEMENT_TYPES.has(type) || type.startsWith(ENGAGEMENT_PREFIX) || COMBINED_TYPE.test(type);
79
+ }
80
+ function isActionArray(value) {
81
+ return Array.isArray(value) && value.every((entry) => typeof entry === "object" && entry !== null && typeof entry.action_type === "string");
82
+ }
83
+ function representative(canonical, family) {
84
+ const pick = family.find((entry) => entry.action_type === `omni_${canonical}`) ?? family.find((entry) => entry.action_type === canonical) ?? family.reduce((best, entry) => Number(entry.value) > Number(best.value) ? entry : best);
85
+ return { ...pick, action_type: canonical };
86
+ }
87
+ function sliceOf(entry) {
88
+ return Object.entries(entry).filter(([key]) => key.startsWith("action_") && key !== "action_type");
89
+ }
90
+ function collapse(entries) {
91
+ const families = /* @__PURE__ */ new Map();
92
+ for (const entry of entries) {
93
+ const key = JSON.stringify([canonicalType(entry.action_type), sliceOf(entry)]);
94
+ families.set(key, [...families.get(key) ?? [], entry]);
95
+ }
96
+ return [...families.values()].map((family) => representative(canonicalType(family[0]?.action_type ?? ""), family));
97
+ }
98
+ function keepNamed(entries, wanted) {
99
+ const raw = entries.filter(
100
+ (entry) => wanted.includes(entry.action_type) && canonicalType(entry.action_type) !== entry.action_type || wanted.some((name) => entry.action_type.endsWith(`.${name}`))
101
+ );
102
+ const named = collapse(entries).filter((entry) => wanted.includes(entry.action_type));
103
+ return [...named, ...raw.filter((entry) => !named.some((kept) => kept.action_type === entry.action_type))];
104
+ }
105
+ function compactArray(field, entries, wanted, dropped) {
106
+ if (!MIXED_ACTION_FIELDS.has(field)) return collapse(entries);
107
+ if (wanted) return keepNamed(entries, wanted);
108
+ const kept = entries.filter((entry) => {
109
+ if (!isNoise(entry.action_type)) return true;
110
+ dropped.add(entry.action_type);
111
+ return false;
112
+ });
113
+ return collapse(kept);
114
+ }
115
+ function compactInsightsRows(rows, options) {
116
+ const dropped = /* @__PURE__ */ new Set();
117
+ const compacted = rows.map(
118
+ (row) => Object.fromEntries(
119
+ Object.entries(row).map(([field, value]) => [
120
+ field,
121
+ isActionArray(value) ? compactArray(field, value, options.actionTypes, dropped) : value
122
+ ])
123
+ )
124
+ );
125
+ return { rows: compacted, dropped: [...dropped] };
126
+ }
127
+ var COUNT_FIELDS = /* @__PURE__ */ new Set(["actions", "unique_actions", "conversions"]);
128
+ var CUSTOM_EVENT_PREFIX = "offsite_conversion.fb_pixel_custom";
129
+ function columnOf(field, entry) {
130
+ const slice = sliceOf(entry).map(([, value]) => String(value));
131
+ return slice.length === 0 ? `${field}.${entry.action_type}` : `${field}.${entry.action_type}[${slice.join(",")}]`;
132
+ }
133
+ function round2(value) {
134
+ return Math.round(value * 100) / 100;
135
+ }
136
+ function pricedEntry(field, entry, priceAll) {
137
+ if (!COUNT_FIELDS.has(field) || sliceOf(entry).length > 0) return false;
138
+ return priceAll || entry.action_type.startsWith(CUSTOM_EVENT_PREFIX);
139
+ }
140
+ function insightsTable(rows, fields, options = {}) {
141
+ const priceAll = options.priceAll ?? false;
142
+ const period = ["date_start", "date_stop"].filter(
143
+ (field) => !fields.includes(field) && rows.some((row) => row[field] !== void 0)
144
+ );
145
+ const columns = [...period, ...fields].flatMap((field) => {
146
+ const counts = /* @__PURE__ */ new Set();
147
+ const costs = /* @__PURE__ */ new Set();
148
+ for (const row of rows) {
149
+ const value = row[field];
150
+ if (!isActionArray(value)) continue;
151
+ for (const entry of value) {
152
+ counts.add(columnOf(field, entry));
153
+ if (pricedEntry(field, entry, priceAll) && row.spend !== void 0)
154
+ costs.add(`cost_per.${columnOf(field, entry)}`);
155
+ }
156
+ }
157
+ return counts.size === 0 ? [field] : [...counts, ...costs];
158
+ });
159
+ const flat = rows.map((row) => {
160
+ const out = {};
161
+ const spend = Number(row.spend);
162
+ for (const [field, value] of Object.entries(row)) {
163
+ if (!isActionArray(value)) {
164
+ out[field] = value;
165
+ continue;
166
+ }
167
+ for (const entry of value) {
168
+ const column = columnOf(field, entry);
169
+ out[column] = entry.value;
170
+ const count = Number(entry.value);
171
+ if (pricedEntry(field, entry, priceAll) && Number.isFinite(spend) && count > 0) {
172
+ out[`cost_per.${column}`] = round2(spend / count);
173
+ }
174
+ }
175
+ }
176
+ return out;
177
+ });
178
+ return { rows: flat, columns };
179
+ }
180
+ var FUNNEL_COLUMNS = ["result_type", "results", "cvr", "cost_per_result"];
181
+ var RESULT_PRIORITY = [
182
+ "purchase",
183
+ "complete_registration",
184
+ "lead",
185
+ "submit_application",
186
+ "subscribe",
187
+ "start_trial",
188
+ "schedule",
189
+ "contact",
190
+ "initiate_checkout",
191
+ "add_payment_info",
192
+ "add_to_cart"
193
+ ];
194
+ function countOf(actions, type) {
195
+ return actions.filter((entry) => entry.action_type === type).reduce((sum, entry) => sum + Number(entry.value), 0);
196
+ }
197
+ function resultTypeOf(actions, wanted) {
198
+ const present = new Set(actions.map((entry) => entry.action_type));
199
+ const named = (wanted ?? []).find((name) => [...present].some((type) => type === name || type.endsWith(`.${name}`)));
200
+ if (named) return [...present].find((type) => type === named || type.endsWith(`.${named}`)) ?? null;
201
+ const standard = RESULT_PRIORITY.find((type) => present.has(type));
202
+ if (standard) return standard;
203
+ const custom = actions.filter((entry) => entry.action_type.startsWith(CUSTOM_EVENT_PREFIX)).sort((a, b) => Number(b.value) - Number(a.value));
204
+ return custom[0]?.action_type ?? null;
205
+ }
206
+ function withFunnelResults(rows, options) {
207
+ return rows.map((row) => {
208
+ const actions = isActionArray(row.actions) ? row.actions : [];
209
+ const resultType = resultTypeOf(actions, options.actionTypes);
210
+ const results = resultType === null ? null : countOf(actions, resultType);
211
+ const linkClicks = row.inline_link_clicks !== void 0 ? Number(row.inline_link_clicks) : countOf(actions, "link_click");
212
+ const spend = Number(row.spend);
213
+ return {
214
+ ...row,
215
+ result_type: resultType,
216
+ results,
217
+ cvr: results !== null && linkClicks > 0 ? round2(results / linkClicks * 100) : null,
218
+ cost_per_result: results !== null && results > 0 && Number.isFinite(spend) ? round2(spend / results) : null
219
+ };
220
+ });
221
+ }
222
+
38
223
  // src/commands/ads/meta/placement-delivery.ts
39
224
  var MIN_IMPRESSIONS = 20;
40
225
  var SILENT_FRACTION_OF_REFERENCE = 0.1;
@@ -328,6 +513,21 @@ function syncedHintOf(body) {
328
513
  const level = body.level === "adset" ? "ad_group" : body.level;
329
514
  return syncedFirstHint("meta", level);
330
515
  }
516
+ function shapeRows(rows, args) {
517
+ if (args.full) return { rows, hints: [] };
518
+ const actionTypes = commaSplit(args["action-types"]);
519
+ const { rows: compacted, dropped } = compactInsightsRows(rows, { actionTypes });
520
+ const compact = args.intent === "funnel" ? withFunnelResults(compacted, { actionTypes }) : compacted;
521
+ if (dropped.length === 0) return { rows: compact, hints: [] };
522
+ const named = dropped.slice(0, 4).join(", ");
523
+ const more = dropped.length > 4 ? ` and ${dropped.length - 4} more` : "";
524
+ return {
525
+ rows: compact,
526
+ hints: [
527
+ `Engagement and combined action types were left out (${named}${more}); --action-types <type> keeps one, --full returns every raw action.`
528
+ ]
529
+ };
530
+ }
331
531
  var insightsCommand = defineCommand({
332
532
  meta: {
333
533
  name: "insights",
@@ -361,9 +561,20 @@ Examples \u2014 common AI questions:
361
561
  # "Should we shift budget to Instagram?"
362
562
  baker ads meta insights --object act_123 --level adset --breakdowns publisher_platform,platform_position
363
563
 
564
+ # "How many sign-ups and leads per month?" \u2014 one call, one row per month
565
+ baker ads meta insights --object act_123 --intent revenue --action-types complete_registration,lead --time-increment monthly --since 2026-01-01 --until 2026-03-31
566
+
364
567
  # Custom field set (escape hatch)
365
568
  baker ads meta insights --object act_123 --fields impressions,spend,actions
366
569
 
570
+ Action arrays (actions, cost_per_action_type, conversions, \u2026) are compact: Meta's aliases of one conversion
571
+ (omni_, offsite_conversion.fb_pixel_, onsite_web_ \u2026) collapse to one entry under its plain name
572
+ (complete_registration, lead, purchase), and engagement counts (likes, saves, video views) are left out.
573
+ --action-types keeps only the named types; --full returns Meta's raw arrays. --output md|csv gives each
574
+ action type its own column (actions.lead, cost_per_action_type.lead); a custom event, or every type --action-types
575
+ names, also gets its cost (cost_per.conversions.<type> = spend / count). --intent funnel adds result_type, results,
576
+ cvr (% of link clicks) and cost_per_result to each row; --action-types <type> picks which action is the result.
577
+
367
578
  Async is automatic for heavy queries; pass --async to force it, or --no-async to refuse fallback.`
368
579
  },
369
580
  args: {
@@ -380,6 +591,11 @@ Async is automatic for heavy queries; pass --async to force it, or --no-async to
380
591
  until: { type: "string", description: "Custom end date YYYY-MM-DD" },
381
592
  "time-increment": { type: "string", description: "1 (day) | monthly | all_days" },
382
593
  breakdowns: { type: "string", description: "Comma-separated breakdowns (e.g. publisher_platform,age)" },
594
+ "action-types": {
595
+ type: "string",
596
+ description: "Keep only these action types in actions/cost_per_action_type/conversions \u2014 plain names (complete_registration,lead,purchase), a raw Meta name, or a custom event's name"
597
+ },
598
+ full: { type: "boolean", description: "Return Meta's raw action arrays: every alias and engagement type" },
383
599
  "action-breakdowns": {
384
600
  type: "string",
385
601
  description: "Slice the actions[] array (default: action_type for revenue/funnel)"
@@ -418,13 +634,16 @@ Async is automatic for heavy queries; pass --async to force it, or --no-async to
418
634
  const wantAsync = wantsAsync(args.async, body);
419
635
  try {
420
636
  const rows = wantAsync ? await runAsync(body) : await apiPost("/api/ads/meta/insights", body);
421
- const sorted = args["no-sort"] ? rows : sortRowsBySpendDesc(rows);
637
+ const shaped = shapeRows(args["no-sort"] ? rows : sortRowsBySpendDesc(rows), args);
638
+ const sorted = shaped.rows;
422
639
  if (fmt !== "json") {
423
- writeAdsOutput(sorted, fmt, body.fields);
640
+ const fields = args.intent === "funnel" && !args.full ? [...body.fields, ...FUNNEL_COLUMNS] : body.fields;
641
+ const table = args.full || fmt === "jsonl" ? { rows: sorted, columns: fields } : insightsTable(sorted, fields, { priceAll: args["action-types"] !== void 0 });
642
+ writeAdsOutput(table.rows, fmt, table.columns, shaped.hints);
424
643
  return;
425
644
  }
426
645
  const synced = syncedHintOf(body);
427
- const hints = [...placementDeliveryHints(sorted), ...synced === null ? [] : [synced]];
646
+ const hints = [...placementDeliveryHints(sorted), ...shaped.hints, ...synced === null ? [] : [synced]];
428
647
  writeJsonEnvelope({ ok: true, data: sorted, hints });
429
648
  } catch (err) {
430
649
  handleMetaError(err);
@@ -436,4 +655,4 @@ export {
436
655
  insightsCommand,
437
656
  wantsAsync
438
657
  };
439
- //# sourceMappingURL=insights-UOO6OK3U.js.map
658
+ //# sourceMappingURL=insights-7NC2JFXU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/ads/meta/insights.ts","../src/commands/ads/meta/insights-actions.ts","../src/commands/ads/meta/placement-delivery.ts","../src/commands/ads/meta/presets.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet, apiPost } from \"../../../client.ts\";\nimport { writeAdsJson, writeAdsOutput, writeJsonEnvelope } from \"../output.ts\";\nimport { metaBreakdownSyncedHint, type SyncedLevel, syncedFirstHint } from \"../synced-first.ts\";\nimport { compactInsightsRows, FUNNEL_COLUMNS, insightsTable, withFunnelResults } from \"./insights-actions.ts\";\nimport { placementDeliveryHints } from \"./placement-delivery.ts\";\nimport { composeFields, getIntent, type InsightsIntent, type InsightsLevel, listIntents } from \"./presets.ts\";\nimport { csvOrJson, getDateRange, handleMetaError } from \"./shared.ts\";\n\nconst POLL_FIRST_MS = 5_000;\nconst POLL_LONGEST_MS = 30_000;\nconst POLL_MAX_MS = 10 * 60_000;\n\n/**\n * The wait before status poll `attempt` (0-based): 5s, growing by half each\n * poll, at most 30s. Every poll is a read from the ad account's hourly Meta\n * budget, and a long report gains nothing from being asked every 5 seconds.\n */\nexport function asyncPollDelayMs(attempt: number): number {\n return Math.min(Math.round(POLL_FIRST_MS * 1.5 ** attempt), POLL_LONGEST_MS);\n}\n\n/** Default attribution windows — only these still work as of Jan 2026 (1d_view + 28d_click also valid but rarely used). */\nconst DEFAULT_ATTRIBUTION_WINDOWS = [\"7d_click\", \"1d_view\"];\n\n/** Default filter — strip rows that didn't deliver. Almost always what we want. */\nconst DEFAULT_FILTERING = [{ field: \"impressions\", operator: \"GREATER_THAN\", value: 0 }];\n\nexport interface InsightsBody {\n object: string;\n level: InsightsLevel;\n fields: string[];\n datePreset?: string;\n since?: string;\n until?: string;\n timeIncrement?: string;\n breakdowns?: string[];\n actionBreakdowns?: string[];\n filtering?: Array<{ field: string; operator: string; value: string | number | string[] }>;\n attributionWindows?: string[];\n useAccountAttributionSetting?: boolean;\n useUnifiedAttributionSetting?: boolean;\n limit?: number;\n skipCache?: boolean;\n}\n\nfunction commaSplit(input: string | undefined): string[] | undefined {\n if (!input) return undefined;\n return input\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n}\n\nfunction parseFiltering(raw: string | undefined): InsightsBody[\"filtering\"] {\n if (!raw) return undefined;\n try {\n return JSON.parse(raw) as InsightsBody[\"filtering\"];\n } catch {\n handleMetaError(new Error(\"Invalid --filtering JSON\"));\n }\n}\n\nfunction pickIntent(name: string | undefined): InsightsIntent {\n if (!name) return \"baseline\";\n const found = getIntent(name);\n if (!found) {\n handleMetaError(new Error(`Unknown --intent: ${name}. Use --list-intents to see options.`));\n }\n return found.name;\n}\n\nfunction pickLevel(args: Record<string, unknown>): InsightsLevel {\n const raw = args.level as string | undefined;\n if (!raw) return \"account\";\n if (raw !== \"account\" && raw !== \"campaign\" && raw !== \"adset\" && raw !== \"ad\") {\n handleMetaError(new Error(\"--level must be one of: account|campaign|adset|ad\"));\n }\n return raw;\n}\n\n/**\n * Auto-async heuristic. Heavy queries that would time out as sync go async\n * automatically — the user shouldn't have to think about it.\n *\n * - level=ad with breakdowns\n * - >2 breakdowns at any level\n * - explicit time range > 90 days\n * - level=ad over an account-level object with a wide window\n */\nfunction shouldAutoAsync(body: InsightsBody): boolean {\n const breakdownCount = (body.breakdowns ?? []).length;\n if (body.level === \"ad\" && breakdownCount > 0 && body.object.startsWith(\"act_\")) {\n return true;\n }\n if (breakdownCount > 2) {\n return true;\n }\n if (body.since && body.until) {\n const days = (Date.parse(body.until) - Date.parse(body.since)) / 86_400_000;\n if (days > 90) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Whether to take the async path — three states, not two.\n *\n * citty resolves `--no-async` to `async: false` rather than filling a separate\n * `no-async` arg, so reading `args[\"no-async\"]` (as this did) always saw\n * undefined and the documented refusal never applied: a heavy query went async\n * no matter what the caller asked for.\n */\nexport function wantsAsync(asyncFlag: unknown, body: InsightsBody): boolean {\n if (asyncFlag === true) return true;\n if (asyncFlag === false) return false;\n return shouldAutoAsync(body);\n}\n\nfunction applyDateRange(body: InsightsBody, args: Record<string, unknown>): void {\n const range = getDateRange(args);\n if (range.datePreset) body.datePreset = range.datePreset;\n if (range.since) body.since = range.since;\n if (range.until) body.until = range.until;\n if (!body.datePreset && !(body.since && body.until)) {\n body.datePreset = \"last_7d\";\n }\n}\n\nfunction buildFiltering(args: Record<string, unknown>): InsightsBody[\"filtering\"] {\n const explicit = parseFiltering(args.filtering as string | undefined);\n if (explicit) return explicit;\n if (args[\"include-undelivered\"]) return undefined;\n return DEFAULT_FILTERING;\n}\n\nfunction buildAttributionWindows(args: Record<string, unknown>): string[] | undefined {\n const explicit = commaSplit(args[\"attribution-windows\"] as string | undefined);\n if (explicit) return explicit;\n return DEFAULT_ATTRIBUTION_WINDOWS;\n}\n\nfunction buildBody(args: Record<string, unknown>): InsightsBody {\n const intent = pickIntent(args.intent as string | undefined);\n const level = pickLevel(args);\n const intentDef = getIntent(intent);\n const explicitFields = commaSplit(args.fields as string | undefined);\n const fields = explicitFields ?? composeFields(intent, level);\n const breakdowns = commaSplit(args.breakdowns as string | undefined);\n const actionBreakdowns = commaSplit(args[\"action-breakdowns\"] as string | undefined) ?? intentDef?.actionBreakdowns;\n\n const body: InsightsBody = {\n object: args.object as string,\n level,\n fields,\n timeIncrement: args[\"time-increment\"] as string | undefined,\n breakdowns,\n actionBreakdowns,\n filtering: buildFiltering(args),\n attributionWindows: buildAttributionWindows(args),\n useAccountAttributionSetting: Boolean(args[\"use-account-attribution\"]),\n useUnifiedAttributionSetting: Boolean(args[\"use-unified-attribution\"]),\n limit: args.limit ? Number(args.limit) : 1000,\n skipCache: Boolean(args[\"no-cache\"]),\n };\n applyDateRange(body, args);\n return body;\n}\n\nasync function pollAsync(reportRunId: string): Promise<void> {\n const start = Date.now();\n for (let attempt = 0; Date.now() - start < POLL_MAX_MS; attempt++) {\n // The status route is a GET reading `report-run-id` from the query string.\n // Posting to it matched no route at all, so every heavy query died on a\n // bare 404 the moment it went async.\n const status = await apiGet<{ async_status?: string; async_percent_completion?: number }>(\n \"/api/ads/meta/insights/async/status\",\n { \"report-run-id\": reportRunId },\n );\n if (status.async_status === \"Job Completed\") return;\n if (status.async_status === \"Job Failed\" || status.async_status === \"Job Skipped\") {\n handleMetaError(new Error(`Async insights job ${status.async_status}`));\n }\n process.stderr.write(\n `Async insights ${status.async_status ?? \"queued\"} (${Math.round(status.async_percent_completion ?? 0)}%)…\\n`,\n );\n await new Promise((resolve) => setTimeout(resolve, asyncPollDelayMs(attempt)));\n }\n handleMetaError(new Error(\"Async insights polling timed out after 10 minutes\"));\n}\n\nasync function runAsync(body: InsightsBody): Promise<Array<Record<string, unknown>>> {\n const submit = await apiPost<{ reportRunId: string }>(\"/api/ads/meta/insights/async\", body);\n process.stderr.write(`Async insights job: ${submit.reportRunId}\\n`);\n await pollAsync(submit.reportRunId);\n return apiPost<Array<Record<string, unknown>>>(\"/api/ads/meta/insights/async/result\", {\n reportRunId: submit.reportRunId,\n fields: body.fields,\n limit: body.limit,\n });\n}\n\n/** Insights rows have nested `actions[]` arrays. Sort by the named action_type's value descending. */\nfunction sortRowsBySpendDesc(rows: Array<Record<string, unknown>>): Array<Record<string, unknown>> {\n return [...rows].sort((a, b) => {\n const sa = Number(a.spend ?? 0);\n const sb = Number(b.spend ?? 0);\n if (Number.isNaN(sa) || Number.isNaN(sb)) return 0;\n return sb - sa;\n });\n}\n\n/** The `baker ads performance` read that answers the same insights read; null when the synced copy cannot. */\nfunction syncedHintOf(body: InsightsBody): string | null {\n const breakdowns = body.breakdowns ?? [];\n if (breakdowns.length > 0) return metaBreakdownSyncedHint(breakdowns);\n const level: SyncedLevel = body.level === \"adset\" ? \"ad_group\" : body.level;\n return syncedFirstHint(\"meta\", level);\n}\n\n/** The compact rows, or Meta's own with --full, and the hint naming what the compact view dropped. */\nfunction shapeRows(\n rows: Array<Record<string, unknown>>,\n args: Record<string, unknown>,\n): { rows: Array<Record<string, unknown>>; hints: string[] } {\n if (args.full) return { rows, hints: [] };\n const actionTypes = commaSplit(args[\"action-types\"] as string | undefined);\n const { rows: compacted, dropped } = compactInsightsRows(rows, { actionTypes });\n const compact = args.intent === \"funnel\" ? withFunnelResults(compacted, { actionTypes }) : compacted;\n if (dropped.length === 0) return { rows: compact, hints: [] };\n const named = dropped.slice(0, 4).join(\", \");\n const more = dropped.length > 4 ? ` and ${dropped.length - 4} more` : \"\";\n return {\n rows: compact,\n hints: [\n `Engagement and combined action types were left out (${named}${more}); --action-types <type> keeps one, --full returns every raw action.`,\n ],\n };\n}\n\nexport const insightsCommand = defineCommand({\n meta: {\n name: \"insights\",\n description: `Performance reporting — the main Meta tool for AI agents.\n\nSmart defaults so the AI doesn't have to remember every flag:\n --level account (set --level campaign|adset|ad to drill in)\n --intent baseline (or revenue|funnel|ranking|video|identity)\n --date-preset last_7d (override with --since/--until)\n --attribution-windows 7d_click,1d_view (the only ones still working post Jan 2026)\n filter: impressions > 0 (skip undelivered rows; --include-undelivered to keep)\n sort: spend descending (when result fits in memory)\n auto-async when query is heavy (level=ad + breakdowns, big date ranges, etc.)\n\nIdentity fields (campaign_name, ad_name etc.) are appended automatically based on --level so rows\nare self-describing.\n\nExamples — common AI questions:\n # \"How is GreenLeaf doing this week?\"\n baker ads meta insights --object act_123\n\n # \"Which campaigns are profitable?\"\n baker ads meta insights --object act_123 --level campaign --intent revenue --date-preset last_28d\n\n # \"Which creatives need a refresh?\"\n baker ads meta insights --object act_123 --level ad --intent ranking --date-preset last_14d\n\n # \"Where do users drop off the funnel?\"\n baker ads meta insights --object act_123 --intent funnel\n\n # \"Should we shift budget to Instagram?\"\n baker ads meta insights --object act_123 --level adset --breakdowns publisher_platform,platform_position\n\n # \"How many sign-ups and leads per month?\" — one call, one row per month\n baker ads meta insights --object act_123 --intent revenue --action-types complete_registration,lead --time-increment monthly --since 2026-01-01 --until 2026-03-31\n\n # Custom field set (escape hatch)\n baker ads meta insights --object act_123 --fields impressions,spend,actions\n\nAction arrays (actions, cost_per_action_type, conversions, …) are compact: Meta's aliases of one conversion\n(omni_, offsite_conversion.fb_pixel_, onsite_web_ …) collapse to one entry under its plain name\n(complete_registration, lead, purchase), and engagement counts (likes, saves, video views) are left out.\n--action-types keeps only the named types; --full returns Meta's raw arrays. --output md|csv gives each\naction type its own column (actions.lead, cost_per_action_type.lead); a custom event, or every type --action-types\nnames, also gets its cost (cost_per.conversions.<type> = spend / count). --intent funnel adds result_type, results,\ncvr (% of link clicks) and cost_per_result to each row; --action-types <type> picks which action is the result.\n\nAsync is automatic for heavy queries; pass --async to force it, or --no-async to refuse fallback.`,\n },\n args: {\n object: {\n type: \"string\",\n description: \"Object ID — act_<id> for account, or a campaign/adset/ad ID\",\n },\n level: { type: \"string\", description: \"account|campaign|adset|ad (default: account)\" },\n intent: { type: \"string\", description: \"baseline|revenue|funnel|ranking|video|identity (default: baseline)\" },\n fields: { type: \"string\", description: \"Comma-separated field list (overrides --intent bundle)\" },\n \"list-intents\": { type: \"boolean\", description: \"Print available intents and exit\" },\n \"date-preset\": { type: \"string\", description: \"Meta date preset (last_7d, last_28d, today, ...)\" },\n since: { type: \"string\", description: \"Custom start date YYYY-MM-DD\" },\n until: { type: \"string\", description: \"Custom end date YYYY-MM-DD\" },\n \"time-increment\": { type: \"string\", description: \"1 (day) | monthly | all_days\" },\n breakdowns: { type: \"string\", description: \"Comma-separated breakdowns (e.g. publisher_platform,age)\" },\n \"action-types\": {\n type: \"string\",\n description:\n \"Keep only these action types in actions/cost_per_action_type/conversions — plain names (complete_registration,lead,purchase), a raw Meta name, or a custom event's name\",\n },\n full: { type: \"boolean\", description: \"Return Meta's raw action arrays: every alias and engagement type\" },\n \"action-breakdowns\": {\n type: \"string\",\n description: \"Slice the actions[] array (default: action_type for revenue/funnel)\",\n },\n filtering: { type: \"string\", description: \"Override default filter — JSON array of {field,operator,value}\" },\n \"include-undelivered\": { type: \"boolean\", description: \"Keep rows where impressions=0 (off by default)\" },\n \"attribution-windows\": {\n type: \"string\",\n description: \"Override default 7d_click,1d_view (only 1d_view, 1d_click, 7d_click, 28d_click work post Jan 2026)\",\n },\n \"use-account-attribution\": { type: \"boolean\", description: \"Use account-saved attribution setting\" },\n \"use-unified-attribution\": { type: \"boolean\", description: \"Use ad-set unified attribution setting\" },\n limit: { type: \"string\", description: \"Max rows (default 1000)\" },\n // Declaring `no-async` too would be a trap: citty resolves it to `async: false`\n // and never fills an arg of that name, so the declaration reads as supported\n // while nothing consumes it.\n async: { type: \"boolean\", description: \"Force the async submit-and-poll path (--no-async refuses it)\" },\n \"no-sort\": { type: \"boolean\", description: \"Skip default spend-desc sort\" },\n \"no-cache\": NO_CACHE_ARG,\n output: { type: \"string\", description: \"Output format: json|csv|jsonl|md\", default: \"json\" },\n },\n run: async ({ args }) => {\n if (args[\"list-intents\"]) {\n writeAdsJson({ ok: true, data: listIntents() });\n return;\n }\n\n if (!args.object) {\n writeAdsJson({\n ok: false,\n error: { code: \"VALIDATION_ERROR\", message: \"Missing required argument: --object\" },\n });\n process.exit(1);\n }\n\n const body = buildBody(args);\n const fmt = csvOrJson(args);\n const wantAsync = wantsAsync(args.async, body);\n\n try {\n const rows = wantAsync\n ? await runAsync(body)\n : await apiPost<Array<Record<string, unknown>>>(\"/api/ads/meta/insights\", body);\n const shaped = shapeRows(args[\"no-sort\"] ? rows : sortRowsBySpendDesc(rows), args);\n const sorted = shaped.rows;\n\n if (fmt !== \"json\") {\n const fields = args.intent === \"funnel\" && !args.full ? [...body.fields, ...FUNNEL_COLUMNS] : body.fields;\n const table =\n args.full || fmt === \"jsonl\"\n ? { rows: sorted, columns: fields }\n : insightsTable(sorted, fields, { priceAll: args[\"action-types\"] !== undefined });\n writeAdsOutput(table.rows, fmt, table.columns, shaped.hints);\n return;\n }\n const synced = syncedHintOf(body);\n const hints = [...placementDeliveryHints(sorted), ...shaped.hints, ...(synced === null ? [] : [synced])];\n writeJsonEnvelope({ ok: true, data: sorted, hints });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n","/**\n * The compact view of Meta's insights action arrays (`actions`,\n * `cost_per_action_type`, `conversions`, …).\n *\n * Meta returns one conversion under up to six names — `complete_registration`,\n * `omni_complete_registration`, `offsite_conversion.fb_pixel_complete_registration`,\n * `onsite_web_…` — with the same count, beside every engagement count the\n * account ever had (likes, saves, unlikes, video views). A one-month revenue\n * read ran to ~35 entries per row and 3.7 KB, and agents cut it with `head -c`\n * past the spend figure (BAKER-855). So by default each alias family becomes one\n * entry under its plain name, and engagement and Meta's combined \"+ 20s calls\" /\n * \"+ Meta leads\" restatements are dropped from the mixed arrays. `--action-types`\n * keeps only the named ones; `--full` skips this module.\n */\n\ntype InsightsRow = Record<string, unknown>;\ntype ActionEntry = Record<string, unknown> & { action_type: string };\n\n/** Arrays that mix every action type; single-purpose arrays (video watch, outbound clicks) are only de-aliased. */\nconst MIXED_ACTION_FIELDS = new Set([\n \"actions\",\n \"unique_actions\",\n \"action_values\",\n \"cost_per_action_type\",\n \"cost_per_unique_action_type\",\n \"conversions\",\n \"conversion_values\",\n \"cost_per_conversion\",\n]);\n\nconst ENGAGEMENT_TYPES = new Set([\n \"page_engagement\",\n \"post_engagement\",\n \"post\",\n \"comment\",\n \"like\",\n \"photo_view\",\n \"video_view\",\n \"post_reaction\",\n \"post_interaction_gross\",\n \"post_interaction_net\",\n]);\n\n/** `onsite_conversion.post_save`, `…post_net_like`, `…post_unlike` and the rest of the post counters. */\nconst ENGAGEMENT_PREFIX = \"onsite_conversion.post_\";\n\n/** Meta's sums of a conversion with another result (`offsite_lead_add_20_s_calls`), each already its own entry. */\nconst COMBINED_TYPE = /_add_(?:\\d+_s_calls|meta_leads)$/;\n\n/** The channel prefixes Meta puts in front of one conversion's name; `omni_` is the cross-channel total. */\nconst ALIAS_PREFIXES = [\n \"omni_\",\n \"offsite_conversion.fb_pixel_\",\n \"onsite_web_app_\",\n \"onsite_web_\",\n \"app_custom_event.fb_mobile_\",\n];\n\n/** On-Facebook lead forms report under their own names; `lead` is the total that includes them. */\nconst LEAD_ALIASES = new Set([\"onsite_conversion.lead_grouped\", \"leadgen_grouped\"]);\n\n/** A custom event (`offsite_conversion.fb_pixel_custom.<Name>`) keeps its full name: it has no alias. */\nfunction canonicalType(type: string): string {\n if (LEAD_ALIASES.has(type)) return \"lead\";\n if (type.startsWith(\"offsite_conversion.fb_pixel_custom\")) return type;\n const prefix = ALIAS_PREFIXES.find((p) => type.startsWith(p));\n return prefix ? type.slice(prefix.length) : type;\n}\n\nfunction isNoise(type: string): boolean {\n return ENGAGEMENT_TYPES.has(type) || type.startsWith(ENGAGEMENT_PREFIX) || COMBINED_TYPE.test(type);\n}\n\nfunction isActionArray(value: unknown): value is ActionEntry[] {\n return (\n Array.isArray(value) &&\n value.every((entry) => typeof entry === \"object\" && entry !== null && typeof entry.action_type === \"string\")\n );\n}\n\n/** The cross-channel `omni_` entry, else the plain name, else the largest alias: never a sum, the aliases overlap. */\nfunction representative(canonical: string, family: ActionEntry[]): ActionEntry {\n const pick =\n family.find((entry) => entry.action_type === `omni_${canonical}`) ??\n family.find((entry) => entry.action_type === canonical) ??\n family.reduce((best, entry) => (Number(entry.value) > Number(best.value) ? entry : best));\n return { ...pick, action_type: canonical };\n}\n\n/** The `--action-breakdowns` dimensions an entry is sliced by (`action_device: \"iphone\"`), beyond its type. */\nfunction sliceOf(entry: ActionEntry): Array<[string, unknown]> {\n return Object.entries(entry).filter(([key]) => key.startsWith(\"action_\") && key !== \"action_type\");\n}\n\n/** Aliases collapse within one breakdown slice: an iPhone and a desktop count of one conversion are two entries. */\nfunction collapse(entries: ActionEntry[]): ActionEntry[] {\n const families = new Map<string, ActionEntry[]>();\n for (const entry of entries) {\n const key = JSON.stringify([canonicalType(entry.action_type), sliceOf(entry)]);\n families.set(key, [...(families.get(key) ?? []), entry]);\n }\n return [...families.values()].map((family) => representative(canonicalType(family[0]?.action_type ?? \"\"), family));\n}\n\n/** `--action-types`: a plain name (its aliases collapsed), an exact raw name, or a custom event's own name. */\nfunction keepNamed(entries: ActionEntry[], wanted: string[]): ActionEntry[] {\n const raw = entries.filter(\n (entry) =>\n (wanted.includes(entry.action_type) && canonicalType(entry.action_type) !== entry.action_type) ||\n wanted.some((name) => entry.action_type.endsWith(`.${name}`)),\n );\n const named = collapse(entries).filter((entry) => wanted.includes(entry.action_type));\n return [...named, ...raw.filter((entry) => !named.some((kept) => kept.action_type === entry.action_type))];\n}\n\nfunction compactArray(field: string, entries: ActionEntry[], wanted: string[] | undefined, dropped: Set<string>) {\n if (!MIXED_ACTION_FIELDS.has(field)) return collapse(entries);\n if (wanted) return keepNamed(entries, wanted);\n const kept = entries.filter((entry) => {\n if (!isNoise(entry.action_type)) return true;\n dropped.add(entry.action_type);\n return false;\n });\n return collapse(kept);\n}\n\n/** Every row with its action arrays compacted, and the engagement or combined types that were dropped. */\nexport function compactInsightsRows(\n rows: InsightsRow[],\n options: { actionTypes?: string[] },\n): { rows: InsightsRow[]; dropped: string[] } {\n const dropped = new Set<string>();\n const compacted = rows.map((row) =>\n Object.fromEntries(\n Object.entries(row).map(([field, value]) => [\n field,\n isActionArray(value) ? compactArray(field, value, options.actionTypes, dropped) : value,\n ]),\n ),\n );\n return { rows: compacted, dropped: [...dropped] };\n}\n\n/** Arrays that count actions; their entries can be priced from the row's spend. */\nconst COUNT_FIELDS = new Set([\"actions\", \"unique_actions\", \"conversions\"]);\n\nconst CUSTOM_EVENT_PREFIX = \"offsite_conversion.fb_pixel_custom\";\n\n/** `actions.lead`, or `actions.lead[iphone]` for an `--action-breakdowns` slice. */\nfunction columnOf(field: string, entry: ActionEntry): string {\n const slice = sliceOf(entry).map(([, value]) => String(value));\n return slice.length === 0 ? `${field}.${entry.action_type}` : `${field}.${entry.action_type}[${slice.join(\",\")}]`;\n}\n\nfunction round2(value: number): number {\n return Math.round(value * 100) / 100;\n}\n\n/** Spend over count, for an unsliced count entry that is priced: spend is per row, never per breakdown slice. */\nfunction pricedEntry(field: string, entry: ActionEntry, priceAll: boolean): boolean {\n if (!COUNT_FIELDS.has(field) || sliceOf(entry).length > 0) return false;\n return priceAll || entry.action_type.startsWith(CUSTOM_EVENT_PREFIX);\n}\n\n/**\n * Rows for `--output md|csv`: each action array becomes one `<field>.<action_type>`\n * column holding its total, in place of the array as JSON in one cell. The\n * click/view split stays in `--output json|jsonl`. Meta adds each row's period\n * (`date_start`, `date_stop`) outside the requested fields; it leads the table.\n * A custom event (a CRM stage), or every type `--action-types` named\n * (`priceAll`), gets a `cost_per.<field>.<action_type>` column: the row's spend\n * over that count, in the requested attribution windows.\n */\nexport function insightsTable(\n rows: InsightsRow[],\n fields: string[],\n options: { priceAll?: boolean } = {},\n): { rows: InsightsRow[]; columns: string[] } {\n const priceAll = options.priceAll ?? false;\n const period = [\"date_start\", \"date_stop\"].filter(\n (field) => !fields.includes(field) && rows.some((row) => row[field] !== undefined),\n );\n const columns = [...period, ...fields].flatMap((field) => {\n const counts = new Set<string>();\n const costs = new Set<string>();\n for (const row of rows) {\n const value = row[field];\n if (!isActionArray(value)) continue;\n for (const entry of value) {\n counts.add(columnOf(field, entry));\n if (pricedEntry(field, entry, priceAll) && row.spend !== undefined)\n costs.add(`cost_per.${columnOf(field, entry)}`);\n }\n }\n return counts.size === 0 ? [field] : [...counts, ...costs];\n });\n const flat = rows.map((row) => {\n const out: InsightsRow = {};\n const spend = Number(row.spend);\n for (const [field, value] of Object.entries(row)) {\n if (!isActionArray(value)) {\n out[field] = value;\n continue;\n }\n for (const entry of value) {\n const column = columnOf(field, entry);\n out[column] = entry.value;\n const count = Number(entry.value);\n if (pricedEntry(field, entry, priceAll) && Number.isFinite(spend) && count > 0) {\n out[`cost_per.${column}`] = round2(spend / count);\n }\n }\n }\n return out;\n });\n return { rows: flat, columns };\n}\n\n/** The columns `--intent funnel` adds to every row. */\nexport const FUNNEL_COLUMNS = [\"result_type\", \"results\", \"cvr\", \"cost_per_result\"];\n\n/** The conversions a funnel ends in, deepest first: the first one an ad reports is its result. */\nconst RESULT_PRIORITY = [\n \"purchase\",\n \"complete_registration\",\n \"lead\",\n \"submit_application\",\n \"subscribe\",\n \"start_trial\",\n \"schedule\",\n \"contact\",\n \"initiate_checkout\",\n \"add_payment_info\",\n \"add_to_cart\",\n];\n\nfunction countOf(actions: ActionEntry[], type: string): number {\n return actions.filter((entry) => entry.action_type === type).reduce((sum, entry) => sum + Number(entry.value), 0);\n}\n\nfunction resultTypeOf(actions: ActionEntry[], wanted: string[] | undefined): string | null {\n const present = new Set(actions.map((entry) => entry.action_type));\n const named = (wanted ?? []).find((name) => [...present].some((type) => type === name || type.endsWith(`.${name}`)));\n if (named) return [...present].find((type) => type === named || type.endsWith(`.${named}`)) ?? null;\n const standard = RESULT_PRIORITY.find((type) => present.has(type));\n if (standard) return standard;\n const custom = actions\n .filter((entry) => entry.action_type.startsWith(CUSTOM_EVENT_PREFIX))\n .sort((a, b) => Number(b.value) - Number(a.value));\n return custom[0]?.action_type ?? null;\n}\n\n/**\n * `--intent funnel` rows with the figures the intent exists for: the ad's\n * result (the first `--action-types` name it reports, else its deepest standard\n * conversion, else its largest custom event), `cvr` as the percent of link\n * clicks that became one, and `cost_per_result` as spend over results. Reads\n * compacted rows, where each conversion sits under its plain name.\n */\nexport function withFunnelResults(rows: InsightsRow[], options: { actionTypes?: string[] }): InsightsRow[] {\n return rows.map((row) => {\n const actions = isActionArray(row.actions) ? row.actions : [];\n const resultType = resultTypeOf(actions, options.actionTypes);\n const results = resultType === null ? null : countOf(actions, resultType);\n const linkClicks =\n row.inline_link_clicks !== undefined ? Number(row.inline_link_clicks) : countOf(actions, \"link_click\");\n const spend = Number(row.spend);\n return {\n ...row,\n result_type: resultType,\n results,\n cvr: results !== null && linkClicks > 0 ? round2((results / linkClicks) * 100) : null,\n cost_per_result: results !== null && results > 0 && Number.isFinite(spend) ? round2(spend / results) : null,\n };\n });\n}\n","import { placementFormatNote, previewFormatForPosition } from \"@baker/api/ads-meta\";\n\n/**\n * Reads a placement breakdown the way the question \"why does my video show as a\n * still image?\" actually needs to be answered: with this account's own numbers.\n *\n * The failure this replaces is an agent recalling a list of \"image-only\n * placements\" (most of it wrong) and inventing a mechanism Meta does not\n * document. Impressions against video plays, per placement, is the cheap\n * empirical check — it costs one query the agent already ran, and it is\n * account evidence rather than a rule. So the hints below name a suspect and\n * hand over the command that confirms it; they never conclude.\n */\n\n/**\n * Below this, a placement's play rate is arithmetic on too few impressions to\n * carry a claim. Set against a 90%-ish reference rate, seeing no plays in 20\n * impressions is not something chance produces — so this is low enough to reach\n * the long tail where format problems actually live, and the placements it\n * excludes are the ones nobody could have concluded anything from anyway.\n */\nconst MIN_IMPRESSIONS = 20;\n\n/**\n * How far below the ad's own play rate counts as \"this placement is not playing\".\n *\n * Judged against the ad, not against zero. The account this was built from is\n * the reason: it plays at 93% overall, and the one placement carrying a\n * documented format constraint played at 3.85% — 24x worse, and still above any\n * absolute \"under 2%\" bar. An absolute rule cannot see that at any impression\n * threshold; a relative one calibrates itself per creative and per account.\n */\nconst SILENT_FRACTION_OF_REFERENCE = 0.1;\n\n/** Proof the creative plays at all somewhere, so a flagged placement means something. */\nconst PLAYING_REFERENCE_RATE = 0.5;\n\ninterface PlacementDelivery {\n platform: string;\n position: string;\n impressions: number;\n plays: number;\n playRate: number;\n share: number;\n}\n\nfunction toNumber(value: unknown): number {\n const n = Number(value);\n return Number.isFinite(n) ? n : 0;\n}\n\n/** Meta returns action metrics as `[{ action_type, value }]`; the total is what matters here. */\nfunction sumActionValues(value: unknown): number {\n if (!Array.isArray(value)) return 0;\n return value.reduce<number>((total, entry) => {\n const item = entry as { value?: unknown };\n return total + toNumber(item?.value);\n }, 0);\n}\n\nfunction aggregate(rows: Array<Record<string, unknown>>): PlacementDelivery[] {\n const byPlacement = new Map<string, PlacementDelivery>();\n let totalImpressions = 0;\n\n for (const row of rows) {\n const position = row.platform_position;\n if (typeof position !== \"string\" || position.length === 0) continue;\n const platform = typeof row.publisher_platform === \"string\" ? row.publisher_platform : \"\";\n const impressions = toNumber(row.impressions);\n totalImpressions += impressions;\n const key = `${platform}/${position}`;\n const current = byPlacement.get(key) ?? { platform, position, impressions: 0, plays: 0, playRate: 0, share: 0 };\n current.impressions += impressions;\n current.plays += sumActionValues(row.video_play_actions);\n byPlacement.set(key, current);\n }\n\n return [...byPlacement.values()].map((placement) => ({\n ...placement,\n playRate: placement.impressions > 0 ? placement.plays / placement.impressions : 0,\n share: totalImpressions > 0 ? placement.impressions / totalImpressions : 0,\n }));\n}\n\nfunction previewCommand(placement: PlacementDelivery): string {\n const format = previewFormatForPosition(placement.position, placement.platform);\n return format\n ? `\\`baker ads meta preview --creative-id <id> --placement ${placement.position} --platform ${placement.platform}\\``\n : `no preview format is known for ${placement.position}, so Meta's renderer cannot confirm it — say the placement is unverified rather than filling the gap`;\n}\n\n/**\n * The play rate only means something when every row describes the same\n * creative. Aggregating placements across ads puts an image ad's impressions in\n * the same bucket as a video's plays, which reads as \"this placement doesn't\n * render video\" when it only means \"an image ad ran there\" — the exact wrong\n * conclusion this module exists to prevent. So a query that does not pin one ad\n * (`--level ad --object <adId>`) gets no hint rather than a confounded one.\n */\nfunction isSingleAdQuery(rows: Array<Record<string, unknown>>): boolean {\n const adIds = new Set<string>();\n for (const row of rows) {\n if (typeof row.ad_id !== \"string\" || row.ad_id.length === 0) return false;\n adIds.add(row.ad_id);\n }\n return adIds.size === 1;\n}\n\n/**\n * Placements this account delivered into without the video ever playing.\n *\n * Silent unless the query carried video metrics AND the creative demonstrably\n * plays somewhere else: without a playing reference, a zero everywhere means\n * \"not a video query\", not \"the placement is broken\".\n */\nexport function placementDeliveryHints(rows: Array<Record<string, unknown>>): string[] {\n const carriesVideoMetrics = rows.some((row) => Array.isArray(row.video_play_actions));\n if (!carriesVideoMetrics || !isSingleAdQuery(rows)) return [];\n\n const placements = aggregate(rows);\n const judgeable = placements.filter((p) => p.impressions >= MIN_IMPRESSIONS);\n const impressions = judgeable.reduce((total, p) => total + p.impressions, 0);\n const reference = impressions > 0 ? judgeable.reduce((total, p) => total + p.plays, 0) / impressions : 0;\n if (reference < PLAYING_REFERENCE_RATE) return [];\n\n const silent = judgeable\n .filter((p) => p.playRate < reference * SILENT_FRACTION_OF_REFERENCE)\n .sort((a, b) => b.impressions - a.impressions);\n\n // Never go quiet on a video placement query. Silence is what the agent fills\n // in with a remembered rule, and \"every placement plays\" is the answer to\n // \"why does it show as a still image\" far more often than a placement is.\n if (silent.length === 0) {\n const worst = [...judgeable].sort((a, b) => a.playRate - b.playRate)[0];\n return [\n `Checked every placement above ${MIN_IMPRESSIONS} impressions against this ad's own play rate (${(reference * 100).toFixed(0)}%): no placement is failing to play the video${worst ? `, the lowest being ${worst.platform}/${worst.position} at ${(worst.playRate * 100).toFixed(0)}%` : \"\"}. So placements do not explain a \"it shows as a still image\" report — rule out autoplay off or data saver in the viewer's own app, which renders every video as its cover frame account-wide.`,\n ];\n }\n\n const hints = silent.map((placement) => {\n const note = placementFormatNote(placement.position);\n const documented = note ? ` Meta documents this placement: ${note.note}` : \"\";\n return `${placement.platform}/${placement.position} delivered ${placement.impressions.toLocaleString(\"en-US\")} impressions (${(placement.share * 100).toFixed(1)}% of the total) and ${placement.plays.toLocaleString(\"en-US\")} video plays — it may not be rendering the video. This is account evidence, not a rule: confirm what Meta renders there with ${previewCommand(placement)} before you say anything about it.${documented}`;\n });\n\n const combinedShare = silent.reduce((total, placement) => total + placement.share, 0) * 100;\n hints.push(\n `Those placements are ${combinedShare.toFixed(1)}% of delivery in this query. State that share before proposing to remove them — and note that removing placements from a live ad set is a targeting change, which Meta counts as a significant edit that re-enters the learning phase.`,\n );\n return hints;\n}\n","/**\n * Insights field bundles. Picked for AI agent ergonomics: small, focused field\n * lists that answer one specific question without forcing the AI to enumerate\n * Meta's 500+ insights fields.\n *\n * Two-axis design:\n * --intent (field bundle, default: baseline) — what data to ask for\n * --level (object granularity, default: account) — at what granularity\n *\n * Intents are independent of level — pass `--intent ranking --level ad` to flag\n * creatives, or `--intent revenue --level campaign` for ROAS by campaign.\n *\n * Identity fields (campaign_name etc.) are appended automatically based on\n * level so the AI can read rows without joining.\n */\n\nexport type InsightsLevel = \"account\" | \"campaign\" | \"adset\" | \"ad\";\n\nexport type InsightsIntent = \"baseline\" | \"revenue\" | \"funnel\" | \"ranking\" | \"video\" | \"identity\";\n\ninterface IntentDefinition {\n name: InsightsIntent;\n description: string;\n fields: string[];\n /** Action breakdowns to slice the actions[] array — empty if not needed. */\n actionBreakdowns?: string[];\n}\n\nconst INSIGHTS_INTENTS: Record<InsightsIntent, IntentDefinition> = {\n baseline: {\n name: \"baseline\",\n description: \"Spend, impressions, clicks, CTR, CPC, CPM. The default question: 'how is delivery?'\",\n fields: [\"impressions\", \"reach\", \"frequency\", \"spend\", \"clicks\", \"ctr\", \"cpc\", \"cpm\"],\n },\n revenue: {\n name: \"revenue\",\n description: \"Spend, conversions, action_values, purchase_roas. 'How much money are we making?'\",\n fields: [\"spend\", \"actions\", \"action_values\", \"conversions\", \"conversion_values\", \"purchase_roas\"],\n actionBreakdowns: [\"action_type\"],\n },\n funnel: {\n name: \"funnel\",\n description: \"Impression → click → landing page → action. 'Where do users drop off?'\",\n fields: [\"impressions\", \"clicks\", \"inline_link_clicks\", \"outbound_clicks\", \"actions\", \"spend\"],\n actionBreakdowns: [\"action_type\"],\n },\n ranking: {\n name: \"ranking\",\n description: \"Quality, engagement, conversion-rate rankings. 'Which creatives need a refresh?'\",\n fields: [\"impressions\", \"spend\", \"ctr\", \"quality_ranking\", \"engagement_rate_ranking\", \"conversion_rate_ranking\"],\n },\n video: {\n name: \"video\",\n description: \"Watch funnel, thruplay cost. 'How are video creatives holding attention?'\",\n fields: [\n \"impressions\",\n \"spend\",\n \"video_play_actions\",\n \"video_p25_watched_actions\",\n \"video_p50_watched_actions\",\n \"video_p75_watched_actions\",\n \"video_p100_watched_actions\",\n \"video_thruplay_watched_actions\",\n \"cost_per_thruplay\",\n ],\n },\n identity: {\n name: \"identity\",\n description: \"Just the names + spend — for cheap roll-up summaries.\",\n fields: [\"spend\", \"impressions\"],\n },\n};\n\nconst IDENTITY_FIELDS_BY_LEVEL: Record<InsightsLevel, string[]> = {\n account: [\"account_id\", \"account_name\", \"account_currency\"],\n campaign: [\"campaign_id\", \"campaign_name\", \"objective\"],\n adset: [\"adset_id\", \"adset_name\", \"campaign_id\", \"campaign_name\"],\n ad: [\"ad_id\", \"ad_name\", \"adset_id\", \"adset_name\", \"campaign_id\", \"campaign_name\"],\n};\n\n/** Compose final field list: intent metrics + level-specific identity fields, deduplicated. */\nexport function composeFields(intent: InsightsIntent, level: InsightsLevel): string[] {\n const intentFields = INSIGHTS_INTENTS[intent].fields;\n const identity = IDENTITY_FIELDS_BY_LEVEL[level];\n const seen = new Set<string>();\n const out: string[] = [];\n for (const f of [...identity, ...intentFields]) {\n if (!seen.has(f)) {\n seen.add(f);\n out.push(f);\n }\n }\n return out;\n}\n\nexport function getIntent(name: string): IntentDefinition | undefined {\n return INSIGHTS_INTENTS[name as InsightsIntent];\n}\n\nexport function listIntents(): IntentDefinition[] {\n return Object.values(INSIGHTS_INTENTS);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;;;ACmB9B,IAAM,sBAAsB,oBAAI,IAAI;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,mBAAmB,oBAAI,IAAI;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAM,oBAAoB;AAG1B,IAAM,gBAAgB;AAGtB,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGA,IAAM,eAAe,oBAAI,IAAI,CAAC,kCAAkC,iBAAiB,CAAC;AAGlF,SAAS,cAAc,MAAsB;AAC3C,MAAI,aAAa,IAAI,IAAI,EAAG,QAAO;AACnC,MAAI,KAAK,WAAW,oCAAoC,EAAG,QAAO;AAClE,QAAM,SAAS,eAAe,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC;AAC5D,SAAO,SAAS,KAAK,MAAM,OAAO,MAAM,IAAI;AAC9C;AAEA,SAAS,QAAQ,MAAuB;AACtC,SAAO,iBA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,IAChB;AAEA,UAAM,OAAO,UAAU,IAAI;AAC3B,UAAM,MAAM,UAAU,IAAI;AAC1B,UAAM,YAAY,WAAW,KAAK,OAAO,IAAI;AAE7C,QAAI;AACF,YAAM,OAAO,YACT,MAAM,SAAS,IAAI,IACnB,MAAM,QAAwC,0BAA0B,IAAI;AAChF,YAAM,SAAS,UAAU,KAAK,SAAS,IAAI,OAAO,oBAAoB,IAAI,GAAG,IAAI;AACjF,YAAM,SAAS,OAAO;AAEtB,UAAI,QAAQ,QAAQ;AAClB,cAAM,SAAS,KAAK,WAAW,YAAY,CAAC,KAAK,OAAO,CAAC,GAAG,KAAK,QAAQ,GAAG,cAAc,IAAI,KAAK;AACnG,cAAM,QACJ,KAAK,QAAQ,QAAQ,UACjB,EAAE,MAAM,QAAQ,SAAS,OAAO,IAChC,cAAc,QAAQ,QAAQ,EAAE,UAAU,KAAK,cAAc,MAAM,OAAU,CAAC;AACpF,uBAAe,MAAM,MAAM,KAAK,MAAM,SAAS,OAAO,KAAK;AAC3D;AAAA,MACF;AACA,YAAM,SAAS,aAAa,IAAI;AAChC,YAAM,QAAQ,CAAC,GAAG,uBAAuB,MAAM,GAAG,GAAG,OAAO,OAAO,GAAI,WAAW,OAAO,CAAC,IAAI,CAAC,MAAM,CAAE;AACvG,wBAAkB,EAAE,IAAI,MAAM,MAAM,QAAQ,MAAM,CAAC;AAAA,IACrD,SAAS,KAAK;AACZ,sBAAgB,GAAG;AAAA,IACrB;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -92,7 +92,7 @@ Full guide: __tooling__/docs/tools/baker/ads-meta.md`
92
92
  "custom-conversions": () => import("./custom-conversions-OVUDN3HH.js").then((m) => m.customConversionsCommand),
93
93
  pixels: () => import("./pixels-6PKYGSQ4.js").then((m) => m.pixelsCommand),
94
94
  activities: () => import("./activities-OC3CJX4I.js").then((m) => m.activitiesCommand),
95
- insights: () => import("./insights-UOO6OK3U.js").then((m) => m.insightsCommand),
95
+ insights: () => import("./insights-7NC2JFXU.js").then((m) => m.insightsCommand),
96
96
  preview: () => import("./preview-CD2QADBJ.js").then((m) => m.previewCommand),
97
97
  targeting: () => import("./targeting-II4CQUPW.js").then((m) => m.targetingCommand),
98
98
  "instagram-accounts": () => import("./account-assets-BVEEUGDA.js").then((m) => m.instagramAccountsCommand),
@@ -119,4 +119,4 @@ Full guide: __tooling__/docs/tools/baker/ads-meta.md`
119
119
  export {
120
120
  metaCommand
121
121
  };
122
- //# sourceMappingURL=meta-MBW5LM5V.js.map
122
+ //# sourceMappingURL=meta-6IFYEOZL.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koda-sl/baker-cli",
3
- "version": "0.540.0",
3
+ "version": "0.541.0",
4
4
  "description": "AI-agent-first CLI for interacting with Baker, including the Baker creative canvas.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/ads/meta/insights.ts","../src/commands/ads/meta/placement-delivery.ts","../src/commands/ads/meta/presets.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet, apiPost } from \"../../../client.ts\";\nimport { writeAdsJson, writeAdsOutput, writeJsonEnvelope } from \"../output.ts\";\nimport { metaBreakdownSyncedHint, type SyncedLevel, syncedFirstHint } from \"../synced-first.ts\";\nimport { placementDeliveryHints } from \"./placement-delivery.ts\";\nimport { composeFields, getIntent, type InsightsIntent, type InsightsLevel, listIntents } from \"./presets.ts\";\nimport { csvOrJson, getDateRange, handleMetaError } from \"./shared.ts\";\n\nconst POLL_FIRST_MS = 5_000;\nconst POLL_LONGEST_MS = 30_000;\nconst POLL_MAX_MS = 10 * 60_000;\n\n/**\n * The wait before status poll `attempt` (0-based): 5s, growing by half each\n * poll, at most 30s. Every poll is a read from the ad account's hourly Meta\n * budget, and a long report gains nothing from being asked every 5 seconds.\n */\nexport function asyncPollDelayMs(attempt: number): number {\n return Math.min(Math.round(POLL_FIRST_MS * 1.5 ** attempt), POLL_LONGEST_MS);\n}\n\n/** Default attribution windows — only these still work as of Jan 2026 (1d_view + 28d_click also valid but rarely used). */\nconst DEFAULT_ATTRIBUTION_WINDOWS = [\"7d_click\", \"1d_view\"];\n\n/** Default filter — strip rows that didn't deliver. Almost always what we want. */\nconst DEFAULT_FILTERING = [{ field: \"impressions\", operator: \"GREATER_THAN\", value: 0 }];\n\nexport interface InsightsBody {\n object: string;\n level: InsightsLevel;\n fields: string[];\n datePreset?: string;\n since?: string;\n until?: string;\n timeIncrement?: string;\n breakdowns?: string[];\n actionBreakdowns?: string[];\n filtering?: Array<{ field: string; operator: string; value: string | number | string[] }>;\n attributionWindows?: string[];\n useAccountAttributionSetting?: boolean;\n useUnifiedAttributionSetting?: boolean;\n limit?: number;\n skipCache?: boolean;\n}\n\nfunction commaSplit(input: string | undefined): string[] | undefined {\n if (!input) return undefined;\n return input\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n}\n\nfunction parseFiltering(raw: string | undefined): InsightsBody[\"filtering\"] {\n if (!raw) return undefined;\n try {\n return JSON.parse(raw) as InsightsBody[\"filtering\"];\n } catch {\n handleMetaError(new Error(\"Invalid --filtering JSON\"));\n }\n}\n\nfunction pickIntent(name: string | undefined): InsightsIntent {\n if (!name) return \"baseline\";\n const found = getIntent(name);\n if (!found) {\n handleMetaError(new Error(`Unknown --intent: ${name}. Use --list-intents to see options.`));\n }\n return found.name;\n}\n\nfunction pickLevel(args: Record<string, unknown>): InsightsLevel {\n const raw = args.level as string | undefined;\n if (!raw) return \"account\";\n if (raw !== \"account\" && raw !== \"campaign\" && raw !== \"adset\" && raw !== \"ad\") {\n handleMetaError(new Error(\"--level must be one of: account|campaign|adset|ad\"));\n }\n return raw;\n}\n\n/**\n * Auto-async heuristic. Heavy queries that would time out as sync go async\n * automatically — the user shouldn't have to think about it.\n *\n * - level=ad with breakdowns\n * - >2 breakdowns at any level\n * - explicit time range > 90 days\n * - level=ad over an account-level object with a wide window\n */\nfunction shouldAutoAsync(body: InsightsBody): boolean {\n const breakdownCount = (body.breakdowns ?? []).length;\n if (body.level === \"ad\" && breakdownCount > 0 && body.object.startsWith(\"act_\")) {\n return true;\n }\n if (breakdownCount > 2) {\n return true;\n }\n if (body.since && body.until) {\n const days = (Date.parse(body.until) - Date.parse(body.since)) / 86_400_000;\n if (days > 90) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Whether to take the async path — three states, not two.\n *\n * citty resolves `--no-async` to `async: false` rather than filling a separate\n * `no-async` arg, so reading `args[\"no-async\"]` (as this did) always saw\n * undefined and the documented refusal never applied: a heavy query went async\n * no matter what the caller asked for.\n */\nexport function wantsAsync(asyncFlag: unknown, body: InsightsBody): boolean {\n if (asyncFlag === true) return true;\n if (asyncFlag === false) return false;\n return shouldAutoAsync(body);\n}\n\nfunction applyDateRange(body: InsightsBody, args: Record<string, unknown>): void {\n const range = getDateRange(args);\n if (range.datePreset) body.datePreset = range.datePreset;\n if (range.since) body.since = range.since;\n if (range.until) body.until = range.until;\n if (!body.datePreset && !(body.since && body.until)) {\n body.datePreset = \"last_7d\";\n }\n}\n\nfunction buildFiltering(args: Record<string, unknown>): InsightsBody[\"filtering\"] {\n const explicit = parseFiltering(args.filtering as string | undefined);\n if (explicit) return explicit;\n if (args[\"include-undelivered\"]) return undefined;\n return DEFAULT_FILTERING;\n}\n\nfunction buildAttributionWindows(args: Record<string, unknown>): string[] | undefined {\n const explicit = commaSplit(args[\"attribution-windows\"] as string | undefined);\n if (explicit) return explicit;\n return DEFAULT_ATTRIBUTION_WINDOWS;\n}\n\nfunction buildBody(args: Record<string, unknown>): InsightsBody {\n const intent = pickIntent(args.intent as string | undefined);\n const level = pickLevel(args);\n const intentDef = getIntent(intent);\n const explicitFields = commaSplit(args.fields as string | undefined);\n const fields = explicitFields ?? composeFields(intent, level);\n const breakdowns = commaSplit(args.breakdowns as string | undefined);\n const actionBreakdowns = commaSplit(args[\"action-breakdowns\"] as string | undefined) ?? intentDef?.actionBreakdowns;\n\n const body: InsightsBody = {\n object: args.object as string,\n level,\n fields,\n timeIncrement: args[\"time-increment\"] as string | undefined,\n breakdowns,\n actionBreakdowns,\n filtering: buildFiltering(args),\n attributionWindows: buildAttributionWindows(args),\n useAccountAttributionSetting: Boolean(args[\"use-account-attribution\"]),\n useUnifiedAttributionSetting: Boolean(args[\"use-unified-attribution\"]),\n limit: args.limit ? Number(args.limit) : 1000,\n skipCache: Boolean(args[\"no-cache\"]),\n };\n applyDateRange(body, args);\n return body;\n}\n\nasync function pollAsync(reportRunId: string): Promise<void> {\n const start = Date.now();\n for (let attempt = 0; Date.now() - start < POLL_MAX_MS; attempt++) {\n // The status route is a GET reading `report-run-id` from the query string.\n // Posting to it matched no route at all, so every heavy query died on a\n // bare 404 the moment it went async.\n const status = await apiGet<{ async_status?: string; async_percent_completion?: number }>(\n \"/api/ads/meta/insights/async/status\",\n { \"report-run-id\": reportRunId },\n );\n if (status.async_status === \"Job Completed\") return;\n if (status.async_status === \"Job Failed\" || status.async_status === \"Job Skipped\") {\n handleMetaError(new Error(`Async insights job ${status.async_status}`));\n }\n process.stderr.write(\n `Async insights ${status.async_status ?? \"queued\"} (${Math.round(status.async_percent_completion ?? 0)}%)…\\n`,\n );\n await new Promise((resolve) => setTimeout(resolve, asyncPollDelayMs(attempt)));\n }\n handleMetaError(new Error(\"Async insights polling timed out after 10 minutes\"));\n}\n\nasync function runAsync(body: InsightsBody): Promise<Array<Record<string, unknown>>> {\n const submit = await apiPost<{ reportRunId: string }>(\"/api/ads/meta/insights/async\", body);\n process.stderr.write(`Async insights job: ${submit.reportRunId}\\n`);\n await pollAsync(submit.reportRunId);\n return apiPost<Array<Record<string, unknown>>>(\"/api/ads/meta/insights/async/result\", {\n reportRunId: submit.reportRunId,\n fields: body.fields,\n limit: body.limit,\n });\n}\n\n/** Insights rows have nested `actions[]` arrays. Sort by the named action_type's value descending. */\nfunction sortRowsBySpendDesc(rows: Array<Record<string, unknown>>): Array<Record<string, unknown>> {\n return [...rows].sort((a, b) => {\n const sa = Number(a.spend ?? 0);\n const sb = Number(b.spend ?? 0);\n if (Number.isNaN(sa) || Number.isNaN(sb)) return 0;\n return sb - sa;\n });\n}\n\n/** The `baker ads performance` read that answers the same insights read; null when the synced copy cannot. */\nfunction syncedHintOf(body: InsightsBody): string | null {\n const breakdowns = body.breakdowns ?? [];\n if (breakdowns.length > 0) return metaBreakdownSyncedHint(breakdowns);\n const level: SyncedLevel = body.level === \"adset\" ? \"ad_group\" : body.level;\n return syncedFirstHint(\"meta\", level);\n}\n\nexport const insightsCommand = defineCommand({\n meta: {\n name: \"insights\",\n description: `Performance reporting — the main Meta tool for AI agents.\n\nSmart defaults so the AI doesn't have to remember every flag:\n --level account (set --level campaign|adset|ad to drill in)\n --intent baseline (or revenue|funnel|ranking|video|identity)\n --date-preset last_7d (override with --since/--until)\n --attribution-windows 7d_click,1d_view (the only ones still working post Jan 2026)\n filter: impressions > 0 (skip undelivered rows; --include-undelivered to keep)\n sort: spend descending (when result fits in memory)\n auto-async when query is heavy (level=ad + breakdowns, big date ranges, etc.)\n\nIdentity fields (campaign_name, ad_name etc.) are appended automatically based on --level so rows\nare self-describing.\n\nExamples — common AI questions:\n # \"How is GreenLeaf doing this week?\"\n baker ads meta insights --object act_123\n\n # \"Which campaigns are profitable?\"\n baker ads meta insights --object act_123 --level campaign --intent revenue --date-preset last_28d\n\n # \"Which creatives need a refresh?\"\n baker ads meta insights --object act_123 --level ad --intent ranking --date-preset last_14d\n\n # \"Where do users drop off the funnel?\"\n baker ads meta insights --object act_123 --intent funnel\n\n # \"Should we shift budget to Instagram?\"\n baker ads meta insights --object act_123 --level adset --breakdowns publisher_platform,platform_position\n\n # Custom field set (escape hatch)\n baker ads meta insights --object act_123 --fields impressions,spend,actions\n\nAsync is automatic for heavy queries; pass --async to force it, or --no-async to refuse fallback.`,\n },\n args: {\n object: {\n type: \"string\",\n description: \"Object ID — act_<id> for account, or a campaign/adset/ad ID\",\n },\n level: { type: \"string\", description: \"account|campaign|adset|ad (default: account)\" },\n intent: { type: \"string\", description: \"baseline|revenue|funnel|ranking|video|identity (default: baseline)\" },\n fields: { type: \"string\", description: \"Comma-separated field list (overrides --intent bundle)\" },\n \"list-intents\": { type: \"boolean\", description: \"Print available intents and exit\" },\n \"date-preset\": { type: \"string\", description: \"Meta date preset (last_7d, last_28d, today, ...)\" },\n since: { type: \"string\", description: \"Custom start date YYYY-MM-DD\" },\n until: { type: \"string\", description: \"Custom end date YYYY-MM-DD\" },\n \"time-increment\": { type: \"string\", description: \"1 (day) | monthly | all_days\" },\n breakdowns: { type: \"string\", description: \"Comma-separated breakdowns (e.g. publisher_platform,age)\" },\n \"action-breakdowns\": {\n type: \"string\",\n description: \"Slice the actions[] array (default: action_type for revenue/funnel)\",\n },\n filtering: { type: \"string\", description: \"Override default filter — JSON array of {field,operator,value}\" },\n \"include-undelivered\": { type: \"boolean\", description: \"Keep rows where impressions=0 (off by default)\" },\n \"attribution-windows\": {\n type: \"string\",\n description: \"Override default 7d_click,1d_view (only 1d_view, 1d_click, 7d_click, 28d_click work post Jan 2026)\",\n },\n \"use-account-attribution\": { type: \"boolean\", description: \"Use account-saved attribution setting\" },\n \"use-unified-attribution\": { type: \"boolean\", description: \"Use ad-set unified attribution setting\" },\n limit: { type: \"string\", description: \"Max rows (default 1000)\" },\n // Declaring `no-async` too would be a trap: citty resolves it to `async: false`\n // and never fills an arg of that name, so the declaration reads as supported\n // while nothing consumes it.\n async: { type: \"boolean\", description: \"Force the async submit-and-poll path (--no-async refuses it)\" },\n \"no-sort\": { type: \"boolean\", description: \"Skip default spend-desc sort\" },\n \"no-cache\": NO_CACHE_ARG,\n output: { type: \"string\", description: \"Output format: json|csv|jsonl|md\", default: \"json\" },\n },\n run: async ({ args }) => {\n if (args[\"list-intents\"]) {\n writeAdsJson({ ok: true, data: listIntents() });\n return;\n }\n\n if (!args.object) {\n writeAdsJson({\n ok: false,\n error: { code: \"VALIDATION_ERROR\", message: \"Missing required argument: --object\" },\n });\n process.exit(1);\n }\n\n const body = buildBody(args);\n const fmt = csvOrJson(args);\n const wantAsync = wantsAsync(args.async, body);\n\n try {\n const rows = wantAsync\n ? await runAsync(body)\n : await apiPost<Array<Record<string, unknown>>>(\"/api/ads/meta/insights\", body);\n const sorted = args[\"no-sort\"] ? rows : sortRowsBySpendDesc(rows);\n\n if (fmt !== \"json\") {\n writeAdsOutput(sorted, fmt, body.fields);\n return;\n }\n const synced = syncedHintOf(body);\n const hints = [...placementDeliveryHints(sorted), ...(synced === null ? [] : [synced])];\n writeJsonEnvelope({ ok: true, data: sorted, hints });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n","import { placementFormatNote, previewFormatForPosition } from \"@baker/api/ads-meta\";\n\n/**\n * Reads a placement breakdown the way the question \"why does my video show as a\n * still image?\" actually needs to be answered: with this account's own numbers.\n *\n * The failure this replaces is an agent recalling a list of \"image-only\n * placements\" (most of it wrong) and inventing a mechanism Meta does not\n * document. Impressions against video plays, per placement, is the cheap\n * empirical check — it costs one query the agent already ran, and it is\n * account evidence rather than a rule. So the hints below name a suspect and\n * hand over the command that confirms it; they never conclude.\n */\n\n/**\n * Below this, a placement's play rate is arithmetic on too few impressions to\n * carry a claim. Set against a 90%-ish reference rate, seeing no plays in 20\n * impressions is not something chance produces — so this is low enough to reach\n * the long tail where format problems actually live, and the placements it\n * excludes are the ones nobody could have concluded anything from anyway.\n */\nconst MIN_IMPRESSIONS = 20;\n\n/**\n * How far below the ad's own play rate counts as \"this placement is not playing\".\n *\n * Judged against the ad, not against zero. The account this was built from is\n * the reason: it plays at 93% overall, and the one placement carrying a\n * documented format constraint played at 3.85% — 24x worse, and still above any\n * absolute \"under 2%\" bar. An absolute rule cannot see that at any impression\n * threshold; a relative one calibrates itself per creative and per account.\n */\nconst SILENT_FRACTION_OF_REFERENCE = 0.1;\n\n/** Proof the creative plays at all somewhere, so a flagged placement means something. */\nconst PLAYING_REFERENCE_RATE = 0.5;\n\ninterface PlacementDelivery {\n platform: string;\n position: string;\n impressions: number;\n plays: number;\n playRate: number;\n share: number;\n}\n\nfunction toNumber(value: unknown): number {\n const n = Number(value);\n return Number.isFinite(n) ? n : 0;\n}\n\n/** Meta returns action metrics as `[{ action_type, value }]`; the total is what matters here. */\nfunction sumActionValues(value: unknown): number {\n if (!Array.isArray(value)) return 0;\n return value.reduce<number>((total, entry) => {\n const item = entry as { value?: unknown };\n return total + toNumber(item?.value);\n }, 0);\n}\n\nfunction aggregate(rows: Array<Record<string, unknown>>): PlacementDelivery[] {\n const byPlacement = new Map<string, PlacementDelivery>();\n let totalImpressions = 0;\n\n for (const row of rows) {\n const position = row.platform_position;\n if (typeof position !== \"string\" || position.length === 0) continue;\n const platform = typeof row.publisher_platform === \"string\" ? row.publisher_platform : \"\";\n const impressions = toNumber(row.impressions);\n totalImpressions += impressions;\n const key = `${platform}/${position}`;\n const current = byPlacement.get(key) ?? { platform, position, impressions: 0, plays: 0, playRate: 0, share: 0 };\n current.impressions += impressions;\n current.plays += sumActionValues(row.video_play_actions);\n byPlacement.set(key, current);\n }\n\n return [...byPlacement.values()].map((placement) => ({\n ...placement,\n playRate: placement.impressions > 0 ? placement.plays / placement.impressions : 0,\n share: totalImpressions > 0 ? placement.impressions / totalImpressions : 0,\n }));\n}\n\nfunction previewCommand(placement: PlacementDelivery): string {\n const format = previewFormatForPosition(placement.position, placement.platform);\n return format\n ? `\\`baker ads meta preview --creative-id <id> --placement ${placement.position} --platform ${placement.platform}\\``\n : `no preview format is known for ${placement.position}, so Meta's renderer cannot confirm it — say the placement is unverified rather than filling the gap`;\n}\n\n/**\n * The play rate only means something when every row describes the same\n * creative. Aggregating placements across ads puts an image ad's impressions in\n * the same bucket as a video's plays, which reads as \"this placement doesn't\n * render video\" when it only means \"an image ad ran there\" — the exact wrong\n * conclusion this module exists to prevent. So a query that does not pin one ad\n * (`--level ad --object <adId>`) gets no hint rather than a confounded one.\n */\nfunction isSingleAdQuery(rows: Array<Record<string, unknown>>): boolean {\n const adIds = new Set<string>();\n for (const row of rows) {\n if (typeof row.ad_id !== \"string\" || row.ad_id.length === 0) return false;\n adIds.add(row.ad_id);\n }\n return adIds.size === 1;\n}\n\n/**\n * Placements this account delivered into without the video ever playing.\n *\n * Silent unless the query carried video metrics AND the creative demonstrably\n * plays somewhere else: without a playing reference, a zero everywhere means\n * \"not a video query\", not \"the placement is broken\".\n */\nexport function placementDeliveryHints(rows: Array<Record<string, unknown>>): string[] {\n const carriesVideoMetrics = rows.some((row) => Array.isArray(row.video_play_actions));\n if (!carriesVideoMetrics || !isSingleAdQuery(rows)) return [];\n\n const placements = aggregate(rows);\n const judgeable = placements.filter((p) => p.impressions >= MIN_IMPRESSIONS);\n const impressions = judgeable.reduce((total, p) => total + p.impressions, 0);\n const reference = impressions > 0 ? judgeable.reduce((total, p) => total + p.plays, 0) / impressions : 0;\n if (reference < PLAYING_REFERENCE_RATE) return [];\n\n const silent = judgeable\n .filter((p) => p.playRate < reference * SILENT_FRACTION_OF_REFERENCE)\n .sort((a, b) => b.impressions - a.impressions);\n\n // Never go quiet on a video placement query. Silence is what the agent fills\n // in with a remembered rule, and \"every placement plays\" is the answer to\n // \"why does it show as a still image\" far more often than a placement is.\n if (silent.length === 0) {\n const worst = [...judgeable].sort((a, b) => a.playRate - b.playRate)[0];\n return [\n `Checked every placement above ${MIN_IMPRESSIONS} impressions against this ad's own play rate (${(reference * 100).toFixed(0)}%): no placement is failing to play the video${worst ? `, the lowest being ${worst.platform}/${worst.position} at ${(worst.playRate * 100).toFixed(0)}%` : \"\"}. So placements do not explain a \"it shows as a still image\" report — rule out autoplay off or data saver in the viewer's own app, which renders every video as its cover frame account-wide.`,\n ];\n }\n\n const hints = silent.map((placement) => {\n const note = placementFormatNote(placement.position);\n const documented = note ? ` Meta documents this placement: ${note.note}` : \"\";\n return `${placement.platform}/${placement.position} delivered ${placement.impressions.toLocaleString(\"en-US\")} impressions (${(placement.share * 100).toFixed(1)}% of the total) and ${placement.plays.toLocaleString(\"en-US\")} video plays — it may not be rendering the video. This is account evidence, not a rule: confirm what Meta renders there with ${previewCommand(placement)} before you say anything about it.${documented}`;\n });\n\n const combinedShare = silent.reduce((total, placement) => total + placement.share, 0) * 100;\n hints.push(\n `Those placements are ${combinedShare.toFixed(1)}% of delivery in this query. State that share before proposing to remove them — and note that removing placements from a live ad set is a targeting change, which Meta counts as a significant edit that re-enters the learning phase.`,\n );\n return hints;\n}\n","/**\n * Insights field bundles. Picked for AI agent ergonomics: small, focused field\n * lists that answer one specific question without forcing the AI to enumerate\n * Meta's 500+ insights fields.\n *\n * Two-axis design:\n * --intent (field bundle, default: baseline) — what data to ask for\n * --level (object granularity, default: account) — at what granularity\n *\n * Intents are independent of level — pass `--intent ranking --level ad` to flag\n * creatives, or `--intent revenue --level campaign` for ROAS by campaign.\n *\n * Identity fields (campaign_name etc.) are appended automatically based on\n * level so the AI can read rows without joining.\n */\n\nexport type InsightsLevel = \"account\" | \"campaign\" | \"adset\" | \"ad\";\n\nexport type InsightsIntent = \"baseline\" | \"revenue\" | \"funnel\" | \"ranking\" | \"video\" | \"identity\";\n\ninterface IntentDefinition {\n name: InsightsIntent;\n description: string;\n fields: string[];\n /** Action breakdowns to slice the actions[] array — empty if not needed. */\n actionBreakdowns?: string[];\n}\n\nconst INSIGHTS_INTENTS: Record<InsightsIntent, IntentDefinition> = {\n baseline: {\n name: \"baseline\",\n description: \"Spend, impressions, clicks, CTR, CPC, CPM. The default question: 'how is delivery?'\",\n fields: [\"impressions\", \"reach\", \"frequency\", \"spend\", \"clicks\", \"ctr\", \"cpc\", \"cpm\"],\n },\n revenue: {\n name: \"revenue\",\n description: \"Spend, conversions, action_values, purchase_roas. 'How much money are we making?'\",\n fields: [\"spend\", \"actions\", \"action_values\", \"conversions\", \"conversion_values\", \"purchase_roas\"],\n actionBreakdowns: [\"action_type\"],\n },\n funnel: {\n name: \"funnel\",\n description: \"Impression → click → landing page → action. 'Where do users drop off?'\",\n fields: [\"impressions\", \"clicks\", \"inline_link_clicks\", \"outbound_clicks\", \"actions\", \"spend\"],\n actionBreakdowns: [\"action_type\"],\n },\n ranking: {\n name: \"ranking\",\n description: \"Quality, engagement, conversion-rate rankings. 'Which creatives need a refresh?'\",\n fields: [\"impressions\", \"spend\", \"ctr\", \"quality_ranking\", \"engagement_rate_ranking\", \"conversion_rate_ranking\"],\n },\n video: {\n name: \"video\",\n description: \"Watch funnel, thruplay cost. 'How are video creatives holding attention?'\",\n fields: [\n \"impressions\",\n \"spend\",\n \"video_play_actions\",\n \"video_p25_watched_actions\",\n \"video_p50_watched_actions\",\n \"video_p75_watched_actions\",\n \"video_p100_watched_actions\",\n \"video_thruplay_watched_actions\",\n \"cost_per_thruplay\",\n ],\n },\n identity: {\n name: \"identity\",\n description: \"Just the names + spend — for cheap roll-up summaries.\",\n fields: [\"spend\", \"impressions\"],\n },\n};\n\nconst IDENTITY_FIELDS_BY_LEVEL: Record<InsightsLevel, string[]> = {\n account: [\"account_id\", \"account_name\", \"account_currency\"],\n campaign: [\"campaign_id\", \"campaign_name\", \"objective\"],\n adset: [\"adset_id\", \"adset_name\", \"campaign_id\", \"campaign_name\"],\n ad: [\"ad_id\", \"ad_name\", \"adset_id\", \"adset_name\", \"campaign_id\", \"campaign_name\"],\n};\n\n/** Compose final field list: intent metrics + level-specific identity fields, deduplicated. */\nexport function composeFields(intent: InsightsIntent, level: InsightsLevel): string[] {\n const intentFields = INSIGHTS_INTENTS[intent].fields;\n const identity = IDENTITY_FIELDS_BY_LEVEL[level];\n const seen = new Set<string>();\n const out: string[] = [];\n for (const f of [...identity, ...intentFields]) {\n if (!seen.has(f)) {\n seen.add(f);\n out.push(f);\n }\n }\n return out;\n}\n\nexport function getIntent(name: string): IntentDefinition | undefined {\n return INSIGHTS_INTENTS[name as InsightsIntent];\n}\n\nexport function listIntents(): IntentDefinition[] {\n return Object.values(INSIGHTS_INTENTS);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SA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