@uipath/coder-tool 1.203.0-preview.203 → 1.204.0-preview.206
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-3h464y16.js → tool-jr7p1z0d.js} +581 -52
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2864,6 +2864,57 @@ function settlePromiseLike(thenable) {
|
|
|
2864
2864
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
2865
2865
|
}
|
|
2866
2866
|
|
|
2867
|
+
// ../common/src/error-graph.ts
|
|
2868
|
+
function* walkErrorGraph(error) {
|
|
2869
|
+
const queue = [error];
|
|
2870
|
+
const seen = new Set;
|
|
2871
|
+
for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
|
|
2872
|
+
const current = queue.shift();
|
|
2873
|
+
if (current === null || typeof current !== "object")
|
|
2874
|
+
continue;
|
|
2875
|
+
if (seen.has(current))
|
|
2876
|
+
continue;
|
|
2877
|
+
seen.add(current);
|
|
2878
|
+
const cur = current;
|
|
2879
|
+
yield cur;
|
|
2880
|
+
if (cur.cause !== undefined)
|
|
2881
|
+
queue.push(cur.cause);
|
|
2882
|
+
if (Array.isArray(cur.errors))
|
|
2883
|
+
queue.push(...cur.errors);
|
|
2884
|
+
}
|
|
2885
|
+
return;
|
|
2886
|
+
}
|
|
2887
|
+
function parseHttpStatusFromMessage(message) {
|
|
2888
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
2889
|
+
if (!match)
|
|
2890
|
+
return;
|
|
2891
|
+
const status = Number(match[1]);
|
|
2892
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
2893
|
+
}
|
|
2894
|
+
function findHttpStatusInGraph(error) {
|
|
2895
|
+
for (const node of walkErrorGraph(error)) {
|
|
2896
|
+
const response = node.response;
|
|
2897
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
2898
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
2899
|
+
return explicit;
|
|
2900
|
+
}
|
|
2901
|
+
if (typeof node.message === "string") {
|
|
2902
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
2903
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
2904
|
+
return parsed;
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
return;
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
// ../common/src/local-permission-codes.ts
|
|
2912
|
+
var LOCAL_PERMISSION_ERROR_CODES = new Set([
|
|
2913
|
+
"EACCES",
|
|
2914
|
+
"EPERM",
|
|
2915
|
+
"EROFS"
|
|
2916
|
+
]);
|
|
2917
|
+
|
|
2867
2918
|
// ../common/src/error-handler.ts
|
|
2868
2919
|
var NETWORK_ERROR_CODES = new Set([
|
|
2869
2920
|
"ECONNREFUSED",
|
|
@@ -2888,7 +2939,7 @@ var TLS_ERROR_CODES = new Set([
|
|
|
2888
2939
|
]);
|
|
2889
2940
|
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
2890
2941
|
var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
2891
|
-
var
|
|
2942
|
+
var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
|
|
2892
2943
|
// ../common/src/exit-code.ts
|
|
2893
2944
|
function setExitCode(code) {
|
|
2894
2945
|
process.exitCode = code;
|
|
@@ -3147,12 +3198,162 @@ function getOutputFilter() {
|
|
|
3147
3198
|
return filterSlot.get();
|
|
3148
3199
|
}
|
|
3149
3200
|
|
|
3201
|
+
// ../common/src/telemetry/telemetry-dimensions.ts
|
|
3202
|
+
var BaseDimensions = {
|
|
3203
|
+
ApplicationName: "ApplicationName",
|
|
3204
|
+
ProductVersion: "ProductVersion",
|
|
3205
|
+
InstallationId: "InstallationId",
|
|
3206
|
+
CloudUserId: "CloudUserId",
|
|
3207
|
+
CloudTenantId: "CloudTenantId",
|
|
3208
|
+
CloudOrganizationId: "CloudOrganizationId",
|
|
3209
|
+
IsInternalUser: "IsInternalUser",
|
|
3210
|
+
Environment: "Environment",
|
|
3211
|
+
BaseUrl: "BaseUrl",
|
|
3212
|
+
Region: "Region",
|
|
3213
|
+
Agent: "Agent",
|
|
3214
|
+
AgentVersion: "AgentVersion",
|
|
3215
|
+
AgentModel: "AgentModel",
|
|
3216
|
+
ToolName: "ToolName",
|
|
3217
|
+
ToolVersion: "ToolVersion",
|
|
3218
|
+
ExecutionContext: "ExecutionContext",
|
|
3219
|
+
CiProvider: "CiProvider",
|
|
3220
|
+
SessionIdSource: "SessionIdSource",
|
|
3221
|
+
SessionId: "SessionId"
|
|
3222
|
+
};
|
|
3223
|
+
var CommandDimensions = {
|
|
3224
|
+
IsCommand: "IsCommand",
|
|
3225
|
+
IsReexec: "IsReexec",
|
|
3226
|
+
CommandName: "CommandName",
|
|
3227
|
+
ExitCode: "ExitCode",
|
|
3228
|
+
TerminalOutcome: "TerminalOutcome",
|
|
3229
|
+
ErrorClass: "ErrorClass",
|
|
3230
|
+
TerminalSignal: "TerminalSignal",
|
|
3231
|
+
ErrorMessage: "ErrorMessage",
|
|
3232
|
+
SkillName: "SkillName",
|
|
3233
|
+
ProductArea: "ProductArea",
|
|
3234
|
+
Mode: "Mode"
|
|
3235
|
+
};
|
|
3236
|
+
var ShipDimensions = {
|
|
3237
|
+
ShipKind: "ShipKind",
|
|
3238
|
+
Target: "Target",
|
|
3239
|
+
ProjectType: "ProjectType",
|
|
3240
|
+
ProjectTypes: "ProjectTypes",
|
|
3241
|
+
ArtifactCorrelationKey: "ArtifactCorrelationKey",
|
|
3242
|
+
PackageName: "PackageName",
|
|
3243
|
+
PackageVersion: "PackageVersion",
|
|
3244
|
+
PackageVersionKey: "PackageVersionKey",
|
|
3245
|
+
DeploymentKey: "DeploymentKey",
|
|
3246
|
+
SolutionId: "SolutionId",
|
|
3247
|
+
FolderKey: "FolderKey",
|
|
3248
|
+
FeedId: "FeedId"
|
|
3249
|
+
};
|
|
3250
|
+
var ErrorDimensions = {
|
|
3251
|
+
Result: "Result",
|
|
3252
|
+
ErrorCode: "ErrorCode",
|
|
3253
|
+
Retry: "Retry",
|
|
3254
|
+
ErrorMessage: "ErrorMessage"
|
|
3255
|
+
};
|
|
3256
|
+
var AuthDimensions = {
|
|
3257
|
+
AuthenticationMethod: "AuthenticationMethod",
|
|
3258
|
+
Success: "Success",
|
|
3259
|
+
Reason: "Reason"
|
|
3260
|
+
};
|
|
3261
|
+
var SkillsDimensions = {
|
|
3262
|
+
SchemaVersion: "SchemaVersion",
|
|
3263
|
+
AgentType: "AgentType",
|
|
3264
|
+
SkillsVersion: "SkillsVersion",
|
|
3265
|
+
UipSubcommand: "UipSubcommand",
|
|
3266
|
+
FileExtension: "FileExtension",
|
|
3267
|
+
SubagentModel: "SubagentModel",
|
|
3268
|
+
SubagentType: "SubagentType",
|
|
3269
|
+
PermissionMode: "PermissionMode",
|
|
3270
|
+
EffortLevel: "EffortLevel",
|
|
3271
|
+
SessionSource: "SessionSource",
|
|
3272
|
+
Outcome: "Outcome",
|
|
3273
|
+
DurationMs: "DurationMs",
|
|
3274
|
+
Source: "Source"
|
|
3275
|
+
};
|
|
3276
|
+
var PackagerDimensions = {
|
|
3277
|
+
ProjectId: "ProjectId",
|
|
3278
|
+
ProjectType: "ProjectType",
|
|
3279
|
+
SolutionId: "SolutionId"
|
|
3280
|
+
};
|
|
3281
|
+
var ScopeDimensions = {
|
|
3282
|
+
FolderId: "FolderId"
|
|
3283
|
+
};
|
|
3284
|
+
var ID_DIMENSIONS = new Set([
|
|
3285
|
+
BaseDimensions.CloudUserId,
|
|
3286
|
+
BaseDimensions.CloudTenantId,
|
|
3287
|
+
BaseDimensions.CloudOrganizationId,
|
|
3288
|
+
BaseDimensions.InstallationId,
|
|
3289
|
+
ShipDimensions.ArtifactCorrelationKey,
|
|
3290
|
+
ShipDimensions.PackageVersionKey,
|
|
3291
|
+
ShipDimensions.DeploymentKey,
|
|
3292
|
+
ShipDimensions.SolutionId,
|
|
3293
|
+
ShipDimensions.FolderKey,
|
|
3294
|
+
ShipDimensions.FeedId,
|
|
3295
|
+
PackagerDimensions.ProjectId
|
|
3296
|
+
]);
|
|
3297
|
+
var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
|
|
3298
|
+
var RESERVED_DIMENSION_NAMES = new Set([
|
|
3299
|
+
...Object.values(BaseDimensions),
|
|
3300
|
+
...Object.values(CommandDimensions),
|
|
3301
|
+
...Object.values(ShipDimensions),
|
|
3302
|
+
...Object.values(ErrorDimensions),
|
|
3303
|
+
...Object.values(AuthDimensions),
|
|
3304
|
+
...Object.values(SkillsDimensions),
|
|
3305
|
+
...Object.values(PackagerDimensions),
|
|
3306
|
+
...Object.values(ScopeDimensions)
|
|
3307
|
+
]);
|
|
3308
|
+
var CURATED_DIMENSIONS = new Set([
|
|
3309
|
+
BaseDimensions.ApplicationName,
|
|
3310
|
+
BaseDimensions.ProductVersion,
|
|
3311
|
+
BaseDimensions.InstallationId,
|
|
3312
|
+
BaseDimensions.CloudUserId,
|
|
3313
|
+
BaseDimensions.CloudTenantId,
|
|
3314
|
+
BaseDimensions.CloudOrganizationId,
|
|
3315
|
+
BaseDimensions.IsInternalUser,
|
|
3316
|
+
BaseDimensions.Environment,
|
|
3317
|
+
BaseDimensions.BaseUrl,
|
|
3318
|
+
BaseDimensions.Region,
|
|
3319
|
+
BaseDimensions.Agent,
|
|
3320
|
+
BaseDimensions.AgentVersion,
|
|
3321
|
+
BaseDimensions.ToolVersion,
|
|
3322
|
+
BaseDimensions.ExecutionContext,
|
|
3323
|
+
BaseDimensions.CiProvider,
|
|
3324
|
+
BaseDimensions.SessionIdSource,
|
|
3325
|
+
BaseDimensions.SessionId,
|
|
3326
|
+
...Object.values(CommandDimensions),
|
|
3327
|
+
...Object.values(ShipDimensions)
|
|
3328
|
+
]);
|
|
3329
|
+
function lowercaseIdDimensionValues(properties) {
|
|
3330
|
+
let changed = false;
|
|
3331
|
+
const result = {
|
|
3332
|
+
...properties
|
|
3333
|
+
};
|
|
3334
|
+
for (const key of Object.keys(result)) {
|
|
3335
|
+
const value = result[key];
|
|
3336
|
+
if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
|
|
3337
|
+
continue;
|
|
3338
|
+
}
|
|
3339
|
+
const lowered = value.toLowerCase();
|
|
3340
|
+
if (lowered !== value) {
|
|
3341
|
+
result[key] = lowered;
|
|
3342
|
+
changed = true;
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
return changed ? result : properties;
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3150
3348
|
// ../common/src/telemetry/command-terminal.ts
|
|
3151
3349
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
3152
3350
|
var AUTH_ERROR_CODES = new Set([
|
|
3153
3351
|
"authentication_required",
|
|
3154
3352
|
"permission_denied"
|
|
3155
3353
|
]);
|
|
3354
|
+
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
3355
|
+
"local_permission_denied"
|
|
3356
|
+
]);
|
|
3156
3357
|
var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
3157
3358
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
3158
3359
|
"network_error",
|
|
@@ -3293,6 +3494,9 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3293
3494
|
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
3294
3495
|
return "auth";
|
|
3295
3496
|
}
|
|
3497
|
+
if (LOCAL_PERMISSION_CLI_ERROR_CODES.has(errorCode)) {
|
|
3498
|
+
return "local_permission";
|
|
3499
|
+
}
|
|
3296
3500
|
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
3297
3501
|
return "validation";
|
|
3298
3502
|
}
|
|
@@ -3304,6 +3508,15 @@ function classifyFromErrorCode(errorCode) {
|
|
|
3304
3508
|
}
|
|
3305
3509
|
return;
|
|
3306
3510
|
}
|
|
3511
|
+
function hasLocalPermissionCode(error) {
|
|
3512
|
+
for (const node of walkErrorGraph(error)) {
|
|
3513
|
+
const code = node.code;
|
|
3514
|
+
if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
|
|
3515
|
+
return true;
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
return false;
|
|
3519
|
+
}
|
|
3307
3520
|
function classifyFromError(error) {
|
|
3308
3521
|
const code = findCodeInCauseChain(error);
|
|
3309
3522
|
if (code) {
|
|
@@ -3320,6 +3533,9 @@ function classifyFromError(error) {
|
|
|
3320
3533
|
return "missing_dependency";
|
|
3321
3534
|
}
|
|
3322
3535
|
}
|
|
3536
|
+
if (hasLocalPermissionCode(error)) {
|
|
3537
|
+
return "local_permission";
|
|
3538
|
+
}
|
|
3323
3539
|
const message = stringField(error, "message");
|
|
3324
3540
|
if (message?.includes("fetch failed") === true) {
|
|
3325
3541
|
return "network_http";
|
|
@@ -3335,7 +3551,7 @@ function classifyError(input) {
|
|
|
3335
3551
|
if (recorded?.errorClass) {
|
|
3336
3552
|
return recorded.errorClass;
|
|
3337
3553
|
}
|
|
3338
|
-
const status = recorded?.context?.httpStatus;
|
|
3554
|
+
const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
|
|
3339
3555
|
if (status !== undefined) {
|
|
3340
3556
|
return classifyHttpStatus(status);
|
|
3341
3557
|
}
|
|
@@ -3358,17 +3574,18 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
3358
3574
|
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
|
|
3359
3575
|
const terminalSignal = terminalSignalFor(input, outcome);
|
|
3360
3576
|
return {
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
...errorClass ? {
|
|
3364
|
-
...terminalSignal ? {
|
|
3577
|
+
[CommandDimensions.ExitCode]: input.exitCode,
|
|
3578
|
+
[CommandDimensions.TerminalOutcome]: outcome,
|
|
3579
|
+
...errorClass ? { [CommandDimensions.ErrorClass]: errorClass } : {},
|
|
3580
|
+
...terminalSignal ? { [CommandDimensions.TerminalSignal]: terminalSignal } : {}
|
|
3365
3581
|
};
|
|
3366
3582
|
}
|
|
3367
3583
|
|
|
3368
3584
|
// ../common/src/telemetry/telemetry-events.ts
|
|
3369
3585
|
var CommonTelemetryEvents = {
|
|
3370
|
-
|
|
3371
|
-
|
|
3586
|
+
Start: "Application.Start",
|
|
3587
|
+
Error: "Application.Error",
|
|
3588
|
+
ShipSucceeded: "Cli.ShipSucceeded"
|
|
3372
3589
|
};
|
|
3373
3590
|
|
|
3374
3591
|
// ../common/src/registry.ts
|
|
@@ -3576,8 +3793,8 @@ function detectExecutionContext(options = {}) {
|
|
|
3576
3793
|
function getExecutionContextTelemetryProperties() {
|
|
3577
3794
|
const detected = detectExecutionContext();
|
|
3578
3795
|
return {
|
|
3579
|
-
|
|
3580
|
-
...detected.ciProvider ? {
|
|
3796
|
+
[BaseDimensions.ExecutionContext]: detected.executionContext,
|
|
3797
|
+
...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
|
|
3581
3798
|
};
|
|
3582
3799
|
}
|
|
3583
3800
|
// ../common/src/telemetry/node-context-storage.ts
|
|
@@ -3620,7 +3837,7 @@ function getInboundTraceContext() {
|
|
|
3620
3837
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
3621
3838
|
var SESSION_ID_MAX_LENGTH = 64;
|
|
3622
3839
|
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
3623
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "
|
|
3840
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
3624
3841
|
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
3625
3842
|
var INHERITED_SESSION_SOURCES = [
|
|
3626
3843
|
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
@@ -3672,6 +3889,9 @@ function resolveTelemetrySession() {
|
|
|
3672
3889
|
telemetrySessionSlot.set(resolved);
|
|
3673
3890
|
return resolved;
|
|
3674
3891
|
}
|
|
3892
|
+
function getTelemetrySessionId() {
|
|
3893
|
+
return resolveTelemetrySession().id;
|
|
3894
|
+
}
|
|
3675
3895
|
function getTelemetrySessionSource() {
|
|
3676
3896
|
return resolveTelemetrySession().source;
|
|
3677
3897
|
}
|
|
@@ -3752,7 +3972,10 @@ class TelemetryService {
|
|
|
3752
3972
|
} catch (error) {
|
|
3753
3973
|
const durationMs = clock.elapsedMs();
|
|
3754
3974
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3755
|
-
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
3975
|
+
await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
|
|
3976
|
+
...properties,
|
|
3977
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
3978
|
+
}, context));
|
|
3756
3979
|
throw error;
|
|
3757
3980
|
}
|
|
3758
3981
|
}
|
|
@@ -3823,7 +4046,10 @@ class TelemetryService {
|
|
|
3823
4046
|
const durationMs = clock.elapsedMs();
|
|
3824
4047
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3825
4048
|
await this.telemetryProvider.trackDependency({
|
|
3826
|
-
...this.spanFor(name, durationMs, false, {
|
|
4049
|
+
...this.spanFor(name, durationMs, false, {
|
|
4050
|
+
...properties,
|
|
4051
|
+
[CommandDimensions.ErrorMessage]: err.message
|
|
4052
|
+
}, childContext),
|
|
3827
4053
|
type
|
|
3828
4054
|
});
|
|
3829
4055
|
throw error;
|
|
@@ -3858,9 +4084,10 @@ class TelemetryService {
|
|
|
3858
4084
|
...globalProperties,
|
|
3859
4085
|
...this.defaultProperties,
|
|
3860
4086
|
...redactProperties(properties ?? {}),
|
|
3861
|
-
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource()
|
|
4087
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
4088
|
+
[BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
|
|
3862
4089
|
};
|
|
3863
|
-
return enriched;
|
|
4090
|
+
return lowercaseIdDimensionValues(enriched);
|
|
3864
4091
|
}
|
|
3865
4092
|
generateId() {
|
|
3866
4093
|
const bytes = new Uint8Array(8);
|
|
@@ -4621,7 +4848,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4621
4848
|
this.instructions = "Pass --limit <n> to choose how many records the filter applies to. " + "To filter over all records, pass the command's maximum accepted --limit (see the option's description in --help).";
|
|
4622
4849
|
}
|
|
4623
4850
|
}
|
|
4624
|
-
function
|
|
4851
|
+
function countRecords(data) {
|
|
4852
|
+
if (Array.isArray(data))
|
|
4853
|
+
return data.length;
|
|
4854
|
+
return data == null ? 0 : 1;
|
|
4855
|
+
}
|
|
4856
|
+
function availableFields(data) {
|
|
4857
|
+
const records = Array.isArray(data) ? data : [data];
|
|
4858
|
+
const keys = new Set;
|
|
4859
|
+
for (const record of records) {
|
|
4860
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
4861
|
+
for (const key of Object.keys(record))
|
|
4862
|
+
keys.add(key);
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4865
|
+
return [...keys];
|
|
4866
|
+
}
|
|
4867
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
4868
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
4869
|
+
if (!error && typeof decoded === "string")
|
|
4870
|
+
return decoded;
|
|
4871
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
4872
|
+
}
|
|
4873
|
+
function referencedFields(filter) {
|
|
4874
|
+
const top = new Set;
|
|
4875
|
+
const nested = new Set;
|
|
4876
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
4877
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
4878
|
+
const quoted = [];
|
|
4879
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
4880
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
4881
|
+
if (!isAlias) {
|
|
4882
|
+
quoted.push({
|
|
4883
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
4884
|
+
index,
|
|
4885
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
4886
|
+
});
|
|
4887
|
+
}
|
|
4888
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
4889
|
+
});
|
|
4890
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
4891
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
4892
|
+
const place = (name, index, tail) => {
|
|
4893
|
+
if (tail || index >= rootEnd)
|
|
4894
|
+
nested.add(name);
|
|
4895
|
+
else
|
|
4896
|
+
top.add(name);
|
|
4897
|
+
};
|
|
4898
|
+
for (const entry of quoted)
|
|
4899
|
+
place(entry.name, entry.index, entry.tail);
|
|
4900
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
4901
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
4902
|
+
for (const match of identifiers) {
|
|
4903
|
+
const [, name, trailing] = match;
|
|
4904
|
+
if (trailing || reserved.has(name))
|
|
4905
|
+
continue;
|
|
4906
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
4907
|
+
}
|
|
4908
|
+
return {
|
|
4909
|
+
top: [...top],
|
|
4910
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
4911
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
4912
|
+
};
|
|
4913
|
+
}
|
|
4914
|
+
function appearsBelowTopLevel(data, name) {
|
|
4915
|
+
let budget = 2000;
|
|
4916
|
+
const visit = (value, depth) => {
|
|
4917
|
+
if (budget-- <= 0 || depth > 4)
|
|
4918
|
+
return false;
|
|
4919
|
+
if (value === null || typeof value !== "object")
|
|
4920
|
+
return false;
|
|
4921
|
+
if (Array.isArray(value))
|
|
4922
|
+
return value.some((entry) => visit(entry, depth));
|
|
4923
|
+
const record = value;
|
|
4924
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
4925
|
+
return true;
|
|
4926
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
4927
|
+
};
|
|
4928
|
+
return visit(data, 0);
|
|
4929
|
+
}
|
|
4930
|
+
function alwaysNullKeys(records) {
|
|
4931
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
4932
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
4933
|
+
return [];
|
|
4934
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
4935
|
+
if (keys.length === 0)
|
|
4936
|
+
return [];
|
|
4937
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
4938
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
4939
|
+
}
|
|
4940
|
+
function carriesOnlyNulls(value) {
|
|
4941
|
+
if (value === null)
|
|
4942
|
+
return true;
|
|
4943
|
+
if (Array.isArray(value)) {
|
|
4944
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
4945
|
+
}
|
|
4946
|
+
if (typeof value === "object" && value !== undefined) {
|
|
4947
|
+
const values = Object.values(value);
|
|
4948
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
4949
|
+
}
|
|
4950
|
+
return false;
|
|
4951
|
+
}
|
|
4952
|
+
function nameList(names, cap2 = 12) {
|
|
4953
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
4954
|
+
const rest = names.length - shown.length;
|
|
4955
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
4956
|
+
}
|
|
4957
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
4958
|
+
const present = availableFields(data);
|
|
4959
|
+
const refs = referencedFields(filter);
|
|
4960
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
4961
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
4962
|
+
const count = countRecords(data);
|
|
4963
|
+
const scope = `${count} record(s)`;
|
|
4964
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
4965
|
+
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" : "";
|
|
4966
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
4967
|
+
let detail;
|
|
4968
|
+
let lede;
|
|
4969
|
+
if (outcome.kind === "null-elements") {
|
|
4970
|
+
lede = "returned only null values";
|
|
4971
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
4972
|
+
if (unknown.length > 0) {
|
|
4973
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4974
|
+
} else if (unchecked.length > 0) {
|
|
4975
|
+
detail = withSoundness(projected);
|
|
4976
|
+
} else {
|
|
4977
|
+
detail = `${projected}, and every field it names exists — a multi-select list ` + `(\`[A, B]\`) reads each entry against \`Data\` itself, so on a list ` + `result use \`[].[A, B]\` or \`[].{a: A, b: B}\` to read the records`;
|
|
4978
|
+
}
|
|
4979
|
+
} else if (outcome.kind === "null-rows") {
|
|
4980
|
+
lede = "returned only null values";
|
|
4981
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
4982
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
4983
|
+
} else if (outcome.kind === "null-values") {
|
|
4984
|
+
lede = "returned only null values";
|
|
4985
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
4986
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
4987
|
+
if (sameSet) {
|
|
4988
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
4989
|
+
} else if (unknown.length > 0) {
|
|
4990
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4991
|
+
} else {
|
|
4992
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
4993
|
+
}
|
|
4994
|
+
} else {
|
|
4995
|
+
lede = "returned nothing";
|
|
4996
|
+
if (unknown.length > 0) {
|
|
4997
|
+
detail = isNotAField(unknown);
|
|
4998
|
+
} else {
|
|
4999
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
5000
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
5001
|
+
}
|
|
5002
|
+
}
|
|
5003
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
5004
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
5005
|
+
}
|
|
5006
|
+
function appendWarning(existing, note) {
|
|
5007
|
+
return existing ? `${existing} ${note}` : note;
|
|
5008
|
+
}
|
|
5009
|
+
function applyFilter(data, filter, onWarning) {
|
|
4625
5010
|
const codec = requireJmespath();
|
|
4626
5011
|
let result;
|
|
4627
5012
|
try {
|
|
@@ -4629,9 +5014,34 @@ function applyFilter(data, filter) {
|
|
|
4629
5014
|
} catch (err) {
|
|
4630
5015
|
throw new FilterEvaluationError(filter, err);
|
|
4631
5016
|
}
|
|
4632
|
-
|
|
5017
|
+
const inputCount = countRecords(data);
|
|
5018
|
+
const warn = (outcome) => {
|
|
5019
|
+
if (inputCount === 0)
|
|
5020
|
+
return;
|
|
5021
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
5022
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
5023
|
+
`);
|
|
5024
|
+
onWarning?.(note);
|
|
5025
|
+
};
|
|
5026
|
+
const warnIfAllNull = (records) => {
|
|
5027
|
+
const keys = alwaysNullKeys(records);
|
|
5028
|
+
if (keys.length > 0)
|
|
5029
|
+
warn({ kind: "null-values", keys });
|
|
5030
|
+
};
|
|
5031
|
+
if (result == null) {
|
|
5032
|
+
warn({ kind: "empty" });
|
|
4633
5033
|
return [];
|
|
5034
|
+
}
|
|
4634
5035
|
if (Array.isArray(result)) {
|
|
5036
|
+
if (result.length === 0) {
|
|
5037
|
+
warn({ kind: "empty" });
|
|
5038
|
+
} else if (result.every((entry) => entry === null)) {
|
|
5039
|
+
warn({ kind: "null-elements", count: result.length });
|
|
5040
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
5041
|
+
warn({ kind: "null-rows", count: result.length });
|
|
5042
|
+
} else {
|
|
5043
|
+
warnIfAllNull(result);
|
|
5044
|
+
}
|
|
4635
5045
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
4636
5046
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
4637
5047
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -4639,10 +5049,30 @@ function applyFilter(data, filter) {
|
|
|
4639
5049
|
}
|
|
4640
5050
|
return result;
|
|
4641
5051
|
}
|
|
4642
|
-
if (typeof result === "object")
|
|
5052
|
+
if (typeof result === "object") {
|
|
5053
|
+
warnIfAllNull([result]);
|
|
4643
5054
|
return result;
|
|
5055
|
+
}
|
|
4644
5056
|
return { Value: result };
|
|
4645
5057
|
}
|
|
5058
|
+
function filterFailureData(envelope) {
|
|
5059
|
+
const filter = getOutputFilter();
|
|
5060
|
+
const data = envelope.Data;
|
|
5061
|
+
if (!filter || data == null)
|
|
5062
|
+
return;
|
|
5063
|
+
let note;
|
|
5064
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
5065
|
+
note = n;
|
|
5066
|
+
}));
|
|
5067
|
+
if (filterError) {
|
|
5068
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
5069
|
+
return;
|
|
5070
|
+
}
|
|
5071
|
+
envelope.Data = filtered;
|
|
5072
|
+
if (note) {
|
|
5073
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5074
|
+
}
|
|
5075
|
+
}
|
|
4646
5076
|
function defaultErrorCodeForResult(result) {
|
|
4647
5077
|
switch (result) {
|
|
4648
5078
|
case RESULTS.AuthenticationError:
|
|
@@ -4657,7 +5087,7 @@ function defaultErrorCodeForResult(result) {
|
|
|
4657
5087
|
return "unknown_error";
|
|
4658
5088
|
}
|
|
4659
5089
|
}
|
|
4660
|
-
function
|
|
5090
|
+
function parseHttpStatusFromMessage2(message) {
|
|
4661
5091
|
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
4662
5092
|
if (!match)
|
|
4663
5093
|
return;
|
|
@@ -4686,10 +5116,10 @@ function defaultErrorCodeForHttpStatus(status) {
|
|
|
4686
5116
|
return "server_error";
|
|
4687
5117
|
return;
|
|
4688
5118
|
}
|
|
4689
|
-
var LOCAL_PERMISSION_TEXT_PATTERN =
|
|
5119
|
+
var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
|
|
4690
5120
|
function defaultErrorCodeForFailure(data) {
|
|
4691
5121
|
if (data.Result === RESULTS.Failure) {
|
|
4692
|
-
const status = data.Context?.httpStatus ??
|
|
5122
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
4693
5123
|
const errorCode = defaultErrorCodeForHttpStatus(status);
|
|
4694
5124
|
if (errorCode)
|
|
4695
5125
|
return errorCode;
|
|
@@ -4725,8 +5155,14 @@ var OutputFormatter;
|
|
|
4725
5155
|
}
|
|
4726
5156
|
const filter = getOutputFilter();
|
|
4727
5157
|
if (filter) {
|
|
4728
|
-
|
|
5158
|
+
let note;
|
|
5159
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
5160
|
+
note = n;
|
|
5161
|
+
});
|
|
4729
5162
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
5163
|
+
if (note) {
|
|
5164
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
5165
|
+
}
|
|
4730
5166
|
}
|
|
4731
5167
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4732
5168
|
}
|
|
@@ -4754,12 +5190,13 @@ var OutputFormatter;
|
|
|
4754
5190
|
delete envelope.TelemetryErrorClass;
|
|
4755
5191
|
delete envelope.TelemetryTerminalOutcome;
|
|
4756
5192
|
delete envelope.TelemetryTerminalSignal;
|
|
5193
|
+
filterFailureData(envelope);
|
|
4757
5194
|
if (!suppressTelemetry) {
|
|
4758
5195
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
5196
|
+
[ErrorDimensions.Result]: data.Result,
|
|
5197
|
+
[ErrorDimensions.ErrorCode]: data.ErrorCode,
|
|
5198
|
+
[ErrorDimensions.Retry]: data.Retry,
|
|
5199
|
+
[ErrorDimensions.ErrorMessage]: data.Message
|
|
4763
5200
|
});
|
|
4764
5201
|
}
|
|
4765
5202
|
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
@@ -4802,13 +5239,20 @@ var OutputFormatter;
|
|
|
4802
5239
|
OutputFormatter.log = log;
|
|
4803
5240
|
function formatToString(data) {
|
|
4804
5241
|
const filter = getOutputFilter();
|
|
5242
|
+
const envelope = data;
|
|
4805
5243
|
if ("Data" in data && data.Data != null) {
|
|
4806
5244
|
data.Data = normalizeDataKeys(data.Data);
|
|
4807
5245
|
if (filter) {
|
|
4808
|
-
|
|
5246
|
+
let note;
|
|
5247
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
5248
|
+
note = n;
|
|
5249
|
+
}));
|
|
5250
|
+
if (note) {
|
|
5251
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5252
|
+
}
|
|
4809
5253
|
}
|
|
4810
5254
|
}
|
|
4811
|
-
const output = normalizeOutputKeys(
|
|
5255
|
+
const output = normalizeOutputKeys(envelope);
|
|
4812
5256
|
const lines = [];
|
|
4813
5257
|
const sink = getOutputSink();
|
|
4814
5258
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -4866,7 +5310,7 @@ var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
|
4866
5310
|
var MAX_SKILL_NAME_LENGTH = 80;
|
|
4867
5311
|
var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
4868
5312
|
function productMode(productArea, mode) {
|
|
4869
|
-
return {
|
|
5313
|
+
return { ProductArea: productArea, Mode: mode };
|
|
4870
5314
|
}
|
|
4871
5315
|
function attributionRecord(groups) {
|
|
4872
5316
|
const record = {};
|
|
@@ -4924,6 +5368,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
4924
5368
|
["rpa", "build", ["uip.rpa-legacy"]],
|
|
4925
5369
|
["conversational", "operate", ["uip.conversational"]],
|
|
4926
5370
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
5371
|
+
["coding-agents", "build", ["uip.coder"]],
|
|
4927
5372
|
["agenthub", "build", ["uip.agenthub"]],
|
|
4928
5373
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
4929
5374
|
["functions", "build", ["uip.function", "uip.functions"]],
|
|
@@ -5009,32 +5454,64 @@ function normalizeSkillName(value) {
|
|
|
5009
5454
|
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
5010
5455
|
const skillName = normalizeSkillName(skillSource);
|
|
5011
5456
|
return {
|
|
5012
|
-
...skillName ? {
|
|
5457
|
+
...skillName ? { SkillName: skillName } : {},
|
|
5013
5458
|
...getCommandProductModeAttribution(commandPath)
|
|
5014
5459
|
};
|
|
5015
5460
|
}
|
|
5461
|
+
var AGENT_SESSION_ENV = {
|
|
5462
|
+
[BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
|
|
5463
|
+
[SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
|
|
5464
|
+
[SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
|
|
5465
|
+
[SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
|
|
5466
|
+
};
|
|
5467
|
+
var MAX_TELEMETRY_TOKEN_LENGTH = 120;
|
|
5468
|
+
function sanitizeTelemetryToken(value) {
|
|
5469
|
+
return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
|
|
5470
|
+
}
|
|
5471
|
+
function buildAgentSessionTelemetry(env) {
|
|
5472
|
+
const dimensions = {};
|
|
5473
|
+
for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
|
|
5474
|
+
const value = env[variable]?.trim();
|
|
5475
|
+
if (value) {
|
|
5476
|
+
dimensions[key] = sanitizeTelemetryToken(value);
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
return dimensions;
|
|
5480
|
+
}
|
|
5016
5481
|
|
|
5017
5482
|
// ../common/src/telemetry/command-name.ts
|
|
5018
|
-
var
|
|
5483
|
+
var TELEMETRY_NAME_ROOT = "Cli";
|
|
5484
|
+
var CLI_COMMAND_ROOT = "uip";
|
|
5485
|
+
var TELEMETRY_NAME_BARE_ACTION = "Invoke";
|
|
5019
5486
|
function commandTelemetryName(parts) {
|
|
5487
|
+
const action = vetCommandTokens(parts).map(pascalizeToken).join("");
|
|
5488
|
+
return `${TELEMETRY_NAME_ROOT}.${action || TELEMETRY_NAME_BARE_ACTION}`;
|
|
5489
|
+
}
|
|
5490
|
+
function commandInvocationPath(parts) {
|
|
5491
|
+
return [CLI_COMMAND_ROOT, ...vetCommandTokens(parts)].join(" ");
|
|
5492
|
+
}
|
|
5493
|
+
function vetCommandTokens(parts) {
|
|
5020
5494
|
const tokens = [];
|
|
5021
5495
|
for (const part of parts) {
|
|
5022
|
-
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !==
|
|
5496
|
+
const pieces = String(part ?? "").split(/\s+/).filter((token) => token && !token.startsWith("-") && token !== CLI_COMMAND_ROOT);
|
|
5023
5497
|
if (pieces.every(isCommandToken)) {
|
|
5024
5498
|
tokens.push(...pieces);
|
|
5025
5499
|
continue;
|
|
5026
5500
|
}
|
|
5027
5501
|
tokens.push(UNKNOWN_TOKEN);
|
|
5028
5502
|
}
|
|
5029
|
-
return
|
|
5503
|
+
return tokens;
|
|
5030
5504
|
}
|
|
5031
|
-
|
|
5505
|
+
function pascalizeToken(token) {
|
|
5506
|
+
return token.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
5507
|
+
}
|
|
5508
|
+
var COMMAND_TOKEN_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
5032
5509
|
var MAX_COMMAND_TOKEN_LENGTH = 32;
|
|
5033
5510
|
var GUID_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
5034
5511
|
function isCommandToken(token) {
|
|
5035
|
-
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token)
|
|
5512
|
+
return token.length <= MAX_COMMAND_TOKEN_LENGTH && COMMAND_TOKEN_PATTERN.test(token) && !GUID_TOKEN.test(token);
|
|
5036
5513
|
}
|
|
5037
|
-
var UNKNOWN_TOKEN = "
|
|
5514
|
+
var UNKNOWN_TOKEN = "unknown";
|
|
5038
5515
|
|
|
5039
5516
|
// ../common/src/telemetry/invocation-request.ts
|
|
5040
5517
|
var requestContextSlot = singleton("TelemetryInvocationRequestContext");
|
|
@@ -5139,7 +5616,7 @@ function withheldArgumentValues(cmd) {
|
|
|
5139
5616
|
});
|
|
5140
5617
|
return values;
|
|
5141
5618
|
}
|
|
5142
|
-
function
|
|
5619
|
+
function deriveCommandParts(cmd) {
|
|
5143
5620
|
const parts = [];
|
|
5144
5621
|
let current = cmd;
|
|
5145
5622
|
while (current) {
|
|
@@ -5152,14 +5629,13 @@ function deriveCommandPath(cmd) {
|
|
|
5152
5629
|
if (parts.length > 1) {
|
|
5153
5630
|
parts.shift();
|
|
5154
5631
|
}
|
|
5155
|
-
return
|
|
5632
|
+
return parts;
|
|
5156
5633
|
}
|
|
5157
5634
|
function isErrorContext(value) {
|
|
5158
5635
|
return value !== null && typeof value === "object";
|
|
5159
5636
|
}
|
|
5160
5637
|
function commandHelpHint(commandPath) {
|
|
5161
|
-
|
|
5162
|
-
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5638
|
+
return `An unexpected error occurred. Run '${commandPath} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
5163
5639
|
}
|
|
5164
5640
|
function isPromptCancellation(error) {
|
|
5165
5641
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
@@ -5184,7 +5660,9 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5184
5660
|
yaml: getOutputFormat() === "yaml",
|
|
5185
5661
|
filter: getOutputFilter() !== undefined
|
|
5186
5662
|
});
|
|
5187
|
-
const
|
|
5663
|
+
const commandParts = deriveCommandParts(command);
|
|
5664
|
+
const telemetryName = commandTelemetryName(commandParts);
|
|
5665
|
+
const commandPath = commandInvocationPath(commandParts);
|
|
5188
5666
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
5189
5667
|
markCommandStart();
|
|
5190
5668
|
const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
|
|
@@ -5219,7 +5697,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5219
5697
|
Result: finalResult,
|
|
5220
5698
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
5221
5699
|
Message: errorMessage,
|
|
5222
|
-
Instructions: customInstructions ?? commandHelpHint(
|
|
5700
|
+
Instructions: customInstructions ?? commandHelpHint(commandPath),
|
|
5223
5701
|
...customRetry ? { Retry: customRetry } : {},
|
|
5224
5702
|
...customContext ? { Context: customContext } : {}
|
|
5225
5703
|
});
|
|
@@ -5236,8 +5714,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5236
5714
|
recordedFailure,
|
|
5237
5715
|
pollSignal: context.pollSignal
|
|
5238
5716
|
});
|
|
5239
|
-
if (terminalTelemetry.
|
|
5240
|
-
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), {
|
|
5717
|
+
if (terminalTelemetry[CommandDimensions.ErrorClass] === "internal" && error) {
|
|
5718
|
+
telemetry.trackException(error instanceof Error ? error : new Error(String(error)), { [CommandDimensions.CommandName]: commandPath }, getInvocationRequestContext());
|
|
5241
5719
|
}
|
|
5242
5720
|
const commandParams = extractCommandParams(command);
|
|
5243
5721
|
if (props) {
|
|
@@ -5248,10 +5726,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
5248
5726
|
const baseProperties = redactProperties({
|
|
5249
5727
|
...commandParams,
|
|
5250
5728
|
...props,
|
|
5251
|
-
...buildCommandTelemetryAttribution(
|
|
5252
|
-
|
|
5729
|
+
...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
|
|
5730
|
+
...buildAgentSessionTelemetry(process.env),
|
|
5731
|
+
[CommandDimensions.CommandName]: commandPath,
|
|
5732
|
+
[CommandDimensions.IsCommand]: "true",
|
|
5253
5733
|
...terminalTelemetry,
|
|
5254
|
-
...errorMessage ? { errorMessage } : {}
|
|
5734
|
+
...errorMessage ? { [CommandDimensions.ErrorMessage]: errorMessage } : {}
|
|
5255
5735
|
});
|
|
5256
5736
|
emitInvocationRequest(telemetryName, success, baseProperties);
|
|
5257
5737
|
} finally {
|
|
@@ -5482,6 +5962,40 @@ var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
|
|
|
5482
5962
|
// ../common/src/interactivity-context.ts
|
|
5483
5963
|
var modeSlot = singleton("InteractivityMode");
|
|
5484
5964
|
var interactiveFlagSlot = singleton("InteractiveFlag");
|
|
5965
|
+
// ../common/src/mime-types.ts
|
|
5966
|
+
var MIME_TYPES_BY_EXTENSION = Object.freeze({
|
|
5967
|
+
pdf: "application/pdf",
|
|
5968
|
+
png: "image/png",
|
|
5969
|
+
jpg: "image/jpeg",
|
|
5970
|
+
jpeg: "image/jpeg",
|
|
5971
|
+
gif: "image/gif",
|
|
5972
|
+
webp: "image/webp",
|
|
5973
|
+
bmp: "image/bmp",
|
|
5974
|
+
tif: "image/tiff",
|
|
5975
|
+
tiff: "image/tiff",
|
|
5976
|
+
svg: "image/svg+xml",
|
|
5977
|
+
txt: "text/plain",
|
|
5978
|
+
log: "text/plain",
|
|
5979
|
+
md: "text/markdown",
|
|
5980
|
+
csv: "text/csv",
|
|
5981
|
+
tsv: "text/tab-separated-values",
|
|
5982
|
+
json: "application/json",
|
|
5983
|
+
xml: "application/xml",
|
|
5984
|
+
html: "text/html",
|
|
5985
|
+
htm: "text/html",
|
|
5986
|
+
yaml: "application/yaml",
|
|
5987
|
+
yml: "application/yaml",
|
|
5988
|
+
doc: "application/msword",
|
|
5989
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
5990
|
+
xls: "application/vnd.ms-excel",
|
|
5991
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5992
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
5993
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
5994
|
+
zip: "application/zip",
|
|
5995
|
+
mp3: "audio/mpeg",
|
|
5996
|
+
wav: "audio/wav",
|
|
5997
|
+
mp4: "video/mp4"
|
|
5998
|
+
});
|
|
5485
5999
|
// ../common/src/polling/types.ts
|
|
5486
6000
|
var PollOutcome = {
|
|
5487
6001
|
Completed: "completed",
|
|
@@ -5526,6 +6040,7 @@ var ScreenLogger;
|
|
|
5526
6040
|
ScreenLogger.progress = progress;
|
|
5527
6041
|
})(ScreenLogger ||= {});
|
|
5528
6042
|
// ../common/src/sdk-user-agent.ts
|
|
6043
|
+
var AGENT_PROPERTY = BaseDimensions.Agent;
|
|
5529
6044
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
5530
6045
|
// ../common/src/telemetry/ship-succeeded.ts
|
|
5531
6046
|
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
@@ -5536,7 +6051,7 @@ var package_default = {
|
|
|
5536
6051
|
name: "@uipath/coder-tool",
|
|
5537
6052
|
author: "UiPath",
|
|
5538
6053
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5539
|
-
version: "1.
|
|
6054
|
+
version: "1.204.0-preview.206",
|
|
5540
6055
|
description: "Interactive coding agent (Pi) with UiPath LLM Gateway and BYO provider support.",
|
|
5541
6056
|
publishConfig: {
|
|
5542
6057
|
registry: "https://npm.pkg.github.com/"
|
|
@@ -5887,6 +6402,11 @@ var pickName = (claims) => {
|
|
|
5887
6402
|
const username = asString(claims?.preferred_username);
|
|
5888
6403
|
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
5889
6404
|
};
|
|
6405
|
+
var pickScopes = (claims) => {
|
|
6406
|
+
const raw = claims?.scope;
|
|
6407
|
+
const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
|
|
6408
|
+
return scopes.length > 0 ? scopes : undefined;
|
|
6409
|
+
};
|
|
5890
6410
|
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
5891
6411
|
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
5892
6412
|
const email = pickEmail(claims);
|
|
@@ -5912,6 +6432,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
5912
6432
|
identity.clientId = clientId;
|
|
5913
6433
|
return identity;
|
|
5914
6434
|
};
|
|
6435
|
+
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
5915
6436
|
|
|
5916
6437
|
// ../auth/src/envAuth.ts
|
|
5917
6438
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
@@ -5984,6 +6505,7 @@ var readAuthFromEnv = () => {
|
|
|
5984
6505
|
const expiration = getTokenExpiration(accessToken);
|
|
5985
6506
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
5986
6507
|
const identity = resolveSessionIdentity(accessToken);
|
|
6508
|
+
const scopes = readTokenScopes(accessToken);
|
|
5987
6509
|
return {
|
|
5988
6510
|
loginStatus,
|
|
5989
6511
|
accessToken,
|
|
@@ -5994,7 +6516,8 @@ var readAuthFromEnv = () => {
|
|
|
5994
6516
|
tenantId,
|
|
5995
6517
|
expiration,
|
|
5996
6518
|
source: "env-vars" /* EnvironmentVariables */,
|
|
5997
|
-
...identity ? { identity } : {}
|
|
6519
|
+
...identity ? { identity } : {},
|
|
6520
|
+
...scopes ? { scopes } : {}
|
|
5998
6521
|
};
|
|
5999
6522
|
};
|
|
6000
6523
|
|
|
@@ -6632,10 +7155,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
6632
7155
|
}
|
|
6633
7156
|
function identityFields(accessToken, credentials) {
|
|
6634
7157
|
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
6635
|
-
|
|
7158
|
+
const scopes = readTokenScopes(accessToken);
|
|
7159
|
+
return {
|
|
7160
|
+
...identity ? { identity } : {},
|
|
7161
|
+
...scopes ? { scopes } : {}
|
|
7162
|
+
};
|
|
6636
7163
|
}
|
|
6637
7164
|
function buildRobotStatus(robotCreds) {
|
|
6638
7165
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
7166
|
+
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
6639
7167
|
return {
|
|
6640
7168
|
loginStatus: "Logged in",
|
|
6641
7169
|
accessToken: robotCreds.accessToken,
|
|
@@ -6647,7 +7175,8 @@ function buildRobotStatus(robotCreds) {
|
|
|
6647
7175
|
issuer: robotCreds.issuer,
|
|
6648
7176
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
6649
7177
|
source: "robot" /* Robot */,
|
|
6650
|
-
...identity ? { identity } : {}
|
|
7178
|
+
...identity ? { identity } : {},
|
|
7179
|
+
...scopes ? { scopes } : {}
|
|
6651
7180
|
};
|
|
6652
7181
|
}
|
|
6653
7182
|
var isFileNotFoundError = (error) => {
|
|
@@ -7094,4 +7623,4 @@ var registerCommands = async (program2) => {
|
|
|
7094
7623
|
|
|
7095
7624
|
export { Command, setPreviewBuild, metadata, registerCommands };
|
|
7096
7625
|
|
|
7097
|
-
//# debugId=
|
|
7626
|
+
//# debugId=36B7DB9FA86824AE64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/coder-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.204.0-preview.206",
|
|
6
6
|
"description": "Interactive coding agent (Pi) with UiPath LLM Gateway and BYO provider support.",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@earendil-works/pi-coding-agent": "^0.80.6"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "ea7fd32a02acccf14e8e83522e69101430627b83"
|
|
25
25
|
}
|