@uipath/context-grounding-tool 1.204.0-preview.254 → 1.205.0-preview.256
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-g5j6gvbf.js → tool-8ehfmyt6.js} +141 -29
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2277,6 +2277,16 @@ class NodeFileSystem {
|
|
|
2277
2277
|
async rename(oldPath, newPath) {
|
|
2278
2278
|
await fs.rename(oldPath, newPath);
|
|
2279
2279
|
}
|
|
2280
|
+
async isSymbolicLink(filePath) {
|
|
2281
|
+
try {
|
|
2282
|
+
return (await fs.lstat(filePath)).isSymbolicLink();
|
|
2283
|
+
} catch (error) {
|
|
2284
|
+
if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
|
|
2285
|
+
return false;
|
|
2286
|
+
}
|
|
2287
|
+
throw error;
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2280
2290
|
async realpath(filePath) {
|
|
2281
2291
|
try {
|
|
2282
2292
|
return await fs.realpath(filePath);
|
|
@@ -2984,7 +2994,7 @@ function setGlobalLogFilePath(path2) {
|
|
|
2984
2994
|
function getGlobalLogFilePath() {
|
|
2985
2995
|
return logFilePathSlot.get("");
|
|
2986
2996
|
}
|
|
2987
|
-
var DEFAULT_LOG_LEVEL =
|
|
2997
|
+
var DEFAULT_LOG_LEVEL = 2 /* WARN */;
|
|
2988
2998
|
|
|
2989
2999
|
class SimpleLogger {
|
|
2990
3000
|
__brand = "SimpleLogger";
|
|
@@ -3254,7 +3264,9 @@ var ErrorDimensions = {
|
|
|
3254
3264
|
Result: "Result",
|
|
3255
3265
|
ErrorCode: "ErrorCode",
|
|
3256
3266
|
Retry: "Retry",
|
|
3257
|
-
ErrorMessage: "ErrorMessage"
|
|
3267
|
+
ErrorMessage: "ErrorMessage",
|
|
3268
|
+
HttpStatus: "HttpStatus",
|
|
3269
|
+
UpstreamErrorCode: "UpstreamErrorCode"
|
|
3258
3270
|
};
|
|
3259
3271
|
var AuthDimensions = {
|
|
3260
3272
|
AuthenticationMethod: "AuthenticationMethod",
|
|
@@ -4242,7 +4254,9 @@ var CLI_ERROR_CODES = [
|
|
|
4242
4254
|
"timeout",
|
|
4243
4255
|
"server_error",
|
|
4244
4256
|
"method_not_allowed",
|
|
4257
|
+
"not_supported",
|
|
4245
4258
|
"configuration_error",
|
|
4259
|
+
"execution_failed",
|
|
4246
4260
|
"unknown_error"
|
|
4247
4261
|
];
|
|
4248
4262
|
var RETRY_HINTS = [
|
|
@@ -5199,7 +5213,9 @@ var OutputFormatter;
|
|
|
5199
5213
|
[ErrorDimensions.Result]: data.Result,
|
|
5200
5214
|
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
5201
5215
|
[ErrorDimensions.Retry]: data.Retry,
|
|
5202
|
-
[ErrorDimensions.ErrorMessage]: data.Message
|
|
5216
|
+
[ErrorDimensions.ErrorMessage]: data.Message,
|
|
5217
|
+
[ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
|
|
5218
|
+
[ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
|
|
5203
5219
|
});
|
|
5204
5220
|
}
|
|
5205
5221
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -6247,22 +6263,12 @@ var resolveConfigAsync = async ({
|
|
|
6247
6263
|
baseUrl = DEFAULT_BASE_URL;
|
|
6248
6264
|
}
|
|
6249
6265
|
baseUrl = normalizeAndValidateBaseUrl(baseUrl);
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
clientId = fileAuth.clientId;
|
|
6253
|
-
}
|
|
6254
|
-
if (!clientId) {
|
|
6255
|
-
clientId = DEFAULT_CLIENT_ID;
|
|
6256
|
-
}
|
|
6257
|
-
let clientSecret = customClientSecret;
|
|
6258
|
-
if (!clientSecret && fileAuth.clientSecret) {
|
|
6259
|
-
clientSecret = fileAuth.clientSecret;
|
|
6260
|
-
}
|
|
6261
|
-
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
|
|
6266
|
+
const clientId = customClientId || DEFAULT_CLIENT_ID;
|
|
6267
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(customClientSecret) || Boolean(customClientAssertion));
|
|
6262
6268
|
const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
|
|
6263
6269
|
return {
|
|
6264
6270
|
clientId,
|
|
6265
|
-
clientSecret,
|
|
6271
|
+
clientSecret: customClientSecret,
|
|
6266
6272
|
scopes,
|
|
6267
6273
|
baseUrl,
|
|
6268
6274
|
authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
|
|
@@ -6436,6 +6442,16 @@ var resolveIdentityType = (claims, authFlow, email) => {
|
|
|
6436
6442
|
}
|
|
6437
6443
|
return;
|
|
6438
6444
|
};
|
|
6445
|
+
var resolveApplicationSubtype = (claims, authFlow) => {
|
|
6446
|
+
switch (asString(claims?.sub_type)) {
|
|
6447
|
+
case "service.external":
|
|
6448
|
+
return "External";
|
|
6449
|
+
case "service.internal":
|
|
6450
|
+
return "Internal";
|
|
6451
|
+
default:
|
|
6452
|
+
return authFlow === "client_credentials" || authFlow === "federated_credentials" ? "External" : undefined;
|
|
6453
|
+
}
|
|
6454
|
+
};
|
|
6439
6455
|
var looksLikeEmail = (value) => value?.includes("@") ?? false;
|
|
6440
6456
|
var pickEmail = (claims) => {
|
|
6441
6457
|
for (const candidate of [claims?.email, claims?.preferred_username]) {
|
|
@@ -6477,6 +6493,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
6477
6493
|
const clientId = asString(claims?.client_id);
|
|
6478
6494
|
if (clientId)
|
|
6479
6495
|
identity.clientId = clientId;
|
|
6496
|
+
const subType = asString(claims?.sub_type);
|
|
6497
|
+
if (subType)
|
|
6498
|
+
identity.subType = subType;
|
|
6499
|
+
const applicationSubtype = resolveApplicationSubtype(claims, authFlow);
|
|
6500
|
+
if (applicationSubtype)
|
|
6501
|
+
identity.applicationSubtype = applicationSubtype;
|
|
6480
6502
|
return identity;
|
|
6481
6503
|
};
|
|
6482
6504
|
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
@@ -6769,6 +6791,40 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
6769
6791
|
}
|
|
6770
6792
|
};
|
|
6771
6793
|
|
|
6794
|
+
// ../auth/src/tenantSelection.ts
|
|
6795
|
+
var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
|
|
6796
|
+
var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
|
|
6797
|
+
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
6798
|
+
var describeNonJsonResponse = (organizationId, response, parseError) => {
|
|
6799
|
+
if (response.redirected) {
|
|
6800
|
+
return `Could not find organization '${organizationId}': the request was ` + `redirected to a sign-in page instead of the organization's tenant ` + `list. ${LOGIN_STATUS_HINT}`;
|
|
6801
|
+
}
|
|
6802
|
+
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
6803
|
+
return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
|
|
6804
|
+
};
|
|
6805
|
+
var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId, signal) => {
|
|
6806
|
+
const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
|
|
6807
|
+
const response = await fetch(url, {
|
|
6808
|
+
headers: {
|
|
6809
|
+
Authorization: `Bearer ${accessToken}`
|
|
6810
|
+
},
|
|
6811
|
+
...signal ? { signal } : {}
|
|
6812
|
+
});
|
|
6813
|
+
if (!response.ok) {
|
|
6814
|
+
if (response.status === 401) {
|
|
6815
|
+
throw new Error(`Unauthorized: the access token was rejected, it was not ` + `issued for organization '${organizationId}', or ` + `'${organizationId}' was not accepted as an organization ` + `URL segment in this environment. ` + LOGIN_STATUS_HINT);
|
|
6816
|
+
}
|
|
6817
|
+
const errorText = await response.text();
|
|
6818
|
+
const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
|
|
6819
|
+
throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
|
|
6820
|
+
}
|
|
6821
|
+
const [parseError, data] = await catchError2(response.json());
|
|
6822
|
+
if (parseError) {
|
|
6823
|
+
throw new Error(describeNonJsonResponse(organizationId, response, parseError));
|
|
6824
|
+
}
|
|
6825
|
+
return data;
|
|
6826
|
+
};
|
|
6827
|
+
|
|
6772
6828
|
// ../auth/src/tokenRefresh.ts
|
|
6773
6829
|
var TOKEN_REFRESH_REAUTHENTICATE_MESSAGE = "Token refresh failed. Run 'uip login' to re-authenticate.";
|
|
6774
6830
|
|
|
@@ -6981,6 +7037,8 @@ var saveEnvFileAsync = async ({
|
|
|
6981
7037
|
};
|
|
6982
7038
|
|
|
6983
7039
|
// ../auth/src/loginStatus.ts
|
|
7040
|
+
var defaultRobotTenantIdCache = new Map;
|
|
7041
|
+
var ROBOT_TENANT_LOOKUP_TIMEOUT_MS = 5000;
|
|
6984
7042
|
var getLoginStatusAsync = async (options = {}) => {
|
|
6985
7043
|
return getLoginStatusWithDeps(options);
|
|
6986
7044
|
};
|
|
@@ -6993,12 +7051,20 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
6993
7051
|
refreshToken: refreshTokenFn = refreshAccessToken,
|
|
6994
7052
|
resolveConfig = resolveConfigAsync,
|
|
6995
7053
|
robotFallback = tryRobotClientFallback,
|
|
7054
|
+
fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
|
|
7055
|
+
robotTenantIdCache = defaultRobotTenantIdCache,
|
|
7056
|
+
robotTenantLookupTimeoutMs = ROBOT_TENANT_LOOKUP_TIMEOUT_MS,
|
|
6996
7057
|
loadBreaker = loadRefreshBreaker,
|
|
6997
7058
|
saveBreaker = saveRefreshBreaker,
|
|
6998
7059
|
clearBreaker = clearRefreshBreaker
|
|
6999
7060
|
} = deps;
|
|
7061
|
+
const robotDeps = {
|
|
7062
|
+
fetchTenantsAndOrgs,
|
|
7063
|
+
cache: robotTenantIdCache,
|
|
7064
|
+
lookupTimeoutMs: robotTenantLookupTimeoutMs
|
|
7065
|
+
};
|
|
7000
7066
|
if (isRobotAuthEnforced()) {
|
|
7001
|
-
return resolveRobotEnforcedStatus(robotFallback);
|
|
7067
|
+
return resolveRobotEnforcedStatus(robotFallback, robotDeps);
|
|
7002
7068
|
}
|
|
7003
7069
|
if (isEnvAuthEnabled()) {
|
|
7004
7070
|
return readAuthFromEnv();
|
|
@@ -7016,7 +7082,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
7016
7082
|
hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
|
|
7017
7083
|
};
|
|
7018
7084
|
}
|
|
7019
|
-
return resolveBorrowedRobotStatus(robotFallback);
|
|
7085
|
+
return resolveBorrowedRobotStatus(robotFallback, robotDeps);
|
|
7020
7086
|
}
|
|
7021
7087
|
const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
|
|
7022
7088
|
if ("status" in loaded) {
|
|
@@ -7058,7 +7124,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
7058
7124
|
}
|
|
7059
7125
|
return buildFileStatus(tokens, credentials, globalHint);
|
|
7060
7126
|
};
|
|
7061
|
-
async function resolveRobotEnforcedStatus(robotFallback) {
|
|
7127
|
+
async function resolveRobotEnforcedStatus(robotFallback, deps) {
|
|
7062
7128
|
if (isEnvAuthEnabled()) {
|
|
7063
7129
|
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
|
|
7064
7130
|
}
|
|
@@ -7069,11 +7135,11 @@ async function resolveRobotEnforcedStatus(robotFallback) {
|
|
|
7069
7135
|
hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
|
|
7070
7136
|
};
|
|
7071
7137
|
}
|
|
7072
|
-
return buildRobotStatus(robotCreds);
|
|
7138
|
+
return buildRobotStatus(robotCreds, deps);
|
|
7073
7139
|
}
|
|
7074
|
-
async function resolveBorrowedRobotStatus(robotFallback) {
|
|
7140
|
+
async function resolveBorrowedRobotStatus(robotFallback, deps) {
|
|
7075
7141
|
const robotCreds = await robotFallback();
|
|
7076
|
-
return robotCreds ? buildRobotStatus(robotCreds) : { loginStatus: "Not logged in" };
|
|
7142
|
+
return robotCreds ? buildRobotStatus(robotCreds, deps) : { loginStatus: "Not logged in" };
|
|
7077
7143
|
}
|
|
7078
7144
|
async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
7079
7145
|
let credentials;
|
|
@@ -7208,9 +7274,10 @@ function identityFields(accessToken, credentials) {
|
|
|
7208
7274
|
...scopes ? { scopes } : {}
|
|
7209
7275
|
};
|
|
7210
7276
|
}
|
|
7211
|
-
function buildRobotStatus(robotCreds) {
|
|
7277
|
+
async function buildRobotStatus(robotCreds, deps) {
|
|
7212
7278
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
7213
7279
|
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
7280
|
+
const tenant = robotCreds.tenantId ? { tenantId: robotCreds.tenantId } : await resolveRobotTenantId(robotCreds, deps);
|
|
7214
7281
|
return {
|
|
7215
7282
|
loginStatus: "Logged in",
|
|
7216
7283
|
accessToken: robotCreds.accessToken,
|
|
@@ -7218,14 +7285,62 @@ function buildRobotStatus(robotCreds) {
|
|
|
7218
7285
|
organizationName: robotCreds.organizationName,
|
|
7219
7286
|
organizationId: robotCreds.organizationId,
|
|
7220
7287
|
tenantName: robotCreds.tenantName,
|
|
7221
|
-
tenantId:
|
|
7288
|
+
tenantId: tenant.tenantId,
|
|
7222
7289
|
issuer: robotCreds.issuer,
|
|
7223
7290
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
7224
7291
|
source: "robot" /* Robot */,
|
|
7292
|
+
...tenant.hint ? { hint: tenant.hint } : {},
|
|
7225
7293
|
...identity ? { identity } : {},
|
|
7226
7294
|
...scopes ? { scopes } : {}
|
|
7227
7295
|
};
|
|
7228
7296
|
}
|
|
7297
|
+
async function resolveRobotTenantId(robotCreds, deps) {
|
|
7298
|
+
const { baseUrl, accessToken, tenantName } = robotCreds;
|
|
7299
|
+
const organization = robotCreds.organizationName ?? robotCreds.organizationId;
|
|
7300
|
+
if (!tenantName || !organization) {
|
|
7301
|
+
return {};
|
|
7302
|
+
}
|
|
7303
|
+
const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
|
|
7304
|
+
let pending = deps.cache.get(key);
|
|
7305
|
+
if (!pending) {
|
|
7306
|
+
pending = catchError2(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
|
|
7307
|
+
const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
|
|
7308
|
+
if (!settled.tenantId) {
|
|
7309
|
+
deps.cache.delete(key);
|
|
7310
|
+
}
|
|
7311
|
+
return settled;
|
|
7312
|
+
});
|
|
7313
|
+
deps.cache.set(key, pending);
|
|
7314
|
+
}
|
|
7315
|
+
return pending;
|
|
7316
|
+
}
|
|
7317
|
+
async function lookupRobotTenantId(target, deps) {
|
|
7318
|
+
const { baseUrl, accessToken, organization, tenantName } = target;
|
|
7319
|
+
const [error, data] = await catchError2(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
|
|
7320
|
+
if (error) {
|
|
7321
|
+
const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
|
|
7322
|
+
return { hint: tenantLookupFailureHint(tenantName, reason) };
|
|
7323
|
+
}
|
|
7324
|
+
const rows = data?.tenants;
|
|
7325
|
+
const tenants = Array.isArray(rows) ? rows.filter((tenant) => typeof tenant?.id === "string" && typeof tenant?.name === "string") : [];
|
|
7326
|
+
const wantedName = decodePathSegment(tenantName);
|
|
7327
|
+
const wanted = wantedName.toLowerCase();
|
|
7328
|
+
const match = tenants.find((tenant) => tenant.name === wantedName) ?? tenants.find((tenant) => tenant.name.toLowerCase() === wanted);
|
|
7329
|
+
if (!match) {
|
|
7330
|
+
const names = tenants.map((tenant) => tenant.name).join(", ");
|
|
7331
|
+
return {
|
|
7332
|
+
hint: `The Robot session targets tenant '${tenantName}', but ` + `organization '${organization}' lists no tenant of that name` + `${names ? ` (available: ${names})` : ""}. Commands that need ` + `the tenant id will fail until it can be resolved.`
|
|
7333
|
+
};
|
|
7334
|
+
}
|
|
7335
|
+
return { tenantId: match.id };
|
|
7336
|
+
}
|
|
7337
|
+
function tenantLookupFailureHint(tenantName, reason) {
|
|
7338
|
+
return `Could not resolve the id of tenant '${tenantName}' from the ` + `Robot session: ${reason} Commands that need the tenant id will ` + `fail until it can be resolved.`;
|
|
7339
|
+
}
|
|
7340
|
+
function decodePathSegment(segment) {
|
|
7341
|
+
const [error, decoded] = catchError2(() => decodeURIComponent(segment));
|
|
7342
|
+
return error ? segment : decoded;
|
|
7343
|
+
}
|
|
7229
7344
|
var isFileNotFoundError = (error) => {
|
|
7230
7345
|
if (!(error instanceof Object))
|
|
7231
7346
|
return false;
|
|
@@ -7491,9 +7606,6 @@ var getAuthEnv = async (options = {}) => {
|
|
|
7491
7606
|
}
|
|
7492
7607
|
return { authEnv, loginStatus: status };
|
|
7493
7608
|
};
|
|
7494
|
-
// ../auth/src/tenantSelection.ts
|
|
7495
|
-
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
7496
|
-
|
|
7497
7609
|
// ../auth/src/selectTenant.ts
|
|
7498
7610
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
7499
7611
|
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
@@ -8331,7 +8443,7 @@ var package_default = {
|
|
|
8331
8443
|
name: "@uipath/context-grounding-tool",
|
|
8332
8444
|
author: "UiPath",
|
|
8333
8445
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
8334
|
-
version: "1.
|
|
8446
|
+
version: "1.205.0-preview.256",
|
|
8335
8447
|
description: "Tool for context grounding operations via the UiPath Python SDK",
|
|
8336
8448
|
keywords: [
|
|
8337
8449
|
"uipcli-tool",
|
|
@@ -8417,4 +8529,4 @@ var registerCommands = async (program2) => {
|
|
|
8417
8529
|
|
|
8418
8530
|
export { Command, metadata, registerCommands };
|
|
8419
8531
|
|
|
8420
|
-
//# debugId=
|
|
8532
|
+
//# debugId=8DA4BC5591DF56C864756E2164756E21
|
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.205.0-preview.256",
|
|
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": "63740c6cbb7ff282fa9118cc16a148eb030b245f"
|
|
33
33
|
}
|