@uipath/codedagent-tool 1.203.0-preview.233 → 1.203.0-preview.237

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
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  metadata,
4
4
  registerCommands
5
- } from "./tool-3g0zdcsm.js";
5
+ } from "./tool-5ts7hq90.js";
6
6
  import {
7
7
  Command
8
- } from "./tool-etst5h2w.js";
8
+ } from "./tool-tfmtkjk7.js";
9
9
  import"./tool-1de529jm.js";
10
10
 
11
11
  // src/index.ts
package/dist/init.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  COMMAND_RULES,
3
3
  codedAgentCommandPreflight,
4
4
  runUipathPythonCommand
5
- } from "./tool-etst5h2w.js";
5
+ } from "./tool-tfmtkjk7.js";
6
6
  import"./tool-1de529jm.js";
7
7
 
8
8
  // src/services/codedagent-init-service.ts
@@ -11,7 +11,7 @@ import {
11
11
  getFileSystem,
12
12
  processContext,
13
13
  trackShipSucceeded
14
- } from "./tool-etst5h2w.js";
14
+ } from "./tool-tfmtkjk7.js";
15
15
  import {
16
16
  __require
17
17
  } from "./tool-1de529jm.js";
@@ -20,7 +20,7 @@ var package_default = {
20
20
  name: "@uipath/codedagent-tool",
21
21
  author: "UiPath",
22
22
  license: "SEE LICENSE IN LICENSE.txt",
23
- version: "1.203.0-preview.233",
23
+ version: "1.203.0-preview.237",
24
24
  description: "Build, run, deploy, and manage AI Agents.",
25
25
  keywords: [
26
26
  "cli-tool",
@@ -3213,4 +3213,4 @@ var registerCommands = async (program) => {
3213
3213
 
3214
3214
  export { metadata, registerCommands };
3215
3215
 
3216
- //# debugId=C645BA6FD6D0E64364756E2164756E21
3216
+ //# debugId=E761A34A7180C02B64756E2164756E21
@@ -4615,7 +4615,165 @@ class FilterImplicitLimitError extends Error {
4615
4615
  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).";
4616
4616
  }
4617
4617
  }
4618
- function applyFilter(data, filter) {
4618
+ function countRecords(data) {
4619
+ if (Array.isArray(data))
4620
+ return data.length;
4621
+ return data == null ? 0 : 1;
4622
+ }
4623
+ function availableFields(data) {
4624
+ const records = Array.isArray(data) ? data : [data];
4625
+ const keys = new Set;
4626
+ for (const record of records) {
4627
+ if (record && typeof record === "object" && !Array.isArray(record)) {
4628
+ for (const key of Object.keys(record))
4629
+ keys.add(key);
4630
+ }
4631
+ }
4632
+ return [...keys];
4633
+ }
4634
+ function decodeQuotedIdentifier(whole, inner) {
4635
+ const [error, decoded] = catchError(() => JSON.parse(whole));
4636
+ if (!error && typeof decoded === "string")
4637
+ return decoded;
4638
+ return inner.replace(/\\(.)/g, "$1");
4639
+ }
4640
+ function referencedFields(filter) {
4641
+ const top = new Set;
4642
+ const nested = new Set;
4643
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
4644
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
4645
+ const quoted = [];
4646
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
4647
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
4648
+ if (!isAlias) {
4649
+ quoted.push({
4650
+ name: decodeQuotedIdentifier(whole, name),
4651
+ index,
4652
+ tail: isPathTail(withoutValueLiterals, index)
4653
+ });
4654
+ }
4655
+ return `"${" ".repeat(whole.length - 2)}"`;
4656
+ });
4657
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
4658
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
4659
+ const place = (name, index, tail) => {
4660
+ if (tail || index >= rootEnd)
4661
+ nested.add(name);
4662
+ else
4663
+ top.add(name);
4664
+ };
4665
+ for (const entry of quoted)
4666
+ place(entry.name, entry.index, entry.tail);
4667
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
4668
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
4669
+ for (const match of identifiers) {
4670
+ const [, name, trailing] = match;
4671
+ if (trailing || reserved.has(name))
4672
+ continue;
4673
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
4674
+ }
4675
+ return {
4676
+ top: [...top],
4677
+ nested: [...nested].filter((name) => !top.has(name)),
4678
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
4679
+ };
4680
+ }
4681
+ function appearsBelowTopLevel(data, name) {
4682
+ let budget = 2000;
4683
+ const visit = (value, depth) => {
4684
+ if (budget-- <= 0 || depth > 4)
4685
+ return false;
4686
+ if (value === null || typeof value !== "object")
4687
+ return false;
4688
+ if (Array.isArray(value))
4689
+ return value.some((entry) => visit(entry, depth));
4690
+ const record = value;
4691
+ if (depth > 0 && Object.hasOwn(record, name))
4692
+ return true;
4693
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
4694
+ };
4695
+ return visit(data, 0);
4696
+ }
4697
+ function alwaysNullKeys(records) {
4698
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
4699
+ if (objects.length === 0 || objects.length !== records.length)
4700
+ return [];
4701
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
4702
+ if (keys.length === 0)
4703
+ return [];
4704
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
4705
+ return nullKeys.length === keys.length ? nullKeys : [];
4706
+ }
4707
+ function carriesOnlyNulls(value) {
4708
+ if (value === null)
4709
+ return true;
4710
+ if (Array.isArray(value)) {
4711
+ return value.length > 0 && value.every(carriesOnlyNulls);
4712
+ }
4713
+ if (typeof value === "object" && value !== undefined) {
4714
+ const values = Object.values(value);
4715
+ return values.length > 0 && values.every(carriesOnlyNulls);
4716
+ }
4717
+ return false;
4718
+ }
4719
+ function nameList(names, cap2 = 12) {
4720
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
4721
+ const rest = names.length - shown.length;
4722
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
4723
+ }
4724
+ function buildFilterWarning(filter, data, outcome) {
4725
+ const present = availableFields(data);
4726
+ const refs = referencedFields(filter);
4727
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
4728
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
4729
+ const count = countRecords(data);
4730
+ const scope = `${count} record(s)`;
4731
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
4732
+ 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" : "";
4733
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
4734
+ let detail;
4735
+ let lede;
4736
+ if (outcome.kind === "null-elements") {
4737
+ lede = "returned only null values";
4738
+ const projected = `all ${outcome.count} of the elements it projected are null`;
4739
+ if (unknown.length > 0) {
4740
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4741
+ } else if (unchecked.length > 0) {
4742
+ detail = withSoundness(projected);
4743
+ } else {
4744
+ 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`;
4745
+ }
4746
+ } else if (outcome.kind === "null-rows") {
4747
+ lede = "returned only null values";
4748
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
4749
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
4750
+ } else if (outcome.kind === "null-values") {
4751
+ lede = "returned only null values";
4752
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
4753
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
4754
+ if (sameSet) {
4755
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
4756
+ } else if (unknown.length > 0) {
4757
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4758
+ } else {
4759
+ detail = withSoundness(`${projected} on all ${scope}`);
4760
+ }
4761
+ } else {
4762
+ lede = "returned nothing";
4763
+ if (unknown.length > 0) {
4764
+ detail = isNotAField(unknown);
4765
+ } else {
4766
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
4767
+ detail = withSoundness(`${selection} — it read ${scope}`);
4768
+ }
4769
+ }
4770
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
4771
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
4772
+ }
4773
+ function appendWarning(existing, note) {
4774
+ return existing ? `${existing} ${note}` : note;
4775
+ }
4776
+ function applyFilter(data, filter, onWarning) {
4619
4777
  const codec = requireJmespath();
4620
4778
  let result;
4621
4779
  try {
@@ -4623,9 +4781,34 @@ function applyFilter(data, filter) {
4623
4781
  } catch (err) {
4624
4782
  throw new FilterEvaluationError(filter, err);
4625
4783
  }
4626
- if (result == null)
4784
+ const inputCount = countRecords(data);
4785
+ const warn = (outcome) => {
4786
+ if (inputCount === 0)
4787
+ return;
4788
+ const note = buildFilterWarning(filter, data, outcome);
4789
+ getOutputSink().writeErr(`[WARN] ${note}
4790
+ `);
4791
+ onWarning?.(note);
4792
+ };
4793
+ const warnIfAllNull = (records) => {
4794
+ const keys = alwaysNullKeys(records);
4795
+ if (keys.length > 0)
4796
+ warn({ kind: "null-values", keys });
4797
+ };
4798
+ if (result == null) {
4799
+ warn({ kind: "empty" });
4627
4800
  return [];
4801
+ }
4628
4802
  if (Array.isArray(result)) {
4803
+ if (result.length === 0) {
4804
+ warn({ kind: "empty" });
4805
+ } else if (result.every((entry) => entry === null)) {
4806
+ warn({ kind: "null-elements", count: result.length });
4807
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
4808
+ warn({ kind: "null-rows", count: result.length });
4809
+ } else {
4810
+ warnIfAllNull(result);
4811
+ }
4629
4812
  if (result.length > 0 && typeof result[0] !== "object") {
4630
4813
  const fieldMatch = filter.match(/\.(\w+)$/);
4631
4814
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -4633,10 +4816,30 @@ function applyFilter(data, filter) {
4633
4816
  }
4634
4817
  return result;
4635
4818
  }
4636
- if (typeof result === "object")
4819
+ if (typeof result === "object") {
4820
+ warnIfAllNull([result]);
4637
4821
  return result;
4822
+ }
4638
4823
  return { Value: result };
4639
4824
  }
4825
+ function filterFailureData(envelope) {
4826
+ const filter = getOutputFilter();
4827
+ const data = envelope.Data;
4828
+ if (!filter || data == null)
4829
+ return;
4830
+ let note;
4831
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
4832
+ note = n;
4833
+ }));
4834
+ if (filterError) {
4835
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
4836
+ return;
4837
+ }
4838
+ envelope.Data = filtered;
4839
+ if (note) {
4840
+ envelope.Warning = appendWarning(envelope.Warning, note);
4841
+ }
4842
+ }
4640
4843
  function defaultErrorCodeForResult(result) {
4641
4844
  switch (result) {
4642
4845
  case RESULTS.AuthenticationError:
@@ -4719,8 +4922,14 @@ var OutputFormatter;
4719
4922
  }
4720
4923
  const filter = getOutputFilter();
4721
4924
  if (filter) {
4722
- const filtered = applyFilter(data.Data, filter);
4925
+ let note;
4926
+ const filtered = applyFilter(data.Data, filter, (n) => {
4927
+ note = n;
4928
+ });
4723
4929
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
4930
+ if (note) {
4931
+ data.Warning = appendWarning(data.Warning, note);
4932
+ }
4724
4933
  }
4725
4934
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
4726
4935
  }
@@ -4748,6 +4957,7 @@ var OutputFormatter;
4748
4957
  delete envelope.TelemetryErrorClass;
4749
4958
  delete envelope.TelemetryTerminalOutcome;
4750
4959
  delete envelope.TelemetryTerminalSignal;
4960
+ filterFailureData(envelope);
4751
4961
  if (!suppressTelemetry) {
4752
4962
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
4753
4963
  result: data.Result,
@@ -4796,13 +5006,20 @@ var OutputFormatter;
4796
5006
  OutputFormatter.log = log;
4797
5007
  function formatToString(data) {
4798
5008
  const filter = getOutputFilter();
5009
+ const envelope = data;
4799
5010
  if ("Data" in data && data.Data != null) {
4800
5011
  data.Data = normalizeDataKeys(data.Data);
4801
5012
  if (filter) {
4802
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5013
+ let note;
5014
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5015
+ note = n;
5016
+ }));
5017
+ if (note) {
5018
+ envelope.Warning = appendWarning(envelope.Warning, note);
5019
+ }
4803
5020
  }
4804
5021
  }
4805
- const output = normalizeOutputKeys(data);
5022
+ const output = normalizeOutputKeys(envelope);
4806
5023
  const lines = [];
4807
5024
  const sink = getOutputSink();
4808
5025
  printOutput(output, getOutputFormat(), (msg) => {
@@ -7845,4 +8062,4 @@ var codedAgentCommandPreflight = ({
7845
8062
 
7846
8063
  export { getFileSystem, catchError, extractErrorMessageSync, RESULTS, OutputFormatter, Command, processContext, trackShipSucceeded, runUipathPythonCommand, createExecuteCommand, createSetupCommand, WHITELISTED_COMMANDS, COMMAND_RULES, codedAgentCommandPreflight };
7847
8064
 
7848
- //# debugId=56087E0307A4B44B64756E2164756E21
8065
+ //# debugId=9C9BC5114B5D8F3464756E2164756E21
package/dist/tool.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-3g0zdcsm.js";
5
- import"./tool-etst5h2w.js";
4
+ } from "./tool-5ts7hq90.js";
5
+ import"./tool-tfmtkjk7.js";
6
6
  import"./tool-1de529jm.js";
7
7
  export {
8
8
  metadata,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/codedagent-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.233",
5
+ "version": "1.203.0-preview.237",
6
6
  "description": "Build, run, deploy, and manage AI Agents.",
7
7
  "keywords": [
8
8
  "cli-tool",
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "registry": "https://registry.npmjs.org/"
35
35
  },
36
- "gitHead": "641614a6f9817662baaf51dabdebbfa2a9334b1b"
36
+ "gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
37
37
  }