@adport/mcp 0.13.1 → 0.14.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.
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/server";
3
3
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
4
4
  import { z } from "zod";
5
5
  import { registerAppResource, registerAppTool, RESOURCE_MIME_TYPE } from "@modelcontextprotocol/ext-apps/server";
6
- import { AdportError, CredentialStore, createContext, selectRuntimeCatalog, nextPageArguments, writeOutput } from "@adport/core";
6
+ import { TOOL_PROVIDERS, AdportError, CredentialStore, createContext, selectRuntimeCatalog, nextPageArguments, writeOutput } from "@adport/core";
7
7
  import { createGa4Module, createGscModule } from "@adport/provider-analytics";
8
8
  import { createGtmModule } from "@adport/provider-gtm";
9
9
  import { createGoogleModule } from "@adport/provider-google";
@@ -18,11 +18,13 @@ import { createPinterestModule } from "@adport/provider-pinterest";
18
18
  import { createLinkedInModule } from "@adport/provider-linkedin";
19
19
  import { createXModule } from "@adport/provider-x";
20
20
  import { createOpenAIModule } from "@adport/provider-openai";
21
+ import { createGravityModule } from "@adport/provider-gravity";
22
+ import { createMatomoModule } from "@adport/provider-matomo";
21
23
 
22
24
  // package.json
23
25
  var package_default = {
24
26
  name: "@adport/mcp",
25
- version: "0.13.1",
27
+ version: "0.14.0",
26
28
  description: "adport MCP server \u2014 the open control plane for paid media",
27
29
  license: "Apache-2.0",
28
30
  type: "module",
@@ -59,13 +61,15 @@ var package_default = {
59
61
  "@adport/provider-snapchat": "workspace:*",
60
62
  "@adport/provider-spotify": "workspace:*",
61
63
  "@adport/provider-tiktok": "workspace:*",
64
+ "@adport/provider-gravity": "workspace:*",
62
65
  "@adport/provider-openai": "workspace:*",
63
66
  "@adport/provider-x": "workspace:*",
64
67
  "@modelcontextprotocol/ext-apps": "^2.0.4",
65
68
  zod: "^4.6.7",
66
69
  "@modelcontextprotocol/server": "^2.4.0",
67
70
  "@adport/provider-gtm": "workspace:*",
68
- "@adport/provider-analytics": "workspace:*"
71
+ "@adport/provider-analytics": "workspace:*",
72
+ "@adport/provider-matomo": "workspace:*"
69
73
  },
70
74
  devDependencies: {
71
75
  "@types/jsdom": "^21.1.7",
@@ -93,6 +97,34 @@ var package_default = {
93
97
  }
94
98
  };
95
99
 
100
+ // src/acquisition-ui.ts
101
+ var ACQUISITION_UI = String.raw`
102
+ function renderAcquisition(data,meta) {
103
+ const goals=meta.tool==='analytics_goals',rows=arr(goals?data.goals:data.rows),range=data.date_range;
104
+ const provider=data.provider||meta.provider;
105
+ const scope=[meta.providerNames?.[provider],data.account_id,
106
+ range&&[range.start,range.end].filter(Boolean).join(' – '),range?.timezone].filter(Boolean).join(' · ');
107
+ const pageArgs=goals?null:readPageArgs(meta,'data-report-next');
108
+ const landing=rows.some(row=>Object.hasOwn(row.dimensions||{},'landing_page'));
109
+ const labels=goals?['Goal','ID','Counting method']:['Source','Medium','Campaign',...(landing?['Landing page']:[]),'Sessions','Conversions','Revenue'+(data.currency?' · '+data.currency:'')];
110
+ const format=new Intl.NumberFormat(state.host.locale||'en',{maximumFractionDigits:4});
111
+ const amount=value=>typeof value==='number'&&Number.isFinite(value)?format.format(value):'—';
112
+ const values=rows.map(row=>{
113
+ if(goals)return [row.name,row.id,row.counting_method?human(row.counting_method.toLowerCase()):'—'];
114
+ const d=row.dimensions||{},m=row.metrics||{};
115
+ return [d.source,d.medium,d.campaign,...(landing?[d.landing_page]:[]),amount(m.sessions),amount(m.conversions),amount(m.revenue)];
116
+ });
117
+ const title=goals?'Conversion goals':'Conversions by acquisition';
118
+ const clean={...data};delete clean._adport;
119
+ const body=values.length?workflowTable(labels,values,title):workflowNote(goals?'No conversion goals configured for this site.':'No acquisition rows returned for these dates.');
120
+ app.innerHTML=chrome(operationHeader(title,scope,provider)+notices(data)+'<section data-native-report data-read-page-focus tabindex="-1">'+body+
121
+ readPageMarkup(pageArgs,'data-report-next','data-report-page-status')+
122
+ '<details class="report-data"><summary>Details · '+rows.length+' results</summary>'+workflowNote(data.attribution)+workflowNote(data.revenue_basis)+
123
+ '<pre>'+esc(JSON.stringify(clean,null,2))+'</pre></details></section>','');
124
+ bindReadPage(meta,pageArgs,'data-report-next','data-report-page-status',value=>Array.isArray(value?.rows));
125
+ }
126
+ `;
127
+
96
128
  // src/media-library-ui.ts
97
129
  var MEDIA_LIBRARY_STYLES = String.raw`
98
130
  .media-library { position:relative }
@@ -736,7 +768,7 @@ ${RECORD_COLLECTION_UI}
736
768
  }).join('')+'</dl>':'')+'</article>';
737
769
  }
738
770
  function entityRecordTable(tool) {
739
- return /^(?:google|meta|apple|microsoft|tiktok|linkedin|pinterest|reddit|snapchat|spotify|openai|x)_(?:list_)?(?:campaigns|campaign_groups|adgroups|ad_groups|ad_sets|adsets|line_items|adsquads)$/.test(tool||'');
771
+ return /^(?:google|meta|apple|microsoft|tiktok|linkedin|pinterest|reddit|snapchat|spotify|openai|gravity|x)_(?:list_)?(?:campaigns|campaign_groups|adgroups|ad_groups|ad_sets|adsets|line_items|adsquads)$/.test(tool||'');
740
772
  }
741
773
 
742
774
  function entityFields(row,meta) {
@@ -816,7 +848,7 @@ ${RECORD_COLLECTION_UI}
816
848
  if(meta.tool==='apple_report')return renderAppleReport(data,meta);
817
849
  if(nativeReportTools.has(meta.tool)&&(meta.tool!=='google_gaql'||arr(recordPayload(data)?.rows).some(row=>object(row?.metrics)&&Object.keys(row.metrics).length)))return renderNativeReport(data,meta);
818
850
  const payload=recordPayload(data),entries=recordEntries(payload),rows=entries ?? [payload];
819
- const title=meta.tool==='google_gaql'?'Google Ads query results':human(String(meta.tool||'Results').replace(/^(?:google|meta|tiktok|apple|microsoft|reddit|snapchat|spotify|pinterest|linkedin|openai|x)_/,'').replace(/^(?:list|get)_/,'').replace(/_(?:list|get)$/,'').replaceAll('_',' '));
851
+ const title=meta.tool==='google_gaql'?'Google Ads query results':human(String(meta.tool||'Results').replace(/^(?:google|meta|tiktok|apple|microsoft|reddit|snapchat|spotify|pinterest|linkedin|openai|gravity|x)_/,'').replace(/^(?:list|get)_/,'').replace(/_(?:list|get)$/,'').replaceAll('_',' '));
820
852
  const parent=object(data.parent)?Object.entries(data.parent).filter(([key])=>/_id$/.test(key)).map(([key,value])=>human(key.replace(/_id$/,''))+' '+value).join(' · '):'';
821
853
  const scope=[parent,typeof data.parent_id==='string'&&!parent?data.parent_id:'',meta.accountId].filter(Boolean).join(' · ');
822
854
  const clean=object(data)?Object.fromEntries(Object.entries(data).filter(([key])=>key!=='_adport'&&!(key==='creatives'&&meta.view==='records'))):data;
@@ -989,10 +1021,11 @@ var CREATIVE_UI_SCRIPT = String.raw`
989
1021
  };
990
1022
  const unique=values=>[...new Set(arr(values).filter(value=>typeof value==='string'&&value.trim()))];
991
1023
  return creatives.map(creative=>{
992
- const name=creative.name || 'Untitled creative',status=statusOf(creative.status);
1024
+ const name=creative.name || 'Untitled creative',delivery=creative.deliveryStatus || creative.status;
1025
+ const status=statusOf(delivery==='ADSET_PAUSED'?'Ad set paused':delivery==='CAMPAIGN_PAUSED'?'Campaign paused':delivery);
993
1026
  const destination=arr(creative.landing_urls).map(value=>safeUrl(value)).find(Boolean);
994
1027
  const headline=unique(creative.headlines).filter(text=>text!==name).join(' · '),copy=unique(creative.descriptions).filter(text=>text!==name&&text!==headline).join('\n');
995
- const active=/^(active|enabled|ready|approved)$/i.test(creative.status || '');
1028
+ const active=/^(active|enabled|ready|approved)$/i.test(delivery || '');
996
1029
  return '<article class="creative-card" data-media-id="'+esc(creative.id)+'"><div class="creative-heading">'+(providerSvg[creative.provider]?logo(creative.provider):'')+'<span class="creative-name" title="'+esc(name)+'">'+esc(name)+'</span>'+(menuFor?menuFor(creative):'')+'</div>'+mediaView(creative)+'<div class="creative-copy">'+(headline?'<strong title="'+esc(headline)+'">'+esc(headline)+'</strong>':'')+(copy?'<p title="'+esc(copy)+'">'+esc(copy)+'</p>':'')+'</div><div class="creative-footer"><span class="creative-status'+(active?' creative-status-active':'')+'">'+esc(status.label)+'</span>'+(destination?'<a class="creative-destination" href="'+esc(destination.href)+'" target="_blank" rel="noopener noreferrer">'+esc(destination.hostname.replace(/^www\./,''))+'</a>':'')+'</div></article>';
997
1030
  }).join('');
998
1031
  }
@@ -1042,6 +1075,19 @@ var PROVIDER_GALLERY_UI = String.raw`
1042
1075
  let providerGallery=null;
1043
1076
  const galleryStable=value=>JSON.stringify((function sort(v){return Array.isArray(v)?v.map(sort):object(v)?Object.fromEntries(Object.entries(v).sort(([a],[b])=>a.localeCompare(b)).map(([k,item])=>[k,sort(item)])):v;})(value));
1044
1077
  const galleryItemKey=item=>[item.provider,item.account_id,item.id].join(':');
1078
+ function galleryItems(data,meta) {
1079
+ const creatives=arr(data.creatives);
1080
+ if(meta.tool!=='meta_list_ads' || !Array.isArray(data.ads)) return creatives;
1081
+ const delivery=new Map();
1082
+ for(const ad of data.ads) {
1083
+ if(typeof ad?.effective_status==='string' && ad.effective_status && typeof ad.account_id==='string' && typeof ad.id==='string')
1084
+ delivery.set(galleryItemKey({provider:'meta',account_id:ad.account_id,id:ad.id}),ad.effective_status);
1085
+ }
1086
+ return creatives.map(item=>{
1087
+ const status=delivery.get(galleryItemKey(item));
1088
+ return status?{...item,deliveryStatus:status}:item;
1089
+ });
1090
+ }
1045
1091
  function galleryScope(meta) {
1046
1092
  const args={...meta.refresh?.arguments};delete args[meta.pagination?.cursorInput];
1047
1093
  return galleryStable({tool:meta.tool,provider:meta.provider,account:meta.accountId,project:meta.context?.project_id,filters:args});
@@ -1080,12 +1126,12 @@ var PROVIDER_GALLERY_UI = String.raw`
1080
1126
  bindGalleryCard(card,gallery);
1081
1127
  }
1082
1128
  function renderProviderGallery(data,meta) {
1083
- const previous=providerGallery,previousWrite=previous?.meta.capabilities?.can_write,retain=previous && previous.scope===galleryScope(meta) && app.querySelector('[data-provider-gallery]');
1129
+ const previous=providerGallery,previousWrite=previous?.meta.capabilities?.can_write,retain=meta.accountId && previous && previous.scope===galleryScope(meta) && app.querySelector('[data-provider-gallery]');
1084
1130
  if(!retain) providerGallery={scope:galleryScope(meta),data,meta,items:new Map(),sources:new Map(),seen:new Set(),busy:null,review:null};
1085
1131
  const gallery=providerGallery;gallery.data=data;gallery.meta=meta;
1086
1132
  if(!retain) app.innerHTML=chrome('<div data-provider-notes></div><div class="creative-grid" data-provider-gallery role="region" aria-label="Creative previews" tabindex="0"></div><div data-provider-pages></div>','');
1087
1133
  const root=app.querySelector('[data-provider-gallery]');
1088
- for(const item of arr(data.creatives)) {
1134
+ for(const item of galleryItems(data,meta)) {
1089
1135
  const key=galleryItemKey(item);gallery.sources.set(key,meta.refresh?.arguments);if(gallery.items.has(key)) {const old=gallery.items.get(key);if(galleryStable(old)!==galleryStable(item) || previousWrite!==meta.capabilities?.can_write) {const card=[...root.querySelectorAll('[data-creative-key]')].find(node=>node.dataset.creativeKey===key);gallery.items.set(key,item);if(card) {if(meta.capabilities?.can_write!==true) card.querySelector('[data-creative-editor]')?.remove();updateGalleryCard(card,old,item,gallery);}}continue;}
1090
1136
  gallery.items.set(key,item);
1091
1137
  const template=document.createElement('template');template.innerHTML=creativeCards([item],galleryMenu);const card=template.content.firstElementChild;card.dataset.creativeKey=key;root.append(card);bindGalleryCard(card,gallery);bindCreativeErrors(card);
@@ -1093,7 +1139,8 @@ var PROVIDER_GALLERY_UI = String.raw`
1093
1139
  root.querySelector('.empty')?.remove();if(!gallery.items.size) root.innerHTML='<div class="empty">No creatives to preview.</div>';
1094
1140
  root.classList.toggle('creative-grid-single',gallery.items.size===1);
1095
1141
  app.querySelector('[data-provider-notes]').innerHTML=notices({...data,truncated:false});
1096
- state.result={structuredContent:{...data,creatives:[...gallery.items.values()],_adport:meta}};renderProviderPages();
1142
+ if(meta.accountId) state.result={structuredContent:{...data,creatives:[...gallery.items.values()],_adport:meta}};
1143
+ renderProviderPages();
1097
1144
  }
1098
1145
  function renderProviderPages(message='') {
1099
1146
  const gallery=providerGallery,area=app.querySelector('[data-provider-pages]');if(!gallery || !area) return;
@@ -1167,7 +1214,7 @@ var PROVIDER_GALLERY_UI = String.raw`
1167
1214
  gallery.busy={kind:'refresh',tool:gallery.meta.tool,args};renderProviderPages();
1168
1215
  try {
1169
1216
  const response=await callTool(gallery.meta.tool,args,60000),value=galleryPageValue(response,gallery,args);if(providerGallery!==gallery) return;
1170
- const updated=value.creatives.find(item=>galleryItemKey(item)===review.key);
1217
+ const updated=galleryItems(value,value._adport).find(item=>galleryItemKey(item)===review.key);
1171
1218
  if(!updated && !(phase==='applied' && review.kind==='remove')) throw new Error('The edited creative is outside this page. Ask your assistant for a fresh view.');
1172
1219
  if(!updated) {
1173
1220
  gallery.items.delete(review.key);gallery.sources.delete(review.key);card?.remove();gallery.seen.clear();
@@ -1187,6 +1234,7 @@ var PROVIDER_GALLERY_UI = String.raw`
1187
1234
  var PROVIDER_LOGOS = {
1188
1235
  "ga4": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#e37400" style="color:#e37400" height="1em" width="1em"><path d="M22.84 2.9982v17.9987c.0086 1.6473-1.3197 2.9897-2.967 2.9984a2.9808 2.9808 0 01-.3677-.0208c-1.528-.226-2.6477-1.5558-2.6105-3.1V3.1204c-.0369-1.5458 1.0856-2.8762 2.6157-3.1 1.6361-.1915 3.1178.9796 3.3093 2.6158.014.1201.0208.241.0202.3619zM4.1326 18.0548c-1.6417 0-2.9726 1.331-2.9726 2.9726C1.16 22.6691 2.4909 24 4.1326 24s2.9726-1.3309 2.9726-2.9726-1.331-2.9726-2.9726-2.9726zm7.8728-9.0098c-.0171 0-.0342 0-.0513.0003-1.6495.0904-2.9293 1.474-2.891 3.1256v7.9846c0 2.167.9535 3.4825 2.3505 3.763 1.6118.3266 3.1832-.7152 3.5098-2.327.04-.1974.06-.3983.0593-.5998v-8.9585c.003-1.6474-1.33-2.9852-2.9773-2.9882z"></path></svg>',
1189
1236
  "gsc": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#4285f4" style="color:#4285f4" height="1em" width="1em"><path d="M8.548 1.156L6.832 2.872v1.682h1.716zm0 3.398v.035H6.832v-.035H3.386L0 7.844v3.577h2.826V8.94c0-.525.429-.954.954-.954h16.476c.525 0 .954.43.954.954v2.48h2.754V7.844l-3.386-3.29H17.3v.035h-1.717v-.035zm7.035 0H17.3V2.872l-1.717-1.716zM8.679 1.188V2.84h6.773V1.188zm11.471 7.07a.834.834 0 00-.132.01l-.543.002c-5.216.014-10.432-.008-15.648.01-.435-.063-.794.436-.716.883v2.264h17.812c-.016-.888.045-1.782-.034-2.666-.104-.342-.427-.502-.739-.502zm-15.422.634a.689.698 0 01.689.698.689.698 0 01-.689.697.689.698 0 01-.688-.697.689.698 0 01.688-.698zm2.134 0a.689.698 0 01.689.698.689.698 0 01-.689.697.689.698 0 01-.688-.697.689.698 0 01.688-.698zM.036 11.645v9.156c0 1.05.858 1.908 1.907 1.908h.883V11.645zm21.174 0v11.064h.882c1.05 0 1.908-.858 1.908-1.908v-9.156zM4.057 13.133v6.85h6.137v-6.85zm13.243.021v3.777l-1.708.977-1.708-.977v-3.758a4.006 4.006 0 000 7.23v2.441h3.457v-2.442a4.006 4.006 0 00-.041-7.248zm-13.243 8.26v1.43h7.925v-1.43z"></path></svg>',
1237
+ "matomo": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#3152a0" style="color:#3152a0" height="1em" width="1em"><path d="M6.664 15.37a3.336 3.336 0 0 1-3.332 3.332C1.495 18.702 0 17.208 0 15.37s1.495-3.333 3.332-3.333a3.338 3.338 0 0 1 3.332 3.333zm11.565-3.644a3.658 3.658 0 0 1-1.987.591 3.642 3.642 0 0 1-1.872-.529l.008.012a3.728 3.728 0 0 1-1.235-1.19l-2.612-3.693a.17.17 0 0 1-.027-.033A3.312 3.312 0 0 0 7.67 5.298a3.318 3.318 0 0 0-2.848 1.586.146.146 0 0 1-.021.028l-3.428 5.343a3.663 3.663 0 0 1 5.094 1.18.13.13 0 0 1 .015.018l2.756 3.869a3.305 3.305 0 0 0 2.699 1.38 3.31 3.31 0 0 0 2.711-1.379l.009-.013c.073-.103.137-.202.195-.305l1.442-2.255 1.935-3.024zm5.275 1.902l-.014-.028-.044-.066a1.109 1.109 0 0 0-.029-.044l-3.525-5.37c.024.168.052.335.052.51 0 .741-.219 1.457-.634 2.068l-2.803 4.38 1.416 2.179-.002.002a.131.131 0 0 1 .024.028 3.338 3.338 0 0 0 2.723 1.415A3.335 3.335 0 0 0 24 15.37c0-.613-.171-1.216-.496-1.742zm-7.262-1.666a3.336 3.336 0 0 0 3.332-3.333 3.336 3.336 0 0 0-3.332-3.332 3.336 3.336 0 0 0-3.332 3.332 3.338 3.338 0 0 0 3.332 3.333z"></path></svg>',
1190
1238
  "gtm": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#4285f4" style="color:#4285f4" height="1em" width="1em"><path d="M12.003 0a3 3 0 0 0-2.121 5.121l6.865 6.865-4.446 4.541 1.745 1.836a3.432 3.432 0 0 1 .7.739l.012.011-.001.002a3.432 3.432 0 0 1 .609 1.953 3.432 3.432 0 0 1-.09.78l7.75-7.647c.031-.029.067-.05.098-.08.023-.023.038-.052.06-.076a2.994 2.994 0 0 0-.06-4.166l-9-9A2.99 2.99 0 0 0 12.003 0zM8.63 2.133L.88 9.809a2.998 2.998 0 0 0 0 4.238l7.7 7.75a3.432 3.432 0 0 1-.077-.729 3.432 3.432 0 0 1 3.431-3.431 3.432 3.432 0 0 1 .826.101l-5.523-5.81 4.371-4.373-2.08-2.08c-.903-.904-1.193-2.183-.898-3.342zm3.304 16.004a2.932 2.932 0 0 0-2.931 2.931A2.932 2.932 0 0 0 11.934 24a2.932 2.932 0 0 0 2.932-2.932 2.932 2.932 0 0 0-2.932-2.931z"></path></svg>',
1191
1239
  "snapchat": '<svg viewBox="0 0 1024 1024" aria-hidden="true"> <path fill="#fff" d="M992.5,756.3c-4.2-13.9-24.3-23.7-24.3-23.7l0,0c-1.9-1-3.6-1.9-5-2.6c-33.5-16.2-63.2-35.7-88.2-57.8 c-20.1-17.8-37.3-37.4-51.1-58.2c-16.9-25.4-24.8-46.6-28.2-58.1c-1.9-7.5-1.6-10.5,0-14.4c1.3-3.3,5.2-6.4,7-7.9 c11.3-8,29.5-19.8,40.7-27c9.7-6.3,18-11.7,22.9-15.1c15.7-11,26.5-22.2,32.8-34.3c8.2-15.6,9.2-32.8,2.8-49.7 c-8.6-22.8-29.9-36.4-57-36.4c-6,0-12.2,0.7-18.4,2c-15.5,3.4-30.2,8.9-42.5,13.7c-0.9,0.4-1.9-0.3-1.8-1.3 c1.3-30.5,2.8-71.5-0.6-110.4c-3-35.2-10.3-64.9-22.1-90.8c-11.9-26-27.4-45.2-39.5-59.1C708.5,112,688.2,92.5,657.6,75 C614.6,50.4,565.6,37.9,512,37.9c-53.5,0-102.4,12.5-145.5,37.1c-32.4,18.5-53.1,39.4-62.5,50.2c-12.1,13.9-27.6,33.1-39.5,59.1 c-11.9,25.9-19.1,55.5-22.1,90.8c-3.4,39.1-2,76.8-0.6,110.4c0,1-0.9,1.7-1.9,1.3c-12.3-4.8-27-10.3-42.5-13.7 c-6.1-1.3-12.3-2-18.4-2c-27,0-48.3,13.6-57,36.4c-6.4,16.9-5.4,34.1,2.8,49.7c6.4,12.1,17.1,23.3,32.8,34.3 c4.8,3.4,13.2,8.8,22.9,15.1c10.9,7.1,28.6,18.6,40,26.5c1.4,1,6.2,4.6,7.7,8.4c1.6,4,1.9,7-0.2,15c-3.5,11.6-11.4,32.6-28,57.5 c-13.8,20.9-31,40.4-51.1,58.2c-25,22.1-54.7,41.6-88.2,57.8c-1.6,0.8-3.5,1.7-5.5,2.9l0,0c0,0-20,10.2-23.8,23.4 c-5.6,19.5,9.3,37.8,24.4,47.6c24.8,16,55,24.6,72.5,29.3c4.9,1.3,9.3,2.5,13.3,3.7c2.5,0.8,8.8,3.2,11.5,6.7 c3.4,4.4,3.8,9.8,5,15.9v0c1.9,10.3,6.2,23,18.9,31.8c14,9.6,31.7,10.3,54.2,11.2c23.5,0.9,52.7,2,86.2,13.1 c15.5,5.1,29.6,13.8,45.8,23.8c34,20.9,76.3,46.9,148.5,46.9c72.3,0,114.9-26.1,149.1-47.1c16.2-9.9,30.1-18.5,45.3-23.5 c33.5-11.1,62.7-12.2,86.2-13.1c22.5-0.9,40.2-1.5,54.2-11.2c13.6-9.4,17.5-23.4,19.3-33.9c1-5.2,1.6-9.9,4.6-13.7 c2.6-3.3,8.4-5.6,11.1-6.5c4.1-1.3,8.7-2.5,13.8-3.9c17.5-4.7,39.5-10.2,66.2-25.3C993.7,789.8,995.9,767.4,992.5,756.3z" /> <path fill="#000" d="M1020.3,745.5c-7.1-19.4-20.7-29.7-36.1-38.3c-2.9-1.7-5.6-3.1-7.8-4.1c-4.6-2.4-9.3-4.7-14-7.1 c-48.1-25.5-85.7-57.7-111.7-95.8c-8.8-12.9-14.9-24.5-19.2-34c-2.2-6.4-2.1-10-0.5-13.3c1.2-2.5,4.4-5.1,6.2-6.4 c8.3-5.5,16.8-11,22.6-14.7c10.3-6.7,18.5-12,23.7-15.6c19.8-13.8,33.6-28.5,42.2-44.9c12.2-23.1,13.7-49.5,4.3-74.3 c-13-34.4-45.6-55.8-85-55.8c-8.2,0-16.5,0.9-24.7,2.7c-2.2,0.5-4.3,1-6.4,1.5c0.4-23.4-0.2-48.4-2.3-72.8 c-7.4-86-37.5-131.1-68.9-167c-13.1-15-35.9-36.9-70.1-56.5C624.9,21.7,570.9,7.9,512,7.9c-58.7,0-112.7,13.8-160.4,41.1 c-34.4,19.6-57.2,41.6-70.2,56.5c-31.4,35.9-61.5,81-68.9,167c-2.1,24.4-2.6,49.4-2.3,72.8c-2.1-0.5-4.3-1-6.4-1.5 c-8.2-1.8-16.6-2.7-24.7-2.7c-39.4,0-72,21.4-85,55.8c-9.4,24.8-7.9,51.2,4.3,74.3c8.6,16.4,22.5,31.1,42.2,44.9 c5.3,3.7,13.4,9,23.7,15.6c5.6,3.6,13.7,8.9,21.7,14.2c1.2,0.8,5.5,4,7,7c1.7,3.4,1.7,7.1-0.8,13.9c-4.2,9.3-10.3,20.7-18.9,33.3 c-25.5,37.3-62,68.9-108.5,94.1c-24.7,13.1-50.3,21.8-61.1,51.2c-8.2,22.2-2.8,47.5,17.9,68.8l0,0c6.8,7.3,15.4,13.8,26.2,19.8 c25.4,14,47,20.9,64,25.6c3,0.9,9.9,3.1,12.9,5.8c7.6,6.6,6.5,16.6,16.6,31.2c6.1,9.1,13.1,15.3,18.9,19.3 c21.1,14.6,44.9,15.5,70.1,16.5c22.7,0.9,48.5,1.9,77.9,11.6c12.2,4,24.9,11.8,39.5,20.8c35.2,21.7,83.5,51.3,164.2,51.3 c80.8,0,129.3-29.8,164.8-51.5c14.6-8.9,27.2-16.7,39-20.6c29.4-9.7,55.2-10.7,77.9-11.6c25.2-1,48.9-1.9,70.1-16.5 c6.6-4.6,15-12.1,21.6-23.5c7.2-12.3,7.1-21,13.9-26.9c2.8-2.4,8.9-4.5,12.2-5.5c17.1-4.7,39-11.6,64.9-25.9 c11.5-6.3,20.4-13.2,27.5-21.1c0.1-0.1,0.2-0.2,0.3-0.3C1023.4,791.7,1028.3,767.2,1020.3,745.5z M948.6,784 c-43.8,24.2-72.9,21.6-95.5,36.1c-19.2,12.4-7.9,39.1-21.8,48.7c-17.2,11.9-67.9-0.8-133.4,20.8c-54,17.9-88.5,69.2-185.8,69.2 c-97.5,0-131-51.1-185.8-69.2c-65.5-21.6-116.3-8.9-133.4-20.8c-13.9-9.6-2.6-36.3-21.8-48.7c-22.6-14.6-51.7-12-95.5-36.1 c-27.9-15.4-12.1-24.9-2.8-29.4c158.6-76.7,183.8-195.3,185-204.2c1.4-10.6,2.9-19-8.8-29.9c-11.3-10.5-61.6-41.6-75.5-51.3 c-23.1-16.1-33.2-32.2-25.7-52c5.2-13.7,18-18.8,31.5-18.8c4.2,0,8.5,0.5,12.6,1.4c25.3,5.5,49.9,18.2,64.1,21.6 c2,0.5,3.7,0.7,5.2,0.7c7.6,0,10.2-3.8,9.7-12.5c-1.6-27.7-5.6-81.7-1.2-132.2c6-69.4,28.4-103.8,55-134.3 c12.8-14.6,72.8-78,187.5-78c115,0,174.7,63.4,187.5,78c26.6,30.4,49,64.8,55,134.3c4.4,50.5,0.6,104.5-1.2,132.2 c-0.6,9.1,2.2,12.5,9.7,12.5c1.5,0,3.3-0.2,5.2-0.7c14.2-3.4,38.8-16.1,64.1-21.6c4.1-0.9,8.4-1.4,12.6-1.4 c13.5,0,26.3,5.2,31.5,18.8c7.5,19.8-2.7,35.9-25.7,52c-13.9,9.7-64.2,40.8-75.5,51.3c-11.7,10.8-10.2,19.2-8.8,29.9 c1.1,8.9,26.4,127.5,185,204.2C960.6,759.1,976.5,768.6,948.6,784z" /> </svg>',
1192
1240
  "google": '<svg viewBox="0 0 24 24"><path fill="#34a853" d="M4 22.93a4 4 0 1 1 0-8 4 4 0 0 1 0 8Z"/><path fill="#4285f4" d="M23.464 16.929 15.463 3.072A4 4 0 0 0 8.534 7.072l8.001 13.857a4 4 0 0 0 6.929-4Z"/><path fill="#fbbc04" d="M7.514 4.844 1.565 15.148A4.5 4.5 0 0 1 4 14.43a4.5 4.5 0 0 1 4.494 4.715l3.217-5.573-3.61-6.25a4 4 0 0 1-.587-2.478Z"/></svg>',
@@ -1199,7 +1247,8 @@ var PROVIDER_LOGOS = {
1199
1247
  "pinterest": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z"></path></svg>',
1200
1248
  "spotify": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#111" style="color:#111" height="1em" width="1em"><path d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"></path></svg>',
1201
1249
  "linkedin": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 448 512" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path></svg>',
1202
- "openai": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"></path></svg>'
1250
+ "openai": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" role="img" viewBox="0 0 24 24" color="#fff" style="color:#fff" height="1em" width="1em"><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"></path></svg>',
1251
+ "gravity": '<svg fill="currentColor" role="img" viewBox="0 0 375 375" color="#fff" style="color:#fff" height="1em" width="1em"><g transform="scale(2.388535)"><path fill-rule="evenodd" clip-rule="evenodd" d="M100.731 3.27415C80.8003 -2.71024 58.5524 -0.784462 39.1075 10.4421C19.6204 21.6929 6.81088 40.0638 2.07292 60.3466C4.29737 52.1778 22.1954 36.7108 46.2541 22.8204C70.2067 8.99138 92.4638 1.21865 100.731 3.27415Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M145.894 39.0384C138.466 26.1729 102.125 33.2483 64.7373 54.8342L64.749 54.8544C27.3392 76.4529 3.07499 104.4 10.4893 117.241C0.546464 100.02 -2.10672 80.6038 1.59446 62.5311C1.79184 62.8846 2.02276 63.2885 2.28846 63.7487C6.00144 70.1798 31.7103 62.2775 59.7036 46.1155C87.6969 29.9536 107.395 11.6402 103.682 5.20916C103.279 4.51127 102.6 3.97033 101.701 3.58828C119.684 9.22908 135.718 21.4124 145.894 39.0384Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M55.5301 152.937C75.4772 158.997 97.8108 157.076 117.278 145.837C136.701 134.623 149.514 116.306 154.285 96.0332C151.919 104.198 134.072 119.609 110.119 133.438C86.1668 147.267 63.6948 155.108 55.5301 152.937Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M145.894 39.0384C153.321 51.9022 129.044 79.8269 91.6362 101.424C54.2483 123.01 17.9062 130.084 10.4793 117.22C20.6673 134.866 36.6766 147.008 54.6725 152.67C53.7739 152.286 53.0962 151.746 52.6933 151.048C48.992 144.638 68.6783 126.304 96.6716 110.142C124.685 93.9685 150.385 86.0981 154.087 92.5089C154.49 93.2068 154.618 94.0634 154.502 95.034C158.606 76.5848 156.073 56.6608 145.898 39.0364L145.894 39.0384Z"/></g></svg>'
1203
1252
  };
1204
1253
 
1205
1254
  // src/operation-reconciliation-ui.ts
@@ -1244,13 +1293,6 @@ var OPERATION_UI_SCRIPT = String.raw`
1244
1293
  const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
1245
1294
  ${OPERATION_RECONCILIATION_UI}
1246
1295
  const human = value => String(value).replace(/([a-z])([A-Z])/g,'$1 $2').replace(/[_.]/g,' ').replace(/^./,c=>c.toUpperCase());
1247
- function resultData(result) {
1248
- if (result?.structuredContent && typeof result.structuredContent === 'object') return result.structuredContent;
1249
- for (const item of arr(result?.content)) {
1250
- if (item.type === 'text') { try { const value=JSON.parse(item.text),data=object(value)?value:{value};return result._meta?.adport?{...data,_adport:result._meta.adport}:data; } catch {} }
1251
- }
1252
- return Array.isArray(result)?{value:result}:result || {};
1253
- }
1254
1296
  function dataFields(value, prefix='', depth=0) {
1255
1297
  if (!object(value) || depth>8) return [];
1256
1298
  return Object.entries(value).filter(([key])=>!['_adport','data_source','pending_operation_id'].includes(key)).flatMap(([key,item])=>{
@@ -1431,7 +1473,7 @@ var OPERATION_UI_SCRIPT = String.raw`
1431
1473
  else send({jsonrpc:'2.0',id:id++,method:'ui/update-model-context',params:{structuredContent:{adport_operation:facts}}});
1432
1474
  }
1433
1475
  function renderFailure(data,meta,isWrite) {
1434
- const phase=errorPhase(data),title=phase==='expired'?'Preview expired':phase==='blocked'?'Action blocked':isWrite?'Outcome unconfirmed':'Request failed';
1476
+ const phase=errorPhase(data),title=phase==='expired'?'Preview expired':phase==='blocked'?'Action blocked':isWrite?'Outcome unconfirmed':data.error==='UNREADABLE_TOOL_RESULT'?'Result unreadable':'Request failed';
1435
1477
  app.innerHTML=chrome(operationHeader(title,meta.accountId,meta.provider)+'<p class="operation-note" role="alert">'+esc(data.message || (isWrite?'Check the result before retrying.':'See the tool response for details.'))+'</p>'+(!['expired','blocked'].includes(phase) && isWrite?'<p class="operation-note">Check the current state before retrying.</p>':'')+'<details><summary>Details</summary><pre>'+esc(JSON.stringify(data,null,2))+'</pre></details>','');
1436
1478
  }
1437
1479
  `;
@@ -1467,9 +1509,12 @@ var APPLE_REPORT_UI_SCRIPT = String.raw`
1467
1509
  const fields=[['Spend',appleReportMoney(metrics.localSpend)],['Taps',taps===null?'—':taps.toLocaleString(state.host.locale||'en')],['Installs',installs===null?'—':installs.toLocaleString(state.host.locale||'en')],['CPI',installs===0?'—':appleReportMoney(metrics.totalAvgCPI)]];
1468
1510
  return '<dl class="record-fields apple-report-metrics">'+fields.map(([label,value])=>'<div><dt>'+esc(label)+'</dt><dd>'+esc(value)+'</dd></div>').join('')+'</dl>';
1469
1511
  }
1512
+ function appleEntityName(metadata) {
1513
+ return [metadata?.searchTermText,metadata?.text,metadata?.name,metadata?.keyword?.text].find(value=>typeof value==='string' && value.trim()) ?? String(metadata?.id ?? '');
1514
+ }
1470
1515
  function appleReportRow(row,index) {
1471
1516
  const metadata=object(row?.metadata)?row.metadata:{},keyword=object(metadata.keyword)?metadata.keyword:{};
1472
- const name=[metadata.searchTermText,metadata.text,metadata.name,keyword.text].find(value=>typeof value==='string'&&value.trim()) ?? (metadata.id!==undefined?String(metadata.id):'Unnamed result '+(index+1));
1517
+ const name=appleEntityName(metadata) || 'Unnamed result '+(index+1);
1473
1518
  const status=[metadata.displayStatus,metadata.systemStatus,metadata.status].find(value=>typeof value==='string'&&value);
1474
1519
  const dimensions=['countryOrRegion','countryCode','adminArea','locality','deviceClass','ageRange','gender'].flatMap(key=>typeof metadata[key]==='string'&&metadata[key]?[metadata[key]]:[]);
1475
1520
  const matchType=metadata.matchType||keyword.matchType;
@@ -1479,8 +1524,8 @@ var APPLE_REPORT_UI_SCRIPT = String.raw`
1479
1524
  return '<article class="record-row"><div class="record-heading"><strong>'+esc(name)+'</strong>'+(status?'<span>'+esc(human(status.toLowerCase()))+'</span>':'')+'</div>'+(dimensions.length?'<p class="apple-report-dimensions">'+dimensions.map(esc).join(' · ')+'</p>':'')+(hasTotals||!periods.length?appleReportMetrics(row?.totalMetrics):'')+breakdown+'</article>';
1480
1525
  }
1481
1526
  function appleChartRecord(row,index,metrics=row?.totalMetrics) {
1482
- const metadata=object(row?.metadata)?row.metadata:{},keyword=object(metadata.keyword)?metadata.keyword:{};
1483
- const name=[metadata.searchTermText,metadata.text,metadata.name,keyword.text].find(value=>typeof value==='string'&&value.trim())??String(metadata.id??'Unnamed result '+(index+1));
1527
+ const metadata=object(row?.metadata)?row.metadata:{};
1528
+ const name=appleEntityName(metadata) || 'Unnamed result '+(index+1);
1484
1529
  const context=['countryOrRegion','countryCode','deviceClass','ageRange','gender'].flatMap(key=>typeof metadata[key]==='string'?[metadata[key]]:[]);
1485
1530
  const fields=[['spend','Spend',metrics?.localSpend?.amount,appleReportMoney(metrics?.localSpend),currencyOf(metrics?.localSpend||{})||'Account units'],['taps','Taps',metrics?.taps,appleReportNumber(metrics?.taps)===null?'—':String(metrics.taps),''],['installs','Installs',metrics?.totalInstalls,appleReportNumber(metrics?.totalInstalls)===null?'—':String(metrics.totalInstalls),'']].map(([key,label,raw,display,unit])=>({key,label,value:appleReportNumber(raw),display,unit}));
1486
1531
  for(const [key,raw] of Object.entries(metrics||{}))if(!['localSpend','taps','totalInstalls','date'].includes(key)) {
@@ -1489,10 +1534,13 @@ var APPLE_REPORT_UI_SCRIPT = String.raw`
1489
1534
  }
1490
1535
  return {name,context:typeof metrics?.date==='string'&&!reportDate(metrics.date)?[...context,metrics.date]:context,series:[name,...context].join(' · '),date:reportDate(metrics?.date),fields};
1491
1536
  }
1492
- function appleReportOverview(metrics) {
1537
+ function appleReportOverview(metrics,entityName) {
1493
1538
  if(!object(metrics))return '';
1494
1539
  const taps=appleReportNumber(metrics.taps),installs=appleReportNumber(metrics.totalInstalls);
1495
- return '<div class="report-overview apple-report-total" aria-label="Report total"><div><small>Total spend</small><strong>'+esc(appleReportMoney(metrics.localSpend))+'</strong></div><dl><div><dt>Taps</dt><dd>'+esc(taps??'—')+'</dd></div><div><dt>Installs</dt><dd>'+esc(installs??'—')+'</dd></div>'+(installs>0&&object(metrics.totalAvgCPI)?'<div><dt>CPI</dt><dd>'+esc(appleReportMoney(metrics.totalAvgCPI))+'</dd></div>':'')+'</dl></div>';
1540
+ if(taps===null && installs===null && appleReportNumber(metrics.localSpend?.amount)===null)return '';
1541
+ const grandTotal=entityName===undefined,label=grandTotal?'Report total':'Returned row metrics';
1542
+ const spend=grandTotal?'Total spend':entityName?'Spend · '+entityName:'Spend for this row';
1543
+ return '<div class="report-overview'+(grandTotal?' apple-report-total':'')+'" aria-label="'+label+'"><div><small>'+esc(spend)+'</small><strong>'+esc(appleReportMoney(metrics.localSpend))+'</strong></div><dl><div><dt>Taps</dt><dd>'+esc(taps??'—')+'</dd></div><div><dt>Installs</dt><dd>'+esc(installs??'—')+'</dd></div>'+(installs>0&&object(metrics.totalAvgCPI)?'<div><dt>CPI</dt><dd>'+esc(appleReportMoney(metrics.totalAvgCPI))+'</dd></div>':'')+'</dl></div>';
1496
1544
  }
1497
1545
  function renderAppleReport(data,meta) {
1498
1546
  const payload=recordPayload(data),hasRows=object(payload)&&Array.isArray(payload.rows),rows=hasRows?payload.rows:[];
@@ -1500,7 +1548,8 @@ var APPLE_REPORT_UI_SCRIPT = String.raw`
1500
1548
  const grandTotal=payload?.summary?.grandTotal;
1501
1549
  // Use Apple's explicit total, which can cover more rows than this page.
1502
1550
  // Never sum breakdowns, average CPIs, or mix currencies in the widget.
1503
- const summary=rows.length?appleReportOverview(grandTotal):'';
1551
+ const single=rows.length===1?rows[0]:null;
1552
+ const summary=rows.length?appleReportOverview(grandTotal) || (single?appleReportOverview(single.totalMetrics,appleEntityName(single.metadata)):''):'';
1504
1553
  const pagination=data.pagination,offset=pagination?.offset,count=pagination?.totalCount;
1505
1554
  const page=rows.length&&Number.isSafeInteger(offset)&&offset>=0&&Number.isSafeInteger(count)&&count>=offset+rows.length&&(offset>0||count>rows.length)?'<p class="apple-report-page">Showing '+(offset+1)+'–'+(offset+Math.min(rows.length,1000))+' of '+count+' results</p>':'';
1506
1555
  const clean={...data};delete clean._adport;
@@ -1737,10 +1786,9 @@ var META_INSIGHTS_UI = String.raw`
1737
1786
 
1738
1787
  // src/native-report-ui.ts
1739
1788
  var NATIVE_REPORT_TOOLS = [
1740
- "ga4_report",
1741
- "ga4_realtime_report",
1742
1789
  "gsc_search_analytics",
1743
1790
  "google_gaql",
1791
+ "gravity_conversion_stats",
1744
1792
  "linkedin_demographic_report",
1745
1793
  "meta_insights",
1746
1794
  "tiktok_report",
@@ -1753,6 +1801,7 @@ var NATIVE_REPORT_TOOLS = [
1753
1801
  "apple_impression_share",
1754
1802
  "apple_search_term_popularity"
1755
1803
  ];
1804
+ var HISTORICAL_REPORT_TOOLS = ["ga4_report", "ga4_realtime_report", "matomo_report", "matomo_campaign_performance", "matomo_realtime_report"];
1756
1805
  var NATIVE_REPORT_UI_STYLES = String.raw`
1757
1806
  .native-report-metrics { grid-template-columns:repeat(auto-fit,minmax(min(110px,100%),1fr)) }
1758
1807
  .meta-insights-table .workflow-table :is(th,td):not(:first-child) { text-align:right; white-space:nowrap }
@@ -1763,7 +1812,7 @@ var NATIVE_REPORT_UI_STYLES = String.raw`
1763
1812
  .meta-insight-kpis .record-fields dd { margin:4px 0 0; font-size:20px; font-weight:600; font-variant-numeric:tabular-nums }
1764
1813
  `;
1765
1814
  var NATIVE_REPORT_UI_SCRIPT = String.raw`
1766
- const nativeReportTools=new Set(${JSON.stringify(NATIVE_REPORT_TOOLS)});
1815
+ const nativeReportTools=new Set(${JSON.stringify([...NATIVE_REPORT_TOOLS, ...HISTORICAL_REPORT_TOOLS])});
1767
1816
  ${GAQL_REPORT_UI}
1768
1817
  ${META_INSIGHTS_UI}
1769
1818
  function nativeReportDecimal(value,scale=0) {
@@ -1778,13 +1827,14 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
1778
1827
  const known={spend:'Spend',costMicros:'Spend',conversionsValue:'Conversion value',impressions:'Impressions',clicks:'Clicks',conversion:'Conversions',conversions:'Conversions',purchases:'Purchases',cpc:'CPC',cpm:'CPM',ctr:'CTR',roas:'ROAS',total_complete_payment_rate:'Purchase value',complete_payment_roas:'Purchase ROAS',lowImpressionShare:'Impression share · lower bound',highImpressionShare:'Impression share · upper bound',searchPopularity1to5:'Popularity · 1–5',searchPopularity1to100:'Popularity · 1–100',searchPopularityInGenre:'Genre popularity · 1–100',rankInGenre:'Genre rank',OverallSuccessRate:'Success rate · ratio',OverallSuccessCount:'Succeeded',SuccessCount:'Succeeded',FailureCount:'Failed',OverallUnattributedCount:'Unattributed'};
1779
1828
  return known[key]||known[key.toLowerCase()]||human(human(key).toLowerCase());
1780
1829
  }
1781
- function nativeReportRatio(key,provider) {return (provider==='gsc'||provider==='google')&&key==='ctr'||provider==='ga4'&&!key.includes(':')&&/Rate$/.test(key);}
1782
- function nativeReportMetric(key,value,provider,currency,moneyFields=[]) {
1830
+ function nativeReportRatio(key,provider,percentFields=[]) {return percentFields.includes(key)||(provider==='gsc'||provider==='google')&&key==='ctr'||provider==='ga4'&&!key.includes(':')&&/Rate$/.test(key);}
1831
+ function nativeReportMetric(key,value,provider,currency,moneyFields=[],percentFields=[],durationFields=[]) {
1783
1832
  if(key==='costInUsd')currency='USD';
1784
1833
  const lower=key.toLowerCase(),decimal=nativeReportDecimal(value);
1785
1834
  if(value===null||value===undefined||value===''||value==='-'||value==='--')return '—';
1786
1835
  if(provider==='spotify'&&decimal==='-5')return 'Suppressed';
1787
- if(nativeReportRatio(key,provider)&&decimal!==null)return new Intl.NumberFormat(state.host.locale||'en',{style:'percent',maximumFractionDigits:2}).format(Number(decimal));
1836
+ if(nativeReportRatio(key,provider,percentFields)&&decimal!==null)return new Intl.NumberFormat(state.host.locale||'en',{style:'percent',maximumFractionDigits:2}).format(Number(decimal));
1837
+ if(durationFields.includes(key)&&decimal!==null)return nativeReportDuration(Number(decimal));
1788
1838
  const moneyField=nativeReportMoneyField(key,provider,moneyFields);
1789
1839
  if(moneyField) {
1790
1840
  if(decimal===null)return '—';
@@ -1795,6 +1845,10 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
1795
1845
  }
1796
1846
  return typeof value==='string'||typeof value==='number'||typeof value==='boolean'?String(value):'—';
1797
1847
  }
1848
+ function nativeReportDuration(seconds) {
1849
+ const total=Math.round(Math.abs(seconds)),h=Math.floor(total/3600),m=Math.floor(total%3600/60),s=total%60;
1850
+ return (seconds<0?'-':'')+(h?h+'h '+m+'m '+s+'s':m?m+'m '+s+'s':s+'s');
1851
+ }
1798
1852
  function nativeReportMoneyField(key,provider,moneyFields=[]) {
1799
1853
  return moneyFields.includes(key)||/^(spend|revenue|cpc|cpm|cost_per_conversion|costInLocalCurrency|costInUsd|total_complete_payment_rate|conversion_.*_total_value)$|^(?:action_values|cost_per_action_type) · /i.test(key)||provider==='meta'&&/^(?:cpp$|cost_per_)/.test(key)||provider==='google'&&(/Micros$/.test(key)||/conversionsValue$/i.test(key));
1800
1854
  }
@@ -1807,15 +1861,15 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
1807
1861
  }
1808
1862
  function nativeReportRecord(row,index,meta,payload) {
1809
1863
  if(!object(row))return null;
1810
- const provider=meta.tool.split('_')[0],dimensions=object(row.dimensions)?row.dimensions:provider==='google'&&object(row.segments)?row.segments:{},metrics=['tiktok','google','linkedin','ga4','gsc'].includes(provider)&&object(row.metrics)?row.metrics:row;
1811
- const names=provider==='microsoft'?['SearchQuery','Keyword','ConversionName','UploadDate']:provider==='apple'?['searchTerm','appName']:['ad_name','adgroup_name','adset_name','campaign_name','account_name','advertiser_name','name','entity_name'];
1864
+ const provider=meta.tool.split('_')[0],dimensions=object(row.dimensions)?row.dimensions:provider==='google'&&object(row.segments)?row.segments:{},metrics=['tiktok','google','linkedin','ga4','gsc','matomo'].includes(provider)&&object(row.metrics)?row.metrics:row;
1865
+ const names=provider==='gravity'?['date']:provider==='microsoft'?['SearchQuery','Keyword','ConversionName','UploadDate']:provider==='apple'?['searchTerm','appName']:['ad_name','adgroup_name','adset_name','campaign_name','account_name','advertiser_name','name','entity_name'];
1812
1866
  const ids=['ad_id','adgroup_id','adset_id','campaign_id','advertiser_id','account_id','entity_id','id','GoalId','urn'];
1813
1867
  const first=(keys,sources)=>keys.flatMap(key=>sources.map(source=>source[key])).find(value=>(typeof value==='string'&&value.trim())||typeof value==='number');
1814
1868
  const googleDimensions=provider==='google'?gaqlDimensions(row):null;
1815
1869
  const googleEntity=googleDimensions&&[...gaqlEntities.keys()].find(path=>googleDimensions.has(path));
1816
1870
  const googleName=googleDimensions?.get(googleEntity);
1817
1871
  const bucket=dimensions.conversionLagBucket??dimensions.conversionOrAdjustmentLagBucket;
1818
- const analyticsName=['ga4','gsc'].includes(provider)?Object.values(dimensions).filter(value=>typeof value==='string'&&value).join(' · '):null;
1872
+ const analyticsName=['ga4','gsc','matomo'].includes(provider)?Object.entries(dimensions).filter(([key])=>key!=='period_label').map(([,value])=>value).filter(value=>typeof value==='string'&&value).join(' · ')||first(['period_label'],[dimensions])||first(['name'],[payload.report||{}]):null;
1819
1873
  const identity=bucket?reportBucket(bucket):googleName??analyticsName??first(names,[row,metrics,dimensions])??first(ids,[row,dimensions]);
1820
1874
  const name=identity??(provider==='google'?'Report':provider==='meta'?'Reported metrics':'Result '+(index+1));
1821
1875
  const status=first(['entity_status','status'],[row]);
@@ -1835,19 +1889,21 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
1835
1889
  if(provider==='linkedin'&&row.date_range?.start&&row.date_range?.end){const period=row.date_range.start+' – '+row.date_range.end;context.push(period);fields.push(['period',period]);}
1836
1890
  const priority=key=>/^(spend|impressions|clicks)$/i.test(key)?['spend','impressions','clicks'].indexOf(key.toLowerCase()):/^(conversion|conversions|purchases)$|^actions · purchase$/i.test(key)?3:4;
1837
1891
  fields.sort((a,b)=>priority(a[0])-priority(b[0]));
1838
- const moneyFields=provider==='ga4'?arr(payload.metric_headers).filter(header=>header.type==='TYPE_CURRENCY').map(header=>header.name):[];
1839
- return {name,identity,status,context,currency,moneyFields,provider,fields,gaqlDimensions:googleDimensions,gaqlEntity:googleEntity,native:row,date:reportDate(dimensions.stat_time_day??(provider==='ga4'&&/^\d{8}$/.test(dimensions.date||'')?dimensions.date.replace(/^(\d{4})(\d{2})(\d{2})$/,'$1-$2-$3'):dimensions.date)??(row.date_start===row.date_stop?row.date_start:null)??(row.date_range?.start===row.date_range?.end?row.date_range?.start:null)),series:googleName||(['ga4','gsc'].includes(provider)?Object.entries(dimensions).filter(([key])=>key!=='date').map(([,value])=>value).join(' · ')||'Website':name)};
1892
+ const matomoTypes=provider==='matomo'&&object(payload.metric_types)?payload.metric_types:{},typed=type=>Object.keys(matomoTypes).filter(key=>matomoTypes[key]===type);
1893
+ const moneyFields=provider==='ga4'?arr(payload.metric_headers).filter(header=>header.type==='TYPE_CURRENCY').map(header=>header.name):typed('money');
1894
+ const percentFields=typed('percent'),durationFields=typed('duration_s');
1895
+ return {name,identity,status,context,currency,moneyFields,percentFields,durationFields,provider,fields,gaqlDimensions:googleDimensions,gaqlEntity:googleEntity,native:row,date:reportDate(dimensions.stat_time_day??(provider==='ga4'&&/^\d{8}$/.test(dimensions.date||'')?dimensions.date.replace(/^(\d{4})(\d{2})(\d{2})$/,'$1-$2-$3'):dimensions.date)??(row.date_start===row.date_stop?row.date_start:null)??(row.date_range?.start===row.date_range?.end?row.date_range?.start:null)),series:googleName||(['ga4','gsc','matomo'].includes(provider)?Object.entries(dimensions).filter(([key])=>key!=='date'&&key!=='period_label').map(([,value])=>value).join(' · ')||'Website':name)};
1840
1896
  }
1841
1897
  function nativeChartRecord(record) {
1842
1898
  if(!record)return {name:'Unavailable row',context:[],fields:[]};
1843
1899
  const fields=record.fields.map(([key,raw])=>{
1844
1900
  const monetary=nativeReportMoneyField(key,record.provider,record.moneyFields),scaled=nativeReportDecimal(raw,nativeReportScale(key,record.provider));
1845
- const ratio=nativeReportRatio(key,record.provider);
1901
+ const ratio=nativeReportRatio(key,record.provider,record.percentFields);
1846
1902
  const value=record.provider==='spotify'&&String(raw)==='-5'?null:reportNumber(monetary?scaled:raw);
1847
- const display=nativeReportMetric(key,raw,record.provider,record.currency,record.moneyFields);
1903
+ const display=nativeReportMetric(key,raw,record.provider,record.currency,record.moneyFields,record.percentFields,record.durationFields);
1848
1904
  const shortMoney=monetary&&['google','meta'].includes(record.provider);
1849
1905
  const shortDisplay=shortMoney&&scaled!==null?reportAmount(scaled,record.currency):undefined;
1850
- return {key,label:key==='costInLocalCurrency'?'Spend':key==='costInUsd'?'Spend · USD':nativeReportLabel(key),value:ratio&&value!==null?value*100:value,display,shortDisplay,unit:ratio?'%':monetary?key==='costInUsd'?'USD':record.currency||(record.provider==='meta'?'':shortMoney?'Currency unavailable':'Account units'):''};
1906
+ return {key,label:key==='costInLocalCurrency'?'Spend':key==='costInUsd'?'Spend · USD':nativeReportLabel(key),value:ratio&&value!==null?value*100:value,display,shortDisplay,unit:ratio?'%':record.durationFields?.includes(key)?'s':monetary?key==='costInUsd'?'USD':record.currency||(record.provider==='meta'?'':shortMoney?'Currency unavailable':'Account units'):''};
1851
1907
  });
1852
1908
  const low=record.native.lowImpressionShare,high=record.native.highImpressionShare;
1853
1909
  const range=record.provider==='apple'&&[low,high].every(value=>typeof value==='number'&&Number.isFinite(value)&&value>=0&&value<=1)&&low<=high?[low,high]:undefined;
@@ -1857,21 +1913,21 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
1857
1913
  function nativeReportRow(row,index,meta,payload) {
1858
1914
  const record=nativeReportRecord(row,index,meta,payload);
1859
1915
  if(!record)return '<article class="record-row"><p class="operation-note">Report row unavailable.</p></article>';
1860
- const {name,status,context,currency,provider,fields,moneyFields}=record;
1916
+ const {name,status,context,currency,provider,fields,moneyFields,percentFields,durationFields}=record;
1861
1917
  const shown=fields.slice(0,4),details=fields.length>4?'<p class="apple-report-dimensions">'+(fields.length-4)+' more metric'+(fields.length===5?'':'s')+' in Details</p>':'';
1862
- return '<article class="record-row"><div class="record-heading"><div class="record-name"><strong>'+esc(name)+'</strong></div>'+(status?'<span>'+esc(status)+'</span>':'')+'</div>'+(context.length?'<p class="apple-report-dimensions">'+context.map(esc).join(' · ')+'</p>':'')+(shown.length?'<dl class="record-fields apple-report-metrics native-report-metrics">'+shown.map(([key,value])=>'<div><dt>'+esc(nativeReportLabel(key))+'</dt><dd>'+esc(nativeReportMetric(key,value,provider,currency,moneyFields))+'</dd></div>').join('')+'</dl>':'<p class="operation-note">No metrics returned for this row.</p>')+details+'</article>';
1918
+ return '<article class="record-row"><div class="record-heading"><div class="record-name"><strong>'+esc(name)+'</strong></div>'+(status?'<span>'+esc(status)+'</span>':'')+'</div>'+(context.length?'<p class="apple-report-dimensions">'+context.map(esc).join(' · ')+'</p>':'')+(shown.length?'<dl class="record-fields apple-report-metrics native-report-metrics">'+shown.map(([key,value])=>'<div><dt>'+esc(nativeReportLabel(key))+'</dt><dd>'+esc(nativeReportMetric(key,value,provider,currency,moneyFields,percentFields,durationFields))+'</dd></div>').join('')+'</dl>':'<p class="operation-note">No metrics returned for this row.</p>')+details+'</article>';
1863
1919
  }
1864
1920
  function renderNativeReport(data,meta) {
1865
- const payload=meta.tool==='linkedin_demographic_report'?data:recordPayload(data),rows=meta.tool==='reddit_report'?payload?.metrics:payload?.rows;
1921
+ const payload=meta.tool==='linkedin_demographic_report'?data:recordPayload(data),rows=meta.tool==='reddit_report'?payload?.metrics:meta.tool==='gravity_conversion_stats'?payload?.time_series:payload?.rows;
1866
1922
  const entries=Array.isArray(rows)?rows:[],provider=meta.tool.split('_')[0];
1867
- const title=meta.tool.includes('offline_conversion')?'Upload diagnostics':meta.tool==='apple_impression_share'?'Impression share':meta.tool==='apple_search_term_popularity'?'Search popularity':provider==='ga4'?'Website analytics':provider==='gsc'?'Organic search':'Performance';
1923
+ const title=meta.tool==='gravity_conversion_stats'?'Conversions by day':meta.tool.includes('offline_conversion')?'Upload diagnostics':meta.tool==='apple_impression_share'?'Impression share':meta.tool==='apple_search_term_popularity'?'Search popularity':provider==='ga4'?'Website analytics':provider==='gsc'?'Organic search':provider==='matomo'?'Matomo analytics':'Performance';
1868
1924
  const missing=Array.isArray(rows)?'No report rows returned.':'Report rows unavailable. The response is in Details.';
1869
1925
  const clean={...data};delete clean._adport;
1870
1926
  const errors=arr(data.errors).filter(error=>error?.error_code).map(error=>'<p class="notice">Goal '+esc(error.goal_id||'unavailable')+': '+esc(error.error_code)+'</p>').join('');
1871
1927
  const missingGoals=arr(data.not_returned_goal_ids).filter(id=>!arr(data.errors).some(error=>error?.goal_id===id&&error?.error_code));
1872
1928
  const absent=missingGoals.length?'<p class="notice">No summary returned for goal'+(missingGoals.length===1?'':'s')+' '+missingGoals.map(esc).join(', ')+'.</p>':'';
1873
1929
  const records=(provider==='meta'?entries:entries.slice(0,1000)).map((row,index)=>nativeReportRecord(row,index,meta,payload)),delay=provider==='google'&&entries.some(row=>row?.segments?.conversionLagBucket||row?.segments?.conversionOrAdjustmentLagBucket);
1874
- const pageArgs=['ga4_report','gsc_search_analytics'].includes(meta.tool)?readPageArgs(meta,'data-report-next'):null;
1930
+ const pageArgs=['ga4_report','gsc_search_analytics','matomo_report','matomo_campaign_performance'].includes(meta.tool)?readPageArgs(meta,'data-report-next'):null;
1875
1931
  const points=records.map(nativeChartRecord);
1876
1932
  let presentation;
1877
1933
  if(entries.length && provider==='meta') presentation=metaInsightsReport(records,points,payload);
@@ -1883,7 +1939,7 @@ var NATIVE_REPORT_UI_SCRIPT = String.raw`
1883
1939
  const entity=records[0]?.gaqlEntity;
1884
1940
  const dimension=entity&&records.every(row=>row?.gaqlEntity===entity)?gaqlEntities.get(entity).toLowerCase():undefined;
1885
1941
  const chart=entries.length&&!presentation?reportCharts(points,delay?{dimension:'delay',mode:'bars',metric:records.some(record=>record?.fields.some(([key])=>key==='conversions'))?'conversions':undefined}:meta.tool==='apple_impression_share'?{metric:'Impression share',dimension:'search term'}:{dimension}):null;
1886
- const analytics=['ga4','gsc'].includes(provider),range=payload?.date_range;
1942
+ const analytics=['ga4','gsc','matomo'].includes(provider),range=payload?.date_range;
1887
1943
  const period=analytics&&object(range)?[range.start_date??range.start,range.end_date??range.end].filter(workflowText).join(' – '):'';
1888
1944
  const subject=presentation?.subject||(analytics?[meta.accountId,period].filter(Boolean).join(' · '):'');
1889
1945
  const view=presentation||chart;
@@ -2495,14 +2551,17 @@ var REPORT_CHART_SCRIPT = String.raw`
2495
2551
  return '<section class="report-chart" data-report-chart><div class="report-chart-head"><b>'+esc(title)+'</b>'+(unit?'<span>'+esc(unit)+'</span>':'')+'</div>'+body+(!trend&&model.returned>shown.length?'<p class="report-chart-foot">'+shown.length+' of '+model.returned+' returned rows · all rows in Details</p>':trend&&model.returned>points.length?'<p class="report-chart-foot">'+points.length+' of '+model.returned+' dated observations · all data in Details</p>':'')+'</section>';
2496
2552
  }).join('')+(groups.size>4?'<p class="report-chart-foot">Showing four units. All returned values are in Details.</p>':'');
2497
2553
  return {html,mount:()=>{
2498
- const elements=[...app.querySelectorAll('[data-native-line]')];
2554
+ const elements=[...app.querySelectorAll('[data-native-line]')],widths=new Map();
2499
2555
  const draw=()=>elements.forEach(element=>{
2500
2556
  if(element.isConnected===false)return;
2501
2557
  const model=models[Number(element.dataset.nativeLine)];if(!model)return;
2558
+ const width=Math.max(240,Math.floor(element.getBoundingClientRect?.().width||480));
2559
+ if(widths.get(element)===width)return;
2560
+ widths.set(element,width);
2502
2561
  const series=new Map();for(const point of model.points){const name=point.series||point.name;if(!series.has(name))series.set(name,[]);series.get(name).push(point);}
2503
2562
  const chosen=[...series.entries()].slice(0,3),valid=chosen.flatMap(([,points])=>points).filter(point=>available(point.value));
2504
2563
  if(!valid.length){element.innerHTML='<p class="operation-note">No complete dated values were returned.</p>';return;}
2505
- const width=Math.max(240,Math.floor(element.getBoundingClientRect?.().width||480)),height=178,left=46,right=12,top=12,bottom=30;
2564
+ const height=178,left=46,right=12,top=12,bottom=30;
2506
2565
  const dates=[...new Set(model.points.map(point=>point.date))].sort(),start=Date.parse(dates[0]),end=Date.parse(dates.at(-1)),span=Math.max(86400000,end-start);
2507
2566
  const max=Math.max(1e-100,...valid.map(point=>point.value)),min=Math.min(0,...valid.map(point=>point.value)),range=max-min||1;
2508
2567
  const x=date=>left+(Date.parse(date)-start)/span*(width-left-right),y=value=>top+(max-value)/range*(height-top-bottom);
@@ -2515,7 +2574,7 @@ var REPORT_CHART_SCRIPT = String.raw`
2515
2574
  return '<path d="'+line+'" fill="none" stroke="'+colors[index]+'" stroke-width="2" stroke-dasharray="'+dashes[index]+'"/>'+sorted.filter(point=>available(point.value)).map(point=>'<circle cx="'+x(point.date)+'" cy="'+y(point.value)+'" r="3" fill="'+colors[index]+'" tabindex="0"><title>'+esc(pretty(name)+' · '+point.date+' · '+point.display)+'</title></circle>').join('');
2516
2575
  }).join('');
2517
2576
  const axis=value=>new Intl.NumberFormat(state.host.locale||'en',{notation:Math.abs(value)>=1000?'compact':'standard',maximumFractionDigits:3}).format(value);
2518
- element.innerHTML='<svg viewBox="0 0 '+width+' '+height+'" role="img" aria-label="'+esc(model.label+' over reported dates')+'"><line class="chart-grid" x1="'+left+'" x2="'+(width-right)+'" y1="'+(height-bottom)+'" y2="'+(height-bottom)+'"/><text x="'+(left-8)+'" y="'+(top+4)+'" text-anchor="end">'+esc(axis(max))+'</text><text x="'+(left-8)+'" y="'+(height-bottom)+'" text-anchor="end">'+esc(axis(min))+'</text>'+paths+labels+'</svg>'+(chosen.length>1?'<div class="report-legend">'+chosen.map(([name],index)=>'<span><i style="border-color:'+colors[index]+';border-top-style:'+(index?'dashed':'solid')+'"></i>'+esc(pretty(name))+'</span>').join('')+'</div>':'')+(series.size>3?'<p class="report-chart-foot">3 of '+series.size+' series · all series in Details</p>':'');
2577
+ element.innerHTML='<svg height="'+height+'" viewBox="0 0 '+width+' '+height+'" role="img" aria-label="'+esc(model.label+' over reported dates')+'"><line class="chart-grid" x1="'+left+'" x2="'+(width-right)+'" y1="'+(height-bottom)+'" y2="'+(height-bottom)+'"/><text x="'+(left-8)+'" y="'+(top+4)+'" text-anchor="end">'+esc(axis(max))+'</text><text x="'+(left-8)+'" y="'+(height-bottom)+'" text-anchor="end">'+esc(axis(min))+'</text>'+paths+labels+'</svg>'+(chosen.length>1?'<div class="report-legend">'+chosen.map(([name],index)=>'<span><i style="border-color:'+colors[index]+';border-top-style:'+(index?'dashed':'solid')+'"></i>'+esc(pretty(name))+'</span>').join('')+'</div>':'')+(series.size>3?'<p class="report-chart-foot">3 of '+series.size+' series · all series in Details</p>':'');
2519
2578
  });
2520
2579
  draw();if(typeof ResizeObserver!=='undefined'&&models.some(model=>model.trend)){trendResize=new ResizeObserver(draw);elements.forEach(element=>trendResize.observe(element));}
2521
2580
  }};
@@ -2523,8 +2582,9 @@ var REPORT_CHART_SCRIPT = String.raw`
2523
2582
  `;
2524
2583
 
2525
2584
  // src/ui.ts
2526
- var ADPORT_UI_URI = "ui://adport/insight-card-v40.html";
2527
- var ADPORT_SUMMARY_UI_URI = "ui://adport/summary-card-v40.html";
2585
+ var ADPORT_UI_VERSION = 42;
2586
+ var ADPORT_UI_URI = `ui://adport/insight-card-v${ADPORT_UI_VERSION}.html`;
2587
+ var ADPORT_SUMMARY_UI_URI = `ui://adport/summary-card-v${ADPORT_UI_VERSION}.html`;
2528
2588
  var ADPORT_UI_DOMAIN = "https://app.adport.dev";
2529
2589
  var ADPORT_UI_RESOURCE_DOMAINS = [
2530
2590
  ADPORT_UI_DOMAIN,
@@ -2549,6 +2609,7 @@ var ADPORT_UI_RESOURCE_DOMAINS = [
2549
2609
  var providerNames = {
2550
2610
  ga4: "Google Analytics 4",
2551
2611
  gsc: "Google Search Console",
2612
+ matomo: "Matomo",
2552
2613
  gtm: "Google Tag Manager",
2553
2614
  google: "Google Ads",
2554
2615
  meta: "Meta Ads",
@@ -2562,6 +2623,7 @@ var providerNames = {
2562
2623
  linkedin: "LinkedIn Ads",
2563
2624
  x: "X Ads",
2564
2625
  openai: "OpenAI Ads",
2626
+ gravity: "Gravity",
2565
2627
  mock: "Demo",
2566
2628
  demo: "Synthetic demo"
2567
2629
  };
@@ -2682,7 +2744,7 @@ var ADPORT_UI_HTML = String.raw`<!doctype html>
2682
2744
  .identity { display:flex; align-items:center; gap:10px; min-width:0 }
2683
2745
  .logo { display:grid; place-items:center; flex:0 0 auto; width:29px; height:29px; padding:6px; border:1px solid var(--line); border-radius:9px; color:var(--ink); background:var(--paper); font-weight:800; font-size:10px }
2684
2746
  .logo svg { display:block; width:100%; height:100% }
2685
- .logo.reddit { background:#ff4500 }.logo.linkedin { background:#0a66c2 }.logo.spotify { background:#1db954 }.logo.pinterest { background:#e60023 }.logo.x { background:#111 }.logo.openai { background:#000 }.logo.snapchat { background:#fffc00;color:#111 }
2747
+ .logo.reddit { background:#ff4500 }.logo.linkedin { background:#0a66c2 }.logo.spotify { background:#1db954 }.logo.pinterest { background:#e60023 }.logo.x { background:#111 }.logo.openai { background:#000 }.logo.gravity { background:#111 }.logo.snapchat { background:#fffc00;color:#111 }
2686
2748
  .identity-copy { min-width:0 }
2687
2749
  .identity-copy b, .identity-copy span { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis }
2688
2750
  .identity-copy b { font-size:12px }.identity-copy span { margin-top:3px; color:var(--muted); font-size:10px }
@@ -2798,7 +2860,7 @@ ${TREND_UI_STYLES}
2798
2860
  const noticeText=(value,fallback)=>typeof value==='string'?value:typeof value?.message==='string'?value.message:typeof value?.reason==='string'?value.reason:fallback;
2799
2861
  const notices = data => [...arr(data.errors).map(error=>(error?.provider || 'Provider')+': '+noticeText(error,'Read failed')), ...arr(data.warnings).map(warning=>noticeText(warning,'Some metadata is unavailable')), ...arr(data.notes).filter(note=>typeof note==='string'), ...(typeof data.note==='string'?[data.note]:[]), ...(data.truncated ? ['Partial result: row limit reached. Totals and charts cover returned rows only.'] : [])].map(text => '<p class="notice">'+esc(text)+'</p>').join('');
2800
2862
  const providerName = (id, names) => names?.[id] || String(id || 'Provider');
2801
- const initials = (id) => ({snapchat:'S',spotify:'S',pinterest:'P',linkedin:'in',x:'X',openai:'AI'}[id] || String(id || '?').slice(0,2).toUpperCase());
2863
+ const initials = (id) => ({snapchat:'S',spotify:'S',pinterest:'P',linkedin:'in',x:'X',openai:'AI',gravity:'G'}[id] || String(id || '?').slice(0,2).toUpperCase());
2802
2864
  const providerSvg = ${JSON.stringify(PROVIDER_LOGOS)};
2803
2865
  const logo = (id) => '<span class="logo '+esc(id)+'" aria-hidden="true">'+(providerSvg[id] || esc(initials(id)))+'</span>';
2804
2866
  let syntheticResult = false;
@@ -2857,9 +2919,48 @@ ${RECORD_UI_SCRIPT}
2857
2919
  ${READ_PAGE_UI}
2858
2920
  ${APPLE_REPORT_UI_SCRIPT}
2859
2921
  ${NATIVE_REPORT_UI_SCRIPT}
2922
+ ${ACQUISITION_UI}
2860
2923
  ${REPORT_CHART_SCRIPT}
2861
2924
  ${INSIGHT_UI_SCRIPT}
2862
2925
  ${TREND_UI_SCRIPT}
2926
+ function isToolResult(value) {
2927
+ return object(value) && (Object.hasOwn(value,'structuredContent') || Array.isArray(value.content) && value.content.every(block=>typeof block?.type==='string'))
2928
+ && Object.keys(value).every(key=>['content','structuredContent','_meta','isError'].includes(key));
2929
+ }
2930
+ function textPayload(content) {
2931
+ const blocks=arr(content).filter(block=>block?.type==='text' && typeof block.text==='string');
2932
+ for (const block of blocks) {
2933
+ try { return JSON.parse(block.text); } catch {}
2934
+ }
2935
+ if (blocks.length===1 && content.length===1) {
2936
+ const text=blocks[0].text, first=text.trimStart()[0];
2937
+ if (first==='{' || first==='[') return {error:'UNREADABLE_TOOL_RESULT',message:'The widget could not read the complete tool response. Check the result in the conversation.'};
2938
+ return {message:text};
2939
+ }
2940
+ }
2941
+ function normalizeToolResult(input,hostMeta) {
2942
+ let value=input, envelopeMeta, isError=false, fromText=false;
2943
+ // A host can forward a complete CallToolResult inside another text block.
2944
+ // Stop at the provider payload, including its own result, content or copy.
2945
+ for (let depth=0;depth<8 && isToolResult(value);depth++) {
2946
+ isError ||= value.isError===true;
2947
+ envelopeMeta ??= value._meta?.adport;
2948
+ fromText=value.structuredContent==null;
2949
+ const next=fromText?textPayload(value.content):value.structuredContent;
2950
+ if (next===undefined) break;
2951
+ value=next;
2952
+ }
2953
+ const data=object(value)?value:{value};
2954
+ const meta=hostMeta ?? (fromText?undefined:data._adport) ?? envelopeMeta;
2955
+ let structuredContent=data;
2956
+ if (meta!==data._adport) {
2957
+ structuredContent={...data};
2958
+ if (meta) structuredContent._adport=meta;
2959
+ else delete structuredContent._adport;
2960
+ }
2961
+ return {structuredContent,...(isError?{isError:true}:{})};
2962
+ }
2963
+ function resultData(result) { return result?.structuredContent ?? {}; }
2863
2964
  async function callTool(tool,parameters,timeoutMs=30000) {
2864
2965
  const requestId=id++;
2865
2966
  return new Promise((resolve,reject)=>{
@@ -2870,7 +2971,7 @@ ${TREND_UI_SCRIPT}
2870
2971
  const request=pendingRequests.get(requestId);if (request) {clearTimeout(request.timer);pendingRequests.delete(requestId);request.resolve(result);}
2871
2972
  },error=>{const request=pendingRequests.get(requestId);if (request) {clearTimeout(request.timer);pendingRequests.delete(requestId);request.reject(error);}});
2872
2973
  } else send({jsonrpc:'2.0',id:requestId,method:'tools/call',params:{name:tool,arguments:parameters}});
2873
- });
2974
+ }).then(result=>result==null?result:normalizeToolResult(result));
2874
2975
  }
2875
2976
  ${MEDIA_UPLOAD_UI}
2876
2977
  ${MEDIA_LIBRARY_UI}
@@ -2878,11 +2979,27 @@ ${CREATIVE_UI_SCRIPT}
2878
2979
  ${PROVIDER_GALLERY_UI}
2879
2980
  ${WORKFLOW_UI}
2880
2981
  ${PLANNING_UI}
2982
+ function readPresentation(data) {
2983
+ // Some hosts forward only the public text result. These views need no
2984
+ // account scope, pagination arguments or write capability to display it.
2985
+ const name=state.host.toolInfo?.tool?.name, tool=typeof name==='string'?name.split('__').pop():undefined;
2986
+ if ((!tool || tool==='meta_list_ads') && Array.isArray(data.ads) && Array.isArray(data.creatives) &&
2987
+ data.creatives.every(item=>item?.provider==='meta' && typeof item.id==='string' && typeof item.account_id==='string')) {
2988
+ return {tool:'meta_list_ads',view:'creatives',provider:'meta'};
2989
+ }
2990
+ const rows=data.result?.rows;
2991
+ const appleMetrics=metrics=>object(metrics?.localSpend) && (Object.hasOwn(metrics,'taps') || Object.hasOwn(metrics,'totalInstalls'));
2992
+ if (Array.isArray(rows) && (tool==='apple_report' || !tool && (appleMetrics(data.result.summary?.grandTotal) ||
2993
+ rows.some(row=>appleMetrics(row?.totalMetrics) || arr(row?.granularMetrics).some(appleMetrics))))) {
2994
+ return {tool:'apple_report',view:'records',provider:'apple'};
2995
+ }
2996
+ return {};
2997
+ }
2881
2998
  function render(result) {
2882
2999
  cancelHold();clearTimeout(expiryTimer);trendResize?.disconnect();
2883
3000
  let data=resultData(result);
2884
3001
  if (!object(data)) data={value:data};
2885
- const meta = data._adport || {};
3002
+ const meta = data._adport || readPresentation(data);
2886
3003
  recordPages=null;
2887
3004
  if(providerGallery && meta.view!=='creatives' && (!providerGallery.review || meta.view!=='operation' || meta.tool!==providerGallery.review.tool || meta.accountId!==providerGallery.meta.accountId || meta.context?.project_id!==providerGallery.meta.context?.project_id)) providerGallery=null;
2888
3005
  syntheticResult = data.data_source === 'synthetic';
@@ -2897,6 +3014,7 @@ ${PLANNING_UI}
2897
3014
  if (meta.view === 'accounts') return renderAccounts(data,meta);
2898
3015
  if (meta.view === 'report') return renderReport(data,meta);
2899
3016
  if (meta.view === 'operation') {renderOperation(data,meta);providerGalleryReviewControls(data,meta);return;}
3017
+ if (meta.tool === 'analytics_goals' || meta.tool === 'analytics_acquisition_report') return renderAcquisition(data,meta);
2900
3018
  if (meta.tool === 'capabilities_list') return renderAvailability(data,meta);
2901
3019
  if (meta.tool === 'apple_change_history') return renderHistory(data,meta);
2902
3020
  if (meta.tool === 'apple_recommendations') return renderAppleRecommendations(data,meta);
@@ -2921,12 +3039,13 @@ ${PLANNING_UI}
2921
3039
  hostResults.add(fingerprint);
2922
3040
  if (hostResults.size>16) hostResults.delete(hostResults.values().next().value);
2923
3041
  }
2924
- function acceptResult(result,local=false) {
2925
- if (!result || typeof result !== 'object') return;
3042
+ function acceptResult(input,local=false,hostMeta) {
3043
+ if (input==null) return;
3044
+ const result=normalizeToolResult(input,hostMeta);
2926
3045
  const incoming=resultData(result);
2927
3046
  if(!local && (providerGalleryIgnoreEcho(incoming) || mediaLibraryIgnoreEcho(incoming) || recordPagesIgnoreEcho(incoming) || readPageIgnoreEcho(incoming) || distributionIgnoreEcho(incoming))) return;
2928
- if(!local && (app.querySelector('[data-media-gallery]') && uploads.items.length>0 && ['media_prepare_upload','media_finalize_upload','media_get'].includes(incoming?._adport?.tool || result._meta?.adport?.tool) || mediaLibrary?.loading && incoming?._adport?.tool==='media_list' && mediaLibraryProject(incoming,incoming._adport)===mediaLibrary.project)) return;
2929
- const fingerprint=JSON.stringify(incoming);
3047
+ if(!local && (app.querySelector('[data-media-gallery]') && uploads.items.length>0 && ['media_prepare_upload','media_finalize_upload','media_get'].includes(incoming?._adport?.tool) || mediaLibrary?.loading && incoming?._adport?.tool==='media_list' && mediaLibraryProject(incoming,incoming._adport)===mediaLibrary.project)) return;
3048
+ const fingerprint=(result.isError?'error:':'')+JSON.stringify(incoming);
2930
3049
  // Host state updates can echo an old tool result after a local edit/apply.
2931
3050
  if (!local && state.hasLocalResult && hostResults.has(fingerprint)) return;
2932
3051
  if (local) state.hasLocalResult=true;
@@ -2943,8 +3062,7 @@ ${PLANNING_UI}
2943
3062
  if (!globals) return;
2944
3063
  const metadata = globals.toolResponseMetadata;
2945
3064
  const envelope = metadata?.mcp_tool_result || metadata?.call_tool_result;
2946
- if (envelope && typeof envelope === 'object') return acceptResult(envelope);
2947
- if (globals.toolOutput && typeof globals.toolOutput === 'object') acceptResult({structuredContent:{...globals.toolOutput,...(metadata?.adport?{_adport:metadata.adport}:{})}});
3065
+ acceptResult(object(envelope)?envelope:globals.toolOutput,false,metadata?.adport);
2948
3066
  }
2949
3067
  // Some hosts mount an error result's resource but never relay its payload.
2950
3068
  // This is a delivery fallback, not a claim about tool execution or success.
@@ -2978,12 +3096,12 @@ ${PLANNING_UI}
2978
3096
  if (message.method === 'ui/notifications/tool-result') acceptResult(message.params);
2979
3097
  if (message.method === 'ui/notifications/tool-cancelled') acceptResult({structuredContent:{cancelled:true,message:message.params?.reason}});
2980
3098
  if (message.method === 'ui/notifications/host-context-changed') {
2981
- const previousLocale = state.host.locale;
3099
+ const previousHost = state.host;
2982
3100
  state.host = {...state.host,...message.params};
2983
3101
  document.documentElement.dataset.theme = state.host.theme || '';
2984
3102
  // Size/theme updates must not rebuild the DOM: opening Details changes
2985
3103
  // the iframe height, which some hosts echo back as a context update.
2986
- if (state.result && previousLocale !== state.host.locale) {
3104
+ if (state.result && (previousHost.locale!==state.host.locale || !resultData(state.result)._adport && previousHost.toolInfo?.tool?.name!==state.host.toolInfo?.tool?.name)) {
2987
3105
  const expanded = app.querySelector('details')?.open || false;
2988
3106
  render(state.result);
2989
3107
  const details = app.querySelector('details');
@@ -3002,8 +3120,12 @@ ${PLANNING_UI}
3002
3120
  </html>`;
3003
3121
 
3004
3122
  // src/index.ts
3005
- var PROVIDER_IDS = ["ga4", "gsc", "gtm", "google", "meta", "tiktok", "apple", "microsoft", "reddit", "snapchat", "spotify", "pinterest", "linkedin", "x", "openai"];
3006
- var ADPORT_UI_RESOURCE_URIS = [ADPORT_UI_URI, "ui://adport/insight-card-v36.html", "ui://adport/insight-card-v35.html", "ui://adport/insight-card-v34.html", "ui://adport/insight-card-v33.html", "ui://adport/insight-card-v32.html", "ui://adport/insight-card-v31.html", "ui://adport/insight-card-v30.html", "ui://adport/insight-card-v29.html", "ui://adport/insight-card-v28.html", "ui://adport/insight-card-v27.html", "ui://adport/insight-card-v26.html", "ui://adport/insight-card-v25.html", "ui://adport/insight-card-v24.html", "ui://adport/insight-card-v23.html", "ui://adport/insight-card-v22.html", "ui://adport/insight-card-v21.html", "ui://adport/insight-card-v20.html", "ui://adport/insight-card-v19.html", "ui://adport/insight-card-v18.html", "ui://adport/insight-card-v17.html", "ui://adport/insight-card-v16.html", "ui://adport/insight-card-v15.html", "ui://adport/insight-card-v14.html", "ui://adport/insight-card-v13.html", "ui://adport/insight-card-v12.html", "ui://adport/insight-card-v11.html", "ui://adport/insight-card-v10.html", "ui://adport/insight-card-v9.html", "ui://adport/insight-card-v8.html", "ui://adport/insight-card-v7.html", "ui://adport/insight-card-v6.html", "ui://adport/insight-card-v5.html", "ui://adport/insight-card-v4.html", "ui://adport/insight-card-v3.html", "ui://adport/insight-card-v2.html", ADPORT_SUMMARY_UI_URI, "ui://adport/summary-card-v36.html", "ui://adport/summary-card-v35.html", "ui://adport/summary-card-v34.html", "ui://adport/summary-card-v33.html", "ui://adport/summary-card-v32.html", "ui://adport/summary-card-v30.html"];
3123
+ var PROVIDER_IDS = TOOL_PROVIDERS;
3124
+ var uiVersions = Array.from({ length: ADPORT_UI_VERSION - 1 }, (_, i) => ADPORT_UI_VERSION - i);
3125
+ var ADPORT_UI_RESOURCE_URIS = [
3126
+ ...uiVersions.map((v) => `ui://adport/insight-card-v${v}.html`),
3127
+ ...uiVersions.filter((v) => v === 30 || v >= 32).map((v) => `ui://adport/summary-card-v${v}.html`)
3128
+ ];
3007
3129
  var DEFAULT_MCP_ICONS = [{
3008
3130
  src: "https://app.adport.dev/icon.svg?brand=orange-dot-v2",
3009
3131
  mimeType: "image/svg+xml",
@@ -3014,7 +3136,7 @@ async function assembleRuntime(options = {}) {
3014
3136
  const modules = [];
3015
3137
  const includeMock = options.includeMock ?? process.env.ADPORT_DEMO === "true";
3016
3138
  if (!includeMock) {
3017
- for (const factory of [createGa4Module, createGscModule, createGtmModule, createGoogleModule, createMetaModule, createTikTokModule, createAppleModule, createMicrosoftModule, createRedditModule, createSnapchatModule, createSpotifyModule, createPinterestModule, createLinkedInModule, createXModule, createOpenAIModule]) {
3139
+ for (const factory of [createGa4Module, createGscModule, createGtmModule, createGoogleModule, createMetaModule, createTikTokModule, createAppleModule, createMicrosoftModule, createRedditModule, createSnapchatModule, createSpotifyModule, createPinterestModule, createLinkedInModule, createXModule, createOpenAIModule, createMatomoModule, createGravityModule]) {
3018
3140
  const module = await factory(store);
3019
3141
  if (module) modules.push(module);
3020
3142
  }
@@ -3054,7 +3176,7 @@ var hostedWriteOutput = z.looseObject({
3054
3176
  applied: writeOutput.shape.applied,
3055
3177
  preview: z.looseObject(writeOutput.shape.preview.pick({ summary: true, serverValidated: true }).shape),
3056
3178
  pending_operation_id: z.string().optional(),
3057
- expires_at: writeOutput.shape.expires_at.describe("Preview expiration."),
3179
+ expires_at: z.string().optional(),
3058
3180
  result: z.looseObject({}).optional()
3059
3181
  });
3060
3182
  var explicitHostedTitle = /* @__PURE__ */ new Set([
@@ -3122,8 +3244,9 @@ Unavailable on the current plan: ${scopeDenial.message}` : definition.descriptio
3122
3244
  }
3123
3245
  };
3124
3246
  const callback = async (args) => {
3247
+ const platform = tool.namespace === "analytics" ? args.provider : tool.namespace;
3125
3248
  const descriptor = {
3126
- ...PROVIDER_IDS.includes(tool.namespace) ? { provider: tool.namespace } : {},
3249
+ ...typeof platform === "string" && PROVIDER_IDS.includes(platform) ? { provider: platform } : {},
3127
3250
  ...typeof args.account_id === "string" ? { accountId: args.account_id } : {},
3128
3251
  ...tool.pagination ? { pagination: { cursorInput: tool.pagination.cursorInput } } : {}
3129
3252
  };
@@ -3222,4 +3345,4 @@ export {
3222
3345
  createMcpServer,
3223
3346
  runStdioServer
3224
3347
  };
3225
- //# sourceMappingURL=chunk-TEP7TOPQ.js.map
3348
+ //# sourceMappingURL=chunk-U5SWUPMQ.js.map