@uipath/api-workflow-runtime 13.9.2 → 13.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/api-workflow-runtime.js +3 -3
- package/package.json +1 -1
- package/sbom.cdx.json +18 -18
package/THIRD-PARTY-NOTICES.txt
CHANGED
package/api-workflow-runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @uipath/api-workflow-runtime v13.
|
|
1
|
+
// @uipath/api-workflow-runtime v13.10.0 (9b69501d)
|
|
2
2
|
var hj=Object.create;var ev=Object.defineProperty;var _j=Object.getOwnPropertyDescriptor;var mj=Object.getOwnPropertyNames;var vj=Object.getPrototypeOf,yj=Object.prototype.hasOwnProperty;import{createRequire as __deno_internal_createRequire} from "node:module";var Ue=__deno_internal_createRequire(import.meta.url);var Pe=(o,t)=>()=>(o&&(t=o(o=0)),t);var O=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),tv=(o,t)=>{for(var r in t)ev(o,r,{get:t[r],enumerable:!0})},bj=(o,t,r,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of mj(t))!yj.call(o,n)&&n!==r&&ev(o,n,{get:()=>t[n],enumerable:!(e=_j(t,n))||e.enumerable});return o};var Ke=(o,t,r)=>(r=o!=null?hj(vj(o)):{},bj(1 ?ev(r,"default",{value:o,enumerable:!0}):r,o));var i0=O(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0})});var a0=O(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.ActivityType=void 0;var s0;(function(o){o.HttpRequest="HttpRequest",o.IntSvcApiRequest="IntSvcApiRequest",o.IntSvcEventRequest="IntSvcEventRequest",o.ScriptExecution="ScriptExecution",o.LogMessage="LogMessage"})(s0||(xu.ActivityType=s0={}))});var rv=O(io=>{"use strict";var gj=io&&io.__createBinding||(Object.create?function(o,t,r,e){e===void 0&&(e=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(o,e,n)}:function(o,t,r,e){e===void 0&&(e=r),o[e]=t[r]}),c0=io&&io.__exportStar||function(o,t){for(var r in o)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&gj(t,o,r)};Object.defineProperty(io,"__esModule",{value:!0});c0(i0(),io);c0(a0(),io)});var u0=O(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.isBlobFileReference=wj;Mu.getAttachmentEncoding=Ej;function wj(o){if(!o||typeof o!="object")return!1;let t=o;return typeof t.ID=="string"&&t.ID.length>0&&typeof t.FullName=="string"&&t.FullName.length>0&&typeof t.MimeType=="string"&&t.MimeType.length>0}function Ej(o){return o.Metadata?.Encoding==="base64"?"base64":"byte-array"}});var l0=O(nv=>{"use strict";Object.defineProperty(nv,"__esModule",{value:!0});nv.isWorkflowFile=Tj;function Tj(o){if(!o||typeof o!="object")return!1;let t=o;return typeof t.name=="string"&&typeof t.mimeType=="string"&&typeof t.size=="number"&&t.content instanceof Uint8Array}});var f0=O(so=>{"use strict";var Sj=so&&so.__createBinding||(Object.create?function(o,t,r,e){e===void 0&&(e=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(o,e,n)}:function(o,t,r,e){e===void 0&&(e=r),o[e]=t[r]}),d0=so&&so.__exportStar||function(o,t){for(var r in o)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Sj(t,o,r)};Object.defineProperty(so,"__esModule",{value:!0});d0(u0(),so);d0(l0(),so)});var fi=O(ao=>{"use strict";var Oj=ao&&ao.__createBinding||(Object.create?function(o,t,r,e){e===void 0&&(e=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(o,e,n)}:function(o,t,r,e){e===void 0&&(e=r),o[e]=t[r]}),p0=ao&&ao.__exportStar||function(o,t){for(var r in o)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Oj(t,o,r)};Object.defineProperty(ao,"__esModule",{value:!0});p0(rv(),ao);p0(f0(),ao)});var pi=O(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.ActivityBase=void 0;var ov=class{constructor(t){this.logger=t}};Cu.ActivityBase=ov});var Wa=O(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.getNewGuid=kj;ls.getErrorMessage=Pj;ls.isError=h0;ls.hasProperty=Aj;function kj(){return crypto.randomUUID()}function Pj(o){try{return h0(o)?o.message:o?typeof o=="object"?JSON.stringify(o):String(o):"Unknown Error"}catch{return console.error("Error getting error message - circular reference or stringify failed"),"Unknown Error"}}function h0(o){return o?typeof o=="object"&&"message"in o&&"name"in o:!1}function Aj(o,t){return o!=null&&typeof o=="object"&&t in o}});var m0=O((BZ,_0)=>{"use strict";_0.exports=Rj;function Rj(o={}){let{ERR_PATHS_MUST_BE_STRINGS:t=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=e=>`fast-redact \u2013 Invalid path (${e})`}=o;return function({paths:n}){n.forEach(i=>{if(typeof i!="string")throw Error(t());try{if(/〇/.test(i))throw Error();let s=(i[0]==="["?"":".")+i.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(s)||/\/\*/.test(s))throw Error();Function(`
|
|
3
3
|
'use strict'
|
|
4
4
|
const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
|
|
@@ -983,7 +983,7 @@ ${a.Data}`)}}static createRemoteError(a,l){return l.Type==="System.TimeoutExcept
|
|
|
983
983
|
\r
|
|
984
984
|
`+P)}function g(w,T,P,k,I){if(w.listenerCount("wsClientError")){let x=new Error(I);Error.captureStackTrace(x,g),w.emit("wsClientError",x,P,T)}else b(P,k,I)}r.exports=class extends i{constructor(w,T){if(super(),(w={maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d,...w}).port==null&&!w.server&&!w.noServer||w.port!=null&&(w.server||w.noServer)||w.server&&w.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(w.port!=null?(this._server=s.createServer((P,k)=>{let I=s.STATUS_CODES[426];k.writeHead(426,{"Content-Length":I.length,"Content-Type":"text/plain"}),k.end(I)}),this._server.listen(w.port,w.host,w.backlog,T)):w.server&&(this._server=w.server),this._server){let P=this.emit.bind(this,"connection");this._removeListeners=function(k,I){for(let x of Object.keys(I))k.on(x,I[x]);return function(){for(let x of Object.keys(I))k.removeListener(x,I[x])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(k,I,x)=>{this.handleUpgrade(k,I,x,P)}})}w.perMessageDeflate===!0&&(w.perMessageDeflate={}),w.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=w,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(w){if(this._state===2)return w&&this.once("close",()=>{w(new Error("The server is not running"))}),void process.nextTick(m,this);if(w&&this.once("close",w),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(m,this);else{let T=this._server;this._removeListeners(),this._removeListeners=this._server=null,T.close(()=>{m(this)})}}shouldHandle(w){if(this.options.path){let T=w.url.indexOf("?");if((T!==-1?w.url.slice(0,T):w.url)!==this.options.path)return!1}return!0}handleUpgrade(w,T,P,k){T.on("error",v);let I=w.headers["sec-websocket-key"],x=+w.headers["sec-websocket-version"];if(w.method!=="GET")return void g(this,w,T,405,"Invalid HTTP method");if(w.headers.upgrade.toLowerCase()!=="websocket")return void g(this,w,T,400,"Invalid Upgrade header");if(!I||!_.test(I))return void g(this,w,T,400,"Missing or invalid Sec-WebSocket-Key header");if(x!==8&&x!==13)return void g(this,w,T,400,"Missing or invalid Sec-WebSocket-Version header");if(!this.shouldHandle(w))return void b(T,400);let C=w.headers["sec-websocket-protocol"],j=new Set;if(C!==void 0)try{j=l.parse(C)}catch{return void g(this,w,T,400,"Invalid Sec-WebSocket-Protocol header")}let L=w.headers["sec-websocket-extensions"],D={};if(this.options.perMessageDeflate&&L!==void 0){let F=new a(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let q=u.parse(L);q[a.extensionName]&&(F.accept(q[a.extensionName]),D[a.extensionName]=F)}catch{return void g(this,w,T,400,"Invalid or unacceptable Sec-WebSocket-Extensions header")}}if(this.options.verifyClient){let F={origin:w.headers[x===8?"sec-websocket-origin":"origin"],secure:!(!w.socket.authorized&&!w.socket.encrypted),req:w};if(this.options.verifyClient.length===2)return void this.options.verifyClient(F,(q,z,Y,se)=>{if(!q)return b(T,z||401,Y,se);this.completeUpgrade(D,I,j,w,T,P,k)});if(!this.options.verifyClient(F))return b(T,401)}this.completeUpgrade(D,I,j,w,T,P,k)}completeUpgrade(w,T,P,k,I,x,C){if(!I.readable||!I.writable)return I.destroy();if(I[h])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return b(I,503);let j=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${c("sha1").update(T+f).digest("base64")}`],L=new this.options.WebSocket(null);if(P.size){let D=this.options.handleProtocols?this.options.handleProtocols(P,k):P.values().next().value;D&&(j.push(`Sec-WebSocket-Protocol: ${D}`),L._protocol=D)}if(w[a.extensionName]){let D=w[a.extensionName].params,F=u.format({[a.extensionName]:[D]});j.push(`Sec-WebSocket-Extensions: ${F}`),L._extensions=w}this.emit("headers",j,k),I.write(j.concat(`\r
|
|
985
985
|
`).join(`\r
|
|
986
|
-
`)),I.removeListener("error",v),L.setSocket(I,x,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(L),L.on("close",()=>{this.clients.delete(L),this._shouldEmitClose&&!this.clients.size&&process.nextTick(m,this)})),C(L,k)}}},5144:(r,e,n)=>{"use strict";let i=n(467),s=n(1256),c=n(3755),u=n(5256),a=n(192),{randomBytes:l,createHash:d}=n(7968),{Readable:f}=n(8378),{URL:h}=n(8716),_=n(516),m=n(6804),v=n(957),{BINARY_TYPES:b,EMPTY_BUFFER:g,GUID:w,kForOnEventAttribute:T,kListener:P,kStatusCode:k,kWebSocket:I,NOOP:x}=n(5820),{EventTarget:{addEventListener:C,removeEventListener:j}}=n(2584),{format:L,parse:D}=n(1056),{toBuffer:F}=n(3092),q=Symbol("kAborted"),z=[8,13],Y=["CONNECTING","OPEN","CLOSING","CLOSED"],se=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class Q extends i{constructor(B,X,ce){super(),this._binaryType=b[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=g,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=Q.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,B!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,X===void 0?X=[]:Array.isArray(X)||(typeof X=="object"&&X!==null?(ce=X,X=[]):X=[X]),he(this,B,X,ce)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(B){b.includes(B)&&(this._binaryType=B,this._receiver&&(this._receiver._binaryType=B))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(B,X,ce){let oe=new m({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:ce.maxPayload,skipUTF8Validation:ce.skipUTF8Validation});this._sender=new v(B,this._extensions,ce.generateMask),this._receiver=oe,this._socket=B,oe[I]=this,B[I]=this,oe.on("conclude",ti),oe.on("drain",cr),oe.on("error",Zr),oe.on("message",H),oe.on("ping",J),oe.on("pong",ne),B.setTimeout(0),B.setNoDelay(),X.length>0&&B.unshift(X),B.on("close",Ee),B.on("data",fe),B.on("end",Z),B.on("error",ae),this._readyState=Q.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=Q.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[_.extensionName]&&this._extensions[_.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=Q.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(B,X){if(this.readyState!==Q.CLOSED){if(this.readyState===Q.CONNECTING)return G(this,this._req,"WebSocket was closed before the connection was established");this.readyState!==Q.CLOSING?(this._readyState=Q.CLOSING,this._sender.close(B,X,!this._isServer,ce=>{ce||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==Q.CONNECTING&&this.readyState!==Q.CLOSED&&(this._paused=!0,this._socket.pause())}ping(B,X,ce){if(this.readyState===Q.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");typeof B=="function"?(ce=B,B=X=void 0):typeof X=="function"&&(ce=X,X=void 0),typeof B=="number"&&(B=B.toString()),this.readyState===Q.OPEN?(X===void 0&&(X=!this._isServer),this._sender.ping(B||g,X,ce)):Lt(this,B,ce)}pong(B,X,ce){if(this.readyState===Q.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");typeof B=="function"?(ce=B,B=X=void 0):typeof X=="function"&&(ce=X,X=void 0),typeof B=="number"&&(B=B.toString()),this.readyState===Q.OPEN?(X===void 0&&(X=!this._isServer),this._sender.pong(B||g,X,ce)):Lt(this,B,ce)}resume(){this.readyState!==Q.CONNECTING&&this.readyState!==Q.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(B,X,ce){if(this.readyState===Q.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof X=="function"&&(ce=X,X={}),typeof B=="number"&&(B=B.toString()),this.readyState!==Q.OPEN)return void Lt(this,B,ce);let oe={binary:typeof B!="string",mask:!this._isServer,compress:!0,fin:!0,...X};this._extensions[_.extensionName]||(oe.compress=!1),this._sender.send(B||g,oe,ce)}terminate(){if(this.readyState!==Q.CLOSED){if(this.readyState===Q.CONNECTING)return G(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=Q.CLOSING,this._socket.destroy())}}}function he(N,B,X,ce){let oe={protocolVersion:z[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...ce,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!z.includes(oe.protocolVersion))throw new RangeError(`Unsupported protocol version: ${oe.protocolVersion} (supported versions: ${z.join(", ")})`);let ze;if(B instanceof h)ze=B,N._url=B.href;else{try{ze=new h(B)}catch{throw new SyntaxError(`Invalid URL: ${B}`)}N._url=B}let He=ze.protocol==="wss:",en=ze.protocol==="ws+unix:",ur;if(ze.protocol==="ws:"||He||en?en&&!ze.pathname?ur="The URL's pathname is empty":ze.hash&&(ur="The URL contains a fragment identifier"):ur=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`,ur){let Te=new SyntaxError(ur);if(N._redirects===0)throw Te;return void te(N,Te)}let bt=He?443:80,me=l(16).toString("base64"),Ar=He?s.request:c.request,lr=new Set,tn,et;if(oe.createConnection=He?st:$e,oe.defaultPort=oe.defaultPort||bt,oe.port=ze.port||bt,oe.host=ze.hostname.startsWith("[")?ze.hostname.slice(1,-1):ze.hostname,oe.headers={...oe.headers,"Sec-WebSocket-Version":oe.protocolVersion,"Sec-WebSocket-Key":me,Connection:"Upgrade",Upgrade:"websocket"},oe.path=ze.pathname+ze.search,oe.timeout=oe.handshakeTimeout,oe.perMessageDeflate&&(tn=new _(oe.perMessageDeflate!==!0?oe.perMessageDeflate:{},!1,oe.maxPayload),oe.headers["Sec-WebSocket-Extensions"]=L({[_.extensionName]:tn.offer()})),X.length){for(let Te of X){if(typeof Te!="string"||!se.test(Te)||lr.has(Te))throw new SyntaxError("An invalid or duplicated subprotocol was specified");lr.add(Te)}oe.headers["Sec-WebSocket-Protocol"]=X.join(",")}if(oe.origin&&(oe.protocolVersion<13?oe.headers["Sec-WebSocket-Origin"]=oe.origin:oe.headers.Origin=oe.origin),(ze.username||ze.password)&&(oe.auth=`${ze.username}:${ze.password}`),en){let Te=oe.path.split(":");oe.socketPath=Te[0],oe.path=Te[1]}if(oe.followRedirects){if(N._redirects===0){N._originalIpc=en,N._originalSecure=He,N._originalHostOrSocketPath=en?oe.socketPath:ze.host;let Te=ce&&ce.headers;if(ce={...ce,headers:{}},Te)for(let[at,Ze]of Object.entries(Te))ce.headers[at.toLowerCase()]=Ze}else if(N.listenerCount("redirect")===0){let Te=en?!!N._originalIpc&&oe.socketPath===N._originalHostOrSocketPath:!N._originalIpc&&ze.host===N._originalHostOrSocketPath;(!Te||N._originalSecure&&!He)&&(delete oe.headers.authorization,delete oe.headers.cookie,Te||delete oe.headers.host,oe.auth=void 0)}oe.auth&&!ce.headers.authorization&&(ce.headers.authorization="Basic "+Buffer.from(oe.auth).toString("base64")),et=N._req=Ar(oe),N._redirects&&N.emit("redirect",N.url,et)}else et=N._req=Ar(oe);oe.timeout&&et.on("timeout",()=>{G(N,et,"Opening handshake has timed out")}),et.on("error",Te=>{et===null||et[q]||(et=N._req=null,te(N,Te))}),et.on("response",Te=>{let at=Te.headers.location,Ze=Te.statusCode;if(at&&oe.followRedirects&&Ze>=300&&Ze<400){if(++N._redirects>oe.maxRedirects)return void G(N,et,"Maximum redirects exceeded");let Pn;et.abort();try{Pn=new h(at,B)}catch{let Ft=new SyntaxError(`Invalid URL: ${at}`);return void te(N,Ft)}he(N,Pn,X,ce)}else N.emit("unexpected-response",et,Te)||G(N,et,`Unexpected server response: ${Te.statusCode}`)}),et.on("upgrade",(Te,at,Ze)=>{if(N.emit("upgrade",Te),N.readyState!==Q.CONNECTING)return;if(et=N._req=null,Te.headers.upgrade.toLowerCase()!=="websocket")return void G(N,at,"Invalid Upgrade header");let Pn=d("sha1").update(me+w).digest("base64");if(Te.headers["sec-websocket-accept"]!==Pn)return void G(N,at,"Invalid Sec-WebSocket-Accept header");let Rr=Te.headers["sec-websocket-protocol"],Ft;if(Rr!==void 0?lr.size?lr.has(Rr)||(Ft="Server sent an invalid subprotocol"):Ft="Server sent a subprotocol but none was requested":lr.size&&(Ft="Server sent no subprotocol"),Ft)return void G(N,at,Ft);Rr&&(N._protocol=Rr);let Ce=Te.headers["sec-websocket-extensions"];if(Ce!==void 0){if(!tn)return void G(N,at,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");let Zn;try{Zn=D(Ce)}catch{return void G(N,at,"Invalid Sec-WebSocket-Extensions header")}let ri=Object.keys(Zn);if(ri.length!==1||ri[0]!==_.extensionName)return void G(N,at,"Server indicated an extension that was not requested");try{tn.accept(Zn[_.extensionName])}catch{return void G(N,at,"Invalid Sec-WebSocket-Extensions header")}N._extensions[_.extensionName]=tn}N.setSocket(at,Ze,{generateMask:oe.generateMask,maxPayload:oe.maxPayload,skipUTF8Validation:oe.skipUTF8Validation})}),et.end()}function te(N,B){N._readyState=Q.CLOSING,N.emit("error",B),N.emitClose()}function $e(N){return N.path=N.socketPath,u.connect(N)}function st(N){return N.path=void 0,N.servername||N.servername===""||(N.servername=u.isIP(N.host)?"":N.host),a.connect(N)}function G(N,B,X){N._readyState=Q.CLOSING;let ce=new Error(X);Error.captureStackTrace(ce,G),B.setHeader?(B[q]=!0,B.abort(),B.socket&&!B.socket.destroyed&&B.socket.destroy(),process.nextTick(te,N,ce)):(B.destroy(ce),B.once("error",N.emit.bind(N,"error")),B.once("close",N.emitClose.bind(N)))}function Lt(N,B,X){if(B){let ce=F(B).length;N._socket?N._sender._bufferedBytes+=ce:N._bufferedAmount+=ce}X&&X(new Error(`WebSocket is not open: readyState ${N.readyState} (${Y[N.readyState]})`))}function ti(N,B){let X=this[I];X._closeFrameReceived=!0,X._closeMessage=B,X._closeCode=N,X._socket[I]!==void 0&&(X._socket.removeListener("data",fe),process.nextTick(_e,X._socket),N===1005?X.close():X.close(N,B))}function cr(){let N=this[I];N.isPaused||N._socket.resume()}function Zr(N){let B=this[I];B._socket[I]!==void 0&&(B._socket.removeListener("data",fe),process.nextTick(_e,B._socket),B.close(N[k])),B.emit("error",N)}function $(){this[I].emitClose()}function H(N,B){this[I].emit("message",N,B)}function J(N){let B=this[I];B.pong(N,!B._isServer,x),B.emit("ping",N)}function ne(N){this[I].emit("pong",N)}function _e(N){N.resume()}function Ee(){let N=this[I],B;this.removeListener("close",Ee),this.removeListener("data",fe),this.removeListener("end",Z),N._readyState=Q.CLOSING,this._readableState.endEmitted||N._closeFrameReceived||N._receiver._writableState.errorEmitted||(B=N._socket.read())===null||N._receiver.write(B),N._receiver.end(),this[I]=void 0,clearTimeout(N._closeTimer),N._receiver._writableState.finished||N._receiver._writableState.errorEmitted?N.emitClose():(N._receiver.on("error",$),N._receiver.on("finish",$))}function fe(N){this[I]._receiver.write(N)||this.pause()}function Z(){let N=this[I];N._readyState=Q.CLOSING,N._receiver.end(),this.end()}function ae(){let N=this[I];this.removeListener("error",ae),this.on("error",x),N&&(N._readyState=Q.CLOSING,this.destroy())}Object.defineProperty(Q,"CONNECTING",{enumerable:!0,value:Y.indexOf("CONNECTING")}),Object.defineProperty(Q.prototype,"CONNECTING",{enumerable:!0,value:Y.indexOf("CONNECTING")}),Object.defineProperty(Q,"OPEN",{enumerable:!0,value:Y.indexOf("OPEN")}),Object.defineProperty(Q.prototype,"OPEN",{enumerable:!0,value:Y.indexOf("OPEN")}),Object.defineProperty(Q,"CLOSING",{enumerable:!0,value:Y.indexOf("CLOSING")}),Object.defineProperty(Q.prototype,"CLOSING",{enumerable:!0,value:Y.indexOf("CLOSING")}),Object.defineProperty(Q,"CLOSED",{enumerable:!0,value:Y.indexOf("CLOSED")}),Object.defineProperty(Q.prototype,"CLOSED",{enumerable:!0,value:Y.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(N=>{Object.defineProperty(Q.prototype,N,{enumerable:!0})}),["open","error","close","message"].forEach(N=>{Object.defineProperty(Q.prototype,`on${N}`,{enumerable:!0,get(){for(let B of this.listeners(N))if(B[T])return B[P];return null},set(B){for(let X of this.listeners(N))if(X[T]){this.removeListener(N,X);break}typeof B=="function"&&this.addEventListener(N,B,{[T]:!0})}})}),Q.prototype.addEventListener=C,Q.prototype.removeEventListener=j,r.exports=Q},7968:r=>{"use strict";r.exports=Ue("node:crypto")},467:r=>{"use strict";r.exports=Ue("node:events")},2058:r=>{"use strict";r.exports=Ue("node:fs")},3755:r=>{"use strict";r.exports=Ue("node:http")},1256:r=>{"use strict";r.exports=Ue("node:https")},5256:r=>{"use strict";r.exports=Ue("node:net")},8558:r=>{"use strict";r.exports=Ue("node:os")},7072:r=>{"use strict";r.exports=Ue("node:path")},8378:r=>{"use strict";r.exports=Ue("node:stream")},192:r=>{"use strict";r.exports=Ue("node:tls")},8716:r=>{"use strict";r.exports=Ue("node:url")},592:r=>{"use strict";r.exports=Ue("node:zlib")}},t={},function r(e){var n=t[e];if(n!==void 0)return n.exports;var i=t[e]={exports:{}};return o[e].call(i.exports,i,i.exports,r),i.exports}(4856);var o,t})});var B_=Ke(Oe()),Qr=Ke(ir());import{readFile as pZ}from"node:fs/promises";import{basename as AM,dirname as hZ,join as Mw,resolve as _Z}from"node:path";var LX="13.9.2" ,FX="848078f9" ,qX="@uipath/api-workflow-runtime",ux=(o,t)=>/^__[A-Z_]+__$/.test(o)?t:o,lx={version:ux(LX,"0.0.0-dev"),commit:ux(FX,"local")};function dx(){return`${qX} v${lx.version} (${lx.commit})`}var f_=Ke(ir());var hx=Ke(ir());import{Worker as WX}from"node:worker_threads";var UX=typeof globalThis.Deno<"u",$X=`
|
|
986
|
+
`)),I.removeListener("error",v),L.setSocket(I,x,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(L),L.on("close",()=>{this.clients.delete(L),this._shouldEmitClose&&!this.clients.size&&process.nextTick(m,this)})),C(L,k)}}},5144:(r,e,n)=>{"use strict";let i=n(467),s=n(1256),c=n(3755),u=n(5256),a=n(192),{randomBytes:l,createHash:d}=n(7968),{Readable:f}=n(8378),{URL:h}=n(8716),_=n(516),m=n(6804),v=n(957),{BINARY_TYPES:b,EMPTY_BUFFER:g,GUID:w,kForOnEventAttribute:T,kListener:P,kStatusCode:k,kWebSocket:I,NOOP:x}=n(5820),{EventTarget:{addEventListener:C,removeEventListener:j}}=n(2584),{format:L,parse:D}=n(1056),{toBuffer:F}=n(3092),q=Symbol("kAborted"),z=[8,13],Y=["CONNECTING","OPEN","CLOSING","CLOSED"],se=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class Q extends i{constructor(B,X,ce){super(),this._binaryType=b[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=g,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=Q.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,B!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,X===void 0?X=[]:Array.isArray(X)||(typeof X=="object"&&X!==null?(ce=X,X=[]):X=[X]),he(this,B,X,ce)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(B){b.includes(B)&&(this._binaryType=B,this._receiver&&(this._receiver._binaryType=B))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(B,X,ce){let oe=new m({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:ce.maxPayload,skipUTF8Validation:ce.skipUTF8Validation});this._sender=new v(B,this._extensions,ce.generateMask),this._receiver=oe,this._socket=B,oe[I]=this,B[I]=this,oe.on("conclude",ti),oe.on("drain",cr),oe.on("error",Zr),oe.on("message",H),oe.on("ping",J),oe.on("pong",ne),B.setTimeout(0),B.setNoDelay(),X.length>0&&B.unshift(X),B.on("close",Ee),B.on("data",fe),B.on("end",Z),B.on("error",ae),this._readyState=Q.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=Q.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[_.extensionName]&&this._extensions[_.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=Q.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(B,X){if(this.readyState!==Q.CLOSED){if(this.readyState===Q.CONNECTING)return G(this,this._req,"WebSocket was closed before the connection was established");this.readyState!==Q.CLOSING?(this._readyState=Q.CLOSING,this._sender.close(B,X,!this._isServer,ce=>{ce||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==Q.CONNECTING&&this.readyState!==Q.CLOSED&&(this._paused=!0,this._socket.pause())}ping(B,X,ce){if(this.readyState===Q.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");typeof B=="function"?(ce=B,B=X=void 0):typeof X=="function"&&(ce=X,X=void 0),typeof B=="number"&&(B=B.toString()),this.readyState===Q.OPEN?(X===void 0&&(X=!this._isServer),this._sender.ping(B||g,X,ce)):Lt(this,B,ce)}pong(B,X,ce){if(this.readyState===Q.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");typeof B=="function"?(ce=B,B=X=void 0):typeof X=="function"&&(ce=X,X=void 0),typeof B=="number"&&(B=B.toString()),this.readyState===Q.OPEN?(X===void 0&&(X=!this._isServer),this._sender.pong(B||g,X,ce)):Lt(this,B,ce)}resume(){this.readyState!==Q.CONNECTING&&this.readyState!==Q.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(B,X,ce){if(this.readyState===Q.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof X=="function"&&(ce=X,X={}),typeof B=="number"&&(B=B.toString()),this.readyState!==Q.OPEN)return void Lt(this,B,ce);let oe={binary:typeof B!="string",mask:!this._isServer,compress:!0,fin:!0,...X};this._extensions[_.extensionName]||(oe.compress=!1),this._sender.send(B||g,oe,ce)}terminate(){if(this.readyState!==Q.CLOSED){if(this.readyState===Q.CONNECTING)return G(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=Q.CLOSING,this._socket.destroy())}}}function he(N,B,X,ce){let oe={protocolVersion:z[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...ce,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!z.includes(oe.protocolVersion))throw new RangeError(`Unsupported protocol version: ${oe.protocolVersion} (supported versions: ${z.join(", ")})`);let ze;if(B instanceof h)ze=B,N._url=B.href;else{try{ze=new h(B)}catch{throw new SyntaxError(`Invalid URL: ${B}`)}N._url=B}let He=ze.protocol==="wss:",en=ze.protocol==="ws+unix:",ur;if(ze.protocol==="ws:"||He||en?en&&!ze.pathname?ur="The URL's pathname is empty":ze.hash&&(ur="The URL contains a fragment identifier"):ur=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`,ur){let Te=new SyntaxError(ur);if(N._redirects===0)throw Te;return void te(N,Te)}let bt=He?443:80,me=l(16).toString("base64"),Ar=He?s.request:c.request,lr=new Set,tn,et;if(oe.createConnection=He?st:$e,oe.defaultPort=oe.defaultPort||bt,oe.port=ze.port||bt,oe.host=ze.hostname.startsWith("[")?ze.hostname.slice(1,-1):ze.hostname,oe.headers={...oe.headers,"Sec-WebSocket-Version":oe.protocolVersion,"Sec-WebSocket-Key":me,Connection:"Upgrade",Upgrade:"websocket"},oe.path=ze.pathname+ze.search,oe.timeout=oe.handshakeTimeout,oe.perMessageDeflate&&(tn=new _(oe.perMessageDeflate!==!0?oe.perMessageDeflate:{},!1,oe.maxPayload),oe.headers["Sec-WebSocket-Extensions"]=L({[_.extensionName]:tn.offer()})),X.length){for(let Te of X){if(typeof Te!="string"||!se.test(Te)||lr.has(Te))throw new SyntaxError("An invalid or duplicated subprotocol was specified");lr.add(Te)}oe.headers["Sec-WebSocket-Protocol"]=X.join(",")}if(oe.origin&&(oe.protocolVersion<13?oe.headers["Sec-WebSocket-Origin"]=oe.origin:oe.headers.Origin=oe.origin),(ze.username||ze.password)&&(oe.auth=`${ze.username}:${ze.password}`),en){let Te=oe.path.split(":");oe.socketPath=Te[0],oe.path=Te[1]}if(oe.followRedirects){if(N._redirects===0){N._originalIpc=en,N._originalSecure=He,N._originalHostOrSocketPath=en?oe.socketPath:ze.host;let Te=ce&&ce.headers;if(ce={...ce,headers:{}},Te)for(let[at,Ze]of Object.entries(Te))ce.headers[at.toLowerCase()]=Ze}else if(N.listenerCount("redirect")===0){let Te=en?!!N._originalIpc&&oe.socketPath===N._originalHostOrSocketPath:!N._originalIpc&&ze.host===N._originalHostOrSocketPath;(!Te||N._originalSecure&&!He)&&(delete oe.headers.authorization,delete oe.headers.cookie,Te||delete oe.headers.host,oe.auth=void 0)}oe.auth&&!ce.headers.authorization&&(ce.headers.authorization="Basic "+Buffer.from(oe.auth).toString("base64")),et=N._req=Ar(oe),N._redirects&&N.emit("redirect",N.url,et)}else et=N._req=Ar(oe);oe.timeout&&et.on("timeout",()=>{G(N,et,"Opening handshake has timed out")}),et.on("error",Te=>{et===null||et[q]||(et=N._req=null,te(N,Te))}),et.on("response",Te=>{let at=Te.headers.location,Ze=Te.statusCode;if(at&&oe.followRedirects&&Ze>=300&&Ze<400){if(++N._redirects>oe.maxRedirects)return void G(N,et,"Maximum redirects exceeded");let Pn;et.abort();try{Pn=new h(at,B)}catch{let Ft=new SyntaxError(`Invalid URL: ${at}`);return void te(N,Ft)}he(N,Pn,X,ce)}else N.emit("unexpected-response",et,Te)||G(N,et,`Unexpected server response: ${Te.statusCode}`)}),et.on("upgrade",(Te,at,Ze)=>{if(N.emit("upgrade",Te),N.readyState!==Q.CONNECTING)return;if(et=N._req=null,Te.headers.upgrade.toLowerCase()!=="websocket")return void G(N,at,"Invalid Upgrade header");let Pn=d("sha1").update(me+w).digest("base64");if(Te.headers["sec-websocket-accept"]!==Pn)return void G(N,at,"Invalid Sec-WebSocket-Accept header");let Rr=Te.headers["sec-websocket-protocol"],Ft;if(Rr!==void 0?lr.size?lr.has(Rr)||(Ft="Server sent an invalid subprotocol"):Ft="Server sent a subprotocol but none was requested":lr.size&&(Ft="Server sent no subprotocol"),Ft)return void G(N,at,Ft);Rr&&(N._protocol=Rr);let Ce=Te.headers["sec-websocket-extensions"];if(Ce!==void 0){if(!tn)return void G(N,at,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");let Zn;try{Zn=D(Ce)}catch{return void G(N,at,"Invalid Sec-WebSocket-Extensions header")}let ri=Object.keys(Zn);if(ri.length!==1||ri[0]!==_.extensionName)return void G(N,at,"Server indicated an extension that was not requested");try{tn.accept(Zn[_.extensionName])}catch{return void G(N,at,"Invalid Sec-WebSocket-Extensions header")}N._extensions[_.extensionName]=tn}N.setSocket(at,Ze,{generateMask:oe.generateMask,maxPayload:oe.maxPayload,skipUTF8Validation:oe.skipUTF8Validation})}),et.end()}function te(N,B){N._readyState=Q.CLOSING,N.emit("error",B),N.emitClose()}function $e(N){return N.path=N.socketPath,u.connect(N)}function st(N){return N.path=void 0,N.servername||N.servername===""||(N.servername=u.isIP(N.host)?"":N.host),a.connect(N)}function G(N,B,X){N._readyState=Q.CLOSING;let ce=new Error(X);Error.captureStackTrace(ce,G),B.setHeader?(B[q]=!0,B.abort(),B.socket&&!B.socket.destroyed&&B.socket.destroy(),process.nextTick(te,N,ce)):(B.destroy(ce),B.once("error",N.emit.bind(N,"error")),B.once("close",N.emitClose.bind(N)))}function Lt(N,B,X){if(B){let ce=F(B).length;N._socket?N._sender._bufferedBytes+=ce:N._bufferedAmount+=ce}X&&X(new Error(`WebSocket is not open: readyState ${N.readyState} (${Y[N.readyState]})`))}function ti(N,B){let X=this[I];X._closeFrameReceived=!0,X._closeMessage=B,X._closeCode=N,X._socket[I]!==void 0&&(X._socket.removeListener("data",fe),process.nextTick(_e,X._socket),N===1005?X.close():X.close(N,B))}function cr(){let N=this[I];N.isPaused||N._socket.resume()}function Zr(N){let B=this[I];B._socket[I]!==void 0&&(B._socket.removeListener("data",fe),process.nextTick(_e,B._socket),B.close(N[k])),B.emit("error",N)}function $(){this[I].emitClose()}function H(N,B){this[I].emit("message",N,B)}function J(N){let B=this[I];B.pong(N,!B._isServer,x),B.emit("ping",N)}function ne(N){this[I].emit("pong",N)}function _e(N){N.resume()}function Ee(){let N=this[I],B;this.removeListener("close",Ee),this.removeListener("data",fe),this.removeListener("end",Z),N._readyState=Q.CLOSING,this._readableState.endEmitted||N._closeFrameReceived||N._receiver._writableState.errorEmitted||(B=N._socket.read())===null||N._receiver.write(B),N._receiver.end(),this[I]=void 0,clearTimeout(N._closeTimer),N._receiver._writableState.finished||N._receiver._writableState.errorEmitted?N.emitClose():(N._receiver.on("error",$),N._receiver.on("finish",$))}function fe(N){this[I]._receiver.write(N)||this.pause()}function Z(){let N=this[I];N._readyState=Q.CLOSING,N._receiver.end(),this.end()}function ae(){let N=this[I];this.removeListener("error",ae),this.on("error",x),N&&(N._readyState=Q.CLOSING,this.destroy())}Object.defineProperty(Q,"CONNECTING",{enumerable:!0,value:Y.indexOf("CONNECTING")}),Object.defineProperty(Q.prototype,"CONNECTING",{enumerable:!0,value:Y.indexOf("CONNECTING")}),Object.defineProperty(Q,"OPEN",{enumerable:!0,value:Y.indexOf("OPEN")}),Object.defineProperty(Q.prototype,"OPEN",{enumerable:!0,value:Y.indexOf("OPEN")}),Object.defineProperty(Q,"CLOSING",{enumerable:!0,value:Y.indexOf("CLOSING")}),Object.defineProperty(Q.prototype,"CLOSING",{enumerable:!0,value:Y.indexOf("CLOSING")}),Object.defineProperty(Q,"CLOSED",{enumerable:!0,value:Y.indexOf("CLOSED")}),Object.defineProperty(Q.prototype,"CLOSED",{enumerable:!0,value:Y.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(N=>{Object.defineProperty(Q.prototype,N,{enumerable:!0})}),["open","error","close","message"].forEach(N=>{Object.defineProperty(Q.prototype,`on${N}`,{enumerable:!0,get(){for(let B of this.listeners(N))if(B[T])return B[P];return null},set(B){for(let X of this.listeners(N))if(X[T]){this.removeListener(N,X);break}typeof B=="function"&&this.addEventListener(N,B,{[T]:!0})}})}),Q.prototype.addEventListener=C,Q.prototype.removeEventListener=j,r.exports=Q},7968:r=>{"use strict";r.exports=Ue("node:crypto")},467:r=>{"use strict";r.exports=Ue("node:events")},2058:r=>{"use strict";r.exports=Ue("node:fs")},3755:r=>{"use strict";r.exports=Ue("node:http")},1256:r=>{"use strict";r.exports=Ue("node:https")},5256:r=>{"use strict";r.exports=Ue("node:net")},8558:r=>{"use strict";r.exports=Ue("node:os")},7072:r=>{"use strict";r.exports=Ue("node:path")},8378:r=>{"use strict";r.exports=Ue("node:stream")},192:r=>{"use strict";r.exports=Ue("node:tls")},8716:r=>{"use strict";r.exports=Ue("node:url")},592:r=>{"use strict";r.exports=Ue("node:zlib")}},t={},function r(e){var n=t[e];if(n!==void 0)return n.exports;var i=t[e]={exports:{}};return o[e].call(i.exports,i,i.exports,r),i.exports}(4856);var o,t})});var B_=Ke(Oe()),Qr=Ke(ir());import{readFile as pZ}from"node:fs/promises";import{basename as AM,dirname as hZ,join as Mw,resolve as _Z}from"node:path";var LX="13.10.0" ,FX="9b69501d" ,qX="@uipath/api-workflow-runtime",ux=(o,t)=>/^__[A-Z_]+__$/.test(o)?t:o,lx={version:ux(LX,"0.0.0-dev"),commit:ux(FX,"local")};function dx(){return`${qX} v${lx.version} (${lx.commit})`}var f_=Ke(ir());var hx=Ke(ir());import{Worker as WX}from"node:worker_threads";var UX=typeof globalThis.Deno<"u",$X=`
|
|
987
987
|
if (typeof self === 'undefined') {
|
|
988
988
|
const { parentPort } = require('worker_threads');
|
|
989
989
|
globalThis.self = {
|
|
@@ -1638,7 +1638,7 @@ self.onmessage = function(e) {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
}
|
|
1640
1640
|
};
|
|
1641
|
-
`}async testEvaluatePlainJsExpression(t){return(await this.evaluateSanitizedExpressionsInternal(new Set([t]))).get(t)}};var Or=Ke(ir()),dw=Ke(Oe());var r_=Ke(Oe()),n_=Ke(ir()),Xi=class{static sanitizeData(t,r){if(!t)return{sanitizedData:t,sanitizedError:this.sanitizeError(r)};let e;try{e=(0,r_.removeObjectPaths)(t,["context","input","output","variables","properties"])}catch(i){console.error("Error sanitizing data:",i),e=t}let n=this.sanitizeError(r);return{sanitizedData:e,sanitizedError:n}}static sanitizeError(t){if(t)try{if((0,n_.isWorkflowError)(t)){let r=t.getData(),e=(0,r_.redactObjectPaths)(r,["cause.headers","cause.request"]);return new n_.WorkflowError(t.title,t.status,t.type,t.instance,t.detail,e,{originatingTaskName:t.originatingTaskName,originatingWorkflow:t.originatingWorkflow,fatal:t.fatal})}else{let r=new Error(t.message);r.stack=t.stack;for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r}}catch(r){return console.error("Error sanitizing error:",r),t}}};var _x=Ke(Qv()),mx=Ke(Oe()),vx=Ke(Oe()),BX="X-UiPath-Licensing-Context",HX="/lease_/api/usageEvent",VX="Is.Activities",zX=1,KX="Vertical",YX=!1;function JX(o){return _x.default.utc(o).format("YYYY-MM-DDTHH:mm:ss.SSS")+"0000Z"}function ow(o){if(o)try{let t=o.split(";");for(let r of t){let e=r.indexOf("=");if(e===-1)continue;let n=r.substring(0,e).trim(),i=r.substring(e+1).trim();if(n==="transactionType"&&i)return i}return}catch(t){console.error("LicensingService: Failed to parse licensing context:",t);return}}var o_=class{licensingContext;organizationId;tenantId;accessToken;baseUrl;source;constructor(t,r){this.licensingContext=r||"",this.organizationId=t.organizationId,this.tenantId=t.tenantId,this.accessToken=t.tracingConfig?.tracingToken||"",this.baseUrl=t.baseUrl,this.source=t.source}async reportHttpTaskConsumption(t){if(!YX||!this.licensingContext||ow(this.licensingContext)!==KX)return;if(!this.accessToken){console.error("LicensingService: No access token available for licensing consumption reporting");return}let r=this.buildLeaseRequest(t),e=(0,mx.addPathComponentsToUrl)(this.baseUrl,[this.organizationId,HX,this.organizationId]);try{let n=await fetch(e,{method:"PUT",body:JSON.stringify(r),headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json",[BX]:this.licensingContext},signal:AbortSignal.timeout(5e3)}),i=await n.text();if(n.ok)console.log("LicensingService: Consumption reported successfully.");else{let s=`Licensing API failed: ${n.status} ${n.statusText} - ${i}`;throw console.error(`LicensingService: ${s}`),new Error(s)}}catch(n){let s=n instanceof DOMException&&n.name==="TimeoutError"?"LicensingService: Request timed out after 5s":`LicensingService: Failed to report consumption: ${(0,vx.getErrorMessage)(n)}`;throw console.error(s),new Error(s)}}buildLeaseRequest(t){let r=t.displayName||"N/A",e=[{k:"count",v:"1"},{k:"activityType",v:"HTTP"},{k:"activityDisplayName",v:r.substring(0,255)},{k:"source",v:this.source}];return{nonce:t.nonce,referenceId:t.referenceId,usage:1,consumedAt:JX(new Date),organizationId:this.organizationId,context:{tenantId:this.tenantId,operationCode:VX},rawData:{formula:zX,Params:e}}}};var Cx=Ke(ir()),jx=Ke(Oe());async function yx(o,t,r,e,n,i="v2",s=""){let c=i==="v3"?"api/Traces/v3/spans":"api/Traces/spans",u=s.replace(/^\/+|\/+$/g,""),a=u?`${u}/${c}`:c,l=new URL(`${o.replace(/\/$/,"")}/${a}`);return l.searchParams.set("traceId",r),l.searchParams.set("source",e),fetch(l.toString(),{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)})}function GX(o){let t=globalThis.crypto;if(t?.getRandomValues===void 0)throw new Error("Web Crypto API is unavailable; @uipath/tracing requires globalThis.crypto (browser, Node >= 20, or Deno).");let r=new Uint8Array(o);return t.getRandomValues(r),Array.from(r,e=>e.toString(16).padStart(2,"0")).join("")}var bx={generate(){return GX(8)},fromUuid(o){return o.replace(/-/g,"").slice(16).toLowerCase()},toUuid(o){if(o.length!==16)throw new Error(`Invalid OTEL span ID length: ${o.length}`);let t=o.padStart(32,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`},isValid(o){return o.length===16&&/^[0-9a-fA-F]{16}$/.test(o)}};var i_;(function(o){o[o.Unset=0]="Unset",o[o.Ok=1]="Ok",o[o.Error=2]="Error",o[o.Running=3]="Running",o[o.Restricted=4]="Restricted",o[o.Cancelled=5]="Cancelled"})(i_||(i_={}));var Yr;(function(o){o[o.Testing=0]="Testing",o[o.Agents=1]="Agents",o[o.ProcessOrchestration=2]="ProcessOrchestration",o[o.ApiWorkflows=3]="ApiWorkflows",o[o.Robots=4]="Robots",o[o.ConversationalAgentsService=5]="ConversationalAgentsService",o[o.IntegrationServiceTrigger=6]="IntegrationServiceTrigger",o[o.Playground=7]="Playground",o[o.Governance=8]="Governance",o[o.IXPUnstructuredAndComplexDocuments=9]="IXPUnstructuredAndComplexDocuments",o[o.CodedAgents=10]="CodedAgents",o[o.IXPCommunicationsMining=11]="IXPCommunicationsMining",o[o.EnterpriseContextService=12]="EnterpriseContextService",o[o.MCP=13]="MCP",o[o.A2A=14]="A2A",o[o.Serverless=15]="Serverless",o[o.DocumentUnderstanding=16]="DocumentUnderstanding"})(Yr||(Yr={}));var Vc;(function(o){o[o.Verbose=0]="Verbose",o[o.Trace=1]="Trace",o[o.Information=2]="Information",o[o.Warning=3]="Warning",o[o.Error=4]="Error",o[o.Critical=5]="Critical",o[o.Off=6]="Off"})(Vc||(Vc={}));var s_;(function(o){o[o.Debug=0]="Debug",o[o.Runtime=1]="Runtime"})(s_||(s_={}));var Oa;(function(o){o[o.Orchestrator=0]="Orchestrator",o[o.LLMOps=1]="LLMOps",o[o.IDP=2]="IDP"})(Oa||(Oa={}));var zc;(function(o){o[o.None=0]="None",o[o.In=1]="In",o[o.Out=2]="Out"})(zc||(zc={}));var gx;(function(o){o[o.Pending=0]="Pending",o[o.Approved=1]="Approved",o[o.Dismissed=2]="Dismissed"})(gx||(gx={}));var wx;(function(o){o[o.Enabled=0]="Enabled",o[o.Disabled=1]="Disabled"})(wx||(wx={}));var Ex;(function(o){o[o.Episodic=0]="Episodic",o[o.Escalation=1]="Escalation"})(Ex||(Ex={}));var Tx;(function(o){o.Hybrid="Hybrid",o.Semantic="Semantic"})(Tx||(Tx={}));var Sx;(function(o){o[o.Allow=0]="Allow",o[o.PartialBlock=1]="PartialBlock",o[o.Block=2]="Block"})(Sx||(Sx={}));function aw(o){return{id:o.id??bx.generate(),traceId:o.traceId,parentId:o.parentId,name:o.name,spanType:o.spanType,attributes:JSON.stringify(sw(o.attributes)),status:i_[o.status],organizationId:o.organizationId,tenantId:o.tenantId,folderKey:o.folderKey,source:Yr[o.source],startTime:iw(o.startTime),endTime:o.endTime!==void 0?iw(o.endTime):void 0,updatedAt:iw(o.updatedAt),verbosityLevel:Vc[o.verbosityLevel??Vc.Information],executionType:o.executionType!==void 0?s_[o.executionType]:void 0,agentVersion:o.agentVersion,processKey:o.processKey,jobKey:o.jobKey,referenceId:o.agentId,attachments:o.attachments?.map(r=>({provider:Oa[r.provider],id:r.id,fileName:r.fileName,mimeType:r.mimeType,direction:zc[r.direction??zc.None]})),context:XX(o.baggage)}}function XX(o){if(o===void 0)return;let t=o.toReferenceHierarchy();if(t.length!==0)return{referenceHierarchy:t.map(r=>({serviceType:r.serviceType,referenceId:r.referenceId,version:r.version}))}}function iw(o){return typeof o=="string"?o:o.toISOString()}function sw(o){if(Array.isArray(o))return o.map(sw);if(o!==null&&typeof o=="object"&&!(o instanceof Date)){let t={};for(let[r,e]of Object.entries(o))e!=null&&(t[r]=sw(e));return t}return o}var cw="1.0.0";var kx="x-uipath-tracebaggage",ka={Type:"ref.type",Id:"ref.id",Version:"ref.v"},Ox=class o{static Empty=new o([]);_entries;constructor(t){this._entries=t}get entries(){return this._entries}get length(){return this._entries.length}add(t){let r=new Map,e=t instanceof Map?t.entries():Object.entries(t);for(let[i,s]of e){if(typeof i!="string"||i.trim()==="")throw new Error("Property keys must be non-empty strings.");if(typeof s!="string")throw new Error(`Property '${i}' must have a string value.`);r.set(i,s)}if(r.size===0)throw new Error("Properties must contain at least one key.");let n={properties:r};return new o([...this._entries,n])}addReference(t,r,e){if(typeof t!="string"||t.trim()==="")throw new Error("serviceType must be a non-empty string.");if(typeof r!="string"||r.trim()==="")throw new Error("referenceId must be a non-empty string.");let n={[ka.Type]:t,[ka.Id]:r};return e!=null&&e.trim()!==""&&(n[ka.Version]=e),this.add(n)}toReferenceHierarchy(){let t=[];for(let r of this._entries){let e=QX(r);e!==void 0&&t.push(e)}return t}toHeaderValue(){if(this._entries.length===0)return"";let t=[];for(let r of this._entries){let n=Array.from(r.properties.keys()).sort().map(i=>`${i}=${r.properties.get(i)}`).join(";");t.push(n)}return t.join(",")}static fromHeaderValue(t){if(t==null)return o.Empty;let r=t.trim();if(r==="")return o.Empty;let e=[];for(let n of r.split(",")){let i=n.trim();if(i==="")continue;let s=new Map;for(let c of i.split(";")){let u=c.trim();if(u==="")continue;let a=u.indexOf("=");if(a<=0||a>=u.length-1)continue;let l=u.slice(0,a).trim(),d=u.slice(a+1).trim();l===""||d===""||s.set(l,d)}s.size>0&&e.push({properties:s})}return e.length===0?o.Empty:new o(e)}};function QX(o){if(o==null)throw new Error("entry is required");let t=o.properties.get(ka.Type),r=o.properties.get(ka.Id);if(!t||!r||!eQ(r))return;let e=o.properties.get(ka.Version);return{serviceType:t,referenceId:r,version:e}}var ZX=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function eQ(o){return ZX.test(o)}var En=class extends Error{statusCode;constructor(t,r){super(t),this.statusCode=r,this.name="LLMOpsClientError"}},a_=class{config;constructor(t){this.config=t}resolveUrl(t){let r=this.config.organizationId;if(!r)return t;let e=r;return this.config.tenantId&&(e+=`/${this.config.tenantId}`),e+="/llmopstenant_",`${e}/${t}`}async executeCore(t,r,e,n){let s=`${this.config.baseUrl.replace(/\/$/,"")}/${r}`,{extraHeaders:c}=n??{},u;for(let a=0;a<3;a++){try{let l=await this.config.getToken(),d={method:t,headers:{Authorization:`Bearer ${l}`,"X-SDK-Version":cw,...e!==void 0?{"Content-Type":"application/json"}:{},...c},...e!==void 0?{body:JSON.stringify(e)}:{}},f=await fetch(s,d);if(f.ok)return f;if(f.status>=400&&f.status<500)throw new En(`HTTP ${f.status}`,f.status);u=new En(`HTTP ${f.status} (attempt ${a+1})`,f.status)}catch(l){if(l instanceof En&&l.statusCode!==void 0&&l.statusCode<500)throw l;u=l}a<2&&await Rx(1e3*Math.pow(2,a))}throw u instanceof Error?u:new En("Request failed after 3 attempts")}async executeJson(t,r,e){return(await this.executeCore(t,r,e)).json()}async executeVoid(t,r,e){await this.executeCore(t,r,e)}async publishSpans(t,r,e){let n=e??r[0]?.source??Yr.Agents,i=r[0],s=nQ(i?.organizationId,i?.tenantId),c=r.map(aw),u,a;try{a=await Promise.resolve().then(()=>(Ax(),Px))}catch{a=void 0}if(a!==void 0){let d=a.BaggageContextAccessor.get();d!==void 0&&d.length>0&&(u=d.toHeaderValue())}let l;for(let d=0;d<3;d++){try{let h={Authorization:`Bearer ${await this.config.getToken()}`,"X-SDK-Version":cw};u!==void 0&&(h[kx]=u);let _=await yx(this.config.baseUrl,c,t,xx(n),h,this.config.apiVersion??"v2",s);if(_.ok)return;if(_.status>=400&&_.status<500)throw new En(`HTTP ${_.status}`,_.status);l=new En(`HTTP ${_.status} (attempt ${d+1})`,_.status)}catch(f){if(f instanceof En&&f.statusCode!==void 0&&f.statusCode<500)throw f;l=f}d<2&&await Rx(1e3*Math.pow(2,d))}throw l instanceof Error?l:new En("Failed to publish spans after 3 attempts")}async publishSpansBatch(t,r){let e=t.map(aw),n=(this.config.apiVersion??"v2")==="v3"?"api/Traces/v3/spans/batch":"api/Traces/spans/batch",i=this.resolveUrl(`${n}?source=${encodeURIComponent(xx(r))}`);return this.executeJson("POST",i,e)}async getSpans(t,r=1e3,e=!1){let n=this.resolveUrl(`api/Traces/v2/spans?traceId=${encodeURIComponent(t)}&pageSize=${r}&isHistorical=${e}`),i=await this.executeCore("GET",n),s=await i.json(),c=i.headers.get("X-Continuation-Token")??i.headers.get("x-continuation-token")??void 0;return{spans:s,continuationToken:c}}async getOtelSpans(t,r=1e3,e=!1){if((this.config.apiVersion??"v2")!=="v3"){let n=this.resolveUrl(`api/Traces/v2/spans/otel?traceId=${encodeURIComponent(t)}&pageSize=${r}&isHistorical=${e}`),i=await this.executeCore("GET",n),s=await i.json(),c=i.headers.get("X-Continuation-Token")??i.headers.get("x-continuation-token")??void 0;return{spans:s?.spans??[],continuationToken:c}}return this.getOtelSpansV3(t,e)}async getOtelSpansV3(t,r){let e=[],n="";for(;;){let i=this.resolveUrl(`api/Traces/v3/spans?traceId=${encodeURIComponent(t)}&pageSize=500&isHistorical=${r}`),s=n?{"X-UiPath-Trace-Tokens":n}:void 0,c=await this.executeCore("GET",i,void 0,{extraHeaders:s}),u=await c.json(),a=u.Spans??u.spans??[];if(e.push(...a),n=c.headers.get("X-UiPath-Trace-Tokens")??"",!n)break}return{spans:e}}async getSpansByIds(t,r){let e=this.resolveUrl(`api/Traces/v2/spans/byIds?traceId=${encodeURIComponent(t)}`);return this.executeJson("POST",e,r)}async getOtelSpansByIds(t,r){if((this.config.apiVersion??"v2")!=="v3"){let e=this.resolveUrl(`api/Traces/v2/spans/otel/byIds?traceId=${encodeURIComponent(t)}`);return this.executeJson("POST",e,r)}return this.getOtelSpansByIdsV3(t,r)}async getOtelSpansByIdsV3(t,r){let e=this.resolveUrl(`api/Traces/v3/spans/byIds?traceId=${encodeURIComponent(t)}`),n=await this.executeJson("POST",e,r);return Array.isArray(n)?n:n.Spans??n.spans??[]}async getSpansByReferenceId(t,r={}){let e=new URLSearchParams;r.serviceType!==void 0&&e.set("serviceType",r.serviceType),r.version!==void 0&&e.set("version",r.version),r.pageNumber!==void 0&&e.set("pageNumber",String(r.pageNumber)),r.pageSize!==void 0&&e.set("pageSize",String(r.pageSize)),r.startTime!==void 0&&e.set("startTime",r.startTime instanceof Date?r.startTime.toISOString():r.startTime),r.endTime!==void 0&&e.set("endTime",r.endTime instanceof Date?r.endTime.toISOString():r.endTime),r.traceId!==void 0&&e.set("traceId",r.traceId);let n=e.toString(),i=this.resolveUrl(`api/Traces/v3/spans/reference/${encodeURIComponent(t)}${n?`?${n}`:""}`);return this.executeJson("GET",i)}createFeedback(t){return this.executeJson("POST",this.resolveUrl("api/Feedback"),t)}editFeedback(t,r){return this.executeJson("POST",this.resolveUrl(`api/Feedback/${t}`),r)}deleteFeedback(t){return this.executeVoid("DELETE",this.resolveUrl(`api/Feedback/${t}`))}getFeedback(t){return this.executeJson("GET",this.resolveUrl(`api/Feedback/${t}`))}listFeedback(t){let r=rQ(t);return this.executeJson("GET",this.resolveUrl(`api/Feedback${r}`))}getFeedbackMemoryLinks(t){return this.executeJson("GET",this.resolveUrl(`api/Feedback/memoryLinks?traceId=${encodeURIComponent(t)}`))}searchFeedbackByTraceIds(t){return this.executeJson("POST",this.resolveUrl("api/Feedback/search"),t)}createFeedbackCategory(t){return this.executeJson("POST",this.resolveUrl("api/Feedback/category"),t)}listFeedbackCategories(t=0,r=100,e,n){let i=`?skip=${t}&take=${r}`;return e!==void 0&&(i+=`&isPositive=${e}`),n!==void 0&&(i+=`&isNegative=${n}`),this.executeJson("GET",this.resolveUrl(`api/Feedback/category${i}`))}deleteFeedbackCategory(t,r=!1){return this.executeVoid("DELETE",this.resolveUrl(`api/Feedback/category/${t}?forceDelete=${r}`))}createMemoryItem(t,r){return this.executeJson("POST",this.resolveUrl(`api/Memory/${t}/items`),r)}listMemoryItems(t,r=0,e=100,n=!1){let i=`?skip=${r}&take=${e}`;return n&&(i+="&expand=span"),this.executeJson("GET",this.resolveUrl(`api/Memory/${t}/items${i}`))}getMemoryItem(t,r,e=!1){let n=e?"?expand=span":"";return this.executeJson("GET",this.resolveUrl(`api/Memory/${t}/items/${r}${n}`))}updateMemoryItem(t,r,e){return this.executeJson("PATCH",this.resolveUrl(`api/Memory/${t}/items/${r}`),e)}deleteMemoryItem(t,r){return this.executeVoid("DELETE",this.resolveUrl(`api/Memory/${t}/items/${r}`))}bulkDeleteMemoryItems(t,r){return this.executeVoid("DELETE",this.resolveUrl(`api/Memory/${t}/items`),{memoryItemIds:r})}deleteMemorySpace(t){return this.executeVoid("DELETE",this.resolveUrl(`api/Memory/${t}`))}searchMemory(t,r){return this.executeJson("POST",this.resolveUrl(`api/Memory/${t}/search`),r)}};function rQ(o){if(!o)return"";let t=[];return t.push(`skip=${o.skip??0}`),t.push(`take=${o.take??100}`),o.agentId&&t.push(`agentId=${encodeURIComponent(o.agentId)}`),o.agentVersion&&t.push(`agentVersion=${encodeURIComponent(o.agentVersion)}`),o.status!==void 0&&t.push(`status=${o.status}`),o.traceId&&t.push(`traceId=${encodeURIComponent(o.traceId)}`),o.spanId&&t.push(`spanId=${encodeURIComponent(o.spanId)}`),`?${t.join("&")}`}function Rx(o){return new Promise(t=>setTimeout(t,o))}var Ix="00000000-0000-0000-0000-000000000000";function nQ(o,t){if(!o||o===Ix)return"";let r=o;return t&&t!==Ix&&(r+=`/${t}`),`${r}/llmopstenant_`}function xx(o){return Yr[o]??String(o)}var lw="00000000-0000-0000-0000-000000000000";function Mx(o){let{organizationId:t,tenantId:r,folderKey:e,processKey:n,jobKey:i}=o.jobContext;if(!e||e.toLowerCase()===lw)throw new Error(`toSdkSpan: missing folderKey. TraceId: ${o.traceId}, JobKey: ${i}`);return{id:o.id,traceId:o.traceId,parentId:o.parentId||void 0,name:o.name,spanType:o.spanType,attributes:o.attributes??{},status:o.status,source:Yr.ApiWorkflows,startTime:o.startTime,endTime:o.endTime,updatedAt:o.updatedAt,organizationId:t,tenantId:r,folderKey:e,processKey:n,jobKey:i,attachments:o.attachments?.map(s=>({provider:Oa.LLMOps,id:s.id,fileName:s.fileName,mimeType:s.mimeType}))}}var c_=class{traceId;traceViewDataFormatter;injectedPublisher;lazyPublisher;workflowConfig;constructor(t,r,e){this.workflowConfig=t,this.traceViewDataFormatter=new Cx.TraceViewDataFormatter(t,r),this.traceId=this.traceViewDataFormatter.traceId,this.injectedPublisher=e}getPublisher(){return this.injectedPublisher?this.injectedPublisher:(this.lazyPublisher||(this.lazyPublisher=new a_({baseUrl:this.workflowConfig.baseUrl,getToken:()=>Promise.resolve(this.workflowConfig.tracingConfig?.tracingToken??""),apiVersion:"v3"})),this.lazyPublisher)}async sendSpans(t){if(!this.workflowConfig.tracingConfig?.tracingToken||t.length===0){console.log(`TraceViewLogger: ${this.workflowConfig.tracingConfig?.tracingToken?"No spans to flush":"No trace view token"}`);return}let r=this.workflowConfig.processConfig?.folderKey;if(!r||r.toLowerCase()===lw){console.error(`TraceViewLogger: skipping v3 ingest \u2014 missing/empty folderKey. JobKey: ${this.workflowConfig.processConfig?.jobKey}`);return}console.log(`TraceViewLogger: Flushing ${t.length} spans to trace view...`);try{let e=t.map(Mx);await this.getPublisher().publishSpans(this.traceId,e,Yr.ApiWorkflows),console.log(`TraceViewLogger: Updated ${e.length} spans to trace view. TraceId: ${this.traceId}, JobKey: ${this.workflowConfig.processConfig?.jobKey}`)}catch(e){let n=`Error: TraceViewLogger: Failed to send spans to trace view, TraceId: ${this.traceId}, JobKey: ${this.workflowConfig.processConfig?.jobKey}: ${(0,jx.getErrorMessage)(e)}`;throw console.error(n),new Error(n)}}formatWorkflowLog(t,r,e){return this.traceViewDataFormatter.formatWorkflowLog(t,r,e)}formatTaskLog(t,r,e){return this.traceViewDataFormatter.formatTaskLog(t,r,e)}formatUserLog(t,r,e){return this.traceViewDataFormatter.formatUserLog(t,r,e)}};var Jo={Information:"Information",Warning:"Warning",Error:"Error"};var Gn={TELEMETRY_EVENT:"telemetry_event",TELEMETRY_TRACE:"telemetry_trace",USER_LOG:"user_log"},Go=class{static createEventDto(t,r,e,n,i,s){try{let c=r==="task"?t.formatTaskLog(e,n,s):t.formatWorkflowLog(e,n,s);return c?{name:c.name,eventTime:new Date().toISOString(),jobKey:i,properties:c.properties||{}}:(console.error(`Error: Failed to format ${r} log data:`,{event:e,data:JSON.stringify(n),error:s}),null)}catch(c){return console.error(`Failed to create ${r} event DTO:`,{error:c,event:e,data:JSON.stringify(n)}),null}}static createTraceDto(t,r,e,n,i){try{let s={};return n&&Object.keys(n).length>0?Object.entries(n).forEach(([c,u])=>{s[c]=typeof u=="object"?JSON.stringify(u):String(u)}):i&&(t=t+" "+i.message,i.message&&(s.message=i.message),i.name&&(s.name=i.name),i.stack&&(s.stack=i.stack),Object.entries(i).forEach(([c,u])=>{u!=null&&(s[c]=typeof u=="object"?JSON.stringify(u):String(u))})),{message:t,severityLevel:r,eventTime:new Date().toISOString(),jobKey:e,properties:s}}catch(s){return console.error("Failed to create trace DTO:",{error:s,message:t,severity:r,data:JSON.stringify(n)}),null}}static createJobLogDto(t){try{return{Message:String(t.message),LogLevel:t.logLevel}}catch(r){return console.error("Failed to create job log DTO:",{error:r,data:JSON.stringify(t)}),null}}};var u_=class{logLevel;workflowId;workflowName;constructor(t,r,e){this.logLevel=t,this.workflowId=r,this.workflowName=e}async logWorkflowEvent(t,r,e){await this.logEventToConsole(t,r,e)}async logTaskEvent(t,r,e){await this.logEventToConsole(t,r,e)}logIterationVariables(){return Promise.resolve()}async logEvent(t,r){return Promise.resolve()}async logEventToConsole(t,r,e){let n={workflowName:this.workflowName,...r&&{data:r}};if(e)return this.error(`Event: ${t}`,n,e),Promise.resolve();await this.info(`Event: ${t}`,n)}async debug(t,r){this.shouldLog("debug")&&await this.log("debug",t,r)}async info(t,r){this.shouldLog("info")&&await this.log("info",t,r)}async warn(t,r){this.shouldLog("warn")&&await this.log("warn",t,r)}shutdown(){return Promise.resolve()}async error(t,r,e){await this.log("error",t,r,e)}shouldLog(t){let r=["debug","info","warn","error"];return r.indexOf(t)>=r.indexOf(this.logLevel)}log(t,r,e,n){try{let i={message:r,workflowId:this.workflowId,workflowName:this.workflowName,level:t,logTime:new Date().toISOString(),...n&&{error:{name:n.name,message:n.title||n.message,type:n.type,stack:n.detail||n.stack,status:n.status}},...e&&{data:e}};return console[t](JSON.stringify(i)),Promise.resolve()}catch(i){return console.error("Failed to log message:",r,i),Promise.resolve()}}};var l_=class{loggers;rawDataLoggers;ORPHANED_USER_LOGS_TASK_ID="unknown";jobApi;telemetryDataFormatter;traceViewService;licensingService;licensingContext;OrchestratorJobId;totalSocketDurationMs=0;totalTraceViewDurationMs=0;spans=[];userLogDataWithTaskIds=new Map;workflowConfig;SPAN_BATCH_SIZE=5;SPAN_BATCH_INTERVAL_MS=3e3;MAX_SPAN_DATA_SIZE_BYTES=1024*1024;lastSpanFlushTime=Date.now();lastSpanFlushTaskCount=0;taskCount=0;constructor(t,r,e,n,i,s,c){this.loggers=[new u_(t.debugConfig?.isRunningInDesigner?"debug":"info",r,r)],this.rawDataLoggers=c??[],this.jobApi=e,this.workflowConfig=t,this.traceViewService=new c_(t,r),this.licensingService=new o_(t,s),this.licensingContext=s,this.telemetryDataFormatter=new Or.TelemetryDataFormatter(t.organizationId,t.tenantId,t.telemetryConfig?.traceId,t.telemetryConfig?.parentSpanId,t.userId,t.subscriptionType,t.source,n,i,t.processConfig?.isStudioDebugContext,t.processConfig?.folderKey,t.processConfig?.jobKey),this.OrchestratorJobId=t.processConfig?.jobKey}async logWorkflowEvent(t,r,e){let{sanitizedData:n,sanitizedError:i}=Xi.sanitizeData(r,e),s=this.loggers.map(l=>l.logWorkflowEvent(t,n,i)),c=this.rawDataLoggers.map(l=>l.logWorkflowEvent(t,r,e));if(await Promise.all([...s,...c]),t===Or.WorkflowEvent.WORKFLOW_STARTED)return Promise.resolve();let u=this.traceViewService.formatWorkflowLog(t,r,e);this.spans.push(u),await this.flushSpansIfNeeded(),this.addUserLogsToTraceViewSpans(this.ORPHANED_USER_LOGS_TASK_ID,u.id),await this.sendTraceViewData(this.spans),this.userLogDataWithTaskIds.clear(),this.updateWorkflowExecutionTimes(n);let a=Go.createEventDto(this.telemetryDataFormatter,"workflow",t,n,this.OrchestratorJobId,i);await this.sendTelemetryData(a,Gn.TELEMETRY_EVENT)}async logTaskEvent(t,r,e){let{sanitizedData:n,sanitizedError:i}=Xi.sanitizeData(r,e),s=this.loggers.map(v=>v.logTaskEvent(t,n,i)),c=this.rawDataLoggers.map(v=>v.logTaskEvent(t,r,e));if(await Promise.all([...s,...c]),this.taskCount++,t===Or.TaskEvent.TASK_STARTED||r.taskType===Or.TaskType.DO)return Promise.resolve();let u=Go.createEventDto(this.telemetryDataFormatter,"task",t,n,this.OrchestratorJobId,i),a=t===Or.TaskEvent.TASK_COMPLETED&&r.taskType===Or.TaskType.HTTP&&r.HttpCallMode==="direct"&&!r.isUiPathInternalServiceCall&&!this.workflowConfig.processConfig?.isStudioDebugContext,l=(0,dw.getNewGuid)(),d=(0,dw.getNewGuid)();if(u?.properties&&this.licensingContext&&a){u.properties.LicensingContext=this.licensingContext;let v=ow(this.licensingContext);v&&(u.properties.LicensingTransactionType=v),l&&(u.properties.LicensingNonce=l),d&&(u.properties.LicensingReferenceId=d)}let f=this.sendTelemetryData(u,Gn.TELEMETRY_EVENT),h=a?{...r,licenseRefId:d}:r,_=this.traceViewService.formatTaskLog(t,h,e);this.spans.push(_),await this.flushSpansIfNeeded(),this.addUserLogsToTraceViewSpans(r.taskId,_.id);let m=a&&l&&d?this.reportLicensingConsumption({displayName:r.displayName,nonce:l,referenceId:d}):Promise.resolve();await Promise.all([f,m])}async logEvent(t,r){let e=[...this.loggers.map(s=>s.logEvent(t,r)),...this.rawDataLoggers.map(s=>s.logEvent(t,r))],n=Go.createJobLogDto(r),i=this.sendTelemetryData(n,Gn.USER_LOG);if(this.workflowConfig.tracingConfig?.enableUserLogs){let s=r.taskId||this.ORPHANED_USER_LOGS_TASK_ID;this.userLogDataWithTaskIds.has(s)?this.userLogDataWithTaskIds.get(s)?.push(r):this.userLogDataWithTaskIds.set(s,[r])}await Promise.all([...e,i])}async logIterationVariables(t,r,e){let n=[...this.loggers.map(i=>i.logIterationVariables(t,r,e)),...this.rawDataLoggers.map(i=>i.logIterationVariables(t,r,e))];await Promise.all(n)}async debug(t,r){let{sanitizedData:e}=Xi.sanitizeData(r||{},void 0),n=[...this.loggers.map(i=>i.debug(t,e)),...this.rawDataLoggers.map(i=>i.debug(t,r))];await Promise.all(n)}async info(t,r){await this.logWithTelemetry(t,Jo.Information,r)}async warn(t,r){await this.logWithTelemetry(t,Jo.Warning,r)}async error(t,r,e){await this.logWithTelemetry(t,Jo.Error,r,e)}addUserLogsToTraceViewSpans(t,r){this.userLogDataWithTaskIds.has(t)&&(this.userLogDataWithTaskIds.get(t)?.forEach(n=>{let i=this.traceViewService.formatUserLog(Or.LogEvent.USER_LOG,n,r);this.spans.push(i)}),this.userLogDataWithTaskIds.delete(t))}async logWithTelemetry(t,r,e,n){let{sanitizedData:i,sanitizedError:s}=Xi.sanitizeData(e||{},n),c=(d,f)=>{let h=f?e:i,_=f?n:s;switch(r){case Jo.Information:return d.info(t,h);case Jo.Warning:return d.warn(t,h);case Jo.Error:return d.error(t,h,_);default:return d.info(t,h)}},u=[...this.loggers.map(d=>c(d,!1)),...this.rawDataLoggers.map(d=>c(d,!0))],a=Go.createTraceDto(t,r,this.OrchestratorJobId,i,s),l=this.sendTelemetryData(a,Gn.TELEMETRY_TRACE);await Promise.all([...u,l])}async sendTelemetryData(t,r){if(!t){console.debug(`No DTO provided for ${r}, skipping telemetry`);return}if(!this.jobApi){console.warn(`Job API not available for ${r}`);return}let e=Date.now();try{r===Gn.TELEMETRY_EVENT?await this.jobApi.sendTelemetryEvent(t):r===Gn.TELEMETRY_TRACE?await this.jobApi.sendTelemetryTrace(t):r===Gn.USER_LOG&&await this.jobApi.sendLog(t);let n=Date.now()-e;this.totalSocketDurationMs+=n}catch(n){let i=Date.now()-e;this.totalSocketDurationMs+=i,console.error(`IPC communication failed for ${r}:`,{error:n,dto:JSON.stringify(t),duration:`${i}ms`})}}updateWorkflowExecutionTimes(t){t.executionEndTimeMs=Date.now(),t.executionTimeMs=t.executionEndTimeMs-(t.executionStartTimeMs||0),t.externalExecutionTimeMs=(t.externalExecutionTimeMs||0)+this.totalSocketDurationMs+this.totalTraceViewDurationMs,t.systemExecutionTimeMs=t.executionTimeMs-t.externalExecutionTimeMs;let r={};if(t.externalExecutionBreakdown)try{r=JSON.parse(t.externalExecutionBreakdown)}catch{r={}}this.totalSocketDurationMs>0&&(r.SocketTimeMs=this.totalSocketDurationMs),this.totalTraceViewDurationMs>0&&(r.TraceViewTimeMs=this.totalTraceViewDurationMs),t.externalExecutionBreakdown=JSON.stringify(r)}getSpansSize(){try{let t=JSON.stringify(this.spans);return new Blob([t]).size}catch{return 0}}async flushSpansIfNeeded(){let t=Date.now(),r=t-this.lastSpanFlushTime,e=this.getSpansSize();if((this.spans.length>=this.SPAN_BATCH_SIZE||r>=this.SPAN_BATCH_INTERVAL_MS||e>this.MAX_SPAN_DATA_SIZE_BYTES)&&this.spans.length>0){let i=e>this.MAX_SPAN_DATA_SIZE_BYTES?"size":this.spans.length>=this.SPAN_BATCH_SIZE?"count":"time";console.log(`[MEMORY OPTIMIZATION] Flushing ${this.spans.length} spans (${Math.round(e/1024)} KB) due to ${i}`),await this.sendTraceViewData([...this.spans]),this.spans.length=0,this.lastSpanFlushTime=t,this.lastSpanFlushTaskCount=this.taskCount}}async sendTraceViewData(t){let r=Date.now();try{await this.traceViewService.sendSpans(t);let e=Date.now()-r;this.totalTraceViewDurationMs+=e}catch(e){let n=Date.now()-r;this.totalTraceViewDurationMs+=n,console.error("TraceView service error:",e);let i=Go.createTraceDto("TraceView service failed",Jo.Error,this.OrchestratorJobId,void 0,e);await this.sendTelemetryData(i,Gn.TELEMETRY_TRACE)}}async reportLicensingConsumption(t){try{await this.licensingService.reportHttpTaskConsumption(t)}catch(r){console.error("LicensingService: Error reporting consumption:",r)}}async shutdown(){await Promise.all([...this.loggers.map(t=>t.shutdown()),...this.rawDataLoggers.map(t=>t.shutdown())])}};import{AsyncLocalStorage as oQ}from"node:async_hooks";var d_=class{storage=new oQ;current(){return this.storage.getStore()}runInSpan(t,r){return this.storage.run(t,r)}};var iQ="APIWF_TRACE_CONTEXT_PROPAGATION",sQ=new Set(["1","true"]);function aQ(){let o;try{o=process.env[iQ]}catch{return!1}return sQ.has((o??"").trim().toLowerCase())}var Nx;function Dx(){if(aQ())return Nx??=new d_,Nx}var Lx=async(o,t,r,e={})=>{if(!t)throw new Error("Workflow context is required");let{releasePackage:n,jobApi:i,licensingContext:s,additionalLoggers:c,commandStream$:u,workflowResolver:a,workflowFile:l}=e;t.proxyConfig=void 0;let d=n?`${n.id}@${n.version}`:`${o.document.name}@${o.document.version}`,f=new l_(t,d,i,o.document.tags?.projectId,o.document.tags?.solutionId,s,c),h=(t.debugConfig?.isRunningInDesigner??!1)||(t.debugConfig?.enableVerboseDataLogging??!1);return await f_.ServerlessWorkflowExecutor.execute(o,t,r,{expressionHandlers:{[f_.ExpressionLanguage.JavaScript]:t_.getInstance({diffEnabled:h})},logger:f,commandStream$:u,traceContextProvider:Dx(),...a?{workflowResolver:a}:{},...l?{workflowFile:l}:{}},t.processConfig?.jobKey)};var Tn={Successful:"Successful",Faulted:"Faulted",Stopped:"Stopped"};var xa=Ke(Oe()),Ma=Ke(ir());var dt=Ke(ir());pw();var Xo=Ke(ir()),cQ="#Wrapper",uQ="#Retry",lQ=[cQ,uQ],dQ=o=>{let t=lQ.find(r=>o.endsWith(r));return t?o.slice(0,-t.length):o},p_=class{retries=new Map;onTaskEvent(t,r){let e=r?.taskId;if(!e||r?.taskType!==Xo.TaskType.TRY)return;let n=dQ(e);switch(t){case Xo.TaskEvent.TASK_STARTED:this.retries.set(n,0);break;case Xo.TaskEvent.TASK_RETRIED:this.retries.set(n,r?.retry?.attempt??(this.retries.get(n)??0)+1);break;case Xo.TaskEvent.TASK_COMPLETED:case Xo.TaskEvent.TASK_FAILED:case Xo.TaskEvent.TASK_STOPPED:this.retries.delete(n);break;default:break}}snapshot(){let t={};for(let[r,e]of this.retries)t[r]={iterationIndex:e};return t}reset(){this.retries.clear()}};var _w=class extends Error{isStop=!0;constructor(){super((0,dt.t)(dt.ErrorKeys.WORKFLOW_STOPPED_BY_USER)),this.name="WorkflowStoppedError"}};var fQ=new Set(["taskId","taskType","workflowId","workflowRunId","timestamp","isPaused","breakpointId","executionTimeMs","logLevel","loopContext","subWorkflow"]),hw=o=>{if(!o)return;let t={name:o.name,message:o.message,stack:o.stack},r=o;return r.type!==void 0&&(t.type=r.type),r.status!==void 0&&(t.status=r.status),r.title!==void 0&&(t.title=r.title),r.detail!==void 0&&(t.detail=r.detail),r.instance!==void 0&&(t.instance=r.instance),r.data!==void 0&&(t.data=r.data),r.originatingTaskName!==void 0&&(t.originatingTaskName=r.originatingTaskName),r.originatingWorkflow!==void 0&&(t.originatingWorkflow=r.originatingWorkflow),t},h_=class o{static MAX_PAYLOAD_BYTES=5*1024*1024;static SMALL_FIELD_BYTES=4*1024;seq=0;loopContextData={};retryTracker=new p_;terminalEmitted=!1;connection;stopState;constructor(t,r){this.connection=t,this.stopState=r}currentLoopContext(){return structuredClone({...this.loopContextData,...this.retryTracker.snapshot()})}stampLoopContext(t){return{...t,loopContext:this.currentLoopContext()}}emit(t,r){let e={...r,seq:this.seq++};this.connection.send({eventName:t,payload:this.guardPayloadSize(t,e)})}guardPayloadSize(t,r){let e=new Map,n=2,i=0;for(let[d,f]of Object.entries(r)){let h;try{let m=o.jsonValueByteLength(f,o.MAX_PAYLOAD_BYTES);if(m===void 0){e.set(d,0);continue}h=m}catch{h=1/0}e.set(d,h);let _=(i>0?1:0)+o.jsonStringByteLength(d,o.MAX_PAYLOAD_BYTES)+1;!Number.isFinite(h)||n>o.MAX_PAYLOAD_BYTES-_-h?n=1/0:n+=_+h,i++}if(n<=o.MAX_PAYLOAD_BYTES)return r;let s={},c=[];for(let[d,f]of Object.entries(r))(e.get(d)??1/0)<=o.SMALL_FIELD_BYTES?s[d]=f:c.push(d);if(c.includes("data")){let d=o.pickEssentialLogData(r.data);d&&(s.data=d)}let u=Number.isFinite(n)?(n/(1024*1024)).toFixed(2):">5.00",a=(o.MAX_PAYLOAD_BYTES/(1024*1024)).toFixed(0),l={...s,dropped:!0,reason:"payload_size_exceeded_limit",droppedFields:c,message:`${t} payload dropped because it exceeded ${a}MB (original size: ${u}MB)`};return s.message!==void 0&&(l.originalMessage=s.message),l}static pickEssentialLogData(t){if(t===null||typeof t!="object")return;let r=t,e={};for(let n of fQ)o.isSmallField(r[n])&&(e[n]=r[n]);return Object.keys(e).length>0?e:void 0}static isSmallField(t){if(t===void 0)return!1;try{let r=o.jsonValueByteLength(t,o.SMALL_FIELD_BYTES);return r!==void 0&&r<=o.SMALL_FIELD_BYTES}catch{return!1}}static jsonStringByteLength(t,r){let e=4;for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);if(i===34||i===92)e+=4;else if(i<=31)e+=i===8||i===9||i===10||i===12||i===13?3:7;else if(i>=55296&&i<=56319){let s=t.charCodeAt(n+1);s>=56320&&s<=57343?(e+=4,n++):e+=7}else i>=56320&&i<=57343?e+=7:e+=i<128?1:i<2048?2:3;if(e>r)return r+1}return e}static jsonValueByteLength(t,r,e=new Set,n="",i=!0){if(i&&t!==null&&typeof t=="object"){let c=t.toJSON;if(typeof c=="function")return this.jsonValueByteLength(c.call(t,n),r,e,n,!1)}if(t===null)return 4;switch(typeof t){case"string":return this.jsonStringByteLength(t,r);case"boolean":return t?4:5;case"number":{let c=Number.isFinite(t)?String(t):"null";return c.length>r?r+1:c.length}case"bigint":throw new TypeError("BigInt is not JSON serializable");case"undefined":case"function":case"symbol":return}let s=t;if(s instanceof Number||s instanceof String||s instanceof Boolean)return this.jsonValueByteLength(s.valueOf(),r,e,n,!1);if(Object.prototype.toString.call(s)==="[object BigInt]")throw new TypeError("BigInt is not JSON serializable");if(e.has(s))throw new TypeError("Circular structure is not JSON serializable");e.add(s);try{if(Array.isArray(s)){let a=2;for(let l=0;l<s.length;l++){if(l>0&&a++,a>r)return r+1;let d=r-a,h=this.jsonValueByteLength(s[l],d,e,String(l))??4;if(h>d)return r+1;a+=h}return a}let c=2,u=0;for(let a in s){if(!Object.prototype.hasOwnProperty.call(s,a))continue;let l=s[a],d=this.jsonValueByteLength(l,r-c,e,a);if(d===void 0)continue;let f=(u>0?1:0)+this.jsonStringByteLength(a,Math.max(0,r-c))+1;if(f>r-c||d>r-c-f)return r+1;c+=f+d,u++}return c}finally{e.delete(s)}}logWorkflowEvent(t,r,e){return t===dt.WorkflowEvent.WORKFLOW_STARTED&&(this.loopContextData={},this.retryTracker.reset()),this.terminalEmitted&&t===dt.WorkflowEvent.WORKFLOW_FAILED||this.emit(Rt.WorkflowEvent,{event:t,data:this.stampLoopContext(r),error:hw(e)}),Promise.resolve()}logTaskEvent(t,r,e){return this.terminalEmitted&&(t===dt.TaskEvent.TASK_FAILED||t===dt.TaskEvent.TASK_STOPPED)?Promise.resolve():t===dt.TaskEvent.TASK_STARTED&&this.stopState?.requested?(this.terminalEmitted||(this.stopState.reason!=="peer-disconnect"?this.emitStopped(r.taskId):this.emitPeerDisconnectFailure()),Promise.reject(new _w)):(this.retryTracker.onTaskEvent(t,r),this.emit(Rt.TaskEvent,{event:t,data:this.stampLoopContext(r),error:hw(e)}),(t===dt.TaskEvent.TASK_COMPLETED||t===dt.TaskEvent.TASK_FAILED)&&delete this.loopContextData[r.taskId],Promise.resolve())}emitStopped(t){this.terminalEmitted=!0,this.emit(Rt.WorkflowEvent,{event:dt.WorkflowEvent.WORKFLOW_STOPPED,data:this.stampLoopContext({stoppedAtTaskId:t,reason:(0,dt.t)(dt.ErrorKeys.WORKFLOW_STOPPED_BY_USER)})})}emitPeerDisconnectFailure(){this.terminalEmitted||(this.terminalEmitted=!0,this.emit(Rt.WorkflowEvent,{event:dt.WorkflowEvent.WORKFLOW_FAILED,data:this.stampLoopContext({}),error:{name:"PeerDisconnected",message:(0,dt.t)(dt.ErrorKeys.DEBUG_PEER_DISCONNECTED)}}))}logEvent(t,r){return this.terminalEmitted||this.emit(Rt.UserLog,{event:t,data:this.stampLoopContext(r)}),Promise.resolve()}logIterationVariables(t,r,e){let n=this.loopContextData[t];return n?n.iterationIndex++:this.loopContextData[t]={iterationIndex:0},Promise.resolve()}debug(t,r){return this.sendLog("debug",t,r)}info(t,r){return this.sendLog("info",t,r)}warn(t,r){return this.sendLog("warn",t,r)}error(t,r,e){return this.sendLog("error",t,r,e)}sendLog(t,r,e,n){return this.terminalEmitted||this.emit(Rt.AppInsights,{kind:"log",level:t,message:r,data:e,error:hw(n)}),Promise.resolve()}shutdown(){return Promise.resolve()}};var Kc=Ke(ir()),Wx=Ke(sg());function pQ(o){if(!o||typeof o!="object")return;let t=o;return typeof t.taskId!="string"||t.taskId.length===0||typeof t.isEnabled!="boolean"?void 0:{id:typeof t.id=="string"&&t.id.length>0?t.id:t.taskId,taskId:t.taskId,isEnabled:t.isEnabled}}function qx(o){if(!o||typeof o!="object"||Array.isArray(o))return{};let t={};for(let[r,e]of Object.entries(o)){if(!Array.isArray(e))continue;let n=[];for(let i of e){let s=pQ(i);s&&n.push(s)}t[r]=n}return t}function Ux(o,t){let r=new Wx.Subject,e={requested:!1},n,i,s=new Promise((v,b)=>{n=v,i=b}),c=!1,u=new h_(o,e),a=null,l=()=>{a!==null&&(clearTimeout(a),a=null)},d=()=>{c||(c=!0,n({breakpoints:{},supportsChunkedEnvelopes:!1}))},f=()=>{e.requested||(e.requested=!0,e.reason="peer-disconnect",u.emitPeerDisconnectFailure(),d(),r.next({command:Kc.WorkflowCommandEvent.Resume,payload:void 0}))},h=()=>{t!==void 0&&(l(),a=setTimeout(()=>{a=null,f()},t))},_=(v,b)=>{o.onCommand(v,g=>{l(),b(g)})};return _("Start",v=>{if(c){console.warn("Start command received more than once; ignoring duplicate");return}c=!0;let b=v??{};n({breakpoints:qx(b.Breakpoints),supportsChunkedEnvelopes:b.SupportsChunkedEnvelopes===!0})}),_("Resume",()=>{r.next({command:Kc.WorkflowCommandEvent.Resume,payload:void 0})}),_("SetBreakpoints",v=>{r.next({command:Kc.WorkflowCommandEvent.SetBreakpoints,payload:qx(v)})}),_("Stop",()=>{e.requested=!0,e.reason="user",d(),r.next({command:Kc.WorkflowCommandEvent.Resume,payload:void 0})}),_("Hello",()=>{}),_("PeerShutdown",()=>{f()}),{commandStream$:r,stopState:e,logger:u,awaitStart:v=>v===void 0?s:new Promise((b,g)=>{let w=setTimeout(()=>{i(new Error(`Did not receive Start command within ${v}ms`))},v);s.then(T=>{clearTimeout(w),b(T)},T=>{clearTimeout(w),g(T)})}),onPeerDisconnected:h}}var LQ=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,FQ="/orchestrator_/signalr/robotdebug",Rw=6e4,qQ=6e4;function WQ(o,t,r,e){try{let n=(0,xa.addPathComponentsToUrl)(o,[t,r,FQ]);return(0,xa.addQueryParamsToUrl)(n,{sessionId:e})}catch(n){throw new Error(`Failed to build DebugHub URL from baseUrl=${o}: ${(0,xa.getErrorMessage)(n)}`)}}var UQ=(o,t,r)=>{let e=(0,Ma.t)(Ma.ErrorKeys.DEBUG_START_TIMEOUT,{timeoutMs:r});return o.send({eventName:Rt.WorkflowEvent,payload:{event:Ma.WorkflowEvent.WORKFLOW_FAILED,data:{},error:{name:"StartTimeout",message:e},seq:0}}),{status:Tn.Faulted,outputArguments:null,id:t,info:e}};async function wM(o,t,r){let e=o.debugSessionId;if(typeof e!="string"||!LQ.test(e))throw new Error("Debug job is missing a valid runtimeContext.debugSessionId (UUID); StudioWeb must pre-generate it before job start.");let n=WQ(o.baseUrl,o.organizationId,o.tenantId,e),{SignalRDebugConnection:i}=await gM().then(()=>bM),s=new i(n,()=>o.accessToken),c=Ux(s,qQ);t.push(c.logger),s.onPeerDisconnected(c.onPeerDisconnected),await s.start(),s.send({eventName:Rt.Ready,payload:{}});let u;try{u=await c.awaitStart(Rw)}catch(a){return console.error(`Debug session aborted: Start not received within ${Rw}ms`,a),{debugConnection:s,stopState:c.stopState,commandStream$:c.commandStream$,breakpoints:{},earlyResult:UQ(s,r,Rw)}}return u.supportsChunkedEnvelopes&&s.enableChunking(),{debugConnection:s,stopState:c.stopState,commandStream$:c.commandStream$,breakpoints:u.breakpoints}}import TM from"node:http";function $Q(o){for(let t=0;t<o.length;t++){let r=o.charCodeAt(t);if(r<32||r>126||r===34||r===92)return!1}return!0}function EM(o){let t=[],r=[],e=`HEAVYBODY_${crypto.randomUUID()}_`,i=JSON.stringify(o,(_,m)=>{if(typeof m=="string"&&m.length>=1e6&&$Q(m)){let v=`${e}${t.length}_`;return t.push(m),r.push(v),v}return m});if(t.length===0||i===void 0)return i;let s=[];for(let _=0;_<r.length;_++){let m=i.indexOf(r[_]);if(m===-1||i.indexOf(r[_],m+1)!==-1)return JSON.stringify(o);s.push({pos:m,token:r[_],value:t[_]})}s.sort((_,m)=>_.pos-m.pos);let c=new TextEncoder,u=[],a=0,l=0;for(let _ of s){let m=c.encode(i.slice(a,_.pos));u.push(m),l+=m.length+_.value.length,a=_.pos+_.token.length}let d=c.encode(i.slice(a));l+=d.length;let f=new Uint8Array(l),h=0;for(let _=0;_<s.length;_++){f.set(u[_],h),h+=u[_].length;let{written:m}=c.encodeInto(s[_].value,f.subarray(h));if(m!==s[_].value.length)throw new Error(`encodeResultBody: short write while splicing heavy string ${_}: wrote ${m} of ${s[_].value.length} bytes at offset ${h}`);h+=m}return f.set(d,h),f}var N_=class{socketPath;serverlessJobId;agent;constructor(t,r){this.socketPath=t,this.serverlessJobId=r,this.agent=new TM.Agent({keepAlive:!0})}post(t,r){let e=t.includes("{serverlessJobId}")?t.replace("{serverlessJobId}",this.serverlessJobId):t,n=EM(r);return new Promise((i,s)=>{let c=TM.request({socketPath:this.socketPath,path:e,method:"POST",agent:this.agent,headers:{"Content-Type":"application/json"}},u=>{u.resume(),u.on("end",()=>{let a=u.statusCode??0;if(a>=200&&a<300){i();return}s(new Error(`Socket communication failed: Socket Server returned error: HTTP ${a}: ${u.statusMessage}`))}),u.on("error",a=>{s(new Error(`Socket communication failed: ${a.message}`))})});c.on("error",u=>{s(new Error(`Socket communication failed: ${u.message}`))}),c.end(n)})}close(){this.agent.destroy()}};var D_=class{socketService;constructor(t,r){this.socketService=new N_(t,r)}async sendResult(t){return await this.socketService.post("/api/jobs/{serverlessJobId}/result",{id:t.id,status:t.status,outputArguments:t.outputArguments,info:t.info}),!0}async sendTelemetryEvent(t){await this.socketService.post("/api/jobs/{serverlessJobId}/telemetry/customevents",t)}async sendTelemetryTrace(t){await this.socketService.post("/api/jobs/{serverlessJobId}/telemetry/traces",t)}async sendLog(t){await this.socketService.post("/api/jobs/{serverlessJobId}/logs",t)}reportPeakMemoryUsage(t){return Promise.resolve()}async close(){this.socketService.close()}};var uu=Ke(xw());var SM=Ke(xw()),Ca="Never called: CoreIPC generates the real IJobInvocationApi methods",au=class{SetResult(t,r){throw new Error(Ca)}SendLog(t,r){throw new Error(Ca)}SendTelemetryEvent(t,r){throw new Error(Ca)}SendTelemetryTrace(t,r){throw new Error(Ca)}ReportPeakMemoryUsage(t,r){throw new Error(Ca)}GetUserAccessToken(t){throw new Error(Ca)}};SM.ipc.$service({endpoint:"IJobInvocationApi"})(au);import{open as BQ,unlink as HQ}from"node:fs/promises";var VQ=1e6,zQ=32*1024,KQ=64*1024;function YQ(o){for(let t=0;t<o.length;t++){let r=o.charCodeAt(t);if(r<32||r>126||r===34||r===92)return!1}return!0}function*L_(o,t){let r=0;for(;r<t.length;){let e=Math.min(r+zQ,t.length),n=t.charCodeAt(e-1);e<t.length&&e-1>r&&n>=55296&&n<=56319&&(e-=1),yield o.encode(t.slice(r,e)),r=e}}function*JQ(o,t,r){let e=0;for(;e<t.length;){let n=Math.min(e+r.length,t.length),{read:i,written:s}=o.encodeInto(t.slice(e,n),r);yield r.subarray(0,s),e+=i}}async function*GQ(o){let t=new TextEncoder,r=[],e=[],n=`__uipath_output_splice_${crypto.randomUUID()}__`,s=JSON.stringify(o,(l,d)=>{if(typeof d=="string"&&d.length>=VQ&&YQ(d)){let f=`${n}${r.length}__`;return r.push(d),e.push(f),f}return d});if(s===void 0){yield t.encode("null");return}if(r.length===0){yield*L_(t,s);return}let c=[];for(let l=0;l<e.length;l++){let d=s.indexOf(e[l]);if(d===-1||s.indexOf(e[l],d+1)!==-1){yield*L_(t,JSON.stringify(o));return}c.push({position:d,token:e[l],text:r[l]})}c.sort((l,d)=>l.position-d.position);let u=new Uint8Array(KQ),a=0;for(let l of c)yield*L_(t,s.slice(a,l.position)),yield*JQ(t,l.text,u),a=l.position+l.token.length;yield*L_(t,s.slice(a))}var cu=class extends Error{maxBytes;constructor(t){super(`The workflow output arguments exceed the maximum allowed size of ${t} bytes. Reduce the size of the returned data, or write large content to a file and return a file reference instead.`),this.maxBytes=t,this.name="OutputArgumentsTooLargeError"}};async function OM(o,t,r){let e=r!==void 0&&r>0?r:1/0,n=await BQ(o,"w"),i=0;try{for await(let s of GQ(t)){if(i+=s.length,i>e)throw new cu(e);await n.write(s)}await n.close()}catch(s){throw await n.close().catch(()=>{}),await HQ(o).catch(()=>{}),s}}var F_=class{proxy;ipcEndpoint;_serverlessJobId;outputFile;constructor(t,r,e){this.ipcEndpoint=t,this._serverlessJobId=r,this.outputFile=e,this.proxy=uu.ipc.proxy.withAddress(uu.ipc.namedPipe(t)).withService(au)}async sendResult(t){let r=await this.spillOutputArguments(t.outputArguments);return r.rejected!==void 0?await this.proxy.SetResult(this._serverlessJobId,{id:t.id,status:Tn.Faulted,outputArguments:null,info:r.rejected}):await this.proxy.SetResult(this._serverlessJobId,{id:t.id,status:t.status,outputArguments:r.filePath===void 0?t.outputArguments:void 0,outputArgumentsFilePath:r.filePath,info:t.info})}async spillOutputArguments(t){if(this.outputFile===void 0)return{};try{return await OM(this.outputFile.filePath,t,this.outputFile.maxBytes),{filePath:this.outputFile.filePath}}catch(r){return r instanceof cu?(console.error(r.message),{rejected:r.message}):(console.error("Failed to write the output arguments file; sending them inline:",r),{})}}async sendTelemetryEvent(t){await this.proxy.SendTelemetryEvent(this._serverlessJobId,t)}async sendTelemetryTrace(t){await this.proxy.SendTelemetryTrace(this._serverlessJobId,t)}async sendLog(t){await this.proxy.SendLog(this._serverlessJobId,t)}async reportPeakMemoryUsage(t){await this.proxy.ReportPeakMemoryUsage(this._serverlessJobId,t)}async close(){await uu.ipc.disposeChannel(uu.ipc.namedPipe(this.ipcEndpoint))}};var kn=Ke(ir());Pw();var XQ=250,QQ=1e3,ZQ=500,eZ=.85,tZ=.8,rZ=1e4,ar=o=>`${(o/1048576).toFixed(1)} MB`,q_=(o,t)=>`${(o/1048576).toFixed(1)}/${ar(t)}`,W_=class{timer;peak={rss:0,heapTotal:0,heapUsed:0,external:0};peakSinceLastLine=0;lastLineRss=0;lastLineAt=0;lastReportAt=0;lastReportedRss=0;reportInFlight;aboveCritical=!1;lastCriticalAt=0;reportEnabled;finalized=!1;opts;constructor(t){this.opts=t,this.reportEnabled=t.reportEnabled}start(){let t=process.memoryUsage();this.lastLineAt=Date.now(),this.lastLineRss=t.rss,this.track(t),this.timer=setInterval(()=>this.sample(),XQ),j_(this.timer)}onTaskCompleted(t,r){if(!this.opts.trackActivityMemory||this.finalized)return;let e=process.memoryUsage();this.track(e);let n=e.rss-this.lastLineRss,i=`${n<0?"-":"+"}${ar(Math.abs(n))}`;this.emitLine(kn.LogLevel.INFO,`[memory] after '${t}'${r?" (failed)":""}: rss ${this.formatRss(e.rss)} (${i}, peak during ${ar(this.peakSinceLastLine)}), heap ${q_(e.heapUsed,e.heapTotal)}, external ${ar(e.external)}`,e)}async finalize(){if(!this.finalized){this.finalized=!0,this.timer!==void 0&&clearInterval(this.timer),this.track(process.memoryUsage());try{await this.opts.jobApi.sendLog({Message:`[memory] job peak: rss ${this.formatRss(this.peak.rss)}, heap ${q_(this.peak.heapUsed,this.peak.heapTotal)}, external ${ar(this.peak.external)}`,LogLevel:kn.LogLevel.INFO})}catch(t){console.debug("[memory] failed to send summary log:",t)}await this.reportInFlight,await this.report()}}sample(){if(this.finalized)return;let t=Date.now(),r=process.memoryUsage();this.track(r),this.checkCritical(t,r),this.opts.trackActivityMemory&&t-this.lastLineAt>=ZQ&&this.emitLine(kn.LogLevel.INFO,`[memory] rss ${this.formatRss(r.rss)}, peak ${ar(this.peakSinceLastLine)}, heap ${q_(r.heapUsed,r.heapTotal)}, external ${ar(r.external)}`,r),this.reportEnabled&&t-this.lastReportAt>=QQ&&this.peak.rss>this.lastReportedRss&&(this.lastReportAt=t,this.report())}checkCritical(t,r){if(this.opts.memoryLimit<=0)return;let e=r.rss/this.opts.memoryLimit;if(this.aboveCritical&&e<tZ){this.aboveCritical=!1;return}e>=eZ&&(!this.aboveCritical||t-this.lastCriticalAt>=rZ)&&(this.aboveCritical=!0,this.lastCriticalAt=t,this.emitLine(kn.LogLevel.WARN,`[memory] rss ${ar(r.rss)} is ${Math.round(e*100)}% of the ${ar(this.opts.memoryLimit)} limit (peak ${ar(this.peakSinceLastLine)}, heap ${q_(r.heapUsed,r.heapTotal)}, external ${ar(r.external)})`,r))}track(t){t.rss>this.peak.rss&&(this.peak={...t}),t.rss>this.peakSinceLastLine&&(this.peakSinceLastLine=t.rss)}emitLine(t,r,e){this.lastLineAt=Date.now(),this.lastLineRss=e.rss,this.peakSinceLastLine=e.rss,this.opts.jobApi.sendLog({Message:r,LogLevel:t}).catch(n=>console.debug("[memory] failed to send log line:",n))}formatRss(t){return this.opts.memoryLimit<=0?ar(t):`${ar(t)} (${Math.round(t/this.opts.memoryLimit*100)}% of limit)`}async report(){if(!(!this.reportEnabled||this.reportInFlight)){this.reportInFlight=this.send();try{await this.reportInFlight}finally{this.reportInFlight=void 0}}}async send(){let t=this.peak;try{await this.opts.jobApi.reportPeakMemoryUsage({rss:t.rss,details:{HeapTotal:String(t.heapTotal),HeapUsed:String(t.heapUsed),External:String(t.external)}}),this.lastReportedRss=t.rss}catch(r){this.reportEnabled=!1,console.debug("[memory] peak report failed, disabling reports:",r)}}},U_=class{monitor;constructor(t){this.monitor=t}logTaskEvent(t,r,e){return(t===kn.TaskEvent.TASK_COMPLETED||t===kn.TaskEvent.TASK_FAILED||t===kn.TaskEvent.TASK_STOPPED)&&this.monitor.onTaskCompleted(r.displayName||r.taskId,t!==kn.TaskEvent.TASK_COMPLETED),Promise.resolve()}logWorkflowEvent(t,r,e){return Promise.resolve()}logEvent(t,r){return Promise.resolve()}logIterationVariables(t,r,e){return Promise.resolve()}shutdown(){return Promise.resolve()}debug(t,r){return Promise.resolve()}info(t,r){return Promise.resolve()}warn(t,r){return Promise.resolve()}error(t,r,e){return Promise.resolve()}};var Pr=Ke(ir());import{Buffer as nZ}from"node:buffer";import{createReadStream as oZ}from"node:fs";import{lstat as iZ,readdir as sZ,realpath as aZ}from"node:fs/promises";import{join as cZ}from"node:path";var uZ=10*1024*1024,lZ="workflow-runtime-",dZ={realpath:o=>aZ(o),readdir:(o,t)=>sZ(o,t),lstat:o=>iZ(o),readFile:async(o,t)=>{let r=[];for await(let e of oZ(o,{start:0,end:t-1}))r.push(e);return nZ.concat(r)}};function kM(o){let t=o?.code;return typeof t=="string"?t:o?.name??"unknown"}function fZ(o){let t=o;return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.document=="object"&&t.document!==null&&Array.isArray(t.do)}function PM(o){let t=o.fileSystem??dZ,r=o.maxFileBytes??uZ,e=o.log??(()=>{}),n=new Set((o.deniedFileNames??[]).map(u=>u.toLowerCase())),i=u=>{let a=u.toLowerCase();return n.has(a)||a.startsWith(lZ)},s,c=()=>(s??=(async()=>{try{let u=await t.realpath(o.root),a=await t.readdir(u,{withFileTypes:!0});return{directory:u,files:new Set(a.filter(l=>l.isFile()).map(l=>l.name))}}catch(u){let a=kM(u);if(e(`Workflow files could not be listed (${a})`),a==="ENOENT"||a==="ENOTDIR"||a==="NotFound")return;throw s=void 0,new Pr.WorkflowDefinitionLoadError("unreadable")}})(),s);return{async resolve(u){if((0,Pr.getInvalidWorkflowNameReason)(u.name))return;let a=(0,Pr.getWorkflowFileName)(u.name);if(i(a))return;let l=await c();if(!l?.files.has(a))return;let d=cZ(l.directory,a),f;try{let _=await t.lstat(d);if(!_.isFile())return;if(_.size>r)throw new Pr.WorkflowDefinitionLoadError("too_large");let m=await t.readFile(d,r+1);if(m.length>r)throw new Pr.WorkflowDefinitionLoadError("too_large");f=new TextDecoder().decode(m)}catch(_){throw _ instanceof Pr.WorkflowDefinitionLoadError?_:(e(`Workflow '${u.name}' could not be read (${kM(_)})`),new Pr.WorkflowDefinitionLoadError("unreadable"))}let h;try{h=JSON.parse(f)}catch{throw new Pr.WorkflowDefinitionLoadError("invalid_json")}if(!fZ(h))throw new Pr.WorkflowDefinitionLoadError("invalid_definition");return{file:a,definition:h}}}}var mZ="workflow-runtime-input-arguments.json",vZ="workflow-runtime-internal-arguments.json",yZ="workflow-runtime-context.json";async function $_(o){try{let t=await pZ(o,"utf8");return JSON.parse(t)}catch(t){throw console.error(`Error reading file ${o}`,t),new Error(`Error reading file ${o}`)}}var RM=o=>{if(!o||typeof o!="object")return!1;let t=o;return typeof t.ID=="string"&&t.ID.length>0&&typeof t.FullName=="string"&&t.FullName.length>0&&typeof t.MimeType=="string"&&t.MimeType.length>0},bZ=o=>{if(RM(o))return o;if(o&&typeof o=="object"){for(let t of Object.values(o))if(RM(t))return t}},gZ=/^[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*$/,wZ=o=>{for(let t of o){let r=t.charCodeAt(0);if(r<32||r===127)return!0}return!1},EZ=o=>{let t=o.indexOf(";"),r=(t===-1?o:o.slice(0,t)).trim();if(!gZ.test(r))return"application/octet-stream";let e=t===-1?"":o.slice(t);return wZ(e)?r:`${r}${e}`},TZ=o=>{let t="";for(let r of o){let e=r.charCodeAt(0);e<32||e===127||r==='"'||r==="\\"||r==="/"||(t+=r)}return t.trim()||"download"},IM=(o,t)=>{let r={status:o.status===Qr.WorkflowJobStatus.Successful?Tn.Successful:Tn.Faulted,outputArguments:o.data,id:t,info:o.errorMessage||void 0},e=bZ(o.data);return e&&(r.isFileResponse=!0,r.contentType=EZ(e.MimeType),r.contentDisposition=`attachment; filename="${TZ(e.FullName)}"`,r.attachmentId=e.ID),r},SZ=o=>({status:Tn.Stopped,outputArguments:null,id:o,info:(0,Qr.t)(Qr.ErrorKeys.WORKFLOW_STOPPED_BY_USER)}),OZ=o=>({status:Tn.Faulted,outputArguments:null,id:o,info:(0,Qr.t)(Qr.ErrorKeys.DEBUG_PEER_DISCONNECTED)});function xM(o){return o.isStudioDebugContext===!0&&typeof o.debugSessionId=="string"&&o.debugSessionId.length>0}function kZ(o,t){return{organizationId:o.organizationId,tenantId:o.tenantId,accessToken:o.accessToken,baseUrl:o.baseUrl,source:o.source||"ApiWorkflows",userId:o.userKey,subscriptionType:o.subscriptionPlanCode,processConfig:{processKey:o.processKey,folderKey:o.folderKey,jobKey:o.jobKey,robotKey:o.robotKey,isStudioDebugContext:o.isStudioDebugContext},...xM(o)&&{debugConfig:{isRunningInDesigner:!1,runInDebugMode:!0,enableVerboseDataLogging:!0}},telemetryConfig:{traceId:o.traceId,parentSpanId:o.spanId||""},tracingConfig:{traceId:o.platformTraceId,parentSpanId:o.platformParentSpanId||"",tracingToken:o.traceStoreAccessToken,enableUserLogs:!0,enableIoLogs:!0},resourceOverwrites:t.resourceOverwrites||{},automationEdgeFqdn:o.automationEdgeFqdn,licensingContext:t.licensingContext||void 0}}function PZ(o){return o.jobApiEndpoint?{transport:o.jobApiTransport,endpoint:o.jobApiEndpoint}:o.jobApiSocketPath?{transport:"http",endpoint:o.jobApiSocketPath}:{transport:o.jobApiTransport,endpoint:void 0}}function AZ(o){if(o.useOutputFile===!0){if(typeof o.outputArgumentsFilePath!="string"||o.outputArgumentsFilePath.length===0){console.error("useOutputFile is set but no outputArgumentsFilePath was granted; sending the output inline.");return}return{filePath:o.outputArgumentsFilePath,maxBytes:o.maxOutputFileSize}}}function RZ(o,t,r,e){if(o==="ipc"&&t)return new F_(t,r,e);if(o==="http"&&t)return new D_(t,r);console.error(`No valid transport configured (transport=${o}, endpoint=${t}). Telemetry will not be sent.`)}function IZ(o,t,r){if(t?.requested===!0)return t.reason==="peer-disconnect"?OZ(r):SZ(r);let e=(0,B_.getErrorMessage)(o);return(0,Qr.isWorkflowError)(o)&&o.detail&&(e+=`. ${o.detail}`),IM({status:Qr.WorkflowJobStatus.Faulted,data:null,errorMessage:e},r)}var xZ=async(o,t,r)=>{if(t&&o){try{await t.sendResult(o),console.log("Job result sent to host")}catch(e){console.error("Failed to send job result to host:",e)}try{await t.close()}catch(e){console.debug("Transport cleanup error:",e)}}if(r)try{await r.stop()}catch(e){console.error("Failed to stop debug SignalR connection:",e)}};async function MZ(){console.log(dx());let o=await $_(Mw(process.cwd(),yZ)),t=o.id,r,e,n,i,s={id:t,status:Tn.Faulted,outputArguments:null,info:"workflow runtime exited before producing a result"};try{let c=await $_(Mw(process.cwd(),mZ)),u=await $_(Mw(process.cwd(),vZ)),a=process.argv[2];console.log("Workflow file path:",a);let l=(0,B_.redactObjectPaths)(o,["accessToken","traceStoreAccessToken"]);console.log("workflowRuntimeContext:",JSON.stringify(l)),console.log("bindingsAndResourceOverrides:",JSON.stringify(u));let d=await $_(a),f=kZ(o,u),h=PM({root:hZ(_Z(a)),deniedFileNames:o.outputArgumentsFilePath?[AM(o.outputArgumentsFilePath)]:[],log:w=>console.warn(w)}),{transport:_,endpoint:m}=PZ(o);r=RZ(_,m,t,AZ(o));let v=[];r&&(o.supportsPeakMemoryReport===!0||o.trackActivityMemory===!0)&&(e=new W_({jobApi:r,reportEnabled:o.supportsPeakMemoryReport===!0,memoryLimit:o.memoryLimit??0,trackActivityMemory:o.trackActivityMemory===!0}),e.start(),o.trackActivityMemory===!0&&v.push(new U_(e)));let b;if(xM(o)){let w=await wM(o,v,t);if(n=w.debugConnection,i=w.stopState,b=w.commandStream$,w.earlyResult)return s=w.earlyResult,s;f.debugConfig.breakpoints=w.breakpoints}let g=await Lx(d,f,c,{releasePackage:o.packageId?{id:o.packageId,version:o.packageVersion||"0.0.1"}:void 0,jobApi:r,licensingContext:u.licensingContext||void 0,additionalLoggers:v,commandStream$:b,workflowResolver:h,workflowFile:AM(a)});console.log("Workflow execution completed."),s=IM(g,t)}catch(c){console.error("Error executing workflow:",c),s=IZ(c,i,t)}finally{await e?.finalize(),await xZ(s,r,n)}return s}import.meta.main&&MZ().then(()=>{process.exit(0)}).catch(o=>{console.error("Unhandled error:",o),process.exit(1)});export{OZ as buildPeerDisconnectExecResult,SZ as buildStoppedExecResult,kZ as buildWorkflowConfig,xZ as finalizeJobExecution,xM as isDebugHubSession,MZ as main,IZ as mapErrorToResult,AZ as resolveOutputFileSpill};
|
|
1641
|
+
`}async testEvaluatePlainJsExpression(t){return(await this.evaluateSanitizedExpressionsInternal(new Set([t]))).get(t)}};var Or=Ke(ir()),dw=Ke(Oe());var r_=Ke(Oe()),n_=Ke(ir()),Xi=class{static sanitizeData(t,r){if(!t)return{sanitizedData:t,sanitizedError:this.sanitizeError(r)};let e;try{e=(0,r_.removeObjectPaths)(t,["context","input","output","variables","properties"])}catch(i){console.error("Error sanitizing data:",i),e=t}let n=this.sanitizeError(r);return{sanitizedData:e,sanitizedError:n}}static sanitizeError(t){if(t)try{if((0,n_.isWorkflowError)(t)){let r=t.getData(),e=(0,r_.redactObjectPaths)(r,["cause.headers","cause.request"]);return new n_.WorkflowError(t.title,t.status,t.type,t.instance,t.detail,e,{originatingTaskName:t.originatingTaskName,originatingWorkflow:t.originatingWorkflow,fatal:t.fatal})}else{let r=new Error(t.message);r.stack=t.stack;for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r}}catch(r){return console.error("Error sanitizing error:",r),t}}};var _x=Ke(Qv()),mx=Ke(Oe()),vx=Ke(Oe()),BX="X-UiPath-Licensing-Context",HX="/lease_/api/usageEvent",VX="Is.Activities",zX=1,KX="Vertical",YX=!1;function JX(o){return _x.default.utc(o).format("YYYY-MM-DDTHH:mm:ss.SSS")+"0000Z"}function ow(o){if(o)try{let t=o.split(";");for(let r of t){let e=r.indexOf("=");if(e===-1)continue;let n=r.substring(0,e).trim(),i=r.substring(e+1).trim();if(n==="transactionType"&&i)return i}return}catch(t){console.error("LicensingService: Failed to parse licensing context:",t);return}}var o_=class{licensingContext;organizationId;tenantId;accessToken;baseUrl;source;constructor(t,r){this.licensingContext=r||"",this.organizationId=t.organizationId,this.tenantId=t.tenantId,this.accessToken=t.tracingConfig?.tracingToken||"",this.baseUrl=t.baseUrl,this.source=t.source}async reportHttpTaskConsumption(t){if(!YX||!this.licensingContext||ow(this.licensingContext)!==KX)return;if(!this.accessToken){console.error("LicensingService: No access token available for licensing consumption reporting");return}let r=this.buildLeaseRequest(t),e=(0,mx.addPathComponentsToUrl)(this.baseUrl,[this.organizationId,HX,this.organizationId]);try{let n=await fetch(e,{method:"PUT",body:JSON.stringify(r),headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json",[BX]:this.licensingContext},signal:AbortSignal.timeout(5e3)}),i=await n.text();if(n.ok)console.log("LicensingService: Consumption reported successfully.");else{let s=`Licensing API failed: ${n.status} ${n.statusText} - ${i}`;throw console.error(`LicensingService: ${s}`),new Error(s)}}catch(n){let s=n instanceof DOMException&&n.name==="TimeoutError"?"LicensingService: Request timed out after 5s":`LicensingService: Failed to report consumption: ${(0,vx.getErrorMessage)(n)}`;throw console.error(s),new Error(s)}}buildLeaseRequest(t){let r=t.displayName||"N/A",e=[{k:"count",v:"1"},{k:"activityType",v:"HTTP"},{k:"activityDisplayName",v:r.substring(0,255)},{k:"source",v:this.source}];return{nonce:t.nonce,referenceId:t.referenceId,usage:1,consumedAt:JX(new Date),organizationId:this.organizationId,context:{tenantId:this.tenantId,operationCode:VX},rawData:{formula:zX,Params:e}}}};var Cx=Ke(ir()),jx=Ke(Oe());async function yx(o,t,r,e,n,i="v2",s=""){let c=i==="v3"?"api/Traces/v3/spans":"api/Traces/spans",u=s.replace(/^\/+|\/+$/g,""),a=u?`${u}/${c}`:c,l=new URL(`${o.replace(/\/$/,"")}/${a}`);return l.searchParams.set("traceId",r),l.searchParams.set("source",e),fetch(l.toString(),{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)})}function GX(o){let t=globalThis.crypto;if(t?.getRandomValues===void 0)throw new Error("Web Crypto API is unavailable; @uipath/tracing requires globalThis.crypto (browser, Node >= 20, or Deno).");let r=new Uint8Array(o);return t.getRandomValues(r),Array.from(r,e=>e.toString(16).padStart(2,"0")).join("")}var bx={generate(){return GX(8)},fromUuid(o){return o.replace(/-/g,"").slice(16).toLowerCase()},toUuid(o){if(o.length!==16)throw new Error(`Invalid OTEL span ID length: ${o.length}`);let t=o.padStart(32,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`},isValid(o){return o.length===16&&/^[0-9a-fA-F]{16}$/.test(o)}};var i_;(function(o){o[o.Unset=0]="Unset",o[o.Ok=1]="Ok",o[o.Error=2]="Error",o[o.Running=3]="Running",o[o.Restricted=4]="Restricted",o[o.Cancelled=5]="Cancelled"})(i_||(i_={}));var Yr;(function(o){o[o.Testing=0]="Testing",o[o.Agents=1]="Agents",o[o.ProcessOrchestration=2]="ProcessOrchestration",o[o.ApiWorkflows=3]="ApiWorkflows",o[o.Robots=4]="Robots",o[o.ConversationalAgentsService=5]="ConversationalAgentsService",o[o.IntegrationServiceTrigger=6]="IntegrationServiceTrigger",o[o.Playground=7]="Playground",o[o.Governance=8]="Governance",o[o.IXPUnstructuredAndComplexDocuments=9]="IXPUnstructuredAndComplexDocuments",o[o.CodedAgents=10]="CodedAgents",o[o.IXPCommunicationsMining=11]="IXPCommunicationsMining",o[o.EnterpriseContextService=12]="EnterpriseContextService",o[o.MCP=13]="MCP",o[o.A2A=14]="A2A",o[o.Serverless=15]="Serverless",o[o.DocumentUnderstanding=16]="DocumentUnderstanding"})(Yr||(Yr={}));var Vc;(function(o){o[o.Verbose=0]="Verbose",o[o.Trace=1]="Trace",o[o.Information=2]="Information",o[o.Warning=3]="Warning",o[o.Error=4]="Error",o[o.Critical=5]="Critical",o[o.Off=6]="Off"})(Vc||(Vc={}));var s_;(function(o){o[o.Debug=0]="Debug",o[o.Runtime=1]="Runtime"})(s_||(s_={}));var Oa;(function(o){o[o.Orchestrator=0]="Orchestrator",o[o.LLMOps=1]="LLMOps",o[o.IDP=2]="IDP"})(Oa||(Oa={}));var zc;(function(o){o[o.None=0]="None",o[o.In=1]="In",o[o.Out=2]="Out"})(zc||(zc={}));var gx;(function(o){o[o.Pending=0]="Pending",o[o.Approved=1]="Approved",o[o.Dismissed=2]="Dismissed"})(gx||(gx={}));var wx;(function(o){o[o.Enabled=0]="Enabled",o[o.Disabled=1]="Disabled"})(wx||(wx={}));var Ex;(function(o){o[o.Episodic=0]="Episodic",o[o.Escalation=1]="Escalation"})(Ex||(Ex={}));var Tx;(function(o){o.Hybrid="Hybrid",o.Semantic="Semantic"})(Tx||(Tx={}));var Sx;(function(o){o[o.Allow=0]="Allow",o[o.PartialBlock=1]="PartialBlock",o[o.Block=2]="Block"})(Sx||(Sx={}));function aw(o){return{id:o.id??bx.generate(),traceId:o.traceId,parentId:o.parentId,name:o.name,spanType:o.spanType,attributes:JSON.stringify(sw(o.attributes)),status:i_[o.status],organizationId:o.organizationId,tenantId:o.tenantId,folderKey:o.folderKey,source:Yr[o.source],startTime:iw(o.startTime),endTime:o.endTime!==void 0?iw(o.endTime):void 0,updatedAt:iw(o.updatedAt),verbosityLevel:Vc[o.verbosityLevel??Vc.Information],executionType:o.executionType!==void 0?s_[o.executionType]:void 0,agentVersion:o.agentVersion,processKey:o.processKey,jobKey:o.jobKey,referenceId:o.agentId,attachments:o.attachments?.map(r=>({provider:Oa[r.provider],id:r.id,fileName:r.fileName,mimeType:r.mimeType,direction:zc[r.direction??zc.None]})),context:XX(o.baggage)}}function XX(o){if(o===void 0)return;let t=o.toReferenceHierarchy();if(t.length!==0)return{referenceHierarchy:t.map(r=>({serviceType:r.serviceType,referenceId:r.referenceId,version:r.version}))}}function iw(o){return typeof o=="string"?o:o.toISOString()}function sw(o){if(Array.isArray(o))return o.map(sw);if(o!==null&&typeof o=="object"&&!(o instanceof Date)){let t={};for(let[r,e]of Object.entries(o))e!=null&&(t[r]=sw(e));return t}return o}var cw="1.0.0";var kx="x-uipath-tracebaggage",ka={Type:"ref.type",Id:"ref.id",Version:"ref.v"},Ox=class o{static Empty=new o([]);_entries;constructor(t){this._entries=t}get entries(){return this._entries}get length(){return this._entries.length}add(t){let r=new Map,e=t instanceof Map?t.entries():Object.entries(t);for(let[i,s]of e){if(typeof i!="string"||i.trim()==="")throw new Error("Property keys must be non-empty strings.");if(typeof s!="string")throw new Error(`Property '${i}' must have a string value.`);r.set(i,s)}if(r.size===0)throw new Error("Properties must contain at least one key.");let n={properties:r};return new o([...this._entries,n])}addReference(t,r,e){if(typeof t!="string"||t.trim()==="")throw new Error("serviceType must be a non-empty string.");if(typeof r!="string"||r.trim()==="")throw new Error("referenceId must be a non-empty string.");let n={[ka.Type]:t,[ka.Id]:r};return e!=null&&e.trim()!==""&&(n[ka.Version]=e),this.add(n)}toReferenceHierarchy(){let t=[];for(let r of this._entries){let e=QX(r);e!==void 0&&t.push(e)}return t}toHeaderValue(){if(this._entries.length===0)return"";let t=[];for(let r of this._entries){let n=Array.from(r.properties.keys()).sort().map(i=>`${i}=${r.properties.get(i)}`).join(";");t.push(n)}return t.join(",")}static fromHeaderValue(t){if(t==null)return o.Empty;let r=t.trim();if(r==="")return o.Empty;let e=[];for(let n of r.split(",")){let i=n.trim();if(i==="")continue;let s=new Map;for(let c of i.split(";")){let u=c.trim();if(u==="")continue;let a=u.indexOf("=");if(a<=0||a>=u.length-1)continue;let l=u.slice(0,a).trim(),d=u.slice(a+1).trim();l===""||d===""||s.set(l,d)}s.size>0&&e.push({properties:s})}return e.length===0?o.Empty:new o(e)}};function QX(o){if(o==null)throw new Error("entry is required");let t=o.properties.get(ka.Type),r=o.properties.get(ka.Id);if(!t||!r||!eQ(r))return;let e=o.properties.get(ka.Version);return{serviceType:t,referenceId:r,version:e}}var ZX=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function eQ(o){return ZX.test(o)}var En=class extends Error{statusCode;constructor(t,r){super(t),this.statusCode=r,this.name="LLMOpsClientError"}},a_=class{config;constructor(t){this.config=t}resolveUrl(t){let r=this.config.organizationId;if(!r)return t;let e=r;return this.config.tenantId&&(e+=`/${this.config.tenantId}`),e+="/llmopstenant_",`${e}/${t}`}async executeCore(t,r,e,n){let s=`${this.config.baseUrl.replace(/\/$/,"")}/${r}`,{extraHeaders:c}=n??{},u;for(let a=0;a<3;a++){try{let l=await this.config.getToken(),d={method:t,headers:{Authorization:`Bearer ${l}`,"X-SDK-Version":cw,...e!==void 0?{"Content-Type":"application/json"}:{},...c},...e!==void 0?{body:JSON.stringify(e)}:{}},f=await fetch(s,d);if(f.ok)return f;if(f.status>=400&&f.status<500)throw new En(`HTTP ${f.status}`,f.status);u=new En(`HTTP ${f.status} (attempt ${a+1})`,f.status)}catch(l){if(l instanceof En&&l.statusCode!==void 0&&l.statusCode<500)throw l;u=l}a<2&&await Rx(1e3*Math.pow(2,a))}throw u instanceof Error?u:new En("Request failed after 3 attempts")}async executeJson(t,r,e){return(await this.executeCore(t,r,e)).json()}async executeVoid(t,r,e){await this.executeCore(t,r,e)}async publishSpans(t,r,e){let n=e??r[0]?.source??Yr.Agents,i=r[0],s=nQ(i?.organizationId,i?.tenantId),c=r.map(aw),u,a;try{a=await Promise.resolve().then(()=>(Ax(),Px))}catch{a=void 0}if(a!==void 0){let d=a.BaggageContextAccessor.get();d!==void 0&&d.length>0&&(u=d.toHeaderValue())}let l;for(let d=0;d<3;d++){try{let h={Authorization:`Bearer ${await this.config.getToken()}`,"X-SDK-Version":cw};u!==void 0&&(h[kx]=u);let _=await yx(this.config.baseUrl,c,t,xx(n),h,this.config.apiVersion??"v2",s);if(_.ok)return;if(_.status>=400&&_.status<500)throw new En(`HTTP ${_.status}`,_.status);l=new En(`HTTP ${_.status} (attempt ${d+1})`,_.status)}catch(f){if(f instanceof En&&f.statusCode!==void 0&&f.statusCode<500)throw f;l=f}d<2&&await Rx(1e3*Math.pow(2,d))}throw l instanceof Error?l:new En("Failed to publish spans after 3 attempts")}async publishSpansBatch(t,r){let e=t.map(aw),n=(this.config.apiVersion??"v2")==="v3"?"api/Traces/v3/spans/batch":"api/Traces/spans/batch",i=this.resolveUrl(`${n}?source=${encodeURIComponent(xx(r))}`);return this.executeJson("POST",i,e)}async getSpans(t,r=1e3,e=!1){let n=this.resolveUrl(`api/Traces/v2/spans?traceId=${encodeURIComponent(t)}&pageSize=${r}&isHistorical=${e}`),i=await this.executeCore("GET",n),s=await i.json(),c=i.headers.get("X-Continuation-Token")??i.headers.get("x-continuation-token")??void 0;return{spans:s,continuationToken:c}}async getOtelSpans(t,r=1e3,e=!1){if((this.config.apiVersion??"v2")!=="v3"){let n=this.resolveUrl(`api/Traces/v2/spans/otel?traceId=${encodeURIComponent(t)}&pageSize=${r}&isHistorical=${e}`),i=await this.executeCore("GET",n),s=await i.json(),c=i.headers.get("X-Continuation-Token")??i.headers.get("x-continuation-token")??void 0;return{spans:s?.spans??[],continuationToken:c}}return this.getOtelSpansV3(t,e)}async getOtelSpansV3(t,r){let e=[],n="";for(;;){let i=this.resolveUrl(`api/Traces/v3/spans?traceId=${encodeURIComponent(t)}&pageSize=500&isHistorical=${r}`),s=n?{"X-UiPath-Trace-Tokens":n}:void 0,c=await this.executeCore("GET",i,void 0,{extraHeaders:s}),u=await c.json(),a=u.Spans??u.spans??[];if(e.push(...a),n=c.headers.get("X-UiPath-Trace-Tokens")??"",!n)break}return{spans:e}}async getSpansByIds(t,r){let e=this.resolveUrl(`api/Traces/v2/spans/byIds?traceId=${encodeURIComponent(t)}`);return this.executeJson("POST",e,r)}async getOtelSpansByIds(t,r){if((this.config.apiVersion??"v2")!=="v3"){let e=this.resolveUrl(`api/Traces/v2/spans/otel/byIds?traceId=${encodeURIComponent(t)}`);return this.executeJson("POST",e,r)}return this.getOtelSpansByIdsV3(t,r)}async getOtelSpansByIdsV3(t,r){let e=this.resolveUrl(`api/Traces/v3/spans/byIds?traceId=${encodeURIComponent(t)}`),n=await this.executeJson("POST",e,r);return Array.isArray(n)?n:n.Spans??n.spans??[]}async getSpansByReferenceId(t,r={}){let e=new URLSearchParams;r.serviceType!==void 0&&e.set("serviceType",r.serviceType),r.version!==void 0&&e.set("version",r.version),r.pageNumber!==void 0&&e.set("pageNumber",String(r.pageNumber)),r.pageSize!==void 0&&e.set("pageSize",String(r.pageSize)),r.startTime!==void 0&&e.set("startTime",r.startTime instanceof Date?r.startTime.toISOString():r.startTime),r.endTime!==void 0&&e.set("endTime",r.endTime instanceof Date?r.endTime.toISOString():r.endTime),r.traceId!==void 0&&e.set("traceId",r.traceId);let n=e.toString(),i=this.resolveUrl(`api/Traces/v3/spans/reference/${encodeURIComponent(t)}${n?`?${n}`:""}`);return this.executeJson("GET",i)}createFeedback(t){return this.executeJson("POST",this.resolveUrl("api/Feedback"),t)}editFeedback(t,r){return this.executeJson("POST",this.resolveUrl(`api/Feedback/${t}`),r)}deleteFeedback(t){return this.executeVoid("DELETE",this.resolveUrl(`api/Feedback/${t}`))}getFeedback(t){return this.executeJson("GET",this.resolveUrl(`api/Feedback/${t}`))}listFeedback(t){let r=rQ(t);return this.executeJson("GET",this.resolveUrl(`api/Feedback${r}`))}getFeedbackMemoryLinks(t){return this.executeJson("GET",this.resolveUrl(`api/Feedback/memoryLinks?traceId=${encodeURIComponent(t)}`))}searchFeedbackByTraceIds(t){return this.executeJson("POST",this.resolveUrl("api/Feedback/search"),t)}createFeedbackCategory(t){return this.executeJson("POST",this.resolveUrl("api/Feedback/category"),t)}listFeedbackCategories(t=0,r=100,e,n){let i=`?skip=${t}&take=${r}`;return e!==void 0&&(i+=`&isPositive=${e}`),n!==void 0&&(i+=`&isNegative=${n}`),this.executeJson("GET",this.resolveUrl(`api/Feedback/category${i}`))}deleteFeedbackCategory(t,r=!1){return this.executeVoid("DELETE",this.resolveUrl(`api/Feedback/category/${t}?forceDelete=${r}`))}createMemoryItem(t,r){return this.executeJson("POST",this.resolveUrl(`api/Memory/${t}/items`),r)}listMemoryItems(t,r=0,e=100,n=!1){let i=`?skip=${r}&take=${e}`;return n&&(i+="&expand=span"),this.executeJson("GET",this.resolveUrl(`api/Memory/${t}/items${i}`))}getMemoryItem(t,r,e=!1){let n=e?"?expand=span":"";return this.executeJson("GET",this.resolveUrl(`api/Memory/${t}/items/${r}${n}`))}updateMemoryItem(t,r,e){return this.executeJson("PATCH",this.resolveUrl(`api/Memory/${t}/items/${r}`),e)}deleteMemoryItem(t,r){return this.executeVoid("DELETE",this.resolveUrl(`api/Memory/${t}/items/${r}`))}bulkDeleteMemoryItems(t,r){return this.executeVoid("DELETE",this.resolveUrl(`api/Memory/${t}/items`),{memoryItemIds:r})}deleteMemorySpace(t){return this.executeVoid("DELETE",this.resolveUrl(`api/Memory/${t}`))}searchMemory(t,r){return this.executeJson("POST",this.resolveUrl(`api/Memory/${t}/search`),r)}};function rQ(o){if(!o)return"";let t=[];return t.push(`skip=${o.skip??0}`),t.push(`take=${o.take??100}`),o.agentId&&t.push(`agentId=${encodeURIComponent(o.agentId)}`),o.agentVersion&&t.push(`agentVersion=${encodeURIComponent(o.agentVersion)}`),o.status!==void 0&&t.push(`status=${o.status}`),o.traceId&&t.push(`traceId=${encodeURIComponent(o.traceId)}`),o.spanId&&t.push(`spanId=${encodeURIComponent(o.spanId)}`),`?${t.join("&")}`}function Rx(o){return new Promise(t=>setTimeout(t,o))}var Ix="00000000-0000-0000-0000-000000000000";function nQ(o,t){if(!o||o===Ix)return"";let r=o;return t&&t!==Ix&&(r+=`/${t}`),`${r}/llmopstenant_`}function xx(o){return Yr[o]??String(o)}var lw="00000000-0000-0000-0000-000000000000";function Mx(o){let{organizationId:t,tenantId:r,folderKey:e,processKey:n,jobKey:i}=o.jobContext;if(!e||e.toLowerCase()===lw)throw new Error(`toSdkSpan: missing folderKey. TraceId: ${o.traceId}, JobKey: ${i}`);return{id:o.id,traceId:o.traceId,parentId:o.parentId||void 0,name:o.name,spanType:o.spanType,attributes:o.attributes??{},status:o.status,source:Yr.ApiWorkflows,startTime:o.startTime,endTime:o.endTime,updatedAt:o.updatedAt,organizationId:t,tenantId:r,folderKey:e,processKey:n,jobKey:i,attachments:o.attachments?.map(s=>({provider:Oa.LLMOps,id:s.id,fileName:s.fileName,mimeType:s.mimeType}))}}var c_=class{traceId;traceViewDataFormatter;injectedPublisher;lazyPublisher;workflowConfig;constructor(t,r,e){this.workflowConfig=t,this.traceViewDataFormatter=new Cx.TraceViewDataFormatter(t,r),this.traceId=this.traceViewDataFormatter.traceId,this.injectedPublisher=e}getPublisher(){return this.injectedPublisher?this.injectedPublisher:(this.lazyPublisher||(this.lazyPublisher=new a_({baseUrl:this.workflowConfig.baseUrl,getToken:()=>Promise.resolve(this.workflowConfig.tracingConfig?.tracingToken??""),apiVersion:"v3"})),this.lazyPublisher)}async sendSpans(t){if(!this.workflowConfig.tracingConfig?.tracingToken||t.length===0){console.log(`TraceViewLogger: ${this.workflowConfig.tracingConfig?.tracingToken?"No spans to flush":"No trace view token"}`);return}let r=this.workflowConfig.processConfig?.folderKey;if(!r||r.toLowerCase()===lw){console.error(`TraceViewLogger: skipping v3 ingest \u2014 missing/empty folderKey. JobKey: ${this.workflowConfig.processConfig?.jobKey}`);return}console.log(`TraceViewLogger: Flushing ${t.length} spans to trace view...`);try{let e=t.map(Mx);await this.getPublisher().publishSpans(this.traceId,e,Yr.ApiWorkflows),console.log(`TraceViewLogger: Updated ${e.length} spans to trace view. TraceId: ${this.traceId}, JobKey: ${this.workflowConfig.processConfig?.jobKey}`)}catch(e){let n=`Error: TraceViewLogger: Failed to send spans to trace view, TraceId: ${this.traceId}, JobKey: ${this.workflowConfig.processConfig?.jobKey}: ${(0,jx.getErrorMessage)(e)}`;throw console.error(n),new Error(n)}}formatWorkflowLog(t,r,e){return this.traceViewDataFormatter.formatWorkflowLog(t,r,e)}formatTaskLog(t,r,e){return this.traceViewDataFormatter.formatTaskLog(t,r,e)}formatUserLog(t,r,e){return this.traceViewDataFormatter.formatUserLog(t,r,e)}};var Jo={Information:"Information",Warning:"Warning",Error:"Error"};var Gn={TELEMETRY_EVENT:"telemetry_event",TELEMETRY_TRACE:"telemetry_trace",USER_LOG:"user_log"},Go=class{static createEventDto(t,r,e,n,i,s){try{let c=r==="task"?t.formatTaskLog(e,n,s):t.formatWorkflowLog(e,n,s);return c?{name:c.name,eventTime:new Date().toISOString(),jobKey:i,properties:c.properties||{}}:(console.error(`Error: Failed to format ${r} log data:`,{event:e,data:JSON.stringify(n),error:s}),null)}catch(c){return console.error(`Failed to create ${r} event DTO:`,{error:c,event:e,data:JSON.stringify(n)}),null}}static createTraceDto(t,r,e,n,i){try{let s={};return n&&Object.keys(n).length>0?Object.entries(n).forEach(([c,u])=>{s[c]=typeof u=="object"?JSON.stringify(u):String(u)}):i&&(t=t+" "+i.message,i.message&&(s.message=i.message),i.name&&(s.name=i.name),i.stack&&(s.stack=i.stack),Object.entries(i).forEach(([c,u])=>{u!=null&&(s[c]=typeof u=="object"?JSON.stringify(u):String(u))})),{message:t,severityLevel:r,eventTime:new Date().toISOString(),jobKey:e,properties:s}}catch(s){return console.error("Failed to create trace DTO:",{error:s,message:t,severity:r,data:JSON.stringify(n)}),null}}static createJobLogDto(t){try{return{Message:String(t.message),LogLevel:t.logLevel}}catch(r){return console.error("Failed to create job log DTO:",{error:r,data:JSON.stringify(t)}),null}}};var u_=class{logLevel;workflowId;workflowName;constructor(t,r,e){this.logLevel=t,this.workflowId=r,this.workflowName=e}async logWorkflowEvent(t,r,e){await this.logEventToConsole(t,r,e)}async logTaskEvent(t,r,e){await this.logEventToConsole(t,r,e)}logIterationVariables(){return Promise.resolve()}async logEvent(t,r){return Promise.resolve()}async logEventToConsole(t,r,e){let n={workflowName:this.workflowName,...r&&{data:r}};if(e)return this.error(`Event: ${t}`,n,e),Promise.resolve();await this.info(`Event: ${t}`,n)}async debug(t,r){this.shouldLog("debug")&&await this.log("debug",t,r)}async info(t,r){this.shouldLog("info")&&await this.log("info",t,r)}async warn(t,r){this.shouldLog("warn")&&await this.log("warn",t,r)}shutdown(){return Promise.resolve()}async error(t,r,e){await this.log("error",t,r,e)}shouldLog(t){let r=["debug","info","warn","error"];return r.indexOf(t)>=r.indexOf(this.logLevel)}log(t,r,e,n){try{let i={message:r,workflowId:this.workflowId,workflowName:this.workflowName,level:t,logTime:new Date().toISOString(),...n&&{error:{name:n.name,message:n.title||n.message,type:n.type,stack:n.detail||n.stack,status:n.status}},...e&&{data:e}};return console[t](JSON.stringify(i)),Promise.resolve()}catch(i){return console.error("Failed to log message:",r,i),Promise.resolve()}}};var l_=class{loggers;rawDataLoggers;ORPHANED_USER_LOGS_TASK_ID="unknown";jobApi;telemetryDataFormatter;traceViewService;licensingService;licensingContext;OrchestratorJobId;totalSocketDurationMs=0;totalTraceViewDurationMs=0;spans=[];userLogDataWithTaskIds=new Map;workflowConfig;SPAN_BATCH_SIZE=5;SPAN_BATCH_INTERVAL_MS=3e3;MAX_SPAN_DATA_SIZE_BYTES=1024*1024;lastSpanFlushTime=Date.now();lastSpanFlushTaskCount=0;taskCount=0;constructor(t,r,e,n,i,s,c){this.loggers=[new u_(t.debugConfig?.isRunningInDesigner?"debug":"info",r,r)],this.rawDataLoggers=c??[],this.jobApi=e,this.workflowConfig=t,this.traceViewService=new c_(t,r),this.licensingService=new o_(t,s),this.licensingContext=s,this.telemetryDataFormatter=new Or.TelemetryDataFormatter(t.organizationId,t.tenantId,t.telemetryConfig?.traceId,t.telemetryConfig?.parentSpanId,t.userId,t.subscriptionType,t.source,n,i,t.processConfig?.isStudioDebugContext,t.processConfig?.folderKey,t.processConfig?.jobKey),this.OrchestratorJobId=t.processConfig?.jobKey}async logWorkflowEvent(t,r,e){let{sanitizedData:n,sanitizedError:i}=Xi.sanitizeData(r,e),s=this.loggers.map(l=>l.logWorkflowEvent(t,n,i)),c=this.rawDataLoggers.map(l=>l.logWorkflowEvent(t,r,e));if(await Promise.all([...s,...c]),t===Or.WorkflowEvent.WORKFLOW_STARTED)return Promise.resolve();let u=this.traceViewService.formatWorkflowLog(t,r,e);this.spans.push(u),await this.flushSpansIfNeeded(),this.addUserLogsToTraceViewSpans(this.ORPHANED_USER_LOGS_TASK_ID,u.id),await this.sendTraceViewData(this.spans),this.userLogDataWithTaskIds.clear(),this.updateWorkflowExecutionTimes(n);let a=Go.createEventDto(this.telemetryDataFormatter,"workflow",t,n,this.OrchestratorJobId,i);await this.sendTelemetryData(a,Gn.TELEMETRY_EVENT)}async logTaskEvent(t,r,e){let{sanitizedData:n,sanitizedError:i}=Xi.sanitizeData(r,e),s=this.loggers.map(v=>v.logTaskEvent(t,n,i)),c=this.rawDataLoggers.map(v=>v.logTaskEvent(t,r,e));if(await Promise.all([...s,...c]),this.taskCount++,t===Or.TaskEvent.TASK_STARTED||r.taskType===Or.TaskType.DO)return Promise.resolve();let u=Go.createEventDto(this.telemetryDataFormatter,"task",t,n,this.OrchestratorJobId,i),a=t===Or.TaskEvent.TASK_COMPLETED&&r.taskType===Or.TaskType.HTTP&&r.HttpCallMode==="direct"&&!r.isUiPathInternalServiceCall&&!this.workflowConfig.processConfig?.isStudioDebugContext,l=(0,dw.getNewGuid)(),d=(0,dw.getNewGuid)();if(u?.properties&&this.licensingContext&&a){u.properties.LicensingContext=this.licensingContext;let v=ow(this.licensingContext);v&&(u.properties.LicensingTransactionType=v),l&&(u.properties.LicensingNonce=l),d&&(u.properties.LicensingReferenceId=d)}let f=this.sendTelemetryData(u,Gn.TELEMETRY_EVENT),h=a?{...r,licenseRefId:d}:r,_=this.traceViewService.formatTaskLog(t,h,e);this.spans.push(_),await this.flushSpansIfNeeded(),this.addUserLogsToTraceViewSpans(r.taskId,_.id);let m=a&&l&&d?this.reportLicensingConsumption({displayName:r.displayName,nonce:l,referenceId:d}):Promise.resolve();await Promise.all([f,m])}async logEvent(t,r){let e=[...this.loggers.map(s=>s.logEvent(t,r)),...this.rawDataLoggers.map(s=>s.logEvent(t,r))],n=Go.createJobLogDto(r),i=this.sendTelemetryData(n,Gn.USER_LOG);if(this.workflowConfig.tracingConfig?.enableUserLogs){let s=r.taskId||this.ORPHANED_USER_LOGS_TASK_ID;this.userLogDataWithTaskIds.has(s)?this.userLogDataWithTaskIds.get(s)?.push(r):this.userLogDataWithTaskIds.set(s,[r])}await Promise.all([...e,i])}async logIterationVariables(t,r,e){let n=[...this.loggers.map(i=>i.logIterationVariables(t,r,e)),...this.rawDataLoggers.map(i=>i.logIterationVariables(t,r,e))];await Promise.all(n)}async debug(t,r){let{sanitizedData:e}=Xi.sanitizeData(r||{},void 0),n=[...this.loggers.map(i=>i.debug(t,e)),...this.rawDataLoggers.map(i=>i.debug(t,r))];await Promise.all(n)}async info(t,r){await this.logWithTelemetry(t,Jo.Information,r)}async warn(t,r){await this.logWithTelemetry(t,Jo.Warning,r)}async error(t,r,e){await this.logWithTelemetry(t,Jo.Error,r,e)}addUserLogsToTraceViewSpans(t,r){this.userLogDataWithTaskIds.has(t)&&(this.userLogDataWithTaskIds.get(t)?.forEach(n=>{let i=this.traceViewService.formatUserLog(Or.LogEvent.USER_LOG,n,r);this.spans.push(i)}),this.userLogDataWithTaskIds.delete(t))}async logWithTelemetry(t,r,e,n){let{sanitizedData:i,sanitizedError:s}=Xi.sanitizeData(e||{},n),c=(d,f)=>{let h=f?e:i,_=f?n:s;switch(r){case Jo.Information:return d.info(t,h);case Jo.Warning:return d.warn(t,h);case Jo.Error:return d.error(t,h,_);default:return d.info(t,h)}},u=[...this.loggers.map(d=>c(d,!1)),...this.rawDataLoggers.map(d=>c(d,!0))],a=Go.createTraceDto(t,r,this.OrchestratorJobId,i,s),l=this.sendTelemetryData(a,Gn.TELEMETRY_TRACE);await Promise.all([...u,l])}async sendTelemetryData(t,r){if(!t){console.debug(`No DTO provided for ${r}, skipping telemetry`);return}if(!this.jobApi){console.warn(`Job API not available for ${r}`);return}let e=Date.now();try{r===Gn.TELEMETRY_EVENT?await this.jobApi.sendTelemetryEvent(t):r===Gn.TELEMETRY_TRACE?await this.jobApi.sendTelemetryTrace(t):r===Gn.USER_LOG&&await this.jobApi.sendLog(t);let n=Date.now()-e;this.totalSocketDurationMs+=n}catch(n){let i=Date.now()-e;this.totalSocketDurationMs+=i,console.error(`IPC communication failed for ${r}:`,{error:n,dto:JSON.stringify(t),duration:`${i}ms`})}}updateWorkflowExecutionTimes(t){t.executionEndTimeMs=Date.now(),t.executionTimeMs=t.executionEndTimeMs-(t.executionStartTimeMs||0),t.externalExecutionTimeMs=(t.externalExecutionTimeMs||0)+this.totalSocketDurationMs+this.totalTraceViewDurationMs,t.systemExecutionTimeMs=t.executionTimeMs-t.externalExecutionTimeMs;let r={};if(t.externalExecutionBreakdown)try{r=JSON.parse(t.externalExecutionBreakdown)}catch{r={}}this.totalSocketDurationMs>0&&(r.SocketTimeMs=this.totalSocketDurationMs),this.totalTraceViewDurationMs>0&&(r.TraceViewTimeMs=this.totalTraceViewDurationMs),t.externalExecutionBreakdown=JSON.stringify(r)}getSpansSize(){try{let t=JSON.stringify(this.spans);return new Blob([t]).size}catch{return 0}}async flushSpansIfNeeded(){let t=Date.now(),r=t-this.lastSpanFlushTime,e=this.getSpansSize();if((this.spans.length>=this.SPAN_BATCH_SIZE||r>=this.SPAN_BATCH_INTERVAL_MS||e>this.MAX_SPAN_DATA_SIZE_BYTES)&&this.spans.length>0){let i=e>this.MAX_SPAN_DATA_SIZE_BYTES?"size":this.spans.length>=this.SPAN_BATCH_SIZE?"count":"time";console.log(`[MEMORY OPTIMIZATION] Flushing ${this.spans.length} spans (${Math.round(e/1024)} KB) due to ${i}`),await this.sendTraceViewData([...this.spans]),this.spans.length=0,this.lastSpanFlushTime=t,this.lastSpanFlushTaskCount=this.taskCount}}async sendTraceViewData(t){let r=Date.now();try{await this.traceViewService.sendSpans(t);let e=Date.now()-r;this.totalTraceViewDurationMs+=e}catch(e){let n=Date.now()-r;this.totalTraceViewDurationMs+=n,console.error("TraceView service error:",e);let i=Go.createTraceDto("TraceView service failed",Jo.Error,this.OrchestratorJobId,void 0,e);await this.sendTelemetryData(i,Gn.TELEMETRY_TRACE)}}async reportLicensingConsumption(t){try{await this.licensingService.reportHttpTaskConsumption(t)}catch(r){console.error("LicensingService: Error reporting consumption:",r)}}async shutdown(){await Promise.all([...this.loggers.map(t=>t.shutdown()),...this.rawDataLoggers.map(t=>t.shutdown())])}};import{AsyncLocalStorage as oQ}from"node:async_hooks";var d_=class{storage=new oQ;current(){return this.storage.getStore()}runInSpan(t,r){return this.storage.run(t,r)}};var iQ="APIWF_TRACE_CONTEXT_PROPAGATION",sQ=new Set(["1","true"]);function aQ(){let o;try{o=process.env[iQ]}catch{return!1}return sQ.has((o??"").trim().toLowerCase())}var Nx;function Dx(){if(aQ())return Nx??=new d_,Nx}var Lx=async(o,t,r,e={})=>{if(!t)throw new Error("Workflow context is required");let{releasePackage:n,jobApi:i,licensingContext:s,additionalLoggers:c,commandStream$:u,workflowResolver:a,workflowFile:l}=e;t.proxyConfig=void 0;let d=n?`${n.id}@${n.version}`:`${o.document.name}@${o.document.version}`,f=new l_(t,d,i,o.document.tags?.projectId,o.document.tags?.solutionId,s,c),h=(t.debugConfig?.isRunningInDesigner??!1)||(t.debugConfig?.enableVerboseDataLogging??!1);return await f_.ServerlessWorkflowExecutor.execute(o,t,r,{expressionHandlers:{[f_.ExpressionLanguage.JavaScript]:t_.getInstance({diffEnabled:h})},logger:f,commandStream$:u,traceContextProvider:Dx(),...a?{workflowResolver:a}:{},...l?{workflowFile:l}:{}},t.processConfig?.jobKey)};var Tn={Successful:"Successful",Faulted:"Faulted",Stopped:"Stopped"};var xa=Ke(Oe()),Ma=Ke(ir());var dt=Ke(ir());pw();var Xo=Ke(ir()),cQ="#Wrapper",uQ="#Retry",lQ=[cQ,uQ],dQ=o=>{let t=lQ.find(r=>o.endsWith(r));return t?o.slice(0,-t.length):o},p_=class{retries=new Map;onTaskEvent(t,r){let e=r?.taskId;if(!e||r?.taskType!==Xo.TaskType.TRY)return;let n=dQ(e);switch(t){case Xo.TaskEvent.TASK_STARTED:this.retries.set(n,0);break;case Xo.TaskEvent.TASK_RETRIED:this.retries.set(n,r?.retry?.attempt??(this.retries.get(n)??0)+1);break;case Xo.TaskEvent.TASK_COMPLETED:case Xo.TaskEvent.TASK_FAILED:case Xo.TaskEvent.TASK_STOPPED:this.retries.delete(n);break;default:break}}snapshot(){let t={};for(let[r,e]of this.retries)t[r]={iterationIndex:e};return t}reset(){this.retries.clear()}};var _w=class extends Error{isStop=!0;constructor(){super((0,dt.t)(dt.ErrorKeys.WORKFLOW_STOPPED_BY_USER)),this.name="WorkflowStoppedError"}};var fQ=new Set(["taskId","taskType","workflowId","workflowRunId","timestamp","isPaused","breakpointId","executionTimeMs","logLevel","loopContext","subWorkflow"]),hw=o=>{if(!o)return;let t={name:o.name,message:o.message,stack:o.stack},r=o;return r.type!==void 0&&(t.type=r.type),r.status!==void 0&&(t.status=r.status),r.title!==void 0&&(t.title=r.title),r.detail!==void 0&&(t.detail=r.detail),r.instance!==void 0&&(t.instance=r.instance),r.data!==void 0&&(t.data=r.data),r.originatingTaskName!==void 0&&(t.originatingTaskName=r.originatingTaskName),r.originatingWorkflow!==void 0&&(t.originatingWorkflow=r.originatingWorkflow),t},h_=class o{static MAX_PAYLOAD_BYTES=5*1024*1024;static SMALL_FIELD_BYTES=4*1024;seq=0;loopContextData={};retryTracker=new p_;terminalEmitted=!1;connection;stopState;constructor(t,r){this.connection=t,this.stopState=r}currentLoopContext(){return structuredClone({...this.loopContextData,...this.retryTracker.snapshot()})}stampLoopContext(t){return{...t,loopContext:this.currentLoopContext()}}emit(t,r){let e={...r,seq:this.seq++};this.connection.send({eventName:t,payload:this.guardPayloadSize(t,e)})}guardPayloadSize(t,r){let e=new Map,n=2,i=0;for(let[d,f]of Object.entries(r)){let h;try{let m=o.jsonValueByteLength(f,o.MAX_PAYLOAD_BYTES);if(m===void 0){e.set(d,0);continue}h=m}catch{h=1/0}e.set(d,h);let _=(i>0?1:0)+o.jsonStringByteLength(d,o.MAX_PAYLOAD_BYTES)+1;!Number.isFinite(h)||n>o.MAX_PAYLOAD_BYTES-_-h?n=1/0:n+=_+h,i++}if(n<=o.MAX_PAYLOAD_BYTES)return r;let s={},c=[];for(let[d,f]of Object.entries(r))(e.get(d)??1/0)<=o.SMALL_FIELD_BYTES?s[d]=f:c.push(d);if(c.includes("data")){let d=o.pickEssentialLogData(r.data);d&&(s.data=d)}let u=Number.isFinite(n)?(n/(1024*1024)).toFixed(2):">5.00",a=(o.MAX_PAYLOAD_BYTES/(1024*1024)).toFixed(0),l={...s,dropped:!0,reason:"payload_size_exceeded_limit",droppedFields:c,message:`${t} payload dropped because it exceeded ${a}MB (original size: ${u}MB)`};return s.message!==void 0&&(l.originalMessage=s.message),l}static pickEssentialLogData(t){if(t===null||typeof t!="object")return;let r=t,e={};for(let n of fQ)o.isSmallField(r[n])&&(e[n]=r[n]);return Object.keys(e).length>0?e:void 0}static isSmallField(t){if(t===void 0)return!1;try{let r=o.jsonValueByteLength(t,o.SMALL_FIELD_BYTES);return r!==void 0&&r<=o.SMALL_FIELD_BYTES}catch{return!1}}static jsonStringByteLength(t,r){let e=4;for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);if(i===34||i===92)e+=4;else if(i<=31)e+=i===8||i===9||i===10||i===12||i===13?3:7;else if(i>=55296&&i<=56319){let s=t.charCodeAt(n+1);s>=56320&&s<=57343?(e+=4,n++):e+=7}else i>=56320&&i<=57343?e+=7:e+=i<128?1:i<2048?2:3;if(e>r)return r+1}return e}static jsonValueByteLength(t,r,e=new Set,n="",i=!0){if(i&&t!==null&&typeof t=="object"){let c=t.toJSON;if(typeof c=="function")return this.jsonValueByteLength(c.call(t,n),r,e,n,!1)}if(t===null)return 4;switch(typeof t){case"string":return this.jsonStringByteLength(t,r);case"boolean":return t?4:5;case"number":{let c=Number.isFinite(t)?String(t):"null";return c.length>r?r+1:c.length}case"bigint":throw new TypeError("BigInt is not JSON serializable");case"undefined":case"function":case"symbol":return}let s=t;if(s instanceof Number||s instanceof String||s instanceof Boolean)return this.jsonValueByteLength(s.valueOf(),r,e,n,!1);if(Object.prototype.toString.call(s)==="[object BigInt]")throw new TypeError("BigInt is not JSON serializable");if(e.has(s))throw new TypeError("Circular structure is not JSON serializable");e.add(s);try{if(Array.isArray(s)){let a=2;for(let l=0;l<s.length;l++){if(l>0&&a++,a>r)return r+1;let d=r-a,h=this.jsonValueByteLength(s[l],d,e,String(l))??4;if(h>d)return r+1;a+=h}return a}let c=2,u=0;for(let a in s){if(!Object.prototype.hasOwnProperty.call(s,a))continue;let l=s[a],d=this.jsonValueByteLength(l,r-c,e,a);if(d===void 0)continue;let f=(u>0?1:0)+this.jsonStringByteLength(a,Math.max(0,r-c))+1;if(f>r-c||d>r-c-f)return r+1;c+=f+d,u++}return c}finally{e.delete(s)}}logWorkflowEvent(t,r,e){return t===dt.WorkflowEvent.WORKFLOW_STARTED&&(this.loopContextData={},this.retryTracker.reset()),this.terminalEmitted&&t===dt.WorkflowEvent.WORKFLOW_FAILED||this.emit(Rt.WorkflowEvent,{event:t,data:this.stampLoopContext(r),error:hw(e)}),Promise.resolve()}logTaskEvent(t,r,e){return this.terminalEmitted&&(t===dt.TaskEvent.TASK_FAILED||t===dt.TaskEvent.TASK_STOPPED)?Promise.resolve():t===dt.TaskEvent.TASK_STARTED&&this.stopState?.requested?(this.terminalEmitted||(this.stopState.reason!=="peer-disconnect"?this.emitStopped(r.taskId):this.emitPeerDisconnectFailure()),Promise.reject(new _w)):(this.retryTracker.onTaskEvent(t,r),this.emit(Rt.TaskEvent,{event:t,data:this.stampLoopContext(r),error:hw(e)}),(t===dt.TaskEvent.TASK_COMPLETED||t===dt.TaskEvent.TASK_FAILED)&&delete this.loopContextData[r.taskId],Promise.resolve())}emitStopped(t){this.terminalEmitted=!0,this.emit(Rt.WorkflowEvent,{event:dt.WorkflowEvent.WORKFLOW_STOPPED,data:this.stampLoopContext({stoppedAtTaskId:t,reason:(0,dt.t)(dt.ErrorKeys.WORKFLOW_STOPPED_BY_USER)})})}emitPeerDisconnectFailure(){this.terminalEmitted||(this.terminalEmitted=!0,this.emit(Rt.WorkflowEvent,{event:dt.WorkflowEvent.WORKFLOW_FAILED,data:this.stampLoopContext({}),error:{name:"PeerDisconnected",message:(0,dt.t)(dt.ErrorKeys.DEBUG_PEER_DISCONNECTED)}}))}logEvent(t,r){return this.terminalEmitted||this.emit(Rt.UserLog,{event:t,data:this.stampLoopContext(r)}),Promise.resolve()}logIterationVariables(t,r,e){let n=this.loopContextData[t];return n?n.iterationIndex++:this.loopContextData[t]={iterationIndex:0},Promise.resolve()}debug(t,r){return this.sendLog("debug",t,r)}info(t,r){return this.sendLog("info",t,r)}warn(t,r){return this.sendLog("warn",t,r)}error(t,r,e){return this.sendLog("error",t,r,e)}sendLog(t,r,e,n){return this.terminalEmitted||this.emit(Rt.AppInsights,{kind:"log",level:t,message:r,data:e,error:hw(n)}),Promise.resolve()}shutdown(){return Promise.resolve()}};var Kc=Ke(ir()),Wx=Ke(sg());function pQ(o){if(!o||typeof o!="object")return;let t=o;return typeof t.taskId!="string"||t.taskId.length===0||typeof t.isEnabled!="boolean"?void 0:{id:typeof t.id=="string"&&t.id.length>0?t.id:t.taskId,taskId:t.taskId,isEnabled:t.isEnabled}}function qx(o){if(!o||typeof o!="object"||Array.isArray(o))return{};let t={};for(let[r,e]of Object.entries(o)){if(!Array.isArray(e))continue;let n=[];for(let i of e){let s=pQ(i);s&&n.push(s)}t[r]=n}return t}function Ux(o,t){let r=new Wx.Subject,e={requested:!1},n,i,s=new Promise((v,b)=>{n=v,i=b}),c=!1,u=new h_(o,e),a=null,l=()=>{a!==null&&(clearTimeout(a),a=null)},d=()=>{c||(c=!0,n({breakpoints:{},supportsChunkedEnvelopes:!1}))},f=()=>{e.requested||(e.requested=!0,e.reason="peer-disconnect",u.emitPeerDisconnectFailure(),d(),r.next({command:Kc.WorkflowCommandEvent.Resume,payload:void 0}))},h=()=>{t!==void 0&&(l(),a=setTimeout(()=>{a=null,f()},t))},_=(v,b)=>{o.onCommand(v,g=>{l(),b(g)})};return _("Start",v=>{if(c){console.warn("Start command received more than once; ignoring duplicate");return}c=!0;let b=v??{};n({breakpoints:qx(b.Breakpoints),supportsChunkedEnvelopes:b.SupportsChunkedEnvelopes===!0})}),_("Resume",()=>{r.next({command:Kc.WorkflowCommandEvent.Resume,payload:void 0})}),_("SetBreakpoints",v=>{r.next({command:Kc.WorkflowCommandEvent.SetBreakpoints,payload:qx(v)})}),_("Stop",()=>{e.requested=!0,e.reason="user",d(),r.next({command:Kc.WorkflowCommandEvent.Resume,payload:void 0})}),_("Hello",()=>{}),_("PeerShutdown",()=>{f()}),{commandStream$:r,stopState:e,logger:u,awaitStart:v=>v===void 0?s:new Promise((b,g)=>{let w=setTimeout(()=>{i(new Error(`Did not receive Start command within ${v}ms`))},v);s.then(T=>{clearTimeout(w),b(T)},T=>{clearTimeout(w),g(T)})}),onPeerDisconnected:h}}var LQ=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,FQ="/orchestrator_/signalr/robotdebug",Rw=6e4,qQ=6e4;function WQ(o,t,r,e){try{let n=(0,xa.addPathComponentsToUrl)(o,[t,r,FQ]);return(0,xa.addQueryParamsToUrl)(n,{sessionId:e})}catch(n){throw new Error(`Failed to build DebugHub URL from baseUrl=${o}: ${(0,xa.getErrorMessage)(n)}`)}}var UQ=(o,t,r)=>{let e=(0,Ma.t)(Ma.ErrorKeys.DEBUG_START_TIMEOUT,{timeoutMs:r});return o.send({eventName:Rt.WorkflowEvent,payload:{event:Ma.WorkflowEvent.WORKFLOW_FAILED,data:{},error:{name:"StartTimeout",message:e},seq:0}}),{status:Tn.Faulted,outputArguments:null,id:t,info:e}};async function wM(o,t,r){let e=o.debugSessionId;if(typeof e!="string"||!LQ.test(e))throw new Error("Debug job is missing a valid runtimeContext.debugSessionId (UUID); StudioWeb must pre-generate it before job start.");let n=WQ(o.baseUrl,o.organizationId,o.tenantId,e),{SignalRDebugConnection:i}=await gM().then(()=>bM),s=new i(n,()=>o.accessToken),c=Ux(s,qQ);t.push(c.logger),s.onPeerDisconnected(c.onPeerDisconnected),await s.start(),s.send({eventName:Rt.Ready,payload:{}});let u;try{u=await c.awaitStart(Rw)}catch(a){return console.error(`Debug session aborted: Start not received within ${Rw}ms`,a),{debugConnection:s,stopState:c.stopState,commandStream$:c.commandStream$,breakpoints:{},earlyResult:UQ(s,r,Rw)}}return u.supportsChunkedEnvelopes&&s.enableChunking(),{debugConnection:s,stopState:c.stopState,commandStream$:c.commandStream$,breakpoints:u.breakpoints}}import TM from"node:http";function $Q(o){for(let t=0;t<o.length;t++){let r=o.charCodeAt(t);if(r<32||r>126||r===34||r===92)return!1}return!0}function EM(o){let t=[],r=[],e=`HEAVYBODY_${crypto.randomUUID()}_`,i=JSON.stringify(o,(_,m)=>{if(typeof m=="string"&&m.length>=1e6&&$Q(m)){let v=`${e}${t.length}_`;return t.push(m),r.push(v),v}return m});if(t.length===0||i===void 0)return i;let s=[];for(let _=0;_<r.length;_++){let m=i.indexOf(r[_]);if(m===-1||i.indexOf(r[_],m+1)!==-1)return JSON.stringify(o);s.push({pos:m,token:r[_],value:t[_]})}s.sort((_,m)=>_.pos-m.pos);let c=new TextEncoder,u=[],a=0,l=0;for(let _ of s){let m=c.encode(i.slice(a,_.pos));u.push(m),l+=m.length+_.value.length,a=_.pos+_.token.length}let d=c.encode(i.slice(a));l+=d.length;let f=new Uint8Array(l),h=0;for(let _=0;_<s.length;_++){f.set(u[_],h),h+=u[_].length;let{written:m}=c.encodeInto(s[_].value,f.subarray(h));if(m!==s[_].value.length)throw new Error(`encodeResultBody: short write while splicing heavy string ${_}: wrote ${m} of ${s[_].value.length} bytes at offset ${h}`);h+=m}return f.set(d,h),f}var N_=class{socketPath;serverlessJobId;agent;constructor(t,r){this.socketPath=t,this.serverlessJobId=r,this.agent=new TM.Agent({keepAlive:!0})}post(t,r){let e=t.includes("{serverlessJobId}")?t.replace("{serverlessJobId}",this.serverlessJobId):t,n=EM(r);return new Promise((i,s)=>{let c=TM.request({socketPath:this.socketPath,path:e,method:"POST",agent:this.agent,headers:{"Content-Type":"application/json"}},u=>{u.resume(),u.on("end",()=>{let a=u.statusCode??0;if(a>=200&&a<300){i();return}s(new Error(`Socket communication failed: Socket Server returned error: HTTP ${a}: ${u.statusMessage}`))}),u.on("error",a=>{s(new Error(`Socket communication failed: ${a.message}`))})});c.on("error",u=>{s(new Error(`Socket communication failed: ${u.message}`))}),c.end(n)})}close(){this.agent.destroy()}};var D_=class{socketService;constructor(t,r){this.socketService=new N_(t,r)}async sendResult(t){return await this.socketService.post("/api/jobs/{serverlessJobId}/result",{id:t.id,status:t.status,outputArguments:t.outputArguments,info:t.info}),!0}async sendTelemetryEvent(t){await this.socketService.post("/api/jobs/{serverlessJobId}/telemetry/customevents",t)}async sendTelemetryTrace(t){await this.socketService.post("/api/jobs/{serverlessJobId}/telemetry/traces",t)}async sendLog(t){await this.socketService.post("/api/jobs/{serverlessJobId}/logs",t)}reportPeakMemoryUsage(t){return Promise.resolve()}async close(){this.socketService.close()}};var uu=Ke(xw());var SM=Ke(xw()),Ca="Never called: CoreIPC generates the real IJobInvocationApi methods",au=class{SetResult(t,r){throw new Error(Ca)}SendLog(t,r){throw new Error(Ca)}SendTelemetryEvent(t,r){throw new Error(Ca)}SendTelemetryTrace(t,r){throw new Error(Ca)}ReportPeakMemoryUsage(t,r){throw new Error(Ca)}GetUserAccessToken(t){throw new Error(Ca)}};SM.ipc.$service({endpoint:"IJobInvocationApi"})(au);import{open as BQ,unlink as HQ}from"node:fs/promises";var VQ=1e6,zQ=32*1024,KQ=64*1024;function YQ(o){for(let t=0;t<o.length;t++){let r=o.charCodeAt(t);if(r<32||r>126||r===34||r===92)return!1}return!0}function*L_(o,t){let r=0;for(;r<t.length;){let e=Math.min(r+zQ,t.length),n=t.charCodeAt(e-1);e<t.length&&e-1>r&&n>=55296&&n<=56319&&(e-=1),yield o.encode(t.slice(r,e)),r=e}}function*JQ(o,t,r){let e=0;for(;e<t.length;){let n=Math.min(e+r.length,t.length),{read:i,written:s}=o.encodeInto(t.slice(e,n),r);yield r.subarray(0,s),e+=i}}async function*GQ(o){let t=new TextEncoder,r=[],e=[],n=`__uipath_output_splice_${crypto.randomUUID()}__`,s=JSON.stringify(o,(l,d)=>{if(typeof d=="string"&&d.length>=VQ&&YQ(d)){let f=`${n}${r.length}__`;return r.push(d),e.push(f),f}return d});if(s===void 0){yield t.encode("null");return}if(r.length===0){yield*L_(t,s);return}let c=[];for(let l=0;l<e.length;l++){let d=s.indexOf(e[l]);if(d===-1||s.indexOf(e[l],d+1)!==-1){yield*L_(t,JSON.stringify(o));return}c.push({position:d,token:e[l],text:r[l]})}c.sort((l,d)=>l.position-d.position);let u=new Uint8Array(KQ),a=0;for(let l of c)yield*L_(t,s.slice(a,l.position)),yield*JQ(t,l.text,u),a=l.position+l.token.length;yield*L_(t,s.slice(a))}var cu=class extends Error{maxBytes;constructor(t){super(`The workflow output arguments exceed the maximum allowed size of ${t} bytes. Reduce the size of the returned data, or write large content to a file and return a file reference instead.`),this.maxBytes=t,this.name="OutputArgumentsTooLargeError"}};async function OM(o,t,r){let e=r!==void 0&&r>0?r:1/0,n=await BQ(o,"w"),i=0;try{for await(let s of GQ(t)){if(i+=s.length,i>e)throw new cu(e);await n.write(s)}await n.close()}catch(s){throw await n.close().catch(()=>{}),await HQ(o).catch(()=>{}),s}}var F_=class{proxy;ipcEndpoint;job;outputFile;constructor(t,r,e,n){this.ipcEndpoint=t,this.job={jobId:r,resumeVersion:e},this.outputFile=n,this.proxy=uu.ipc.proxy.withAddress(uu.ipc.namedPipe(t)).withService(au)}async sendResult(t){let r=await this.spillOutputArguments(t.outputArguments);return r.rejected!==void 0?await this.proxy.SetResult(this.job,{id:t.id,status:Tn.Faulted,outputArguments:null,info:r.rejected}):await this.proxy.SetResult(this.job,{id:t.id,status:t.status,outputArguments:r.filePath===void 0?t.outputArguments:void 0,outputArgumentsFilePath:r.filePath,info:t.info})}async spillOutputArguments(t){if(this.outputFile===void 0)return{};try{return await OM(this.outputFile.filePath,t,this.outputFile.maxBytes),{filePath:this.outputFile.filePath}}catch(r){return r instanceof cu?(console.error(r.message),{rejected:r.message}):(console.error("Failed to write the output arguments file; sending them inline:",r),{})}}async sendTelemetryEvent(t){await this.proxy.SendTelemetryEvent(this.job,t)}async sendTelemetryTrace(t){await this.proxy.SendTelemetryTrace(this.job,t)}async sendLog(t){await this.proxy.SendLog(this.job,t)}async reportPeakMemoryUsage(t){await this.proxy.ReportPeakMemoryUsage(this.job,t)}async close(){await uu.ipc.disposeChannel(uu.ipc.namedPipe(this.ipcEndpoint))}};var kn=Ke(ir());Pw();var XQ=250,QQ=1e3,ZQ=500,eZ=.85,tZ=.8,rZ=1e4,ar=o=>`${(o/1048576).toFixed(1)} MB`,q_=(o,t)=>`${(o/1048576).toFixed(1)}/${ar(t)}`,W_=class{timer;peak={rss:0,heapTotal:0,heapUsed:0,external:0};peakSinceLastLine=0;lastLineRss=0;lastLineAt=0;lastReportAt=0;lastReportedRss=0;reportInFlight;aboveCritical=!1;lastCriticalAt=0;reportEnabled;finalized=!1;opts;constructor(t){this.opts=t,this.reportEnabled=t.reportEnabled}start(){let t=process.memoryUsage();this.lastLineAt=Date.now(),this.lastLineRss=t.rss,this.track(t),this.timer=setInterval(()=>this.sample(),XQ),j_(this.timer)}onTaskCompleted(t,r){if(!this.opts.trackActivityMemory||this.finalized)return;let e=process.memoryUsage();this.track(e);let n=e.rss-this.lastLineRss,i=`${n<0?"-":"+"}${ar(Math.abs(n))}`;this.emitLine(kn.LogLevel.INFO,`[memory] after '${t}'${r?" (failed)":""}: rss ${this.formatRss(e.rss)} (${i}, peak during ${ar(this.peakSinceLastLine)}), heap ${q_(e.heapUsed,e.heapTotal)}, external ${ar(e.external)}`,e)}async finalize(){if(!this.finalized){this.finalized=!0,this.timer!==void 0&&clearInterval(this.timer),this.track(process.memoryUsage());try{await this.opts.jobApi.sendLog({Message:`[memory] job peak: rss ${this.formatRss(this.peak.rss)}, heap ${q_(this.peak.heapUsed,this.peak.heapTotal)}, external ${ar(this.peak.external)}`,LogLevel:kn.LogLevel.INFO})}catch(t){console.debug("[memory] failed to send summary log:",t)}await this.reportInFlight,await this.report()}}sample(){if(this.finalized)return;let t=Date.now(),r=process.memoryUsage();this.track(r),this.checkCritical(t,r),this.opts.trackActivityMemory&&t-this.lastLineAt>=ZQ&&this.emitLine(kn.LogLevel.INFO,`[memory] rss ${this.formatRss(r.rss)}, peak ${ar(this.peakSinceLastLine)}, heap ${q_(r.heapUsed,r.heapTotal)}, external ${ar(r.external)}`,r),this.reportEnabled&&t-this.lastReportAt>=QQ&&this.peak.rss>this.lastReportedRss&&(this.lastReportAt=t,this.report())}checkCritical(t,r){if(this.opts.memoryLimit<=0)return;let e=r.rss/this.opts.memoryLimit;if(this.aboveCritical&&e<tZ){this.aboveCritical=!1;return}e>=eZ&&(!this.aboveCritical||t-this.lastCriticalAt>=rZ)&&(this.aboveCritical=!0,this.lastCriticalAt=t,this.emitLine(kn.LogLevel.WARN,`[memory] rss ${ar(r.rss)} is ${Math.round(e*100)}% of the ${ar(this.opts.memoryLimit)} limit (peak ${ar(this.peakSinceLastLine)}, heap ${q_(r.heapUsed,r.heapTotal)}, external ${ar(r.external)})`,r))}track(t){t.rss>this.peak.rss&&(this.peak={...t}),t.rss>this.peakSinceLastLine&&(this.peakSinceLastLine=t.rss)}emitLine(t,r,e){this.lastLineAt=Date.now(),this.lastLineRss=e.rss,this.peakSinceLastLine=e.rss,this.opts.jobApi.sendLog({Message:r,LogLevel:t}).catch(n=>console.debug("[memory] failed to send log line:",n))}formatRss(t){return this.opts.memoryLimit<=0?ar(t):`${ar(t)} (${Math.round(t/this.opts.memoryLimit*100)}% of limit)`}async report(){if(!(!this.reportEnabled||this.reportInFlight)){this.reportInFlight=this.send();try{await this.reportInFlight}finally{this.reportInFlight=void 0}}}async send(){let t=this.peak;try{await this.opts.jobApi.reportPeakMemoryUsage({rss:t.rss,details:{HeapTotal:String(t.heapTotal),HeapUsed:String(t.heapUsed),External:String(t.external)}}),this.lastReportedRss=t.rss}catch(r){this.reportEnabled=!1,console.debug("[memory] peak report failed, disabling reports:",r)}}},U_=class{monitor;constructor(t){this.monitor=t}logTaskEvent(t,r,e){return(t===kn.TaskEvent.TASK_COMPLETED||t===kn.TaskEvent.TASK_FAILED||t===kn.TaskEvent.TASK_STOPPED)&&this.monitor.onTaskCompleted(r.displayName||r.taskId,t!==kn.TaskEvent.TASK_COMPLETED),Promise.resolve()}logWorkflowEvent(t,r,e){return Promise.resolve()}logEvent(t,r){return Promise.resolve()}logIterationVariables(t,r,e){return Promise.resolve()}shutdown(){return Promise.resolve()}debug(t,r){return Promise.resolve()}info(t,r){return Promise.resolve()}warn(t,r){return Promise.resolve()}error(t,r,e){return Promise.resolve()}};var Pr=Ke(ir());import{Buffer as nZ}from"node:buffer";import{createReadStream as oZ}from"node:fs";import{lstat as iZ,readdir as sZ,realpath as aZ}from"node:fs/promises";import{join as cZ}from"node:path";var uZ=10*1024*1024,lZ="workflow-runtime-",dZ={realpath:o=>aZ(o),readdir:(o,t)=>sZ(o,t),lstat:o=>iZ(o),readFile:async(o,t)=>{let r=[];for await(let e of oZ(o,{start:0,end:t-1}))r.push(e);return nZ.concat(r)}};function kM(o){let t=o?.code;return typeof t=="string"?t:o?.name??"unknown"}function fZ(o){let t=o;return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.document=="object"&&t.document!==null&&Array.isArray(t.do)}function PM(o){let t=o.fileSystem??dZ,r=o.maxFileBytes??uZ,e=o.log??(()=>{}),n=new Set((o.deniedFileNames??[]).map(u=>u.toLowerCase())),i=u=>{let a=u.toLowerCase();return n.has(a)||a.startsWith(lZ)},s,c=()=>(s??=(async()=>{try{let u=await t.realpath(o.root),a=await t.readdir(u,{withFileTypes:!0});return{directory:u,files:new Set(a.filter(l=>l.isFile()).map(l=>l.name))}}catch(u){let a=kM(u);if(e(`Workflow files could not be listed (${a})`),a==="ENOENT"||a==="ENOTDIR"||a==="NotFound")return;throw s=void 0,new Pr.WorkflowDefinitionLoadError("unreadable")}})(),s);return{async resolve(u){if((0,Pr.getInvalidWorkflowNameReason)(u.name))return;let a=(0,Pr.getWorkflowFileName)(u.name);if(i(a))return;let l=await c();if(!l?.files.has(a))return;let d=cZ(l.directory,a),f;try{let _=await t.lstat(d);if(!_.isFile())return;if(_.size>r)throw new Pr.WorkflowDefinitionLoadError("too_large");let m=await t.readFile(d,r+1);if(m.length>r)throw new Pr.WorkflowDefinitionLoadError("too_large");f=new TextDecoder().decode(m)}catch(_){throw _ instanceof Pr.WorkflowDefinitionLoadError?_:(e(`Workflow '${u.name}' could not be read (${kM(_)})`),new Pr.WorkflowDefinitionLoadError("unreadable"))}let h;try{h=JSON.parse(f)}catch{throw new Pr.WorkflowDefinitionLoadError("invalid_json")}if(!fZ(h))throw new Pr.WorkflowDefinitionLoadError("invalid_definition");return{file:a,definition:h}}}}var mZ="workflow-runtime-input-arguments.json",vZ="workflow-runtime-internal-arguments.json",yZ="workflow-runtime-context.json";async function $_(o){try{let t=await pZ(o,"utf8");return JSON.parse(t)}catch(t){throw console.error(`Error reading file ${o}`,t),new Error(`Error reading file ${o}`)}}var RM=o=>{if(!o||typeof o!="object")return!1;let t=o;return typeof t.ID=="string"&&t.ID.length>0&&typeof t.FullName=="string"&&t.FullName.length>0&&typeof t.MimeType=="string"&&t.MimeType.length>0},bZ=o=>{if(RM(o))return o;if(o&&typeof o=="object"){for(let t of Object.values(o))if(RM(t))return t}},gZ=/^[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*$/,wZ=o=>{for(let t of o){let r=t.charCodeAt(0);if(r<32||r===127)return!0}return!1},EZ=o=>{let t=o.indexOf(";"),r=(t===-1?o:o.slice(0,t)).trim();if(!gZ.test(r))return"application/octet-stream";let e=t===-1?"":o.slice(t);return wZ(e)?r:`${r}${e}`},TZ=o=>{let t="";for(let r of o){let e=r.charCodeAt(0);e<32||e===127||r==='"'||r==="\\"||r==="/"||(t+=r)}return t.trim()||"download"},IM=(o,t)=>{let r={status:o.status===Qr.WorkflowJobStatus.Successful?Tn.Successful:Tn.Faulted,outputArguments:o.data,id:t,info:o.errorMessage||void 0},e=bZ(o.data);return e&&(r.isFileResponse=!0,r.contentType=EZ(e.MimeType),r.contentDisposition=`attachment; filename="${TZ(e.FullName)}"`,r.attachmentId=e.ID),r},SZ=o=>({status:Tn.Stopped,outputArguments:null,id:o,info:(0,Qr.t)(Qr.ErrorKeys.WORKFLOW_STOPPED_BY_USER)}),OZ=o=>({status:Tn.Faulted,outputArguments:null,id:o,info:(0,Qr.t)(Qr.ErrorKeys.DEBUG_PEER_DISCONNECTED)});function xM(o){return o.isStudioDebugContext===!0&&typeof o.debugSessionId=="string"&&o.debugSessionId.length>0}function kZ(o,t){return{organizationId:o.organizationId,tenantId:o.tenantId,accessToken:o.accessToken,baseUrl:o.baseUrl,source:o.source||"ApiWorkflows",userId:o.userKey,subscriptionType:o.subscriptionPlanCode,processConfig:{processKey:o.processKey,folderKey:o.folderKey,jobKey:o.jobKey,robotKey:o.robotKey,isStudioDebugContext:o.isStudioDebugContext},...xM(o)&&{debugConfig:{isRunningInDesigner:!1,runInDebugMode:!0,enableVerboseDataLogging:!0}},telemetryConfig:{traceId:o.traceId,parentSpanId:o.spanId||""},tracingConfig:{traceId:o.platformTraceId,parentSpanId:o.platformParentSpanId||"",tracingToken:o.traceStoreAccessToken,enableUserLogs:!0,enableIoLogs:!0},resourceOverwrites:t.resourceOverwrites||{},automationEdgeFqdn:o.automationEdgeFqdn,licensingContext:t.licensingContext||void 0}}function PZ(o){return o.jobApiEndpoint?{transport:o.jobApiTransport,endpoint:o.jobApiEndpoint}:o.jobApiSocketPath?{transport:"http",endpoint:o.jobApiSocketPath}:{transport:o.jobApiTransport,endpoint:void 0}}function AZ(o){if(o.useOutputFile===!0){if(typeof o.outputArgumentsFilePath!="string"||o.outputArgumentsFilePath.length===0){console.error("useOutputFile is set but no outputArgumentsFilePath was granted; sending the output inline.");return}return{filePath:o.outputArgumentsFilePath,maxBytes:o.maxOutputFileSize}}}function RZ(o,t,r,e,n){if(o==="ipc"&&t)return new F_(t,r,e,n);if(o==="http"&&t)return new D_(t,r);console.error(`No valid transport configured (transport=${o}, endpoint=${t}). Telemetry will not be sent.`)}function IZ(o,t,r){if(t?.requested===!0)return t.reason==="peer-disconnect"?OZ(r):SZ(r);let e=(0,B_.getErrorMessage)(o);return(0,Qr.isWorkflowError)(o)&&o.detail&&(e+=`. ${o.detail}`),IM({status:Qr.WorkflowJobStatus.Faulted,data:null,errorMessage:e},r)}var xZ=async(o,t,r)=>{if(t&&o){try{await t.sendResult(o),console.log("Job result sent to host")}catch(e){console.error("Failed to send job result to host:",e)}try{await t.close()}catch(e){console.debug("Transport cleanup error:",e)}}if(r)try{await r.stop()}catch(e){console.error("Failed to stop debug SignalR connection:",e)}};async function MZ(){console.log(dx());let o=await $_(Mw(process.cwd(),yZ)),t=o.id,r,e,n,i,s={id:t,status:Tn.Faulted,outputArguments:null,info:"workflow runtime exited before producing a result"};try{let c=await $_(Mw(process.cwd(),mZ)),u=await $_(Mw(process.cwd(),vZ)),a=process.argv[2];console.log("Workflow file path:",a);let l=(0,B_.redactObjectPaths)(o,["accessToken","traceStoreAccessToken"]);console.log("workflowRuntimeContext:",JSON.stringify(l)),console.log("bindingsAndResourceOverrides:",JSON.stringify(u));let d=await $_(a),f=kZ(o,u),h=PM({root:hZ(_Z(a)),deniedFileNames:o.outputArgumentsFilePath?[AM(o.outputArgumentsFilePath)]:[],log:w=>console.warn(w)}),{transport:_,endpoint:m}=PZ(o);r=RZ(_,m,t,o.resumeVersion,AZ(o));let v=[];r&&(o.supportsPeakMemoryReport===!0||o.trackActivityMemory===!0)&&(e=new W_({jobApi:r,reportEnabled:o.supportsPeakMemoryReport===!0,memoryLimit:o.memoryLimit??0,trackActivityMemory:o.trackActivityMemory===!0}),e.start(),o.trackActivityMemory===!0&&v.push(new U_(e)));let b;if(xM(o)){let w=await wM(o,v,t);if(n=w.debugConnection,i=w.stopState,b=w.commandStream$,w.earlyResult)return s=w.earlyResult,s;f.debugConfig.breakpoints=w.breakpoints}let g=await Lx(d,f,c,{releasePackage:o.packageId?{id:o.packageId,version:o.packageVersion||"0.0.1"}:void 0,jobApi:r,licensingContext:u.licensingContext||void 0,additionalLoggers:v,commandStream$:b,workflowResolver:h,workflowFile:AM(a)});console.log("Workflow execution completed."),s=IM(g,t)}catch(c){console.error("Error executing workflow:",c),s=IZ(c,i,t)}finally{await e?.finalize(),await xZ(s,r,n)}return s}import.meta.main&&MZ().then(()=>{process.exit(0)}).catch(o=>{console.error("Unhandled error:",o),process.exit(1)});export{OZ as buildPeerDisconnectExecResult,SZ as buildStoppedExecResult,kZ as buildWorkflowConfig,xZ as finalizeJobExecution,xM as isDebugHubSession,MZ as main,IZ as mapErrorToResult,AZ as resolveOutputFileSpill};
|
|
1642
1642
|
/*! Bundled license information:
|
|
1643
1643
|
|
|
1644
1644
|
moment/moment.js:
|
package/package.json
CHANGED
package/sbom.cdx.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
"component": {
|
|
8
8
|
"type": "application",
|
|
9
9
|
"name": "@uipath/api-workflow-runtime",
|
|
10
|
-
"version": "13.
|
|
11
|
-
"bom-ref": "@uipath/api-workflow-runtime@13.
|
|
12
|
-
"purl": "pkg:npm/%40uipath/api-workflow-runtime@13.
|
|
10
|
+
"version": "13.10.0",
|
|
11
|
+
"bom-ref": "@uipath/api-workflow-runtime@13.10.0#7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519",
|
|
12
|
+
"purl": "pkg:npm/%40uipath/api-workflow-runtime@13.10.0",
|
|
13
13
|
"properties": [
|
|
14
14
|
{
|
|
15
15
|
"name": "uipath:sbom:commit",
|
|
16
|
-
"value": "
|
|
16
|
+
"value": "9b69501df7738028b7892fca0d94873aa3610c21"
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
},
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
{
|
|
62
62
|
"type": "library",
|
|
63
63
|
"name": "@uipath/api-workflow-commons",
|
|
64
|
-
"version": "13.
|
|
65
|
-
"bom-ref": "@uipath/api-workflow-commons@13.
|
|
66
|
-
"purl": "pkg:npm/%40uipath/api-workflow-commons@13.
|
|
64
|
+
"version": "13.10.0",
|
|
65
|
+
"bom-ref": "@uipath/api-workflow-commons@13.10.0#decfa1d6a7d8ca965346fa17ed5e62056bca946ef77f81434a35c02dc7f50175",
|
|
66
|
+
"purl": "pkg:npm/%40uipath/api-workflow-commons@13.10.0",
|
|
67
67
|
"licenses": [
|
|
68
68
|
{
|
|
69
69
|
"license": {
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
{
|
|
76
76
|
"type": "library",
|
|
77
77
|
"name": "@uipath/api-workflow-executor",
|
|
78
|
-
"version": "13.
|
|
79
|
-
"bom-ref": "@uipath/api-workflow-executor@13.
|
|
80
|
-
"purl": "pkg:npm/%40uipath/api-workflow-executor@13.
|
|
78
|
+
"version": "13.10.0",
|
|
79
|
+
"bom-ref": "@uipath/api-workflow-executor@13.10.0#dc0cc1d8dc5b0285d554f9bf29e955cfd9931faa4602409848827378c09d1030",
|
|
80
|
+
"purl": "pkg:npm/%40uipath/api-workflow-executor@13.10.0",
|
|
81
81
|
"licenses": [
|
|
82
82
|
{
|
|
83
83
|
"license": {
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"hashes": [
|
|
149
149
|
{
|
|
150
150
|
"alg": "SHA-256",
|
|
151
|
-
"content": "
|
|
151
|
+
"content": "b474124c120ae1b8ea1c432117afc31558a56e1f0701087b973a0620252e6c5f"
|
|
152
152
|
}
|
|
153
153
|
]
|
|
154
154
|
},
|
|
@@ -187,25 +187,25 @@
|
|
|
187
187
|
"dependsOn": []
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
|
-
"ref": "@uipath/api-workflow-commons@13.
|
|
190
|
+
"ref": "@uipath/api-workflow-commons@13.10.0#decfa1d6a7d8ca965346fa17ed5e62056bca946ef77f81434a35c02dc7f50175",
|
|
191
191
|
"dependsOn": [
|
|
192
192
|
"fast-redact@3.5.0#10eb49a9fcccd9f7809ebc0501361297e7cb0fbe4b04ee63bb6abb4ed0a3349d"
|
|
193
193
|
]
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
"ref": "@uipath/api-workflow-executor@13.
|
|
196
|
+
"ref": "@uipath/api-workflow-executor@13.10.0#dc0cc1d8dc5b0285d554f9bf29e955cfd9931faa4602409848827378c09d1030",
|
|
197
197
|
"dependsOn": [
|
|
198
|
-
"@uipath/api-workflow-commons@13.
|
|
198
|
+
"@uipath/api-workflow-commons@13.10.0#decfa1d6a7d8ca965346fa17ed5e62056bca946ef77f81434a35c02dc7f50175",
|
|
199
199
|
"moment@2.29.4#f6b083cd5b1bc69fc16047889af61a59c4ebb1248554bdc4d16fcb98539275cc",
|
|
200
200
|
"rxjs@7.8.0#6a38ba27393e9c55af8215176b5cbc0f777f78285918bba0c5e82bd86c7bd631"
|
|
201
201
|
]
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
|
-
"ref": "@uipath/api-workflow-runtime@13.
|
|
204
|
+
"ref": "@uipath/api-workflow-runtime@13.10.0#7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519",
|
|
205
205
|
"dependsOn": [
|
|
206
206
|
"@microsoft/signalr@8.0.7#247c5d157bca9339e19f40d77055d7e19ab4b3352359a1be03d61fee675afd5f",
|
|
207
|
-
"@uipath/api-workflow-commons@13.
|
|
208
|
-
"@uipath/api-workflow-executor@13.
|
|
207
|
+
"@uipath/api-workflow-commons@13.10.0#decfa1d6a7d8ca965346fa17ed5e62056bca946ef77f81434a35c02dc7f50175",
|
|
208
|
+
"@uipath/api-workflow-executor@13.10.0#dc0cc1d8dc5b0285d554f9bf29e955cfd9931faa4602409848827378c09d1030",
|
|
209
209
|
"@uipath/coreipc@2.5.1-20260324-07#731274d308d63a544d77b078cb5d0518b30b60480c43e1e96ec1d84bea26acbd",
|
|
210
210
|
"@uipath/tracing@1.4.0#e0a14feae7ab181c00c2c4ab62c14b65de3e02d321d513e8f2a3f64d449678a2",
|
|
211
211
|
"moment@2.29.4#f6b083cd5b1bc69fc16047889af61a59c4ebb1248554bdc4d16fcb98539275cc",
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
{
|
|
239
239
|
"aggregate": "incomplete",
|
|
240
240
|
"assemblies": [
|
|
241
|
-
"@uipath/api-workflow-runtime@13.
|
|
241
|
+
"@uipath/api-workflow-runtime@13.10.0#7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519"
|
|
242
242
|
]
|
|
243
243
|
},
|
|
244
244
|
{
|