@apify/actors-mcp-server 0.10.5-beta.4 → 0.10.5-beta.6

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.
@@ -2933,7 +2933,7 @@ Boolean requesting whether a visible border and background is provided by the ho
2933
2933
  - "model": Tool visible to and callable by the agent
2934
2934
  - "app": Tool callable by the app from this server only`)}),Bet=R.object({mimeTypes:R.array(R.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Uet=R.object({method:R.literal("ui/download-file"),params:R.object({contents:R.array(R.union([DI,SI])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),jet=R.object({method:R.literal("ui/message"),params:R.object({role:R.literal("user").describe('Message role, currently only "user" is supported.'),content:R.array(yf).describe("Message content blocks (text, image, etc.).")})}),Het=R.object({method:R.literal("ui/notifications/sandbox-resource-ready"),params:R.object({html:R.string().describe("HTML content to load into the inner iframe."),sandbox:R.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:PC.optional().describe("CSP configuration from resource metadata."),permissions:FC.optional().describe("Sandbox permissions from resource metadata.")})}),HEe=R.object({method:R.literal("ui/notifications/tool-result"),params:bf.describe("Standard MCP tool execution result.")}),XK=R.object({toolInfo:R.object({id:hf.optional().describe("JSON-RPC id of the tools/call request."),tool:Ex.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:TEe.optional().describe("Current color theme preference."),styles:LEe.optional().describe("Style configuration for theming the app."),displayMode:dg.optional().describe("How the UI is currently displayed."),availableDisplayModes:R.array(dg).optional().describe("Display modes the host supports."),containerDimensions:R.union([R.object({height:R.number().describe("Fixed container height in pixels.")}),R.object({maxHeight:R.union([R.number(),R.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(R.union([R.object({width:R.number().describe("Fixed container width in pixels.")}),R.object({maxWidth:R.union([R.number(),R.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
2935
2935
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:R.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:R.string().optional().describe("User's timezone in IANA format."),userAgent:R.string().optional().describe("Host application identifier."),platform:R.union([R.literal("web"),R.literal("desktop"),R.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:R.object({touch:R.boolean().optional().describe("Whether the device supports touch input."),hover:R.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:R.object({top:R.number().describe("Top safe area inset in pixels."),right:R.number().describe("Right safe area inset in pixels."),bottom:R.number().describe("Bottom safe area inset in pixels."),left:R.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),ZEe=R.object({method:R.literal("ui/notifications/host-context-changed"),params:XK.describe("Partial context update containing only changed fields.")}),Zet=R.object({method:R.literal("ui/update-model-context"),params:R.object({content:R.array(yf).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:R.record(R.string(),R.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),Wet=R.object({method:R.literal("ui/initialize"),params:R.object({appInfo:Jh.describe("App identification (name and version)."),appCapabilities:BEe.describe("Features and capabilities this app provides."),protocolVersion:R.string().describe("Protocol version this app supports.")})}),WEe=R.object({protocolVersion:R.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Jh.describe("Host application identification and version."),hostCapabilities:MEe.describe("Features and capabilities provided by the host."),hostContext:XK.describe("Rich context about the host environment.")}).passthrough();var MI=class extends Dx{constructor(n,i={},r={autoResize:!0}){super(r);_r(this,"_appInfo");_r(this,"_capabilities");_r(this,"options");_r(this,"_hostCapabilities");_r(this,"_hostInfo");_r(this,"_hostContext");_r(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=i,this.options=r,this.setRequestHandler(gf,o=>(console.log("Received ping:",o.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(OEe,i=>n(i.params))}set ontoolinputpartial(n){this.setNotificationHandler(REe,i=>n(i.params))}set ontoolresult(n){this.setNotificationHandler(HEe,i=>n(i.params))}set ontoolcancelled(n){this.setNotificationHandler(PEe,i=>n(i.params))}set onhostcontextchanged(n){this.setNotificationHandler(ZEe,i=>{this._hostContext={...this._hostContext,...i.params},n(i.params)})}set onteardown(n){this.setRequestHandler(zEe,(i,r)=>n(i.params,r))}set oncalltool(n){this.setRequestHandler(II,(i,r)=>n(i.params,r))}set onlisttools(n){this.setRequestHandler(TI,(i,r)=>n(i.params,r))}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,i){if(typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},bf,i)}sendMessage(n,i){return this.request({method:"ui/message",params:n},NEe,i)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,i){return this.request({method:"ui/update-model-context",params:n},mx,i)}openLink(n,i){return this.request({method:"ui/open-link",params:n},CEe,i)}downloadFile(n,i){return this.request({method:"ui/download-file",params:n},AEe,i)}requestDisplayMode(n,i){return this.request({method:"ui/request-display-mode",params:n},UEe,i)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,i=0,r=0,o=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let s=document.documentElement,l=s.style.width,d=s.style.height;s.style.width="fit-content",s.style.height="fit-content";let f=s.getBoundingClientRect();s.style.width=l,s.style.height=d;let p=window.innerWidth-s.clientWidth,y=Math.ceil(f.width+p),g=Math.ceil(f.height);(y!==i||g!==r)&&(i=y,r=g,this.sendSizeChanged({width:y,height:g}))}))};o();let a=new ResizeObserver(o);return a.observe(document.documentElement),a.observe(document.body),()=>a.disconnect()}async connect(n=new Cx(window.parent,window.parent),i){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Jke}},WEe,i);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}};function QK({appInfo:e,capabilities:t,onAppCreated:n}){let[i,r]=(0,_f.useState)(null),[o,a]=(0,_f.useState)(!1),[s,l]=(0,_f.useState)(null);return(0,_f.useEffect)(()=>{let d=!0;async function f(){try{let p=new Cx(window.parent,window.parent),y=new MI(e,t);n?.(y),await y.connect(p),d&&(r(y),a(!0),l(null))}catch(p){d&&(r(null),a(!1),l(p instanceof Error?p:Error("Failed to connect")))}}return f(),()=>{d=!1}},[]),{app:i,isConnected:o,error:s}}var iJ=q(Ne(),1),nJ=(0,ta.createContext)(null);function rJ({children:e}){let[t,n]=(0,ta.useState)(null),[i,r]=(0,ta.useState)(),o=(0,ta.useRef)(!1),{app:a}=QK({appInfo:{name:"Apify MCP Widget",version:"1.0.0"},capabilities:{},onAppCreated:s=>{s.ontoolresult=l=>{o.current=!0,n(l)},s.onhostcontextchanged=l=>r(d=>({...d,...l}))}});return(0,ta.useEffect)(()=>{if(a&&(r(a.getHostContext()),!o.current)){let{toolOutput:s}=window.openai??{};s&&n({content:[],structuredContent:s})}},[a]),(0,iJ.jsx)(nJ.Provider,{value:{app:a,toolResult:t,hostContext:i},children:e})}function Gu(){let e=(0,ta.useContext)(nJ);if(!e)throw new Error("useMcpApp must be used within McpAppProvider");return e}var oJ=()=>{let{hostContext:e}=Gu(),t=e?.containerDimensions;return t&&"maxHeight"in t?t.maxHeight??null:t&&"height"in t?t.height:null};function aJ(...e){return e.filter(Boolean).join(" ")}var sJ=q(Ne(),1),LC=({children:e,className:t="",style:n={}})=>{let i=oJ();return(0,sJ.jsx)("div",{className:aJ("flex flex-col gap-6 items-start pb-10 pt-4 px-5 w-full overflow-y-auto",t),style:{fontFamily:"SF Pro, -apple-system, BlinkMacSystemFont, sans-serif",maxHeight:i?`${i}px`:void 0,...n},children:e})};function uJ(e){let{toolResult:t}=Gu(),n=t?.structuredContent??null,i=typeof e=="function"?e():e??null;return n??i}var GEe=q(lJ(),1);var BC=(e,t)=>{let n=new Date(e).getTime(),r=(t?new Date(t).getTime():Date.now())-n,o=Math.floor(r/1e3),a=Math.floor(o/60),s=Math.floor(a/60);return s>0?`${s}h ${a%60}m ${o%60}s`:a>0?`${a}m ${o%60}s`:`${o}s`};var UC=e=>{let t=new Date(e),n=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");return`${n}-${i}-${r} ${o}:${a}`},jC=e=>e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ");var cJ="com.apify/ActorRun";function qEe(e){return e.split(`
2936
- `)[0].trim().replace(/\s*\{[^}]*}\s*\.?$/,"").trim()}function dJ(e){if(!e?.isError)return null;for(let t of e.content){if(typeof t!="object"||t===null||!("text"in t))continue;let n=t.text;if(typeof n=="string"&&n.trim())return qEe(n)||n.trim()}return"Actor run failed before it could start."}var fJ=q(Ne(),1),YEe=op`
2936
+ `)[0].trim().replace(/\s*\{[^}]*}\s*\.?$/,"").trim()}function dJ(e){if(!e?.isError)return null;for(let t of e.content){if(typeof t!="object"||t===null||!("text"in t))continue;let{text:n}=t;if(typeof n=="string"&&n.trim())return qEe(n)||n.trim()}return"Actor run failed before it could start."}var fJ=q(Ne(),1),YEe=op`
2937
2937
  0%, 100% {
2938
2938
  opacity: 1;
2939
2939
  }
@@ -2984,7 +2984,7 @@ container holding the app. Specify either width or maxWidth, and either height o
2984
2984
  &:last-child {
2985
2985
  border-right: none;
2986
2986
  }
2987
- `,pJ=()=>(0,wo.jsx)(JEe,{children:(0,wo.jsxs)(XEe,{children:[(0,wo.jsx)(QEe,{children:(0,wo.jsx)("tr",{children:[0,1,2,3,4].map(e=>(0,wo.jsx)(eDe,{children:(0,wo.jsx)(HC,{style:{width:`${60+e*10}px`,height:"12px"}})},e))})}),(0,wo.jsx)(tDe,{children:[0,1,2,3,4].map(e=>(0,wo.jsx)(nDe,{children:[0,1,2,3,4].map(t=>(0,wo.jsx)(rDe,{children:(0,wo.jsx)(HC,{style:{width:`${70+(e+t)%3*30}px`,height:"14px"}})},t))},e))})]})});var tt=q(Ne(),1),mJ=new Set(["SUCCEEDED","FAILED","ABORTED","TIMED-OUT"]),iDe=e=>new Promise(t=>setTimeout(t,e)),oDe=e=>{switch(e.toUpperCase()){case"SUCCEEDED":return"success";case"FAILED":case"ABORTED":case"TIMED-OUT":return"danger";case"RUNNING":case"READY":return"primary_blue";default:return"neutral"}},aDe=e=>{switch(e.toUpperCase()){case"SUCCEEDED":return Vs;case"FAILED":case"ABORTED":case"TIMED-OUT":return q0;case"RUNNING":case"READY":return S7;default:return}},bJ=e=>{let t=e.split("/");return t.length>1?t[1]:e},xJ=e=>{let t=e.split("/");return t.length>1?t[0]:"unknown"};function sDe(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("runId")?.trim()||null}var hJ=G.div`
2987
+ `,pJ=()=>(0,wo.jsx)(JEe,{children:(0,wo.jsxs)(XEe,{children:[(0,wo.jsx)(QEe,{children:(0,wo.jsx)("tr",{children:[0,1,2,3,4].map(e=>(0,wo.jsx)(eDe,{children:(0,wo.jsx)(HC,{style:{width:`${60+e*10}px`,height:"12px"}})},e))})}),(0,wo.jsx)(tDe,{children:[0,1,2,3,4].map(e=>(0,wo.jsx)(nDe,{children:[0,1,2,3,4].map(t=>(0,wo.jsx)(rDe,{children:(0,wo.jsx)(HC,{style:{width:`${70+(e+t)%3*30}px`,height:"14px"}})},t))},e))})]})});var tt=q(Ne(),1),mJ=new Set(["SUCCEEDED","FAILED","ABORTED","TIMED-OUT"]),iDe=async e=>new Promise(t=>setTimeout(t,e)),oDe=e=>{switch(e.toUpperCase()){case"SUCCEEDED":return"success";case"FAILED":case"ABORTED":case"TIMED-OUT":return"danger";case"RUNNING":case"READY":return"primary_blue";default:return"neutral"}},aDe=e=>{switch(e.toUpperCase()){case"SUCCEEDED":return Vs;case"FAILED":case"ABORTED":case"TIMED-OUT":return q0;case"RUNNING":case"READY":return S7;default:return}},bJ=e=>{let t=e.split("/");return t.length>1?t[1]:e},xJ=e=>{let t=e.split("/");return t.length>1?t[0]:"unknown"};function sDe(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("runId")?.trim()||null}var hJ=G.div`
2988
2988
  display: flex;
2989
2989
  flex-direction: column;
2990
2990
  gap: ${h.space.space8};
@@ -3116,7 +3116,7 @@ container holding the app. Specify either width or maxWidth, and either height o
3116
3116
  ${h.typography.shared.desktop.bodyM};
3117
3117
  color: ${h.color.neutral.text};
3118
3118
  margin: 0;
3119
- `;function _J(e){let t=e?.[cJ]?.usageTotalUsd;return typeof t=="number"?t:void 0}function yJ(e,t){let n=e.startedAt,i=e.finishedAt,r=BC(n,i),o=e.actorName||"Unknown Actor",a=bJ(o),s=jC(a),l=xJ(o),d=_J(t);return{runId:e.runId,actorName:s,actorFullName:o,actorDeveloperUsername:l,status:e.status||"RUNNING",startedAt:n,finishedAt:i,timestamp:UC(n),duration:r,cost:d,stats:e.stats,dataset:e.dataset}}var kJ=()=>{let{app:e,toolResult:t}=Gu(),n=uJ(),i=t?._meta??null,r=sDe(),o=dJ(t),[a,s]=(0,cc.useState)(null),[l,d]=(0,cc.useState)(void 0);if((0,cc.useEffect)(()=>{if(a)return;if(n?.runId){s(yJ(n,i));return}if(!r||!e)return;let g=!1;return(async()=>{try{let _=await e.callServerTool({name:"get-actor-run",arguments:{runId:r}});if(g)return;let S=_?.structuredContent;if(S?.runId){let k=_?._meta;s(yJ(S,k))}}catch(_){g||console.error("[ActorRun] Failed to fetch run by runId:",_)}})(),()=>{g=!0}},[n,a,i,r,e]),(0,cc.useEffect)(()=>{if(!e||!a?.actorFullName||l!==void 0)return;(async()=>{try{let b=await e.callServerTool({name:"fetch-actor-details",arguments:{actor:a.actorFullName}});if(b?.structuredContent){let _=b.structuredContent;if(_.actorInfo){let S=_.actorInfo;d(S.pictureUrl)}}}catch(b){console.error("[ActorRun] Failed to fetch actor details:",b)}})()},[a?.actorFullName,l,e]),(0,cc.useEffect)(()=>{if(!e||!a?.runId)return;let g=(a.status||"").toUpperCase();if(mJ.has(g))return;let b=!1,_=0,S=0,k=E=>{let $=Math.floor(E/2)*5+5;return Math.min($*1e3,6e4)};return(async()=>{for(;!b&&(await iDe(k(_)),!b);)try{let E=await e.callServerTool({name:"get-actor-run",arguments:{runId:a.runId}});if(E.structuredContent){let $=E.structuredContent,z=$.startedAt,A=$.finishedAt,M=BC(z,A),Y=$.actorName||a.actorFullName,oe=bJ(Y),L=jC(oe),ke=xJ(Y),_e=_J(E._meta),me={runId:$.runId,actorName:L,actorFullName:Y,actorDeveloperUsername:ke,status:$.status||"RUNNING",startedAt:z,finishedAt:A,timestamp:UC(z),duration:M,cost:_e,stats:$.stats,dataset:$.dataset};s(me);let he=($.status||"").toUpperCase();if(mJ.has(he)){let Ce=[`Actor run ${a.runId} finished with status: ${he}.`,$.dataset?.datasetId?`Dataset ID: ${$.dataset.datasetId}`:null,$.dataset?.totalItemCount!=null?`Items scraped: ${$.dataset.totalItemCount}`:null].filter(Boolean).join(" ");await e.updateModelContext({content:[{type:"text",text:Ce}]}).catch(()=>{});break}}_++,S=0}catch(E){if(console.error("[Auto-poll] Error:",E),S++,S>=3||E instanceof Error&&(E.message.includes("401")||E.message.includes("Unauthorized")))break}})(),()=>{b=!0}},[a?.runId,a?.status,e]),!a)return(0,tt.jsx)(LC,{children:(0,tt.jsx)(hJ,{children:(0,tt.jsx)(vJ,{children:o?(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(Nu,{variant:"danger",size:"small",LeadingIcon:q0,children:"Failed"}),(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.text},children:o})]}):(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.textMuted},children:"Loading Actor run data ..."})})})});let f=a.dataset?.previewItems.length?Object.keys(a.dataset.previewItems[0]):[],p=()=>{a&&e&&e.openLink({url:`https://console.apify.com/actors/runs/${a.runId}`})},y=()=>{a&&e&&e.openLink({url:`https://apify.com/${a.actorFullName}`})};return(0,tt.jsxs)(LC,{children:[(0,tt.jsxs)(hJ,{children:[(0,tt.jsx)(uDe,{children:(0,tt.jsxs)(xDe,{children:[(0,tt.jsxs)(_De,{children:[(0,tt.jsx)(Tk,{size:20,name:a.actorName,url:l}),(0,tt.jsx)(lDe,{onClick:y,children:a.actorName})]}),(0,tt.jsxs)(kDe,{children:[(0,tt.jsx)(Nu,{variant:oDe(a.status),size:"small",LeadingIcon:aDe(a.status),children:a.status.charAt(0)+a.status.slice(1).toLowerCase()}),(0,tt.jsxs)(cDe,{children:[typeof a.cost=="number"&&(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsxs)(ZC,{type:"body",size:"small",as:"span",children:["$",a.cost.toFixed(3)]}),(0,tt.jsx)(gJ,{children:"|"})]}),(0,tt.jsx)(ZC,{type:"body",size:"small",as:"span",children:a.timestamp}),(0,tt.jsx)(gJ,{children:"|"}),(0,tt.jsx)(ZC,{type:"body",size:"small",as:"span",children:a.duration})]})]})]})}),a.dataset&&a.dataset.previewItems.length>0?(0,tt.jsx)(tt.Fragment,{children:(0,tt.jsxs)(dDe,{children:[(0,tt.jsxs)(pDe,{children:[(0,tt.jsx)(mDe,{children:(0,tt.jsx)("tr",{children:f.map(g=>(0,tt.jsx)(hDe,{children:g.charAt(0).toUpperCase()+g.slice(1)},g))})}),(0,tt.jsx)(gDe,{children:a.dataset.previewItems.map((g,b)=>(0,tt.jsx)(vDe,{children:f.map(_=>(0,tt.jsx)(yDe,{children:g[_]==null?"\u2014":typeof g[_]=="object"?`${Object.keys(g[_]).length} fields`:String(g[_])||"\u2014"},_))},b))})]}),a.dataset.previewItems.length>3&&(0,tt.jsx)(fDe,{})]})}):a.status.toUpperCase()==="RUNNING"?(0,tt.jsx)(pJ,{}):(0,tt.jsx)(vJ,{children:a.status.toUpperCase()==="READY"?(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.textMuted},children:"The Actor is ready to run."}):(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.textMuted},children:"No results available."})}),(0,tt.jsx)(bDe,{children:(0,tt.jsx)(cl,{onClick:p,variant:"secondary",size:"small",children:"View on Apify"})})]}),a.status.toUpperCase()==="SUCCEEDED"&&a&&a.dataset&&a.dataset.totalItemCount>0&&(0,tt.jsxs)(wDe,{children:["The ",a.actorName," found ",a.dataset.totalItemCount," result",a.dataset.totalItemCount!==1?"s":"",". You can visit results via the provided link."]})]})};var EDe=`*, ::before, ::after {
3119
+ `;function _J(e){let t=e?.[cJ]?.usageTotalUsd;return typeof t=="number"?t:void 0}function yJ(e,t){let n=e.startedAt,{finishedAt:i}=e,r=BC(n,i),o=e.actorName||"Unknown Actor",a=bJ(o),s=jC(a),l=xJ(o),d=_J(t);return{runId:e.runId,actorName:s,actorFullName:o,actorDeveloperUsername:l,status:e.status||"RUNNING",startedAt:n,finishedAt:i,timestamp:UC(n),duration:r,cost:d,stats:e.stats,dataset:e.dataset}}var kJ=()=>{let{app:e,toolResult:t}=Gu(),n=uJ(),i=t?._meta??null,r=sDe(),o=dJ(t),[a,s]=(0,cc.useState)(null),[l,d]=(0,cc.useState)(void 0);if((0,cc.useEffect)(()=>{if(a)return;if(n?.runId){s(yJ(n,i));return}if(!r||!e)return;let g=!1;return(async()=>{try{let _=await e.callServerTool({name:"get-actor-run",arguments:{runId:r}});if(g)return;let S=_?.structuredContent;if(S?.runId){let k=_?._meta;s(yJ(S,k))}}catch(_){g||console.error("[ActorRun] Failed to fetch run by runId:",_)}})(),()=>{g=!0}},[n,a,i,r,e]),(0,cc.useEffect)(()=>{if(!e||!a?.actorFullName||l!==void 0)return;(async()=>{try{let b=await e.callServerTool({name:"fetch-actor-details",arguments:{actor:a.actorFullName}});if(b?.structuredContent){let _=b.structuredContent;if(_.actorInfo){let S=_.actorInfo;d(S.pictureUrl)}}}catch(b){console.error("[ActorRun] Failed to fetch actor details:",b)}})()},[a?.actorFullName,l,e]),(0,cc.useEffect)(()=>{if(!e||!a?.runId)return;let g=(a.status||"").toUpperCase();if(mJ.has(g))return;let b=!1,_=0,S=0,k=E=>{let $=Math.floor(E/2)*5+5;return Math.min($*1e3,6e4)};return(async()=>{for(;!b&&(await iDe(k(_)),!b);)try{let E=await e.callServerTool({name:"get-actor-run",arguments:{runId:a.runId}});if(E.structuredContent){let $=E.structuredContent,z=$.startedAt,{finishedAt:A}=$,M=BC(z,A),Y=$.actorName||a.actorFullName,oe=bJ(Y),L=jC(oe),ke=xJ(Y),_e=_J(E._meta),me={runId:$.runId,actorName:L,actorFullName:Y,actorDeveloperUsername:ke,status:$.status||"RUNNING",startedAt:z,finishedAt:A,timestamp:UC(z),duration:M,cost:_e,stats:$.stats,dataset:$.dataset};s(me);let he=($.status||"").toUpperCase();if(mJ.has(he)){let Ce=[`Actor run ${a.runId} finished with status: ${he}.`,$.dataset?.datasetId?`Dataset ID: ${$.dataset.datasetId}`:null,$.dataset?.totalItemCount!=null?`Items scraped: ${$.dataset.totalItemCount}`:null].filter(Boolean).join(" ");await e.updateModelContext({content:[{type:"text",text:Ce}]}).catch(()=>{});break}}_++,S=0}catch(E){if(console.error("[Auto-poll] Error:",E),S++,S>=3||E instanceof Error&&(E.message.includes("401")||E.message.includes("Unauthorized")))break}})(),()=>{b=!0}},[a?.runId,a?.status,e]),!a)return(0,tt.jsx)(LC,{children:(0,tt.jsx)(hJ,{children:(0,tt.jsx)(vJ,{children:o?(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(Nu,{variant:"danger",size:"small",LeadingIcon:q0,children:"Failed"}),(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.text},children:o})]}):(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.textMuted},children:"Loading Actor run data ..."})})})});let f=a.dataset?.previewItems.length?Object.keys(a.dataset.previewItems[0]):[],p=()=>{a&&e&&e.openLink({url:`https://console.apify.com/actors/runs/${a.runId}`})},y=()=>{a&&e&&e.openLink({url:`https://apify.com/${a.actorFullName}`})};return(0,tt.jsxs)(LC,{children:[(0,tt.jsxs)(hJ,{children:[(0,tt.jsx)(uDe,{children:(0,tt.jsxs)(xDe,{children:[(0,tt.jsxs)(_De,{children:[(0,tt.jsx)(Tk,{size:20,name:a.actorName,url:l}),(0,tt.jsx)(lDe,{onClick:y,children:a.actorName})]}),(0,tt.jsxs)(kDe,{children:[(0,tt.jsx)(Nu,{variant:oDe(a.status),size:"small",LeadingIcon:aDe(a.status),children:a.status.charAt(0)+a.status.slice(1).toLowerCase()}),(0,tt.jsxs)(cDe,{children:[typeof a.cost=="number"&&(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsxs)(ZC,{type:"body",size:"small",as:"span",children:["$",a.cost.toFixed(3)]}),(0,tt.jsx)(gJ,{children:"|"})]}),(0,tt.jsx)(ZC,{type:"body",size:"small",as:"span",children:a.timestamp}),(0,tt.jsx)(gJ,{children:"|"}),(0,tt.jsx)(ZC,{type:"body",size:"small",as:"span",children:a.duration})]})]})]})}),a.dataset&&a.dataset.previewItems.length>0?(0,tt.jsx)(tt.Fragment,{children:(0,tt.jsxs)(dDe,{children:[(0,tt.jsxs)(pDe,{children:[(0,tt.jsx)(mDe,{children:(0,tt.jsx)("tr",{children:f.map(g=>(0,tt.jsx)(hDe,{children:g.charAt(0).toUpperCase()+g.slice(1)},g))})}),(0,tt.jsx)(gDe,{children:a.dataset.previewItems.map((g,b)=>(0,tt.jsx)(vDe,{children:f.map(_=>(0,tt.jsx)(yDe,{children:g[_]==null?"\u2014":typeof g[_]=="object"?`${Object.keys(g[_]).length} fields`:String(g[_])||"\u2014"},_))},b))})]}),a.dataset.previewItems.length>3&&(0,tt.jsx)(fDe,{})]})}):a.status.toUpperCase()==="RUNNING"?(0,tt.jsx)(pJ,{}):(0,tt.jsx)(vJ,{children:a.status.toUpperCase()==="READY"?(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.textMuted},children:"The Actor is ready to run."}):(0,tt.jsx)(wt,{type:"body",size:"small",style:{color:h.color.neutral.textMuted},children:"No results available."})}),(0,tt.jsx)(bDe,{children:(0,tt.jsx)(cl,{onClick:p,variant:"secondary",size:"small",children:"View on Apify"})})]}),a.status.toUpperCase()==="SUCCEEDED"&&a&&a.dataset&&a.dataset.totalItemCount>0&&(0,tt.jsxs)(wDe,{children:["The ",a.actorName," found ",a.dataset.totalItemCount," result",a.dataset.totalItemCount!==1?"s":"",". You can visit results via the provided link."]})]})};var EDe=`*, ::before, ::after {
3120
3120
  --tw-border-spacing-x: 0;
3121
3121
  --tw-border-spacing-y: 0;
3122
3122
  --tw-translate-x: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/actors-mcp-server",
3
- "version": "0.10.5-beta.4",
3
+ "version": "0.10.5-beta.6",
4
4
  "type": "module",
5
5
  "description": "Apify MCP Server",
6
6
  "mcpName": "com.apify/apify-mcp-server",
@@ -60,9 +60,9 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@ai-sdk/openai": "^3.0.52",
63
- "@apify/eslint-config": "^1.1.0",
64
63
  "@apify/mcpc": "^0.2.0",
65
- "@apify/tsconfig": "^0.1.0",
64
+ "@apify/oxlint-config": "^0.2.10",
65
+ "@apify/tsconfig": "^0.1.2",
66
66
  "@arizeai/phoenix-client": "^6.6.0",
67
67
  "@arizeai/phoenix-evals": "^1.0.2",
68
68
  "@sentry/cli": "^3.2.0",
@@ -70,13 +70,13 @@
70
70
  "@types/to-json-schema": "^0.2.4",
71
71
  "@types/yargs": "^17.0.33",
72
72
  "@types/yargs-parser": "^21.0.3",
73
- "eslint": "^9.19.0",
74
73
  "eventsource": "^3.0.2",
75
74
  "openai": "^6.10.0",
75
+ "oxlint": "^1.64.0",
76
+ "oxlint-tsgolint": "0.22.1",
76
77
  "p-limit": "^7.3.0",
77
78
  "tsx": "^4.20.6",
78
79
  "typescript": "^5.3.3",
79
- "typescript-eslint": "^8.23.0",
80
80
  "vitest": "^3.0.8"
81
81
  },
82
82
  "scripts": {
@@ -88,8 +88,8 @@
88
88
  "build:web": "npm --prefix src/web install && npm --prefix src/web run build",
89
89
  "postbuild": "mkdir -p dist/web && (cp -r src/web/dist dist/web/ 2>/dev/null || :)",
90
90
  "clean": "tsc -b src --clean && rm -rf dist/web",
91
- "lint": "eslint .",
92
- "lint:fix": "eslint . --fix",
91
+ "lint": "oxlint .",
92
+ "lint:fix": "oxlint . --fix",
93
93
  "type-check": "tsc -p tsconfig.json --noEmit",
94
94
  "typecheck": "npm run type-check",
95
95
  "check": "npm run type-check && npm run lint",