@uipath/common 1.199.0 → 1.201.0-preview.115

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.
@@ -0,0 +1,6 @@
1
+ import { Command } from "commander";
2
+ import "./command-examples";
3
+ import "./preview";
4
+ import "./trackedAction.js";
5
+ /** Install Common's Commander augmentations on a caller-owned constructor. */
6
+ export declare function installCommandExtensions(commandConstructor: typeof Command): void;
@@ -142,6 +142,9 @@ export declare function escapeNonAscii(jsonText: string): string;
142
142
  * successfully can still throw at evaluation time (e.g. type-coercion errors
143
143
  * when functions receive unexpected types). Callers that need a fully
144
144
  * closed-box guarantee must additionally wrap {@link applyFilter}.
145
+ *
146
+ * Requires `loadOutputCodecsAsync({ filter: true })` to have run — the CLI
147
+ * host awaits it immediately before calling this.
145
148
  */
146
149
  export declare function validateOutputFilter(filter: string): Error | null;
147
150
  /**
@@ -164,6 +167,25 @@ export declare class FilterEvaluationError extends Error {
164
167
  readonly result: FailureResultType;
165
168
  constructor(filter: string, cause: unknown);
166
169
  }
170
+ /**
171
+ * Thrown by `trackedAction` when `--output-filter` is combined with a command
172
+ * whose `--limit` resolved from its declared default instead of the command
173
+ * line. The filter runs client-side over only the records the command fetched,
174
+ * so an implicit limit would silently cap the data being filtered — the caller
175
+ * must state how much data the filter applies to.
176
+ *
177
+ * Uses a duck-type `__brand` rather than relying on `instanceof`, because each
178
+ * tool bundles its own copy of `@uipath/common` and class identity differs
179
+ * across bundle boundaries.
180
+ */
181
+ export declare class FilterImplicitLimitError extends Error {
182
+ readonly __brand: "FilterImplicitLimitError";
183
+ readonly errorCode: CliErrorCode;
184
+ readonly instructions: string;
185
+ readonly retry: RetryHint;
186
+ readonly result: FailureResultType;
187
+ constructor(defaultLimit: string);
188
+ }
167
189
  /**
168
190
  * OutputFormatter namespace for formatting and displaying output.
169
191
  */
package/dist/guid.js ADDED
@@ -0,0 +1,10 @@
1
+ // src/guid.ts
2
+ var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
+ function isGuid(value) {
4
+ return GUID_REGEX.test(value);
5
+ }
6
+ export {
7
+ isGuid
8
+ };
9
+
10
+ //# debugId=F25023E1915C1B3664756E2164756E21
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Global options the CLI host owns. It parses them out of argv before
3
+ * Commander runs (`stripGlobalOptions` in `packages/cli/src/utils/globalOptions.ts`)
4
+ * so tools never have to define them.
5
+ *
6
+ * The host cleans `context.args` only — `process.argv` keeps the raw tokens. A
7
+ * tool that re-reads `process.argv` therefore still sees these, and must strip
8
+ * them itself before forwarding. `function-tool`'s passthrough does exactly
9
+ * that: it reads raw argv on purpose, so unknown flags reach the downstream
10
+ * CLI verbatim, which means the host's own options would reach it too and be
11
+ * rejected as unknown options.
12
+ *
13
+ * Adding a global option to the host means adding it here as well;
14
+ * `globalOptions.spec.ts` fails if the two drift apart.
15
+ */
16
+ /** Host options that consume a following value (`--flag v` / `--flag=v`). */
17
+ export declare const HOST_GLOBAL_OPTIONS_WITH_VALUE: readonly ["--output", "--output-filter", "--log-level", "--log-file", "--profile"];
18
+ /** Host options that take no value. */
19
+ export declare const HOST_GLOBAL_FLAGS: readonly ["--json", "--interactive", "--no-interactive"];
20
+ /**
21
+ * Drop every host-owned global option from `args`, returning the rest
22
+ * untouched. Handles both `--flag value` and `--flag=value`; unrelated flags
23
+ * are always preserved, since a passthrough tool must forward what it does not
24
+ * own.
25
+ */
26
+ export declare function stripHostGlobalOptions(args: string[]): string[];
@@ -21223,6 +21223,9 @@ async function extractErrorDetails(error, options) {
21223
21223
  if (!extractedMessage) {
21224
21224
  extractedMessage = body;
21225
21225
  }
21226
+ if (extractedMessage && typeof parsedBody.detail === "string" && parsedBody.detail.length > 0 && !extractedMessage.includes(parsedBody.detail)) {
21227
+ extractedMessage = `${extractedMessage}: ${parsedBody.detail}`;
21228
+ }
21226
21229
  } else {
21227
21230
  extractedMessage = isHtmlDocument(body) ? HTML_RESPONSE_MESSAGE : body;
21228
21231
  }
@@ -21277,6 +21280,8 @@ async function extractErrorDetails(error, options) {
21277
21280
  const extra = {};
21278
21281
  if (parsedBody.errorCode)
21279
21282
  extra.errorCode = parsedBody.errorCode;
21283
+ if (parsedBody.detail)
21284
+ extra.detail = parsedBody.detail;
21280
21285
  if (parsedBody.details)
21281
21286
  extra.details = parsedBody.details;
21282
21287
  if (parsedBody.errors != null)
@@ -22254,9 +22259,15 @@ var FAILURE_STATUSES = new Set([
22254
22259
  "stopped"
22255
22260
  ]);
22256
22261
  function isTerminalStatus(status) {
22262
+ if (typeof status !== "string") {
22263
+ return false;
22264
+ }
22257
22265
  return TERMINAL_STATUSES.has(status.toLowerCase());
22258
22266
  }
22259
22267
  function isFailureStatus(status) {
22268
+ if (typeof status !== "string") {
22269
+ return false;
22270
+ }
22260
22271
  return FAILURE_STATUSES.has(status.toLowerCase());
22261
22272
  }
22262
22273
  function isSuccessStatus(status) {
@@ -22479,7 +22490,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
22479
22490
  ["agents", "build", ["uip.codedagent", "uip.agent"]],
22480
22491
  ["agenthub", "build", ["uip.agenthub"]],
22481
22492
  ["coded-apps", "build", ["uip.codedapp"]],
22482
- ["functions", "build", ["uip.functions"]],
22493
+ ["functions", "build", ["uip.function", "uip.functions"]],
22483
22494
  ["solution", "build", ["uip.solution"]],
22484
22495
  ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
22485
22496
  ["llm-observability", "troubleshoot", ["uip.traces"]],
@@ -22915,7 +22926,7 @@ function getTelemetryOperationId() {
22915
22926
  // src/telemetry/telemetry-events.ts
22916
22927
  var CommonTelemetryEvents = {
22917
22928
  Error: "uip.error",
22918
- ShipSucceeded: "ship_succeeded"
22929
+ ShipSucceeded: "uip.ship.succeeded"
22919
22930
  };
22920
22931
  // src/telemetry/detect-agent.ts
22921
22932
  var KNOWN_AGENTS = [
@@ -23278,14 +23289,11 @@ class TelemetryService {
23278
23289
  }
23279
23290
  async trackDependencyOperation(name, type, fn, properties) {
23280
23291
  const parentContext = this.getCurrentContext();
23281
- if (!parentContext) {
23282
- throw new Error("trackDependencyOperation must be called within a trackRequest block.");
23283
- }
23284
- const childContext = {
23292
+ const childContext = parentContext !== undefined ? {
23285
23293
  operationId: parentContext.operationId,
23286
23294
  parentId: parentContext.id,
23287
23295
  id: this.generateId()
23288
- };
23296
+ } : this.createRequestContext();
23289
23297
  const startTime = performance.now();
23290
23298
  try {
23291
23299
  const result = await this.contextStorage.run(childContext, fn);
@@ -23333,22 +23341,80 @@ class TelemetryService {
23333
23341
  return hex;
23334
23342
  }
23335
23343
  }
23344
+ // src/packager-tool-import.ts
23345
+ var REGISTER_EXPORT = "registerPackagerFactories";
23346
+ async function importPackagerTool(specifier) {
23347
+ const [importError, mod] = await catchError(import(specifier));
23348
+ if (importError)
23349
+ return importError;
23350
+ const register = mod?.[REGISTER_EXPORT];
23351
+ if (typeof register !== "function") {
23352
+ logger.debug(`'${specifier}' has no '${REGISTER_EXPORT}' export — treating it as a ` + "legacy entry point that registered its factories at import.");
23353
+ return;
23354
+ }
23355
+ const [registerError] = catchError(() => {
23356
+ register();
23357
+ });
23358
+ return registerError;
23359
+ }
23360
+
23361
+ // src/tool-module-import.ts
23362
+ async function importToolModule(specifier) {
23363
+ return await import(specifier);
23364
+ }
23365
+
23336
23366
  // src/tool-provider.ts
23337
23367
  var factorySlot = singleton("PackagerFactoryProvider");
23338
23368
  function setPackagerFactoryProvider(provider) {
23339
23369
  factorySlot.set(provider);
23340
23370
  }
23341
- async function ensurePackagerFactory(verb) {
23371
+ var moduleSlot = singleton("ToolModuleProvider");
23372
+ function setToolModuleProvider(provider) {
23373
+ moduleSlot.set(provider);
23374
+ }
23375
+ async function ensureToolModule(verb, packageName, moduleName) {
23376
+ if (!/^[a-z0-9-]+$/.test(moduleName)) {
23377
+ throw new Error(`Invalid tool module name '${moduleName}'.`);
23378
+ }
23379
+ const provider = moduleSlot.get();
23380
+ if (provider) {
23381
+ return provider(verb, moduleName);
23382
+ }
23383
+ const specifier = `${packageName}/${moduleName}`;
23384
+ const [importError, mod] = await catchError(importToolModule(specifier));
23385
+ if (importError) {
23386
+ logger.debug(`No tool-module provider registered; import of '${specifier}' failed: ${importError.message}`);
23387
+ throw new Error(`This command needs '${packageName}'. Install it.`, {
23388
+ cause: importError
23389
+ });
23390
+ }
23391
+ return mod;
23392
+ }
23393
+ async function ensurePackagerFactory(verb, packageName) {
23342
23394
  const provider = factorySlot.get();
23343
- if (!provider) {
23344
- throw new Error(`Packager factory for '${verb}' is required but no factory provider is registered. ` + `Run 'uip tools install ${verb}' manually.`);
23395
+ if (provider) {
23396
+ await provider(verb);
23397
+ return;
23398
+ }
23399
+ const importError = packageName ? await loadPackagerTool(`${packageName}/packager-tool`) : undefined;
23400
+ if (packageName && !importError)
23401
+ return;
23402
+ throw new Error(packageName ? `Packing this project type needs '${packageName}'. Install it.` : `Packing this project type needs the packager factory for '${verb}', and no package provides it.`, { cause: importError });
23403
+ }
23404
+ async function loadPackagerTool(specifier) {
23405
+ const error = await importPackagerTool(specifier);
23406
+ if (error) {
23407
+ logger.debug(`No packager factory provider registered; import of '${specifier}' failed: ${error.message}`);
23408
+ return error;
23345
23409
  }
23346
- await provider(verb);
23410
+ logger.debug(`No packager factory provider registered; loaded '${specifier}' directly.`);
23411
+ return;
23347
23412
  }
23348
23413
  export {
23349
23414
  withCompleter,
23350
23415
  takeRecordedCommandFailureTelemetry,
23351
23416
  singleton,
23417
+ setToolModuleProvider,
23352
23418
  setSdkUserAgentHostToken,
23353
23419
  setPackagerFactoryProvider,
23354
23420
  setOutputFormatExplicit,
@@ -23404,6 +23470,7 @@ export {
23404
23470
  extractErrorMessage,
23405
23471
  extractErrorDetails,
23406
23472
  extractCommandHelp,
23473
+ ensureToolModule,
23407
23474
  ensurePackagerFactory,
23408
23475
  describeConnectivityError,
23409
23476
  createPollAbortController,
@@ -23443,4 +23510,4 @@ export {
23443
23510
  AUTH_FILENAME
23444
23511
  };
23445
23512
 
23446
- //# debugId=04886234C3E93F8264756E2164756E21
23513
+ //# debugId=C2BB3B73AD55AF7D64756E2164756E21
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./attachment-binding";
2
2
  export * from "./body-validators";
3
3
  export * from "./catch-error";
4
4
  export * from "./command-examples";
5
+ export * from "./command-extensions";
5
6
  export * from "./command-help";
6
7
  export * from "./command-walker";
7
8
  export * from "./completer";
@@ -14,21 +15,26 @@ export * from "./error-handler";
14
15
  export * from "./error-instructions";
15
16
  export * from "./formatter";
16
17
  export * from "./guid";
18
+ export * from "./host-global-options";
17
19
  export * from "./interactivity-context";
18
20
  export * from "./logger";
19
21
  export * from "./option-aliases";
20
22
  export * from "./option-validators";
21
23
  export * from "./orchestrator-urls";
24
+ export * from "./output-codecs";
22
25
  export * from "./output-context";
23
26
  export * from "./output-format-context";
24
27
  export * from "./output-sink";
25
28
  export * from "./package-metadata-options";
29
+ export { type PackagerToolModule, REGISTER_EXPORT, } from "./packager-tool-import";
26
30
  export * from "./polling";
27
31
  export * from "./preview";
28
32
  export * from "./registry";
29
33
  export * from "./screen-logger";
30
34
  export * from "./sdk-user-agent";
31
35
  export * from "./singleton";
36
+ export * from "./solution-project-artifacts";
37
+ export * from "./solution-project-types";
32
38
  export * from "./stdin";
33
39
  export { BrowserContextStorage } from "./telemetry/browser-context-storage.js";
34
40
  export * from "./telemetry/command-attribution.js";
@@ -37,8 +43,10 @@ export { ConsoleTelemetryProvider } from "./telemetry/console-telemetry-provider
37
43
  export * from "./telemetry/node.js";
38
44
  export { setGlobalTelemetryProperties } from "./telemetry/node-appinsights-telemetry-provider.js";
39
45
  export { redactError, redactProperties, redactProperty, redactValue, } from "./telemetry/pii-redactor.js";
46
+ export { getProxyAuthHttpsAgent, setProxyAuthHttpsAgent, } from "./telemetry/proxy-http-agent.js";
40
47
  export { type ShipSucceededTelemetryPayload, trackShipSucceeded, } from "./telemetry/ship-succeeded.js";
41
48
  export * from "./telemetry/telemetry-events.js";
42
49
  export * from "./telemetry/telemetry-init.js";
50
+ export * from "./telemetry/telemetry-spool.js";
43
51
  export * from "./tool-provider";
44
52
  export * from "./trackedAction.js";