@uipath/agent-tool 1.200.0-preview.109 → 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.
Files changed (31) hide show
  1. package/dist/{agent-project-service-j3sst5cf.js → agent-project-service-wyh0r5cb.js} +3 -3
  2. package/dist/agent-tool-OK5DK57D-mxt5stp9.js +12 -0
  3. package/dist/{browser-strategy-v4n9zxyf.js → browser-strategy-16yagjhr.js} +1 -1
  4. package/dist/executor-tool.js +296 -0
  5. package/dist/{index-b13x0rpx.js → index-3pq4x5b7.js} +12 -9
  6. package/dist/index-9f8q2ege.js +2058 -0
  7. package/dist/{packager-tool-mf36zc9b.js → index-hsadteg4.js} +41 -253
  8. package/dist/{index-p0nmgr54.js → index-p052hv12.js} +5 -5
  9. package/dist/{index-08fsnqg0.js → index-rqfxg3fq.js} +1 -1
  10. package/dist/index.js +14 -12
  11. package/dist/{integration-tool-service-z414k85p.js → integration-tool-service-dgk5br9n.js} +4 -4
  12. package/dist/{is-client-m0srzs8p.js → is-client-7pyb4pet.js} +3 -3
  13. package/dist/js-yaml-cggj6w7q.js +3145 -0
  14. package/dist/{packager-tool-jmzese1s.js → node-strategy-1r3qegaf.js} +62 -32
  15. package/dist/packager-tool-4fge2k9c.js +419 -0
  16. package/dist/{packager-tool-9tv93r4w.js → packager-tool-b098y4a2.js} +2 -418
  17. package/dist/{packager-tool-dcazs5r7.js → packager-tool-expj850v.js} +6 -4
  18. package/dist/{packager-tool-fzq5y98q.js → packager-tool-ftfbnjpc.js} +2 -2
  19. package/dist/{packager-tool-yet9qmnt.js → packager-tool-fz1pzt1z.js} +93 -21
  20. package/dist/{packager-tool-wfbw3w4y.js → packager-tool-hxd8e3e6.js} +120 -5152
  21. package/dist/{packager-tool-1snc64g4.js → packager-tool-q42rrs00.js} +3 -2
  22. package/dist/packager-tool-qa9gftnj.js +31 -0
  23. package/dist/packager-tool-rev4tnf6.js +8340 -0
  24. package/dist/{packager-tool-k0e3bv7y.js → packager-tool-ty88v0fy.js} +5 -5
  25. package/dist/{packager-tool-wywyn3hw.js → packager-tool-xz142g61.js} +807 -8956
  26. package/dist/packager-tool-yv3rvyas.js +239 -0
  27. package/dist/packager-tool.js +5 -4
  28. package/dist/tool.js +14 -12
  29. package/package.json +4 -3
  30. package/dist/agent-tool-OK5DK57D-8nt05j7t.js +0 -11
  31. package/dist/node-strategy-cvesesna.js +0 -65
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AgentProjectService
3
- } from "./packager-tool-fzq5y98q.js";
4
- import"./packager-tool-wfbw3w4y.js";
3
+ } from "./packager-tool-ftfbnjpc.js";
4
+ import"./packager-tool-hxd8e3e6.js";
5
5
  import"./packager-tool-nsrs2tm5.js";
6
- import"./packager-tool-mf36zc9b.js";
6
+ import"./packager-tool-yv3rvyas.js";
7
7
  import"./packager-tool-wckvcay0.js";
8
8
  export {
9
9
  AgentProjectService
@@ -0,0 +1,12 @@
1
+ import {
2
+ AgentTool
3
+ } from "./packager-tool-expj850v.js";
4
+ import"./packager-tool-4fge2k9c.js";
5
+ import"./packager-tool-zwztyzps.js";
6
+ import"./packager-tool-b098y4a2.js";
7
+ import"./packager-tool-wckvcay0.js";
8
+ export {
9
+ AgentTool
10
+ };
11
+
12
+ //# debugId=0C17AF32789E0B7264756E2164756E21
@@ -3,7 +3,7 @@ import {
3
3
  } from "./packager-tool-0gctz400.js";
4
4
  import {
5
5
  AUTH_CANCELLED_ERROR_CODE
6
- } from "./packager-tool-1snc64g4.js";
6
+ } from "./packager-tool-q42rrs00.js";
7
7
  import"./packager-tool-wckvcay0.js";
8
8
 
9
9
  // ../auth/src/strategies/browser-strategy.ts
@@ -0,0 +1,296 @@
1
+ import {
2
+ AgentDebugCancelledError,
3
+ AgentDebugService
4
+ } from "./packager-tool-rev4tnf6.js";
5
+ import"./packager-tool-ftfbnjpc.js";
6
+ import"./packager-tool-hxd8e3e6.js";
7
+ import"./packager-tool-nsrs2tm5.js";
8
+ import"./packager-tool-fz1pzt1z.js";
9
+ import"./packager-tool-0gctz400.js";
10
+ import"./packager-tool-qa9gftnj.js";
11
+ import"./packager-tool-yv3rvyas.js";
12
+ import"./packager-tool-q42rrs00.js";
13
+ import"./packager-tool-b098y4a2.js";
14
+ import"./packager-tool-wckvcay0.js";
15
+ // ../executor/project-executor/src/models/run-status.ts
16
+ var TERMINAL_RUN_STATUSES = [
17
+ "Succeeded" /* Succeeded */,
18
+ "Faulted" /* Faulted */,
19
+ "Cancelled" /* Cancelled */
20
+ ];
21
+ function isTerminalRunStatus(status) {
22
+ return TERMINAL_RUN_STATUSES.includes(status);
23
+ }
24
+ var RAW_STATUS_MAP = {
25
+ completed: "Succeeded" /* Succeeded */,
26
+ faulted: "Faulted" /* Faulted */,
27
+ cancelled: "Cancelled" /* Cancelled */,
28
+ canceled: "Cancelled" /* Cancelled */,
29
+ failed: "Faulted" /* Faulted */,
30
+ running: "Running" /* Running */,
31
+ inprogress: "Running" /* Running */,
32
+ pending: "Pending" /* Pending */,
33
+ successful: "Succeeded" /* Succeeded */,
34
+ stopped: "Cancelled" /* Cancelled */,
35
+ stopping: "Running" /* Running */,
36
+ suspended: "Suspended" /* Suspended */,
37
+ terminating: "Running" /* Running */,
38
+ new: "Pending" /* Pending */,
39
+ waitingforresource: "Pending" /* Pending */
40
+ };
41
+ function mapRunStatus(rawStatus) {
42
+ if (!rawStatus)
43
+ return "Unknown" /* Unknown */;
44
+ return RAW_STATUS_MAP[rawStatus.toLowerCase()] ?? "Unknown" /* Unknown */;
45
+ }
46
+
47
+ // ../executor/project-executor/src/models/run-result.ts
48
+ class RunResult {
49
+ status;
50
+ errorCode;
51
+ rawStatus;
52
+ message;
53
+ jobKey;
54
+ instanceId;
55
+ runId;
56
+ traceId;
57
+ steps;
58
+ output;
59
+ url;
60
+ details;
61
+ constructor(status, errorCode = "None" /* None */, message) {
62
+ this.status = status;
63
+ this.errorCode = errorCode;
64
+ this.message = message;
65
+ }
66
+ get isSuccess() {
67
+ return this.status === "Succeeded" /* Succeeded */ && this.errorCode === "None" /* None */;
68
+ }
69
+ get isTerminal() {
70
+ return isTerminalRunStatus(this.status);
71
+ }
72
+ static succeeded(init = {}) {
73
+ return Object.assign(new RunResult("Succeeded" /* Succeeded */, "None" /* None */), init);
74
+ }
75
+ static failed(errorCode, message, init = {}) {
76
+ return Object.assign(new RunResult("Faulted" /* Faulted */, errorCode, message), init);
77
+ }
78
+ }
79
+ // ../executor/project-executor/src/services/executors-factory-repository.ts
80
+ class ExecutorsFactoryRepository {
81
+ factoryMap = new Map;
82
+ onConflict;
83
+ constructor(onConflict) {
84
+ this.onConflict = onConflict ?? ((message) => console.warn(message));
85
+ }
86
+ registerProjectExecutorFactory(factory) {
87
+ for (const projectType of factory.supportedTypes) {
88
+ const existing = this.factoryMap.get(projectType);
89
+ if (existing) {
90
+ if (existing.constructor?.name !== factory.constructor?.name) {
91
+ this.onConflict(`Executor factory conflict for project type '${projectType}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
92
+ }
93
+ continue;
94
+ }
95
+ this.factoryMap.set(projectType, factory);
96
+ }
97
+ }
98
+ canHandleProject(projectType) {
99
+ return this.factoryMap.has(projectType);
100
+ }
101
+ getProjectExecutorFactory(projectType) {
102
+ const factory = this.factoryMap.get(projectType);
103
+ if (!factory) {
104
+ throw new Error(`No executor is registered for project type '${projectType}'. ` + `Registered types: ${this.registeredTypes.join(", ") || "none"}.`);
105
+ }
106
+ return factory;
107
+ }
108
+ get registeredTypes() {
109
+ return [...this.factoryMap.keys()];
110
+ }
111
+ reset() {
112
+ this.factoryMap.clear();
113
+ }
114
+ }
115
+ var REGISTRY_KEY = Symbol.for("@uipath/project-executor/executorsFactoryRepository");
116
+ var _global = globalThis;
117
+ if (!_global[REGISTRY_KEY]) {
118
+ _global[REGISTRY_KEY] = new ExecutorsFactoryRepository;
119
+ }
120
+ var executorsFactoryRepository = _global[REGISTRY_KEY];
121
+
122
+ // ../executor/project-executor/src/services/executor-factory-provider.ts
123
+ var PROVIDER_KEY = Symbol.for("@uipath/project-executor/executorFactoryProvider");
124
+ // ../executor/project-executor/src/services/project-executor.ts
125
+ class ProjectExecutor {
126
+ fileSystem;
127
+ logger;
128
+ constructor(fileSystem, logger) {
129
+ this.fileSystem = fileSystem;
130
+ this.logger = logger;
131
+ }
132
+ runAsync(_options, _cancellationToken) {
133
+ return Promise.resolve(RunResult.failed("UnsupportedProjectType" /* UnsupportedProjectType */, `${this.constructor.name} does not support run.`));
134
+ }
135
+ async resolveDefaultEntryPoint(projectPath) {
136
+ const entryPointsFile = this.fileSystem.path.join(projectPath, ENTRY_POINTS_FILE_NAME);
137
+ try {
138
+ const raw = await this.fileSystem.readFile(entryPointsFile, "utf-8");
139
+ if (!raw) {
140
+ return;
141
+ }
142
+ const declared = JSON.parse(raw).entryPoints;
143
+ return this.firstDeclaredEntryPoint(declared);
144
+ } catch (error) {
145
+ this.logger.warn(`Could not read the default entry point from ${entryPointsFile}: ${error instanceof Error ? error.message : String(error)}`);
146
+ return;
147
+ }
148
+ }
149
+ asEntryPoint(value) {
150
+ return typeof value === "string" && value.length > 0 ? value : undefined;
151
+ }
152
+ firstDeclaredEntryPoint(entryPoints) {
153
+ if (!Array.isArray(entryPoints)) {
154
+ return;
155
+ }
156
+ for (const entry of entryPoints) {
157
+ const filePath = this.asEntryPoint(entry?.filePath);
158
+ if (filePath) {
159
+ return filePath;
160
+ }
161
+ }
162
+ return;
163
+ }
164
+ dispose() {
165
+ return Promise.resolve();
166
+ }
167
+ }
168
+ var ENTRY_POINTS_FILE_NAME = "entry-points.json";
169
+ // src/executor/agent-project-executor.ts
170
+ var AGENT_ENTRY_POINT = "agent.json";
171
+ var DEFAULT_POLL_INTERVAL_MS = 2000;
172
+ var DEFAULT_TIMEOUT_MS = 600000;
173
+ var defaultRunnerFactory = () => new AgentDebugService;
174
+
175
+ class AgentProjectExecutor extends ProjectExecutor {
176
+ createRunner;
177
+ constructor(fileSystem, logger, createRunner = defaultRunnerFactory) {
178
+ super(fileSystem, logger);
179
+ this.createRunner = createRunner;
180
+ }
181
+ async runAsync(options, cancellationToken) {
182
+ const { project } = options;
183
+ if (!project.projectPath) {
184
+ return RunResult.failed("InvalidInput" /* InvalidInput */, "Running an agent requires the project directory.");
185
+ }
186
+ if (options.entryPoint && options.entryPoint !== AGENT_ENTRY_POINT) {
187
+ return RunResult.failed("InvalidInput" /* InvalidInput */, `An agent runs '${AGENT_ENTRY_POINT}' and has no other entry point; got '${options.entryPoint}'.`);
188
+ }
189
+ const [authError, auth] = toDebugAuth(options);
190
+ if (authError) {
191
+ return RunResult.failed("Unauthorized" /* Unauthorized */, authError);
192
+ }
193
+ if (cancellationToken?.aborted) {
194
+ return RunResult.failed("Cancelled" /* Cancelled */, "Run cancelled before it started.");
195
+ }
196
+ const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
197
+ this.logger.info(`Running agent '${project.name}' as a serverless debug job...`);
198
+ let outcome;
199
+ try {
200
+ outcome = await this.createRunner().debug({
201
+ projectPath: project.projectPath,
202
+ inputs: options.inputArguments ?? {},
203
+ pollIntervalMs,
204
+ maxPolls: maxPolls(options.timeoutMs, pollIntervalMs),
205
+ onState: (state) => options.callbacks?.onStatusChange?.(mapRunStatus(state)),
206
+ signal: cancellationToken
207
+ }, auth);
208
+ } catch (error) {
209
+ return this.toFailure(error, project.name);
210
+ }
211
+ return this.toRunResult(outcome);
212
+ }
213
+ resolveDefaultEntryPoint() {
214
+ return Promise.resolve(AGENT_ENTRY_POINT);
215
+ }
216
+ toFailure(error, projectName) {
217
+ if (error instanceof AgentDebugCancelledError) {
218
+ return RunResult.failed("Cancelled" /* Cancelled */, error.message, {
219
+ jobKey: error.jobKey
220
+ });
221
+ }
222
+ return RunResult.failed("StartFailed" /* StartFailed */, `Could not run agent '${projectName}': ${messageOf(error)}`, { details: { runnerError: messageOf(error) } });
223
+ }
224
+ toRunResult(outcome) {
225
+ const details = {
226
+ entryPoint: AGENT_ENTRY_POINT
227
+ };
228
+ if (outcome.info) {
229
+ details.info = outcome.info;
230
+ }
231
+ const common = {
232
+ jobKey: outcome.jobKey,
233
+ traceId: outcome.traceId,
234
+ rawStatus: outcome.finalState,
235
+ output: asOutputArguments(outcome.output),
236
+ details
237
+ };
238
+ if (!outcome.success) {
239
+ const result = RunResult.failed("ExecutionFailed" /* ExecutionFailed */, outcome.info ?? `The agent run ended ${outcome.finalState}.`, common);
240
+ result.status = mapRunStatus(outcome.finalState);
241
+ return result;
242
+ }
243
+ return RunResult.succeeded(common);
244
+ }
245
+ }
246
+ function toDebugAuth(options) {
247
+ const { baseUrl, accessToken, organizationId, tenantName } = options.connection;
248
+ const missing = [
249
+ ["base URL", baseUrl],
250
+ ["access token", accessToken],
251
+ ["organization", organizationId],
252
+ ["tenant name", tenantName]
253
+ ].filter(([, value]) => !value).map(([label]) => label);
254
+ if (missing.length > 0) {
255
+ return [
256
+ `Running an agent needs a signed-in session: the run is missing its ${missing.join(", ")}. Run 'uip login' first.`,
257
+ {}
258
+ ];
259
+ }
260
+ return [
261
+ undefined,
262
+ {
263
+ baseUrl,
264
+ accessToken,
265
+ organizationId,
266
+ tenantName
267
+ }
268
+ ];
269
+ }
270
+ function maxPolls(timeoutMs, pollIntervalMs) {
271
+ return Math.max(1, Math.ceil((timeoutMs ?? DEFAULT_TIMEOUT_MS) / pollIntervalMs));
272
+ }
273
+ function asOutputArguments(output) {
274
+ return output !== null && typeof output === "object" && !Array.isArray(output) ? output : undefined;
275
+ }
276
+ function messageOf(error) {
277
+ return error instanceof Error ? error.message : String(error);
278
+ }
279
+
280
+ // src/executor/agent-executor-factory.ts
281
+ var AGENT_PROJECT_TYPES = ["Agent"];
282
+
283
+ class AgentExecutorFactory {
284
+ supportedTypes = AGENT_PROJECT_TYPES;
285
+ createAsync(logger, fileSystem) {
286
+ return Promise.resolve(new AgentProjectExecutor(fileSystem, logger));
287
+ }
288
+ }
289
+
290
+ // src/executor-tool.ts
291
+ var createExecutorFactory = () => new AgentExecutorFactory;
292
+ export {
293
+ createExecutorFactory
294
+ };
295
+
296
+ //# debugId=492E5F05284574BE64756E2164756E21
@@ -2,6 +2,7 @@ import {
2
2
  AUTH_FLOW_ENV_VAR,
3
3
  AuthProfileValidationError,
4
4
  ClientCredentialsAuthenticationError,
5
+ CredentialSource,
5
6
  DEFAULT_AUTH_FILENAME,
6
7
  DEFAULT_AUTH_PROFILE,
7
8
  DEFAULT_ENV_FILENAME,
@@ -14,7 +15,6 @@ import {
14
15
  InvalidBaseUrlError,
15
16
  InvalidTenantError,
16
17
  JWT_BEARER_ASSERTION_TYPE,
17
- LoginStatusSource,
18
18
  TENANT_SELECTION_REQUIRED_CODE,
19
19
  TenantSelectionError,
20
20
  TenantSelectionRequiredError,
@@ -42,6 +42,7 @@ import {
42
42
  logout,
43
43
  logoutWithDeps,
44
44
  normalizeAuthProfileName,
45
+ parseAuthFlow,
45
46
  parseJWT,
46
47
  readAuthFromEnv,
47
48
  refreshAccessToken,
@@ -50,25 +51,25 @@ import {
50
51
  resolveAuthProfileFilePath,
51
52
  resolveEnvFileLocationAsync,
52
53
  resolveEnvFilePathAsync,
54
+ resolveSessionIdentity,
53
55
  runWithAuthProfile,
54
56
  saveEnvFileAsync,
55
57
  saveRefreshBreaker,
56
58
  selectTenantWithDeps,
57
59
  setActiveAuthProfile,
58
60
  setAuthFileConfig
59
- } from "./packager-tool-yet9qmnt.js";
61
+ } from "./packager-tool-fz1pzt1z.js";
60
62
  import {
61
63
  isBrowser,
62
64
  isNode
63
65
  } from "./packager-tool-0gctz400.js";
64
- import {
65
- AUTH_TIMEOUT_ERROR_CODE
66
- } from "./packager-tool-jmzese1s.js";
67
- import"./packager-tool-mf36zc9b.js";
66
+ import"./packager-tool-qa9gftnj.js";
67
+ import"./packager-tool-yv3rvyas.js";
68
68
  import {
69
69
  AUTH_CANCELLED_ERROR_CODE,
70
+ AUTH_TIMEOUT_ERROR_CODE,
70
71
  DEFAULT_AUTH_TIMEOUT_MS
71
- } from "./packager-tool-1snc64g4.js";
72
+ } from "./packager-tool-q42rrs00.js";
72
73
  import"./packager-tool-wckvcay0.js";
73
74
  export {
74
75
  setAuthFileConfig,
@@ -77,6 +78,7 @@ export {
77
78
  saveRefreshBreaker,
78
79
  saveEnvFileAsync,
79
80
  runWithAuthProfile,
81
+ resolveSessionIdentity,
80
82
  resolveEnvFilePathAsync,
81
83
  resolveEnvFileLocationAsync,
82
84
  resolveAuthProfileFilePath,
@@ -85,6 +87,7 @@ export {
85
87
  refreshAccessToken,
86
88
  readAuthFromEnv,
87
89
  parseJWT,
90
+ parseAuthFlow,
88
91
  normalizeAuthProfileName,
89
92
  logoutWithDeps,
90
93
  logout,
@@ -114,7 +117,6 @@ export {
114
117
  TenantSelectionRequiredError,
115
118
  TenantSelectionError,
116
119
  TENANT_SELECTION_REQUIRED_CODE,
117
- LoginStatusSource,
118
120
  JWT_BEARER_ASSERTION_TYPE,
119
121
  InvalidTenantError,
120
122
  InvalidBaseUrlError,
@@ -128,6 +130,7 @@ export {
128
130
  DEFAULT_AUTH_TIMEOUT_MS,
129
131
  DEFAULT_AUTH_PROFILE,
130
132
  DEFAULT_AUTH_FILENAME,
133
+ CredentialSource,
131
134
  ClientCredentialsAuthenticationError,
132
135
  AuthProfileValidationError,
133
136
  AUTH_TIMEOUT_ERROR_CODE,
@@ -135,4 +138,4 @@ export {
135
138
  AUTH_CANCELLED_ERROR_CODE
136
139
  };
137
140
 
138
- //# debugId=FB6CD00532BDE8FA64756E2164756E21
141
+ //# debugId=33F3EC28BA86732264756E2164756E21