@uipath/delegate-cli 0.1.1
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/LICENSE +204 -0
- package/README.md +166 -0
- package/dist/cli.mjs +2 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 UiPath Inc.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
204
|
+
Copyright 2026 UiPath Inc.
|
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# @uipath/delegate-cli
|
|
2
|
+
|
|
3
|
+
Drive the UiPath Delegate agent from the terminal — login, prompts, screenshots, UI automation, all headless. A thin wrapper over `@uipath/delegate-sdk` (installed automatically as a dependency): the SDK owns the agent, interop, login, and host machinery; this package owns the terminal surface.
|
|
4
|
+
|
|
5
|
+
- **Platforms**: macOS arm64, Windows x64, Linux x64. Linux is text-only — run with `--headless`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @uipath/delegate-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
npm pulls the CLI, the SDK, and your platform's runtime package (Mac arm64, Win x64, or Linux x64).
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx delegate-cli login --env production # browser OAuth → ~/.aria/sdk-auth.json
|
|
21
|
+
npx delegate-cli --env production "take a screenshot and tell me what's open"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
There is no default environment — every command that talks to a backend needs `--env` (or an explicit `--backend` URL).
|
|
25
|
+
|
|
26
|
+
If the access token expires mid-session in a TTY, the CLI opens the browser, re-logs in, and retries the prompt automatically.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## CLI
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
delegate-cli [flags] "<prompt>" Send a prompt to the agent
|
|
34
|
+
delegate-cli [flags] - Read the prompt from stdin (also implied when stdin is piped)
|
|
35
|
+
Explicit `-` waits for EOF; the implicit form gives up after 2 s
|
|
36
|
+
of silence so a missing prompt errors instead of hanging
|
|
37
|
+
delegate-cli login --env NAME OAuth browser login
|
|
38
|
+
delegate-cli logout Remove the saved CLI login
|
|
39
|
+
delegate-cli whoami Show the current login (org, tenant, token expiry)
|
|
40
|
+
delegate-cli models --env NAME List LLM models available on the tenant
|
|
41
|
+
delegate-cli host [flags] Run this PC as a remote worker until Ctrl+C
|
|
42
|
+
delegate-cli host install [flags] Auto-start the host at login (macOS/Windows)
|
|
43
|
+
delegate-cli host uninstall Remove auto-start
|
|
44
|
+
delegate-cli host status Show auto-start state
|
|
45
|
+
delegate-cli --cleanup Stop the running interop service
|
|
46
|
+
delegate-cli --version
|
|
47
|
+
delegate-cli --help
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Flags
|
|
51
|
+
|
|
52
|
+
| Flag | Default | What it does |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `--env <name>` | — (required) | `alpha` / `staging` / `production` / `localhost`. Composes the backend URL from saved org/tenant slugs; localhost → `http://localhost:5002`. Required for prompts, `models`, and `login` unless `--backend` / `BACKEND_URL` supplies the URL — there is no default environment. |
|
|
55
|
+
| `--backend <url>` | — | Full backend URL — overrides `--env` and `BACKEND_URL`. |
|
|
56
|
+
| `--model <id>` | `gemini_3_6_flash` | LLM id (use `delegate-cli models` to discover). Also via `MODEL` env. |
|
|
57
|
+
| `--headless` | off | Skip interop. Text-only prompts. |
|
|
58
|
+
| `--keep-alive` | off | Reuse / leave interop running across invocations. Skips the 10–20 s cold start on the next call. |
|
|
59
|
+
| `--cleanup` | — | Force-stop the running interop (from `~/.delegate-sdk/interop.pid`) and exit. |
|
|
60
|
+
| `--no-connections` | off | Disable orchestrator ConnectionService (silences 404 noise on tenants without orchestrator). |
|
|
61
|
+
| `--no-security` | off | Disable tool security wrapper. Debug only. |
|
|
62
|
+
| `--preload-skill <name>` | — | Preload a skill into the session (repeatable). |
|
|
63
|
+
| `-q`, `--quiet` | off | Suppress 🤔 thinking on stderr. |
|
|
64
|
+
| `-v`, `--version` | — | Print the installed CLI version. |
|
|
65
|
+
| `--runner-url <url>` | — | (host) Runner worker WS URL. Required; or `CONTROL_PLANE_WS_URL` env. |
|
|
66
|
+
| `--interop <path>` | — | (host) Interop binary path; or `INTEROP_EXECUTABLE_PATH` env. Absent → registration/discovery only, tool execution disabled. |
|
|
67
|
+
| `--worker-id <id>` | hostname | (host) Stable worker identity; or `WORKER_ID` env. |
|
|
68
|
+
|
|
69
|
+
### Examples
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Cloud, computer use, suppress chatter
|
|
73
|
+
npx delegate-cli --env production -q --no-connections "open Chrome and search UiPath"
|
|
74
|
+
|
|
75
|
+
# Pick a model
|
|
76
|
+
npx delegate-cli --env production --model claude_opus_4_8 "explain quantum entanglement"
|
|
77
|
+
|
|
78
|
+
# Headless: no interop, fastest for text-only prompts
|
|
79
|
+
npx delegate-cli --headless --env production "summarize the last release notes"
|
|
80
|
+
|
|
81
|
+
# Pipe the prompt from stdin
|
|
82
|
+
cat notes.md | npx delegate-cli --headless --env production -
|
|
83
|
+
|
|
84
|
+
# Iterate fast with persistent interop
|
|
85
|
+
npx delegate-cli --keep-alive --env production "take a screenshot"
|
|
86
|
+
npx delegate-cli --keep-alive --env production "now describe the active window" # < 1 s, no spawn
|
|
87
|
+
npx delegate-cli --cleanup # stop when done
|
|
88
|
+
|
|
89
|
+
# Override backend URL fully
|
|
90
|
+
npx delegate-cli --backend "https://custom.example.com/autopilot-everywhere" "..."
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Run as a remote machine (host mode)
|
|
96
|
+
|
|
97
|
+
`delegate-cli host` registers this PC as a remote worker on a runner control plane and serves tool executions until Ctrl+C — no Electron app needed.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx delegate-cli login --env production # once
|
|
101
|
+
npx delegate-cli host --runner-url wss://runner.example/worker \
|
|
102
|
+
--interop /path/to/UiPath.Aria.ComputerUse.Api # omit --interop → discovery only
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Backend URL defaults to the saved login's org/tenant (override with `--backend` or `AUTOPILOT_BACKEND_URL`). Tokens refresh automatically from `~/.aria/sdk-auth.json`; when refresh permanently fails the host prints a re-login instruction and exits non-zero.
|
|
106
|
+
|
|
107
|
+
When the runner URL points at the cloud front door (`wss://<cloud>/delegate_/websocket_/…`), the host fills the account/tenant query parameters from the saved login's org/tenant slugs so the request can be routed. Explicit non-empty params on the URL win; each missing or empty one is filled independently. Other runner URLs are left unchanged for compatibility with older runners that reject query strings.
|
|
108
|
+
|
|
109
|
+
### Auto-start at login
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npx delegate-cli host install --runner-url wss://runner.example/worker # needs a saved login
|
|
113
|
+
npx delegate-cli host status # one-line state
|
|
114
|
+
npx delegate-cli host uninstall # idempotent
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Flags/env present at `install` time are persisted into the OS entry.
|
|
118
|
+
|
|
119
|
+
| OS | Mechanism | Notes |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| macOS | LaunchAgent `com.uipath.delegate.host` in `~/Library/LaunchAgents/` | Restarts on crash, not on clean exit. Logs: `~/Library/Logs/UiPathDelegateHost/`. |
|
|
122
|
+
| Windows | Scheduled Task "UiPath Delegate Host" (at logon) | Env vars are baked into the task as flags. Output not captured — run `delegate-cli host` manually to debug. |
|
|
123
|
+
| Linux | Not supported yet | |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Authentication
|
|
128
|
+
|
|
129
|
+
`delegate-cli login --env <env>` runs OAuth PKCE in your browser and saves to `~/.aria/sdk-auth.json`. The environment is always explicit — `login` without `--env` is an error, not a default.
|
|
130
|
+
|
|
131
|
+
`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).
|
|
132
|
+
|
|
133
|
+
`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.
|
|
134
|
+
|
|
135
|
+
Tokens with < 30 % lifetime left are refreshed proactively on startup. 401s in a TTY trigger the login flow inline and retry.
|
|
136
|
+
|
|
137
|
+
To authenticate as your own identity app (custom `UIPATH_CLIENT_ID` / `UIPATH_CLIENT_SECRET`), see the "Using your own identity app" section in the `@uipath/delegate-sdk` README — the same environment variables apply to the CLI.
|
|
138
|
+
|
|
139
|
+
**No-browser alternative**:
|
|
140
|
+
```bash
|
|
141
|
+
AUTH_TOKEN=... TENANT_ID=... ORG_ID=... npx delegate-cli --env production "..."
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Telemetry
|
|
147
|
+
|
|
148
|
+
The CLI reports usage analytics linked to the signed-in UiPath account (user, organization, and tenant, plus task and tool events — never prompts, file contents, or tool outputs) to help improve the product. To disable it entirely:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
DELEGATE_TELEMETRY_DISABLED=1 npx delegate-cli --env production "..."
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`1` or `true` (case-insensitive) turns all reporting off. The same variable disables telemetry in the UiPath Delegate desktop app.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Documentation & support
|
|
159
|
+
|
|
160
|
+
See [docs.uipath.com](https://docs.uipath.com) for product documentation. For issues with the package, contact UiPath support.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const _0x5f3285=_0x5182;(function(_0x549c43,_0x135b0e){const _0x209138=_0x5182,_0x409309=_0x549c43();while(!![]){try{const _0x59fbbb=parseInt(_0x209138(0x115))/0x1*(-parseInt(_0x209138(0xbe))/0x2)+-parseInt(_0x209138(0xd4))/0x3*(parseInt(_0x209138(0xf3))/0x4)+-parseInt(_0x209138(0x146))/0x5*(-parseInt(_0x209138(0xdb))/0x6)+parseInt(_0x209138(0xfd))/0x7*(parseInt(_0x209138(0xbd))/0x8)+-parseInt(_0x209138(0x102))/0x9*(parseInt(_0x209138(0xe9))/0xa)+parseInt(_0x209138(0xc2))/0xb+parseInt(_0x209138(0x108))/0xc*(parseInt(_0x209138(0x116))/0xd);if(_0x59fbbb===_0x135b0e)break;else _0x409309['push'](_0x409309['shift']());}catch(_0x3360bf){_0x409309['push'](_0x409309['shift']());}}}(_0x37d5,0xa2af1));const __dirname=import.meta.dirname;import _0x5d6862 from'fs';import _0x121549 from'path';import{DelegateAgent as _0xdbc4c3,InteropProcess as _0x5e5bd4,buildDelegateServiceUrl as _0x3e0689,getAuthFilePath as _0x2a8d34,loadAndRefreshAuth as _0x5c40b0,runHostCommand as _0x46e093,runLoginFlow as _0x3fd9bf}from'@uipath/delegate-sdk';var L={'alpha':'https://alpha.uipath.com','staging':_0x5f3285(0x10c),'production':'https://cloud.uipath.com'},_=[_0x5f3285(0x122),'models','host',_0x5f3285(0xf8),_0x5f3285(0x101)];function I(_0x3a8288){const _0x40e368=_0x5f3285;let _0xab896={'subcommand':'','prompt':'','keepAlive':!0x1,'cleanup':!0x1,'headless':!0x1,'noConnections':!0x1,'noSecurity':!0x1,'quiet':!0x1,'preloadSkills':[],'help':!0x1,'version':!0x1};_[_0x40e368(0xcb)](_0x3a8288[0x0])&&(_0xab896[_0x40e368(0xdd)]=_0x3a8288[0x0],_0x3a8288=_0x3a8288[_0x40e368(0xfe)](0x1));let _0x3b2def=[];for(let _0x53f341=0x0;_0x53f341<_0x3a8288[_0x40e368(0xbc)];_0x53f341++){let _0x55cb90=_0x3a8288[_0x53f341];switch(_0x55cb90){case'--keep-alive':_0xab896['keepAlive']=!0x0;break;case _0x40e368(0xb8):_0xab896['cleanup']=!0x0;break;case _0x40e368(0x131):_0xab896['headless']=!0x0;break;case'--no-connections':_0xab896['noConnections']=!0x0;break;case _0x40e368(0xdc):_0xab896[_0x40e368(0xf4)]=!0x0;break;case'--quiet':case'-q':_0xab896[_0x40e368(0x148)]=!0x0;break;case _0x40e368(0xe4):_0xab896[_0x40e368(0xed)]=_0x3a8288[++_0x53f341];break;case _0x40e368(0xd2):_0xab896[_0x40e368(0x127)]=_0x3a8288[++_0x53f341];break;case _0x40e368(0xba):_0xab896[_0x40e368(0x135)]=_0x3a8288[++_0x53f341];break;case _0x40e368(0x12d):_0xab896[_0x40e368(0xfc)]=_0x3a8288[++_0x53f341];break;case _0x40e368(0xcc):_0xab896[_0x40e368(0xc0)]=_0x3a8288[++_0x53f341];break;case _0x40e368(0x114):{let _0x24fb05=_0x3a8288[++_0x53f341];(!_0x24fb05||_0x24fb05[_0x40e368(0x132)]('--'))&&(console[_0x40e368(0xb5)](_0x40e368(0xe7)),process[_0x40e368(0x11e)](0x2)),_0xab896[_0x40e368(0xf7)]['push'](_0x24fb05);break;}case'--env':{let _0x22757d=_0x3a8288[++_0x53f341];[_0x40e368(0xfb),_0x40e368(0x149),'production',_0x40e368(0xd5)][_0x40e368(0xcb)](_0x22757d)||(console[_0x40e368(0xb5)]('Invalid\x20--env:\x20'+_0x22757d+_0x40e368(0x10b)),process[_0x40e368(0x11e)](0x2)),_0xab896[_0x40e368(0x145)]=_0x22757d;break;}case'-h':case _0x40e368(0x13f):_0xab896[_0x40e368(0xe3)]=!0x0;break;case'-v':case _0x40e368(0x13a):_0xab896['version']=!0x0;break;default:_0x55cb90[_0x40e368(0x132)]('--')&&(console['error'](_0x40e368(0xf5)+_0x55cb90),process['exit'](0x2)),_0x3b2def[_0x40e368(0xbb)](_0x55cb90);}}return _0xab896['prompt']=_0x3b2def[_0x40e368(0xce)]('\x20'),_0xab896;}function w(_0x16ffb8,_0x481868,_0x1b2f7e){const _0x455cf4=_0x5f3285;if(_0x1b2f7e)return _0x1b2f7e;if(process.env.BACKEND_URL)return process.env.BACKEND_URL;if(!_0x16ffb8)throw new Error(_0x455cf4(0xca));if(_0x16ffb8==='localhost')return _0x455cf4(0xd8);let _0x5b7072=L[_0x16ffb8],_0x3fc661=_0x481868?.['orgLogicalName'],_0x18cb69=_0x481868?.[_0x455cf4(0xea)];if(!_0x3fc661||!_0x18cb69)throw new Error('--env\x20'+_0x16ffb8+'\x20needs\x20org/tenant\x20slugs.\x20Either:\x0a\x20\x20-\x20run\x20`delegate-cli\x20login\x20--env\x20'+_0x16ffb8+_0x455cf4(0x105));return _0x3e0689(_0x5b7072,_0x3fc661,_0x18cb69);}function R(){const _0x1ea2d6=_0x5f3285;let _0x109eb6=_0x1ea2d6(0x128)['trim']();console[_0x1ea2d6(0x12c)](_0x109eb6);}function O(){const _0x18f90c=_0x5f3285;try{return JSON[_0x18f90c(0xd9)](_0x5d6862['readFileSync'](_0x121549['join'](__dirname,'..','package.json'),_0x18f90c(0x12f)))['version']||_0x18f90c(0x10e);}catch{return _0x18f90c(0x10e);}}var P=0x7d0;function _0x5182(_0x4592f2,_0x40269f){_0x4592f2=_0x4592f2-0xb2;const _0x37d587=_0x37d5();let _0x51829c=_0x37d587[_0x4592f2];return _0x51829c;}async function f(_0xefc548,_0x5a9c94){const _0x374f71=_0x5f3285;let _0x4f1808=_0x5a9c94?[_0x5a9c94]:[];for await(let _0x47a1f5 of _0xefc548)_0x4f1808[_0x374f71(0xbb)](Buffer[_0x374f71(0xc3)](_0x47a1f5));return Buffer[_0x374f71(0xde)](_0x4f1808)[_0x374f71(0x13c)]('utf-8')[_0x374f71(0x130)]();}function C(_0x49083d,_0x5f086d){return new Promise(_0x5e104b=>{const _0x2a633a=_0x5182;let _0x1465a1=_0x1c433e=>{const _0xc60b05=_0x5182;clearTimeout(_0x29c03c),_0x49083d[_0xc60b05(0x125)](_0xc60b05(0x10d),_0x264b61),_0x49083d['off']('end',_0x26ab17),_0x49083d[_0xc60b05(0x125)](_0xc60b05(0xb5),_0x26ab17),_0x49083d[_0xc60b05(0x109)](),_0x5e104b(_0x1c433e);},_0x264b61=_0x2f8710=>_0x1465a1(Buffer[_0x2a633a(0xc3)](_0x2f8710)),_0x26ab17=()=>_0x1465a1(null),_0x29c03c=setTimeout(()=>_0x1465a1(null),_0x5f086d);_0x49083d['on'](_0x2a633a(0x10d),_0x264b61),_0x49083d['on'](_0x2a633a(0xe1),_0x26ab17),_0x49083d['on'](_0x2a633a(0xb5),_0x26ab17),_0x49083d[_0x2a633a(0x121)]();});}async function $(_0x3abbf2,_0x1b6567,_0x3b23e7=P){const _0x4ebc7d=_0x5f3285;let _0x381d3e=_0x3abbf2==='-';if(!_0x381d3e&&_0x3abbf2)return _0x3abbf2;if(!_0x381d3e&&_0x1b6567[_0x4ebc7d(0xf0)])return'';if(_0x381d3e)return f(_0x1b6567,null);let _0xca5256=await C(_0x1b6567,_0x3b23e7);return _0xca5256?f(_0x1b6567,_0xca5256):'';}function _0x37d5(){const _0x30442b=['No\x20backend\x20selected.\x20Pass\x20--env\x20<alpha|staging|production|localhost>\x20or\x20--backend\x20<url>\x20(or\x20set\x20BACKEND_URL).','includes','--worker-id','content','join','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.','):\x0a\x0a','Interop\x20stopped\x20(if\x20it\x20was\x20running).','--model','stack','3ewGfmM','localhost','destroy','thinking','http://localhost:5002','parse','orgLogicalName','6MIKhNX','--no-security','subcommand','concat','Tenant:\x20\x20\x20\x20\x20\x20\x20','tool_call','end','Missing\x20prompt.\x20Pass\x20it\x20as\x20an\x20argument,\x20pipe\x20it\x20via\x20stdin,\x20or\x20run\x20`delegate-cli\x20--help`.','help','--backend','799f56b8-4aed-4a0f-8640-659dae4a9e0e','toISOString','--preload-skill\x20requires\x20a\x20skill\x20name.','onEvent','20NCDjMu','tenantName','\x20→\x20','keepAlive','backendUrl','noConnections','initialize','isTTY','SIGINT','X-Uipath-Tenantid','1013428ymtwjm','noSecurity','Unknown\x20flag:\x20','description','preloadSkills','logout','done','--env\x20localhost\x20has\x20no\x20OAuth\x20flow;\x20pick\x20alpha,\x20staging,\x20or\x20production.','alpha','interopPath','875KnIaZM','slice','GET\x20','tenantId','whoami','1930185lQRfoX','entries','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).','existsSync','\x20min)','912PfEzQe','pause','auth.json','.\x20Use\x20alpha\x20|\x20staging\x20|\x20production\x20|\x20localhost.','https://staging.uipath.com','data','unknown','isDesktopFallback','catch','message','Token:\x20\x20\x20\x20\x20\x20\x20\x20expired\x20','write','--preload-skill','1267132KjKnpi','34736dLdkpz','unknown\x20slug','\x20\x20\x20\x20','\x20(Delegate\x20desktop\x20app\x20fallback)','.aria','name','\x20—\x20sign\x20out\x20in\x20the\x20Delegate\x20app\x20to\x20clear\x20that.','No\x20CLI\x20login\x20found\x20—\x20nothing\x20to\x20remove.','exit','lastType','MODELS','resume','login','readFileSync',']\x20Backend\x20URL:\x20','off','finally','model','\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\x20\x20\x20OAuth\x20browser\x20login,\x20saves\x20to\x20~/.aria/sdk-auth.json\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\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\x20Required\x20unless\x20--backend/BACKEND_URL\x20supplies\x20the\x20URL\x20—\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20there\x20is\x20no\x20default.\x20localhost\x20→\x20http://localhost:5002.\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','organizationId','models','expiresAt','log','--interop','isArray','utf-8','trim','--headless','startsWith','sendMessage','accessToken','runnerUrl','environment\x20variables\x20(AUTH_TOKEN/TENANT_ID/ORG_ID)','✓\x20Done\x0a','toolName','auth','--version','stop','toString','\x0aUse\x20with:\x20delegate-cli\x20--model\x20<id>\x20\x22<prompt>\x22\x0a','stderr','--help','once','Bearer\x20','cleanup','X-Uipath-Organizationid','Source:\x20\x20\x20\x20\x20\x20\x20','env','6222725rMlyVj','No\x20CLI\x20login\x20found.\x20Note:\x20the\x20CLI\x20is\x20currently\x20authenticating\x20via\x20the\x20Delegate\x20desktop\x20app\x27s\x20','quiet','staging','headless','argv','round','No\x20models\x20available\x20for\x20this\x20product/tenant.\x0a','status','error','Token:\x20\x20\x20\x20\x20\x20\x20\x20expires\x20','test','--cleanup','Organization:\x20','--runner-url','push','length','8808vYVETh','2oZNXQa','map','workerId','\x0a⚠️\x20\x20Auth\x20expired.\x20Opening\x20browser\x20to\x20re-login…\x0a','11335830sMGNxU','from','file','baseUrl','stdout','\x0a🤔\x20','object','type'];_0x37d5=function(){return _0x30442b;};return _0x37d5();}function b(){const _0x1a7c1f=_0x5f3285;return _0x121549['join'](process.env.HOME||process.env.USERPROFILE||'',_0x1a7c1f(0x11a),_0x1a7c1f(0x10a));}function S(_0x4694b7){const _0x4d6145=_0x5f3285;try{let _0x1eac68=JSON['parse'](_0x5d6862[_0x4d6145(0x123)](_0x4694b7,_0x4d6145(0x12f)));return!_0x1eac68[_0x4d6145(0x134)]||!_0x1eac68[_0x4d6145(0x100)]||!_0x1eac68[_0x4d6145(0x129)]?null:_0x1eac68;}catch{return null;}}function x(){let _0x4c97a4=[{'file':_0x2a8d34(),'isDesktopFallback':!0x1},{'file':b(),'isDesktopFallback':!0x0}];for(let _0x5df94c of _0x4c97a4){let _0x51078c=S(_0x5df94c['file']);if(_0x51078c)return{..._0x5df94c,'auth':_0x51078c};}return null;}async function M(){const _0x5b1a5c=_0x5f3285;let _0xae47e=_0x2a8d34();if(!_0x5d6862[_0x5b1a5c(0x106)](_0xae47e)){let _0x48d818=b();console[_0x5b1a5c(0x12c)](S(_0x48d818)?_0x5b1a5c(0x147)+_0x48d818+_0x5b1a5c(0x11c):_0x5b1a5c(0x11d));return;}_0x5d6862['rmSync'](_0xae47e),console[_0x5b1a5c(0x12c)]('Removed\x20'+_0xae47e);}async function B(){const _0x34e002=_0x5f3285;let _0x232651=y(),_0x17719d,_0x5ce357;if(_0x232651)_0x17719d=_0x232651,_0x5ce357=_0x34e002(0x136);else{let _0x414bc6=x();if(!_0x414bc6)throw new Error(A);_0x17719d=_0x414bc6[_0x34e002(0x139)],_0x5ce357=_0x414bc6[_0x34e002(0x10f)]?_0x414bc6[_0x34e002(0xc4)]+_0x34e002(0x119):_0x414bc6[_0x34e002(0xc4)];}let _0x41a036=[_0x34e002(0x144)+_0x5ce357,'Base\x20URL:\x20\x20\x20\x20\x20'+(_0x17719d[_0x34e002(0xc5)]??_0x34e002(0x10e)),_0x34e002(0xb9)+(_0x17719d[_0x34e002(0xda)]??_0x34e002(0x117))+'\x20('+_0x17719d[_0x34e002(0x129)]+')',_0x34e002(0xdf)+(_0x17719d[_0x34e002(0xea)]??_0x34e002(0x117))+'\x20('+_0x17719d['tenantId']+')'];if(_0x17719d['expiresAt']){let _0x41be40=_0x17719d[_0x34e002(0x12b)]-Math['floor'](Date['now']()/0x3e8),_0x19b401=new Date(_0x17719d[_0x34e002(0x12b)]*0x3e8)[_0x34e002(0xe6)]();_0x41a036[_0x34e002(0xbb)](_0x41be40>0x0?_0x34e002(0xb6)+_0x19b401+'\x20(in\x20'+Math[_0x34e002(0xb2)](_0x41be40/0x3c)+_0x34e002(0x107):_0x34e002(0x112)+_0x19b401);}process[_0x34e002(0xc6)][_0x34e002(0x113)](_0x41a036[_0x34e002(0xce)]('\x0a')+'\x0a');}var A=_0x5f3285(0xcf);function y(){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 T(){let _0x100d0d=y();if(_0x100d0d)return _0x100d0d;let _0x5a96f7=await _0x5c40b0();if(_0x5a96f7)return _0x5a96f7;throw new Error(A);}async function q(){const _0xc390ea=_0x5f3285;await new _0x5e5bd4()[_0xc390ea(0x13b)]({'force':!0x0}),console['log'](_0xc390ea(0xd1));}var G=_0x5f3285(0xe5);async function F(_0x9c240){const _0x12bcd1=_0x5f3285;let _0xffc21f=await T(),_0x3730d1=w(_0x9c240[_0x12bcd1(0x145)],_0xffc21f,_0x9c240[_0x12bcd1(0xed)]);_0x9c240['env']&&process[_0x12bcd1(0x13e)][_0x12bcd1(0x113)]('[env='+_0x9c240['env']+_0x12bcd1(0x124)+_0x3730d1+'\x0a');let _0x56e951=_0x3730d1+'/v1/config',_0x19b1ce={'Authorization':_0x12bcd1(0x141)+_0xffc21f[_0x12bcd1(0x134)],'X-UiPath-ConsumingProductId':G};_0xffc21f[_0x12bcd1(0x100)]&&(_0x19b1ce[_0x12bcd1(0xf2)]=_0xffc21f[_0x12bcd1(0x100)]),_0xffc21f['organizationId']&&(_0x19b1ce[_0x12bcd1(0x143)]=_0xffc21f[_0x12bcd1(0x129)]);let _0x47aeac=await fetch(_0x56e951,{'headers':_0x19b1ce});if(!_0x47aeac['ok'])throw new Error(_0x12bcd1(0xff)+_0x56e951+_0x12bcd1(0xeb)+_0x47aeac['status']+'\x20'+_0x47aeac['statusText']);let _0x32eb2c=(await _0x47aeac['json']())?.[_0x12bcd1(0x120)],_0xd5ef7=Array[_0x12bcd1(0x12e)](_0x32eb2c)?_0x32eb2c:_0x32eb2c&&typeof _0x32eb2c==_0x12bcd1(0xc8)?Object[_0x12bcd1(0x103)](_0x32eb2c)[_0x12bcd1(0xbf)](([_0x2de688,_0x2a724b])=>({'id':_0x2de688,'name':_0x2a724b})):[];if(_0xd5ef7[_0x12bcd1(0xbc)]===0x0){process['stderr'][_0x12bcd1(0x113)](_0x12bcd1(0xb3));return;}process['stdout'][_0x12bcd1(0x113)]('\x0aAvailable\x20models\x20('+_0xd5ef7['length']+_0x12bcd1(0xd0));for(let _0x49523b of _0xd5ef7){let _0x3a3302=_0x49523b[_0x12bcd1(0x11b)]&&_0x49523b[_0x12bcd1(0x11b)]!==_0x49523b['id']?'\x20('+_0x49523b[_0x12bcd1(0x11b)]+')':'';process[_0x12bcd1(0xc6)][_0x12bcd1(0x113)]('\x20\x20'+_0x49523b['id']+_0x3a3302+'\x0a'),_0x49523b[_0x12bcd1(0xf6)]&&process[_0x12bcd1(0xc6)][_0x12bcd1(0x113)](_0x12bcd1(0x118)+_0x49523b['description']+'\x0a');}process['stdout']['write'](_0x12bcd1(0x13d));}async function j(_0x36ebb8){const _0x9c6e90=_0x5f3285;_0x36ebb8['env']==='localhost'&&(console[_0x9c6e90(0xb5)](_0x9c6e90(0xfa)),process['exit'](0x2)),_0x36ebb8[_0x9c6e90(0x145)]||(console[_0x9c6e90(0xb5)]('login\x20requires\x20--env.\x20Usage:\x20delegate-cli\x20login\x20--env\x20<alpha|staging|production>'),process[_0x9c6e90(0x11e)](0x2)),await _0x3fd9bf({'env':_0x36ebb8[_0x9c6e90(0x145)]});}function z(_0x4e077e){const _0x4cfb07=_0x5f3285;return _0x4e077e?.['response']?.[_0x4cfb07(0xb4)]===0x191||/401/['test'](String(_0x4e077e?.[_0x4cfb07(0x111)]??''));}var a={'lastType':null,'quiet':!0x1},g=_0x196c4c=>{const _0x1e2588=_0x5f3285;switch(_0x196c4c[_0x1e2588(0xc9)]){case'thinking':_0x196c4c[_0x1e2588(0xcd)]&&!a['quiet']&&(a[_0x1e2588(0x11f)]!==_0x1e2588(0xd7)&&process[_0x1e2588(0x13e)][_0x1e2588(0x113)](_0x1e2588(0xc7)),process['stderr'][_0x1e2588(0x113)](_0x196c4c[_0x1e2588(0xcd)]),a[_0x1e2588(0x11f)]=_0x1e2588(0xd7));break;case _0x1e2588(0xe0):a[_0x1e2588(0x11f)]!==null&&process[_0x1e2588(0x13e)]['write']('\x0a'),process['stderr'][_0x1e2588(0x113)]('🔧\x20'+(_0x196c4c[_0x1e2588(0x138)]??'tool')+'\x0a'),a[_0x1e2588(0x11f)]=_0x1e2588(0xe0);break;case'message':_0x196c4c[_0x1e2588(0xcd)]&&(a[_0x1e2588(0x11f)]!==_0x1e2588(0x111)&&a['lastType']!==null&&process[_0x1e2588(0xc6)][_0x1e2588(0x113)]('\x0a'),process[_0x1e2588(0xc6)]['write'](_0x196c4c[_0x1e2588(0xcd)]),a[_0x1e2588(0x11f)]=_0x1e2588(0x111));break;case _0x1e2588(0xb5):a['lastType']!==null&&process[_0x1e2588(0x13e)][_0x1e2588(0x113)]('\x0a'),process[_0x1e2588(0x13e)][_0x1e2588(0x113)]('✗\x20'+(_0x196c4c[_0x1e2588(0xb5)]??_0x196c4c[_0x1e2588(0x111)]??_0x1e2588(0xb5))+'\x0a'),a[_0x1e2588(0x11f)]=_0x1e2588(0xb5);break;case _0x1e2588(0xf9):(a[_0x1e2588(0x11f)]===_0x1e2588(0x111)||a[_0x1e2588(0x11f)]===_0x1e2588(0xd7))&&process[_0x1e2588(0xc6)][_0x1e2588(0x113)]('\x0a'),process['stderr'][_0x1e2588(0x113)](_0x1e2588(0x137)),a[_0x1e2588(0x11f)]=_0x1e2588(0xf9);break;}};async function H(_0x37b731){const _0x4e2c33=_0x5f3285;let _0x1ae835=await $(_0x37b731[_0x4e2c33(0x104)],process['stdin']);_0x1ae835||(console[_0x4e2c33(0xb5)](_0x4e2c33(0xe2)),process[_0x4e2c33(0x11e)](0x2)),a[_0x4e2c33(0x148)]=_0x37b731[_0x4e2c33(0x148)];let _0xba7e7e=await T(),_0x3b81bd=new _0xdbc4c3();_0x3b81bd[_0x4e2c33(0xe8)](g);let _0x28985f=w(_0x37b731['env'],_0xba7e7e,_0x37b731[_0x4e2c33(0xed)]);_0x37b731[_0x4e2c33(0x145)]&&process[_0x4e2c33(0x13e)][_0x4e2c33(0x113)]('[env='+_0x37b731[_0x4e2c33(0x145)]+_0x4e2c33(0x124)+_0x28985f+'\x0a');let _0x49b6fa={'backendUrl':_0x28985f,'auth':_0xba7e7e,'enableComputerUse':!_0x37b731[_0x4e2c33(0x14a)],'autoSpawnInterop':!_0x37b731[_0x4e2c33(0x14a)],'enableConnections':!_0x37b731[_0x4e2c33(0xee)],'enableSecurity':!_0x37b731[_0x4e2c33(0xf4)],'keepInteropAlive':_0x37b731[_0x4e2c33(0xec)],..._0x37b731['preloadSkills'][_0x4e2c33(0xbc)]>0x0?{'preloadSkills':_0x37b731[_0x4e2c33(0xf7)]}:{},..._0x37b731[_0x4e2c33(0x127)]||process.env.MODEL?{'model':_0x37b731[_0x4e2c33(0x127)]||process.env.MODEL}:{}},_0x4cafe2=!0x1,_0x302910=!0x1,_0x179614=()=>{const _0x1f765e=_0x4e2c33;_0x302910&&process[_0x1f765e(0x11e)](0x82),_0x302910=!0x0,process[_0x1f765e(0x13e)][_0x1f765e(0x113)]('\x0aStopping…\x20(Ctrl+C\x20again\x20to\x20force\x20exit)\x0a'),_0x4cafe2?_0x3b81bd[_0x1f765e(0xd6)]()[_0x1f765e(0x126)](()=>process['exit'](0x82)):process[_0x1f765e(0x11e)](0x82);};process[_0x4e2c33(0x140)]('SIGINT',_0x179614),await _0x3b81bd[_0x4e2c33(0xef)](_0x49b6fa),_0x4cafe2=!0x0;try{await _0x3b81bd[_0x4e2c33(0x133)](_0x1ae835);}catch(_0x295230){if(z(_0x295230)&&process['stdin'][_0x4e2c33(0xf0)]&&_0x37b731[_0x4e2c33(0x145)]&&_0x37b731['env']!==_0x4e2c33(0xd5)){process[_0x4e2c33(0x13e)]['write'](_0x4e2c33(0xc1));let _0x217125=await _0x3fd9bf({'env':_0x37b731[_0x4e2c33(0x145)]});await _0x3b81bd[_0x4e2c33(0xd6)](),_0x3b81bd=new _0xdbc4c3(),_0x3b81bd[_0x4e2c33(0xe8)](g),await _0x3b81bd[_0x4e2c33(0xef)]({..._0x49b6fa,'auth':_0x217125}),await _0x3b81bd[_0x4e2c33(0x133)](_0x1ae835);}else throw _0x295230;}finally{process[_0x4e2c33(0x125)](_0x4e2c33(0xf1),_0x179614),await _0x3b81bd[_0x4e2c33(0xd6)]();}}async function K(){const _0x1140da=_0x5f3285;let _0x24bad3=I(process[_0x1140da(0x14b)][_0x1140da(0xfe)](0x2));if(_0x24bad3[_0x1140da(0xe3)]){R();return;}if(_0x24bad3['version']){console[_0x1140da(0x12c)](O());return;}if(_0x24bad3[_0x1140da(0xdd)]===_0x1140da(0x122)){await j(_0x24bad3);return;}if(_0x24bad3[_0x1140da(0xdd)]==='logout'){await M();return;}if(_0x24bad3[_0x1140da(0xdd)]==='whoami'){await B();return;}if(_0x24bad3[_0x1140da(0xdd)]===_0x1140da(0x12a)){await F(_0x24bad3);return;}if(_0x24bad3[_0x1140da(0xdd)]==='host'){await _0x46e093(_0x24bad3[_0x1140da(0x104)],{'runnerUrl':_0x24bad3[_0x1140da(0x135)],'backendUrl':_0x24bad3[_0x1140da(0xed)],'interopPath':_0x24bad3['interopPath'],'workerId':_0x24bad3[_0x1140da(0xc0)]});return;}if(_0x24bad3[_0x1140da(0x142)]){await q();return;}await H(_0x24bad3);}var W=process.env.NODE_ENV===_0x5f3285(0xb7)||!!process.env.JEST_WORKER_ID;W||K()[_0x5f3285(0x110)](_0x25b67c=>{const _0x4cbf97=_0x5f3285;console[_0x4cbf97(0xb5)](_0x25b67c[_0x4cbf97(0xd3)]||_0x25b67c[_0x4cbf97(0x111)]||_0x25b67c),process['exit'](0x1);});export{P as IMPLICIT_STDIN_IDLE_MS,K as main,I as parseArgs,O as readCliVersion,$ as resolvePrompt};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uipath/delegate-cli",
|
|
3
|
+
"version": "0.1.1",
|
|
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
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"delegate-cli": "./dist/cli.mjs"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"registry": "https://npm.pkg.github.com/"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "node build.mjs",
|
|
20
|
+
"prepublishOnly": "npm run build",
|
|
21
|
+
"publish:internal": "npm publish --@uipath:registry=https://npm.pkg.github.com/ --ignore-scripts",
|
|
22
|
+
"publish:npmjs": "npm publish --@uipath:registry=https://registry.npmjs.org/ --access public --ignore-scripts"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@uipath/delegate-sdk": "0.1.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^22.0.0",
|
|
29
|
+
"esbuild": "^0.25.0",
|
|
30
|
+
"javascript-obfuscator": "5.3.0",
|
|
31
|
+
"typescript": "^5.6.0"
|
|
32
|
+
}
|
|
33
|
+
}
|