@uipath/agent-sdk 0.1.1 → 0.1.2
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 +102 -55
- package/package.json +3 -6
package/dist/index.js
CHANGED
|
@@ -6716,6 +6716,38 @@ var init_js_yaml = __esm(() => {
|
|
|
6716
6716
|
safeDump = renamed("safeDump", "dump");
|
|
6717
6717
|
});
|
|
6718
6718
|
|
|
6719
|
+
// ../common/src/singleton.ts
|
|
6720
|
+
function singleton(ctorOrName) {
|
|
6721
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
6722
|
+
const key = Symbol.for(PREFIX + name);
|
|
6723
|
+
return {
|
|
6724
|
+
get(fallback) {
|
|
6725
|
+
return _g[key] ?? fallback;
|
|
6726
|
+
},
|
|
6727
|
+
set(value) {
|
|
6728
|
+
_g[key] = value;
|
|
6729
|
+
},
|
|
6730
|
+
clear() {
|
|
6731
|
+
delete _g[key];
|
|
6732
|
+
},
|
|
6733
|
+
getOrInit(factory, guard) {
|
|
6734
|
+
const existing = _g[key];
|
|
6735
|
+
if (existing != null && typeof existing === "object") {
|
|
6736
|
+
if (!guard || guard(existing)) {
|
|
6737
|
+
return existing;
|
|
6738
|
+
}
|
|
6739
|
+
}
|
|
6740
|
+
const instance = factory();
|
|
6741
|
+
_g[key] = instance;
|
|
6742
|
+
return instance;
|
|
6743
|
+
}
|
|
6744
|
+
};
|
|
6745
|
+
}
|
|
6746
|
+
var PREFIX = "@uipath/common/", _g;
|
|
6747
|
+
var init_singleton = __esm(() => {
|
|
6748
|
+
_g = globalThis;
|
|
6749
|
+
});
|
|
6750
|
+
|
|
6719
6751
|
// ../common/src/output-context.ts
|
|
6720
6752
|
function createStorage() {
|
|
6721
6753
|
const [error, mod2] = catchError(() => __require("node:async_hooks"));
|
|
@@ -6730,11 +6762,14 @@ function createStorage() {
|
|
|
6730
6762
|
return new mod2.AsyncLocalStorage;
|
|
6731
6763
|
}
|
|
6732
6764
|
function getOutputSink() {
|
|
6733
|
-
return outputStorage.getStore() ??
|
|
6765
|
+
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
6734
6766
|
}
|
|
6735
|
-
var
|
|
6767
|
+
var storageSingleton, sinkSlot, outputStorage, CONSOLE_FALLBACK;
|
|
6736
6768
|
var init_output_context = __esm(() => {
|
|
6737
|
-
|
|
6769
|
+
init_singleton();
|
|
6770
|
+
storageSingleton = singleton("OutputStorage");
|
|
6771
|
+
sinkSlot = singleton("OutputSink");
|
|
6772
|
+
outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
6738
6773
|
CONSOLE_FALLBACK = {
|
|
6739
6774
|
writeOut: (str2) => process.stdout.write(str2),
|
|
6740
6775
|
writeErr: (str2) => process.stderr.write(str2),
|
|
@@ -6751,19 +6786,21 @@ var init_output_context = __esm(() => {
|
|
|
6751
6786
|
import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
6752
6787
|
import { dirname } from "node:path";
|
|
6753
6788
|
function setGlobalLogFilePath(path) {
|
|
6754
|
-
|
|
6789
|
+
logFilePathSlot.set(path);
|
|
6755
6790
|
}
|
|
6756
6791
|
function getGlobalLogFilePath() {
|
|
6757
|
-
return
|
|
6792
|
+
return logFilePathSlot.get("");
|
|
6758
6793
|
}
|
|
6759
6794
|
function getLogFilePath() {
|
|
6760
6795
|
return logger.getLogFilePath();
|
|
6761
6796
|
}
|
|
6762
|
-
var
|
|
6797
|
+
var logFilePathSlot, DEFAULT_LOG_LEVEL = 3 /* ERROR */, SimpleLogger, loggerSingleton, logger;
|
|
6763
6798
|
var init_logger = __esm(() => {
|
|
6764
6799
|
init_output_context();
|
|
6800
|
+
init_singleton();
|
|
6801
|
+
logFilePathSlot = singleton("logFilePath");
|
|
6765
6802
|
SimpleLogger = class SimpleLogger {
|
|
6766
|
-
|
|
6803
|
+
__brand = "SimpleLogger";
|
|
6767
6804
|
level;
|
|
6768
6805
|
logFilePath;
|
|
6769
6806
|
fileLoggingEnabled;
|
|
@@ -6773,13 +6810,10 @@ var init_logger = __esm(() => {
|
|
|
6773
6810
|
this.fileLoggingEnabled = false;
|
|
6774
6811
|
}
|
|
6775
6812
|
static getInstance() {
|
|
6776
|
-
|
|
6777
|
-
SimpleLogger.instance = new SimpleLogger;
|
|
6778
|
-
}
|
|
6779
|
-
return SimpleLogger.instance;
|
|
6813
|
+
return loggerSingleton.getOrInit(() => new SimpleLogger, (v) => ("__brand" in v) && v.__brand === "SimpleLogger");
|
|
6780
6814
|
}
|
|
6781
6815
|
static resetInstance() {
|
|
6782
|
-
|
|
6816
|
+
loggerSingleton.clear();
|
|
6783
6817
|
}
|
|
6784
6818
|
static isNode = typeof process !== "undefined" && !!process.versions?.node;
|
|
6785
6819
|
static resolveLevel() {
|
|
@@ -6923,18 +6957,23 @@ var init_logger = __esm(() => {
|
|
|
6923
6957
|
}
|
|
6924
6958
|
};
|
|
6925
6959
|
};
|
|
6960
|
+
loggerSingleton = singleton(SimpleLogger);
|
|
6926
6961
|
logger = SimpleLogger.getInstance();
|
|
6927
6962
|
});
|
|
6928
6963
|
|
|
6929
6964
|
// ../common/src/output-format-context.ts
|
|
6930
6965
|
function getOutputFormat() {
|
|
6931
|
-
return
|
|
6966
|
+
return formatSlot.get("table");
|
|
6932
6967
|
}
|
|
6933
6968
|
function getOutputFilter() {
|
|
6934
|
-
return
|
|
6969
|
+
return filterSlot.get();
|
|
6935
6970
|
}
|
|
6936
|
-
var
|
|
6937
|
-
|
|
6971
|
+
var formatSlot, filterSlot;
|
|
6972
|
+
var init_output_format_context = __esm(() => {
|
|
6973
|
+
init_singleton();
|
|
6974
|
+
formatSlot = singleton("OutputFormat");
|
|
6975
|
+
filterSlot = singleton("OutputFilter");
|
|
6976
|
+
});
|
|
6938
6977
|
// ../telemetry/src/contextstorage/adapters/node-context-storage.ts
|
|
6939
6978
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6940
6979
|
|
|
@@ -7116,30 +7155,22 @@ var init_logger_telemetry_provider = __esm(() => {
|
|
|
7116
7155
|
// ../common/src/node-appinsights-telemetry-provider.ts
|
|
7117
7156
|
function setGlobalTelemetryProperties(properties) {
|
|
7118
7157
|
const existing = getGlobalTelemetryProperties();
|
|
7119
|
-
|
|
7120
|
-
...existing,
|
|
7121
|
-
...properties
|
|
7122
|
-
};
|
|
7158
|
+
telemetryPropsSlot.set({ ...existing, ...properties });
|
|
7123
7159
|
}
|
|
7124
7160
|
function getGlobalTelemetryProperties() {
|
|
7125
|
-
return
|
|
7161
|
+
return telemetryPropsSlot.get();
|
|
7126
7162
|
}
|
|
7127
|
-
var
|
|
7163
|
+
var telemetryPropsSlot, providerSlot;
|
|
7128
7164
|
var init_node_appinsights_telemetry_provider = __esm(() => {
|
|
7129
7165
|
init_logger();
|
|
7166
|
+
init_singleton();
|
|
7167
|
+
telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
7168
|
+
providerSlot = singleton("TelemetryProvider");
|
|
7130
7169
|
});
|
|
7131
7170
|
|
|
7132
7171
|
// ../common/src/telemetry.ts
|
|
7133
|
-
function getOrCreateSessionId() {
|
|
7134
|
-
const existing = globalThis[GLOBAL_SESSION_ID_KEY];
|
|
7135
|
-
if (typeof existing === "string")
|
|
7136
|
-
return existing;
|
|
7137
|
-
const id = crypto.randomUUID();
|
|
7138
|
-
globalThis[GLOBAL_SESSION_ID_KEY] = id;
|
|
7139
|
-
return id;
|
|
7140
|
-
}
|
|
7141
7172
|
function getGlobalTelemetryInstance() {
|
|
7142
|
-
const existing =
|
|
7173
|
+
const existing = telemetryInstanceSlot.get();
|
|
7143
7174
|
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
7144
7175
|
return existing;
|
|
7145
7176
|
}
|
|
@@ -7154,13 +7185,14 @@ function getTelemetryInstance() {
|
|
|
7154
7185
|
}
|
|
7155
7186
|
return _localTelemetryInstance;
|
|
7156
7187
|
}
|
|
7157
|
-
var
|
|
7188
|
+
var telemetryInstanceSlot, DEFAULT_AI_CONNECTION_STRING, _localTelemetryInstance, telemetry;
|
|
7158
7189
|
var init_telemetry = __esm(() => {
|
|
7159
7190
|
init_node();
|
|
7160
7191
|
init_logger();
|
|
7161
7192
|
init_logger_telemetry_provider();
|
|
7162
7193
|
init_node_appinsights_telemetry_provider();
|
|
7163
|
-
|
|
7194
|
+
init_singleton();
|
|
7195
|
+
telemetryInstanceSlot = singleton("TelemetryService");
|
|
7164
7196
|
DEFAULT_AI_CONNECTION_STRING = Buffer.from("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj", "base64").toString("utf-8");
|
|
7165
7197
|
telemetry = new Proxy({}, {
|
|
7166
7198
|
get(_, prop) {
|
|
@@ -7206,7 +7238,7 @@ function printOutput(data, format = "table", logFn) {
|
|
|
7206
7238
|
break;
|
|
7207
7239
|
}
|
|
7208
7240
|
default: {
|
|
7209
|
-
if ("Data" in data && data.Data != null) {
|
|
7241
|
+
if ("Data" in data && data.Data != null && !(Array.isArray(data.Data) && data.Data.length === 0)) {
|
|
7210
7242
|
const logValue = data.Log;
|
|
7211
7243
|
if (Array.isArray(data.Data)) {
|
|
7212
7244
|
printResizableTable(data.Data, logFn, logValue);
|
|
@@ -7369,6 +7401,7 @@ var init_formatter = __esm(() => {
|
|
|
7369
7401
|
init_js_yaml();
|
|
7370
7402
|
init_logger();
|
|
7371
7403
|
init_output_context();
|
|
7404
|
+
init_output_format_context();
|
|
7372
7405
|
init_telemetry();
|
|
7373
7406
|
init_telemetry_events();
|
|
7374
7407
|
((OutputFormatter) => {
|
|
@@ -7425,11 +7458,16 @@ var init_command_help = __esm(() => {
|
|
|
7425
7458
|
init_esm();
|
|
7426
7459
|
init_formatter();
|
|
7427
7460
|
init_output_context();
|
|
7461
|
+
init_output_format_context();
|
|
7428
7462
|
});
|
|
7429
7463
|
|
|
7430
7464
|
// ../common/src/console-guard.ts
|
|
7465
|
+
var guardInstalledSlot, savedOriginalsSlot;
|
|
7431
7466
|
var init_console_guard = __esm(() => {
|
|
7432
7467
|
init_output_context();
|
|
7468
|
+
init_singleton();
|
|
7469
|
+
guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
7470
|
+
savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
7433
7471
|
});
|
|
7434
7472
|
|
|
7435
7473
|
// ../common/src/constants.ts
|
|
@@ -7437,7 +7475,6 @@ var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", CONFIG_FILENAME = "con
|
|
|
7437
7475
|
var init_constants = __esm(() => {
|
|
7438
7476
|
DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
7439
7477
|
});
|
|
7440
|
-
|
|
7441
7478
|
// ../common/src/error-handler.ts
|
|
7442
7479
|
var init_error_handler = () => {};
|
|
7443
7480
|
|
|
@@ -8887,6 +8924,27 @@ var init_polling = __esm(() => {
|
|
|
8887
8924
|
init_terminal_statuses();
|
|
8888
8925
|
init_types();
|
|
8889
8926
|
});
|
|
8927
|
+
|
|
8928
|
+
// ../common/src/screen-logger.ts
|
|
8929
|
+
var ScreenLogger;
|
|
8930
|
+
var init_screen_logger = __esm(() => {
|
|
8931
|
+
init_output_context();
|
|
8932
|
+
((ScreenLogger) => {
|
|
8933
|
+
function progress(message) {
|
|
8934
|
+
getOutputSink().writeErr(`${message}
|
|
8935
|
+
`);
|
|
8936
|
+
}
|
|
8937
|
+
ScreenLogger.progress = progress;
|
|
8938
|
+
})(ScreenLogger ||= {});
|
|
8939
|
+
});
|
|
8940
|
+
|
|
8941
|
+
// ../common/src/tool-provider.ts
|
|
8942
|
+
var factorySlot;
|
|
8943
|
+
var init_tool_provider = __esm(() => {
|
|
8944
|
+
init_singleton();
|
|
8945
|
+
factorySlot = singleton("PackagerFactoryProvider");
|
|
8946
|
+
});
|
|
8947
|
+
|
|
8890
8948
|
// ../common/src/trackedAction.ts
|
|
8891
8949
|
function deriveCommandPath(cmd) {
|
|
8892
8950
|
const parts = [];
|
|
@@ -8903,24 +8961,16 @@ function deriveCommandPath(cmd) {
|
|
|
8903
8961
|
}
|
|
8904
8962
|
return ["uip", ...parts.filter((p) => p !== "uip")].join(".");
|
|
8905
8963
|
}
|
|
8906
|
-
var
|
|
8964
|
+
var pollSignalSlot;
|
|
8907
8965
|
var init_trackedAction = __esm(() => {
|
|
8908
8966
|
init_esm();
|
|
8909
8967
|
init_formatter();
|
|
8910
8968
|
init_logger();
|
|
8969
|
+
init_singleton();
|
|
8911
8970
|
init_telemetry();
|
|
8912
|
-
|
|
8913
|
-
Command.prototype.trackedAction = function(context,
|
|
8971
|
+
pollSignalSlot = singleton("PollSignal");
|
|
8972
|
+
Command.prototype.trackedAction = function(context, fn, properties) {
|
|
8914
8973
|
const command = this;
|
|
8915
|
-
let fn;
|
|
8916
|
-
let properties;
|
|
8917
|
-
if (typeof fnOrName === "string") {
|
|
8918
|
-
fn = fnOrProps;
|
|
8919
|
-
properties = legacyProperties;
|
|
8920
|
-
} else {
|
|
8921
|
-
fn = fnOrName;
|
|
8922
|
-
properties = fnOrProps;
|
|
8923
|
-
}
|
|
8924
8974
|
return this.action(async (...args) => {
|
|
8925
8975
|
const telemetryName = deriveCommandPath(command);
|
|
8926
8976
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
@@ -8960,10 +9010,13 @@ var init_src = __esm(() => {
|
|
|
8960
9010
|
init_jsonpath();
|
|
8961
9011
|
init_logger();
|
|
8962
9012
|
init_output_context();
|
|
9013
|
+
init_output_format_context();
|
|
8963
9014
|
init_polling();
|
|
8964
9015
|
init_registry();
|
|
9016
|
+
init_screen_logger();
|
|
8965
9017
|
init_telemetry();
|
|
8966
9018
|
init_telemetry_events();
|
|
9019
|
+
init_tool_provider();
|
|
8967
9020
|
init_trackedAction();
|
|
8968
9021
|
});
|
|
8969
9022
|
|
|
@@ -26606,7 +26659,8 @@ var resolveConfigAsync = async ({
|
|
|
26606
26659
|
while (baseUrl.endsWith("/")) {
|
|
26607
26660
|
baseUrl = baseUrl.slice(0, -1);
|
|
26608
26661
|
}
|
|
26609
|
-
const
|
|
26662
|
+
const resolvedBaseUrl = baseUrl;
|
|
26663
|
+
const [urlError, url2] = catchError(() => new URL(resolvedBaseUrl));
|
|
26610
26664
|
if (urlError) {
|
|
26611
26665
|
throw new InvalidBaseUrlError(baseUrl, `Malformed URL. ${urlError instanceof Error ? urlError.message : "Unknown error"}`);
|
|
26612
26666
|
}
|
|
@@ -26618,9 +26672,6 @@ var resolveConfigAsync = async ({
|
|
|
26618
26672
|
baseUrl = url2.origin;
|
|
26619
26673
|
}
|
|
26620
26674
|
let clientId = customClientId;
|
|
26621
|
-
if (!clientId) {
|
|
26622
|
-
clientId = process.env.UIPATH_CLIENT_ID;
|
|
26623
|
-
}
|
|
26624
26675
|
if (!clientId && config2.auth?.clientId) {
|
|
26625
26676
|
clientId = config2.auth.clientId;
|
|
26626
26677
|
}
|
|
@@ -26628,9 +26679,6 @@ var resolveConfigAsync = async ({
|
|
|
26628
26679
|
clientId = DEFAULT_CLIENT_ID;
|
|
26629
26680
|
}
|
|
26630
26681
|
let clientSecret = customClientSecret;
|
|
26631
|
-
if (!clientSecret) {
|
|
26632
|
-
clientSecret = process.env.UIPATH_CLIENT_SECRET;
|
|
26633
|
-
}
|
|
26634
26682
|
if (!clientSecret && config2.auth?.clientSecret) {
|
|
26635
26683
|
clientSecret = config2.auth.clientSecret;
|
|
26636
26684
|
}
|
|
@@ -26904,7 +26952,6 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
26904
26952
|
if (result.loginStatus === "Logged in") {
|
|
26905
26953
|
const userId = getUserIdFromToken(accessToken);
|
|
26906
26954
|
const defaultProps = {
|
|
26907
|
-
sessionId,
|
|
26908
26955
|
...userId ? { userId } : {},
|
|
26909
26956
|
...result.tenantId ? { tenantId: result.tenantId } : {},
|
|
26910
26957
|
...result.organizationId ? { organizationId: result.organizationId } : {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/agent-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "SDK for the UiPath Agent Runtime API — evaluation execution and debug sessions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,13 +29,10 @@
|
|
|
29
29
|
"generate": "bun run src/scripts/generate-sdk.ts",
|
|
30
30
|
"lint": "biome check ."
|
|
31
31
|
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@uipath/auth": "workspace:*",
|
|
34
|
-
"@uipath/common": "workspace:*"
|
|
35
|
-
},
|
|
36
32
|
"devDependencies": {
|
|
37
33
|
"@openapitools/openapi-generator-cli": "^2.28.3",
|
|
38
|
-
"@types/node": "^25.
|
|
34
|
+
"@types/node": "^25.5.0",
|
|
35
|
+
"@uipath/auth": "0.1.11",
|
|
39
36
|
"typescript": "^5"
|
|
40
37
|
}
|
|
41
38
|
}
|