@uipath/codedagent-tool 1.200.0-preview.120 → 1.201.0-preview.121
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/dist/{browser-strategy-fdkppa2b.js → browser-strategy-yccf8mtd.js} +3 -2
- package/dist/index-2fj08e7n.js +2058 -0
- package/dist/index-w03qc9m8.js +634 -0
- package/dist/index.js +6 -5
- package/dist/init.js +5 -4
- package/dist/js-yaml-4ypbq2tt.js +3145 -0
- package/dist/node-strategy-12qfy0nv.js +348 -0
- package/dist/{tool-vc9mne6b.js → tool-0v6na3yp.js} +2 -9
- package/dist/{tool-5be0qe39.js → tool-26zbdsea.js} +326 -5282
- package/dist/tool-5arsyj36.js +11 -0
- package/dist/tool-7eva0peq.js +265 -0
- package/dist/{tool-fja3c4rd.js → tool-dr8tkvm4.js} +121 -18
- package/dist/tool.js +6 -5
- package/package.json +2 -2
- package/dist/node-strategy-7affvvq6.js +0 -62
- package/dist/tool-nvhfxv67.js +0 -1159
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ../auth/src/constants.ts
|
|
2
|
+
var UIPATH_HOME_DIR = ".uipath";
|
|
3
|
+
var AUTH_FILENAME = ".auth";
|
|
4
|
+
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
5
|
+
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
6
|
+
var AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT";
|
|
7
|
+
var AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED";
|
|
8
|
+
|
|
9
|
+
export { UIPATH_HOME_DIR, AUTH_FILENAME, DEFAULT_BASE_URL, DEFAULT_AUTH_TIMEOUT_MS, AUTH_TIMEOUT_ERROR_CODE, AUTH_CANCELLED_ERROR_CODE };
|
|
10
|
+
|
|
11
|
+
//# debugId=E98AE5255EE78AC164756E2164756E21
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "./tool-0v6na3yp.js";
|
|
4
|
+
|
|
5
|
+
// ../filesystem/src/node.ts
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import * as fs from "node:fs/promises";
|
|
9
|
+
import * as os from "node:os";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
var LOCK_HEARTBEAT_MS = 5000;
|
|
12
|
+
var LOCK_STALE_MS = 15000;
|
|
13
|
+
var LOCK_MAX_WAIT_MS = 20000;
|
|
14
|
+
var LOCK_MAX_HOLD_MS = 60000;
|
|
15
|
+
var LOCK_RETRY_MIN_MS = 100;
|
|
16
|
+
var LOCK_RETRY_JITTER_MS = 200;
|
|
17
|
+
|
|
18
|
+
class NodeFileSystem {
|
|
19
|
+
path = {
|
|
20
|
+
join: path.join,
|
|
21
|
+
resolve: path.resolve,
|
|
22
|
+
relative: path.relative,
|
|
23
|
+
dirname: path.dirname,
|
|
24
|
+
isAbsolute: path.isAbsolute,
|
|
25
|
+
basename: path.basename
|
|
26
|
+
};
|
|
27
|
+
env = {
|
|
28
|
+
cwd: process.cwd,
|
|
29
|
+
homedir: os.homedir,
|
|
30
|
+
tmpdir: os.tmpdir,
|
|
31
|
+
getenv: (key) => process.env[key]
|
|
32
|
+
};
|
|
33
|
+
utils = {
|
|
34
|
+
open: async (url) => {
|
|
35
|
+
const { default: open } = await import("./index-w03qc9m8.js");
|
|
36
|
+
await open(url);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
async readFile(path2, options) {
|
|
40
|
+
try {
|
|
41
|
+
if (options) {
|
|
42
|
+
return await fs.readFile(path2, "utf-8");
|
|
43
|
+
}
|
|
44
|
+
return await fs.readFile(path2);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (this.isEnoent(error))
|
|
47
|
+
return null;
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async writeFile(filePath, data) {
|
|
52
|
+
const dir = path.dirname(filePath);
|
|
53
|
+
if (dir) {
|
|
54
|
+
await fs.mkdir(dir, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
await fs.writeFile(filePath, data);
|
|
57
|
+
}
|
|
58
|
+
async appendFile(filePath, data) {
|
|
59
|
+
const dir = path.dirname(filePath);
|
|
60
|
+
if (dir) {
|
|
61
|
+
await fs.mkdir(dir, { recursive: true });
|
|
62
|
+
}
|
|
63
|
+
await fs.appendFile(filePath, data);
|
|
64
|
+
}
|
|
65
|
+
async readdir(dirPath) {
|
|
66
|
+
try {
|
|
67
|
+
return await fs.readdir(dirPath);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (this.isEnoent(error))
|
|
70
|
+
return [];
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async stat(filePath) {
|
|
75
|
+
try {
|
|
76
|
+
const stats = await fs.stat(filePath);
|
|
77
|
+
return {
|
|
78
|
+
isFile: () => stats.isFile(),
|
|
79
|
+
isDirectory: () => stats.isDirectory(),
|
|
80
|
+
size: stats.size,
|
|
81
|
+
mtimeMs: stats.mtimeMs
|
|
82
|
+
};
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (this.isEnoent(error))
|
|
85
|
+
return null;
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async exists(filePath) {
|
|
90
|
+
return existsSync(filePath);
|
|
91
|
+
}
|
|
92
|
+
async mkdir(dirPath) {
|
|
93
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
94
|
+
}
|
|
95
|
+
async acquireLock(lockPath) {
|
|
96
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
97
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
98
|
+
const ownerId = randomUUID();
|
|
99
|
+
const start = Date.now();
|
|
100
|
+
while (true) {
|
|
101
|
+
try {
|
|
102
|
+
await fs.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
103
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
const stats = await fs.stat(lockFile).catch(() => null);
|
|
109
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
110
|
+
const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
111
|
+
if (reclaimed)
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
115
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
116
|
+
}
|
|
117
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async canonicalizeLockTarget(lockPath) {
|
|
122
|
+
const absolute = path.resolve(lockPath);
|
|
123
|
+
const fullReal = await fs.realpath(absolute).catch(() => null);
|
|
124
|
+
if (fullReal)
|
|
125
|
+
return fullReal;
|
|
126
|
+
const parent = path.dirname(absolute);
|
|
127
|
+
const base = path.basename(absolute);
|
|
128
|
+
const canonicalParent = await fs.realpath(parent).catch(() => parent);
|
|
129
|
+
return path.join(canonicalParent, base);
|
|
130
|
+
}
|
|
131
|
+
createLockRelease(lockFile, ownerId) {
|
|
132
|
+
const heartbeatStart = Date.now();
|
|
133
|
+
let heartbeatTimer;
|
|
134
|
+
let stopped = false;
|
|
135
|
+
const stopHeartbeat = () => {
|
|
136
|
+
stopped = true;
|
|
137
|
+
if (heartbeatTimer)
|
|
138
|
+
clearTimeout(heartbeatTimer);
|
|
139
|
+
};
|
|
140
|
+
const scheduleNextHeartbeat = () => {
|
|
141
|
+
if (stopped)
|
|
142
|
+
return;
|
|
143
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
144
|
+
stopped = true;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
heartbeatTimer = setTimeout(() => {
|
|
148
|
+
runHeartbeat();
|
|
149
|
+
}, LOCK_HEARTBEAT_MS);
|
|
150
|
+
heartbeatTimer.unref?.();
|
|
151
|
+
};
|
|
152
|
+
const runHeartbeat = async () => {
|
|
153
|
+
if (stopped)
|
|
154
|
+
return;
|
|
155
|
+
const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
|
|
156
|
+
if (stopped)
|
|
157
|
+
return;
|
|
158
|
+
if (current !== ownerId) {
|
|
159
|
+
stopped = true;
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const now = Date.now() / 1000;
|
|
163
|
+
await fs.utimes(lockFile, now, now).catch(() => {});
|
|
164
|
+
scheduleNextHeartbeat();
|
|
165
|
+
};
|
|
166
|
+
scheduleNextHeartbeat();
|
|
167
|
+
let released = false;
|
|
168
|
+
return async () => {
|
|
169
|
+
if (released)
|
|
170
|
+
return;
|
|
171
|
+
released = true;
|
|
172
|
+
stopHeartbeat();
|
|
173
|
+
const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
|
|
174
|
+
if (current === ownerId) {
|
|
175
|
+
await fs.rm(lockFile, { force: true });
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
async rm(filePath) {
|
|
180
|
+
await fs.rm(filePath, { recursive: true, force: true });
|
|
181
|
+
}
|
|
182
|
+
async rename(oldPath, newPath) {
|
|
183
|
+
await fs.rename(oldPath, newPath);
|
|
184
|
+
}
|
|
185
|
+
async realpath(filePath) {
|
|
186
|
+
try {
|
|
187
|
+
return await fs.realpath(filePath);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (this.isEnoent(error))
|
|
190
|
+
return filePath;
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async getTempDir() {
|
|
195
|
+
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
196
|
+
}
|
|
197
|
+
async copyDirectory(sourcePath, destPath) {
|
|
198
|
+
const sourceStats = await this.stat(sourcePath);
|
|
199
|
+
if (!sourceStats) {
|
|
200
|
+
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
201
|
+
}
|
|
202
|
+
if (!sourceStats.isDirectory()) {
|
|
203
|
+
throw new Error(`Source path is not a directory: ${sourcePath}`);
|
|
204
|
+
}
|
|
205
|
+
await this.mkdir(destPath);
|
|
206
|
+
const entries = await this.readdir(sourcePath);
|
|
207
|
+
for (const entry of entries) {
|
|
208
|
+
const srcEntry = path.join(sourcePath, entry);
|
|
209
|
+
const destEntry = path.join(destPath, entry);
|
|
210
|
+
const entryStats = await this.stat(srcEntry);
|
|
211
|
+
if (!entryStats)
|
|
212
|
+
continue;
|
|
213
|
+
if (entryStats.isDirectory()) {
|
|
214
|
+
await this.copyDirectory(srcEntry, destEntry);
|
|
215
|
+
} else if (entryStats.isFile()) {
|
|
216
|
+
const content = await this.readFile(srcEntry);
|
|
217
|
+
if (content !== null) {
|
|
218
|
+
await this.writeFile(destEntry, content);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
isEnoent(error) {
|
|
224
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
225
|
+
}
|
|
226
|
+
hasErrnoCode(error, code) {
|
|
227
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// ../filesystem/src/index.ts
|
|
232
|
+
var fsInstance = new NodeFileSystem;
|
|
233
|
+
var getFileSystem = () => fsInstance;
|
|
234
|
+
|
|
235
|
+
// ../auth/src/catch-error.ts
|
|
236
|
+
function isPromiseLike(value) {
|
|
237
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
238
|
+
}
|
|
239
|
+
function catchError(fnOrPromise) {
|
|
240
|
+
if (isPromiseLike(fnOrPromise)) {
|
|
241
|
+
return settlePromiseLike(fnOrPromise);
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
const result = fnOrPromise();
|
|
245
|
+
if (isPromiseLike(result)) {
|
|
246
|
+
return settlePromiseLike(result);
|
|
247
|
+
}
|
|
248
|
+
return [undefined, result];
|
|
249
|
+
} catch (error) {
|
|
250
|
+
return [
|
|
251
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
252
|
+
undefined
|
|
253
|
+
];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function settlePromiseLike(thenable) {
|
|
257
|
+
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
258
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
259
|
+
undefined
|
|
260
|
+
]);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export { getFileSystem, catchError };
|
|
264
|
+
|
|
265
|
+
//# debugId=7C969342331D7A5864756E2164756E21
|
|
@@ -10,18 +10,18 @@ import {
|
|
|
10
10
|
extractErrorMessageSync,
|
|
11
11
|
processContext,
|
|
12
12
|
trackShipSucceeded
|
|
13
|
-
} from "./tool-
|
|
13
|
+
} from "./tool-26zbdsea.js";
|
|
14
14
|
import {
|
|
15
15
|
getFileSystem
|
|
16
|
-
} from "./tool-
|
|
16
|
+
} from "./tool-7eva0peq.js";
|
|
17
17
|
import {
|
|
18
18
|
__require
|
|
19
|
-
} from "./tool-
|
|
19
|
+
} from "./tool-0v6na3yp.js";
|
|
20
20
|
// package.json
|
|
21
21
|
var package_default = {
|
|
22
22
|
name: "@uipath/codedagent-tool",
|
|
23
23
|
license: "MIT",
|
|
24
|
-
version: "1.
|
|
24
|
+
version: "1.201.0-preview.121",
|
|
25
25
|
description: "Build, run, deploy, and manage AI Agents.",
|
|
26
26
|
keywords: [
|
|
27
27
|
"cli-tool",
|
|
@@ -638,6 +638,20 @@ import { existsSync } from "node:fs";
|
|
|
638
638
|
import * as fs6 from "node:fs/promises";
|
|
639
639
|
import * as os2 from "node:os";
|
|
640
640
|
import * as path2 from "node:path";
|
|
641
|
+
var __defProp = Object.defineProperty;
|
|
642
|
+
var __returnValue = (v) => v;
|
|
643
|
+
function __exportSetter(name, newValue) {
|
|
644
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
645
|
+
}
|
|
646
|
+
var __export = (target, all) => {
|
|
647
|
+
for (var name in all)
|
|
648
|
+
__defProp(target, name, {
|
|
649
|
+
get: all[name],
|
|
650
|
+
enumerable: true,
|
|
651
|
+
configurable: true,
|
|
652
|
+
set: __exportSetter.bind(all, name)
|
|
653
|
+
});
|
|
654
|
+
};
|
|
641
655
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
642
656
|
var __require2 = /* @__PURE__ */ createRequire(import.meta.url);
|
|
643
657
|
function isPromiseLike(value) {
|
|
@@ -986,6 +1000,12 @@ var init_is_in_ssh = __esm(() => {
|
|
|
986
1000
|
isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
|
|
987
1001
|
is_in_ssh_default = isInSsh;
|
|
988
1002
|
});
|
|
1003
|
+
var exports_open = {};
|
|
1004
|
+
__export(exports_open, {
|
|
1005
|
+
openApp: () => openApp,
|
|
1006
|
+
default: () => open_default,
|
|
1007
|
+
apps: () => apps
|
|
1008
|
+
});
|
|
989
1009
|
function detectArchBinary(binary) {
|
|
990
1010
|
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
991
1011
|
return binary;
|
|
@@ -1222,6 +1242,22 @@ var open = (target, options) => {
|
|
|
1222
1242
|
target
|
|
1223
1243
|
});
|
|
1224
1244
|
};
|
|
1245
|
+
var openApp = (name, options) => {
|
|
1246
|
+
if (typeof name !== "string" && !Array.isArray(name)) {
|
|
1247
|
+
throw new TypeError("Expected a valid `name`");
|
|
1248
|
+
}
|
|
1249
|
+
const { arguments: appArguments = [] } = options ?? {};
|
|
1250
|
+
if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
|
|
1251
|
+
throw new TypeError("Expected `appArguments` as Array type");
|
|
1252
|
+
}
|
|
1253
|
+
return baseOpen({
|
|
1254
|
+
...options,
|
|
1255
|
+
app: {
|
|
1256
|
+
name,
|
|
1257
|
+
arguments: appArguments
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
};
|
|
1225
1261
|
var apps;
|
|
1226
1262
|
var open_default;
|
|
1227
1263
|
var init_open = __esm(() => {
|
|
@@ -1295,7 +1331,8 @@ class NodeFileSystem {
|
|
|
1295
1331
|
};
|
|
1296
1332
|
utils = {
|
|
1297
1333
|
open: async (url) => {
|
|
1298
|
-
await
|
|
1334
|
+
const { default: open2 } = await Promise.resolve().then(() => (init_open(), exports_open));
|
|
1335
|
+
await open2(url);
|
|
1299
1336
|
}
|
|
1300
1337
|
};
|
|
1301
1338
|
async readFile(path3, options) {
|
|
@@ -1495,9 +1532,7 @@ var LOCK_MAX_WAIT_MS = 20000;
|
|
|
1495
1532
|
var LOCK_MAX_HOLD_MS = 60000;
|
|
1496
1533
|
var LOCK_RETRY_MIN_MS = 100;
|
|
1497
1534
|
var LOCK_RETRY_JITTER_MS = 200;
|
|
1498
|
-
var init_node =
|
|
1499
|
-
init_open();
|
|
1500
|
-
});
|
|
1535
|
+
var init_node = () => {};
|
|
1501
1536
|
var fsInstance;
|
|
1502
1537
|
var getFileSystem2 = () => fsInstance;
|
|
1503
1538
|
var init_src = __esm(() => {
|
|
@@ -1505,9 +1540,6 @@ var init_src = __esm(() => {
|
|
|
1505
1540
|
init_node();
|
|
1506
1541
|
fsInstance = new NodeFileSystem;
|
|
1507
1542
|
});
|
|
1508
|
-
var init_server = __esm(() => {
|
|
1509
|
-
init_constants();
|
|
1510
|
-
});
|
|
1511
1543
|
init_constants();
|
|
1512
1544
|
var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
|
|
1513
1545
|
var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
|
|
@@ -1739,6 +1771,65 @@ var getTokenExpiration = (accessToken) => {
|
|
|
1739
1771
|
return;
|
|
1740
1772
|
}
|
|
1741
1773
|
};
|
|
1774
|
+
var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
|
|
1775
|
+
var decodeClaims = (accessToken) => {
|
|
1776
|
+
const [error, claims] = catchError2(() => parseJWT(accessToken));
|
|
1777
|
+
return error ? undefined : claims;
|
|
1778
|
+
};
|
|
1779
|
+
var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
1780
|
+
var resolveIdentityType = (claims, authFlow, email) => {
|
|
1781
|
+
const subType = asString(claims?.sub_type);
|
|
1782
|
+
if (subType) {
|
|
1783
|
+
return subType.startsWith("service") ? "Application" : "User";
|
|
1784
|
+
}
|
|
1785
|
+
if (authFlow) {
|
|
1786
|
+
return authFlow === "authorization_code" ? "User" : "Application";
|
|
1787
|
+
}
|
|
1788
|
+
if (email)
|
|
1789
|
+
return "User";
|
|
1790
|
+
if (asString(claims?.client_id) && !asString(claims?.sub)) {
|
|
1791
|
+
return "Application";
|
|
1792
|
+
}
|
|
1793
|
+
return;
|
|
1794
|
+
};
|
|
1795
|
+
var looksLikeEmail = (value) => value?.includes("@") ?? false;
|
|
1796
|
+
var pickEmail = (claims) => {
|
|
1797
|
+
for (const candidate of [claims?.email, claims?.preferred_username]) {
|
|
1798
|
+
const value = asString(candidate);
|
|
1799
|
+
if (looksLikeEmail(value))
|
|
1800
|
+
return value;
|
|
1801
|
+
}
|
|
1802
|
+
return;
|
|
1803
|
+
};
|
|
1804
|
+
var pickName = (claims) => {
|
|
1805
|
+
const username = asString(claims?.preferred_username);
|
|
1806
|
+
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
1807
|
+
};
|
|
1808
|
+
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
1809
|
+
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
1810
|
+
const email = pickEmail(claims);
|
|
1811
|
+
const type = resolveIdentityType(claims, authFlow, email);
|
|
1812
|
+
if (!type)
|
|
1813
|
+
return;
|
|
1814
|
+
const identity = { type };
|
|
1815
|
+
if (authFlow)
|
|
1816
|
+
identity.authFlow = authFlow;
|
|
1817
|
+
if (type === "User") {
|
|
1818
|
+
const userId = asString(claims?.sub);
|
|
1819
|
+
if (userId)
|
|
1820
|
+
identity.userId = userId;
|
|
1821
|
+
if (email)
|
|
1822
|
+
identity.userEmail = email;
|
|
1823
|
+
const name = pickName(claims);
|
|
1824
|
+
if (name)
|
|
1825
|
+
identity.userName = name;
|
|
1826
|
+
return identity;
|
|
1827
|
+
}
|
|
1828
|
+
const clientId = asString(claims?.client_id);
|
|
1829
|
+
if (clientId)
|
|
1830
|
+
identity.clientId = clientId;
|
|
1831
|
+
return identity;
|
|
1832
|
+
};
|
|
1742
1833
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
1743
1834
|
var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
|
|
1744
1835
|
var ENV_AUTH_VARS = {
|
|
@@ -1787,6 +1878,7 @@ var readAuthFromEnv = () => {
|
|
|
1787
1878
|
}
|
|
1788
1879
|
const expiration = getTokenExpiration(accessToken);
|
|
1789
1880
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
1881
|
+
const identity = resolveSessionIdentity(accessToken);
|
|
1790
1882
|
return {
|
|
1791
1883
|
loginStatus,
|
|
1792
1884
|
accessToken,
|
|
@@ -1796,7 +1888,8 @@ var readAuthFromEnv = () => {
|
|
|
1796
1888
|
tenantName,
|
|
1797
1889
|
tenantId,
|
|
1798
1890
|
expiration,
|
|
1799
|
-
source: "env"
|
|
1891
|
+
source: "env-vars",
|
|
1892
|
+
...identity ? { identity } : {}
|
|
1800
1893
|
};
|
|
1801
1894
|
};
|
|
1802
1895
|
init_src();
|
|
@@ -2042,6 +2135,7 @@ var refreshAccessToken = async ({
|
|
|
2042
2135
|
}
|
|
2043
2136
|
return { accessToken: newAccessToken, refreshToken: newRefreshToken };
|
|
2044
2137
|
};
|
|
2138
|
+
var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
|
|
2045
2139
|
init_src();
|
|
2046
2140
|
init_constants();
|
|
2047
2141
|
var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
|
|
@@ -2406,7 +2500,8 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
2406
2500
|
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
2407
2501
|
tenantId: credentials.UIPATH_TENANT_ID,
|
|
2408
2502
|
expiration: tokens.expiration,
|
|
2409
|
-
source: "
|
|
2503
|
+
source: "saved-login",
|
|
2504
|
+
...identityFields(tokens.accessToken, credentials),
|
|
2410
2505
|
...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
|
|
2411
2506
|
...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
2412
2507
|
...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
|
|
@@ -2419,7 +2514,12 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
2419
2514
|
}
|
|
2420
2515
|
return result;
|
|
2421
2516
|
}
|
|
2517
|
+
function identityFields(accessToken, credentials) {
|
|
2518
|
+
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
2519
|
+
return identity ? { identity } : {};
|
|
2520
|
+
}
|
|
2422
2521
|
function buildRobotStatus(robotCreds) {
|
|
2522
|
+
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
2423
2523
|
return {
|
|
2424
2524
|
loginStatus: "Logged in",
|
|
2425
2525
|
accessToken: robotCreds.accessToken,
|
|
@@ -2430,7 +2530,8 @@ function buildRobotStatus(robotCreds) {
|
|
|
2430
2530
|
tenantId: robotCreds.tenantId,
|
|
2431
2531
|
issuer: robotCreds.issuer,
|
|
2432
2532
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
2433
|
-
source: "robot"
|
|
2533
|
+
source: "robot",
|
|
2534
|
+
...identity ? { identity } : {}
|
|
2434
2535
|
};
|
|
2435
2536
|
}
|
|
2436
2537
|
var isFileNotFoundError = (error) => {
|
|
@@ -2481,7 +2582,8 @@ async function circuitBreakerShortCircuit(ctx) {
|
|
|
2481
2582
|
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
2482
2583
|
tenantId: credentials.UIPATH_TENANT_ID,
|
|
2483
2584
|
expiration,
|
|
2484
|
-
source: "
|
|
2585
|
+
source: "saved-login",
|
|
2586
|
+
...identityFields(accessToken, credentials)
|
|
2485
2587
|
} : {},
|
|
2486
2588
|
hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
|
|
2487
2589
|
refreshCircuitOpen: true,
|
|
@@ -2503,7 +2605,8 @@ async function lockAcquireFailureStatus(ctx, error) {
|
|
|
2503
2605
|
tenantName: ctx.credentials.UIPATH_TENANT_NAME,
|
|
2504
2606
|
tenantId: ctx.credentials.UIPATH_TENANT_ID,
|
|
2505
2607
|
expiration: ctx.expiration,
|
|
2506
|
-
source: "
|
|
2608
|
+
source: "saved-login",
|
|
2609
|
+
...identityFields(ctx.accessToken, ctx.credentials),
|
|
2507
2610
|
hint: globalHint,
|
|
2508
2611
|
tokenRefresh: {
|
|
2509
2612
|
attempted: false,
|
|
@@ -2668,6 +2771,7 @@ function errorMessage(error) {
|
|
|
2668
2771
|
}
|
|
2669
2772
|
init_constants();
|
|
2670
2773
|
init_src();
|
|
2774
|
+
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
2671
2775
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
2672
2776
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
2673
2777
|
var TENANT_SELECTION_CODES = new Set([
|
|
@@ -2675,7 +2779,6 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
2675
2779
|
INVALID_TENANT_CODE
|
|
2676
2780
|
]);
|
|
2677
2781
|
init_src();
|
|
2678
|
-
init_server();
|
|
2679
2782
|
var SERVICE_PATH = {
|
|
2680
2783
|
"llm-gateway": "llmgateway_"
|
|
2681
2784
|
};
|
|
@@ -3079,4 +3182,4 @@ var registerCommands = async (program) => {
|
|
|
3079
3182
|
|
|
3080
3183
|
export { metadata, registerCommands };
|
|
3081
3184
|
|
|
3082
|
-
//# debugId=
|
|
3185
|
+
//# debugId=A28FC161563AFFDE64756E2164756E21
|
package/dist/tool.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
metadata,
|
|
3
3
|
registerCommands
|
|
4
|
-
} from "./tool-
|
|
5
|
-
import"./tool-
|
|
4
|
+
} from "./tool-dr8tkvm4.js";
|
|
5
|
+
import"./tool-26zbdsea.js";
|
|
6
6
|
import"./tool-9qecd4wb.js";
|
|
7
|
-
import"./tool-
|
|
8
|
-
import"./tool-
|
|
7
|
+
import"./tool-7eva0peq.js";
|
|
8
|
+
import"./tool-5arsyj36.js";
|
|
9
|
+
import"./tool-0v6na3yp.js";
|
|
9
10
|
export {
|
|
10
11
|
registerCommands,
|
|
11
12
|
metadata
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
//# debugId=
|
|
15
|
+
//# debugId=41CB38F55D92291A64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/codedagent-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.201.0-preview.121",
|
|
5
5
|
"description": "Build, run, deploy, and manage AI Agents.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"cli-tool",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"registry": "https://registry.npmjs.org/"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
|
|
36
36
|
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
catchError,
|
|
3
|
-
getFileSystem,
|
|
4
|
-
startServer
|
|
5
|
-
} from "./tool-nvhfxv67.js";
|
|
6
|
-
import"./tool-vc9mne6b.js";
|
|
7
|
-
|
|
8
|
-
// ../auth/src/strategies/node-strategy.ts
|
|
9
|
-
class NodeAuthStrategy {
|
|
10
|
-
async execute(url, redirectUri, expectedState, opts) {
|
|
11
|
-
const fs = getFileSystem();
|
|
12
|
-
const callbackUrl = await startServer({
|
|
13
|
-
redirectUri,
|
|
14
|
-
timeoutMs: opts?.timeoutMs,
|
|
15
|
-
signal: opts?.signal,
|
|
16
|
-
onListening: async () => {
|
|
17
|
-
let safeUrl = "";
|
|
18
|
-
for (const ch of url) {
|
|
19
|
-
const c = ch.charCodeAt(0);
|
|
20
|
-
if (c > 31 && (c < 128 || c > 159))
|
|
21
|
-
safeUrl += ch;
|
|
22
|
-
}
|
|
23
|
-
if (opts?.noBrowser) {
|
|
24
|
-
if (!opts.onAuthUrl) {
|
|
25
|
-
throw new Error("Headless login (noBrowser) requires an onAuthUrl handler " + "to surface the authorize URL, but none was provided.");
|
|
26
|
-
}
|
|
27
|
-
opts.onAuthUrl(safeUrl);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const [openError] = await catchError(fs.utils.open(url));
|
|
31
|
-
if (!openError)
|
|
32
|
-
return;
|
|
33
|
-
const isSpawnError = "code" in openError && openError.code === "ENOENT";
|
|
34
|
-
if (isSpawnError) {
|
|
35
|
-
throw new Error("Could not open a browser. No supported browser launcher was found. " + `On a headless or minimal system, use non-interactive login instead:
|
|
36
|
-
|
|
37
|
-
` + ` uip login --client-id <id> --client-secret <secret> -t <tenant>
|
|
38
|
-
|
|
39
|
-
` + "Or install a browser opener for your OS (e.g. xdg-utils on Linux).", { cause: openError });
|
|
40
|
-
}
|
|
41
|
-
throw new Error("Could not open the browser automatically. " + `Visit this URL to authenticate:
|
|
42
|
-
|
|
43
|
-
${safeUrl}
|
|
44
|
-
`, { cause: openError });
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
const returnedState = callbackUrl.searchParams.get("state");
|
|
48
|
-
if (returnedState !== expectedState) {
|
|
49
|
-
throw new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again.");
|
|
50
|
-
}
|
|
51
|
-
const code = callbackUrl.searchParams.get("code");
|
|
52
|
-
if (!code) {
|
|
53
|
-
throw new Error("No authorization code received");
|
|
54
|
-
}
|
|
55
|
-
return code;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
NodeAuthStrategy
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
//# debugId=A474411E22F056AC64756E2164756E21
|