@uipath/delegate-cli 0.1.6 → 0.1.8

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
@@ -34,8 +34,13 @@ delegate-cli [flags] "<prompt>" Send a prompt to the agent
34
34
  delegate-cli [flags] - Read the prompt from stdin (also implied when stdin is piped)
35
35
  Explicit `-` waits for EOF; the implicit form gives up after 2 s
36
36
  of silence so a missing prompt errors instead of hanging
37
- delegate-cli login [--env NAME] OAuth browser login (--env required on FIRST login;
38
- afterwards defaults to the saved login's cloud)
37
+ delegate-cli login [--env NAME] [--tenant NAME]
38
+ OAuth browser login (--env required on FIRST login;
39
+ afterwards defaults to the saved login's cloud;
40
+ --tenant picks a tenant by name, otherwise a
41
+ re-login keeps the saved tenant)
42
+ delegate-cli tenant [NAME] List the organization's tenants, or switch the saved
43
+ login to NAME — no browser round-trip
39
44
  delegate-cli logout Remove the saved CLI login
40
45
  delegate-cli whoami Show the current login (org, tenant, token expiry)
41
46
  delegate-cli models [--env NAME] List LLM models available on the tenant
@@ -54,6 +59,7 @@ delegate-cli --help
54
59
  |---|---|---|
55
60
  | `--env <name>` | saved login's cloud | `alpha` / `staging` / `production` / `localhost`. Composes the backend URL from saved org/tenant slugs; localhost → `http://localhost:5002`. Omitted → the cloud you logged into (`delegate-cli login`). With no saved login and no `--backend` / `BACKEND_URL` either, commands error — the CLI never guesses an environment. |
56
61
  | `--backend <url>` | — | Full backend URL — overrides `--env` and `BACKEND_URL`. |
62
+ | `--tenant <name>` | saved login's tenant, else the org's first | (`login` only) Tenant to sign into, matched by name case-insensitively. Without it a re-login keeps the tenant of the saved login on that cloud. An unknown name fails and lists the tenants that exist; on any other command the flag is refused — switch an existing login with `delegate-cli tenant <name>`. |
57
63
  | `--model <id>` | `gemini_3_6_flash` | LLM id (use `delegate-cli models` to discover). Also via `MODEL` env. |
58
64
  | `--headless` | off | Skip interop. Text-only prompts. |
59
65
  | `--keep-alive` | off | Reuse / leave interop running across invocations. Skips the 10–20 s cold start on the next call. |
@@ -132,6 +138,10 @@ Flags/env present at `install` time are persisted into the OS entry.
132
138
 
133
139
  `delegate-cli login --env <env>` runs OAuth PKCE in your browser and saves to `~/.aria/sdk-auth.json`. The first login must name the environment; from then on that cloud is the default — `delegate-cli login` re-logs into it, and prompts/`models` target it unless `--env`/`--backend` say otherwise.
134
140
 
141
+ The browser step only picks the organization (Identity asks when your account belongs to several). The tenant comes from the CLI: the organization's first tenant unless `--tenant <name>` names another, and a re-login on the same cloud keeps the saved tenant. The login output lists the organization's other tenants, and `delegate-cli whoami` shows the active one.
142
+
143
+ To change tenant afterwards, run `delegate-cli tenant <name>` — no browser: tokens are issued per organization, so the command only lists the organization's tenants, matches the name case-insensitively, and rewrites the tenant id and slug in `~/.aria/sdk-auth.json`. `delegate-cli tenant` alone lists the tenants and marks the current one. It works on the CLI's own login only: with `AUTH_TOKEN` env-var auth the tenant is `TENANT_ID`/`TENANT_SLUG`, and the Delegate desktop app's fallback file keeps the tenant chosen in the app.
144
+
135
145
  `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).
136
146
 
137
147
  `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.
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const _0x2f0b42=_0x52d9;(function(_0x1ad841,_0x979da7){const _0x145c7a=_0x52d9,_0x76ed51=_0x1ad841();while(!![]){try{const _0x87d2fc=-parseInt(_0x145c7a(0x229))/0x1+parseInt(_0x145c7a(0x1c0))/0x2+-parseInt(_0x145c7a(0x1e4))/0x3+-parseInt(_0x145c7a(0x1ca))/0x4*(-parseInt(_0x145c7a(0x236))/0x5)+-parseInt(_0x145c7a(0x1f9))/0x6*(-parseInt(_0x145c7a(0x1f6))/0x7)+-parseInt(_0x145c7a(0x215))/0x8+-parseInt(_0x145c7a(0x1ec))/0x9*(-parseInt(_0x145c7a(0x1d9))/0xa);if(_0x87d2fc===_0x979da7)break;else _0x76ed51['push'](_0x76ed51['shift']());}catch(_0x3da134){_0x76ed51['push'](_0x76ed51['shift']());}}}(_0x4c16,0xbf9a0));const __dirname=import.meta.dirname;import _0x19202a from'fs';import _0x33fcfd from'path';import{DelegateAgent as _0x2bb8b8,InteropProcess as _0x3c4eec,buildDelegateServiceUrl as _0x52483c,getAuthFilePath as _0x556aeb,loadAndRefreshAuth as _0x191ceb,runHostCommand as _0x562e79,runLoginFlow as _0x2ee80d}from'@uipath/delegate-sdk';var I={'alpha':_0x2f0b42(0x211),'staging':'https://staging.uipath.com','production':_0x2f0b42(0x213)},R=['login',_0x2f0b42(0x24f),_0x2f0b42(0x230),_0x2f0b42(0x217),_0x2f0b42(0x203)];function O(_0x523f15){const _0x26c0aa=_0x2f0b42;let _0x34e719={'subcommand':'','prompt':'','keepAlive':!0x1,'cleanup':!0x1,'headless':!0x1,'noConnections':!0x1,'noSecurity':!0x1,'quiet':!0x1,'preloadSkills':[],'help':!0x1,'version':!0x1};R[_0x26c0aa(0x24b)](_0x523f15[0x0])&&(_0x34e719[_0x26c0aa(0x1fd)]=_0x523f15[0x0],_0x523f15=_0x523f15[_0x26c0aa(0x207)](0x1));let _0x3caa2a=[];for(let _0x2d784b=0x0;_0x2d784b<_0x523f15[_0x26c0aa(0x204)];_0x2d784b++){let _0x5c4b3f=_0x523f15[_0x2d784b];switch(_0x5c4b3f){case'--keep-alive':_0x34e719[_0x26c0aa(0x1e8)]=!0x0;break;case'--cleanup':_0x34e719[_0x26c0aa(0x22d)]=!0x0;break;case'--headless':_0x34e719[_0x26c0aa(0x1de)]=!0x0;break;case _0x26c0aa(0x237):_0x34e719[_0x26c0aa(0x228)]=!0x0;break;case _0x26c0aa(0x205):_0x34e719[_0x26c0aa(0x242)]=!0x0;break;case _0x26c0aa(0x233):case'-q':_0x34e719[_0x26c0aa(0x21e)]=!0x0;break;case'--backend':_0x34e719[_0x26c0aa(0x247)]=_0x523f15[++_0x2d784b];break;case _0x26c0aa(0x202):_0x34e719[_0x26c0aa(0x20d)]=_0x523f15[++_0x2d784b];break;case'--runner-url':_0x34e719[_0x26c0aa(0x235)]=_0x523f15[++_0x2d784b];break;case _0x26c0aa(0x21d):_0x34e719[_0x26c0aa(0x1f1)]=_0x523f15[++_0x2d784b];break;case'--worker-id':_0x34e719[_0x26c0aa(0x1c2)]=_0x523f15[++_0x2d784b];break;case'--preload-skill':{let _0x1d6d05=_0x523f15[++_0x2d784b];(!_0x1d6d05||_0x1d6d05['startsWith']('--'))&&(console['error'](_0x26c0aa(0x1bc)),process[_0x26c0aa(0x1ef)](0x2)),_0x34e719[_0x26c0aa(0x1d2)][_0x26c0aa(0x206)](_0x1d6d05);break;}case _0x26c0aa(0x218):{let _0x2d699b=_0x523f15[++_0x2d784b];['alpha',_0x26c0aa(0x20e),_0x26c0aa(0x1c5),_0x26c0aa(0x1e1)]['includes'](_0x2d699b)||(console[_0x26c0aa(0x212)]('Invalid\x20--env:\x20'+_0x2d699b+_0x26c0aa(0x249)),process[_0x26c0aa(0x1ef)](0x2)),_0x34e719['env']=_0x2d699b;break;}case'-h':case _0x26c0aa(0x1da):_0x34e719[_0x26c0aa(0x24c)]=!0x0;break;case'-v':case'--version':_0x34e719[_0x26c0aa(0x1e5)]=!0x0;break;default:_0x5c4b3f[_0x26c0aa(0x1c3)]('--')&&(console[_0x26c0aa(0x212)](_0x26c0aa(0x20f)+_0x5c4b3f),process[_0x26c0aa(0x1ef)](0x2)),_0x3caa2a[_0x26c0aa(0x206)](_0x5c4b3f);}}return _0x34e719[_0x26c0aa(0x22e)]=_0x3caa2a[_0x26c0aa(0x22b)]('\x20'),_0x34e719;}function w(_0x1000c6,_0x174fff,_0x457515){const _0xfce530=_0x2f0b42;if(_0x457515)return _0x457515;if(process.env.BACKEND_URL)return process.env.BACKEND_URL;if(!_0x1000c6){if(_0x174fff?.[_0xfce530(0x1ed)]&&_0x174fff?.[_0xfce530(0x1d0)]&&_0x174fff?.[_0xfce530(0x1cc)])return _0x52483c(_0x174fff[_0xfce530(0x1ed)],_0x174fff[_0xfce530(0x1d0)],_0x174fff[_0xfce530(0x1cc)]);throw new Error('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).');}if(_0x1000c6==='localhost')return _0xfce530(0x1db);let _0x113a7a=I[_0x1000c6],_0x3aec1c=_0x174fff?.['orgLogicalName'],_0x8d426=_0x174fff?.[_0xfce530(0x1cc)];if(!_0x3aec1c||!_0x8d426)throw new Error('--env\x20'+_0x1000c6+'\x20needs\x20org/tenant\x20slugs.\x20Either:\x0a\x20\x20-\x20run\x20`delegate-cli\x20login\x20--env\x20'+_0x1000c6+_0xfce530(0x22f));return _0x52483c(_0x113a7a,_0x3aec1c,_0x8d426);}function C(){const _0x3a7767=_0x2f0b42;let _0x5f057d='\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\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\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--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'[_0x3a7767(0x1e6)]();console[_0x3a7767(0x227)](_0x5f057d);}function P(){const _0x5794b0=_0x2f0b42;try{return JSON[_0x5794b0(0x1bd)](_0x19202a[_0x5794b0(0x1cf)](_0x33fcfd[_0x5794b0(0x22b)](__dirname,'..','package.json'),_0x5794b0(0x1c1)))['version']||_0x5794b0(0x224);}catch{return _0x5794b0(0x224);}}var $=0x7d0;async function m(_0xced5a0,_0x26ef51){const _0x1b54a2=_0x2f0b42;let _0x2b29e7=_0x26ef51?[_0x26ef51]:[];for await(let _0x4f61e0 of _0xced5a0)_0x2b29e7[_0x1b54a2(0x206)](Buffer[_0x1b54a2(0x241)](_0x4f61e0));return Buffer[_0x1b54a2(0x1d3)](_0x2b29e7)[_0x1b54a2(0x214)](_0x1b54a2(0x1c1))[_0x1b54a2(0x1e6)]();}function x(_0x206a2c,_0x1bfb9f){return new Promise(_0xad8ab6=>{const _0x402d4c=_0x52d9;let _0x2a366d=_0x31e8c1=>{const _0xabc40=_0x52d9;clearTimeout(_0x2f6f26),_0x206a2c[_0xabc40(0x1f4)](_0xabc40(0x1dd),_0xc1436b),_0x206a2c['off'](_0xabc40(0x201),_0x5921ac),_0x206a2c['off'](_0xabc40(0x212),_0x5921ac),_0x206a2c[_0xabc40(0x1fc)](),_0xad8ab6(_0x31e8c1);},_0xc1436b=_0x149695=>_0x2a366d(Buffer[_0x402d4c(0x241)](_0x149695)),_0x5921ac=()=>_0x2a366d(null),_0x2f6f26=setTimeout(()=>_0x2a366d(null),_0x1bfb9f);_0x206a2c['on'](_0x402d4c(0x1dd),_0xc1436b),_0x206a2c['on'](_0x402d4c(0x201),_0x5921ac),_0x206a2c['on'](_0x402d4c(0x212),_0x5921ac),_0x206a2c[_0x402d4c(0x1f2)]();});}async function M(_0x37fe59,_0x538bf6,_0x1be6af=$){let _0x24b923=_0x37fe59==='-';if(!_0x24b923&&_0x37fe59)return _0x37fe59;if(!_0x24b923&&_0x538bf6['isTTY'])return'';if(_0x24b923)return m(_0x538bf6,null);let _0x37feae=await x(_0x538bf6,_0x1be6af);return _0x37feae?m(_0x538bf6,_0x37feae):'';}function S(){const _0x293780=_0x2f0b42;return _0x33fcfd['join'](process.env.HOME||process.env.USERPROFILE||'',_0x293780(0x200),'auth.json');}function A(_0x211b6a){const _0x8718be=_0x2f0b42;try{let _0x3364d9=JSON['parse'](_0x19202a[_0x8718be(0x1cf)](_0x211b6a,'utf-8'));return!_0x3364d9[_0x8718be(0x1c8)]||!_0x3364d9[_0x8718be(0x1e9)]||!_0x3364d9[_0x8718be(0x23b)]?null:_0x3364d9;}catch{return null;}}function y(){const _0x441bb9=_0x2f0b42;let _0x44b04c=[{'file':_0x556aeb(),'isDesktopFallback':!0x1},{'file':S(),'isDesktopFallback':!0x0}];for(let _0x2ae511 of _0x44b04c){let _0x353a77=A(_0x2ae511[_0x441bb9(0x24e)]);if(_0x353a77)return{..._0x2ae511,'auth':_0x353a77};}return null;}async function B(){const _0x4f7266=_0x2f0b42;let _0x46466b=_0x556aeb();if(!_0x19202a[_0x4f7266(0x1bf)](_0x46466b)){let _0x5988b2=S();console['log'](A(_0x5988b2)?_0x4f7266(0x20b)+_0x5988b2+'\x20—\x20sign\x20out\x20in\x20the\x20Delegate\x20app\x20to\x20clear\x20that.':_0x4f7266(0x1d5));return;}_0x19202a[_0x4f7266(0x1c6)](_0x46466b),console[_0x4f7266(0x227)](_0x4f7266(0x1cd)+_0x46466b);}async function F(){const _0x31fbb9=_0x2f0b42;let _0x57ec12=E(),_0x329faf,_0x2173b8;if(_0x57ec12)_0x329faf=_0x57ec12,_0x2173b8=_0x31fbb9(0x234);else{let _0x289c33=y();if(!_0x289c33)throw new Error(T);_0x329faf=_0x289c33[_0x31fbb9(0x1dc)],_0x2173b8=_0x289c33[_0x31fbb9(0x210)]?_0x289c33[_0x31fbb9(0x24e)]+_0x31fbb9(0x1eb):_0x289c33[_0x31fbb9(0x24e)];}let _0x2a2266=['Source:\x20\x20\x20\x20\x20\x20\x20'+_0x2173b8,_0x31fbb9(0x21f)+(_0x329faf[_0x31fbb9(0x1ed)]??'unknown'),_0x31fbb9(0x1d1)+(_0x329faf[_0x31fbb9(0x1d0)]??_0x31fbb9(0x23a))+'\x20('+_0x329faf[_0x31fbb9(0x23b)]+')',_0x31fbb9(0x1ee)+(_0x329faf['tenantName']??_0x31fbb9(0x23a))+'\x20('+_0x329faf[_0x31fbb9(0x1e9)]+')'];if(_0x329faf[_0x31fbb9(0x231)]){let _0x20b23f=_0x329faf[_0x31fbb9(0x231)]-Math[_0x31fbb9(0x243)](Date[_0x31fbb9(0x1ff)]()/0x3e8),_0x5484ae=new Date(_0x329faf['expiresAt']*0x3e8)[_0x31fbb9(0x1f3)]();_0x2a2266[_0x31fbb9(0x206)](_0x20b23f>0x0?_0x31fbb9(0x1f8)+_0x5484ae+_0x31fbb9(0x1d8)+Math[_0x31fbb9(0x23c)](_0x20b23f/0x3c)+_0x31fbb9(0x245):_0x31fbb9(0x20a)+_0x5484ae);}process[_0x31fbb9(0x1f7)][_0x31fbb9(0x1df)](_0x2a2266[_0x31fbb9(0x22b)]('\x0a')+'\x0a');}var T=_0x2f0b42(0x220);function E(){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;}function _0x52d9(_0x3a2fd2,_0x10f17f){_0x3a2fd2=_0x3a2fd2-0x1bc;const _0x4c1636=_0x4c16();let _0x52d9e1=_0x4c1636[_0x3a2fd2];return _0x52d9e1;}async function U(){let _0x46b00e=E();if(_0x46b00e)return _0x46b00e;let _0x5aac32=await _0x191ceb();if(_0x5aac32)return _0x5aac32;throw new Error(T);}async function q(){const _0x1823c7=_0x2f0b42;await new _0x3c4eec()[_0x1823c7(0x1d4)]({'force':!0x0}),console[_0x1823c7(0x227)](_0x1823c7(0x1fe));}var G=_0x2f0b42(0x1d6);function N(_0x30a260,_0x1fcfec,_0x166e3e){const _0x40d736=_0x2f0b42;_0x30a260?process[_0x40d736(0x1d7)]['write']('[env='+_0x30a260+_0x40d736(0x1ea)+_0x166e3e+'\x0a'):!_0x1fcfec&&!process.env.BACKEND_URL&&process['stderr'][_0x40d736(0x1df)](_0x40d736(0x24a)+_0x166e3e+'\x0a');}function _0x4c16(){const _0x3515d9=['object','accessToken','thinking','159848UgGlig','sendMessage','tenantName','Removed\x20','SIGINT','readFileSync','orgLogicalName','Organization:\x20','preloadSkills','concat','stop','No\x20CLI\x20login\x20found\x20—\x20nothing\x20to\x20remove.','799f56b8-4aed-4a0f-8640-659dae4a9e0e','stderr','\x20(in\x20','8920910nlCySk','--help','http://localhost:5002','auth','data','headless','write','✓\x20Done\x0a','localhost','entries','--env\x20localhost\x20has\x20no\x20OAuth\x20flow;\x20pick\x20alpha,\x20staging,\x20or\x20production.','4051956yImnNe','version','trim','name','keepAlive','tenantId',']\x20Backend\x20URL:\x20','\x20(Delegate\x20desktop\x20app\x20fallback)','9gHAFxr','baseUrl','Tenant:\x20\x20\x20\x20\x20\x20\x20','exit','env','interopPath','resume','toISOString','off','onEvent','26292qGZLIX','stdout','Token:\x20\x20\x20\x20\x20\x20\x20\x20expires\x20','774tbQDBp','tool','message','pause','subcommand','Interop\x20stopped\x20(if\x20it\x20was\x20running).','now','.aria','end','--model','whoami','length','--no-security','push','slice','\x0a⚠️\x20\x20Auth\x20expired.\x20Opening\x20browser\x20to\x20re-login…\x0a','toolName','Token:\x20\x20\x20\x20\x20\x20\x20\x20expired\x20','No\x20CLI\x20login\x20found.\x20Note:\x20the\x20CLI\x20is\x20currently\x20authenticating\x20via\x20the\x20Delegate\x20desktop\x20app\x27s\x20','type','model','staging','Unknown\x20flag:\x20','isDesktopFallback','https://alpha.uipath.com','error','https://cloud.uipath.com','toString','210944MdRraE','catch','logout','--env','response','initialize','test','/v1/config','--interop','quiet','Base\x20URL:\x20\x20\x20\x20\x20','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.','isArray','GET\x20','isTTY','unknown','description','MODELS','log','noConnections','801752xzyJGn','\x0aStopping…\x20(Ctrl+C\x20again\x20to\x20force\x20exit)\x0a','join','content','cleanup','prompt','`\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).','host','expiresAt','done','--quiet','environment\x20variables\x20(AUTH_TOKEN/TENANT_ID/ORG_ID)','runnerUrl','40pZjGbA','--no-connections','lastType','stdin','unknown\x20slug','organizationId','round','X-Uipath-Tenantid','\x20\x20\x20\x20','\x20→\x20','map','from','noSecurity','floor','\x0aUse\x20with:\x20delegate-cli\x20--model\x20<id>\x20\x22<prompt>\x22\x0a','\x20min)','status','backendUrl','login','.\x20Use\x20alpha\x20|\x20staging\x20|\x20production\x20|\x20localhost.','[saved\x20login]\x20Backend\x20URL:\x20','includes','help','tool_call','file','models','No\x20models\x20available\x20for\x20this\x20product/tenant.\x0a','--preload-skill\x20requires\x20a\x20skill\x20name.','parse','destroy','existsSync','2534522EexutM','utf-8','workerId','startsWith','finally','production','rmSync'];_0x4c16=function(){return _0x3515d9;};return _0x4c16();}async function j(_0x4b86da){const _0x4ffdf3=_0x2f0b42;let _0x533ba2=await U(),_0x1ba0a9=w(_0x4b86da['env'],_0x533ba2,_0x4b86da['backendUrl']);N(_0x4b86da['env'],_0x4b86da['backendUrl'],_0x1ba0a9);let _0xd065be=_0x1ba0a9+_0x4ffdf3(0x21c),_0x565de1={'Authorization':'Bearer\x20'+_0x533ba2[_0x4ffdf3(0x1c8)],'X-UiPath-ConsumingProductId':G};_0x533ba2[_0x4ffdf3(0x1e9)]&&(_0x565de1[_0x4ffdf3(0x23d)]=_0x533ba2[_0x4ffdf3(0x1e9)]),_0x533ba2[_0x4ffdf3(0x23b)]&&(_0x565de1['X-Uipath-Organizationid']=_0x533ba2[_0x4ffdf3(0x23b)]);let _0x5aab0e=await fetch(_0xd065be,{'headers':_0x565de1});if(!_0x5aab0e['ok'])throw new Error(_0x4ffdf3(0x222)+_0xd065be+_0x4ffdf3(0x23f)+_0x5aab0e[_0x4ffdf3(0x246)]+'\x20'+_0x5aab0e['statusText']);let _0x15c983=(await _0x5aab0e['json']())?.[_0x4ffdf3(0x226)],_0x2fe9c8=Array[_0x4ffdf3(0x221)](_0x15c983)?_0x15c983:_0x15c983&&typeof _0x15c983==_0x4ffdf3(0x1c7)?Object[_0x4ffdf3(0x1e2)](_0x15c983)[_0x4ffdf3(0x240)](([_0x211377,_0x383194])=>({'id':_0x211377,'name':_0x383194})):[];if(_0x2fe9c8[_0x4ffdf3(0x204)]===0x0){process[_0x4ffdf3(0x1d7)]['write'](_0x4ffdf3(0x250));return;}process[_0x4ffdf3(0x1f7)]['write']('\x0aAvailable\x20models\x20('+_0x2fe9c8[_0x4ffdf3(0x204)]+'):\x0a\x0a');for(let _0x56ee22 of _0x2fe9c8){let _0x55e57=_0x56ee22[_0x4ffdf3(0x1e7)]&&_0x56ee22['name']!==_0x56ee22['id']?'\x20('+_0x56ee22[_0x4ffdf3(0x1e7)]+')':'';process['stdout'][_0x4ffdf3(0x1df)]('\x20\x20'+_0x56ee22['id']+_0x55e57+'\x0a'),_0x56ee22[_0x4ffdf3(0x225)]&&process['stdout'][_0x4ffdf3(0x1df)](_0x4ffdf3(0x23e)+_0x56ee22['description']+'\x0a');}process[_0x4ffdf3(0x1f7)][_0x4ffdf3(0x1df)](_0x4ffdf3(0x244));}async function z(_0x2e0471){const _0x2c51b3=_0x2f0b42;if(_0x2e0471[_0x2c51b3(0x1f0)]==='localhost'&&(console[_0x2c51b3(0x212)](_0x2c51b3(0x1e3)),process[_0x2c51b3(0x1ef)](0x2)),_0x2e0471[_0x2c51b3(0x1f0)]){await _0x2ee80d({'env':_0x2e0471[_0x2c51b3(0x1f0)]});return;}let _0x1ae881=y();if(_0x1ae881?.[_0x2c51b3(0x1dc)][_0x2c51b3(0x1ed)]){await _0x2ee80d({'baseUrl':_0x1ae881[_0x2c51b3(0x1dc)][_0x2c51b3(0x1ed)]});return;}console[_0x2c51b3(0x212)]('First\x20login\x20requires\x20--env.\x20Usage:\x20delegate-cli\x20login\x20--env\x20<alpha|staging|production>'),process[_0x2c51b3(0x1ef)](0x2);}function K(_0x682db7){const _0x5e9449=_0x2f0b42;return _0x682db7?.[_0x5e9449(0x219)]?.[_0x5e9449(0x246)]===0x191||/401/[_0x5e9449(0x21b)](String(_0x682db7?.[_0x5e9449(0x1fb)]??''));}var a={'lastType':null,'quiet':!0x1},k=_0x22511c=>{const _0x1e9334=_0x2f0b42;switch(_0x22511c[_0x1e9334(0x20c)]){case'thinking':_0x22511c[_0x1e9334(0x22c)]&&!a['quiet']&&(a[_0x1e9334(0x238)]!==_0x1e9334(0x1c9)&&process[_0x1e9334(0x1d7)]['write']('\x0a🤔\x20'),process[_0x1e9334(0x1d7)][_0x1e9334(0x1df)](_0x22511c[_0x1e9334(0x22c)]),a[_0x1e9334(0x238)]=_0x1e9334(0x1c9));break;case'tool_call':a[_0x1e9334(0x238)]!==null&&process[_0x1e9334(0x1d7)][_0x1e9334(0x1df)]('\x0a'),process['stderr'][_0x1e9334(0x1df)]('🔧\x20'+(_0x22511c[_0x1e9334(0x209)]??_0x1e9334(0x1fa))+'\x0a'),a[_0x1e9334(0x238)]=_0x1e9334(0x24d);break;case'message':_0x22511c[_0x1e9334(0x22c)]&&(a['lastType']!==_0x1e9334(0x1fb)&&a[_0x1e9334(0x238)]!==null&&process[_0x1e9334(0x1f7)]['write']('\x0a'),process['stdout'][_0x1e9334(0x1df)](_0x22511c['content']),a['lastType']=_0x1e9334(0x1fb));break;case'error':a[_0x1e9334(0x238)]!==null&&process[_0x1e9334(0x1d7)]['write']('\x0a'),process[_0x1e9334(0x1d7)][_0x1e9334(0x1df)]('✗\x20'+(_0x22511c[_0x1e9334(0x212)]??_0x22511c['message']??_0x1e9334(0x212))+'\x0a'),a[_0x1e9334(0x238)]=_0x1e9334(0x212);break;case _0x1e9334(0x232):(a[_0x1e9334(0x238)]===_0x1e9334(0x1fb)||a[_0x1e9334(0x238)]===_0x1e9334(0x1c9))&&process['stdout'][_0x1e9334(0x1df)]('\x0a'),process['stderr'][_0x1e9334(0x1df)](_0x1e9334(0x1e0)),a[_0x1e9334(0x238)]=_0x1e9334(0x232);break;}};async function H(_0x982cc){const _0x1ca080=_0x2f0b42;let _0x3a9809=await M(_0x982cc[_0x1ca080(0x22e)],process[_0x1ca080(0x239)]);_0x3a9809||(console['error']('Missing\x20prompt.\x20Pass\x20it\x20as\x20an\x20argument,\x20pipe\x20it\x20via\x20stdin,\x20or\x20run\x20`delegate-cli\x20--help`.'),process[_0x1ca080(0x1ef)](0x2)),a[_0x1ca080(0x21e)]=_0x982cc[_0x1ca080(0x21e)];let _0x5e2784=await U(),_0x16cbbe=new _0x2bb8b8();_0x16cbbe[_0x1ca080(0x1f5)](k);let _0x5d9431=w(_0x982cc[_0x1ca080(0x1f0)],_0x5e2784,_0x982cc[_0x1ca080(0x247)]);N(_0x982cc[_0x1ca080(0x1f0)],_0x982cc[_0x1ca080(0x247)],_0x5d9431);let _0x5b450e={'backendUrl':_0x5d9431,'auth':_0x5e2784,'enableComputerUse':!_0x982cc[_0x1ca080(0x1de)],'autoSpawnInterop':!_0x982cc[_0x1ca080(0x1de)],'enableConnections':!_0x982cc[_0x1ca080(0x228)],'enableSecurity':!_0x982cc[_0x1ca080(0x242)],'keepInteropAlive':_0x982cc[_0x1ca080(0x1e8)],..._0x982cc['preloadSkills']['length']>0x0?{'preloadSkills':_0x982cc['preloadSkills']}:{},..._0x982cc[_0x1ca080(0x20d)]||process.env.MODEL?{'model':_0x982cc['model']||process.env.MODEL}:{}},_0x1a3999=!0x1,_0x2e8ee3=!0x1,_0x4fa62a=()=>{const _0x41f371=_0x1ca080;_0x2e8ee3&&process['exit'](0x82),_0x2e8ee3=!0x0,process[_0x41f371(0x1d7)][_0x41f371(0x1df)](_0x41f371(0x22a)),_0x1a3999?_0x16cbbe[_0x41f371(0x1be)]()[_0x41f371(0x1c4)](()=>process['exit'](0x82)):process[_0x41f371(0x1ef)](0x82);};process['once'](_0x1ca080(0x1ce),_0x4fa62a),await _0x16cbbe[_0x1ca080(0x21a)](_0x5b450e),_0x1a3999=!0x0;try{await _0x16cbbe['sendMessage'](_0x3a9809);}catch(_0x30cb66){if(K(_0x30cb66)&&process['stdin'][_0x1ca080(0x223)]&&_0x982cc['env']!==_0x1ca080(0x1e1)&&(_0x982cc[_0x1ca080(0x1f0)]||_0x5e2784[_0x1ca080(0x1ed)])){process[_0x1ca080(0x1d7)]['write'](_0x1ca080(0x208));let _0x309eac=await _0x2ee80d(_0x982cc[_0x1ca080(0x1f0)]?{'env':_0x982cc[_0x1ca080(0x1f0)]}:{'baseUrl':_0x5e2784[_0x1ca080(0x1ed)]});await _0x16cbbe['destroy'](),_0x16cbbe=new _0x2bb8b8(),_0x16cbbe[_0x1ca080(0x1f5)](k),await _0x16cbbe['initialize']({..._0x5b450e,'auth':_0x309eac}),await _0x16cbbe[_0x1ca080(0x1cb)](_0x3a9809);}else throw _0x30cb66;}finally{process[_0x1ca080(0x1f4)](_0x1ca080(0x1ce),_0x4fa62a),await _0x16cbbe[_0x1ca080(0x1be)]();}}async function W(){const _0x5c2bf5=_0x2f0b42;let _0x40341f=O(process['argv'][_0x5c2bf5(0x207)](0x2));if(_0x40341f[_0x5c2bf5(0x24c)]){C();return;}if(_0x40341f[_0x5c2bf5(0x1e5)]){console['log'](P());return;}if(_0x40341f[_0x5c2bf5(0x1fd)]===_0x5c2bf5(0x248)){await z(_0x40341f);return;}if(_0x40341f[_0x5c2bf5(0x1fd)]==='logout'){await B();return;}if(_0x40341f['subcommand']===_0x5c2bf5(0x203)){await F();return;}if(_0x40341f['subcommand']===_0x5c2bf5(0x24f)){await j(_0x40341f);return;}if(_0x40341f[_0x5c2bf5(0x1fd)]===_0x5c2bf5(0x230)){await _0x562e79(_0x40341f['prompt'],{'runnerUrl':_0x40341f[_0x5c2bf5(0x235)],'backendUrl':_0x40341f['backendUrl'],'interopPath':_0x40341f['interopPath'],'workerId':_0x40341f[_0x5c2bf5(0x1c2)]});return;}if(_0x40341f['cleanup']){await q();return;}await H(_0x40341f);}var J=process.env.NODE_ENV===_0x2f0b42(0x21b)||!!process.env.JEST_WORKER_ID;J||W()[_0x2f0b42(0x216)](_0x20f977=>{const _0x132015=_0x2f0b42;console[_0x132015(0x212)](_0x20f977['stack']||_0x20f977[_0x132015(0x1fb)]||_0x20f977),process[_0x132015(0x1ef)](0x1);});export{$ as IMPLICIT_STDIN_IDLE_MS,W as main,O as parseArgs,P as readCliVersion,M as resolvePrompt};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/delegate-cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
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.6"
25
+ "@uipath/delegate-sdk": "0.1.8"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.0.0",