@uipath/context-grounding-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/dist/index.js +1 -1
- package/dist/{tool-gd3kgx54.js → tool-445y4fra.js} +370 -196
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2127,12 +2127,26 @@ class NodeFileSystem {
|
|
|
2127
2127
|
throw error;
|
|
2128
2128
|
}
|
|
2129
2129
|
}
|
|
2130
|
-
async writeFile(filePath, data) {
|
|
2130
|
+
async writeFile(filePath, data, options) {
|
|
2131
2131
|
const dir = path.dirname(filePath);
|
|
2132
2132
|
if (dir) {
|
|
2133
2133
|
await fs.mkdir(dir, { recursive: true });
|
|
2134
2134
|
}
|
|
2135
|
-
|
|
2135
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
2136
|
+
if (options?.exclusive) {
|
|
2137
|
+
await fs.writeFile(filePath, data, { flag: "wx" });
|
|
2138
|
+
} else {
|
|
2139
|
+
await fs.writeFile(filePath, data);
|
|
2140
|
+
}
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
2144
|
+
try {
|
|
2145
|
+
await handle.chmod(options.mode);
|
|
2146
|
+
await handle.writeFile(data);
|
|
2147
|
+
} finally {
|
|
2148
|
+
await handle.close();
|
|
2149
|
+
}
|
|
2136
2150
|
}
|
|
2137
2151
|
async appendFile(filePath, data) {
|
|
2138
2152
|
const dir = path.dirname(filePath);
|
|
@@ -2167,7 +2181,8 @@ class NodeFileSystem {
|
|
|
2167
2181
|
isDirectory: () => stats.isDirectory(),
|
|
2168
2182
|
size: stats.size,
|
|
2169
2183
|
mtimeMs: stats.mtimeMs,
|
|
2170
|
-
ctimeMs: stats.ctimeMs
|
|
2184
|
+
ctimeMs: stats.ctimeMs,
|
|
2185
|
+
mode: stats.mode
|
|
2171
2186
|
};
|
|
2172
2187
|
} catch (error) {
|
|
2173
2188
|
if (this.isEnoent(error))
|
|
@@ -2178,8 +2193,13 @@ class NodeFileSystem {
|
|
|
2178
2193
|
async exists(filePath) {
|
|
2179
2194
|
return existsSync(filePath);
|
|
2180
2195
|
}
|
|
2181
|
-
async mkdir(dirPath) {
|
|
2182
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
2196
|
+
async mkdir(dirPath, options) {
|
|
2197
|
+
await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
2198
|
+
}
|
|
2199
|
+
async chmod(targetPath, mode) {
|
|
2200
|
+
if (process.platform === "win32")
|
|
2201
|
+
return;
|
|
2202
|
+
await fs.chmod(targetPath, mode);
|
|
2183
2203
|
}
|
|
2184
2204
|
async acquireLock(lockPath) {
|
|
2185
2205
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -2329,7 +2349,7 @@ class NodeFileSystem {
|
|
|
2329
2349
|
async getTempDir() {
|
|
2330
2350
|
return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
|
|
2331
2351
|
}
|
|
2332
|
-
async copyDirectory(sourcePath, destPath) {
|
|
2352
|
+
async copyDirectory(sourcePath, destPath, options) {
|
|
2333
2353
|
const sourceStats = await this.stat(sourcePath);
|
|
2334
2354
|
if (!sourceStats) {
|
|
2335
2355
|
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
@@ -2346,7 +2366,9 @@ class NodeFileSystem {
|
|
|
2346
2366
|
if (!entryStats)
|
|
2347
2367
|
continue;
|
|
2348
2368
|
if (entryStats.isDirectory()) {
|
|
2349
|
-
|
|
2369
|
+
if (options?.skipDirectoryNames?.includes(entry))
|
|
2370
|
+
continue;
|
|
2371
|
+
await this.copyDirectory(srcEntry, destEntry, options);
|
|
2350
2372
|
} else if (entryStats.isFile()) {
|
|
2351
2373
|
const content = await this.readFile(srcEntry);
|
|
2352
2374
|
if (content !== null) {
|
|
@@ -2409,13 +2431,15 @@ var ProjectDimensions = {
|
|
|
2409
2431
|
SolutionKey: "SolutionKey",
|
|
2410
2432
|
SolutionProjectKey: "SolutionProjectKey",
|
|
2411
2433
|
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2412
|
-
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2434
|
+
PreviousSolutionKey: "PreviousSolutionKey",
|
|
2435
|
+
PreviousProjectKey: "PreviousProjectKey"
|
|
2413
2436
|
};
|
|
2414
2437
|
var GUID_KEY_DIMENSIONS = new Set([
|
|
2415
2438
|
ProjectDimensions.ProjectKey,
|
|
2416
2439
|
ProjectDimensions.SolutionKey,
|
|
2417
2440
|
ProjectDimensions.SolutionProjectKey,
|
|
2418
|
-
ProjectDimensions.PreviousSolutionKey
|
|
2441
|
+
ProjectDimensions.PreviousSolutionKey,
|
|
2442
|
+
ProjectDimensions.PreviousProjectKey
|
|
2419
2443
|
]);
|
|
2420
2444
|
var ShipDimensions = {
|
|
2421
2445
|
ShipKind: "ShipKind",
|
|
@@ -2569,9 +2593,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
|
|
|
2569
2593
|
}
|
|
2570
2594
|
}
|
|
2571
2595
|
|
|
2572
|
-
// ../common/src/
|
|
2573
|
-
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2574
|
-
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2596
|
+
// ../common/src/sha256.ts
|
|
2575
2597
|
var SHA256_K = new Uint32Array([
|
|
2576
2598
|
1116352408,
|
|
2577
2599
|
1899447441,
|
|
@@ -2651,7 +2673,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
|
|
|
2651
2673
|
function rotr(value, bits) {
|
|
2652
2674
|
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
2653
2675
|
}
|
|
2654
|
-
function
|
|
2676
|
+
function sha256Words(input) {
|
|
2655
2677
|
const bytes = new TextEncoder().encode(input);
|
|
2656
2678
|
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
2657
2679
|
const buffer = new Uint8Array(paddedLength);
|
|
@@ -2707,12 +2729,19 @@ function sha256Hex(input) {
|
|
|
2707
2729
|
state[6] = state[6] + g >>> 0;
|
|
2708
2730
|
state[7] = state[7] + h >>> 0;
|
|
2709
2731
|
}
|
|
2732
|
+
return state;
|
|
2733
|
+
}
|
|
2734
|
+
function sha256Hex(input) {
|
|
2710
2735
|
let hex = "";
|
|
2711
|
-
for (const word of
|
|
2736
|
+
for (const word of sha256Words(input)) {
|
|
2712
2737
|
hex += word.toString(16).padStart(8, "0");
|
|
2713
2738
|
}
|
|
2714
2739
|
return hex;
|
|
2715
2740
|
}
|
|
2741
|
+
|
|
2742
|
+
// ../common/src/telemetry/pseudonymize.ts
|
|
2743
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
2744
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
2716
2745
|
function resolveSha256Hex() {
|
|
2717
2746
|
try {
|
|
2718
2747
|
const nodeCrypto = __require("node:crypto");
|
|
@@ -3108,13 +3137,25 @@ function settlePromiseLike(thenable) {
|
|
|
3108
3137
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
3109
3138
|
}
|
|
3110
3139
|
|
|
3140
|
+
// ../common/src/result-types.ts
|
|
3141
|
+
var RESULTS = {
|
|
3142
|
+
Success: "Success",
|
|
3143
|
+
Failure: "Failure",
|
|
3144
|
+
ConfigError: "ConfigError",
|
|
3145
|
+
AuthenticationError: "AuthenticationError",
|
|
3146
|
+
ValidationError: "ValidationError",
|
|
3147
|
+
TimeoutError: "TimeoutError"
|
|
3148
|
+
};
|
|
3149
|
+
|
|
3111
3150
|
// ../common/src/error-codes.ts
|
|
3112
3151
|
var CLI_ERROR_CODES = [
|
|
3113
3152
|
"invalid_argument",
|
|
3153
|
+
"confirmation_required",
|
|
3114
3154
|
"authentication_required",
|
|
3115
3155
|
"permission_denied",
|
|
3116
3156
|
"local_permission_denied",
|
|
3117
3157
|
"not_found",
|
|
3158
|
+
"not_enabled",
|
|
3118
3159
|
"rate_limited",
|
|
3119
3160
|
"network_error",
|
|
3120
3161
|
"timeout",
|
|
@@ -3153,6 +3194,12 @@ function carriedRetry(error) {
|
|
|
3153
3194
|
const retry = error.retry;
|
|
3154
3195
|
return isRetryHint(retry) ? retry : undefined;
|
|
3155
3196
|
}
|
|
3197
|
+
function carriedResult(error) {
|
|
3198
|
+
if (!error || typeof error !== "object")
|
|
3199
|
+
return;
|
|
3200
|
+
const result = error.result;
|
|
3201
|
+
return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
|
|
3202
|
+
}
|
|
3156
3203
|
function defaultRetryForErrorCode(errorCode) {
|
|
3157
3204
|
switch (errorCode) {
|
|
3158
3205
|
case "network_error":
|
|
@@ -3542,6 +3589,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3542
3589
|
}
|
|
3543
3590
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
3544
3591
|
context.errorCode = parsedBody.errorCode;
|
|
3592
|
+
} else if (typeof parsedBody?.errorCode === "number") {
|
|
3593
|
+
context.errorCode = String(parsedBody.errorCode);
|
|
3545
3594
|
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
3546
3595
|
context.errorCode = parsedBody.code;
|
|
3547
3596
|
}
|
|
@@ -3598,15 +3647,6 @@ async function extractErrorDetails(error, options) {
|
|
|
3598
3647
|
...parsedErrors ? { parsedErrors } : {}
|
|
3599
3648
|
};
|
|
3600
3649
|
}
|
|
3601
|
-
// ../common/src/result-types.ts
|
|
3602
|
-
var RESULTS = {
|
|
3603
|
-
Success: "Success",
|
|
3604
|
-
Failure: "Failure",
|
|
3605
|
-
ConfigError: "ConfigError",
|
|
3606
|
-
AuthenticationError: "AuthenticationError",
|
|
3607
|
-
ValidationError: "ValidationError",
|
|
3608
|
-
TimeoutError: "TimeoutError"
|
|
3609
|
-
};
|
|
3610
3650
|
// ../../node_modules/commander/index.js
|
|
3611
3651
|
var exports_commander = {};
|
|
3612
3652
|
__exportCjs(exports_commander, {
|
|
@@ -4042,7 +4082,10 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
4042
4082
|
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
4043
4083
|
"local_permission_denied"
|
|
4044
4084
|
]);
|
|
4045
|
-
var VALIDATION_ERROR_CODES = new Set([
|
|
4085
|
+
var VALIDATION_ERROR_CODES = new Set([
|
|
4086
|
+
"invalid_argument",
|
|
4087
|
+
"confirmation_required"
|
|
4088
|
+
]);
|
|
4046
4089
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
4047
4090
|
"network_error",
|
|
4048
4091
|
"rate_limited",
|
|
@@ -4268,6 +4311,109 @@ var CommonTelemetryEvents = {
|
|
|
4268
4311
|
ShipSucceeded: "Cli.ShipSucceeded"
|
|
4269
4312
|
};
|
|
4270
4313
|
|
|
4314
|
+
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
4315
|
+
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
4316
|
+
function getGlobalTelemetryProperties() {
|
|
4317
|
+
return telemetryPropsSlot.get();
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4320
|
+
// ../common/src/telemetry/trace-context.ts
|
|
4321
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
4322
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
4323
|
+
function getProcessEnv() {
|
|
4324
|
+
return globalThis.process?.env;
|
|
4325
|
+
}
|
|
4326
|
+
function parseInboundTraceparent(value) {
|
|
4327
|
+
if (!value) {
|
|
4328
|
+
return;
|
|
4329
|
+
}
|
|
4330
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
4331
|
+
if (!match) {
|
|
4332
|
+
return;
|
|
4333
|
+
}
|
|
4334
|
+
const [, traceId, parentSpanId] = match;
|
|
4335
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
4336
|
+
return;
|
|
4337
|
+
}
|
|
4338
|
+
return { traceId, parentSpanId };
|
|
4339
|
+
}
|
|
4340
|
+
function getInboundTraceContext() {
|
|
4341
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
// ../common/src/telemetry/session-id.ts
|
|
4345
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4346
|
+
var SESSION_ID_MAX_LENGTH = 64;
|
|
4347
|
+
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4348
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4349
|
+
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4350
|
+
var INHERITED_SESSION_SOURCES = [
|
|
4351
|
+
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
4352
|
+
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
4353
|
+
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
4354
|
+
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
4355
|
+
{ envVar: "WT_SESSION", source: "terminal" }
|
|
4356
|
+
];
|
|
4357
|
+
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
4358
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
4359
|
+
function getProcessEnv2() {
|
|
4360
|
+
return globalThis.process?.env;
|
|
4361
|
+
}
|
|
4362
|
+
function normalizeSessionId(value) {
|
|
4363
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
4367
|
+
return cleaned || undefined;
|
|
4368
|
+
}
|
|
4369
|
+
function getConfiguredTelemetrySessionId() {
|
|
4370
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
4371
|
+
}
|
|
4372
|
+
function getInheritedSession(env) {
|
|
4373
|
+
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
4374
|
+
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
4375
|
+
if (handle) {
|
|
4376
|
+
return { id: handle, source: candidate.source };
|
|
4377
|
+
}
|
|
4378
|
+
}
|
|
4379
|
+
return;
|
|
4380
|
+
}
|
|
4381
|
+
function generateRandomSession() {
|
|
4382
|
+
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
4383
|
+
crypto.getRandomValues(bytes);
|
|
4384
|
+
let hex = "";
|
|
4385
|
+
for (const byte of bytes) {
|
|
4386
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
4387
|
+
}
|
|
4388
|
+
return { id: hex, source: "random" };
|
|
4389
|
+
}
|
|
4390
|
+
function resolveTelemetrySession() {
|
|
4391
|
+
const existing = telemetrySessionSlot.get();
|
|
4392
|
+
if (existing) {
|
|
4393
|
+
return existing;
|
|
4394
|
+
}
|
|
4395
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
4396
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
4397
|
+
telemetrySessionSlot.set(resolved);
|
|
4398
|
+
return resolved;
|
|
4399
|
+
}
|
|
4400
|
+
function getTelemetrySessionId() {
|
|
4401
|
+
return resolveTelemetrySession().id;
|
|
4402
|
+
}
|
|
4403
|
+
function getTelemetrySessionSource() {
|
|
4404
|
+
return resolveTelemetrySession().source;
|
|
4405
|
+
}
|
|
4406
|
+
function getTelemetryOperationId() {
|
|
4407
|
+
const existing = telemetryOperationIdSlot.get();
|
|
4408
|
+
if (existing) {
|
|
4409
|
+
return existing;
|
|
4410
|
+
}
|
|
4411
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
4412
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
4413
|
+
telemetryOperationIdSlot.set(generated);
|
|
4414
|
+
return generated;
|
|
4415
|
+
}
|
|
4416
|
+
|
|
4271
4417
|
// ../common/src/registry.ts
|
|
4272
4418
|
import { execFileSync } from "node:child_process";
|
|
4273
4419
|
function readRegistryValue(keyPath, valueName) {
|
|
@@ -4489,108 +4635,6 @@ class NodeContextStorage {
|
|
|
4489
4635
|
return this.storage.getStore();
|
|
4490
4636
|
}
|
|
4491
4637
|
}
|
|
4492
|
-
// ../common/src/telemetry/trace-context.ts
|
|
4493
|
-
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
4494
|
-
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
4495
|
-
function getProcessEnv() {
|
|
4496
|
-
return globalThis.process?.env;
|
|
4497
|
-
}
|
|
4498
|
-
function parseInboundTraceparent(value) {
|
|
4499
|
-
if (!value) {
|
|
4500
|
-
return;
|
|
4501
|
-
}
|
|
4502
|
-
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
4503
|
-
if (!match) {
|
|
4504
|
-
return;
|
|
4505
|
-
}
|
|
4506
|
-
const [, traceId, parentSpanId] = match;
|
|
4507
|
-
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
4508
|
-
return;
|
|
4509
|
-
}
|
|
4510
|
-
return { traceId, parentSpanId };
|
|
4511
|
-
}
|
|
4512
|
-
function getInboundTraceContext() {
|
|
4513
|
-
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
4514
|
-
}
|
|
4515
|
-
|
|
4516
|
-
// ../common/src/telemetry/session-id.ts
|
|
4517
|
-
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
4518
|
-
var SESSION_ID_MAX_LENGTH = 64;
|
|
4519
|
-
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
4520
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
4521
|
-
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
4522
|
-
var INHERITED_SESSION_SOURCES = [
|
|
4523
|
-
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
4524
|
-
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
4525
|
-
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
4526
|
-
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
4527
|
-
{ envVar: "WT_SESSION", source: "terminal" }
|
|
4528
|
-
];
|
|
4529
|
-
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
4530
|
-
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
4531
|
-
function getProcessEnv2() {
|
|
4532
|
-
return globalThis.process?.env;
|
|
4533
|
-
}
|
|
4534
|
-
function normalizeSessionId(value) {
|
|
4535
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
4536
|
-
return;
|
|
4537
|
-
}
|
|
4538
|
-
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
4539
|
-
return cleaned || undefined;
|
|
4540
|
-
}
|
|
4541
|
-
function getConfiguredTelemetrySessionId() {
|
|
4542
|
-
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
4543
|
-
}
|
|
4544
|
-
function getInheritedSession(env) {
|
|
4545
|
-
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
4546
|
-
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
4547
|
-
if (handle) {
|
|
4548
|
-
return { id: handle, source: candidate.source };
|
|
4549
|
-
}
|
|
4550
|
-
}
|
|
4551
|
-
return;
|
|
4552
|
-
}
|
|
4553
|
-
function generateRandomSession() {
|
|
4554
|
-
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
4555
|
-
crypto.getRandomValues(bytes);
|
|
4556
|
-
let hex = "";
|
|
4557
|
-
for (const byte of bytes) {
|
|
4558
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
4559
|
-
}
|
|
4560
|
-
return { id: hex, source: "random" };
|
|
4561
|
-
}
|
|
4562
|
-
function resolveTelemetrySession() {
|
|
4563
|
-
const existing = telemetrySessionSlot.get();
|
|
4564
|
-
if (existing) {
|
|
4565
|
-
return existing;
|
|
4566
|
-
}
|
|
4567
|
-
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
4568
|
-
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
4569
|
-
telemetrySessionSlot.set(resolved);
|
|
4570
|
-
return resolved;
|
|
4571
|
-
}
|
|
4572
|
-
function getTelemetrySessionId() {
|
|
4573
|
-
return resolveTelemetrySession().id;
|
|
4574
|
-
}
|
|
4575
|
-
function getTelemetrySessionSource() {
|
|
4576
|
-
return resolveTelemetrySession().source;
|
|
4577
|
-
}
|
|
4578
|
-
function getTelemetryOperationId() {
|
|
4579
|
-
const existing = telemetryOperationIdSlot.get();
|
|
4580
|
-
if (existing) {
|
|
4581
|
-
return existing;
|
|
4582
|
-
}
|
|
4583
|
-
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
4584
|
-
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
4585
|
-
telemetryOperationIdSlot.set(generated);
|
|
4586
|
-
return generated;
|
|
4587
|
-
}
|
|
4588
|
-
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
4589
|
-
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
4590
|
-
function getGlobalTelemetryProperties() {
|
|
4591
|
-
return telemetryPropsSlot.get();
|
|
4592
|
-
}
|
|
4593
|
-
|
|
4594
4638
|
// ../common/src/telemetry/span-clock.ts
|
|
4595
4639
|
function startSpanClock() {
|
|
4596
4640
|
const started = performance.now();
|
|
@@ -4804,6 +4848,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
|
4804
4848
|
// ../common/src/telemetry/telemetry-init.ts
|
|
4805
4849
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
4806
4850
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
4851
|
+
var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
|
|
4807
4852
|
function getGlobalTelemetryInstance() {
|
|
4808
4853
|
const existing = telemetryInstanceSlot.get();
|
|
4809
4854
|
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
@@ -4987,7 +5032,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
4987
5032
|
const pagedRows = extractPagedRows(data.Data);
|
|
4988
5033
|
const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
|
|
4989
5034
|
items.forEach((item) => {
|
|
4990
|
-
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
5035
|
+
const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
|
|
4991
5036
|
logFn(values);
|
|
4992
5037
|
});
|
|
4993
5038
|
} else {
|
|
@@ -5002,7 +5047,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
5002
5047
|
default: {
|
|
5003
5048
|
const hasData = "Data" in data && data.Data != null;
|
|
5004
5049
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
5005
|
-
const
|
|
5050
|
+
const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
|
|
5051
|
+
const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
|
|
5006
5052
|
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
5007
5053
|
const logValue = data.Log;
|
|
5008
5054
|
if (rows !== null) {
|
|
@@ -5059,6 +5105,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
|
5059
5105
|
function isPlainObjectArray(value) {
|
|
5060
5106
|
return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
5061
5107
|
}
|
|
5108
|
+
function isPrimitiveArray(value) {
|
|
5109
|
+
return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
|
|
5110
|
+
}
|
|
5062
5111
|
function isNonEmptyPlainObject(value) {
|
|
5063
5112
|
return isPlainRecord(value) && Object.keys(value).length > 0;
|
|
5064
5113
|
}
|
|
@@ -5405,12 +5454,12 @@ class FilterEvaluationError extends Error {
|
|
|
5405
5454
|
instructions;
|
|
5406
5455
|
retry = "RetryWillNotFix";
|
|
5407
5456
|
result = RESULTS.ValidationError;
|
|
5408
|
-
constructor(filter, cause) {
|
|
5457
|
+
constructor(filter, cause, hint) {
|
|
5409
5458
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
5410
|
-
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
5459
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
|
|
5411
5460
|
this.name = "FilterEvaluationError";
|
|
5412
5461
|
this.filter = filter;
|
|
5413
|
-
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(@)'.";
|
|
5462
|
+
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(@)'.";
|
|
5414
5463
|
}
|
|
5415
5464
|
}
|
|
5416
5465
|
|
|
@@ -5532,6 +5581,93 @@ function nameList(names, cap = 12) {
|
|
|
5532
5581
|
const rest = names.length - shown.length;
|
|
5533
5582
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
5534
5583
|
}
|
|
5584
|
+
function notFieldsOn(names, scope) {
|
|
5585
|
+
return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
5586
|
+
}
|
|
5587
|
+
function failingFieldRead(ast, isList, fn, argIndex) {
|
|
5588
|
+
const [left, right, condition] = ast.children ?? [];
|
|
5589
|
+
let scopes = [];
|
|
5590
|
+
if (!isList) {
|
|
5591
|
+
scopes = [ast];
|
|
5592
|
+
} else if (ast.type === "FilterProjection" && left?.type === "Identity") {
|
|
5593
|
+
scopes = [condition, right];
|
|
5594
|
+
} else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
|
|
5595
|
+
scopes = [right];
|
|
5596
|
+
}
|
|
5597
|
+
const reads = new Set;
|
|
5598
|
+
let tracked = 0;
|
|
5599
|
+
const visit = (node) => {
|
|
5600
|
+
if (!node)
|
|
5601
|
+
return;
|
|
5602
|
+
switch (node.type) {
|
|
5603
|
+
case "Function": {
|
|
5604
|
+
const arg = node.children?.[argIndex - 1];
|
|
5605
|
+
if (node.name === fn && arg?.type === "Field" && arg.name) {
|
|
5606
|
+
reads.add(arg.name);
|
|
5607
|
+
tracked++;
|
|
5608
|
+
}
|
|
5609
|
+
node.children?.forEach(visit);
|
|
5610
|
+
return;
|
|
5611
|
+
}
|
|
5612
|
+
case "AndExpression":
|
|
5613
|
+
case "OrExpression":
|
|
5614
|
+
case "NotExpression":
|
|
5615
|
+
case "Comparator":
|
|
5616
|
+
case "MultiSelectList":
|
|
5617
|
+
case "MultiSelectHash":
|
|
5618
|
+
node.children?.forEach(visit);
|
|
5619
|
+
return;
|
|
5620
|
+
case "KeyValuePair":
|
|
5621
|
+
visit(node.value);
|
|
5622
|
+
return;
|
|
5623
|
+
}
|
|
5624
|
+
};
|
|
5625
|
+
scopes.forEach(visit);
|
|
5626
|
+
const calls = (node) => {
|
|
5627
|
+
if (node === null || typeof node !== "object")
|
|
5628
|
+
return 0;
|
|
5629
|
+
const own = node.type === "Function" && node.name === fn ? 1 : 0;
|
|
5630
|
+
const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
|
|
5631
|
+
return own + next.reduce((sum, child) => sum + calls(child), 0);
|
|
5632
|
+
};
|
|
5633
|
+
return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
|
|
5634
|
+
}
|
|
5635
|
+
function fieldExpression(name) {
|
|
5636
|
+
return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
|
|
5637
|
+
}
|
|
5638
|
+
function evaluationHint(codec, filter, data, cause) {
|
|
5639
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
5640
|
+
const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
|
|
5641
|
+
if (!failure)
|
|
5642
|
+
return;
|
|
5643
|
+
const [, fn, position, expected] = failure;
|
|
5644
|
+
const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
|
|
5645
|
+
if (name === undefined)
|
|
5646
|
+
return;
|
|
5647
|
+
const present = availableFields(data);
|
|
5648
|
+
if (present.length === 0)
|
|
5649
|
+
return;
|
|
5650
|
+
const scope = `${countRecords(data)} record(s)`;
|
|
5651
|
+
if (!present.includes(name)) {
|
|
5652
|
+
return {
|
|
5653
|
+
detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
|
|
5654
|
+
instructions: "Use a field the records have; names are case-sensitive."
|
|
5655
|
+
};
|
|
5656
|
+
}
|
|
5657
|
+
const records = Array.isArray(data) ? data : [data];
|
|
5658
|
+
const unset = records.filter((r) => r?.[name] == null).length;
|
|
5659
|
+
const field = fieldExpression(name);
|
|
5660
|
+
let fallback;
|
|
5661
|
+
if (expected.split(",").includes("string")) {
|
|
5662
|
+
fallback = "''";
|
|
5663
|
+
} else if (expected.split(",").includes("array")) {
|
|
5664
|
+
fallback = "`[]`";
|
|
5665
|
+
}
|
|
5666
|
+
return {
|
|
5667
|
+
detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
|
|
5668
|
+
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.`
|
|
5669
|
+
};
|
|
5670
|
+
}
|
|
5535
5671
|
function buildFilterWarning(filter, data, outcome) {
|
|
5536
5672
|
const present = availableFields(data);
|
|
5537
5673
|
const refs = referencedFields(filter);
|
|
@@ -5539,7 +5675,7 @@ function buildFilterWarning(filter, data, outcome) {
|
|
|
5539
5675
|
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
5540
5676
|
const count = countRecords(data);
|
|
5541
5677
|
const scope = `${count} record(s)`;
|
|
5542
|
-
const isNotAField = (names) =>
|
|
5678
|
+
const isNotAField = (names) => notFieldsOn(names, scope);
|
|
5543
5679
|
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" : "";
|
|
5544
5680
|
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
5545
5681
|
let detail;
|
|
@@ -5590,7 +5726,8 @@ function applyFilter(data, filter, onWarning) {
|
|
|
5590
5726
|
try {
|
|
5591
5727
|
result = codec.search(data, filter);
|
|
5592
5728
|
} catch (err) {
|
|
5593
|
-
|
|
5729
|
+
const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
|
|
5730
|
+
throw new FilterEvaluationError(filter, err, hint);
|
|
5594
5731
|
}
|
|
5595
5732
|
const inputCount = countRecords(data);
|
|
5596
5733
|
const warn = (outcome) => {
|
|
@@ -6481,7 +6618,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
6481
6618
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
6482
6619
|
const typed = error;
|
|
6483
6620
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
6484
|
-
const customResult =
|
|
6621
|
+
const customResult = carriedResult(error);
|
|
6485
6622
|
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
6486
6623
|
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
6487
6624
|
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
@@ -6844,6 +6981,8 @@ var FAILURE_STATUSES = new Set([
|
|
|
6844
6981
|
"canceled",
|
|
6845
6982
|
"stopped"
|
|
6846
6983
|
]);
|
|
6984
|
+
// ../common/src/relayed-output.ts
|
|
6985
|
+
var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
|
|
6847
6986
|
// ../common/src/screen-logger.ts
|
|
6848
6987
|
var ScreenLogger;
|
|
6849
6988
|
((ScreenLogger) => {
|
|
@@ -6878,63 +7017,15 @@ async function readCache(cacheFile) {
|
|
|
6878
7017
|
}
|
|
6879
7018
|
return cache;
|
|
6880
7019
|
}
|
|
6881
|
-
// ../uipath-python-bridge/
|
|
6882
|
-
var
|
|
6883
|
-
name: "@uipath/uipath-python-bridge",
|
|
6884
|
-
author: "UiPath",
|
|
6885
|
-
license: "SEE LICENSE IN LICENSE.txt",
|
|
6886
|
-
version: "1.206.0-preview.303",
|
|
6887
|
-
description: "Shared Python detection, caching, and CLI bridge for UiPath Python SDK tools.",
|
|
6888
|
-
keywords: [
|
|
6889
|
-
"uip",
|
|
6890
|
-
"python",
|
|
6891
|
-
"bridge"
|
|
6892
|
-
],
|
|
6893
|
-
uipath: {
|
|
6894
|
-
requires: {
|
|
6895
|
-
uipath: ">=2.14.41"
|
|
6896
|
-
}
|
|
6897
|
-
},
|
|
6898
|
-
type: "module",
|
|
6899
|
-
main: "./dist/index.js",
|
|
6900
|
-
exports: {
|
|
6901
|
-
".": "./dist/index.js"
|
|
6902
|
-
},
|
|
6903
|
-
files: [
|
|
6904
|
-
"dist"
|
|
6905
|
-
],
|
|
6906
|
-
repository: {
|
|
6907
|
-
type: "git",
|
|
6908
|
-
url: "https://github.com/UiPath/cli.git",
|
|
6909
|
-
directory: "packages/uipath-python-bridge"
|
|
6910
|
-
},
|
|
6911
|
-
publishConfig: {
|
|
6912
|
-
registry: "https://npm.pkg.github.com/@uipath"
|
|
6913
|
-
},
|
|
6914
|
-
scripts: {
|
|
6915
|
-
build: "bun build ./src/index.ts --outdir dist --format esm --target node --external applicationinsights --sourcemap=linked",
|
|
6916
|
-
typecheck: "tsc --noEmit",
|
|
6917
|
-
test: "vitest run",
|
|
6918
|
-
"test:coverage": "vitest run --coverage",
|
|
6919
|
-
lint: "biome check .",
|
|
6920
|
-
"lint:fix": "biome check --write ."
|
|
6921
|
-
},
|
|
6922
|
-
devDependencies: {
|
|
6923
|
-
"@uipath/auth": "workspace:*",
|
|
6924
|
-
"@uipath/common": "workspace:*",
|
|
6925
|
-
"@uipath/filesystem": "workspace:*",
|
|
6926
|
-
"@types/bun": "^1.3.11",
|
|
6927
|
-
commander: "^14.0.3",
|
|
6928
|
-
typescript: "^7.0.2"
|
|
6929
|
-
}
|
|
6930
|
-
};
|
|
7020
|
+
// ../uipath-python-bridge/src/minimum-uipath-version.ts
|
|
7021
|
+
var MINIMUM_UIPATH_VERSION = "2.14.49";
|
|
6931
7022
|
|
|
6932
7023
|
// ../uipath-python-bridge/src/config.ts
|
|
6933
7024
|
var DEFAULT_CONFIG = {
|
|
6934
7025
|
allowedPythonVersions: ["3.14", "3.13", "3.12", "3.11", "3.15"],
|
|
6935
7026
|
packageName: "uipath",
|
|
6936
7027
|
cacheFileName: ".uipath-python-cache.json",
|
|
6937
|
-
uipathVersionRequirement:
|
|
7028
|
+
uipathVersionRequirement: `>=${MINIMUM_UIPATH_VERSION}`
|
|
6938
7029
|
};
|
|
6939
7030
|
function getAllowedPythonVersions() {
|
|
6940
7031
|
const envVersions = process.env.PYTHON_TOOL_PYTHON_VERSIONS;
|
|
@@ -7040,6 +7131,8 @@ function settlePromiseLike2(thenable) {
|
|
|
7040
7131
|
// ../auth/src/constants.ts
|
|
7041
7132
|
var UIPATH_HOME_DIR2 = ".uipath";
|
|
7042
7133
|
var AUTH_FILENAME = ".auth";
|
|
7134
|
+
var AUTH_FILE_MODE = 384;
|
|
7135
|
+
var AUTH_DIR_MODE = 448;
|
|
7043
7136
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
7044
7137
|
var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
7045
7138
|
|
|
@@ -7863,6 +7956,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
7863
7956
|
}
|
|
7864
7957
|
return parseEnvContent(content);
|
|
7865
7958
|
};
|
|
7959
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
7960
|
+
let current = dir;
|
|
7961
|
+
for (;; ) {
|
|
7962
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR2)
|
|
7963
|
+
return current;
|
|
7964
|
+
const parent = fs.path.dirname(current);
|
|
7965
|
+
if (parent === current)
|
|
7966
|
+
return;
|
|
7967
|
+
current = parent;
|
|
7968
|
+
}
|
|
7969
|
+
};
|
|
7970
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
7971
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
7972
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
7973
|
+
for (let attempt = 1;; attempt++) {
|
|
7974
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
7975
|
+
try {
|
|
7976
|
+
await fs.writeFile(tempPath, content, {
|
|
7977
|
+
mode: AUTH_FILE_MODE,
|
|
7978
|
+
exclusive: true
|
|
7979
|
+
});
|
|
7980
|
+
return tempPath;
|
|
7981
|
+
} catch (error) {
|
|
7982
|
+
if (!isFileExists(error)) {
|
|
7983
|
+
await fs.rm(tempPath).catch(() => {});
|
|
7984
|
+
throw error;
|
|
7985
|
+
}
|
|
7986
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
7987
|
+
throw error;
|
|
7988
|
+
}
|
|
7989
|
+
}
|
|
7990
|
+
};
|
|
7866
7991
|
var saveEnvFileAsync = async ({
|
|
7867
7992
|
envPath,
|
|
7868
7993
|
data,
|
|
@@ -7890,10 +8015,18 @@ var saveEnvFileAsync = async ({
|
|
|
7890
8015
|
`)}
|
|
7891
8016
|
`;
|
|
7892
8017
|
const dir = fs.path.dirname(absolutePath);
|
|
7893
|
-
await fs.mkdir(dir);
|
|
7894
|
-
const
|
|
7895
|
-
|
|
7896
|
-
|
|
8018
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
8019
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
8020
|
+
if (authHomeDir !== undefined) {
|
|
8021
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
8022
|
+
}
|
|
8023
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
8024
|
+
try {
|
|
8025
|
+
await fs.rename(tempPath, absolutePath);
|
|
8026
|
+
} catch (error) {
|
|
8027
|
+
await fs.rm(tempPath).catch(() => {});
|
|
8028
|
+
throw error;
|
|
8029
|
+
}
|
|
7897
8030
|
};
|
|
7898
8031
|
|
|
7899
8032
|
// ../auth/src/loginStatus.ts
|
|
@@ -8477,10 +8610,31 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
8477
8610
|
import { execFile } from "node:child_process";
|
|
8478
8611
|
var PROBE_TIMEOUT_MS = 15000;
|
|
8479
8612
|
var TYPE_OPTION = /^--type(=|$)/;
|
|
8613
|
+
var DIR_OPTION = /^--dir(=|$)/;
|
|
8480
8614
|
var TYPE_LISTED = /^[ \t]*--type(?![\w-])/m;
|
|
8615
|
+
var NEW_OPTIONS_WITH_VALUE = new Set([
|
|
8616
|
+
"--type",
|
|
8617
|
+
"--agent-framework",
|
|
8618
|
+
"--dir"
|
|
8619
|
+
]);
|
|
8481
8620
|
function hasTypeOption(args) {
|
|
8482
8621
|
return args.some((arg) => TYPE_OPTION.test(arg));
|
|
8483
8622
|
}
|
|
8623
|
+
function hasDirOption(args) {
|
|
8624
|
+
return args.some((arg) => DIR_OPTION.test(arg));
|
|
8625
|
+
}
|
|
8626
|
+
function scaffoldNameOf(args) {
|
|
8627
|
+
for (let i = 1;i < args.length; i++) {
|
|
8628
|
+
const arg = args[i] ?? "";
|
|
8629
|
+
if (!arg.startsWith("-")) {
|
|
8630
|
+
return arg === "" ? undefined : arg;
|
|
8631
|
+
}
|
|
8632
|
+
if (NEW_OPTIONS_WITH_VALUE.has(arg)) {
|
|
8633
|
+
i++;
|
|
8634
|
+
}
|
|
8635
|
+
}
|
|
8636
|
+
return;
|
|
8637
|
+
}
|
|
8484
8638
|
async function supportsNewTypeOption(exePath, cwd, env = {}, signal) {
|
|
8485
8639
|
return new Promise((resolve) => {
|
|
8486
8640
|
execFile(exePath, ["new", "--help"], {
|
|
@@ -8639,6 +8793,10 @@ function applyOutputFormatOption(args, option, supportedFormats) {
|
|
|
8639
8793
|
}
|
|
8640
8794
|
return [...args, option, format];
|
|
8641
8795
|
}
|
|
8796
|
+
async function isSolutionRoot(fs, dir) {
|
|
8797
|
+
const [readError, entries] = await catchError(fs.readdir(dir));
|
|
8798
|
+
return !readError && Array.isArray(entries) && entries.some((entry) => entry.endsWith(".uipx"));
|
|
8799
|
+
}
|
|
8642
8800
|
function matchesRequiredCommand(args, commands) {
|
|
8643
8801
|
return args[0] !== undefined && commands.includes(args[0]);
|
|
8644
8802
|
}
|
|
@@ -8706,6 +8864,17 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
8706
8864
|
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args) && hasTypeOption(processed.args)) {
|
|
8707
8865
|
return fail("new_type_not_allowed", "--type is not a valid option.", "Remove --type and re-run.");
|
|
8708
8866
|
}
|
|
8867
|
+
const cwd = options.cwd ?? fs.env.cwd();
|
|
8868
|
+
let scaffoldDir;
|
|
8869
|
+
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args) && !hasDirOption(processed.args)) {
|
|
8870
|
+
const name = scaffoldNameOf(processed.args);
|
|
8871
|
+
if (name !== undefined && await isSolutionRoot(fs, cwd)) {
|
|
8872
|
+
if (await fs.exists(fs.path.resolve(cwd, name))) {
|
|
8873
|
+
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.");
|
|
8874
|
+
}
|
|
8875
|
+
scaffoldDir = name;
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8709
8878
|
const processedArgs = applyOutputFormatOption(processed.args, options.outputFormatOption, options.outputFormats);
|
|
8710
8879
|
const commandArgs = options.commandPrefix ? [options.commandPrefix, ...processedArgs] : [...processedArgs];
|
|
8711
8880
|
const requiredEnv = {};
|
|
@@ -8739,7 +8908,6 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
8739
8908
|
}
|
|
8740
8909
|
}
|
|
8741
8910
|
const stdio = options.stdio ?? "inherit";
|
|
8742
|
-
const cwd = options.cwd ?? fs.env.cwd();
|
|
8743
8911
|
const versionCheck = await checkUipathVersion(cache.uipathExePath, {
|
|
8744
8912
|
cwd,
|
|
8745
8913
|
signal: options.signal
|
|
@@ -8748,8 +8916,13 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
8748
8916
|
return fail(versionCheck.kind === "unsupported" ? "uipath_version_unsupported" : "uipath_version_unverifiable", versionCheck.message, uipathVersionInstructions(versionCheck, toolLabel));
|
|
8749
8917
|
}
|
|
8750
8918
|
logger.debug(`Using uipath ${versionCheck.version} at ${cache.uipathExePath} (source: ${cache.source ?? "unknown"}; requires uipath${versionCheck.requirement})`);
|
|
8751
|
-
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args)
|
|
8752
|
-
|
|
8919
|
+
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args)) {
|
|
8920
|
+
if (await supportsNewTypeOption(cache.uipathExePath, cwd, { ...authEnv, ...requiredEnv }, options.signal)) {
|
|
8921
|
+
commandArgs.push("--type", options.pinNewType);
|
|
8922
|
+
}
|
|
8923
|
+
if (scaffoldDir !== undefined) {
|
|
8924
|
+
commandArgs.push("--dir", scaffoldDir);
|
|
8925
|
+
}
|
|
8753
8926
|
}
|
|
8754
8927
|
const proc = spawn(cache.uipathExePath, commandArgs, {
|
|
8755
8928
|
cwd,
|
|
@@ -8809,6 +8982,7 @@ var CLI_RESULT_BY_REASON = {
|
|
|
8809
8982
|
uipath_version_unverifiable: RESULTS.ConfigError,
|
|
8810
8983
|
command_disabled: RESULTS.ValidationError,
|
|
8811
8984
|
new_type_not_allowed: RESULTS.ValidationError,
|
|
8985
|
+
new_dir_exists: RESULTS.ValidationError,
|
|
8812
8986
|
required_env_missing: RESULTS.ConfigError,
|
|
8813
8987
|
preflight_error: RESULTS.Failure,
|
|
8814
8988
|
preflight_rejected: RESULTS.ConfigError,
|
|
@@ -9402,11 +9576,11 @@ function createCommandForwarder(executeCommand) {
|
|
|
9402
9576
|
};
|
|
9403
9577
|
}
|
|
9404
9578
|
// package.json
|
|
9405
|
-
var
|
|
9579
|
+
var package_default = {
|
|
9406
9580
|
name: "@uipath/context-grounding-tool",
|
|
9407
9581
|
author: "UiPath",
|
|
9408
9582
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
9409
|
-
version: "1.
|
|
9583
|
+
version: "1.207.0-preview.305",
|
|
9410
9584
|
description: "Tool for context grounding operations via the UiPath Python SDK",
|
|
9411
9585
|
keywords: [
|
|
9412
9586
|
"uipcli-tool",
|
|
@@ -9463,7 +9637,7 @@ var COMMAND_RULES = [
|
|
|
9463
9637
|
var COMMAND_PREFIX = "context-grounding";
|
|
9464
9638
|
var metadata2 = {
|
|
9465
9639
|
name: "context-grounding-tool",
|
|
9466
|
-
version:
|
|
9640
|
+
version: package_default.version,
|
|
9467
9641
|
description: "A tool for context grounding operations via the UiPath Python SDK.",
|
|
9468
9642
|
commandPrefix: COMMAND_PREFIX
|
|
9469
9643
|
};
|
|
@@ -9493,4 +9667,4 @@ var registerCommands2 = async (program) => {
|
|
|
9493
9667
|
|
|
9494
9668
|
export { Command, metadata2, registerCommands2 };
|
|
9495
9669
|
|
|
9496
|
-
//# debugId=
|
|
9670
|
+
//# debugId=1B01BA7CC519E96364756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/context-grounding-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": "Tool for context grounding operations via the UiPath Python SDK",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"uipcli-tool",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"registry": "https://registry.npmjs.org/"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "1600aa89255c37c1b8bc68d9882c3395c1d5bff4"
|
|
33
33
|
}
|