@uipath/codedagent-tool 1.206.0-preview.303 → 1.207.0-preview.305
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 +15 -9
- package/dist/index.js +2 -2
- package/dist/init.js +1 -1
- package/dist/{tool-jz4ybq18.js → tool-wby11rp2.js} +369 -195
- package/dist/{tool-8x1kxcm7.js → tool-x4hgg940.js} +13 -12
- package/dist/tool.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -75,6 +75,15 @@ instead. The flag is only sent when the resolved `uipath` advertises it
|
|
|
75
75
|
(checked with one `uipath new --help` call, since older cores reject options
|
|
76
76
|
they do not know).
|
|
77
77
|
|
|
78
|
+
Run from a solution root (a directory holding a `.uipx`), `new` is also sent
|
|
79
|
+
`--dir <name>`, so the project is scaffolded into `./<name>` and becomes a
|
|
80
|
+
member folder: written beside the `.uipx` it would be a member at the solution
|
|
81
|
+
root, which `uip solution pack` refuses. Only the current directory is checked
|
|
82
|
+
for a `.uipx`, so `mkdir my-agent && cd my-agent && uip codedagent new
|
|
83
|
+
my-agent` still scaffolds in place, as does `new` outside any solution. A
|
|
84
|
+
`<name>` already present at the solution root is refused (exit `3`) rather than
|
|
85
|
+
scaffolded over. A `--dir` you type yourself is kept.
|
|
86
|
+
|
|
78
87
|
`--type` is not an option this command takes: `uip codedagent new` always
|
|
79
88
|
scaffolds an agent, so passing one exits `1` with
|
|
80
89
|
`--type is not a valid option.` rather than being honoured or silently
|
|
@@ -181,17 +190,14 @@ export PYTHON_TOOL_PYTHON_VERSIONS=3.14,3.13,3.12,3.11,3.15
|
|
|
181
190
|
`uip` and its npm tools move in lockstep, but the Python `uipath` CLI releases
|
|
182
191
|
on its own schedule and `uv` resolves a per-project copy into `.venv`
|
|
183
192
|
independently of any global install. So `@uipath/uipath-python-bridge` declares
|
|
184
|
-
the minimum `uipath` it supports in
|
|
193
|
+
the minimum `uipath` it supports in `src/minimum-uipath-version.ts`:
|
|
185
194
|
|
|
186
|
-
```
|
|
187
|
-
"
|
|
188
|
-
"requires": {
|
|
189
|
-
"uipath": ">=2.14.41"
|
|
190
|
-
}
|
|
191
|
-
}
|
|
195
|
+
```ts
|
|
196
|
+
export const MINIMUM_UIPATH_VERSION = "2.14.49";
|
|
192
197
|
```
|
|
193
198
|
|
|
194
|
-
|
|
199
|
+
CI and the Athena image install exactly this version, read from that file, so
|
|
200
|
+
bumping the constant is the only step. The floor is held in two places. `setup` refuses to bind an executable below it
|
|
195
201
|
(and writes no cache). Every forwarded command then runs `uipath --version` on
|
|
196
202
|
the bound executable right before spawning it (the cache never holds a version) so an
|
|
197
203
|
in-place upgrade or downgrade, or a venv that differs from the global install,
|
|
@@ -234,7 +240,7 @@ uip codedagent setup
|
|
|
234
240
|
# Force re-detection
|
|
235
241
|
uip codedagent setup --force
|
|
236
242
|
|
|
237
|
-
# Scaffold a project, then initialize it
|
|
243
|
+
# Scaffold a project in the current directory, then initialize it
|
|
238
244
|
uip codedagent new my-agent
|
|
239
245
|
uip codedagent init
|
|
240
246
|
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
Command
|
|
4
|
-
} from "./tool-
|
|
4
|
+
} from "./tool-wby11rp2.js";
|
|
5
5
|
import {
|
|
6
6
|
metadata2,
|
|
7
7
|
registerCommands2
|
|
8
|
-
} from "./tool-
|
|
8
|
+
} from "./tool-x4hgg940.js";
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
var program = new Command;
|
package/dist/init.js
CHANGED
|
@@ -2120,13 +2120,15 @@ var ProjectDimensions = {
|
|
|
2120
2120
|
SolutionKey: "SolutionKey",
|
|
2121
2121
|
SolutionProjectKey: "SolutionProjectKey",
|
|
2122
2122
|
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2123
|
-
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2123
|
+
PreviousSolutionKey: "PreviousSolutionKey",
|
|
2124
|
+
PreviousProjectKey: "PreviousProjectKey"
|
|
2124
2125
|
};
|
|
2125
2126
|
var GUID_KEY_DIMENSIONS = new Set([
|
|
2126
2127
|
ProjectDimensions.ProjectKey,
|
|
2127
2128
|
ProjectDimensions.SolutionKey,
|
|
2128
2129
|
ProjectDimensions.SolutionProjectKey,
|
|
2129
|
-
ProjectDimensions.PreviousSolutionKey
|
|
2130
|
+
ProjectDimensions.PreviousSolutionKey,
|
|
2131
|
+
ProjectDimensions.PreviousProjectKey
|
|
2130
2132
|
]);
|
|
2131
2133
|
var ShipDimensions = {
|
|
2132
2134
|
ShipKind: "ShipKind",
|
|
@@ -2339,9 +2341,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
|
|
|
2339
2341
|
}
|
|
2340
2342
|
}
|
|
2341
2343
|
|
|
2342
|
-
// ../common/src/
|
|
2343
|
-
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2344
|
-
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2344
|
+
// ../common/src/sha256.ts
|
|
2345
2345
|
var SHA256_K = new Uint32Array([
|
|
2346
2346
|
1116352408,
|
|
2347
2347
|
1899447441,
|
|
@@ -2421,7 +2421,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
|
|
|
2421
2421
|
function rotr(value, bits) {
|
|
2422
2422
|
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
2423
2423
|
}
|
|
2424
|
-
function
|
|
2424
|
+
function sha256Words(input) {
|
|
2425
2425
|
const bytes = new TextEncoder().encode(input);
|
|
2426
2426
|
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
2427
2427
|
const buffer = new Uint8Array(paddedLength);
|
|
@@ -2477,12 +2477,19 @@ function sha256Hex(input) {
|
|
|
2477
2477
|
state[6] = state[6] + g >>> 0;
|
|
2478
2478
|
state[7] = state[7] + h >>> 0;
|
|
2479
2479
|
}
|
|
2480
|
+
return state;
|
|
2481
|
+
}
|
|
2482
|
+
function sha256Hex(input) {
|
|
2480
2483
|
let hex = "";
|
|
2481
|
-
for (const word of
|
|
2484
|
+
for (const word of sha256Words(input)) {
|
|
2482
2485
|
hex += word.toString(16).padStart(8, "0");
|
|
2483
2486
|
}
|
|
2484
2487
|
return hex;
|
|
2485
2488
|
}
|
|
2489
|
+
|
|
2490
|
+
// ../common/src/telemetry/pseudonymize.ts
|
|
2491
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2492
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2486
2493
|
function resolveSha256Hex() {
|
|
2487
2494
|
try {
|
|
2488
2495
|
const nodeCrypto = __require("node:crypto");
|
|
@@ -2878,13 +2885,25 @@ function settlePromiseLike(thenable) {
|
|
|
2878
2885
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2879
2886
|
}
|
|
2880
2887
|
|
|
2888
|
+
// ../common/src/result-types.ts
|
|
2889
|
+
var RESULTS = {
|
|
2890
|
+
Success: "Success",
|
|
2891
|
+
Failure: "Failure",
|
|
2892
|
+
ConfigError: "ConfigError",
|
|
2893
|
+
AuthenticationError: "AuthenticationError",
|
|
2894
|
+
ValidationError: "ValidationError",
|
|
2895
|
+
TimeoutError: "TimeoutError"
|
|
2896
|
+
};
|
|
2897
|
+
|
|
2881
2898
|
// ../common/src/error-codes.ts
|
|
2882
2899
|
var CLI_ERROR_CODES = [
|
|
2883
2900
|
"invalid_argument",
|
|
2901
|
+
"confirmation_required",
|
|
2884
2902
|
"authentication_required",
|
|
2885
2903
|
"permission_denied",
|
|
2886
2904
|
"local_permission_denied",
|
|
2887
2905
|
"not_found",
|
|
2906
|
+
"not_enabled",
|
|
2888
2907
|
"rate_limited",
|
|
2889
2908
|
"network_error",
|
|
2890
2909
|
"timeout",
|
|
@@ -2923,6 +2942,12 @@ function carriedRetry(error) {
|
|
|
2923
2942
|
const retry = error.retry;
|
|
2924
2943
|
return isRetryHint(retry) ? retry : undefined;
|
|
2925
2944
|
}
|
|
2945
|
+
function carriedResult(error) {
|
|
2946
|
+
if (!error || typeof error !== "object")
|
|
2947
|
+
return;
|
|
2948
|
+
const result = error.result;
|
|
2949
|
+
return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
|
|
2950
|
+
}
|
|
2926
2951
|
function defaultRetryForErrorCode(errorCode) {
|
|
2927
2952
|
switch (errorCode) {
|
|
2928
2953
|
case "network_error":
|
|
@@ -3312,6 +3337,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3312
3337
|
}
|
|
3313
3338
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
3314
3339
|
context.errorCode = parsedBody.errorCode;
|
|
3340
|
+
} else if (typeof parsedBody?.errorCode === "number") {
|
|
3341
|
+
context.errorCode = String(parsedBody.errorCode);
|
|
3315
3342
|
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
3316
3343
|
context.errorCode = parsedBody.code;
|
|
3317
3344
|
}
|
|
@@ -3432,12 +3459,26 @@ class NodeFileSystem {
|
|
|
3432
3459
|
throw error;
|
|
3433
3460
|
}
|
|
3434
3461
|
}
|
|
3435
|
-
async writeFile(filePath, data) {
|
|
3462
|
+
async writeFile(filePath, data, options) {
|
|
3436
3463
|
const dir = path.dirname(filePath);
|
|
3437
3464
|
if (dir) {
|
|
3438
3465
|
await fs.mkdir(dir, { recursive: true });
|
|
3439
3466
|
}
|
|
3440
|
-
|
|
3467
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
3468
|
+
if (options?.exclusive) {
|
|
3469
|
+
await fs.writeFile(filePath, data, { flag: "wx" });
|
|
3470
|
+
} else {
|
|
3471
|
+
await fs.writeFile(filePath, data);
|
|
3472
|
+
}
|
|
3473
|
+
return;
|
|
3474
|
+
}
|
|
3475
|
+
const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
3476
|
+
try {
|
|
3477
|
+
await handle.chmod(options.mode);
|
|
3478
|
+
await handle.writeFile(data);
|
|
3479
|
+
} finally {
|
|
3480
|
+
await handle.close();
|
|
3481
|
+
}
|
|
3441
3482
|
}
|
|
3442
3483
|
async appendFile(filePath, data) {
|
|
3443
3484
|
const dir = path.dirname(filePath);
|
|
@@ -3472,7 +3513,8 @@ class NodeFileSystem {
|
|
|
3472
3513
|
isDirectory: () => stats.isDirectory(),
|
|
3473
3514
|
size: stats.size,
|
|
3474
3515
|
mtimeMs: stats.mtimeMs,
|
|
3475
|
-
ctimeMs: stats.ctimeMs
|
|
3516
|
+
ctimeMs: stats.ctimeMs,
|
|
3517
|
+
mode: stats.mode
|
|
3476
3518
|
};
|
|
3477
3519
|
} catch (error) {
|
|
3478
3520
|
if (this.isEnoent(error))
|
|
@@ -3483,8 +3525,13 @@ class NodeFileSystem {
|
|
|
3483
3525
|
async exists(filePath) {
|
|
3484
3526
|
return existsSync(filePath);
|
|
3485
3527
|
}
|
|
3486
|
-
async mkdir(dirPath) {
|
|
3487
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
3528
|
+
async mkdir(dirPath, options) {
|
|
3529
|
+
await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
3530
|
+
}
|
|
3531
|
+
async chmod(targetPath, mode) {
|
|
3532
|
+
if (process.platform === "win32")
|
|
3533
|
+
return;
|
|
3534
|
+
await fs.chmod(targetPath, mode);
|
|
3488
3535
|
}
|
|
3489
3536
|
async acquireLock(lockPath) {
|
|
3490
3537
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -3634,7 +3681,7 @@ class NodeFileSystem {
|
|
|
3634
3681
|
async getTempDir() {
|
|
3635
3682
|
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
3636
3683
|
}
|
|
3637
|
-
async copyDirectory(sourcePath, destPath) {
|
|
3684
|
+
async copyDirectory(sourcePath, destPath, options) {
|
|
3638
3685
|
const sourceStats = await this.stat(sourcePath);
|
|
3639
3686
|
if (!sourceStats) {
|
|
3640
3687
|
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
@@ -3651,7 +3698,9 @@ class NodeFileSystem {
|
|
|
3651
3698
|
if (!entryStats)
|
|
3652
3699
|
continue;
|
|
3653
3700
|
if (entryStats.isDirectory()) {
|
|
3654
|
-
|
|
3701
|
+
if (options?.skipDirectoryNames?.includes(entry))
|
|
3702
|
+
continue;
|
|
3703
|
+
await this.copyDirectory(srcEntry, destEntry, options);
|
|
3655
3704
|
} else if (entryStats.isFile()) {
|
|
3656
3705
|
const content = await this.readFile(srcEntry);
|
|
3657
3706
|
if (content !== null) {
|
|
@@ -4021,16 +4070,6 @@ function getOutputFilter() {
|
|
|
4021
4070
|
return filterSlot.get();
|
|
4022
4071
|
}
|
|
4023
4072
|
|
|
4024
|
-
// ../common/src/result-types.ts
|
|
4025
|
-
var RESULTS = {
|
|
4026
|
-
Success: "Success",
|
|
4027
|
-
Failure: "Failure",
|
|
4028
|
-
ConfigError: "ConfigError",
|
|
4029
|
-
AuthenticationError: "AuthenticationError",
|
|
4030
|
-
ValidationError: "ValidationError",
|
|
4031
|
-
TimeoutError: "TimeoutError"
|
|
4032
|
-
};
|
|
4033
|
-
|
|
4034
4073
|
// ../common/src/telemetry/command-terminal.ts
|
|
4035
4074
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
4036
4075
|
var AUTH_ERROR_CODES = new Set([
|
|
@@ -4040,7 +4079,10 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
4040
4079
|
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
4041
4080
|
"local_permission_denied"
|
|
4042
4081
|
]);
|
|
4043
|
-
var VALIDATION_ERROR_CODES = new Set([
|
|
4082
|
+
var VALIDATION_ERROR_CODES = new Set([
|
|
4083
|
+
"invalid_argument",
|
|
4084
|
+
"confirmation_required"
|
|
4085
|
+
]);
|
|
4044
4086
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
4045
4087
|
"network_error",
|
|
4046
4088
|
"rate_limited",
|
|
@@ -4266,6 +4308,109 @@ var CommonTelemetryEvents = {
|
|
|
4266
4308
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
4267
4309
|
};
|
|
4268
4310
|
|
|
4311
|
+
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
4312
|
+
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
4313
|
+
function getGlobalTelemetryProperties() {
|
|
4314
|
+
return telemetryPropsSlot.get();
|
|
4315
|
+
}
|
|
4316
|
+
|
|
4317
|
+
// ../common/src/telemetry/trace-context.ts
|
|
4318
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
4319
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
4320
|
+
function getProcessEnv() {
|
|
4321
|
+
return globalThis.process?.env;
|
|
4322
|
+
}
|
|
4323
|
+
function parseInboundTraceparent(value) {
|
|
4324
|
+
if (!value) {
|
|
4325
|
+
return;
|
|
4326
|
+
}
|
|
4327
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
4328
|
+
if (!match) {
|
|
4329
|
+
return;
|
|
4330
|
+
}
|
|
4331
|
+
const [, traceId, parentSpanId] = match;
|
|
4332
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
4333
|
+
return;
|
|
4334
|
+
}
|
|
4335
|
+
return { traceId, parentSpanId };
|
|
4336
|
+
}
|
|
4337
|
+
function getInboundTraceContext() {
|
|
4338
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
4339
|
+
}
|
|
4340
|
+
|
|
4341
|
+
// ../common/src/telemetry/session-id.ts
|
|
4342
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4343
|
+
var SESSION_ID_MAX_LENGTH = 64;
|
|
4344
|
+
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4345
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4346
|
+
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4347
|
+
var INHERITED_SESSION_SOURCES = [
|
|
4348
|
+
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
4349
|
+
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
4350
|
+
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
4351
|
+
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
4352
|
+
{ envVar: "WT_SESSION", source: "terminal" }
|
|
4353
|
+
];
|
|
4354
|
+
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
4355
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
4356
|
+
function getProcessEnv2() {
|
|
4357
|
+
return globalThis.process?.env;
|
|
4358
|
+
}
|
|
4359
|
+
function normalizeSessionId(value) {
|
|
4360
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
4361
|
+
return;
|
|
4362
|
+
}
|
|
4363
|
+
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
4364
|
+
return cleaned || undefined;
|
|
4365
|
+
}
|
|
4366
|
+
function getConfiguredTelemetrySessionId() {
|
|
4367
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
4368
|
+
}
|
|
4369
|
+
function getInheritedSession(env) {
|
|
4370
|
+
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
4371
|
+
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
4372
|
+
if (handle) {
|
|
4373
|
+
return { id: handle, source: candidate.source };
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
return;
|
|
4377
|
+
}
|
|
4378
|
+
function generateRandomSession() {
|
|
4379
|
+
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
4380
|
+
crypto.getRandomValues(bytes);
|
|
4381
|
+
let hex = "";
|
|
4382
|
+
for (const byte of bytes) {
|
|
4383
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4384
|
+
}
|
|
4385
|
+
return { id: hex, source: "random" };
|
|
4386
|
+
}
|
|
4387
|
+
function resolveTelemetrySession() {
|
|
4388
|
+
const existing = telemetrySessionSlot.get();
|
|
4389
|
+
if (existing) {
|
|
4390
|
+
return existing;
|
|
4391
|
+
}
|
|
4392
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
4393
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
4394
|
+
telemetrySessionSlot.set(resolved);
|
|
4395
|
+
return resolved;
|
|
4396
|
+
}
|
|
4397
|
+
function getTelemetrySessionId() {
|
|
4398
|
+
return resolveTelemetrySession().id;
|
|
4399
|
+
}
|
|
4400
|
+
function getTelemetrySessionSource() {
|
|
4401
|
+
return resolveTelemetrySession().source;
|
|
4402
|
+
}
|
|
4403
|
+
function getTelemetryOperationId() {
|
|
4404
|
+
const existing = telemetryOperationIdSlot.get();
|
|
4405
|
+
if (existing) {
|
|
4406
|
+
return existing;
|
|
4407
|
+
}
|
|
4408
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
4409
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
4410
|
+
telemetryOperationIdSlot.set(generated);
|
|
4411
|
+
return generated;
|
|
4412
|
+
}
|
|
4413
|
+
|
|
4269
4414
|
// ../common/src/registry.ts
|
|
4270
4415
|
import { execFileSync } from "node:child_process";
|
|
4271
4416
|
function readRegistryValue(keyPath, valueName) {
|
|
@@ -4487,108 +4632,6 @@ class NodeContextStorage {
|
|
|
4487
4632
|
return this.storage.getStore();
|
|
4488
4633
|
}
|
|
4489
4634
|
}
|
|
4490
|
-
// ../common/src/telemetry/trace-context.ts
|
|
4491
|
-
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
4492
|
-
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
4493
|
-
function getProcessEnv() {
|
|
4494
|
-
return globalThis.process?.env;
|
|
4495
|
-
}
|
|
4496
|
-
function parseInboundTraceparent(value) {
|
|
4497
|
-
if (!value) {
|
|
4498
|
-
return;
|
|
4499
|
-
}
|
|
4500
|
-
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
4501
|
-
if (!match) {
|
|
4502
|
-
return;
|
|
4503
|
-
}
|
|
4504
|
-
const [, traceId, parentSpanId] = match;
|
|
4505
|
-
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
4506
|
-
return;
|
|
4507
|
-
}
|
|
4508
|
-
return { traceId, parentSpanId };
|
|
4509
|
-
}
|
|
4510
|
-
function getInboundTraceContext() {
|
|
4511
|
-
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
4512
|
-
}
|
|
4513
|
-
|
|
4514
|
-
// ../common/src/telemetry/session-id.ts
|
|
4515
|
-
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4516
|
-
var SESSION_ID_MAX_LENGTH = 64;
|
|
4517
|
-
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4518
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4519
|
-
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4520
|
-
var INHERITED_SESSION_SOURCES = [
|
|
4521
|
-
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
4522
|
-
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
4523
|
-
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
4524
|
-
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
4525
|
-
{ envVar: "WT_SESSION", source: "terminal" }
|
|
4526
|
-
];
|
|
4527
|
-
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
4528
|
-
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
4529
|
-
function getProcessEnv2() {
|
|
4530
|
-
return globalThis.process?.env;
|
|
4531
|
-
}
|
|
4532
|
-
function normalizeSessionId(value) {
|
|
4533
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
4534
|
-
return;
|
|
4535
|
-
}
|
|
4536
|
-
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
4537
|
-
return cleaned || undefined;
|
|
4538
|
-
}
|
|
4539
|
-
function getConfiguredTelemetrySessionId() {
|
|
4540
|
-
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
4541
|
-
}
|
|
4542
|
-
function getInheritedSession(env) {
|
|
4543
|
-
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
4544
|
-
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
4545
|
-
if (handle) {
|
|
4546
|
-
return { id: handle, source: candidate.source };
|
|
4547
|
-
}
|
|
4548
|
-
}
|
|
4549
|
-
return;
|
|
4550
|
-
}
|
|
4551
|
-
function generateRandomSession() {
|
|
4552
|
-
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
4553
|
-
crypto.getRandomValues(bytes);
|
|
4554
|
-
let hex = "";
|
|
4555
|
-
for (const byte of bytes) {
|
|
4556
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
4557
|
-
}
|
|
4558
|
-
return { id: hex, source: "random" };
|
|
4559
|
-
}
|
|
4560
|
-
function resolveTelemetrySession() {
|
|
4561
|
-
const existing = telemetrySessionSlot.get();
|
|
4562
|
-
if (existing) {
|
|
4563
|
-
return existing;
|
|
4564
|
-
}
|
|
4565
|
-
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
4566
|
-
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
4567
|
-
telemetrySessionSlot.set(resolved);
|
|
4568
|
-
return resolved;
|
|
4569
|
-
}
|
|
4570
|
-
function getTelemetrySessionId() {
|
|
4571
|
-
return resolveTelemetrySession().id;
|
|
4572
|
-
}
|
|
4573
|
-
function getTelemetrySessionSource() {
|
|
4574
|
-
return resolveTelemetrySession().source;
|
|
4575
|
-
}
|
|
4576
|
-
function getTelemetryOperationId() {
|
|
4577
|
-
const existing = telemetryOperationIdSlot.get();
|
|
4578
|
-
if (existing) {
|
|
4579
|
-
return existing;
|
|
4580
|
-
}
|
|
4581
|
-
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
4582
|
-
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
4583
|
-
telemetryOperationIdSlot.set(generated);
|
|
4584
|
-
return generated;
|
|
4585
|
-
}
|
|
4586
|
-
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
4587
|
-
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
4588
|
-
function getGlobalTelemetryProperties() {
|
|
4589
|
-
return telemetryPropsSlot.get();
|
|
4590
|
-
}
|
|
4591
|
-
|
|
4592
4635
|
// ../common/src/telemetry/span-clock.ts
|
|
4593
4636
|
function startSpanClock() {
|
|
4594
4637
|
const started = performance.now();
|
|
@@ -4802,6 +4845,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
|
4802
4845
|
// ../common/src/telemetry/telemetry-init.ts
|
|
4803
4846
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
4804
4847
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
4848
|
+
var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
|
|
4805
4849
|
function getGlobalTelemetryInstance() {
|
|
4806
4850
|
const existing = telemetryInstanceSlot.get();
|
|
4807
4851
|
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
@@ -4985,7 +5029,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
4985
5029
|
const pagedRows = extractPagedRows(data.Data);
|
|
4986
5030
|
const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
|
|
4987
5031
|
items.forEach((item) => {
|
|
4988
|
-
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
5032
|
+
const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
|
|
4989
5033
|
logFn(values);
|
|
4990
5034
|
});
|
|
4991
5035
|
} else {
|
|
@@ -5000,7 +5044,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
5000
5044
|
default: {
|
|
5001
5045
|
const hasData = "Data" in data && data.Data != null;
|
|
5002
5046
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
5003
|
-
const
|
|
5047
|
+
const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
|
|
5048
|
+
const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
|
|
5004
5049
|
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
5005
5050
|
const logValue = data.Log;
|
|
5006
5051
|
if (rows !== null) {
|
|
@@ -5057,6 +5102,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
|
5057
5102
|
function isPlainObjectArray(value) {
|
|
5058
5103
|
return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
5059
5104
|
}
|
|
5105
|
+
function isPrimitiveArray(value) {
|
|
5106
|
+
return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
|
|
5107
|
+
}
|
|
5060
5108
|
function isNonEmptyPlainObject(value) {
|
|
5061
5109
|
return isPlainRecord(value) && Object.keys(value).length > 0;
|
|
5062
5110
|
}
|
|
@@ -5403,12 +5451,12 @@ class FilterEvaluationError extends Error {
|
|
|
5403
5451
|
instructions;
|
|
5404
5452
|
retry = "RetryWillNotFix";
|
|
5405
5453
|
result = RESULTS.ValidationError;
|
|
5406
|
-
constructor(filter, cause) {
|
|
5454
|
+
constructor(filter, cause, hint) {
|
|
5407
5455
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
5408
|
-
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
5456
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
|
|
5409
5457
|
this.name = "FilterEvaluationError";
|
|
5410
5458
|
this.filter = filter;
|
|
5411
|
-
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
5459
|
+
this.instructions = (hint ? `${hint.instructions} ` : "") + `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
5412
5460
|
}
|
|
5413
5461
|
}
|
|
5414
5462
|
|
|
@@ -5530,6 +5578,93 @@ function nameList(names, cap = 12) {
|
|
|
5530
5578
|
const rest = names.length - shown.length;
|
|
5531
5579
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5532
5580
|
}
|
|
5581
|
+
function notFieldsOn(names, scope) {
|
|
5582
|
+
return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5583
|
+
}
|
|
5584
|
+
function failingFieldRead(ast, isList, fn, argIndex) {
|
|
5585
|
+
const [left, right, condition] = ast.children ?? [];
|
|
5586
|
+
let scopes = [];
|
|
5587
|
+
if (!isList) {
|
|
5588
|
+
scopes = [ast];
|
|
5589
|
+
} else if (ast.type === "FilterProjection" && left?.type === "Identity") {
|
|
5590
|
+
scopes = [condition, right];
|
|
5591
|
+
} else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
|
|
5592
|
+
scopes = [right];
|
|
5593
|
+
}
|
|
5594
|
+
const reads = new Set;
|
|
5595
|
+
let tracked = 0;
|
|
5596
|
+
const visit = (node) => {
|
|
5597
|
+
if (!node)
|
|
5598
|
+
return;
|
|
5599
|
+
switch (node.type) {
|
|
5600
|
+
case "Function": {
|
|
5601
|
+
const arg = node.children?.[argIndex - 1];
|
|
5602
|
+
if (node.name === fn && arg?.type === "Field" && arg.name) {
|
|
5603
|
+
reads.add(arg.name);
|
|
5604
|
+
tracked++;
|
|
5605
|
+
}
|
|
5606
|
+
node.children?.forEach(visit);
|
|
5607
|
+
return;
|
|
5608
|
+
}
|
|
5609
|
+
case "AndExpression":
|
|
5610
|
+
case "OrExpression":
|
|
5611
|
+
case "NotExpression":
|
|
5612
|
+
case "Comparator":
|
|
5613
|
+
case "MultiSelectList":
|
|
5614
|
+
case "MultiSelectHash":
|
|
5615
|
+
node.children?.forEach(visit);
|
|
5616
|
+
return;
|
|
5617
|
+
case "KeyValuePair":
|
|
5618
|
+
visit(node.value);
|
|
5619
|
+
return;
|
|
5620
|
+
}
|
|
5621
|
+
};
|
|
5622
|
+
scopes.forEach(visit);
|
|
5623
|
+
const calls = (node) => {
|
|
5624
|
+
if (node === null || typeof node !== "object")
|
|
5625
|
+
return 0;
|
|
5626
|
+
const own = node.type === "Function" && node.name === fn ? 1 : 0;
|
|
5627
|
+
const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
|
|
5628
|
+
return own + next.reduce((sum, child) => sum + calls(child), 0);
|
|
5629
|
+
};
|
|
5630
|
+
return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
|
|
5631
|
+
}
|
|
5632
|
+
function fieldExpression(name) {
|
|
5633
|
+
return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
|
|
5634
|
+
}
|
|
5635
|
+
function evaluationHint(codec, filter, data, cause) {
|
|
5636
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
5637
|
+
const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
|
|
5638
|
+
if (!failure)
|
|
5639
|
+
return;
|
|
5640
|
+
const [, fn, position, expected] = failure;
|
|
5641
|
+
const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
|
|
5642
|
+
if (name === undefined)
|
|
5643
|
+
return;
|
|
5644
|
+
const present = availableFields(data);
|
|
5645
|
+
if (present.length === 0)
|
|
5646
|
+
return;
|
|
5647
|
+
const scope = `${countRecords(data)} record(s)`;
|
|
5648
|
+
if (!present.includes(name)) {
|
|
5649
|
+
return {
|
|
5650
|
+
detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
|
|
5651
|
+
instructions: "Use a field the records have; names are case-sensitive."
|
|
5652
|
+
};
|
|
5653
|
+
}
|
|
5654
|
+
const records = Array.isArray(data) ? data : [data];
|
|
5655
|
+
const unset = records.filter((r) => r?.[name] == null).length;
|
|
5656
|
+
const field = fieldExpression(name);
|
|
5657
|
+
let fallback;
|
|
5658
|
+
if (expected.split(",").includes("string")) {
|
|
5659
|
+
fallback = "''";
|
|
5660
|
+
} else if (expected.split(",").includes("array")) {
|
|
5661
|
+
fallback = "`[]`";
|
|
5662
|
+
}
|
|
5663
|
+
return {
|
|
5664
|
+
detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
|
|
5665
|
+
instructions: fallback ? `Give it a default where ${fn}() reads it, e.g. \`${field} || ${fallback}\`.` : `Filter out the records where \`${name}\` is null before ${fn}() reads it.`
|
|
5666
|
+
};
|
|
5667
|
+
}
|
|
5533
5668
|
function buildFilterWarning(filter, data, outcome) {
|
|
5534
5669
|
const present = availableFields(data);
|
|
5535
5670
|
const refs = referencedFields(filter);
|
|
@@ -5537,7 +5672,7 @@ function buildFilterWarning(filter, data, outcome) {
|
|
|
5537
5672
|
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5538
5673
|
const count = countRecords(data);
|
|
5539
5674
|
const scope = `${count} record(s)`;
|
|
5540
|
-
const isNotAField = (names) =>
|
|
5675
|
+
const isNotAField = (names) => notFieldsOn(names, scope);
|
|
5541
5676
|
const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
|
|
5542
5677
|
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5543
5678
|
let detail;
|
|
@@ -5588,7 +5723,8 @@ function applyFilter(data, filter, onWarning) {
|
|
|
5588
5723
|
try {
|
|
5589
5724
|
result = codec.search(data, filter);
|
|
5590
5725
|
} catch (err) {
|
|
5591
|
-
|
|
5726
|
+
const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
|
|
5727
|
+
throw new FilterEvaluationError(filter, err, hint);
|
|
5592
5728
|
}
|
|
5593
5729
|
const inputCount = countRecords(data);
|
|
5594
5730
|
const warn = (outcome) => {
|
|
@@ -6479,7 +6615,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6479
6615
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
6480
6616
|
const typed = error;
|
|
6481
6617
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6482
|
-
const customResult =
|
|
6618
|
+
const customResult = carriedResult(error);
|
|
6483
6619
|
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6484
6620
|
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6485
6621
|
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
@@ -6926,6 +7062,8 @@ var FAILURE_STATUSES = new Set([
|
|
|
6926
7062
|
"canceled",
|
|
6927
7063
|
"stopped"
|
|
6928
7064
|
]);
|
|
7065
|
+
// ../common/src/relayed-output.ts
|
|
7066
|
+
var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
|
|
6929
7067
|
// ../common/src/screen-logger.ts
|
|
6930
7068
|
var ScreenLogger;
|
|
6931
7069
|
((ScreenLogger) => {
|
|
@@ -6974,6 +7112,8 @@ function settlePromiseLike2(thenable) {
|
|
|
6974
7112
|
// ../auth/src/constants.ts
|
|
6975
7113
|
var UIPATH_HOME_DIR2 = ".uipath";
|
|
6976
7114
|
var AUTH_FILENAME = ".auth";
|
|
7115
|
+
var AUTH_FILE_MODE = 384;
|
|
7116
|
+
var AUTH_DIR_MODE = 448;
|
|
6977
7117
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
6978
7118
|
var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
6979
7119
|
|
|
@@ -7797,6 +7937,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
7797
7937
|
}
|
|
7798
7938
|
return parseEnvContent(content);
|
|
7799
7939
|
};
|
|
7940
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
7941
|
+
let current = dir;
|
|
7942
|
+
for (;; ) {
|
|
7943
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR2)
|
|
7944
|
+
return current;
|
|
7945
|
+
const parent = fs.path.dirname(current);
|
|
7946
|
+
if (parent === current)
|
|
7947
|
+
return;
|
|
7948
|
+
current = parent;
|
|
7949
|
+
}
|
|
7950
|
+
};
|
|
7951
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
7952
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
7953
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
7954
|
+
for (let attempt = 1;; attempt++) {
|
|
7955
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
7956
|
+
try {
|
|
7957
|
+
await fs.writeFile(tempPath, content, {
|
|
7958
|
+
mode: AUTH_FILE_MODE,
|
|
7959
|
+
exclusive: true
|
|
7960
|
+
});
|
|
7961
|
+
return tempPath;
|
|
7962
|
+
} catch (error) {
|
|
7963
|
+
if (!isFileExists(error)) {
|
|
7964
|
+
await fs.rm(tempPath).catch(() => {});
|
|
7965
|
+
throw error;
|
|
7966
|
+
}
|
|
7967
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
7968
|
+
throw error;
|
|
7969
|
+
}
|
|
7970
|
+
}
|
|
7971
|
+
};
|
|
7800
7972
|
var saveEnvFileAsync = async ({
|
|
7801
7973
|
envPath,
|
|
7802
7974
|
data,
|
|
@@ -7824,10 +7996,18 @@ var saveEnvFileAsync = async ({
|
|
|
7824
7996
|
`)}
|
|
7825
7997
|
`;
|
|
7826
7998
|
const dir = fs.path.dirname(absolutePath);
|
|
7827
|
-
await fs.mkdir(dir);
|
|
7828
|
-
const
|
|
7829
|
-
|
|
7830
|
-
|
|
7999
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
8000
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
8001
|
+
if (authHomeDir !== undefined) {
|
|
8002
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
8003
|
+
}
|
|
8004
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
8005
|
+
try {
|
|
8006
|
+
await fs.rename(tempPath, absolutePath);
|
|
8007
|
+
} catch (error) {
|
|
8008
|
+
await fs.rm(tempPath).catch(() => {});
|
|
8009
|
+
throw error;
|
|
8010
|
+
}
|
|
7831
8011
|
};
|
|
7832
8012
|
|
|
7833
8013
|
// ../auth/src/loginStatus.ts
|
|
@@ -8468,63 +8648,16 @@ async function readCache(cacheFile) {
|
|
|
8468
8648
|
}
|
|
8469
8649
|
return cache;
|
|
8470
8650
|
}
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
author: "UiPath",
|
|
8475
|
-
license: "SEE LICENSE IN LICENSE.txt",
|
|
8476
|
-
version: "1.206.0-preview.303",
|
|
8477
|
-
description: "Shared Python detection, caching, and CLI bridge for UiPath Python SDK tools.",
|
|
8478
|
-
keywords: [
|
|
8479
|
-
"uip",
|
|
8480
|
-
"python",
|
|
8481
|
-
"bridge"
|
|
8482
|
-
],
|
|
8483
|
-
uipath: {
|
|
8484
|
-
requires: {
|
|
8485
|
-
uipath: ">=2.14.41"
|
|
8486
|
-
}
|
|
8487
|
-
},
|
|
8488
|
-
type: "module",
|
|
8489
|
-
main: "./dist/index.js",
|
|
8490
|
-
exports: {
|
|
8491
|
-
".": "./dist/index.js"
|
|
8492
|
-
},
|
|
8493
|
-
files: [
|
|
8494
|
-
"dist"
|
|
8495
|
-
],
|
|
8496
|
-
repository: {
|
|
8497
|
-
type: "git",
|
|
8498
|
-
url: "https://github.com/UiPath/cli.git",
|
|
8499
|
-
directory: "packages/uipath-python-bridge"
|
|
8500
|
-
},
|
|
8501
|
-
publishConfig: {
|
|
8502
|
-
registry: "https://npm.pkg.github.com/@uipath"
|
|
8503
|
-
},
|
|
8504
|
-
scripts: {
|
|
8505
|
-
build: "bun build ./src/index.ts --outdir dist --format esm --target node --external applicationinsights --sourcemap=linked",
|
|
8506
|
-
typecheck: "tsc --noEmit",
|
|
8507
|
-
test: "vitest run",
|
|
8508
|
-
"test:coverage": "vitest run --coverage",
|
|
8509
|
-
lint: "biome check .",
|
|
8510
|
-
"lint:fix": "biome check --write ."
|
|
8511
|
-
},
|
|
8512
|
-
devDependencies: {
|
|
8513
|
-
"@uipath/auth": "workspace:*",
|
|
8514
|
-
"@uipath/common": "workspace:*",
|
|
8515
|
-
"@uipath/filesystem": "workspace:*",
|
|
8516
|
-
"@types/bun": "^1.3.11",
|
|
8517
|
-
commander: "^14.0.3",
|
|
8518
|
-
typescript: "^7.0.2"
|
|
8519
|
-
}
|
|
8520
|
-
};
|
|
8651
|
+
|
|
8652
|
+
// ../uipath-python-bridge/src/minimum-uipath-version.ts
|
|
8653
|
+
var MINIMUM_UIPATH_VERSION = "2.14.49";
|
|
8521
8654
|
|
|
8522
8655
|
// ../uipath-python-bridge/src/config.ts
|
|
8523
8656
|
var DEFAULT_CONFIG = {
|
|
8524
8657
|
allowedPythonVersions: ["3.14", "3.13", "3.12", "3.11", "3.15"],
|
|
8525
8658
|
packageName: "uipath",
|
|
8526
8659
|
cacheFileName: ".uipath-python-cache.json",
|
|
8527
|
-
uipathVersionRequirement:
|
|
8660
|
+
uipathVersionRequirement: `>=${MINIMUM_UIPATH_VERSION}`
|
|
8528
8661
|
};
|
|
8529
8662
|
function getAllowedPythonVersions() {
|
|
8530
8663
|
const envVersions = process.env.PYTHON_TOOL_PYTHON_VERSIONS;
|
|
@@ -8601,10 +8734,31 @@ function processCommandArgs(args, rules) {
|
|
|
8601
8734
|
import { execFile } from "node:child_process";
|
|
8602
8735
|
var PROBE_TIMEOUT_MS = 15000;
|
|
8603
8736
|
var TYPE_OPTION = /^--type(=|$)/;
|
|
8737
|
+
var DIR_OPTION = /^--dir(=|$)/;
|
|
8604
8738
|
var TYPE_LISTED = /^[ \t]*--type(?![\w-])/m;
|
|
8739
|
+
var NEW_OPTIONS_WITH_VALUE = new Set([
|
|
8740
|
+
"--type",
|
|
8741
|
+
"--agent-framework",
|
|
8742
|
+
"--dir"
|
|
8743
|
+
]);
|
|
8605
8744
|
function hasTypeOption(args) {
|
|
8606
8745
|
return args.some((arg) => TYPE_OPTION.test(arg));
|
|
8607
8746
|
}
|
|
8747
|
+
function hasDirOption(args) {
|
|
8748
|
+
return args.some((arg) => DIR_OPTION.test(arg));
|
|
8749
|
+
}
|
|
8750
|
+
function scaffoldNameOf(args) {
|
|
8751
|
+
for (let i = 1;i < args.length; i++) {
|
|
8752
|
+
const arg = args[i] ?? "";
|
|
8753
|
+
if (!arg.startsWith("-")) {
|
|
8754
|
+
return arg === "" ? undefined : arg;
|
|
8755
|
+
}
|
|
8756
|
+
if (NEW_OPTIONS_WITH_VALUE.has(arg)) {
|
|
8757
|
+
i++;
|
|
8758
|
+
}
|
|
8759
|
+
}
|
|
8760
|
+
return;
|
|
8761
|
+
}
|
|
8608
8762
|
async function supportsNewTypeOption(exePath, cwd, env = {}, signal) {
|
|
8609
8763
|
return new Promise((resolve) => {
|
|
8610
8764
|
execFile(exePath, ["new", "--help"], {
|
|
@@ -8763,6 +8917,10 @@ function applyOutputFormatOption(args, option, supportedFormats) {
|
|
|
8763
8917
|
}
|
|
8764
8918
|
return [...args, option, format];
|
|
8765
8919
|
}
|
|
8920
|
+
async function isSolutionRoot(fs, dir) {
|
|
8921
|
+
const [readError, entries] = await catchError(fs.readdir(dir));
|
|
8922
|
+
return !readError && Array.isArray(entries) && entries.some((entry) => entry.endsWith(".uipx"));
|
|
8923
|
+
}
|
|
8766
8924
|
function matchesRequiredCommand(args, commands) {
|
|
8767
8925
|
return args[0] !== undefined && commands.includes(args[0]);
|
|
8768
8926
|
}
|
|
@@ -8830,6 +8988,17 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
8830
8988
|
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args) && hasTypeOption(processed.args)) {
|
|
8831
8989
|
return fail("new_type_not_allowed", "--type is not a valid option.", "Remove --type and re-run.");
|
|
8832
8990
|
}
|
|
8991
|
+
const cwd = options.cwd ?? fs.env.cwd();
|
|
8992
|
+
let scaffoldDir;
|
|
8993
|
+
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args) && !hasDirOption(processed.args)) {
|
|
8994
|
+
const name = scaffoldNameOf(processed.args);
|
|
8995
|
+
if (name !== undefined && await isSolutionRoot(fs, cwd)) {
|
|
8996
|
+
if (await fs.exists(fs.path.resolve(cwd, name))) {
|
|
8997
|
+
return fail("new_dir_exists", `'${name}' already exists in this solution folder.`, "Choose another project name, or pass --dir <path> to scaffold into a directory of your own.");
|
|
8998
|
+
}
|
|
8999
|
+
scaffoldDir = name;
|
|
9000
|
+
}
|
|
9001
|
+
}
|
|
8833
9002
|
const processedArgs = applyOutputFormatOption(processed.args, options.outputFormatOption, options.outputFormats);
|
|
8834
9003
|
const commandArgs = options.commandPrefix ? [options.commandPrefix, ...processedArgs] : [...processedArgs];
|
|
8835
9004
|
const requiredEnv = {};
|
|
@@ -8863,7 +9032,6 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
8863
9032
|
}
|
|
8864
9033
|
}
|
|
8865
9034
|
const stdio = options.stdio ?? "inherit";
|
|
8866
|
-
const cwd = options.cwd ?? fs.env.cwd();
|
|
8867
9035
|
const versionCheck = await checkUipathVersion(cache.uipathExePath, {
|
|
8868
9036
|
cwd,
|
|
8869
9037
|
signal: options.signal
|
|
@@ -8872,8 +9040,13 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
8872
9040
|
return fail(versionCheck.kind === "unsupported" ? "uipath_version_unsupported" : "uipath_version_unverifiable", versionCheck.message, uipathVersionInstructions(versionCheck, toolLabel));
|
|
8873
9041
|
}
|
|
8874
9042
|
logger.debug(`Using uipath ${versionCheck.version} at ${cache.uipathExePath} (source: ${cache.source ?? "unknown"}; requires uipath${versionCheck.requirement})`);
|
|
8875
|
-
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args)
|
|
8876
|
-
|
|
9043
|
+
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args)) {
|
|
9044
|
+
if (await supportsNewTypeOption(cache.uipathExePath, cwd, { ...authEnv, ...requiredEnv }, options.signal)) {
|
|
9045
|
+
commandArgs.push("--type", options.pinNewType);
|
|
9046
|
+
}
|
|
9047
|
+
if (scaffoldDir !== undefined) {
|
|
9048
|
+
commandArgs.push("--dir", scaffoldDir);
|
|
9049
|
+
}
|
|
8877
9050
|
}
|
|
8878
9051
|
const proc = spawn(cache.uipathExePath, commandArgs, {
|
|
8879
9052
|
cwd,
|
|
@@ -8933,6 +9106,7 @@ var CLI_RESULT_BY_REASON = {
|
|
|
8933
9106
|
uipath_version_unverifiable: RESULTS.ConfigError,
|
|
8934
9107
|
command_disabled: RESULTS.ValidationError,
|
|
8935
9108
|
new_type_not_allowed: RESULTS.ValidationError,
|
|
9109
|
+
new_dir_exists: RESULTS.ValidationError,
|
|
8936
9110
|
required_env_missing: RESULTS.ConfigError,
|
|
8937
9111
|
preflight_error: RESULTS.Failure,
|
|
8938
9112
|
preflight_rejected: RESULTS.ConfigError,
|
|
@@ -9575,6 +9749,6 @@ var codedAgentCommandPreflight = ({
|
|
|
9575
9749
|
};
|
|
9576
9750
|
};
|
|
9577
9751
|
|
|
9578
|
-
export { getFileSystem, CommandDimensions, ShipDimensions, catchError,
|
|
9752
|
+
export { getFileSystem, CommandDimensions, ShipDimensions, catchError, RESULTS, extractErrorMessageSync, Command, OutputFormatter, processContext, trackShipSucceeded, parseJWT, getLoginStatusAsync, getAuthContext, runUipathPythonCommand, createExecuteCommand, createSetupCommand, WHITELISTED_COMMANDS, COMMAND_RULES, codedAgentCommandPreflight };
|
|
9579
9753
|
|
|
9580
|
-
//# debugId=
|
|
9754
|
+
//# debugId=6D4BB844F264121164756E2164756E21
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
CommandDimensions,
|
|
4
4
|
ShipDimensions,
|
|
5
5
|
catchError,
|
|
6
|
-
extractErrorMessageSync,
|
|
7
6
|
RESULTS,
|
|
7
|
+
extractErrorMessageSync,
|
|
8
8
|
OutputFormatter,
|
|
9
9
|
processContext,
|
|
10
10
|
trackShipSucceeded,
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
WHITELISTED_COMMANDS,
|
|
17
17
|
COMMAND_RULES,
|
|
18
18
|
codedAgentCommandPreflight
|
|
19
|
-
} from "./tool-
|
|
19
|
+
} from "./tool-wby11rp2.js";
|
|
20
20
|
// package.json
|
|
21
21
|
var package_default = {
|
|
22
22
|
name: "@uipath/codedagent-tool",
|
|
23
23
|
author: "UiPath",
|
|
24
24
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
25
|
-
version: "1.
|
|
25
|
+
version: "1.207.0-preview.305",
|
|
26
26
|
description: "Build, run, deploy, and manage AI Agents.",
|
|
27
27
|
keywords: [
|
|
28
28
|
"cli-tool",
|
|
@@ -669,11 +669,10 @@ function buildUrl(baseUrl, path, query) {
|
|
|
669
669
|
const qs = search.toString();
|
|
670
670
|
return qs ? `${trimmed}${suffix}?${qs}` : `${trimmed}${suffix}`;
|
|
671
671
|
}
|
|
672
|
-
async function
|
|
672
|
+
async function httpError(response) {
|
|
673
673
|
const text = await response.text().catch(() => "");
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
return `${response.status} ${response.statusText}: ${text.slice(0, 1000)}`;
|
|
674
|
+
const reason = response.statusText || "Request failed";
|
|
675
|
+
return Object.assign(new Error(text ? `${reason}: ${text.slice(0, 1000)}` : reason), { status: response.status });
|
|
677
676
|
}
|
|
678
677
|
async function createAiHttpContext(service, options) {
|
|
679
678
|
const { auth, bearerToken } = await resolveAuth(options);
|
|
@@ -711,10 +710,11 @@ async function createAiHttpContext(service, options) {
|
|
|
711
710
|
const response = await fetch(url, {
|
|
712
711
|
method: req.method,
|
|
713
712
|
headers,
|
|
714
|
-
body: req.body !== undefined ? JSON.stringify(req.body) : undefined
|
|
713
|
+
body: req.body !== undefined ? JSON.stringify(req.body) : undefined,
|
|
714
|
+
signal: options?.signal
|
|
715
715
|
});
|
|
716
716
|
if (!response.ok) {
|
|
717
|
-
throw
|
|
717
|
+
throw await httpError(response);
|
|
718
718
|
}
|
|
719
719
|
if (response.status === 204) {
|
|
720
720
|
return;
|
|
@@ -736,10 +736,11 @@ async function createAiHttpContext(service, options) {
|
|
|
736
736
|
const response = await fetch(url, {
|
|
737
737
|
method: req.method,
|
|
738
738
|
headers,
|
|
739
|
-
body: req.body !== undefined ? JSON.stringify(req.body) : undefined
|
|
739
|
+
body: req.body !== undefined ? JSON.stringify(req.body) : undefined,
|
|
740
|
+
signal: options?.signal
|
|
740
741
|
});
|
|
741
742
|
if (!response.ok) {
|
|
742
|
-
throw
|
|
743
|
+
throw await httpError(response);
|
|
743
744
|
}
|
|
744
745
|
};
|
|
745
746
|
return {
|
|
@@ -1022,4 +1023,4 @@ var registerCommands2 = async (program) => {
|
|
|
1022
1023
|
|
|
1023
1024
|
export { metadata2, registerCommands2 };
|
|
1024
1025
|
|
|
1025
|
-
//# debugId=
|
|
1026
|
+
//# debugId=6D2A53CCD01EE82464756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/codedagent-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.207.0-preview.305",
|
|
6
6
|
"description": "Build, run, deploy, and manage AI Agents.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"cli-tool",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"registry": "https://registry.npmjs.org/"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "1600aa89255c37c1b8bc68d9882c3395c1d5bff4"
|
|
37
37
|
}
|