@uipath/common 1.199.0 → 1.200.0-preview.117
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/formatter.d.ts +19 -0
- package/dist/guid.js +10 -0
- package/dist/host-global-options.d.ts +26 -0
- package/dist/index.browser.js +79 -12
- package/dist/index.d.ts +4 -0
- package/dist/index.js +419 -31
- package/dist/packager-tool-import.d.ts +28 -0
- package/dist/polling/terminal-statuses.d.ts +3 -3
- package/dist/solution-project-artifacts.d.ts +43 -0
- package/dist/telemetry/index.js +4 -7
- package/dist/telemetry/node-appinsights-telemetry-provider.d.ts +20 -0
- package/dist/telemetry/telemetry-events.d.ts +11 -1
- package/dist/telemetry/telemetry-init.d.ts +18 -3
- package/dist/telemetry/telemetry-service.d.ts +5 -0
- package/dist/telemetry/telemetry-spool.d.ts +68 -0
- package/dist/tool-module-import.d.ts +9 -0
- package/dist/tool-provider.d.ts +34 -2
- package/package.json +6 -2
package/dist/formatter.d.ts
CHANGED
|
@@ -164,6 +164,25 @@ export declare class FilterEvaluationError extends Error {
|
|
|
164
164
|
readonly result: FailureResultType;
|
|
165
165
|
constructor(filter: string, cause: unknown);
|
|
166
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Thrown by `trackedAction` when `--output-filter` is combined with a command
|
|
169
|
+
* whose `--limit` resolved from its declared default instead of the command
|
|
170
|
+
* line. The filter runs client-side over only the records the command fetched,
|
|
171
|
+
* so an implicit limit would silently cap the data being filtered — the caller
|
|
172
|
+
* must state how much data the filter applies to.
|
|
173
|
+
*
|
|
174
|
+
* Uses a duck-type `__brand` rather than relying on `instanceof`, because each
|
|
175
|
+
* tool bundles its own copy of `@uipath/common` and class identity differs
|
|
176
|
+
* across bundle boundaries.
|
|
177
|
+
*/
|
|
178
|
+
export declare class FilterImplicitLimitError extends Error {
|
|
179
|
+
readonly __brand: "FilterImplicitLimitError";
|
|
180
|
+
readonly errorCode: CliErrorCode;
|
|
181
|
+
readonly instructions: string;
|
|
182
|
+
readonly retry: RetryHint;
|
|
183
|
+
readonly result: FailureResultType;
|
|
184
|
+
constructor(defaultLimit: string);
|
|
185
|
+
}
|
|
167
186
|
/**
|
|
168
187
|
* OutputFormatter namespace for formatting and displaying output.
|
|
169
188
|
*/
|
package/dist/guid.js
ADDED
|
@@ -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[];
|
package/dist/index.browser.js
CHANGED
|
@@ -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: "
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
23344
|
-
|
|
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
|
-
|
|
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=
|
|
23513
|
+
//# debugId=C2BB3B73AD55AF7D64756E2164756E21
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./error-handler";
|
|
|
14
14
|
export * from "./error-instructions";
|
|
15
15
|
export * from "./formatter";
|
|
16
16
|
export * from "./guid";
|
|
17
|
+
export * from "./host-global-options";
|
|
17
18
|
export * from "./interactivity-context";
|
|
18
19
|
export * from "./logger";
|
|
19
20
|
export * from "./option-aliases";
|
|
@@ -23,12 +24,14 @@ export * from "./output-context";
|
|
|
23
24
|
export * from "./output-format-context";
|
|
24
25
|
export * from "./output-sink";
|
|
25
26
|
export * from "./package-metadata-options";
|
|
27
|
+
export { type PackagerToolModule, REGISTER_EXPORT, } from "./packager-tool-import";
|
|
26
28
|
export * from "./polling";
|
|
27
29
|
export * from "./preview";
|
|
28
30
|
export * from "./registry";
|
|
29
31
|
export * from "./screen-logger";
|
|
30
32
|
export * from "./sdk-user-agent";
|
|
31
33
|
export * from "./singleton";
|
|
34
|
+
export * from "./solution-project-artifacts";
|
|
32
35
|
export * from "./stdin";
|
|
33
36
|
export { BrowserContextStorage } from "./telemetry/browser-context-storage.js";
|
|
34
37
|
export * from "./telemetry/command-attribution.js";
|
|
@@ -40,5 +43,6 @@ export { redactError, redactProperties, redactProperty, redactValue, } from "./t
|
|
|
40
43
|
export { type ShipSucceededTelemetryPayload, trackShipSucceeded, } from "./telemetry/ship-succeeded.js";
|
|
41
44
|
export * from "./telemetry/telemetry-events.js";
|
|
42
45
|
export * from "./telemetry/telemetry-init.js";
|
|
46
|
+
export * from "./telemetry/telemetry-spool.js";
|
|
43
47
|
export * from "./tool-provider";
|
|
44
48
|
export * from "./trackedAction.js";
|
package/dist/index.js
CHANGED
|
@@ -3194,6 +3194,9 @@ async function extractErrorDetails(error, options) {
|
|
|
3194
3194
|
if (!extractedMessage) {
|
|
3195
3195
|
extractedMessage = body;
|
|
3196
3196
|
}
|
|
3197
|
+
if (extractedMessage && typeof parsedBody.detail === "string" && parsedBody.detail.length > 0 && !extractedMessage.includes(parsedBody.detail)) {
|
|
3198
|
+
extractedMessage = `${extractedMessage}: ${parsedBody.detail}`;
|
|
3199
|
+
}
|
|
3197
3200
|
} else {
|
|
3198
3201
|
extractedMessage = isHtmlDocument(body) ? HTML_RESPONSE_MESSAGE : body;
|
|
3199
3202
|
}
|
|
@@ -3248,6 +3251,8 @@ async function extractErrorDetails(error, options) {
|
|
|
3248
3251
|
const extra = {};
|
|
3249
3252
|
if (parsedBody.errorCode)
|
|
3250
3253
|
extra.errorCode = parsedBody.errorCode;
|
|
3254
|
+
if (parsedBody.detail)
|
|
3255
|
+
extra.detail = parsedBody.detail;
|
|
3251
3256
|
if (parsedBody.details)
|
|
3252
3257
|
extra.details = parsedBody.details;
|
|
3253
3258
|
if (parsedBody.errors != null)
|
|
@@ -9144,9 +9149,12 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
9144
9149
|
// src/telemetry/telemetry-events.ts
|
|
9145
9150
|
var CommonTelemetryEvents = {
|
|
9146
9151
|
Error: "uip.error",
|
|
9147
|
-
ShipSucceeded: "
|
|
9152
|
+
ShipSucceeded: "uip.ship.succeeded"
|
|
9148
9153
|
};
|
|
9149
9154
|
|
|
9155
|
+
// src/telemetry/telemetry-init.ts
|
|
9156
|
+
import { spawn } from "node:child_process";
|
|
9157
|
+
|
|
9150
9158
|
// src/registry.ts
|
|
9151
9159
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
9152
9160
|
function readRegistryValue(keyPath, valueName) {
|
|
@@ -9786,14 +9794,11 @@ class TelemetryService {
|
|
|
9786
9794
|
}
|
|
9787
9795
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
9788
9796
|
const parentContext = this.getCurrentContext();
|
|
9789
|
-
|
|
9790
|
-
throw new Error("trackDependencyOperation must be called within a trackRequest block.");
|
|
9791
|
-
}
|
|
9792
|
-
const childContext = {
|
|
9797
|
+
const childContext = parentContext !== undefined ? {
|
|
9793
9798
|
operationId: parentContext.operationId,
|
|
9794
9799
|
parentId: parentContext.id,
|
|
9795
9800
|
id: this.generateId()
|
|
9796
|
-
};
|
|
9801
|
+
} : this.createRequestContext();
|
|
9797
9802
|
const startTime = performance.now();
|
|
9798
9803
|
try {
|
|
9799
9804
|
const result = await this.contextStorage.run(childContext, fn);
|
|
@@ -9974,6 +9979,9 @@ function normalizeFlushCallbackError(response) {
|
|
|
9974
9979
|
}
|
|
9975
9980
|
return extractAppInsightsDumpMessage(text) ?? text;
|
|
9976
9981
|
}
|
|
9982
|
+
function channelInternals(client) {
|
|
9983
|
+
return client.channel;
|
|
9984
|
+
}
|
|
9977
9985
|
function setDefaultAppInsightsEnv(name, value) {
|
|
9978
9986
|
if (process.env[name] === undefined) {
|
|
9979
9987
|
process.env[name] = value;
|
|
@@ -10181,6 +10189,32 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
10181
10189
|
logger.warn(`[AppInsights] flush error (non-fatal): ${error.message}`);
|
|
10182
10190
|
}
|
|
10183
10191
|
}
|
|
10192
|
+
drainPendingEnvelopes() {
|
|
10193
|
+
const client = this.client;
|
|
10194
|
+
if (!client)
|
|
10195
|
+
return;
|
|
10196
|
+
const endpointUrl = client.config?.endpointUrl;
|
|
10197
|
+
if (!endpointUrl)
|
|
10198
|
+
return;
|
|
10199
|
+
const [error, envelopes] = catchError(() => {
|
|
10200
|
+
const channel = channelInternals(client);
|
|
10201
|
+
if (!channel || !Array.isArray(channel._buffer)) {
|
|
10202
|
+
throw new Error("unexpected channel shape");
|
|
10203
|
+
}
|
|
10204
|
+
if (channel._timeoutHandle) {
|
|
10205
|
+
clearTimeout(channel._timeoutHandle);
|
|
10206
|
+
channel._timeoutHandle = undefined;
|
|
10207
|
+
}
|
|
10208
|
+
const buffered = channel._buffer;
|
|
10209
|
+
channel._buffer = [];
|
|
10210
|
+
return buffered;
|
|
10211
|
+
});
|
|
10212
|
+
if (error) {
|
|
10213
|
+
logger.debug("[AppInsights] failed to drain the channel buffer");
|
|
10214
|
+
return;
|
|
10215
|
+
}
|
|
10216
|
+
return { endpointUrl, envelopes };
|
|
10217
|
+
}
|
|
10184
10218
|
async shutdown() {
|
|
10185
10219
|
const client = this.client;
|
|
10186
10220
|
if (client) {
|
|
@@ -10188,6 +10222,19 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
10188
10222
|
if (statsbeatError) {
|
|
10189
10223
|
logger.debug("[AppInsights] failed to shut down Statsbeat");
|
|
10190
10224
|
}
|
|
10225
|
+
const [channelError] = catchError(() => {
|
|
10226
|
+
const channel = channelInternals(client);
|
|
10227
|
+
if (!channel)
|
|
10228
|
+
return;
|
|
10229
|
+
if (channel._timeoutHandle) {
|
|
10230
|
+
clearTimeout(channel._timeoutHandle);
|
|
10231
|
+
channel._timeoutHandle = undefined;
|
|
10232
|
+
}
|
|
10233
|
+
channel._buffer = [];
|
|
10234
|
+
});
|
|
10235
|
+
if (channelError) {
|
|
10236
|
+
logger.debug("[AppInsights] failed to clear the channel buffer");
|
|
10237
|
+
}
|
|
10191
10238
|
}
|
|
10192
10239
|
const appInsights = this.appInsightsModule;
|
|
10193
10240
|
if (appInsights) {
|
|
@@ -10229,6 +10276,115 @@ function isTelemetryDisabled() {
|
|
|
10229
10276
|
return value === "1" || value === "true";
|
|
10230
10277
|
}
|
|
10231
10278
|
|
|
10279
|
+
// src/telemetry/telemetry-spool.ts
|
|
10280
|
+
var TELEMETRY_DRAIN_ARGV = "__uip-drain-telemetry";
|
|
10281
|
+
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
10282
|
+
function setTelemetrySidecarEntry(entryPath) {
|
|
10283
|
+
sidecarEntrySlot.set(entryPath);
|
|
10284
|
+
}
|
|
10285
|
+
function getTelemetrySidecarEntry() {
|
|
10286
|
+
return sidecarEntrySlot.get();
|
|
10287
|
+
}
|
|
10288
|
+
var PENDING_SUFFIX = ".json";
|
|
10289
|
+
var CLAIMED_SUFFIX = ".sending";
|
|
10290
|
+
var WRITE_TEMP_SUFFIX = ".tmp";
|
|
10291
|
+
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
10292
|
+
var MAX_SPOOL_FILES = 50;
|
|
10293
|
+
function getTelemetrySpoolDir() {
|
|
10294
|
+
const fs7 = getFileSystem();
|
|
10295
|
+
return fs7.path.join(fs7.env.homedir(), ".uipath", "telemetry", "pending");
|
|
10296
|
+
}
|
|
10297
|
+
async function writeTelemetrySpoolFile(payload) {
|
|
10298
|
+
const fs7 = getFileSystem();
|
|
10299
|
+
const dir = getTelemetrySpoolDir();
|
|
10300
|
+
await fs7.mkdir(dir);
|
|
10301
|
+
const name = `${Date.now()}-${process.pid}`;
|
|
10302
|
+
const finalPath = fs7.path.join(dir, `${name}${PENDING_SUFFIX}`);
|
|
10303
|
+
const tempPath = fs7.path.join(dir, `${name}${WRITE_TEMP_SUFFIX}`);
|
|
10304
|
+
await fs7.writeFile(tempPath, JSON.stringify(payload));
|
|
10305
|
+
await fs7.rename(tempPath, finalPath);
|
|
10306
|
+
return finalPath;
|
|
10307
|
+
}
|
|
10308
|
+
function isSpoolPayload(value) {
|
|
10309
|
+
return value !== null && typeof value === "object" && typeof value.endpointUrl === "string" && value.endpointUrl.length > 0 && Array.isArray(value.envelopes);
|
|
10310
|
+
}
|
|
10311
|
+
async function listSpoolEntries(suffix) {
|
|
10312
|
+
const fs7 = getFileSystem();
|
|
10313
|
+
const dir = getTelemetrySpoolDir();
|
|
10314
|
+
const [readdirError, names] = await catchError(fs7.readdir(dir));
|
|
10315
|
+
if (readdirError) {
|
|
10316
|
+
return { dir, names: [] };
|
|
10317
|
+
}
|
|
10318
|
+
return {
|
|
10319
|
+
dir,
|
|
10320
|
+
names: names.filter((n) => n.endsWith(suffix)).sort((a, b) => a.localeCompare(b))
|
|
10321
|
+
};
|
|
10322
|
+
}
|
|
10323
|
+
async function claimPendingSpoolFiles() {
|
|
10324
|
+
const fs7 = getFileSystem();
|
|
10325
|
+
const { dir, names } = await listSpoolEntries(PENDING_SUFFIX);
|
|
10326
|
+
const claimed = [];
|
|
10327
|
+
for (const name of names) {
|
|
10328
|
+
const pendingPath = fs7.path.join(dir, name);
|
|
10329
|
+
const claimedPath = `${pendingPath.slice(0, -PENDING_SUFFIX.length)}${CLAIMED_SUFFIX}`;
|
|
10330
|
+
const [claimError] = await catchError(fs7.rename(pendingPath, claimedPath));
|
|
10331
|
+
if (claimError) {
|
|
10332
|
+
continue;
|
|
10333
|
+
}
|
|
10334
|
+
const [readError, raw] = await catchError(fs7.readFile(claimedPath, "utf-8"));
|
|
10335
|
+
if (readError || raw === null) {
|
|
10336
|
+
logger.debug(`[TelemetrySpool] could not read ${name}; leaving it for a later run`);
|
|
10337
|
+
await releaseClaimedSpoolFile(claimedPath);
|
|
10338
|
+
continue;
|
|
10339
|
+
}
|
|
10340
|
+
const [parseError, parsed] = catchError(() => JSON.parse(raw));
|
|
10341
|
+
if (parseError || !isSpoolPayload(parsed)) {
|
|
10342
|
+
logger.debug(`[TelemetrySpool] dropping malformed file: ${name}`);
|
|
10343
|
+
await catchError(fs7.rm(claimedPath));
|
|
10344
|
+
continue;
|
|
10345
|
+
}
|
|
10346
|
+
claimed.push({ claimedPath, payload: parsed });
|
|
10347
|
+
}
|
|
10348
|
+
return claimed;
|
|
10349
|
+
}
|
|
10350
|
+
async function releaseClaimedSpoolFile(claimedPath) {
|
|
10351
|
+
const fs7 = getFileSystem();
|
|
10352
|
+
const pendingPath = `${claimedPath.slice(0, -CLAIMED_SUFFIX.length)}${PENDING_SUFFIX}`;
|
|
10353
|
+
await catchError(fs7.rename(claimedPath, pendingPath));
|
|
10354
|
+
}
|
|
10355
|
+
async function discardClaimedSpoolFile(claimedPath) {
|
|
10356
|
+
const fs7 = getFileSystem();
|
|
10357
|
+
await catchError(fs7.rm(claimedPath));
|
|
10358
|
+
}
|
|
10359
|
+
async function sweepTelemetrySpool() {
|
|
10360
|
+
const fs7 = getFileSystem();
|
|
10361
|
+
const { dir, names } = await listSpoolEntries("");
|
|
10362
|
+
const now = Date.now();
|
|
10363
|
+
const pending = [];
|
|
10364
|
+
for (const name of names) {
|
|
10365
|
+
const filePath = fs7.path.join(dir, name);
|
|
10366
|
+
const [statError, stats] = await catchError(fs7.stat(filePath));
|
|
10367
|
+
if (statError || !stats) {
|
|
10368
|
+
continue;
|
|
10369
|
+
}
|
|
10370
|
+
if (now - stats.mtimeMs > MAX_SPOOL_AGE_MS) {
|
|
10371
|
+
await catchError(fs7.rm(filePath));
|
|
10372
|
+
continue;
|
|
10373
|
+
}
|
|
10374
|
+
if (name.endsWith(PENDING_SUFFIX)) {
|
|
10375
|
+
pending.push({ path: filePath, mtimeMs: stats.mtimeMs });
|
|
10376
|
+
}
|
|
10377
|
+
}
|
|
10378
|
+
if (pending.length > MAX_SPOOL_FILES) {
|
|
10379
|
+
pending.sort((a, b) => a.mtimeMs - b.mtimeMs);
|
|
10380
|
+
const excess = pending.slice(0, pending.length - MAX_SPOOL_FILES);
|
|
10381
|
+
for (const file of excess) {
|
|
10382
|
+
await catchError(fs7.rm(file.path));
|
|
10383
|
+
}
|
|
10384
|
+
logger.debug(`[TelemetrySpool] deleted ${excess.length} oldest files over the ${MAX_SPOOL_FILES}-file cap`);
|
|
10385
|
+
}
|
|
10386
|
+
}
|
|
10387
|
+
|
|
10232
10388
|
// src/telemetry/telemetry-init.ts
|
|
10233
10389
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
10234
10390
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
@@ -10322,6 +10478,56 @@ async function runWithTimeout(operation, timeoutMs) {
|
|
|
10322
10478
|
clearTimeout(timer);
|
|
10323
10479
|
}
|
|
10324
10480
|
}
|
|
10481
|
+
async function runProviderShutdown(provider) {
|
|
10482
|
+
const [shutdownError, shutdownResult] = await catchError(runWithTimeout(provider.shutdown(), FLUSH_SHUTDOWN_TIMEOUT_MS));
|
|
10483
|
+
if (shutdownError) {
|
|
10484
|
+
logger.warn(`[Telemetry] shutdown failed (non-fatal): ${shutdownError.message}`);
|
|
10485
|
+
} else if (shutdownResult === "timeout") {
|
|
10486
|
+
logger.warn(`[Telemetry] shutdown timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
10487
|
+
}
|
|
10488
|
+
}
|
|
10489
|
+
function isSyncFlushForced() {
|
|
10490
|
+
const value = process.env.UIPATH_TELEMETRY_SYNC_FLUSH;
|
|
10491
|
+
return value === "1" || value === "true";
|
|
10492
|
+
}
|
|
10493
|
+
function isDrainableTelemetryProvider(provider) {
|
|
10494
|
+
return "drainPendingEnvelopes" in provider && typeof provider.drainPendingEnvelopes === "function";
|
|
10495
|
+
}
|
|
10496
|
+
function spawnTelemetrySidecar(entryPath) {
|
|
10497
|
+
const child = spawn(process.execPath, [entryPath, TELEMETRY_DRAIN_ARGV], {
|
|
10498
|
+
cwd: getFileSystem().env.tmpdir(),
|
|
10499
|
+
detached: true,
|
|
10500
|
+
stdio: "ignore",
|
|
10501
|
+
windowsHide: true
|
|
10502
|
+
});
|
|
10503
|
+
child.on("error", (error) => {
|
|
10504
|
+
logger.debug(`[Telemetry] sidecar spawn failed (spool kept for a later run): ${error.message}`);
|
|
10505
|
+
});
|
|
10506
|
+
child.unref();
|
|
10507
|
+
}
|
|
10508
|
+
async function trySidecarHandoff(provider) {
|
|
10509
|
+
const entryPath = getTelemetrySidecarEntry();
|
|
10510
|
+
if (entryPath === undefined || isSyncFlushForced() || !isDrainableTelemetryProvider(provider)) {
|
|
10511
|
+
return false;
|
|
10512
|
+
}
|
|
10513
|
+
const pending = provider.drainPendingEnvelopes();
|
|
10514
|
+
if (!pending) {
|
|
10515
|
+
return false;
|
|
10516
|
+
}
|
|
10517
|
+
if (pending.envelopes.length > 0) {
|
|
10518
|
+
const [spoolError] = await catchError(writeTelemetrySpoolFile(pending));
|
|
10519
|
+
if (spoolError) {
|
|
10520
|
+
logger.debug(`[Telemetry] spool write failed; dropping ${pending.envelopes.length} pending envelope(s): ${spoolError.message}`);
|
|
10521
|
+
} else {
|
|
10522
|
+
const [spawnError] = catchError(() => spawnTelemetrySidecar(entryPath));
|
|
10523
|
+
if (spawnError) {
|
|
10524
|
+
logger.debug(`[Telemetry] sidecar spawn failed; spool will be sent by a future run: ${spawnError.message}`);
|
|
10525
|
+
}
|
|
10526
|
+
}
|
|
10527
|
+
}
|
|
10528
|
+
await runProviderShutdown(provider);
|
|
10529
|
+
return true;
|
|
10530
|
+
}
|
|
10325
10531
|
async function telemetryFlushAndShutdown() {
|
|
10326
10532
|
if (!isFlushableTelemetryProvider(telemetryProviderInstance)) {
|
|
10327
10533
|
return;
|
|
@@ -10329,22 +10535,27 @@ async function telemetryFlushAndShutdown() {
|
|
|
10329
10535
|
if (!telemetryFlushShutdownPromise) {
|
|
10330
10536
|
const provider = telemetryProviderInstance;
|
|
10331
10537
|
telemetryFlushShutdownPromise = (async () => {
|
|
10538
|
+
if (await trySidecarHandoff(provider)) {
|
|
10539
|
+
return;
|
|
10540
|
+
}
|
|
10332
10541
|
const [flushError, flushResult] = await catchError(runWithTimeout(provider.flush(), FLUSH_SHUTDOWN_TIMEOUT_MS));
|
|
10333
10542
|
if (flushError) {
|
|
10334
10543
|
logger.warn(`[Telemetry] flush failed (non-fatal): ${flushError.message}`);
|
|
10335
10544
|
} else if (flushResult === "timeout") {
|
|
10336
10545
|
logger.warn(`[Telemetry] flush timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
10337
10546
|
}
|
|
10338
|
-
|
|
10339
|
-
if (shutdownError) {
|
|
10340
|
-
logger.warn(`[Telemetry] shutdown failed (non-fatal): ${shutdownError.message}`);
|
|
10341
|
-
} else if (shutdownResult === "timeout") {
|
|
10342
|
-
logger.warn(`[Telemetry] shutdown timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
10343
|
-
}
|
|
10547
|
+
await runProviderShutdown(provider);
|
|
10344
10548
|
})();
|
|
10345
10549
|
}
|
|
10346
10550
|
await telemetryFlushShutdownPromise;
|
|
10347
10551
|
}
|
|
10552
|
+
async function telemetryShutdownWithoutFlush() {
|
|
10553
|
+
if (!isFlushableTelemetryProvider(telemetryProviderInstance)) {
|
|
10554
|
+
return;
|
|
10555
|
+
}
|
|
10556
|
+
telemetryFlushShutdownPromise ??= runProviderShutdown(telemetryProviderInstance);
|
|
10557
|
+
await telemetryFlushShutdownPromise;
|
|
10558
|
+
}
|
|
10348
10559
|
|
|
10349
10560
|
// src/formatter.ts
|
|
10350
10561
|
var CLI_ERROR_CODES = [
|
|
@@ -10621,21 +10832,43 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
10621
10832
|
logFn(`Log: ${externalLogValue}`);
|
|
10622
10833
|
}
|
|
10623
10834
|
}
|
|
10835
|
+
function isPlainObjectArray(value) {
|
|
10836
|
+
return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
10837
|
+
}
|
|
10838
|
+
function isNonEmptyPlainObject(value) {
|
|
10839
|
+
return isPlainRecord(value) && Object.keys(value).length > 0;
|
|
10840
|
+
}
|
|
10841
|
+
var NESTED_INDENT = " ";
|
|
10624
10842
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
10625
10843
|
const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
10626
10844
|
if (keys.length === 0)
|
|
10627
10845
|
return;
|
|
10628
|
-
const
|
|
10846
|
+
const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
|
|
10847
|
+
const scalarKeys = keys.filter((key) => !isBlockValue(data[key]));
|
|
10848
|
+
const maxKeyWidth = scalarKeys.length > 0 ? Math.max(...scalarKeys.map((key) => key.length)) : 0;
|
|
10849
|
+
const termWidth = process.stdout.columns || 120;
|
|
10850
|
+
const nestedWidth = Math.max(termWidth - NESTED_INDENT.length, 1);
|
|
10629
10851
|
keys.forEach((key) => {
|
|
10852
|
+
const value = data[key];
|
|
10853
|
+
if (isPlainObjectArray(value)) {
|
|
10854
|
+
logFn(`${key}:`);
|
|
10855
|
+
printResizableTable(value, (line) => logFn(`${NESTED_INDENT}${line}`), undefined, nestedWidth);
|
|
10856
|
+
return;
|
|
10857
|
+
}
|
|
10858
|
+
if (isNonEmptyPlainObject(value)) {
|
|
10859
|
+
logFn(`${key}:`);
|
|
10860
|
+
printVerticalTable(value, (line) => logFn(`${NESTED_INDENT}${line}`));
|
|
10861
|
+
return;
|
|
10862
|
+
}
|
|
10630
10863
|
const keyCol = key.padEnd(maxKeyWidth);
|
|
10631
|
-
logFn(`${keyCol} | ${cellToString(
|
|
10864
|
+
logFn(`${keyCol} | ${cellToString(value)}`);
|
|
10632
10865
|
});
|
|
10633
10866
|
if (externalLogValue) {
|
|
10634
10867
|
logFn("");
|
|
10635
10868
|
logFn(`Log: ${externalLogValue}`);
|
|
10636
10869
|
}
|
|
10637
10870
|
}
|
|
10638
|
-
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
10871
|
+
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth) {
|
|
10639
10872
|
if (data.length === 0)
|
|
10640
10873
|
return;
|
|
10641
10874
|
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
@@ -10648,7 +10881,7 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
|
10648
10881
|
const naturalWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
10649
10882
|
const separatorTotal = (keys.length - 1) * 3;
|
|
10650
10883
|
const totalWidth = naturalWidths.reduce((a, b) => a + b, 0) + separatorTotal;
|
|
10651
|
-
const termWidth = process.stdout.columns || 120;
|
|
10884
|
+
const termWidth = availableWidth ?? (process.stdout.columns || 120);
|
|
10652
10885
|
if (totalWidth <= termWidth) {
|
|
10653
10886
|
printTable(data, logFn, externalLogValue);
|
|
10654
10887
|
return;
|
|
@@ -10738,6 +10971,19 @@ class FilterEvaluationError extends Error {
|
|
|
10738
10971
|
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
10739
10972
|
}
|
|
10740
10973
|
}
|
|
10974
|
+
|
|
10975
|
+
class FilterImplicitLimitError extends Error {
|
|
10976
|
+
__brand = "FilterImplicitLimitError";
|
|
10977
|
+
errorCode = "invalid_argument";
|
|
10978
|
+
instructions;
|
|
10979
|
+
retry = "RetryWillNotFix";
|
|
10980
|
+
result = RESULTS.ValidationError;
|
|
10981
|
+
constructor(defaultLimit) {
|
|
10982
|
+
super(`--output-filter requires an explicit --limit: this command defaults to --limit ${defaultLimit}, ` + `so the filter would silently apply to only the first ${defaultLimit} records.`);
|
|
10983
|
+
this.name = "FilterImplicitLimitError";
|
|
10984
|
+
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).";
|
|
10985
|
+
}
|
|
10986
|
+
}
|
|
10741
10987
|
function applyFilter(data, filter) {
|
|
10742
10988
|
let result;
|
|
10743
10989
|
try {
|
|
@@ -10991,7 +11237,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
10991
11237
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
10992
11238
|
["agenthub", "build", ["uip.agenthub"]],
|
|
10993
11239
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
10994
|
-
["functions", "build", ["uip.functions"]],
|
|
11240
|
+
["functions", "build", ["uip.function", "uip.functions"]],
|
|
10995
11241
|
["solution", "build", ["uip.solution"]],
|
|
10996
11242
|
["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
|
|
10997
11243
|
["llm-observability", "troubleshoot", ["uip.traces"]],
|
|
@@ -11158,6 +11404,16 @@ function commandHelpHint(commandPath) {
|
|
|
11158
11404
|
function isPromptCancellation(error) {
|
|
11159
11405
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
11160
11406
|
}
|
|
11407
|
+
function implicitLimitViolation(cmd) {
|
|
11408
|
+
if (getOutputFilter() === undefined) {
|
|
11409
|
+
return;
|
|
11410
|
+
}
|
|
11411
|
+
const hasLimit = cmd.options.some((o) => o.attributeName() === "limit");
|
|
11412
|
+
if (!hasLimit || cmd.getOptionValueSource("limit") !== "default") {
|
|
11413
|
+
return;
|
|
11414
|
+
}
|
|
11415
|
+
return new FilterImplicitLimitError(String(cmd.opts().limit));
|
|
11416
|
+
}
|
|
11161
11417
|
function exitCodeFromProcess(fallback) {
|
|
11162
11418
|
return typeof process.exitCode === "number" ? process.exitCode : fallback;
|
|
11163
11419
|
}
|
|
@@ -11171,7 +11427,13 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
11171
11427
|
let errorMessage;
|
|
11172
11428
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
11173
11429
|
clearRecordedCommandFailureTelemetry();
|
|
11174
|
-
const [error] = await catchError(telemetry.runWithContext(requestContext, () =>
|
|
11430
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => {
|
|
11431
|
+
const violation = implicitLimitViolation(command);
|
|
11432
|
+
if (violation) {
|
|
11433
|
+
return Promise.reject(violation);
|
|
11434
|
+
}
|
|
11435
|
+
return fn(...args);
|
|
11436
|
+
}));
|
|
11175
11437
|
if (error) {
|
|
11176
11438
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
11177
11439
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -11421,6 +11683,40 @@ var GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
|
|
|
11421
11683
|
function isGuid(value) {
|
|
11422
11684
|
return GUID_REGEX.test(value);
|
|
11423
11685
|
}
|
|
11686
|
+
// src/host-global-options.ts
|
|
11687
|
+
var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
|
|
11688
|
+
"--output",
|
|
11689
|
+
"--output-filter",
|
|
11690
|
+
"--log-level",
|
|
11691
|
+
"--log-file",
|
|
11692
|
+
"--profile"
|
|
11693
|
+
];
|
|
11694
|
+
var HOST_GLOBAL_FLAGS = [
|
|
11695
|
+
"--json",
|
|
11696
|
+
"--interactive",
|
|
11697
|
+
"--no-interactive"
|
|
11698
|
+
];
|
|
11699
|
+
var VALUE_OPTIONS = new Set(HOST_GLOBAL_OPTIONS_WITH_VALUE);
|
|
11700
|
+
var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
|
|
11701
|
+
function stripHostGlobalOptions(args) {
|
|
11702
|
+
const cleaned = [];
|
|
11703
|
+
for (let i = 0;i < args.length; i++) {
|
|
11704
|
+
const arg = args[i] ?? "";
|
|
11705
|
+
if (BOOLEAN_FLAGS.has(arg)) {
|
|
11706
|
+
continue;
|
|
11707
|
+
}
|
|
11708
|
+
if (VALUE_OPTIONS.has(arg)) {
|
|
11709
|
+
i++;
|
|
11710
|
+
continue;
|
|
11711
|
+
}
|
|
11712
|
+
const equalsIndex = arg.indexOf("=");
|
|
11713
|
+
if (equalsIndex > 0 && VALUE_OPTIONS.has(arg.slice(0, equalsIndex))) {
|
|
11714
|
+
continue;
|
|
11715
|
+
}
|
|
11716
|
+
cleaned.push(arg);
|
|
11717
|
+
}
|
|
11718
|
+
return cleaned;
|
|
11719
|
+
}
|
|
11424
11720
|
// src/interactivity-context.ts
|
|
11425
11721
|
var modeSlot = singleton("InteractivityMode");
|
|
11426
11722
|
var interactiveFlagSlot = singleton("InteractiveFlag");
|
|
@@ -11584,6 +11880,22 @@ function mapPackageMetadataOptions(opts) {
|
|
|
11584
11880
|
}
|
|
11585
11881
|
return fields;
|
|
11586
11882
|
}
|
|
11883
|
+
// src/packager-tool-import.ts
|
|
11884
|
+
var REGISTER_EXPORT = "registerPackagerFactories";
|
|
11885
|
+
async function importPackagerTool(specifier) {
|
|
11886
|
+
const [importError, mod2] = await catchError(import(specifier));
|
|
11887
|
+
if (importError)
|
|
11888
|
+
return importError;
|
|
11889
|
+
const register = mod2?.[REGISTER_EXPORT];
|
|
11890
|
+
if (typeof register !== "function") {
|
|
11891
|
+
logger.debug(`'${specifier}' has no '${REGISTER_EXPORT}' export — treating it as a ` + "legacy entry point that registered its factories at import.");
|
|
11892
|
+
return;
|
|
11893
|
+
}
|
|
11894
|
+
const [registerError] = catchError(() => {
|
|
11895
|
+
register();
|
|
11896
|
+
});
|
|
11897
|
+
return registerError;
|
|
11898
|
+
}
|
|
11587
11899
|
// src/polling/abort-controller.ts
|
|
11588
11900
|
var created = false;
|
|
11589
11901
|
function createPollAbortController() {
|
|
@@ -12070,9 +12382,15 @@ var FAILURE_STATUSES = new Set([
|
|
|
12070
12382
|
"stopped"
|
|
12071
12383
|
]);
|
|
12072
12384
|
function isTerminalStatus(status) {
|
|
12385
|
+
if (typeof status !== "string") {
|
|
12386
|
+
return false;
|
|
12387
|
+
}
|
|
12073
12388
|
return TERMINAL_STATUSES.has(status.toLowerCase());
|
|
12074
12389
|
}
|
|
12075
12390
|
function isFailureStatus(status) {
|
|
12391
|
+
if (typeof status !== "string") {
|
|
12392
|
+
return false;
|
|
12393
|
+
}
|
|
12076
12394
|
return FAILURE_STATUSES.has(status.toLowerCase());
|
|
12077
12395
|
}
|
|
12078
12396
|
function isSuccessStatus(status) {
|
|
@@ -12214,6 +12532,68 @@ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
|
12214
12532
|
function installSdkCodingAgentHeader(BaseApiClass) {
|
|
12215
12533
|
installRequestHeaderForwarding(BaseApiClass, codingAgentPatchKey(), (headers) => addSdkCodingAgentHeader(headers));
|
|
12216
12534
|
}
|
|
12535
|
+
// src/tool-module-import.ts
|
|
12536
|
+
async function importToolModule(specifier) {
|
|
12537
|
+
return await import(specifier);
|
|
12538
|
+
}
|
|
12539
|
+
|
|
12540
|
+
// src/tool-provider.ts
|
|
12541
|
+
var factorySlot = singleton("PackagerFactoryProvider");
|
|
12542
|
+
function setPackagerFactoryProvider(provider) {
|
|
12543
|
+
factorySlot.set(provider);
|
|
12544
|
+
}
|
|
12545
|
+
var moduleSlot = singleton("ToolModuleProvider");
|
|
12546
|
+
function setToolModuleProvider(provider) {
|
|
12547
|
+
moduleSlot.set(provider);
|
|
12548
|
+
}
|
|
12549
|
+
async function ensureToolModule(verb, packageName, moduleName) {
|
|
12550
|
+
if (!/^[a-z0-9-]+$/.test(moduleName)) {
|
|
12551
|
+
throw new Error(`Invalid tool module name '${moduleName}'.`);
|
|
12552
|
+
}
|
|
12553
|
+
const provider = moduleSlot.get();
|
|
12554
|
+
if (provider) {
|
|
12555
|
+
return provider(verb, moduleName);
|
|
12556
|
+
}
|
|
12557
|
+
const specifier = `${packageName}/${moduleName}`;
|
|
12558
|
+
const [importError, mod2] = await catchError(importToolModule(specifier));
|
|
12559
|
+
if (importError) {
|
|
12560
|
+
logger.debug(`No tool-module provider registered; import of '${specifier}' failed: ${importError.message}`);
|
|
12561
|
+
throw new Error(`This command needs '${packageName}'. Install it.`, {
|
|
12562
|
+
cause: importError
|
|
12563
|
+
});
|
|
12564
|
+
}
|
|
12565
|
+
return mod2;
|
|
12566
|
+
}
|
|
12567
|
+
async function ensurePackagerFactory(verb, packageName) {
|
|
12568
|
+
const provider = factorySlot.get();
|
|
12569
|
+
if (provider) {
|
|
12570
|
+
await provider(verb);
|
|
12571
|
+
return;
|
|
12572
|
+
}
|
|
12573
|
+
const importError = packageName ? await loadPackagerTool(`${packageName}/packager-tool`) : undefined;
|
|
12574
|
+
if (packageName && !importError)
|
|
12575
|
+
return;
|
|
12576
|
+
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 });
|
|
12577
|
+
}
|
|
12578
|
+
async function loadPackagerTool(specifier) {
|
|
12579
|
+
const error = await importPackagerTool(specifier);
|
|
12580
|
+
if (error) {
|
|
12581
|
+
logger.debug(`No packager factory provider registered; import of '${specifier}' failed: ${error.message}`);
|
|
12582
|
+
return error;
|
|
12583
|
+
}
|
|
12584
|
+
logger.debug(`No packager factory provider registered; loaded '${specifier}' directly.`);
|
|
12585
|
+
return;
|
|
12586
|
+
}
|
|
12587
|
+
|
|
12588
|
+
// src/solution-project-artifacts.ts
|
|
12589
|
+
async function ensureProjectArtifacts(args) {
|
|
12590
|
+
const [error, mod2] = await catchError(ensureToolModule("solution", "@uipath/solution-tool", "init"));
|
|
12591
|
+
if (error) {
|
|
12592
|
+
logger.warn(`Solution artifact-resource generation skipped for project "${args.projectName}": ${error.message}. ` + "Run 'uip solution project add' to finish setup.");
|
|
12593
|
+
return { Created: false, Error: error.message };
|
|
12594
|
+
}
|
|
12595
|
+
return mod2.addProjectArtifactsToSolutionAsync(args);
|
|
12596
|
+
}
|
|
12217
12597
|
// src/stdin.ts
|
|
12218
12598
|
async function readStdin() {
|
|
12219
12599
|
if (process.stdin.isTTY) {
|
|
@@ -12313,30 +12693,24 @@ function trackShipSucceeded(payload) {
|
|
|
12313
12693
|
telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties({ ...payload }));
|
|
12314
12694
|
return true;
|
|
12315
12695
|
}
|
|
12316
|
-
// src/tool-provider.ts
|
|
12317
|
-
var factorySlot = singleton("PackagerFactoryProvider");
|
|
12318
|
-
function setPackagerFactoryProvider(provider) {
|
|
12319
|
-
factorySlot.set(provider);
|
|
12320
|
-
}
|
|
12321
|
-
async function ensurePackagerFactory(verb) {
|
|
12322
|
-
const provider = factorySlot.get();
|
|
12323
|
-
if (!provider) {
|
|
12324
|
-
throw new Error(`Packager factory for '${verb}' is required but no factory provider is registered. ` + `Run 'uip tools install ${verb}' manually.`);
|
|
12325
|
-
}
|
|
12326
|
-
await provider(verb);
|
|
12327
|
-
}
|
|
12328
12696
|
export {
|
|
12697
|
+
writeTelemetrySpoolFile,
|
|
12329
12698
|
withCompleter,
|
|
12330
12699
|
wasInteractiveFlagPassed,
|
|
12331
12700
|
warnDeprecatedTenantOption,
|
|
12332
12701
|
warnDeprecatedOptionAlias,
|
|
12333
12702
|
validateOutputFilter,
|
|
12334
12703
|
trackShipSucceeded,
|
|
12704
|
+
telemetryShutdownWithoutFlush,
|
|
12335
12705
|
telemetryInit,
|
|
12336
12706
|
telemetryFlushAndShutdown,
|
|
12337
12707
|
telemetry,
|
|
12338
12708
|
takeRecordedCommandFailureTelemetry,
|
|
12709
|
+
sweepTelemetrySpool,
|
|
12710
|
+
stripHostGlobalOptions,
|
|
12339
12711
|
singleton,
|
|
12712
|
+
setToolModuleProvider,
|
|
12713
|
+
setTelemetrySidecarEntry,
|
|
12340
12714
|
setSdkUserAgentHostToken,
|
|
12341
12715
|
setProcessContextPollSignal,
|
|
12342
12716
|
setPreviewBuild,
|
|
@@ -12360,6 +12734,7 @@ export {
|
|
|
12360
12734
|
resolveAttachmentInputs,
|
|
12361
12735
|
resetLoggerInstance,
|
|
12362
12736
|
requireConfirmation,
|
|
12737
|
+
releaseClaimedSpoolFile,
|
|
12363
12738
|
registerPackageMetadataOptions,
|
|
12364
12739
|
redactValue,
|
|
12365
12740
|
redactProperty,
|
|
@@ -12399,6 +12774,8 @@ export {
|
|
|
12399
12774
|
installSdkCodingAgentHeader,
|
|
12400
12775
|
installConsoleGuard,
|
|
12401
12776
|
hashContent,
|
|
12777
|
+
getTelemetrySpoolDir,
|
|
12778
|
+
getTelemetrySidecarEntry,
|
|
12402
12779
|
getTelemetrySessionSource,
|
|
12403
12780
|
getTelemetrySessionId,
|
|
12404
12781
|
getSdkUserAgentToken,
|
|
@@ -12423,7 +12800,10 @@ export {
|
|
|
12423
12800
|
extractErrorDetails,
|
|
12424
12801
|
extractCommandHelp,
|
|
12425
12802
|
escapeNonAscii,
|
|
12803
|
+
ensureToolModule,
|
|
12804
|
+
ensureProjectArtifacts,
|
|
12426
12805
|
ensurePackagerFactory,
|
|
12806
|
+
discardClaimedSpoolFile,
|
|
12427
12807
|
detectExecutionContext,
|
|
12428
12808
|
detectAgentVersion,
|
|
12429
12809
|
detectAgent,
|
|
@@ -12436,6 +12816,7 @@ export {
|
|
|
12436
12816
|
configureLogger,
|
|
12437
12817
|
collectCommands,
|
|
12438
12818
|
clearRecordedCommandFailureTelemetry,
|
|
12819
|
+
claimPendingSpoolFiles,
|
|
12439
12820
|
catchError,
|
|
12440
12821
|
canPrompt,
|
|
12441
12822
|
buildSkillEventTelemetryAttribution,
|
|
@@ -12457,18 +12838,25 @@ export {
|
|
|
12457
12838
|
TELEMETRY_SESSION_ID_ENV,
|
|
12458
12839
|
TELEMETRY_PARENT_ID_PROPERTY,
|
|
12459
12840
|
TELEMETRY_OPERATION_ID_PROPERTY,
|
|
12841
|
+
TELEMETRY_DRAIN_ARGV,
|
|
12460
12842
|
TELEMETRY_COMMAND_ARG_PREFIX,
|
|
12461
12843
|
SuccessOutput,
|
|
12462
12844
|
ScreenLogger,
|
|
12463
12845
|
RETRY_HINTS,
|
|
12464
12846
|
RESULTS,
|
|
12847
|
+
REGISTER_EXPORT,
|
|
12465
12848
|
PollOutcome,
|
|
12466
12849
|
Pagination,
|
|
12467
12850
|
POLL_DEFAULTS,
|
|
12468
12851
|
OutputFormatter,
|
|
12469
12852
|
NodeContextStorage,
|
|
12470
12853
|
MIN_INTERVAL_MS,
|
|
12854
|
+
MAX_SPOOL_FILES,
|
|
12855
|
+
MAX_SPOOL_AGE_MS,
|
|
12471
12856
|
LogLevel,
|
|
12857
|
+
HOST_GLOBAL_OPTIONS_WITH_VALUE,
|
|
12858
|
+
HOST_GLOBAL_FLAGS,
|
|
12859
|
+
FilterImplicitLimitError,
|
|
12472
12860
|
FilterEvaluationError,
|
|
12473
12861
|
FailureOutput,
|
|
12474
12862
|
ErrorDecision,
|
|
@@ -12492,4 +12880,4 @@ export {
|
|
|
12492
12880
|
ATTACHMENT_INSTRUCTIONS
|
|
12493
12881
|
};
|
|
12494
12882
|
|
|
12495
|
-
//# debugId=
|
|
12883
|
+
//# debugId=C8D78C124860EA5264756E2164756E21
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import a tool's `packager-tool` entry point and run its registration.
|
|
3
|
+
*
|
|
4
|
+
* Its own module so tests can stand in for it. The real entry points are
|
|
5
|
+
* multi-megabyte tool bundles; loading one takes seconds and blocks the event
|
|
6
|
+
* loop while it evaluates, which is far too slow for a unit test.
|
|
7
|
+
*/
|
|
8
|
+
/** Named export every in-repo `packager-tool` entry point must provide. */
|
|
9
|
+
export declare const REGISTER_EXPORT = "registerPackagerFactories";
|
|
10
|
+
/** Shape of a `packager-tool` entry point's module namespace. */
|
|
11
|
+
export interface PackagerToolModule {
|
|
12
|
+
[REGISTER_EXPORT]?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Import `specifier` and call its `registerPackagerFactories` export. Returns
|
|
16
|
+
* the failure instead of throwing so the caller can decide what to say.
|
|
17
|
+
*
|
|
18
|
+
* Registration is a call, not an import side effect, so a run that reaches
|
|
19
|
+
* the same factories through two tool bundles registers them once — from the
|
|
20
|
+
* one caller that is about to pack.
|
|
21
|
+
*
|
|
22
|
+
* Tools published before that change register at import and ship no export.
|
|
23
|
+
* They still work: the import above already registered them, so treat a
|
|
24
|
+
* missing export as a legacy entry point instead of a failure. Tools that live
|
|
25
|
+
* in this repo must export it — `scripts/lint-packager-tool-exports.ts` fails
|
|
26
|
+
* the build if one doesn't.
|
|
27
|
+
*/
|
|
28
|
+
export declare function importPackagerTool(specifier: string): Promise<Error | undefined>;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* isTerminalStatus("FAULTED") // true
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export declare function isTerminalStatus(status: string): boolean;
|
|
23
|
+
export declare function isTerminalStatus(status: string | null | undefined): boolean;
|
|
24
24
|
/**
|
|
25
25
|
* Check if a status string represents a failure state (case-insensitive).
|
|
26
26
|
*
|
|
@@ -34,7 +34,7 @@ export declare function isTerminalStatus(status: string): boolean;
|
|
|
34
34
|
* isFailureStatus("Cancelled") // true
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export declare function isFailureStatus(status: string): boolean;
|
|
37
|
+
export declare function isFailureStatus(status: string | null | undefined): boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Check if a status string represents a successful terminal state (case-insensitive).
|
|
40
40
|
*
|
|
@@ -47,4 +47,4 @@ export declare function isFailureStatus(status: string): boolean;
|
|
|
47
47
|
* isSuccessStatus("Running") // false
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
export declare function isSuccessStatus(status: string): boolean;
|
|
50
|
+
export declare function isSuccessStatus(status: string | null | undefined): boolean;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `ensureProjectArtifacts` used by every `*-tool init` path (agent,
|
|
3
|
+
* case, codedapp, flow, maestro). Lives here so the five tools don't each
|
|
4
|
+
* carry a copy; each tool re-exports it from its own
|
|
5
|
+
* `src/services/project-artifacts.ts` shim (the browser-build
|
|
6
|
+
* `excludedImports` stub mechanism resolves only relative paths under each
|
|
7
|
+
* tool's own src tree).
|
|
8
|
+
*/
|
|
9
|
+
/** Options forwarded to solution-tool's `addProjectArtifactsToSolutionAsync`. */
|
|
10
|
+
export interface EnsureProjectArtifactsArgs {
|
|
11
|
+
/** Absolute path to the solution directory (containing the `.uipx`). */
|
|
12
|
+
solutionDir: string;
|
|
13
|
+
/** Stable project key — must match the `Id` in `.uipx` `Projects[]`. */
|
|
14
|
+
projectId: string;
|
|
15
|
+
/** Display name for the project; typically the project folder name. */
|
|
16
|
+
projectName: string;
|
|
17
|
+
/** Project type as written to `project.uiproj` (e.g. `Flow`, `Agent`). */
|
|
18
|
+
projectType: string;
|
|
19
|
+
/** Optional SDK subType (AppV2: `"Coded"` / `"CodedAction"`). */
|
|
20
|
+
projectSubType?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Result envelope. Structurally identical to `ProjectArtifactsResult` in
|
|
24
|
+
* `@uipath/solution-sdk/resources` — declared here too because this
|
|
25
|
+
* package sits below `solution-sdk` in the dependency graph and cannot import
|
|
26
|
+
* from it.
|
|
27
|
+
*/
|
|
28
|
+
export interface ProjectArtifactsResult {
|
|
29
|
+
/** True when artifact resources were generated. */
|
|
30
|
+
Created: boolean;
|
|
31
|
+
/** Error message when `Created` is `false`. */
|
|
32
|
+
Error?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generate the `resources/solution_folder/...` artifact-resource entries for
|
|
36
|
+
* a project that has just been registered in its parent solution's `.uipx`.
|
|
37
|
+
*
|
|
38
|
+
* The implementation is resolved at runtime from the installed
|
|
39
|
+
* `@uipath/solution-tool` (through the CLI host's tool-module provider, which
|
|
40
|
+
* installs it on demand), so the multi-megabyte resource-builder chain is
|
|
41
|
+
* never bundled into the calling tool.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ensureProjectArtifacts(args: EnsureProjectArtifactsArgs): Promise<ProjectArtifactsResult>;
|
package/dist/telemetry/index.js
CHANGED
|
@@ -86,7 +86,7 @@ var COMMAND_ATTRIBUTION = commandAttribution([
|
|
|
86
86
|
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
87
87
|
["agenthub", "build", ["uip.agenthub"]],
|
|
88
88
|
["coded-apps", "build", ["uip.codedapp"]],
|
|
89
|
-
["functions", "build", ["uip.functions"]],
|
|
89
|
+
["functions", "build", ["uip.function", "uip.functions"]],
|
|
90
90
|
["solution", "build", ["uip.solution"]],
|
|
91
91
|
["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
|
|
92
92
|
["llm-observability", "troubleshoot", ["uip.traces"]],
|
|
@@ -762,14 +762,11 @@ class TelemetryService {
|
|
|
762
762
|
}
|
|
763
763
|
async trackDependencyOperation(name, type, fn, properties) {
|
|
764
764
|
const parentContext = this.getCurrentContext();
|
|
765
|
-
|
|
766
|
-
throw new Error("trackDependencyOperation must be called within a trackRequest block.");
|
|
767
|
-
}
|
|
768
|
-
const childContext = {
|
|
765
|
+
const childContext = parentContext !== undefined ? {
|
|
769
766
|
operationId: parentContext.operationId,
|
|
770
767
|
parentId: parentContext.id,
|
|
771
768
|
id: this.generateId()
|
|
772
|
-
};
|
|
769
|
+
} : this.createRequestContext();
|
|
773
770
|
const startTime = performance.now();
|
|
774
771
|
try {
|
|
775
772
|
const result = await this.contextStorage.run(childContext, fn);
|
|
@@ -845,4 +842,4 @@ export {
|
|
|
845
842
|
BrowserContextStorage
|
|
846
843
|
};
|
|
847
844
|
|
|
848
|
-
//# debugId=
|
|
845
|
+
//# debugId=E05A0A007C0249BF64756E2164756E21
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { ITelemetryProvider } from "./telemetry-provider.js";
|
|
2
2
|
import { type TelemetryProperties } from "./telemetry-service.js";
|
|
3
3
|
export { getGlobalTelemetryProperties, setGlobalTelemetryProperties, } from "./global-telemetry-properties.js";
|
|
4
|
+
/**
|
|
5
|
+
* Envelopes still buffered in the SDK channel at exit, plus the ingestion
|
|
6
|
+
* endpoint they were headed to. The envelopes are fully formed (tags, ikey,
|
|
7
|
+
* time already baked in) — POSTing them newline-joined and gzipped to
|
|
8
|
+
* `endpointUrl` with `Content-Type: application/x-json-stream` is exactly
|
|
9
|
+
* what the SDK's own sender would have done.
|
|
10
|
+
*/
|
|
11
|
+
export interface PendingTelemetryEnvelopes {
|
|
12
|
+
endpointUrl: string;
|
|
13
|
+
envelopes: unknown[];
|
|
14
|
+
}
|
|
4
15
|
/**
|
|
5
16
|
* Node.js Application Insights telemetry provider.
|
|
6
17
|
* Uses the `applicationinsights` Node SDK (not the browser SDK).
|
|
@@ -67,6 +78,15 @@ export declare class NodeAppInsightsTelemetryProvider implements ITelemetryProvi
|
|
|
67
78
|
trackRequest(name: string, duration: number, success: boolean, properties?: TelemetryProperties): Promise<void>;
|
|
68
79
|
trackDependency(name: string, type: string, duration: number, success: boolean, properties?: TelemetryProperties, resultCode?: string): Promise<void>;
|
|
69
80
|
flush(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Take the envelopes still buffered in the SDK channel (nothing has sent
|
|
83
|
+
* them yet), clearing the batch timer and the buffer so a later
|
|
84
|
+
* {@link shutdown} has nothing left to send or hold the event loop open
|
|
85
|
+
* with. Returns `undefined` when draining isn't possible (no client, no
|
|
86
|
+
* endpoint, or an unexpected SDK shape) — callers must then fall back to
|
|
87
|
+
* a normal in-process {@link flush}.
|
|
88
|
+
*/
|
|
89
|
+
drainPendingEnvelopes(): PendingTelemetryEnvelopes | undefined;
|
|
70
90
|
/**
|
|
71
91
|
* Dispose the Application Insights SDK so its internal channels,
|
|
72
92
|
* keep-alive sockets, and timers are closed — allowing the Node.js
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical CLI event names.
|
|
3
|
+
*
|
|
4
|
+
* Every name lives under the `uip.*` namespace so a single
|
|
5
|
+
* `name startswith "uip."` filter selects all CLI telemetry — a snake_case
|
|
6
|
+
* name outside it is invisible to every downstream pipeline (STUD-80942).
|
|
7
|
+
*/
|
|
1
8
|
export declare const CommonTelemetryEvents: {
|
|
2
9
|
readonly Error: "uip.error";
|
|
3
|
-
|
|
10
|
+
/** A ship (publish/deploy/upload) completed. The command that shipped is
|
|
11
|
+
* carried by the `command_name` dimension; `ship_kind`/`target` describe
|
|
12
|
+
* what was shipped where. */
|
|
13
|
+
readonly ShipSucceeded: "uip.ship.succeeded";
|
|
4
14
|
};
|
|
@@ -41,8 +41,23 @@ export interface TelemetryInitOptions {
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function telemetryInit(options?: TelemetryInitOptions): Promise<void>;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
* Must be awaited
|
|
46
|
-
*
|
|
44
|
+
* Deliver all buffered telemetry before the process exits.
|
|
45
|
+
* Must be awaited on every exit path.
|
|
46
|
+
*
|
|
47
|
+
* Normally hands the buffered envelopes to a detached sidecar process (see
|
|
48
|
+
* {@link trySidecarHandoff}) so the exit is instant. Falls back to the
|
|
49
|
+
* in-process flush — one ingestion round-trip, capped at
|
|
50
|
+
* FLUSH_SHUTDOWN_TIMEOUT_MS — when the sidecar handoff isn't available or
|
|
51
|
+
* UIPATH_TELEMETRY_SYNC_FLUSH=1 forces it.
|
|
47
52
|
*/
|
|
48
53
|
export declare function telemetryFlushAndShutdown(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Dispose the telemetry SDK without sending — buffered events are dropped
|
|
56
|
+
* on purpose. For exits where delivery is not worth a network round-trip
|
|
57
|
+
* (help/version display).
|
|
58
|
+
*
|
|
59
|
+
* Shares the memo slot with {@link telemetryFlushAndShutdown}: whichever
|
|
60
|
+
* runs first wins, so a later flush call on the same exit path awaits the
|
|
61
|
+
* already-finished shutdown instead of opening a network connection.
|
|
62
|
+
*/
|
|
63
|
+
export declare function telemetryShutdownWithoutFlush(): Promise<void>;
|
|
@@ -193,6 +193,11 @@ export interface ITelemetryService {
|
|
|
193
193
|
* @remarks
|
|
194
194
|
* Tracks this operation as a dependency in Application Insights, automatically correlated
|
|
195
195
|
* to the parent request using the context from IContextStorage.
|
|
196
|
+
*
|
|
197
|
+
* With no enclosing request the dependency is emitted as a trace root (no
|
|
198
|
+
* `operation_ParentId`) rather than being dropped or throwing — a reusable
|
|
199
|
+
* unit of work stays a dependency even when the host that called it never
|
|
200
|
+
* opened a request of ours.
|
|
196
201
|
*/
|
|
197
202
|
trackDependencyOperation<T>(name: string, type: string, fn: () => Promise<T>, properties?: TelemetryProperties): Promise<T>;
|
|
198
203
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hidden argv verb that makes the CLI entry point run the spool sender
|
|
3
|
+
* instead of the normal Commander pipeline. Never registered as a command —
|
|
4
|
+
* the entry point matches it on raw argv before the program is built.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TELEMETRY_DRAIN_ARGV = "__uip-drain-telemetry";
|
|
7
|
+
/**
|
|
8
|
+
* Register the script path that handles {@link TELEMETRY_DRAIN_ARGV}.
|
|
9
|
+
* Called once by the CLI entry point at startup; until it is called, the
|
|
10
|
+
* exit path keeps the in-process flush (no sidecar is ever spawned).
|
|
11
|
+
*/
|
|
12
|
+
export declare function setTelemetrySidecarEntry(entryPath: string): void;
|
|
13
|
+
export declare function getTelemetrySidecarEntry(): string | undefined;
|
|
14
|
+
/** Contents of one spool file. */
|
|
15
|
+
export interface TelemetrySpoolPayload {
|
|
16
|
+
/** Full ingestion URL (`<IngestionEndpoint>/v2.1/track`). */
|
|
17
|
+
endpointUrl: string;
|
|
18
|
+
/** Fully-formed App Insights envelopes, exactly as the SDK buffered them. */
|
|
19
|
+
envelopes: unknown[];
|
|
20
|
+
}
|
|
21
|
+
/** A pending spool file claimed for sending (renamed to `.sending`). */
|
|
22
|
+
export interface ClaimedSpoolFile {
|
|
23
|
+
/** The claimed (`.sending`) path — delete it after a successful send. */
|
|
24
|
+
claimedPath: string;
|
|
25
|
+
payload: TelemetrySpoolPayload;
|
|
26
|
+
}
|
|
27
|
+
/** Spool files older than this are deleted unsent — stale telemetry has no value. */
|
|
28
|
+
export declare const MAX_SPOOL_AGE_MS: number;
|
|
29
|
+
/** Hard cap on spool files; oldest beyond this are deleted (offline machines). */
|
|
30
|
+
export declare const MAX_SPOOL_FILES = 50;
|
|
31
|
+
export declare function getTelemetrySpoolDir(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Persist pending envelopes for the sidecar. Writes to a `.tmp` name first
|
|
34
|
+
* and renames into place so a concurrently-running sender never claims a
|
|
35
|
+
* half-written file. Returns the spool file path.
|
|
36
|
+
*/
|
|
37
|
+
export declare function writeTelemetrySpoolFile(payload: TelemetrySpoolPayload): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Claim every pending spool file for sending. Claiming renames the file to
|
|
40
|
+
* `.sending` — an atomic operation, so when two senders sweep concurrently
|
|
41
|
+
* only one wins each file and nothing is delivered twice. Files that fail
|
|
42
|
+
* the rename are skipped (another sender owns them).
|
|
43
|
+
*
|
|
44
|
+
* Bad content is split two ways on purpose: a file that cannot be READ is
|
|
45
|
+
* released for a later attempt (on Windows a concurrent handle shows up as a
|
|
46
|
+
* transient EBUSY, and deleting there would throw telemetry away for a problem
|
|
47
|
+
* that resolves itself), while a file that reads fine but does not parse or
|
|
48
|
+
* does not match the payload shape is deleted — no future sweep can make it
|
|
49
|
+
* valid, so keeping it would just burn a claim on every run until the age cap.
|
|
50
|
+
*/
|
|
51
|
+
export declare function claimPendingSpoolFiles(): Promise<ClaimedSpoolFile[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Return a claimed file to the pending pool so a future sender retries it.
|
|
54
|
+
* Best-effort: if the rename fails the file stays `.sending` and the age
|
|
55
|
+
* cap eventually removes it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function releaseClaimedSpoolFile(claimedPath: string): Promise<void>;
|
|
58
|
+
/** Delete a claimed file after its envelopes were delivered. Best-effort. */
|
|
59
|
+
export declare function discardClaimedSpoolFile(claimedPath: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Enforce the spool bounds: delete any file older than
|
|
62
|
+
* {@link MAX_SPOOL_AGE_MS} — including `.sending` files orphaned by a
|
|
63
|
+
* crashed sender and `.tmp` files orphaned by a crashed writer — and keep at
|
|
64
|
+
* most {@link MAX_SPOOL_FILES} pending files, deleting the oldest beyond
|
|
65
|
+
* that. Run by the sender before claiming, so an unreachable endpoint can't
|
|
66
|
+
* grow the spool without bound.
|
|
67
|
+
*/
|
|
68
|
+
export declare function sweepTelemetrySpool(): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic import of another tool's library entry point (e.g.
|
|
3
|
+
* `@uipath/solution-tool/init`).
|
|
4
|
+
*
|
|
5
|
+
* Its own module so tests can stand in for it, and so the specifier stays a
|
|
6
|
+
* plain variable — bundlers then leave the `import()` to run at runtime
|
|
7
|
+
* instead of inlining the multi-megabyte target bundle into the caller.
|
|
8
|
+
*/
|
|
9
|
+
export declare function importToolModule(specifier: string): Promise<unknown>;
|
package/dist/tool-provider.d.ts
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cross-module bridge for packager factory resolution.
|
|
2
|
+
* Cross-module bridge for packager factory and tool-module resolution.
|
|
3
3
|
*/
|
|
4
4
|
export type PackagerFactoryProvider = (verb: string) => Promise<void>;
|
|
5
5
|
export declare function setPackagerFactoryProvider(provider: PackagerFactoryProvider): void;
|
|
6
|
-
export
|
|
6
|
+
export type ToolModuleProvider = (verb: string, moduleName: string) => Promise<unknown>;
|
|
7
|
+
export declare function setToolModuleProvider(provider: ToolModuleProvider): void;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve another tool's library entry point (its `dist/<module>.js` subpath
|
|
10
|
+
* export) at runtime and return the module namespace.
|
|
11
|
+
*
|
|
12
|
+
* Prefers the registered provider (installed by the CLI — it can install the
|
|
13
|
+
* tool on demand and imports the entry by absolute path). With no provider —
|
|
14
|
+
* a library caller — falls back to importing `<packageName>/<moduleName>`,
|
|
15
|
+
* which resolves when the tool package is installed next to the caller.
|
|
16
|
+
*
|
|
17
|
+
* This is how one tool uses another tool's code without bundling it: the
|
|
18
|
+
* multi-megabyte implementation ships once, in the tool that owns it.
|
|
19
|
+
*
|
|
20
|
+
* @param verb - CLI tool verb that owns the module (e.g. `"solution"`).
|
|
21
|
+
* @param packageName - npm package behind that verb, used for the fallback
|
|
22
|
+
* import (e.g. `"@uipath/solution-tool"`).
|
|
23
|
+
* @param moduleName - subpath entry to load (e.g. `"init"`, `"resource"`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function ensureToolModule(verb: string, packageName: string, moduleName: string): Promise<unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the packager factory for a tool verb.
|
|
28
|
+
*
|
|
29
|
+
* Prefers the registered provider (installed by the CLI). With no provider —
|
|
30
|
+
* a library caller — falls back to the tool package's own `packager-tool`
|
|
31
|
+
* entry point: imports it and calls its `registerPackagerFactories` export.
|
|
32
|
+
*
|
|
33
|
+
* @param verb - CLI tool verb that owns the factory (e.g. `"maestro"`).
|
|
34
|
+
* @param packageName - npm package behind that verb. Drives the fallback
|
|
35
|
+
* import and is the one thing the error asks for. Omit when unknown; there is
|
|
36
|
+
* then no fallback and no package to name.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ensurePackagerFactory(verb: string, packageName?: string): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/common",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.200.0-preview.117",
|
|
5
5
|
"description": "Common infrastructure needed by uip tools.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/catch-error.d.ts",
|
|
29
29
|
"default": "./dist/catch-error.js"
|
|
30
30
|
},
|
|
31
|
+
"./guid": {
|
|
32
|
+
"types": "./dist/guid.d.ts",
|
|
33
|
+
"default": "./dist/guid.js"
|
|
34
|
+
},
|
|
31
35
|
"./sdk-user-agent": {
|
|
32
36
|
"browser": {
|
|
33
37
|
"types": "./dist/sdk-user-agent.d.ts",
|
|
@@ -67,5 +71,5 @@
|
|
|
67
71
|
"mihaigirleanu",
|
|
68
72
|
"vlad-uipath"
|
|
69
73
|
],
|
|
70
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "5ba432ca14252784a1e20c03f5a858a5ae39746e"
|
|
71
75
|
}
|