@uipath/delegate-cli 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,6 +44,9 @@ delegate-cli tenant [NAME] List the organization's tenants, or switch
44
44
  delegate-cli logout Remove the saved CLI login
45
45
  delegate-cli whoami Show the current login (org, tenant, token expiry)
46
46
  delegate-cli models [--env NAME] List LLM models available on the tenant
47
+ delegate-cli check [--env NAME] [--headless]
48
+ Verify auth, backend and interop without sending a
49
+ prompt; exits 1 when any check fails
47
50
  delegate-cli host [flags] Run this PC as a remote worker until Ctrl+C
48
51
  delegate-cli host install [flags] Auto-start the host at login (macOS/Windows)
49
52
  delegate-cli host uninstall Remove auto-start
@@ -144,6 +147,8 @@ To change tenant afterwards, run `delegate-cli tenant <name>` — no browser: to
144
147
 
145
148
  `delegate-cli whoami` shows the active identity (auth source, org/tenant, token expiry). It is strictly read-only: no backend call, and no token refresh either — so an expired token is reported as expired instead of being silently rotated behind an inspection command. The `Source:` line names the file the credential actually came from, which may be the Delegate desktop app's `~/.aria/auth.json` (the SDK's read-only fallback).
146
149
 
150
+ `delegate-cli check` is the pre-flight a prompt would otherwise run implicitly, without sending one: it loads (and refreshes) auth and resolves the backend URL exactly like a prompt does, then prints three lines — `auth` (token not expired, and its organization and tenant match the backend URL), `backend` (one read-only `GET /v1/config` with the token), and `interop` (spawns the bundled interop, waits for `/health`, stops it again; `--headless` skips it). Any failed line makes the command exit 1, so a scheduler or a Robot job can gate on it. A saved login whose org/tenant slugs disagree with the backend URL — after a `--backend` override or a `tenant` switch — fails the `auth` line, and a prompt with the same combination is refused by the SDK before any request is sent.
151
+
147
152
  `delegate-cli logout` deletes the saved CLI login and never the desktop app's file. When that fallback is what you are authenticating with, it says so rather than reporting nothing to remove — sign out in the Delegate app to clear it.
148
153
 
149
154
  Tokens with < 30 % lifetime left are refreshed proactively on startup. 401s in a TTY trigger the login flow inline and retry.
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const _0x203660=_0x2bc1;function _0x2bc1(_0x5eb10a,_0x2484b7){_0x5eb10a=_0x5eb10a-0x149;const _0x47bc5c=_0x47bc();let _0x2bc1a7=_0x47bc5c[_0x5eb10a];return _0x2bc1a7;}(function(_0x3cdbea,_0x45b180){const _0x13bdf0=_0x2bc1,_0x50d4aa=_0x3cdbea();while(!![]){try{const _0x830a13=-parseInt(_0x13bdf0(0x1b9))/0x1+-parseInt(_0x13bdf0(0x1ee))/0x2*(parseInt(_0x13bdf0(0x16e))/0x3)+-parseInt(_0x13bdf0(0x160))/0x4+-parseInt(_0x13bdf0(0x191))/0x5+-parseInt(_0x13bdf0(0x1f4))/0x6+parseInt(_0x13bdf0(0x1ad))/0x7*(-parseInt(_0x13bdf0(0x17a))/0x8)+parseInt(_0x13bdf0(0x159))/0x9;if(_0x830a13===_0x45b180)break;else _0x50d4aa['push'](_0x50d4aa['shift']());}catch(_0x1f5704){_0x50d4aa['push'](_0x50d4aa['shift']());}}}(_0x47bc,0x3f8ba));const __dirname=import.meta.dirname;import _0x34a65f from'fs';import _0x547328 from'path';import{DelegateAgent as _0xf0320,InteropProcess as _0x1839de,buildDelegateServiceUrl as _0x53eb27,getAuthFilePath as _0x17ca9d,listTenants as _0x2455fb,loadAndRefreshAuth as _0x54275c,loadAndRefreshSdkLogin as _0x3b7ec8,runHostCommand as _0x176147,runLoginFlow as _0x447a5d,saveAuthData as _0x38a352,switchTenant as _0x53ab71}from'@uipath/delegate-sdk';var m={'alpha':_0x203660(0x1ab),'staging':_0x203660(0x199),'production':_0x203660(0x1b7)},P=[_0x203660(0x193),_0x203660(0x1b0),_0x203660(0x189),_0x203660(0x18d),_0x203660(0x1bc),_0x203660(0x1dc)];function x(_0x1f88cc){const _0x3fe376=_0x203660;let _0x1f962f={'subcommand':'','prompt':'','keepAlive':!0x1,'cleanup':!0x1,'headless':!0x1,'noConnections':!0x1,'noSecurity':!0x1,'quiet':!0x1,'preloadSkills':[],'help':!0x1,'version':!0x1};P[_0x3fe376(0x1b2)](_0x1f88cc[0x0])&&(_0x1f962f[_0x3fe376(0x19a)]=_0x1f88cc[0x0],_0x1f88cc=_0x1f88cc[_0x3fe376(0x153)](0x1));let _0x2af127=[];for(let _0x8d86a5=0x0;_0x8d86a5<_0x1f88cc[_0x3fe376(0x1e4)];_0x8d86a5++){let _0x2d9a21=_0x1f88cc[_0x8d86a5];switch(_0x2d9a21){case'--keep-alive':_0x1f962f[_0x3fe376(0x1ce)]=!0x0;break;case _0x3fe376(0x192):_0x1f962f[_0x3fe376(0x1d3)]=!0x0;break;case _0x3fe376(0x16f):_0x1f962f[_0x3fe376(0x14e)]=!0x0;break;case'--no-connections':_0x1f962f[_0x3fe376(0x1e5)]=!0x0;break;case _0x3fe376(0x16a):_0x1f962f[_0x3fe376(0x174)]=!0x0;break;case'--quiet':case'-q':_0x1f962f[_0x3fe376(0x1cb)]=!0x0;break;case _0x3fe376(0x1e1):_0x1f962f[_0x3fe376(0x1ec)]=_0x1f88cc[++_0x8d86a5];break;case _0x3fe376(0x1a3):_0x1f962f[_0x3fe376(0x1a4)]=_0x1f88cc[++_0x8d86a5];break;case _0x3fe376(0x152):_0x1f962f[_0x3fe376(0x1c1)]=_0x1f88cc[++_0x8d86a5];break;case _0x3fe376(0x167):_0x1f962f[_0x3fe376(0x156)]=_0x1f88cc[++_0x8d86a5];break;case _0x3fe376(0x14b):_0x1f962f[_0x3fe376(0x1d7)]=_0x1f88cc[++_0x8d86a5];break;case'--preload-skill':{let _0x170f5c=_0x1f88cc[++_0x8d86a5];(!_0x170f5c||_0x170f5c[_0x3fe376(0x1e8)]('--'))&&(console[_0x3fe376(0x1dd)](_0x3fe376(0x188)),process[_0x3fe376(0x16c)](0x2)),_0x1f962f['preloadSkills']['push'](_0x170f5c);break;}case _0x3fe376(0x172):{let _0x308504=_0x1f88cc[++_0x8d86a5];(!_0x308504||_0x308504[_0x3fe376(0x1e8)]('--'))&&(console[_0x3fe376(0x1dd)](_0x3fe376(0x14f)),process[_0x3fe376(0x16c)](0x2)),_0x1f962f[_0x3fe376(0x1b0)]=_0x308504;break;}case _0x3fe376(0x1c8):{let _0x3a64d1=_0x1f88cc[++_0x8d86a5];['alpha',_0x3fe376(0x18b),'production','localhost'][_0x3fe376(0x1b2)](_0x3a64d1)||(console[_0x3fe376(0x1dd)](_0x3fe376(0x175)+_0x3a64d1+_0x3fe376(0x18f)),process[_0x3fe376(0x16c)](0x2)),_0x1f962f[_0x3fe376(0x1cd)]=_0x3a64d1;break;}case'-h':case _0x3fe376(0x170):_0x1f962f[_0x3fe376(0x1a2)]=!0x0;break;case'-v':case _0x3fe376(0x1a7):_0x1f962f[_0x3fe376(0x176)]=!0x0;break;default:_0x2d9a21['startsWith']('--')&&(console[_0x3fe376(0x1dd)](_0x3fe376(0x182)+_0x2d9a21),process['exit'](0x2)),_0x2af127[_0x3fe376(0x1e2)](_0x2d9a21);}}return _0x1f962f[_0x3fe376(0x1b0)]!==void 0x0&&_0x1f962f[_0x3fe376(0x19a)]!=='login'&&(console[_0x3fe376(0x1dd)](_0x3fe376(0x186)),process[_0x3fe376(0x16c)](0x2)),_0x1f962f[_0x3fe376(0x14c)]=_0x2af127[_0x3fe376(0x185)]('\x20'),_0x1f962f;}function y(_0x382b6a,_0x3b2178,_0x752dc9){const _0x438e44=_0x203660;if(_0x752dc9)return _0x752dc9;if(process.env.BACKEND_URL)return process.env.BACKEND_URL;if(!_0x382b6a){if(_0x3b2178?.[_0x438e44(0x1d8)]&&_0x3b2178?.['orgLogicalName']&&_0x3b2178?.[_0x438e44(0x16b)])return _0x53eb27(_0x3b2178['baseUrl'],_0x3b2178['orgLogicalName'],_0x3b2178[_0x438e44(0x16b)]);throw new Error(_0x438e44(0x17e));}if(_0x382b6a===_0x438e44(0x15b))return'http://localhost:5002';let _0x5e2789=m[_0x382b6a],_0x4f1acd=_0x3b2178?.['orgLogicalName'],_0x252402=_0x3b2178?.['tenantName'];if(!_0x4f1acd||!_0x252402)throw new Error(_0x438e44(0x1b3)+_0x382b6a+'\x20needs\x20org/tenant\x20slugs.\x20Either:\x0a\x20\x20-\x20run\x20`delegate-cli\x20login\x20--env\x20'+_0x382b6a+_0x438e44(0x1a6));return _0x53eb27(_0x5e2789,_0x4f1acd,_0x252402);}function M(){const _0x502c3d=_0x203660;let _0x15deac=_0x502c3d(0x1bb)[_0x502c3d(0x197)]();console['log'](_0x15deac);}function B(){const _0x2ca875=_0x203660;try{return JSON[_0x2ca875(0x17d)](_0x34a65f[_0x2ca875(0x177)](_0x547328[_0x2ca875(0x185)](__dirname,'..',_0x2ca875(0x14a)),_0x2ca875(0x1ae)))['version']||_0x2ca875(0x1c0);}catch{return'unknown';}}var G=0x7d0;async function A(_0x9669f9,_0x33513c){const _0x184a58=_0x203660;let _0x5f2ad5=_0x33513c?[_0x33513c]:[];for await(let _0x27371b of _0x9669f9)_0x5f2ad5[_0x184a58(0x1e2)](Buffer[_0x184a58(0x1f0)](_0x27371b));return Buffer[_0x184a58(0x1f5)](_0x5f2ad5)[_0x184a58(0x1c9)](_0x184a58(0x1ae))[_0x184a58(0x197)]();}function q(_0x59d26c,_0x3dda43){return new Promise(_0x45c10b=>{const _0x3c7fd2=_0x2bc1;let _0x2b32db=_0x12af25=>{const _0x3ae6dd=_0x2bc1;clearTimeout(_0x186200),_0x59d26c[_0x3ae6dd(0x157)](_0x3ae6dd(0x1f2),_0x3b9d89),_0x59d26c['off'](_0x3ae6dd(0x194),_0xa6f435),_0x59d26c[_0x3ae6dd(0x157)]('error',_0xa6f435),_0x59d26c[_0x3ae6dd(0x1d1)](),_0x45c10b(_0x12af25);},_0x3b9d89=_0x2e3aad=>_0x2b32db(Buffer[_0x3c7fd2(0x1f0)](_0x2e3aad)),_0xa6f435=()=>_0x2b32db(null),_0x186200=setTimeout(()=>_0x2b32db(null),_0x3dda43);_0x59d26c['on']('data',_0x3b9d89),_0x59d26c['on']('end',_0xa6f435),_0x59d26c['on']('error',_0xa6f435),_0x59d26c[_0x3c7fd2(0x154)]();});}async function F(_0x59299b,_0x5dbbaf,_0x3ad473=G){let _0x37663c=_0x59299b==='-';if(!_0x37663c&&_0x59299b)return _0x59299b;if(!_0x37663c&&_0x5dbbaf['isTTY'])return'';if(_0x37663c)return A(_0x5dbbaf,null);let _0x183e56=await q(_0x5dbbaf,_0x3ad473);return _0x183e56?A(_0x5dbbaf,_0x183e56):'';}function v(){const _0x5ec814=_0x203660;return _0x547328[_0x5ec814(0x185)](process.env.HOME||process.env.USERPROFILE||'',_0x5ec814(0x18c),_0x5ec814(0x1b1));}function f(_0x39d956){const _0x39ac58=_0x203660;try{let _0x2b0b92=JSON[_0x39ac58(0x17d)](_0x34a65f['readFileSync'](_0x39d956,_0x39ac58(0x1ae)));return!_0x2b0b92[_0x39ac58(0x1d6)]||!_0x2b0b92['tenantId']||!_0x2b0b92[_0x39ac58(0x179)]?null:_0x2b0b92;}catch{return null;}}function j(){let _0x383a77=[{'file':_0x17ca9d(),'isDesktopFallback':!0x1},{'file':v(),'isDesktopFallback':!0x0}];for(let _0x290b7e of _0x383a77){let _0x4c953a=f(_0x290b7e['file']);if(_0x4c953a)return{..._0x290b7e,'auth':_0x4c953a};}return null;}async function z(){const _0x4b2fe2=_0x203660;let _0x1338ff=_0x17ca9d();if(!_0x34a65f[_0x4b2fe2(0x1de)](_0x1338ff)){let _0x80f962=v();console[_0x4b2fe2(0x163)](f(_0x80f962)?_0x4b2fe2(0x171)+_0x80f962+_0x4b2fe2(0x1bf):_0x4b2fe2(0x1e6));return;}_0x34a65f[_0x4b2fe2(0x14d)](_0x1338ff),console[_0x4b2fe2(0x163)](_0x4b2fe2(0x1a5)+_0x1338ff);}async function H(){const _0x21637b=_0x203660;let _0x2bf765=k(),_0x3df902,_0x2eab09;if(_0x2bf765)_0x3df902=_0x2bf765,_0x2eab09='environment\x20variables\x20(AUTH_TOKEN/TENANT_ID/ORG_ID)';else{let _0x346ca9=j();if(!_0x346ca9)throw new Error(N);_0x3df902=_0x346ca9[_0x21637b(0x19c)],_0x2eab09=_0x346ca9['isDesktopFallback']?_0x346ca9[_0x21637b(0x1c3)]+_0x21637b(0x1e3):_0x346ca9[_0x21637b(0x1c3)];}let _0x494794=[_0x21637b(0x19f)+_0x2eab09,'Base\x20URL:\x20\x20\x20\x20\x20'+(_0x3df902[_0x21637b(0x1d8)]??'unknown'),_0x21637b(0x1be)+(_0x3df902[_0x21637b(0x1af)]??'unknown\x20slug')+'\x20('+_0x3df902['organizationId']+')',_0x21637b(0x1cf)+(_0x3df902['tenantName']??_0x21637b(0x173))+'\x20('+_0x3df902['tenantId']+')'];if(_0x3df902[_0x21637b(0x187)]){let _0x4febba=_0x3df902[_0x21637b(0x187)]-Math[_0x21637b(0x1ed)](Date[_0x21637b(0x19d)]()/0x3e8),_0x1871e3=new Date(_0x3df902[_0x21637b(0x187)]*0x3e8)[_0x21637b(0x1c7)]();_0x494794[_0x21637b(0x1e2)](_0x4febba>0x0?_0x21637b(0x165)+_0x1871e3+'\x20(in\x20'+Math[_0x21637b(0x151)](_0x4febba/0x3c)+'\x20min)':_0x21637b(0x169)+_0x1871e3);}process[_0x21637b(0x180)][_0x21637b(0x1d0)](_0x494794['join']('\x0a')+'\x0a');}var N=_0x203660(0x1f1);function k(){return process.env.AUTH_TOKEN&&process.env.TENANT_ID&&process.env.ORG_ID?{'accessToken':process.env.AUTH_TOKEN,'tenantId':process.env.TENANT_ID,'organizationId':process.env.ORG_ID,'orgLogicalName':process.env.ORG_SLUG,'tenantName':process.env.TENANT_SLUG,'baseUrl':process.env.UIPATH_BASE_URL}:null;}async function E(){let _0x390e9f=k();if(_0x390e9f)return _0x390e9f;let _0x3f1180=await _0x54275c();if(_0x3f1180)return _0x3f1180;throw new Error(N);}async function K(){const _0x21eb7f=_0x203660;await new _0x1839de()[_0x21eb7f(0x17c)]({'force':!0x0}),console[_0x21eb7f(0x163)]('Interop\x20stopped\x20(if\x20it\x20was\x20running).');}var W=_0x203660(0x1ca);function U(_0x348181,_0x54b551,_0x355342){const _0x48cee8=_0x203660;_0x348181?process['stderr'][_0x48cee8(0x1d0)](_0x48cee8(0x1c2)+_0x348181+_0x48cee8(0x1a0)+_0x355342+'\x0a'):!_0x54b551&&!process.env.BACKEND_URL&&process[_0x48cee8(0x161)][_0x48cee8(0x1d0)](_0x48cee8(0x1d4)+_0x355342+'\x0a');}async function J(_0x403e61){const _0x3a6741=_0x203660;let _0x27b5eb=await E(),_0x402d7d=y(_0x403e61['env'],_0x27b5eb,_0x403e61[_0x3a6741(0x1ec)]);U(_0x403e61[_0x3a6741(0x1cd)],_0x403e61[_0x3a6741(0x1ec)],_0x402d7d);let _0x441f38=_0x402d7d+_0x3a6741(0x1a1),_0x21921e={'Authorization':_0x3a6741(0x1b6)+_0x27b5eb[_0x3a6741(0x1d6)],'X-UiPath-ConsumingProductId':W};_0x27b5eb[_0x3a6741(0x1c6)]&&(_0x21921e[_0x3a6741(0x1aa)]=_0x27b5eb[_0x3a6741(0x1c6)]),_0x27b5eb['organizationId']&&(_0x21921e['X-Uipath-Organizationid']=_0x27b5eb['organizationId']);let _0x2cffab=await fetch(_0x441f38,{'headers':_0x21921e});if(!_0x2cffab['ok'])throw new Error(_0x3a6741(0x1da)+_0x441f38+_0x3a6741(0x1bd)+_0x2cffab['status']+'\x20'+_0x2cffab[_0x3a6741(0x1c5)]);let _0x5645ca=(await _0x2cffab[_0x3a6741(0x1e9)]())?.[_0x3a6741(0x1b4)],_0x18b7d9=Array['isArray'](_0x5645ca)?_0x5645ca:_0x5645ca&&typeof _0x5645ca==_0x3a6741(0x162)?Object[_0x3a6741(0x1b5)](_0x5645ca)[_0x3a6741(0x149)](([_0x57aa58,_0x1a77bc])=>({'id':_0x57aa58,'name':_0x1a77bc})):[];if(_0x18b7d9[_0x3a6741(0x1e4)]===0x0){process[_0x3a6741(0x161)]['write'](_0x3a6741(0x17b));return;}process[_0x3a6741(0x180)][_0x3a6741(0x1d0)](_0x3a6741(0x18a)+_0x18b7d9['length']+_0x3a6741(0x1a8));for(let _0x56a6e8 of _0x18b7d9){let _0x245e99=_0x56a6e8[_0x3a6741(0x1d5)]&&_0x56a6e8[_0x3a6741(0x1d5)]!==_0x56a6e8['id']?'\x20('+_0x56a6e8['name']+')':'';process[_0x3a6741(0x180)][_0x3a6741(0x1d0)]('\x20\x20'+_0x56a6e8['id']+_0x245e99+'\x0a'),_0x56a6e8['description']&&process['stdout'][_0x3a6741(0x1d0)](_0x3a6741(0x1e0)+_0x56a6e8[_0x3a6741(0x1e7)]+'\x0a');}process['stdout'][_0x3a6741(0x1d0)]('\x0aUse\x20with:\x20delegate-cli\x20--model\x20<id>\x20\x22<prompt>\x22\x0a');}async function X(_0x2608f3){const _0x3261f2=_0x203660;_0x2608f3['env']===_0x3261f2(0x15b)&&(console[_0x3261f2(0x1dd)]('--env\x20localhost\x20has\x20no\x20OAuth\x20flow;\x20pick\x20alpha,\x20staging,\x20or\x20production.'),process[_0x3261f2(0x16c)](0x2));let _0x5931d9=f(_0x17ca9d());if(_0x2608f3[_0x3261f2(0x1cd)]){let _0x2d903b=_0x2608f3[_0x3261f2(0x1cd)];await _0x447a5d({'env':_0x2d903b,'tenant':_0x2608f3[_0x3261f2(0x1b0)]??L(_0x5931d9,m[_0x2d903b])});return;}if(_0x5931d9?.[_0x3261f2(0x1d8)]){await _0x447a5d({'baseUrl':_0x5931d9['baseUrl'],'tenant':_0x2608f3[_0x3261f2(0x1b0)]??_0x5931d9[_0x3261f2(0x16b)]});return;}console[_0x3261f2(0x1dd)]('First\x20login\x20requires\x20--env.\x20Usage:\x20delegate-cli\x20login\x20--env\x20<alpha|staging|production>'),process[_0x3261f2(0x16c)](0x2);}function L(_0x330f52,_0x31e6dc){return _0x330f52?.['baseUrl']&&V(_0x330f52['baseUrl'],_0x31e6dc)?_0x330f52['tenantName']:void 0x0;}function _0x47bc(){const _0xdd0966=['Bearer\x20','https://cloud.uipath.com','No\x20CLI\x20login\x20to\x20switch:\x20the\x20CLI\x20is\x20authenticating\x20via\x20the\x20Delegate\x20desktop\x20app\x27s\x20','95905ZnjIxp','Tenants\x20of\x20','\x0adelegate-cli\x20—\x20Delegate\x20agent\x20CLI\x0a\x0aUsage:\x0a\x20\x20delegate-cli\x20[flags]\x20\x22<prompt>\x22\x20\x20\x20\x20\x20\x20Send\x20prompt\x20to\x20the\x20agent\x0a\x20\x20delegate-cli\x20[flags]\x20-\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Read\x20the\x20prompt\x20from\x20stdin\x20(also\x20implied\x20when\x20stdin\x20is\x20piped)\x0a\x20\x20delegate-cli\x20login\x20[--env\x20NAME]\x20[--tenant\x20NAME]\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20OAuth\x20browser\x20login\x20→\x20~/.aria/sdk-auth.json.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--env\x20required\x20on\x20FIRST\x20login;\x20afterwards\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20defaults\x20to\x20the\x20saved\x20login\x27s\x20cloud.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--tenant\x20picks\x20a\x20tenant\x20by\x20name;\x20without\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20it\x20a\x20re-login\x20keeps\x20the\x20saved\x20tenant\x0a\x20\x20delegate-cli\x20tenant\x20[NAME]\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20List\x20the\x20organization\x27s\x20tenants,\x20or\x20switch\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20the\x20saved\x20login\x20to\x20NAME\x20(no\x20browser)\x0a\x20\x20delegate-cli\x20logout\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Remove\x20the\x20saved\x20CLI\x20login\x0a\x20\x20delegate-cli\x20whoami\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20the\x20current\x20login\x20(org,\x20tenant,\x20token\x20expiry)\x0a\x20\x20delegate-cli\x20models\x20[--env\x20NAME]\x20\x20\x20\x20\x20List\x20available\x20LLM\x20models\x20for\x20the\x20current\x20tenant\x0a\x20\x20delegate-cli\x20host\x20[flags]\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Run\x20this\x20PC\x20as\x20a\x20remote\x20worker\x20until\x20Ctrl+C\x0a\x20\x20delegate-cli\x20host\x20install\x20[flags]\x20\x20\x20\x20Auto-start\x20the\x20host\x20at\x20login\x20(macOS\x20LaunchAgent\x20/\x20Windows\x20Scheduled\x20Task)\x0a\x20\x20delegate-cli\x20host\x20uninstall\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Remove\x20auto-start\x0a\x20\x20delegate-cli\x20host\x20status\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20auto-start\x20state\x0a\x20\x20delegate-cli\x20--cleanup\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Stop\x20running\x20interop\x0a\x0aFlags:\x0a\x20\x20--env\x20NAME\x20\x20\x20\x20\x20\x20\x20\x20alpha\x20|\x20staging\x20|\x20production\x20|\x20localhost\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Composes\x20backend\x20URL\x20from\x20saved\x20auth\x20(org/tenant\x20slugs).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Omitted\x20→\x20the\x20cloud\x20you\x20logged\x20into\x20(delegate-cli\x20login).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20localhost\x20→\x20http://localhost:5002.\x20No\x20saved\x20login\x20and\x20no\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--env/--backend/BACKEND_URL\x20is\x20an\x20error\x20—\x20never\x20a\x20guess.\x0a\x20\x20--backend\x20URL\x20\x20\x20\x20\x20Full\x20backend\x20URL\x20—\x20escape\x20hatch\x20overrides\x20--env\x0a\x20\x20--tenant\x20NAME\x20\x20\x20\x20\x20(login)\x20Tenant\x20to\x20sign\x20into,\x20by\x20name\x20(case-insensitive).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default:\x20the\x20saved\x20login\x27s\x20tenant\x20on\x20that\x20cloud,\x20else\x20the\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20org\x27s\x20first\x20tenant.\x20Later:\x20delegate-cli\x20tenant\x20<name>\x0a\x20\x20--model\x20NAME\x20\x20\x20\x20\x20\x20LLM\x20model\x20id\x20(e.g.\x20claude_sonnet_5,\x20kimi_k2_7_code).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default:\x20gemini_3_6_flash.\x20Also\x20settable\x20via\x20MODEL\x20env\x20var.\x0a\x20\x20--keep-alive\x20\x20\x20\x20\x20\x20Reuse/leave\x20interop\x20running\x20across\x20invocations\x0a\x20\x20--headless\x20\x20\x20\x20\x20\x20\x20\x20Skip\x20interop\x20(text-only\x20prompts)\x0a\x20\x20--no-connections\x20\x20Disable\x20orchestrator\x20ConnectionService\x20(silences\x20404\x20warnings)\x0a\x20\x20--no-security\x20\x20\x20\x20\x20Disable\x20tool\x20security\x20wrapper\x20(use\x20only\x20for\x20debugging)\x0a\x20\x20--preload-skill\x20NAME\x20\x20Preload\x20a\x20skill\x20into\x20the\x20session\x20(repeatable).\x20The\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20skill\x27s\x20content\x20is\x20attached\x20before\x20the\x20first\x20model\x20turn\x20—\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20same\x20mechanism\x20as\x20project\x20preloaded\x20skills\x20in\x20the\x20app\x0a\x20\x20--runner-url\x20URL\x20\x20(host)\x20Runner\x20worker\x20WS\x20URL.\x20Required;\x20or\x20CONTROL_PLANE_WS_URL\x20env\x0a\x20\x20--interop\x20PATH\x20\x20\x20\x20(host)\x20Interop\x20binary\x20path;\x20or\x20INTEROP_EXECUTABLE_PATH\x20env.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Absent\x20→\x20registration/discovery\x20only,\x20tool\x20execution\x20disabled\x0a\x20\x20--worker-id\x20ID\x20\x20\x20\x20(host)\x20Stable\x20worker\x20identity;\x20or\x20WORKER_ID\x20env.\x20Default:\x20hostname\x0a\x20\x20-q,\x20--quiet\x20\x20\x20\x20\x20\x20\x20Suppress\x20🤔\x20thinking\x20output\x20to\x20stderr\x0a\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x0a\x20\x20-v,\x20--version\x20\x20\x20\x20\x20Print\x20the\x20installed\x20CLI\x20version\x0a\x0aAuth:\x20prompts\x20auto-retry\x20on\x20401\x20by\x20opening\x20the\x20browser\x20to\x20re-login\x20(TTY\x20only).\x0a','logout','\x20→\x20','Organization:\x20','\x20—\x20sign\x20out\x20in\x20the\x20Delegate\x20app\x20to\x20clear\x20that.','unknown','runnerUrl','[env=','file','content','statusText','tenantId','toISOString','--env','toString','799f56b8-4aed-4a0f-8640-659dae4a9e0e','quiet','sendMessage','env','keepAlive','Tenant:\x20\x20\x20\x20\x20\x20\x20','write','pause','tool','cleanup','[saved\x20login]\x20Backend\x20URL:\x20','name','accessToken','workerId','baseUrl','stdin','GET\x20','preloadSkills','whoami','error','existsSync','The\x20saved\x20CLI\x20login\x20could\x20not\x20be\x20refreshed.\x20Run\x20`delegate-cli\x20login`\x20again.','\x20\x20\x20\x20','--backend','push','\x20(Delegate\x20desktop\x20app\x20fallback)','length','noConnections','No\x20CLI\x20login\x20found\x20—\x20nothing\x20to\x20remove.','description','startsWith','json','🔧\x20',',\x20whose\x20tenant\x20is\x20chosen\x20in\x20the\x20app.\x20Run\x20`delegate-cli\x20login\x20--env\x20<env>`\x20for\x20a\x20CLI\x20login\x20of\x20your\x20own.','backendUrl','floor','72154auNzIU','thinking','from','No\x20auth\x20found.\x20Set\x20AUTH_TOKEN/TENANT_ID/ORG_ID\x20env\x20vars,\x20or\x20run\x20`delegate-cli\x20login\x20--env\x20<alpha|staging|production>`\x20(interactive\x20browser\x20OAuth)\x20first.','data','stack','700560vSxYdk','concat','map','package.json','--worker-id','prompt','rmSync','headless','--tenant\x20requires\x20a\x20tenant\x20name.','once','round','--runner-url','slice','resume','toolName','interopPath','off','origin','15182550lptJJt','onEvent','localhost','finally','No\x20CLI\x20login\x20found.\x20Run\x20`delegate-cli\x20login\x20--env\x20<alpha|staging|production>`\x20first.','lastType','Missing\x20prompt.\x20Pass\x20it\x20as\x20an\x20argument,\x20pipe\x20it\x20via\x20stdin,\x20or\x20run\x20`delegate-cli\x20--help`.','605228SlXHDF','stderr','object','log','initialize','Token:\x20\x20\x20\x20\x20\x20\x20\x20expires\x20','\x0a🤔\x20','--interop','response','Token:\x20\x20\x20\x20\x20\x20\x20\x20expired\x20','--no-security','tenantName','exit','SIGINT','9fgKTYJ','--headless','--help','No\x20CLI\x20login\x20found.\x20Note:\x20the\x20CLI\x20is\x20currently\x20authenticating\x20via\x20the\x20Delegate\x20desktop\x20app\x27s\x20','--tenant','unknown\x20slug','noSecurity','Invalid\x20--env:\x20','version','readFileSync','\x20(current)','organizationId','72blnBRU','No\x20models\x20available\x20for\x20this\x20product/tenant.\x0a','stop','parse','No\x20backend\x20selected.\x20Run\x20`delegate-cli\x20login\x20--env\x20<env>`\x20first\x20(commands\x20then\x20default\x20to\x20that\x20cloud),\x20or\x20pass\x20--env\x20<alpha|staging|production|localhost>\x20or\x20--backend\x20<url>\x20(or\x20set\x20BACKEND_URL).','\x0aStopping…\x20(Ctrl+C\x20again\x20to\x20force\x20exit)\x0a','stdout','isTTY','Unknown\x20flag:\x20','✓\x20Done\x0a','done','join','--tenant\x20applies\x20to\x20`delegate-cli\x20login`\x20only.\x20Switch\x20tenants\x20with:\x20delegate-cli\x20tenant\x20<name>','expiresAt','--preload-skill\x20requires\x20a\x20skill\x20name.','models','\x0aAvailable\x20models\x20(','staging','.aria','host','message','.\x20Use\x20alpha\x20|\x20staging\x20|\x20production\x20|\x20localhost.','tool_call','2481420mEasmy','--cleanup','login','end','argv','destroy','trim','status','https://staging.uipath.com','subcommand','test','auth','now','Tenant\x20not\x20switched:\x20could\x20not\x20write\x20','Source:\x20\x20\x20\x20\x20\x20\x20',']\x20Backend\x20URL:\x20','/v1/config','help','--model','model','Removed\x20','`\x20(writes\x20slugs\x20to\x20~/.aria/sdk-auth.json),\x20or\x0a\x20\x20-\x20set\x20ORG_SLUG\x20and\x20TENANT_SLUG\x20env\x20vars\x20alongside\x20ORG_ID/TENANT_ID,\x20or\x0a\x20\x20-\x20pass\x20the\x20full\x20URL\x20via\x20--backend\x20(overrides\x20--env).','--version','):\x0a\x0a',';\x20the\x20saved\x20login\x20still\x20uses\x20','X-Uipath-Tenantid','https://alpha.uipath.com','Auth\x20comes\x20from\x20AUTH_TOKEN/TENANT_ID/ORG_ID\x20—\x20set\x20TENANT_ID\x20and\x20TENANT_SLUG\x20to\x20change\x20the\x20tenant.','356363RPEYPU','utf-8','orgLogicalName','tenant','auth.json','includes','--env\x20','MODELS','entries'];_0x47bc=function(){return _0xdd0966;};return _0x47bc();}function V(_0xcf9d2f,_0x952345){const _0x28498d=_0x203660;try{return new URL(_0xcf9d2f)[_0x28498d(0x158)]===new URL(_0x952345)[_0x28498d(0x158)];}catch{return!0x1;}}async function Y(_0x3b96a4){const _0x30dc02=_0x203660;k()&&(console[_0x30dc02(0x1dd)](_0x30dc02(0x1ac)),process[_0x30dc02(0x16c)](0x2));let _0xdf7950=await _0x3b7ec8();if(_0xdf7950||(console['error'](Q()),process[_0x30dc02(0x16c)](0x2)),_0x3b96a4['trim']()){let _0x2b94e1=await _0x53ab71(_0xdf7950,_0x3b96a4);_0x38a352(_0x2b94e1)||(console[_0x30dc02(0x1dd)](_0x30dc02(0x19e)+_0x17ca9d()+_0x30dc02(0x1a9)+_0xdf7950[_0x30dc02(0x16b)]+'.'),process['exit'](0x1)),console[_0x30dc02(0x163)]('Tenant:\x20'+_0x2b94e1[_0x30dc02(0x16b)]+'\x20('+_0x2b94e1[_0x30dc02(0x1c6)]+')\x20—\x20saved\x20to\x20'+_0x17ca9d());return;}Z(await _0x2455fb(_0xdf7950),_0xdf7950);}function Q(){const _0x17e266=_0x203660;if(_0x34a65f[_0x17e266(0x1de)](_0x17ca9d()))return _0x17e266(0x1df);let _0x43bdc6=v();return f(_0x43bdc6)?_0x17e266(0x1b8)+_0x43bdc6+_0x17e266(0x1eb):_0x17e266(0x15d);}function Z(_0x326273,_0x4124be){const _0x4ed0b2=_0x203660;let _0x1fcf69=_0x326273[_0x4ed0b2(0x149)](_0x18d0f8=>_0x18d0f8['id']===_0x4124be['tenantId']?'*\x20'+_0x18d0f8[_0x4ed0b2(0x1d5)]+_0x4ed0b2(0x178):'\x20\x20'+_0x18d0f8[_0x4ed0b2(0x1d5)]);process['stdout'][_0x4ed0b2(0x1d0)](_0x4ed0b2(0x1ba)+(_0x4124be[_0x4ed0b2(0x1af)]??_0x4124be[_0x4ed0b2(0x179)])+':\x0a'+_0x1fcf69['join']('\x0a')+'\x0a'),_0x326273['length']>0x1&&process['stdout'][_0x4ed0b2(0x1d0)]('Switch\x20with:\x20delegate-cli\x20tenant\x20<name>\x0a');}function ee(_0x4985df){const _0x4639a9=_0x203660;return _0x4985df?.[_0x4639a9(0x168)]?.[_0x4639a9(0x198)]===0x191||/401/[_0x4639a9(0x19b)](String(_0x4985df?.['message']??''));}var a={'lastType':null,'quiet':!0x1},S=_0x13fdf6=>{const _0x45cc7b=_0x203660;switch(_0x13fdf6['type']){case'thinking':_0x13fdf6[_0x45cc7b(0x1c4)]&&!a[_0x45cc7b(0x1cb)]&&(a['lastType']!=='thinking'&&process['stderr'][_0x45cc7b(0x1d0)](_0x45cc7b(0x166)),process[_0x45cc7b(0x161)][_0x45cc7b(0x1d0)](_0x13fdf6['content']),a['lastType']=_0x45cc7b(0x1ef));break;case _0x45cc7b(0x190):a[_0x45cc7b(0x15e)]!==null&&process['stderr'][_0x45cc7b(0x1d0)]('\x0a'),process[_0x45cc7b(0x161)][_0x45cc7b(0x1d0)](_0x45cc7b(0x1ea)+(_0x13fdf6[_0x45cc7b(0x155)]??_0x45cc7b(0x1d2))+'\x0a'),a[_0x45cc7b(0x15e)]=_0x45cc7b(0x190);break;case _0x45cc7b(0x18e):_0x13fdf6[_0x45cc7b(0x1c4)]&&(a[_0x45cc7b(0x15e)]!==_0x45cc7b(0x18e)&&a['lastType']!==null&&process[_0x45cc7b(0x180)][_0x45cc7b(0x1d0)]('\x0a'),process[_0x45cc7b(0x180)]['write'](_0x13fdf6[_0x45cc7b(0x1c4)]),a['lastType']=_0x45cc7b(0x18e));break;case _0x45cc7b(0x1dd):a[_0x45cc7b(0x15e)]!==null&&process[_0x45cc7b(0x161)][_0x45cc7b(0x1d0)]('\x0a'),process[_0x45cc7b(0x161)][_0x45cc7b(0x1d0)]('✗\x20'+(_0x13fdf6['error']??_0x13fdf6[_0x45cc7b(0x18e)]??'error')+'\x0a'),a[_0x45cc7b(0x15e)]=_0x45cc7b(0x1dd);break;case'done':(a[_0x45cc7b(0x15e)]===_0x45cc7b(0x18e)||a[_0x45cc7b(0x15e)]==='thinking')&&process[_0x45cc7b(0x180)][_0x45cc7b(0x1d0)]('\x0a'),process[_0x45cc7b(0x161)][_0x45cc7b(0x1d0)](_0x45cc7b(0x183)),a[_0x45cc7b(0x15e)]=_0x45cc7b(0x184);break;}};async function ne(_0x2a95fd){const _0x2661c7=_0x203660;let _0x213ac1=await F(_0x2a95fd['prompt'],process[_0x2661c7(0x1d9)]);_0x213ac1||(console[_0x2661c7(0x1dd)](_0x2661c7(0x15f)),process[_0x2661c7(0x16c)](0x2)),a[_0x2661c7(0x1cb)]=_0x2a95fd['quiet'];let _0x11d8f1=await E(),_0x3b19ee=new _0xf0320();_0x3b19ee['onEvent'](S);let _0x18cc87=y(_0x2a95fd[_0x2661c7(0x1cd)],_0x11d8f1,_0x2a95fd['backendUrl']);U(_0x2a95fd[_0x2661c7(0x1cd)],_0x2a95fd[_0x2661c7(0x1ec)],_0x18cc87);let _0x1b0dd5={'backendUrl':_0x18cc87,'auth':_0x11d8f1,'enableComputerUse':!_0x2a95fd[_0x2661c7(0x14e)],'autoSpawnInterop':!_0x2a95fd['headless'],'enableConnections':!_0x2a95fd[_0x2661c7(0x1e5)],'enableSecurity':!_0x2a95fd['noSecurity'],'keepInteropAlive':_0x2a95fd[_0x2661c7(0x1ce)],..._0x2a95fd[_0x2661c7(0x1db)][_0x2661c7(0x1e4)]>0x0?{'preloadSkills':_0x2a95fd['preloadSkills']}:{},..._0x2a95fd[_0x2661c7(0x1a4)]||process.env.MODEL?{'model':_0x2a95fd[_0x2661c7(0x1a4)]||process.env.MODEL}:{}},_0xb49273=!0x1,_0x193c1b=!0x1,_0x19a9a4=()=>{const _0x44dbda=_0x2661c7;_0x193c1b&&process['exit'](0x82),_0x193c1b=!0x0,process[_0x44dbda(0x161)][_0x44dbda(0x1d0)](_0x44dbda(0x17f)),_0xb49273?_0x3b19ee[_0x44dbda(0x196)]()[_0x44dbda(0x15c)](()=>process[_0x44dbda(0x16c)](0x82)):process[_0x44dbda(0x16c)](0x82);};process[_0x2661c7(0x150)](_0x2661c7(0x16d),_0x19a9a4),await _0x3b19ee[_0x2661c7(0x164)](_0x1b0dd5),_0xb49273=!0x0;try{await _0x3b19ee[_0x2661c7(0x1cc)](_0x213ac1);}catch(_0x4df326){if(ee(_0x4df326)&&process[_0x2661c7(0x1d9)][_0x2661c7(0x181)]&&_0x2a95fd[_0x2661c7(0x1cd)]!==_0x2661c7(0x15b)&&(_0x2a95fd['env']||_0x11d8f1['baseUrl'])){process[_0x2661c7(0x161)][_0x2661c7(0x1d0)]('\x0a⚠️\x20\x20Auth\x20expired.\x20Opening\x20browser\x20to\x20re-login…\x0a');let _0x5c37ee=await _0x447a5d(_0x2a95fd[_0x2661c7(0x1cd)]?{'env':_0x2a95fd[_0x2661c7(0x1cd)],'tenant':L(_0x11d8f1,m[_0x2a95fd['env']])}:{'baseUrl':_0x11d8f1['baseUrl'],'tenant':_0x11d8f1[_0x2661c7(0x16b)]});await _0x3b19ee['destroy'](),_0x3b19ee=new _0xf0320(),_0x3b19ee[_0x2661c7(0x15a)](S),await _0x3b19ee[_0x2661c7(0x164)]({..._0x1b0dd5,'auth':_0x5c37ee}),await _0x3b19ee[_0x2661c7(0x1cc)](_0x213ac1);}else throw _0x4df326;}finally{process['off'](_0x2661c7(0x16d),_0x19a9a4),await _0x3b19ee[_0x2661c7(0x196)]();}}async function te(){const _0x4f02d9=_0x203660;let _0x1cd223=x(process[_0x4f02d9(0x195)][_0x4f02d9(0x153)](0x2));if(_0x1cd223[_0x4f02d9(0x1a2)]){M();return;}if(_0x1cd223[_0x4f02d9(0x176)]){console['log'](B());return;}if(_0x1cd223['subcommand']==='login'){await X(_0x1cd223);return;}if(_0x1cd223[_0x4f02d9(0x19a)]===_0x4f02d9(0x1b0)){await Y(_0x1cd223[_0x4f02d9(0x14c)]);return;}if(_0x1cd223[_0x4f02d9(0x19a)]===_0x4f02d9(0x1bc)){await z();return;}if(_0x1cd223[_0x4f02d9(0x19a)]==='whoami'){await H();return;}if(_0x1cd223[_0x4f02d9(0x19a)]==='models'){await J(_0x1cd223);return;}if(_0x1cd223[_0x4f02d9(0x19a)]==='host'){await _0x176147(_0x1cd223['prompt'],{'runnerUrl':_0x1cd223[_0x4f02d9(0x1c1)],'backendUrl':_0x1cd223['backendUrl'],'interopPath':_0x1cd223[_0x4f02d9(0x156)],'workerId':_0x1cd223[_0x4f02d9(0x1d7)]});return;}if(_0x1cd223[_0x4f02d9(0x1d3)]){await K();return;}await ne(_0x1cd223);}var oe=process.env.NODE_ENV===_0x203660(0x19b)||!!process.env.JEST_WORKER_ID;oe||te()['catch'](_0x4f19a8=>{const _0x59414f=_0x203660;console['error'](_0x4f19a8[_0x59414f(0x1f3)]||_0x4f19a8[_0x59414f(0x18e)]||_0x4f19a8),process[_0x59414f(0x16c)](0x1);});export{G as IMPLICIT_STDIN_IDLE_MS,te as main,x as parseArgs,B as readCliVersion,F as resolvePrompt};
2
+ const _0x338425=_0x32d0;(function(_0x5ab125,_0x300fc7){const _0x4f1cde=_0x32d0,_0x2b8729=_0x5ab125();while(!![]){try{const _0x37ef7b=-parseInt(_0x4f1cde(0xf1))/0x1*(-parseInt(_0x4f1cde(0x120))/0x2)+parseInt(_0x4f1cde(0x11e))/0x3*(parseInt(_0x4f1cde(0x170))/0x4)+-parseInt(_0x4f1cde(0x124))/0x5*(-parseInt(_0x4f1cde(0x154))/0x6)+parseInt(_0x4f1cde(0x132))/0x7*(-parseInt(_0x4f1cde(0x148))/0x8)+-parseInt(_0x4f1cde(0x101))/0x9*(parseInt(_0x4f1cde(0x18e))/0xa)+-parseInt(_0x4f1cde(0x10f))/0xb*(parseInt(_0x4f1cde(0x180))/0xc)+-parseInt(_0x4f1cde(0x13a))/0xd*(-parseInt(_0x4f1cde(0xf0))/0xe);if(_0x37ef7b===_0x300fc7)break;else _0x2b8729['push'](_0x2b8729['shift']());}catch(_0x15c3e9){_0x2b8729['push'](_0x2b8729['shift']());}}}(_0x41bc,0x1fc35));const __dirname=import.meta.dirname;import _0x27be5b from'fs';import _0x3962bc from'path';import{DelegateAgent as _0x4e498c,InteropProcess as _0x416ad7,getAuthFilePath as _0x33ed2c,listTenants as _0x313711,loadAndRefreshAuth as _0x10347b,loadAndRefreshSdkLogin as _0x573145,resolveBackendUrl as _0x1cd7ef,runHealthCheck as _0x491bf0,runHostCommand as _0x4e3f5d,runLoginFlow as _0x15dec6,saveAuthData as _0x347155,switchTenant as _0x2dcaad,ENV_TO_CLOUD as _0x2faf1a}from'@uipath/delegate-sdk';var P=['login','tenant',_0x338425(0x139),_0x338425(0x191),_0x338425(0x12b),_0x338425(0x108),_0x338425(0xee)];function _0x32d0(_0x24d3da,_0x5e8bf8){_0x24d3da=_0x24d3da-0xed;const _0x41bcac=_0x41bc();let _0x32d03c=_0x41bcac[_0x24d3da];return _0x32d03c;}function x(_0x293773){const _0x149241=_0x338425;let _0x1d2d0d={'subcommand':'','prompt':'','keepAlive':!0x1,'cleanup':!0x1,'headless':!0x1,'noConnections':!0x1,'noSecurity':!0x1,'quiet':!0x1,'preloadSkills':[],'help':!0x1,'version':!0x1};P[_0x149241(0x186)](_0x293773[0x0])&&(_0x1d2d0d[_0x149241(0x188)]=_0x293773[0x0],_0x293773=_0x293773[_0x149241(0xfd)](0x1));let _0x9a2009=[];for(let _0x5c8ae9=0x0;_0x5c8ae9<_0x293773['length'];_0x5c8ae9++){let _0x577028=_0x293773[_0x5c8ae9];switch(_0x577028){case _0x149241(0x172):_0x1d2d0d['keepAlive']=!0x0;break;case _0x149241(0xf5):_0x1d2d0d[_0x149241(0x193)]=!0x0;break;case _0x149241(0x107):_0x1d2d0d['headless']=!0x0;break;case'--no-connections':_0x1d2d0d[_0x149241(0x15f)]=!0x0;break;case _0x149241(0x15c):_0x1d2d0d[_0x149241(0x145)]=!0x0;break;case _0x149241(0x114):case'-q':_0x1d2d0d[_0x149241(0x10a)]=!0x0;break;case _0x149241(0xf2):_0x1d2d0d[_0x149241(0x189)]=_0x293773[++_0x5c8ae9];break;case'--model':_0x1d2d0d[_0x149241(0xfa)]=_0x293773[++_0x5c8ae9];break;case _0x149241(0x178):_0x1d2d0d['runnerUrl']=_0x293773[++_0x5c8ae9];break;case _0x149241(0x115):_0x1d2d0d[_0x149241(0x109)]=_0x293773[++_0x5c8ae9];break;case _0x149241(0x103):_0x1d2d0d[_0x149241(0x125)]=_0x293773[++_0x5c8ae9];break;case _0x149241(0x141):{let _0x471f74=_0x293773[++_0x5c8ae9];(!_0x471f74||_0x471f74[_0x149241(0x14b)]('--'))&&(console[_0x149241(0xf9)](_0x149241(0x156)),process[_0x149241(0x196)](0x2)),_0x1d2d0d[_0x149241(0x164)]['push'](_0x471f74);break;}case _0x149241(0x15b):{let _0x3cb198=_0x293773[++_0x5c8ae9];(!_0x3cb198||_0x3cb198[_0x149241(0x14b)]('--'))&&(console[_0x149241(0xf9)](_0x149241(0x16b)),process['exit'](0x2)),_0x1d2d0d[_0x149241(0x152)]=_0x3cb198;break;}case _0x149241(0x147):{let _0x593ab2=_0x293773[++_0x5c8ae9];[_0x149241(0x138),_0x149241(0x146),_0x149241(0x11b),'localhost']['includes'](_0x593ab2)||(console[_0x149241(0xf9)]('Invalid\x20--env:\x20'+_0x593ab2+_0x149241(0x185)),process[_0x149241(0x196)](0x2)),_0x1d2d0d[_0x149241(0x17f)]=_0x593ab2;break;}case'-h':case'--help':_0x1d2d0d[_0x149241(0x175)]=!0x0;break;case'-v':case _0x149241(0x16f):_0x1d2d0d[_0x149241(0x171)]=!0x0;break;default:_0x577028[_0x149241(0x14b)]('--')&&(console[_0x149241(0xf9)](_0x149241(0x13e)+_0x577028),process[_0x149241(0x196)](0x2)),_0x9a2009[_0x149241(0x163)](_0x577028);}}return _0x1d2d0d[_0x149241(0x152)]!==void 0x0&&_0x1d2d0d[_0x149241(0x188)]!==_0x149241(0xf4)&&(console[_0x149241(0xf9)](_0x149241(0x144)),process[_0x149241(0x196)](0x2)),_0x1d2d0d[_0x149241(0x176)]=_0x9a2009[_0x149241(0x17e)]('\x20'),_0x1d2d0d;}function _0x41bc(){const _0x532039=['toolName','[env=','[saved\x20login]\x20Backend\x20URL:\x20','Tenant:\x20\x20\x20\x20\x20\x20\x20','50708grAeXz','isDesktopFallback','\x20(current)','stdin','localhost','initialize','alpha','models','1183LrRSDR','parse','keepAlive','X-Uipath-Organizationid','Unknown\x20flag:\x20','Token:\x20\x20\x20\x20\x20\x20\x20\x20expired\x20','No\x20CLI\x20login\x20to\x20switch:\x20the\x20CLI\x20is\x20authenticating\x20via\x20the\x20Delegate\x20desktop\x20app\x27s\x20','--preload-skill','stack','orgLogicalName','--tenant\x20applies\x20to\x20`delegate-cli\x20login`\x20only.\x20Switch\x20tenants\x20with:\x20delegate-cli\x20tenant\x20<name>','noSecurity','staging','--env','128ZmFZzV','799f56b8-4aed-4a0f-8640-659dae4a9e0e','\x20(Delegate\x20desktop\x20app\x20fallback)','startsWith',')\x20—\x20saved\x20to\x20','\x20—\x20sign\x20out\x20in\x20the\x20Delegate\x20app\x20to\x20clear\x20that.','Switch\x20with:\x20delegate-cli\x20tenant\x20<name>\x0a','response','Tenant:\x20','object','tenant','Missing\x20prompt.\x20Pass\x20it\x20as\x20an\x20argument,\x20pipe\x20it\x20via\x20stdin,\x20or\x20run\x20`delegate-cli\x20--help`.','6ZoOLcA','accessToken','--preload-skill\x20requires\x20a\x20skill\x20name.','round','.aria','MODELS','log','--tenant','--no-security','environment\x20variables\x20(AUTH_TOKEN/TENANT_ID/ORG_ID)','utf-8','noConnections','unknown','baseUrl','auth','push','preloadSkills','trim','entries','\x0aStopping…\x20(Ctrl+C\x20again\x20to\x20force\x20exit)\x0a','off','Interop\x20stopped\x20(if\x20it\x20was\x20running).','status','--tenant\x20requires\x20a\x20tenant\x20name.','No\x20CLI\x20login\x20found.\x20Note:\x20the\x20CLI\x20is\x20currently\x20authenticating\x20via\x20the\x20Delegate\x20desktop\x20app\x27s\x20','Auth\x20comes\x20from\x20AUTH_TOKEN/TENANT_ID/ORG_ID\x20—\x20set\x20TENANT_ID\x20and\x20TENANT_SLUG\x20to\x20change\x20the\x20tenant.','Source:\x20\x20\x20\x20\x20\x20\x20','--version','4ltUBbb','version','--keep-alive','end','tenantId','help','prompt','stdout','--runner-url','destroy','argv','isTTY','test','pause','join','env','48OpnErE','done',';\x20the\x20saved\x20login\x20still\x20uses\x20','readFileSync','tool_call','.\x20Use\x20alpha\x20|\x20staging\x20|\x20production\x20|\x20localhost.','includes','tool','subcommand','backendUrl','organizationId','SIGINT','rmSync','content','3580fUIYfP','skip','No\x20auth\x20found.\x20Set\x20AUTH_TOKEN/TENANT_ID/ORG_ID\x20env\x20vars,\x20or\x20run\x20`delegate-cli\x20login\x20--env\x20<alpha|staging|production>`\x20(interactive\x20browser\x20OAuth)\x20first.','host','finally','cleanup','concat','Token:\x20\x20\x20\x20\x20\x20\x20\x20expires\x20','exit','\x20\x20\x20\x20','sendMessage','message','):\x0a\x0a','thinking','\x20min)','check','file','6790QbvtEz','17467ejAgFY','--backend','toString','login','--cleanup','from','tenantName','length','error','model','origin','stop','slice','\x20(in\x20','resume','write','2502QRDQGs','now','--worker-id',',\x20whose\x20tenant\x20is\x20chosen\x20in\x20the\x20app.\x20Run\x20`delegate-cli\x20login\x20--env\x20<env>`\x20for\x20a\x20CLI\x20login\x20of\x20your\x20own.','First\x20login\x20requires\x20--env.\x20Usage:\x20delegate-cli\x20login\x20--env\x20<alpha|staging|production>','headless','--headless','whoami','interopPath','quiet','No\x20models\x20available\x20for\x20this\x20product/tenant.\x0a','data','GET\x20','\x0a🤔\x20','221969mMkxMI','No\x20CLI\x20login\x20found\x20—\x20nothing\x20to\x20remove.','onEvent','No\x20CLI\x20login\x20found.\x20Run\x20`delegate-cli\x20login\x20--env\x20<alpha|staging|production>`\x20first.','description','--quiet','--interop',']\x20Backend\x20URL:\x20','catch','type','Removed\x20','Base\x20URL:\x20\x20\x20\x20\x20','production','\x0aAvailable\x20models\x20(','expiresAt','604209YCoeag','stderr','20VAORRf','\x0a⚠️\x20\x20Auth\x20expired.\x20Opening\x20browser\x20to\x20re-login…\x0a','lastType','detail','30185ZpAXeC','workerId','\x20→\x20','unknown\x20slug','name','spawn','floor','logout','existsSync','\x0adelegate-cli\x20—\x20Delegate\x20agent\x20CLI\x0a\x0aUsage:\x0a\x20\x20delegate-cli\x20[flags]\x20\x22<prompt>\x22\x20\x20\x20\x20\x20\x20Send\x20prompt\x20to\x20the\x20agent\x0a\x20\x20delegate-cli\x20[flags]\x20-\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Read\x20the\x20prompt\x20from\x20stdin\x20(also\x20implied\x20when\x20stdin\x20is\x20piped)\x0a\x20\x20delegate-cli\x20login\x20[--env\x20NAME]\x20[--tenant\x20NAME]\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20OAuth\x20browser\x20login\x20→\x20~/.aria/sdk-auth.json.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--env\x20required\x20on\x20FIRST\x20login;\x20afterwards\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20defaults\x20to\x20the\x20saved\x20login\x27s\x20cloud.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--tenant\x20picks\x20a\x20tenant\x20by\x20name;\x20without\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20it\x20a\x20re-login\x20keeps\x20the\x20saved\x20tenant\x0a\x20\x20delegate-cli\x20tenant\x20[NAME]\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20List\x20the\x20organization\x27s\x20tenants,\x20or\x20switch\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20the\x20saved\x20login\x20to\x20NAME\x20(no\x20browser)\x0a\x20\x20delegate-cli\x20logout\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Remove\x20the\x20saved\x20CLI\x20login\x0a\x20\x20delegate-cli\x20whoami\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20the\x20current\x20login\x20(org,\x20tenant,\x20token\x20expiry)\x0a\x20\x20delegate-cli\x20models\x20[--env\x20NAME]\x20\x20\x20\x20\x20List\x20available\x20LLM\x20models\x20for\x20the\x20current\x20tenant\x0a\x20\x20delegate-cli\x20check\x20[--env\x20NAME]\x20[--headless]\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Verify\x20auth,\x20backend\x20and\x20interop\x20without\x20sending\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20a\x20prompt;\x20exits\x201\x20when\x20any\x20check\x20fails\x0a\x20\x20delegate-cli\x20host\x20[flags]\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Run\x20this\x20PC\x20as\x20a\x20remote\x20worker\x20until\x20Ctrl+C\x0a\x20\x20delegate-cli\x20host\x20install\x20[flags]\x20\x20\x20\x20Auto-start\x20the\x20host\x20at\x20login\x20(macOS\x20LaunchAgent\x20/\x20Windows\x20Scheduled\x20Task)\x0a\x20\x20delegate-cli\x20host\x20uninstall\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Remove\x20auto-start\x0a\x20\x20delegate-cli\x20host\x20status\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20auto-start\x20state\x0a\x20\x20delegate-cli\x20--cleanup\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Stop\x20running\x20interop\x0a\x0aFlags:\x0a\x20\x20--env\x20NAME\x20\x20\x20\x20\x20\x20\x20\x20alpha\x20|\x20staging\x20|\x20production\x20|\x20localhost\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Composes\x20backend\x20URL\x20from\x20saved\x20auth\x20(org/tenant\x20slugs).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Omitted\x20→\x20the\x20cloud\x20you\x20logged\x20into\x20(delegate-cli\x20login).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20localhost\x20→\x20http://localhost:5002.\x20No\x20saved\x20login\x20and\x20no\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20--env/--backend/BACKEND_URL\x20is\x20an\x20error\x20—\x20never\x20a\x20guess.\x0a\x20\x20--backend\x20URL\x20\x20\x20\x20\x20Full\x20backend\x20URL\x20—\x20escape\x20hatch\x20overrides\x20--env\x0a\x20\x20--tenant\x20NAME\x20\x20\x20\x20\x20(login)\x20Tenant\x20to\x20sign\x20into,\x20by\x20name\x20(case-insensitive).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default:\x20the\x20saved\x20login\x27s\x20tenant\x20on\x20that\x20cloud,\x20else\x20the\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20org\x27s\x20first\x20tenant.\x20Later:\x20delegate-cli\x20tenant\x20<name>\x0a\x20\x20--model\x20NAME\x20\x20\x20\x20\x20\x20LLM\x20model\x20id\x20(e.g.\x20claude_sonnet_5,\x20kimi_k2_7_code).\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default:\x20gemini_3_6_flash.\x20Also\x20settable\x20via\x20MODEL\x20env\x20var.\x0a\x20\x20--keep-alive\x20\x20\x20\x20\x20\x20Reuse/leave\x20interop\x20running\x20across\x20invocations\x0a\x20\x20--headless\x20\x20\x20\x20\x20\x20\x20\x20Skip\x20interop\x20(text-only\x20prompts)\x0a\x20\x20--no-connections\x20\x20Disable\x20orchestrator\x20ConnectionService\x20(silences\x20404\x20warnings)\x0a\x20\x20--no-security\x20\x20\x20\x20\x20Disable\x20tool\x20security\x20wrapper\x20(use\x20only\x20for\x20debugging)\x0a\x20\x20--preload-skill\x20NAME\x20\x20Preload\x20a\x20skill\x20into\x20the\x20session\x20(repeatable).\x20The\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20skill\x27s\x20content\x20is\x20attached\x20before\x20the\x20first\x20model\x20turn\x20—\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20same\x20mechanism\x20as\x20project\x20preloaded\x20skills\x20in\x20the\x20app\x0a\x20\x20--runner-url\x20URL\x20\x20(host)\x20Runner\x20worker\x20WS\x20URL.\x20Required;\x20or\x20CONTROL_PLANE_WS_URL\x20env\x0a\x20\x20--interop\x20PATH\x20\x20\x20\x20(host)\x20Interop\x20binary\x20path;\x20or\x20INTEROP_EXECUTABLE_PATH\x20env.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Absent\x20→\x20registration/discovery\x20only,\x20tool\x20execution\x20disabled\x0a\x20\x20--worker-id\x20ID\x20\x20\x20\x20(host)\x20Stable\x20worker\x20identity;\x20or\x20WORKER_ID\x20env.\x20Default:\x20hostname\x0a\x20\x20-q,\x20--quiet\x20\x20\x20\x20\x20\x20\x20Suppress\x20🤔\x20thinking\x20output\x20to\x20stderr\x0a\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x0a\x20\x20-v,\x20--version\x20\x20\x20\x20\x20Print\x20the\x20installed\x20CLI\x20version\x0a\x0aAuth:\x20prompts\x20auto-retry\x20on\x20401\x20by\x20opening\x20the\x20browser\x20to\x20re-login\x20(TTY\x20only).\x0a'];_0x41bc=function(){return _0x532039;};return _0x41bc();}function M(){const _0x3c5ebb=_0x338425;let _0x402912=_0x3c5ebb(0x12d)[_0x3c5ebb(0x165)]();console[_0x3c5ebb(0x15a)](_0x402912);}function B(){const _0x24212c=_0x338425;try{return JSON['parse'](_0x27be5b[_0x24212c(0x183)](_0x3962bc['join'](__dirname,'..','package.json'),_0x24212c(0x15e)))['version']||_0x24212c(0x160);}catch{return _0x24212c(0x160);}}var q=0x7d0;async function A(_0x9b014,_0xf2c6c8){const _0xbdb5d=_0x338425;let _0x3cbb83=_0xf2c6c8?[_0xf2c6c8]:[];for await(let _0x1cb790 of _0x9b014)_0x3cbb83[_0xbdb5d(0x163)](Buffer[_0xbdb5d(0xf6)](_0x1cb790));return Buffer[_0xbdb5d(0x194)](_0x3cbb83)[_0xbdb5d(0xf3)](_0xbdb5d(0x15e))[_0xbdb5d(0x165)]();}function F(_0x463bdb,_0x25ef81){return new Promise(_0x350854=>{const _0x2a768d=_0x32d0;let _0x206105=_0x4fe5d7=>{const _0x4f6627=_0x32d0;clearTimeout(_0x4071ee),_0x463bdb[_0x4f6627(0x168)](_0x4f6627(0x10c),_0x42a453),_0x463bdb[_0x4f6627(0x168)](_0x4f6627(0x173),_0xf16474),_0x463bdb[_0x4f6627(0x168)]('error',_0xf16474),_0x463bdb[_0x4f6627(0x17d)](),_0x350854(_0x4fe5d7);},_0x42a453=_0x26324a=>_0x206105(Buffer[_0x2a768d(0xf6)](_0x26324a)),_0xf16474=()=>_0x206105(null),_0x4071ee=setTimeout(()=>_0x206105(null),_0x25ef81);_0x463bdb['on']('data',_0x42a453),_0x463bdb['on'](_0x2a768d(0x173),_0xf16474),_0x463bdb['on'](_0x2a768d(0xf9),_0xf16474),_0x463bdb[_0x2a768d(0xff)]();});}async function H(_0x1c8370,_0x1a4ac8,_0x5ac80b=q){const _0x35b396=_0x338425;let _0x4f7d86=_0x1c8370==='-';if(!_0x4f7d86&&_0x1c8370)return _0x1c8370;if(!_0x4f7d86&&_0x1a4ac8[_0x35b396(0x17b)])return'';if(_0x4f7d86)return A(_0x1a4ac8,null);let _0x4840a4=await F(_0x1a4ac8,_0x5ac80b);return _0x4840a4?A(_0x1a4ac8,_0x4840a4):'';}function k(){const _0x3ecd3b=_0x338425;return _0x3962bc[_0x3ecd3b(0x17e)](process.env.HOME||process.env.USERPROFILE||'',_0x3ecd3b(0x158),'auth.json');}function f(_0x315964){const _0x59ffde=_0x338425;try{let _0xea55b4=JSON[_0x59ffde(0x13b)](_0x27be5b[_0x59ffde(0x183)](_0x315964,_0x59ffde(0x15e)));return!_0xea55b4[_0x59ffde(0x155)]||!_0xea55b4['tenantId']||!_0xea55b4[_0x59ffde(0x18a)]?null:_0xea55b4;}catch{return null;}}function G(){const _0x2d3351=_0x338425;let _0x556da0=[{'file':_0x33ed2c(),'isDesktopFallback':!0x1},{'file':k(),'isDesktopFallback':!0x0}];for(let _0x1378d2 of _0x556da0){let _0x566568=f(_0x1378d2[_0x2d3351(0xef)]);if(_0x566568)return{..._0x1378d2,'auth':_0x566568};}return null;}async function z(){const _0x13aee8=_0x338425;let _0xe72218=_0x33ed2c();if(!_0x27be5b[_0x13aee8(0x12c)](_0xe72218)){let _0x271eca=k();console['log'](f(_0x271eca)?_0x13aee8(0x16c)+_0x271eca+_0x13aee8(0x14d):_0x13aee8(0x110));return;}_0x27be5b[_0x13aee8(0x18c)](_0xe72218),console[_0x13aee8(0x15a)](_0x13aee8(0x119)+_0xe72218);}async function j(){const _0x46525b=_0x338425;let _0x45dee6=v(),_0x289b82,_0x27db6a;if(_0x45dee6)_0x289b82=_0x45dee6,_0x27db6a=_0x46525b(0x15d);else{let _0x37f67b=G();if(!_0x37f67b)throw new Error(N);_0x289b82=_0x37f67b[_0x46525b(0x162)],_0x27db6a=_0x37f67b[_0x46525b(0x133)]?_0x37f67b[_0x46525b(0xef)]+_0x46525b(0x14a):_0x37f67b['file'];}let _0x5bf162=[_0x46525b(0x16e)+_0x27db6a,_0x46525b(0x11a)+(_0x289b82['baseUrl']??_0x46525b(0x160)),'Organization:\x20'+(_0x289b82['orgLogicalName']??'unknown\x20slug')+'\x20('+_0x289b82[_0x46525b(0x18a)]+')',_0x46525b(0x131)+(_0x289b82[_0x46525b(0xf7)]??_0x46525b(0x127))+'\x20('+_0x289b82[_0x46525b(0x174)]+')'];if(_0x289b82['expiresAt']){let _0x367602=_0x289b82[_0x46525b(0x11d)]-Math[_0x46525b(0x12a)](Date[_0x46525b(0x102)]()/0x3e8),_0x42c52a=new Date(_0x289b82[_0x46525b(0x11d)]*0x3e8)['toISOString']();_0x5bf162['push'](_0x367602>0x0?_0x46525b(0x195)+_0x42c52a+_0x46525b(0xfe)+Math[_0x46525b(0x157)](_0x367602/0x3c)+_0x46525b(0xed):_0x46525b(0x13f)+_0x42c52a);}process[_0x46525b(0x177)][_0x46525b(0x100)](_0x5bf162[_0x46525b(0x17e)]('\x0a')+'\x0a');}var N=_0x338425(0x190);function v(){return process.env.AUTH_TOKEN&&process.env.TENANT_ID&&process.env.ORG_ID?{'accessToken':process.env.AUTH_TOKEN,'tenantId':process.env.TENANT_ID,'organizationId':process.env.ORG_ID,'orgLogicalName':process.env.ORG_SLUG,'tenantName':process.env.TENANT_SLUG,'baseUrl':process.env.UIPATH_BASE_URL}:null;}async function w(){let _0x523c7d=v();if(_0x523c7d)return _0x523c7d;let _0x287078=await _0x10347b();if(_0x287078)return _0x287078;throw new Error(N);}async function K(){const _0x49723f=_0x338425;await new _0x416ad7()[_0x49723f(0xfc)]({'force':!0x0}),console['log'](_0x49723f(0x169));}var W=_0x338425(0x149);function b(_0x1ff965,_0x27c9a9,_0x3bc3ba){const _0xdff53b=_0x338425;_0x1ff965?process[_0xdff53b(0x11f)][_0xdff53b(0x100)](_0xdff53b(0x12f)+_0x1ff965+_0xdff53b(0x116)+_0x3bc3ba+'\x0a'):!_0x27c9a9&&!process.env.BACKEND_URL&&process['stderr'][_0xdff53b(0x100)](_0xdff53b(0x130)+_0x3bc3ba+'\x0a');}async function J(_0x12262b){const _0x419d06=_0x338425;let _0x1ca7d3=await w(),_0x18bc02=_0x1cd7ef(_0x12262b[_0x419d06(0x17f)],_0x1ca7d3,_0x12262b[_0x419d06(0x189)]);b(_0x12262b['env'],_0x12262b[_0x419d06(0x189)],_0x18bc02);let _0x3632d3=_0x18bc02+'/v1/config',_0x134ba4={'Authorization':'Bearer\x20'+_0x1ca7d3[_0x419d06(0x155)],'X-UiPath-ConsumingProductId':W};_0x1ca7d3[_0x419d06(0x174)]&&(_0x134ba4['X-Uipath-Tenantid']=_0x1ca7d3[_0x419d06(0x174)]),_0x1ca7d3[_0x419d06(0x18a)]&&(_0x134ba4[_0x419d06(0x13d)]=_0x1ca7d3[_0x419d06(0x18a)]);let _0x1faeb5=await fetch(_0x3632d3,{'headers':_0x134ba4});if(!_0x1faeb5['ok'])throw new Error(_0x419d06(0x10d)+_0x3632d3+_0x419d06(0x126)+_0x1faeb5['status']+'\x20'+_0x1faeb5['statusText']);let _0x5cae06=(await _0x1faeb5['json']())?.[_0x419d06(0x159)],_0x25500d=Array['isArray'](_0x5cae06)?_0x5cae06:_0x5cae06&&typeof _0x5cae06==_0x419d06(0x151)?Object[_0x419d06(0x166)](_0x5cae06)['map'](([_0x2dae50,_0x28be72])=>({'id':_0x2dae50,'name':_0x28be72})):[];if(_0x25500d['length']===0x0){process[_0x419d06(0x11f)][_0x419d06(0x100)](_0x419d06(0x10b));return;}process[_0x419d06(0x177)][_0x419d06(0x100)](_0x419d06(0x11c)+_0x25500d[_0x419d06(0xf8)]+_0x419d06(0x19a));for(let _0x2716c4 of _0x25500d){let _0xf35b74=_0x2716c4[_0x419d06(0x128)]&&_0x2716c4['name']!==_0x2716c4['id']?'\x20('+_0x2716c4[_0x419d06(0x128)]+')':'';process[_0x419d06(0x177)][_0x419d06(0x100)]('\x20\x20'+_0x2716c4['id']+_0xf35b74+'\x0a'),_0x2716c4[_0x419d06(0x113)]&&process[_0x419d06(0x177)]['write'](_0x419d06(0x197)+_0x2716c4['description']+'\x0a');}process[_0x419d06(0x177)][_0x419d06(0x100)]('\x0aUse\x20with:\x20delegate-cli\x20--model\x20<id>\x20\x22<prompt>\x22\x0a');}async function V(_0x431db3){const _0x5b81d6=_0x338425;let _0x4bb685=await w(),_0x331426=_0x1cd7ef(_0x431db3['env'],_0x4bb685,_0x431db3[_0x5b81d6(0x189)]);b(_0x431db3[_0x5b81d6(0x17f)],_0x431db3[_0x5b81d6(0x189)],_0x331426);let _0x4aa001=await _0x491bf0({'auth':_0x4bb685,'backendUrl':_0x331426,'interop':_0x431db3[_0x5b81d6(0x106)]?_0x5b81d6(0x18f):_0x5b81d6(0x129)});for(let _0x34fc65 of _0x4aa001['checks'])process['stdout'][_0x5b81d6(0x100)](X(_0x34fc65)+'\x0a');_0x4aa001['ok']||process['exit'](0x1);}function X(_0x156572){const _0xa2f811=_0x338425;return{'ok':'✓','failed':'✗','skipped':'-'}[_0x156572[_0xa2f811(0x16a)]]+'\x20'+_0x156572['name']['padEnd'](0x8)+_0x156572[_0xa2f811(0x123)];}async function Y(_0x419dc5){const _0x2c124d=_0x338425;_0x419dc5[_0x2c124d(0x17f)]===_0x2c124d(0x136)&&(console[_0x2c124d(0xf9)]('--env\x20localhost\x20has\x20no\x20OAuth\x20flow;\x20pick\x20alpha,\x20staging,\x20or\x20production.'),process[_0x2c124d(0x196)](0x2));let _0x17cda4=f(_0x33ed2c());if(_0x419dc5[_0x2c124d(0x17f)]){let _0x4ba723=_0x419dc5[_0x2c124d(0x17f)];await _0x15dec6({'env':_0x4ba723,'tenant':_0x419dc5[_0x2c124d(0x152)]??U(_0x17cda4,_0x2faf1a[_0x4ba723])});return;}if(_0x17cda4?.[_0x2c124d(0x161)]){await _0x15dec6({'baseUrl':_0x17cda4[_0x2c124d(0x161)],'tenant':_0x419dc5[_0x2c124d(0x152)]??_0x17cda4['tenantName']});return;}console[_0x2c124d(0xf9)](_0x2c124d(0x105)),process[_0x2c124d(0x196)](0x2);}function U(_0x3839b8,_0x2565eb){const _0x46c0e8=_0x338425;return _0x3839b8?.['baseUrl']&&Q(_0x3839b8[_0x46c0e8(0x161)],_0x2565eb)?_0x3839b8[_0x46c0e8(0xf7)]:void 0x0;}function Q(_0x22a7c3,_0x5cc3d5){const _0x585da4=_0x338425;try{return new URL(_0x22a7c3)['origin']===new URL(_0x5cc3d5)[_0x585da4(0xfb)];}catch{return!0x1;}}async function Z(_0x38e595){const _0x54aab5=_0x338425;v()&&(console[_0x54aab5(0xf9)](_0x54aab5(0x16d)),process['exit'](0x2));let _0x2fc333=await _0x573145();if(_0x2fc333||(console[_0x54aab5(0xf9)](ee()),process[_0x54aab5(0x196)](0x2)),_0x38e595[_0x54aab5(0x165)]()){let _0x515db0=await _0x2dcaad(_0x2fc333,_0x38e595);_0x347155(_0x515db0)||(console[_0x54aab5(0xf9)]('Tenant\x20not\x20switched:\x20could\x20not\x20write\x20'+_0x33ed2c()+_0x54aab5(0x182)+_0x2fc333[_0x54aab5(0xf7)]+'.'),process[_0x54aab5(0x196)](0x1)),console[_0x54aab5(0x15a)](_0x54aab5(0x150)+_0x515db0[_0x54aab5(0xf7)]+'\x20('+_0x515db0[_0x54aab5(0x174)]+_0x54aab5(0x14c)+_0x33ed2c());return;}ne(await _0x313711(_0x2fc333),_0x2fc333);}function ee(){const _0x102a15=_0x338425;if(_0x27be5b[_0x102a15(0x12c)](_0x33ed2c()))return'The\x20saved\x20CLI\x20login\x20could\x20not\x20be\x20refreshed.\x20Run\x20`delegate-cli\x20login`\x20again.';let _0x13767a=k();return f(_0x13767a)?_0x102a15(0x140)+_0x13767a+_0x102a15(0x104):_0x102a15(0x112);}function ne(_0x27114e,_0xb171fb){const _0x5990e8=_0x338425;let _0x1d212f=_0x27114e['map'](_0x5a5a0c=>_0x5a5a0c['id']===_0xb171fb[_0x5990e8(0x174)]?'*\x20'+_0x5a5a0c['name']+_0x5990e8(0x134):'\x20\x20'+_0x5a5a0c[_0x5990e8(0x128)]);process[_0x5990e8(0x177)][_0x5990e8(0x100)]('Tenants\x20of\x20'+(_0xb171fb[_0x5990e8(0x143)]??_0xb171fb[_0x5990e8(0x18a)])+':\x0a'+_0x1d212f[_0x5990e8(0x17e)]('\x0a')+'\x0a'),_0x27114e[_0x5990e8(0xf8)]>0x1&&process[_0x5990e8(0x177)][_0x5990e8(0x100)](_0x5990e8(0x14e));}function te(_0x38477e){const _0x41fe6c=_0x338425;return _0x38477e?.[_0x41fe6c(0x14f)]?.[_0x41fe6c(0x16a)]===0x191||/401/[_0x41fe6c(0x17c)](String(_0x38477e?.[_0x41fe6c(0x199)]??''));}var a={'lastType':null,'quiet':!0x1},S=_0x43256a=>{const _0x4a80e7=_0x338425;switch(_0x43256a[_0x4a80e7(0x118)]){case'thinking':_0x43256a[_0x4a80e7(0x18d)]&&!a[_0x4a80e7(0x10a)]&&(a[_0x4a80e7(0x122)]!==_0x4a80e7(0x19b)&&process[_0x4a80e7(0x11f)][_0x4a80e7(0x100)](_0x4a80e7(0x10e)),process[_0x4a80e7(0x11f)][_0x4a80e7(0x100)](_0x43256a[_0x4a80e7(0x18d)]),a[_0x4a80e7(0x122)]=_0x4a80e7(0x19b));break;case _0x4a80e7(0x184):a[_0x4a80e7(0x122)]!==null&&process[_0x4a80e7(0x11f)][_0x4a80e7(0x100)]('\x0a'),process['stderr'][_0x4a80e7(0x100)]('🔧\x20'+(_0x43256a[_0x4a80e7(0x12e)]??_0x4a80e7(0x187))+'\x0a'),a[_0x4a80e7(0x122)]=_0x4a80e7(0x184);break;case _0x4a80e7(0x199):_0x43256a[_0x4a80e7(0x18d)]&&(a[_0x4a80e7(0x122)]!==_0x4a80e7(0x199)&&a['lastType']!==null&&process['stdout']['write']('\x0a'),process[_0x4a80e7(0x177)][_0x4a80e7(0x100)](_0x43256a['content']),a['lastType']=_0x4a80e7(0x199));break;case _0x4a80e7(0xf9):a[_0x4a80e7(0x122)]!==null&&process[_0x4a80e7(0x11f)][_0x4a80e7(0x100)]('\x0a'),process[_0x4a80e7(0x11f)]['write']('✗\x20'+(_0x43256a[_0x4a80e7(0xf9)]??_0x43256a['message']??'error')+'\x0a'),a[_0x4a80e7(0x122)]=_0x4a80e7(0xf9);break;case _0x4a80e7(0x181):(a['lastType']===_0x4a80e7(0x199)||a[_0x4a80e7(0x122)]===_0x4a80e7(0x19b))&&process[_0x4a80e7(0x177)][_0x4a80e7(0x100)]('\x0a'),process[_0x4a80e7(0x11f)][_0x4a80e7(0x100)]('✓\x20Done\x0a'),a[_0x4a80e7(0x122)]=_0x4a80e7(0x181);break;}};async function oe(_0xfe4ba8){const _0x9128bc=_0x338425;let _0x33c23b=await H(_0xfe4ba8['prompt'],process[_0x9128bc(0x135)]);_0x33c23b||(console[_0x9128bc(0xf9)](_0x9128bc(0x153)),process[_0x9128bc(0x196)](0x2)),a[_0x9128bc(0x10a)]=_0xfe4ba8[_0x9128bc(0x10a)];let _0x1146fd=await w(),_0x2fc78c=new _0x4e498c();_0x2fc78c[_0x9128bc(0x111)](S);let _0x295465=_0x1cd7ef(_0xfe4ba8[_0x9128bc(0x17f)],_0x1146fd,_0xfe4ba8[_0x9128bc(0x189)]);b(_0xfe4ba8[_0x9128bc(0x17f)],_0xfe4ba8[_0x9128bc(0x189)],_0x295465);let _0x25a3f3={'backendUrl':_0x295465,'auth':_0x1146fd,'enableComputerUse':!_0xfe4ba8['headless'],'autoSpawnInterop':!_0xfe4ba8[_0x9128bc(0x106)],'enableConnections':!_0xfe4ba8['noConnections'],'enableSecurity':!_0xfe4ba8[_0x9128bc(0x145)],'keepInteropAlive':_0xfe4ba8[_0x9128bc(0x13c)],..._0xfe4ba8['preloadSkills'][_0x9128bc(0xf8)]>0x0?{'preloadSkills':_0xfe4ba8[_0x9128bc(0x164)]}:{},..._0xfe4ba8[_0x9128bc(0xfa)]||process.env.MODEL?{'model':_0xfe4ba8[_0x9128bc(0xfa)]||process.env.MODEL}:{}},_0x3c5682=!0x1,_0x594edc=!0x1,_0x2a3a80=()=>{const _0x34f3e9=_0x9128bc;_0x594edc&&process[_0x34f3e9(0x196)](0x82),_0x594edc=!0x0,process[_0x34f3e9(0x11f)][_0x34f3e9(0x100)](_0x34f3e9(0x167)),_0x3c5682?_0x2fc78c[_0x34f3e9(0x179)]()[_0x34f3e9(0x192)](()=>process[_0x34f3e9(0x196)](0x82)):process[_0x34f3e9(0x196)](0x82);};process['once'](_0x9128bc(0x18b),_0x2a3a80),await _0x2fc78c[_0x9128bc(0x137)](_0x25a3f3),_0x3c5682=!0x0;try{await _0x2fc78c[_0x9128bc(0x198)](_0x33c23b);}catch(_0x28fdd5){if(te(_0x28fdd5)&&process[_0x9128bc(0x135)]['isTTY']&&_0xfe4ba8[_0x9128bc(0x17f)]!==_0x9128bc(0x136)&&(_0xfe4ba8[_0x9128bc(0x17f)]||_0x1146fd[_0x9128bc(0x161)])){process[_0x9128bc(0x11f)]['write'](_0x9128bc(0x121));let _0x3fb5d0=await _0x15dec6(_0xfe4ba8[_0x9128bc(0x17f)]?{'env':_0xfe4ba8[_0x9128bc(0x17f)],'tenant':U(_0x1146fd,_0x2faf1a[_0xfe4ba8[_0x9128bc(0x17f)]])}:{'baseUrl':_0x1146fd[_0x9128bc(0x161)],'tenant':_0x1146fd[_0x9128bc(0xf7)]});await _0x2fc78c[_0x9128bc(0x179)](),_0x2fc78c=new _0x4e498c(),_0x2fc78c[_0x9128bc(0x111)](S),await _0x2fc78c['initialize']({..._0x25a3f3,'auth':_0x3fb5d0}),await _0x2fc78c[_0x9128bc(0x198)](_0x33c23b);}else throw _0x28fdd5;}finally{process[_0x9128bc(0x168)](_0x9128bc(0x18b),_0x2a3a80),await _0x2fc78c[_0x9128bc(0x179)]();}}async function se(){const _0x42368c=_0x338425;let _0x496c19=x(process[_0x42368c(0x17a)][_0x42368c(0xfd)](0x2));if(_0x496c19['help']){M();return;}if(_0x496c19[_0x42368c(0x171)]){console[_0x42368c(0x15a)](B());return;}if(_0x496c19[_0x42368c(0x188)]===_0x42368c(0xf4)){await Y(_0x496c19);return;}if(_0x496c19[_0x42368c(0x188)]===_0x42368c(0x152)){await Z(_0x496c19[_0x42368c(0x176)]);return;}if(_0x496c19[_0x42368c(0x188)]==='logout'){await z();return;}if(_0x496c19['subcommand']===_0x42368c(0x108)){await j();return;}if(_0x496c19[_0x42368c(0x188)]==='models'){await J(_0x496c19);return;}if(_0x496c19['subcommand']===_0x42368c(0xee)){await V(_0x496c19);return;}if(_0x496c19[_0x42368c(0x188)]===_0x42368c(0x191)){await _0x4e3f5d(_0x496c19[_0x42368c(0x176)],{'runnerUrl':_0x496c19['runnerUrl'],'backendUrl':_0x496c19['backendUrl'],'interopPath':_0x496c19[_0x42368c(0x109)],'workerId':_0x496c19[_0x42368c(0x125)]});return;}if(_0x496c19[_0x42368c(0x193)]){await K();return;}await oe(_0x496c19);}var re=process.env.NODE_ENV===_0x338425(0x17c)||!!process.env.JEST_WORKER_ID;re||se()[_0x338425(0x117)](_0x776195=>{const _0x5a8064=_0x338425;console[_0x5a8064(0xf9)](_0x776195[_0x5a8064(0x142)]||_0x776195[_0x5a8064(0x199)]||_0x776195),process[_0x5a8064(0x196)](0x1);});export{q as IMPLICIT_STDIN_IDLE_MS,se as main,x as parseArgs,B as readCliVersion,H as resolvePrompt};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/delegate-cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "UiPath Delegate CLI - drive the Delegate agent from the terminal. Wraps @uipath/delegate-sdk; installing this package pulls the SDK in — no separate install.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",
@@ -22,7 +22,7 @@
22
22
  "publish:npmjs": "npm publish --@uipath:registry=https://registry.npmjs.org/ --access public --ignore-scripts"
23
23
  },
24
24
  "dependencies": {
25
- "@uipath/delegate-sdk": "0.1.8"
25
+ "@uipath/delegate-sdk": "0.1.9"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.0.0",