@uipath/coder-tool 1.202.1 → 1.203.0-preview.180

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
@@ -4,7 +4,7 @@ import {
4
4
  metadata,
5
5
  registerCommands,
6
6
  setPreviewBuild
7
- } from "./tool-cb1mxew3.js";
7
+ } from "./tool-2s48b13n.js";
8
8
  import"./tool-1de529jm.js";
9
9
 
10
10
  // src/index.ts
@@ -2609,7 +2609,7 @@ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
2609
2609
  var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
2610
2610
  var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
2611
2611
  var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
2612
- var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2612
+ var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2613
2613
  var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
2614
2614
  var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
2615
2615
  var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
@@ -2656,7 +2656,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
2656
2656
  `(?<![A-Za-z0-9])"(?:[^\\
2657
2657
  ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
2658
2658
  ].join("|"), "g");
2659
- var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
2659
+ var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
2660
2660
  var COLLAPSED_BODY = "{…}";
2661
2661
  var COLLAPSED_BODY_MARKER = "\x01body\x01";
2662
2662
  var MAX_BODY_NESTING = 8;
@@ -2671,10 +2671,13 @@ function collapseJsonBodies(text) {
2671
2671
  }
2672
2672
  return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
2673
2673
  }
2674
- var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
2674
+ var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
2675
2675
  function peelTrailingPunctuation(match) {
2676
- const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
2677
- return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
2676
+ let end = match.length;
2677
+ while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
2678
+ end -= 1;
2679
+ }
2680
+ return [match.slice(0, end), match.slice(end)];
2678
2681
  }
2679
2682
  function redactUrl(raw) {
2680
2683
  try {
@@ -3376,7 +3379,8 @@ function readRegistryValue(keyPath, valueName) {
3376
3379
  }
3377
3380
  const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3378
3381
  encoding: "utf-8",
3379
- stdio: ["pipe", "pipe", "pipe"]
3382
+ stdio: ["pipe", "pipe", "pipe"],
3383
+ windowsHide: true
3380
3384
  }));
3381
3385
  if (error) {
3382
3386
  return "";
@@ -4058,28 +4062,32 @@ function isPlainRecord(value) {
4058
4062
  const prototype = Object.getPrototypeOf(value);
4059
4063
  return prototype === Object.prototype || prototype === null;
4060
4064
  }
4061
- function extractPagedRows(value) {
4065
+ function splitPagedEnvelope(value) {
4062
4066
  if (Array.isArray(value) || !isPlainRecord(value))
4063
4067
  return null;
4064
- const entries = Object.values(value);
4068
+ const entries = Object.entries(value);
4065
4069
  if (entries.length === 0)
4066
4070
  return null;
4067
- let rows = null;
4068
- let hasScalarSibling = false;
4069
- for (const entry of entries) {
4071
+ let found = null;
4072
+ const meta = Object.create(null);
4073
+ for (const [key, entry] of entries) {
4070
4074
  if (Array.isArray(entry)) {
4071
- if (rows !== null)
4075
+ if (found !== null)
4072
4076
  return null;
4073
- rows = entry;
4077
+ found = { key, rows: entry };
4074
4078
  } else if (entry !== null && typeof entry === "object") {
4075
4079
  return null;
4076
4080
  } else {
4077
- hasScalarSibling = true;
4081
+ meta[key] = entry;
4078
4082
  }
4079
4083
  }
4080
- if (rows === null || !hasScalarSibling)
4084
+ if (found === null || Object.keys(meta).length === 0)
4081
4085
  return null;
4082
- return rows;
4086
+ return { ...found, meta };
4087
+ }
4088
+ function extractPagedRows(value) {
4089
+ const paged = splitPagedEnvelope(value);
4090
+ return paged === null ? null : paged.rows;
4083
4091
  }
4084
4092
  function toLowerCamelCaseKey(key) {
4085
4093
  if (!key)
@@ -4183,6 +4191,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
4183
4191
  }
4184
4192
  break;
4185
4193
  }
4194
+ case "markdown":
4195
+ logFn(renderMarkdown(data));
4196
+ break;
4186
4197
  default: {
4187
4198
  const hasData = "Data" in data && data.Data != null;
4188
4199
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
@@ -4207,6 +4218,10 @@ function logOutput(data, format = "json", tableRowStyle) {
4207
4218
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
4208
4219
  `), needsAsciiSafeJson(sink), styleFn);
4209
4220
  }
4221
+ var PLUMBING_KEYS = new Set(["code", "log"]);
4222
+ function isPlumbingKey(key) {
4223
+ return PLUMBING_KEYS.has(key.toLowerCase());
4224
+ }
4210
4225
  function cellToString(val) {
4211
4226
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
4212
4227
  }
@@ -4222,7 +4237,7 @@ function wrapText(text, width) {
4222
4237
  function printTable(data, logFn, externalLogValue, tableRowStyle) {
4223
4238
  if (data.length === 0)
4224
4239
  return;
4225
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4240
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4226
4241
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
4227
4242
  const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
4228
4243
  logFn(header);
@@ -4244,7 +4259,7 @@ function isNonEmptyPlainObject(value) {
4244
4259
  }
4245
4260
  var NESTED_INDENT = " ";
4246
4261
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
4247
- const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4262
+ const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
4248
4263
  if (keys.length === 0)
4249
4264
  return;
4250
4265
  const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
@@ -4275,7 +4290,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
4275
4290
  function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
4276
4291
  if (data.length === 0)
4277
4292
  return;
4278
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4293
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4279
4294
  if (keys.length === 0)
4280
4295
  return;
4281
4296
  if (!process.stdout.isTTY) {
@@ -4349,6 +4364,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4349
4364
  logFn(`Log: ${externalLogValue}`);
4350
4365
  }
4351
4366
  }
4367
+ var MARKDOWN_MAX_CELL = 200;
4368
+ var MARKDOWN_MAX_DEPTH = 3;
4369
+ function markdownHeading(depth) {
4370
+ return "#".repeat(Math.min(3 + depth, 6));
4371
+ }
4372
+ var BACKTICK_RUN = /`+/g;
4373
+ function fencedBlock(text) {
4374
+ const first = text.trimStart()[0];
4375
+ const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
4376
+ const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
4377
+ const fence = "`".repeat(Math.max(3, longestRun + 1));
4378
+ return `${fence}${language}
4379
+ ${text}
4380
+ ${fence}`;
4381
+ }
4382
+ function collapseNewlineRuns(text) {
4383
+ return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
4384
+ `) ? " " : part).join("");
4385
+ }
4386
+ function markdownCell(value) {
4387
+ const text = value instanceof Date ? value.toISOString() : cellToString(value);
4388
+ return collapseNewlineRuns(text).replace(/\|/g, "\\|");
4389
+ }
4390
+ function markdownLabel(key) {
4391
+ return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
4392
+ }
4393
+ function withoutPlumbing(record) {
4394
+ const kept = Object.create(null);
4395
+ for (const [key, value] of Object.entries(record)) {
4396
+ if (!isPlumbingKey(key))
4397
+ kept[key] = value;
4398
+ }
4399
+ return kept;
4400
+ }
4401
+ function rowsWithoutPlumbing(rows) {
4402
+ return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
4403
+ }
4404
+ function markdownTable(rows) {
4405
+ const columns = [];
4406
+ const seen = new Set;
4407
+ for (const row of rows) {
4408
+ for (const key of Object.keys(row)) {
4409
+ if (!seen.has(key)) {
4410
+ seen.add(key);
4411
+ columns.push(key);
4412
+ }
4413
+ }
4414
+ }
4415
+ if (columns.length === 0)
4416
+ return null;
4417
+ const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
4418
+ if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
4419
+ return null;
4420
+ }
4421
+ return [
4422
+ `| ${columns.map(markdownLabel).join(" | ")} |`,
4423
+ `| ${columns.map(() => "---").join(" | ")} |`,
4424
+ ...cells.map((row) => `| ${row.join(" | ")} |`)
4425
+ ].join(`
4426
+ `);
4427
+ }
4428
+ function extractMessageSequence(rows) {
4429
+ const messages = [];
4430
+ for (const row of rows) {
4431
+ const message = extractSingleMessage(row);
4432
+ if (message === null)
4433
+ return null;
4434
+ messages.push(message);
4435
+ }
4436
+ return messages.join(`
4437
+
4438
+ `);
4439
+ }
4440
+ function markdownRows(rows, depth) {
4441
+ if (rows.length === 0)
4442
+ return "(none)";
4443
+ if (!isPlainObjectArray(rows)) {
4444
+ return rows.map((item) => `- ${markdownCell(item)}`).join(`
4445
+ `);
4446
+ }
4447
+ const prose = extractMessageSequence(rows);
4448
+ if (prose !== null)
4449
+ return prose;
4450
+ const table = markdownTable(rows);
4451
+ if (table !== null)
4452
+ return table;
4453
+ if (depth >= MARKDOWN_MAX_DEPTH) {
4454
+ return fencedBlock(JSON.stringify(rows, null, 2));
4455
+ }
4456
+ return rows.map((row, index) => [
4457
+ `${markdownHeading(depth)} ${index + 1}`,
4458
+ markdownObject(row, depth + 1)
4459
+ ].join(`
4460
+
4461
+ `)).join(`
4462
+
4463
+ `);
4464
+ }
4465
+ function markdownObject(obj, depth) {
4466
+ const scalars = [];
4467
+ const blocks = [];
4468
+ for (const [key, value] of Object.entries(obj)) {
4469
+ if (value === undefined)
4470
+ continue;
4471
+ const label = markdownLabel(key);
4472
+ if (Array.isArray(value)) {
4473
+ blocks.push(`${markdownHeading(depth)} ${label}
4474
+
4475
+ ${markdownRows(value, depth + 1)}`);
4476
+ } else if (isNonEmptyPlainObject(value)) {
4477
+ const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
4478
+ if (nested !== "") {
4479
+ blocks.push(`${markdownHeading(depth)} ${label}
4480
+
4481
+ ${nested}`);
4482
+ }
4483
+ } else if (typeof value === "string" && value.includes(`
4484
+ `)) {
4485
+ blocks.push(`**${label}:**
4486
+
4487
+ ${fencedBlock(value)}`);
4488
+ } else {
4489
+ scalars.push(`**${label}:** ${markdownCell(value)}`);
4490
+ }
4491
+ }
4492
+ const sections = scalars.length > 0 ? [scalars.join(`
4493
+ `)] : [];
4494
+ sections.push(...blocks);
4495
+ return sections.join(`
4496
+
4497
+ `);
4498
+ }
4499
+ function extractSingleMessage(payload) {
4500
+ if (!isPlainRecord(payload))
4501
+ return null;
4502
+ const keys = Object.keys(payload);
4503
+ if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
4504
+ return null;
4505
+ const value = payload[keys[0]];
4506
+ return typeof value === "string" ? value : null;
4507
+ }
4508
+ function markdownPayload(payload) {
4509
+ const message = extractSingleMessage(payload);
4510
+ if (message !== null)
4511
+ return message;
4512
+ if (Array.isArray(payload)) {
4513
+ return markdownRows(rowsWithoutPlumbing(payload), 0);
4514
+ }
4515
+ const visible = withoutPlumbing(payload);
4516
+ const paged = splitPagedEnvelope(visible);
4517
+ if (paged !== null) {
4518
+ const meta = markdownObject(paged.meta, 0);
4519
+ const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
4520
+
4521
+ ${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
4522
+ return meta === "" ? rows : `${meta}
4523
+
4524
+ ${rows}`;
4525
+ }
4526
+ return markdownObject(visible, 0);
4527
+ }
4528
+ function isPaginationWorthShowing(value) {
4529
+ if (typeof value !== "object" || value === null)
4530
+ return false;
4531
+ const page = value;
4532
+ return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
4533
+ }
4534
+ function markdownEnvelopeNotes(data) {
4535
+ const envelope = data;
4536
+ const notes = [];
4537
+ const warning = envelope.Warning;
4538
+ if (typeof warning === "string" && warning !== "") {
4539
+ notes.push(`> **Warning:** ${warning}`);
4540
+ }
4541
+ const instructions = envelope.Instructions;
4542
+ if (typeof instructions === "string" && instructions !== "") {
4543
+ notes.push(`> ${instructions}`);
4544
+ }
4545
+ const pagination = envelope.Pagination;
4546
+ if (isPaginationWorthShowing(pagination)) {
4547
+ const body = markdownObject(pagination, 1);
4548
+ if (body !== "") {
4549
+ notes.push(`${markdownHeading(0)} Pagination
4550
+
4551
+ ${body}`);
4552
+ }
4553
+ }
4554
+ const log = envelope.Log;
4555
+ if (typeof log === "string" && log !== "") {
4556
+ notes.push(`**Log:** ${log}`);
4557
+ }
4558
+ return notes;
4559
+ }
4560
+ function renderMarkdown(data) {
4561
+ if (data.Result !== RESULTS.Success) {
4562
+ const failure = data;
4563
+ const sections = [`**Failed:** ${failure.Message}`];
4564
+ if (failure.Data != null) {
4565
+ sections.push(markdownPayload(failure.Data));
4566
+ }
4567
+ if (failure.Instructions) {
4568
+ sections.push(`> ${failure.Instructions}`);
4569
+ }
4570
+ return sections.filter((section) => section !== "").join(`
4571
+
4572
+ `);
4573
+ }
4574
+ if (!("Data" in data) || data.Data == null) {
4575
+ return markdownObject(withoutPlumbing(data), 0);
4576
+ }
4577
+ return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
4578
+
4579
+ `);
4580
+ }
4352
4581
  function toYaml(data) {
4353
4582
  const codec = getYamlCodec();
4354
4583
  if (!codec) {
@@ -5305,8 +5534,9 @@ var factorySlot = singleton("PackagerFactoryProvider");
5305
5534
  // package.json
5306
5535
  var package_default = {
5307
5536
  name: "@uipath/coder-tool",
5537
+ author: "UiPath",
5308
5538
  license: "SEE LICENSE IN LICENSE.txt",
5309
- version: "1.202.1",
5539
+ version: "1.203.0-preview.180",
5310
5540
  description: "Interactive coding agent (Pi) with UiPath LLM Gateway and BYO provider support.",
5311
5541
  publishConfig: {
5312
5542
  registry: "https://npm.pkg.github.com/"
@@ -6114,16 +6344,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
6114
6344
  errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
6115
6345
  };
6116
6346
  };
6117
- var loadEnvFileAsync = async ({ envPath }) => {
6118
- const fs2 = getFileSystem();
6119
- const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
6120
- if (!await fs2.exists(absolutePath)) {
6121
- throw new Error(`Environment file not found: ${envPath}`);
6122
- }
6123
- const content = await fs2.readFile(absolutePath, "utf-8");
6124
- if (content === null) {
6125
- throw new Error(`Environment file not found: ${envPath}`);
6126
- }
6347
+ var parseEnvContent = (content) => {
6127
6348
  const env = {};
6128
6349
  for (const line of content.split(`
6129
6350
  `)) {
@@ -6144,6 +6365,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
6144
6365
  }
6145
6366
  return env;
6146
6367
  };
6368
+ var loadEnvFileAsync = async ({ envPath }) => {
6369
+ const fs2 = getFileSystem();
6370
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
6371
+ if (!await fs2.exists(absolutePath)) {
6372
+ throw new Error(`Environment file not found: ${envPath}`);
6373
+ }
6374
+ const content = await fs2.readFile(absolutePath, "utf-8");
6375
+ if (content === null) {
6376
+ throw new Error(`Environment file not found: ${envPath}`);
6377
+ }
6378
+ return parseEnvContent(content);
6379
+ };
6147
6380
  var saveEnvFileAsync = async ({
6148
6381
  envPath,
6149
6382
  data,
@@ -6861,4 +7094,4 @@ var registerCommands = async (program2) => {
6861
7094
 
6862
7095
  export { Command, setPreviewBuild, metadata, registerCommands };
6863
7096
 
6864
- //# debugId=A647B5E67C8D683A64756E2164756E21
7097
+ //# debugId=D174BA535F8832E464756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-cb1mxew3.js";
4
+ } from "./tool-2s48b13n.js";
5
5
  import"./tool-1de529jm.js";
6
6
  export {
7
7
  metadata,
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@uipath/coder-tool",
3
+ "author": "UiPath",
3
4
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.1",
5
+ "version": "1.203.0-preview.180",
5
6
  "description": "Interactive coding agent (Pi) with UiPath LLM Gateway and BYO provider support.",
6
7
  "publishConfig": {
7
8
  "registry": "https://registry.npmjs.org/"
@@ -20,5 +21,5 @@
20
21
  "dependencies": {
21
22
  "@earendil-works/pi-coding-agent": "^0.80.6"
22
23
  },
23
- "gitHead": "280b581b7893224d512dd194f47dd57243cc6a5c"
24
+ "gitHead": "4e0a51e3ab2c9d89afd3d35a7b087a7fa58133a0"
24
25
  }