@uipath/codedagent-tool 1.202.1-preview.220 → 1.202.1-preview.238
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
CHANGED
package/dist/init.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getFileSystem,
|
|
12
12
|
processContext,
|
|
13
13
|
trackShipSucceeded
|
|
14
|
-
} from "./tool-
|
|
14
|
+
} from "./tool-7nscmrxk.js";
|
|
15
15
|
import {
|
|
16
16
|
__require
|
|
17
17
|
} from "./tool-1de529jm.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@uipath/codedagent-tool",
|
|
21
21
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
22
|
-
version: "1.202.1-preview.
|
|
22
|
+
version: "1.202.1-preview.238",
|
|
23
23
|
description: "Build, run, deploy, and manage AI Agents.",
|
|
24
24
|
keywords: [
|
|
25
25
|
"cli-tool",
|
|
@@ -3208,4 +3208,4 @@ var registerCommands = async (program) => {
|
|
|
3208
3208
|
|
|
3209
3209
|
export { metadata, registerCommands };
|
|
3210
3210
|
|
|
3211
|
-
//# debugId=
|
|
3211
|
+
//# debugId=3562488B85C021FC64756E2164756E21
|
|
@@ -4386,7 +4386,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4386
4386
|
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).";
|
|
4387
4387
|
}
|
|
4388
4388
|
}
|
|
4389
|
-
function
|
|
4389
|
+
function countRecords(data) {
|
|
4390
|
+
if (Array.isArray(data))
|
|
4391
|
+
return data.length;
|
|
4392
|
+
return data == null ? 0 : 1;
|
|
4393
|
+
}
|
|
4394
|
+
function availableFields(data) {
|
|
4395
|
+
const records = Array.isArray(data) ? data : [data];
|
|
4396
|
+
const keys = new Set;
|
|
4397
|
+
for (const record of records) {
|
|
4398
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
4399
|
+
for (const key of Object.keys(record))
|
|
4400
|
+
keys.add(key);
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
return [...keys];
|
|
4404
|
+
}
|
|
4405
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
4406
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
4407
|
+
if (!error && typeof decoded === "string")
|
|
4408
|
+
return decoded;
|
|
4409
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
4410
|
+
}
|
|
4411
|
+
function referencedFields(filter) {
|
|
4412
|
+
const top = new Set;
|
|
4413
|
+
const nested = new Set;
|
|
4414
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
4415
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
4416
|
+
const quoted = [];
|
|
4417
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
4418
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
4419
|
+
if (!isAlias) {
|
|
4420
|
+
quoted.push({
|
|
4421
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
4422
|
+
index,
|
|
4423
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
4424
|
+
});
|
|
4425
|
+
}
|
|
4426
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
4427
|
+
});
|
|
4428
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
4429
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
4430
|
+
const place = (name, index, tail) => {
|
|
4431
|
+
if (tail || index >= rootEnd)
|
|
4432
|
+
nested.add(name);
|
|
4433
|
+
else
|
|
4434
|
+
top.add(name);
|
|
4435
|
+
};
|
|
4436
|
+
for (const entry of quoted)
|
|
4437
|
+
place(entry.name, entry.index, entry.tail);
|
|
4438
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
4439
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
4440
|
+
for (const match of identifiers) {
|
|
4441
|
+
const [, name, trailing] = match;
|
|
4442
|
+
if (trailing || reserved.has(name))
|
|
4443
|
+
continue;
|
|
4444
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
4445
|
+
}
|
|
4446
|
+
return {
|
|
4447
|
+
top: [...top],
|
|
4448
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
4449
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
4450
|
+
};
|
|
4451
|
+
}
|
|
4452
|
+
function appearsBelowTopLevel(data, name) {
|
|
4453
|
+
let budget = 2000;
|
|
4454
|
+
const visit = (value, depth) => {
|
|
4455
|
+
if (budget-- <= 0 || depth > 4)
|
|
4456
|
+
return false;
|
|
4457
|
+
if (value === null || typeof value !== "object")
|
|
4458
|
+
return false;
|
|
4459
|
+
if (Array.isArray(value))
|
|
4460
|
+
return value.some((entry) => visit(entry, depth));
|
|
4461
|
+
const record = value;
|
|
4462
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
4463
|
+
return true;
|
|
4464
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
4465
|
+
};
|
|
4466
|
+
return visit(data, 0);
|
|
4467
|
+
}
|
|
4468
|
+
function alwaysNullKeys(records) {
|
|
4469
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
4470
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
4471
|
+
return [];
|
|
4472
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
4473
|
+
if (keys.length === 0)
|
|
4474
|
+
return [];
|
|
4475
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
4476
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
4477
|
+
}
|
|
4478
|
+
function carriesOnlyNulls(value) {
|
|
4479
|
+
if (value === null)
|
|
4480
|
+
return true;
|
|
4481
|
+
if (Array.isArray(value)) {
|
|
4482
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
4483
|
+
}
|
|
4484
|
+
if (typeof value === "object" && value !== undefined) {
|
|
4485
|
+
const values = Object.values(value);
|
|
4486
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
4487
|
+
}
|
|
4488
|
+
return false;
|
|
4489
|
+
}
|
|
4490
|
+
function nameList(names, cap2 = 12) {
|
|
4491
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
4492
|
+
const rest = names.length - shown.length;
|
|
4493
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
4494
|
+
}
|
|
4495
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
4496
|
+
const present = availableFields(data);
|
|
4497
|
+
const refs = referencedFields(filter);
|
|
4498
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
4499
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
4500
|
+
const count = countRecords(data);
|
|
4501
|
+
const scope = `${count} record(s)`;
|
|
4502
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
4503
|
+
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" : "";
|
|
4504
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
4505
|
+
let detail;
|
|
4506
|
+
let lede;
|
|
4507
|
+
if (outcome.kind === "null-elements") {
|
|
4508
|
+
lede = "returned only null values";
|
|
4509
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
4510
|
+
if (unknown.length > 0) {
|
|
4511
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4512
|
+
} else if (unchecked.length > 0) {
|
|
4513
|
+
detail = withSoundness(projected);
|
|
4514
|
+
} else {
|
|
4515
|
+
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`;
|
|
4516
|
+
}
|
|
4517
|
+
} else if (outcome.kind === "null-rows") {
|
|
4518
|
+
lede = "returned only null values";
|
|
4519
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
4520
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
4521
|
+
} else if (outcome.kind === "null-values") {
|
|
4522
|
+
lede = "returned only null values";
|
|
4523
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
4524
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
4525
|
+
if (sameSet) {
|
|
4526
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
4527
|
+
} else if (unknown.length > 0) {
|
|
4528
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4529
|
+
} else {
|
|
4530
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
4531
|
+
}
|
|
4532
|
+
} else {
|
|
4533
|
+
lede = "returned nothing";
|
|
4534
|
+
if (unknown.length > 0) {
|
|
4535
|
+
detail = isNotAField(unknown);
|
|
4536
|
+
} else {
|
|
4537
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
4538
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
4542
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
4543
|
+
}
|
|
4544
|
+
function appendWarning(existing, note) {
|
|
4545
|
+
return existing ? `${existing} ${note}` : note;
|
|
4546
|
+
}
|
|
4547
|
+
function applyFilter(data, filter, onWarning) {
|
|
4390
4548
|
const codec = requireJmespath();
|
|
4391
4549
|
let result;
|
|
4392
4550
|
try {
|
|
@@ -4394,9 +4552,34 @@ function applyFilter(data, filter) {
|
|
|
4394
4552
|
} catch (err) {
|
|
4395
4553
|
throw new FilterEvaluationError(filter, err);
|
|
4396
4554
|
}
|
|
4397
|
-
|
|
4555
|
+
const inputCount = countRecords(data);
|
|
4556
|
+
const warn = (outcome) => {
|
|
4557
|
+
if (inputCount === 0)
|
|
4558
|
+
return;
|
|
4559
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
4560
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
4561
|
+
`);
|
|
4562
|
+
onWarning?.(note);
|
|
4563
|
+
};
|
|
4564
|
+
const warnIfAllNull = (records) => {
|
|
4565
|
+
const keys = alwaysNullKeys(records);
|
|
4566
|
+
if (keys.length > 0)
|
|
4567
|
+
warn({ kind: "null-values", keys });
|
|
4568
|
+
};
|
|
4569
|
+
if (result == null) {
|
|
4570
|
+
warn({ kind: "empty" });
|
|
4398
4571
|
return [];
|
|
4572
|
+
}
|
|
4399
4573
|
if (Array.isArray(result)) {
|
|
4574
|
+
if (result.length === 0) {
|
|
4575
|
+
warn({ kind: "empty" });
|
|
4576
|
+
} else if (result.every((entry) => entry === null)) {
|
|
4577
|
+
warn({ kind: "null-elements", count: result.length });
|
|
4578
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
4579
|
+
warn({ kind: "null-rows", count: result.length });
|
|
4580
|
+
} else {
|
|
4581
|
+
warnIfAllNull(result);
|
|
4582
|
+
}
|
|
4400
4583
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
4401
4584
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
4402
4585
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -4404,10 +4587,30 @@ function applyFilter(data, filter) {
|
|
|
4404
4587
|
}
|
|
4405
4588
|
return result;
|
|
4406
4589
|
}
|
|
4407
|
-
if (typeof result === "object")
|
|
4590
|
+
if (typeof result === "object") {
|
|
4591
|
+
warnIfAllNull([result]);
|
|
4408
4592
|
return result;
|
|
4593
|
+
}
|
|
4409
4594
|
return { Value: result };
|
|
4410
4595
|
}
|
|
4596
|
+
function filterFailureData(envelope) {
|
|
4597
|
+
const filter = getOutputFilter();
|
|
4598
|
+
const data = envelope.Data;
|
|
4599
|
+
if (!filter || data == null)
|
|
4600
|
+
return;
|
|
4601
|
+
let note;
|
|
4602
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
4603
|
+
note = n;
|
|
4604
|
+
}));
|
|
4605
|
+
if (filterError) {
|
|
4606
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
4607
|
+
return;
|
|
4608
|
+
}
|
|
4609
|
+
envelope.Data = filtered;
|
|
4610
|
+
if (note) {
|
|
4611
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4411
4614
|
function defaultErrorCodeForResult(result) {
|
|
4412
4615
|
switch (result) {
|
|
4413
4616
|
case RESULTS.AuthenticationError:
|
|
@@ -4490,8 +4693,14 @@ var OutputFormatter;
|
|
|
4490
4693
|
}
|
|
4491
4694
|
const filter = getOutputFilter();
|
|
4492
4695
|
if (filter) {
|
|
4493
|
-
|
|
4696
|
+
let note;
|
|
4697
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
4698
|
+
note = n;
|
|
4699
|
+
});
|
|
4494
4700
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
4701
|
+
if (note) {
|
|
4702
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
4703
|
+
}
|
|
4495
4704
|
}
|
|
4496
4705
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4497
4706
|
}
|
|
@@ -4519,6 +4728,7 @@ var OutputFormatter;
|
|
|
4519
4728
|
delete envelope.TelemetryErrorClass;
|
|
4520
4729
|
delete envelope.TelemetryTerminalOutcome;
|
|
4521
4730
|
delete envelope.TelemetryTerminalSignal;
|
|
4731
|
+
filterFailureData(envelope);
|
|
4522
4732
|
if (!suppressTelemetry) {
|
|
4523
4733
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
4524
4734
|
result: data.Result,
|
|
@@ -4567,13 +4777,20 @@ var OutputFormatter;
|
|
|
4567
4777
|
OutputFormatter.log = log;
|
|
4568
4778
|
function formatToString(data) {
|
|
4569
4779
|
const filter = getOutputFilter();
|
|
4780
|
+
const envelope = data;
|
|
4570
4781
|
if ("Data" in data && data.Data != null) {
|
|
4571
4782
|
data.Data = normalizeDataKeys(data.Data);
|
|
4572
4783
|
if (filter) {
|
|
4573
|
-
|
|
4784
|
+
let note;
|
|
4785
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
4786
|
+
note = n;
|
|
4787
|
+
}));
|
|
4788
|
+
if (note) {
|
|
4789
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4790
|
+
}
|
|
4574
4791
|
}
|
|
4575
4792
|
}
|
|
4576
|
-
const output = normalizeOutputKeys(
|
|
4793
|
+
const output = normalizeOutputKeys(envelope);
|
|
4577
4794
|
const lines = [];
|
|
4578
4795
|
const sink = getOutputSink();
|
|
4579
4796
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -7523,4 +7740,4 @@ var codedAgentCommandPreflight = ({
|
|
|
7523
7740
|
|
|
7524
7741
|
export { getFileSystem, catchError, extractErrorMessageSync, RESULTS, OutputFormatter, Command, processContext, trackShipSucceeded, runUipathPythonCommand, createExecuteCommand, createSetupCommand, WHITELISTED_COMMANDS, COMMAND_RULES, codedAgentCommandPreflight };
|
|
7525
7742
|
|
|
7526
|
-
//# debugId=
|
|
7743
|
+
//# debugId=FC36B1B2E608627564756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/codedagent-tool",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "1.202.1-preview.
|
|
4
|
+
"version": "1.202.1-preview.238",
|
|
5
5
|
"description": "Build, run, deploy, and manage AI Agents.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"cli-tool",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"registry": "https://registry.npmjs.org/"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "537e43df1d3583633cfd3a0b88634f9ce3ba9d6b"
|
|
36
36
|
}
|