@uipath/packager-remote-agent-browser 0.0.0-stage → 1.205.0-preview.258

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 ADDED
@@ -0,0 +1,1523 @@
1
+ // src/i18n/index.ts
2
+ import { I18nManager } from "@uipath/solutionpackager-tool-core";
3
+ // src/i18n/locales/de.json
4
+ var de_default = {
5
+ remoteAgentBrowser: {
6
+ info: {
7
+ connectingToHub: "Connecting to SignalR hub: {url}",
8
+ remoteAgentStartedExecution: "Remote agent started execution",
9
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
10
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
11
+ distributingPackages: "Distributing packages for {count} project(s)",
12
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
13
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
14
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
15
+ offloadingInputArguments: "Eingabeargumente sind zu groß ({length} Zeichen), um sie inline zu senden; sie werden als Dateianhang hochgeladen"
16
+ },
17
+ errors: {
18
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
19
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
20
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
21
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
22
+ noResultForProject: "No result for project",
23
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
24
+ hubConnectionClosed: "Hub connection closed unexpectedly",
25
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
26
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
27
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
28
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
29
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
30
+ noMatchingProject: "No matching project found for path: {projectPath}",
31
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
32
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
33
+ createAttachmentFailed: "Anhang für Eingabeargumente konnte nicht erstellt werden ({status}): {errorText}",
34
+ attachmentResponseMalformed: "Die Antwort auf die Anhangerstellung enthielt keine ID und keine Blob-URI",
35
+ uploadInputArgumentsFailed: "Datei mit Eingabeargumenten konnte nicht hochgeladen werden ({status}): {statusText}"
36
+ }
37
+ }
38
+ };
39
+
40
+ // src/i18n/locales/en.ts
41
+ var en = {
42
+ remoteAgentBrowser: {
43
+ info: {
44
+ startingRemoteAgent: "Starting remote {operation} agent for {count} project(s): {paths}",
45
+ connectingToHub: "Connecting to SignalR hub: {url}",
46
+ remoteAgentStartedExecution: "Remote agent started execution",
47
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
48
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
49
+ distributingPackages: "Distributing packages for {count} project(s)",
50
+ skippingRemoteCompilation: "No connection info available — skipping remote compilation for workflow compiler projects",
51
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
52
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
53
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
54
+ offloadingInputArguments: "Input arguments are too large ({length} chars) to send inline; uploading them as a file attachment"
55
+ },
56
+ errors: {
57
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
58
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
59
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
60
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
61
+ agentFailed: "{operation} agent failed with status {status} (code {errorCode})",
62
+ noResultForProject: "No result for project",
63
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
64
+ hubConnectionClosed: "Hub connection closed unexpectedly",
65
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
66
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
67
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
68
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
69
+ downloadArchiveUnreachable: "Could not download the pack result from {host}: {message}. The agent finished; the browser could not reach the result storage, most often because it does not allow this page's origin (CORS).",
70
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
71
+ noMatchingProject: "No matching project found for path: {projectPath}",
72
+ noPackageFromAgent: "The remote agent returned no package for {project} ({projectType}, design {designId}). An agent that does not pack {projectType} projects skips them.",
73
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
74
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
75
+ jobStartTimeout: "The remote agent job {jobKey} was still pending after {minutes} minute(s): no robot picked it up, so it was stopped. Check that a robot or serverless capacity is available in the folder and retry.",
76
+ bundleOperationMismatch: "Cannot mix {sessionOperation} and {entryOperation} in the same context",
77
+ createAttachmentFailed: "Failed to create input arguments attachment ({status}): {errorText}",
78
+ attachmentResponseMalformed: "Attachment creation response did not include an id and blob URI",
79
+ uploadInputArgumentsFailed: "Failed to upload input arguments file ({status}): {statusText}"
80
+ }
81
+ }
82
+ };
83
+ // src/i18n/locales/es.json
84
+ var es_default = {
85
+ remoteAgentBrowser: {
86
+ info: {
87
+ connectingToHub: "Connecting to SignalR hub: {url}",
88
+ remoteAgentStartedExecution: "Remote agent started execution",
89
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
90
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
91
+ distributingPackages: "Distributing packages for {count} project(s)",
92
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
93
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
94
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
95
+ offloadingInputArguments: "Los argumentos de entrada son demasiado grandes ({length} caracteres) para enviarlos en línea; se cargarán como un archivo adjunto"
96
+ },
97
+ errors: {
98
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
99
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
100
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
101
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
102
+ noResultForProject: "No result for project",
103
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
104
+ hubConnectionClosed: "Hub connection closed unexpectedly",
105
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
106
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
107
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
108
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
109
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
110
+ noMatchingProject: "No matching project found for path: {projectPath}",
111
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
112
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
113
+ createAttachmentFailed: "No se pudo crear el archivo adjunto de argumentos de entrada ({status}): {errorText}",
114
+ attachmentResponseMalformed: "La respuesta de creación del archivo adjunto no incluía un id ni un URI de blob",
115
+ uploadInputArgumentsFailed: "No se pudo cargar el archivo de argumentos de entrada ({status}): {statusText}"
116
+ }
117
+ }
118
+ };
119
+ // src/i18n/locales/es-MX.json
120
+ var es_MX_default = {
121
+ remoteAgentBrowser: {
122
+ info: {
123
+ connectingToHub: "Connecting to SignalR hub: {url}",
124
+ remoteAgentStartedExecution: "Remote agent started execution",
125
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
126
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
127
+ distributingPackages: "Distributing packages for {count} project(s)",
128
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
129
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
130
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
131
+ offloadingInputArguments: "Los argumentos de entrada son demasiado grandes ({length} caracteres) para enviarlos en línea; se cargarán como un archivo adjunto"
132
+ },
133
+ errors: {
134
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
135
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
136
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
137
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
138
+ noResultForProject: "No result for project",
139
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
140
+ hubConnectionClosed: "Hub connection closed unexpectedly",
141
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
142
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
143
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
144
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
145
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
146
+ noMatchingProject: "No matching project found for path: {projectPath}",
147
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
148
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
149
+ createAttachmentFailed: "No se pudo crear el archivo adjunto de argumentos de entrada ({status}): {errorText}",
150
+ attachmentResponseMalformed: "La respuesta de creación del archivo adjunto no incluía un id ni un URI de blob",
151
+ uploadInputArgumentsFailed: "No se pudo cargar el archivo de argumentos de entrada ({status}): {statusText}"
152
+ }
153
+ }
154
+ };
155
+ // src/i18n/locales/fr.json
156
+ var fr_default = {
157
+ remoteAgentBrowser: {
158
+ info: {
159
+ connectingToHub: "Connecting to SignalR hub: {url}",
160
+ remoteAgentStartedExecution: "Remote agent started execution",
161
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
162
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
163
+ distributingPackages: "Distributing packages for {count} project(s)",
164
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
165
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
166
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
167
+ offloadingInputArguments: "Les arguments d'entrée sont trop volumineux ({length} caractères) pour être envoyés en ligne ; ils seront chargés en tant que pièce jointe"
168
+ },
169
+ errors: {
170
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
171
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
172
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
173
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
174
+ noResultForProject: "No result for project",
175
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
176
+ hubConnectionClosed: "Hub connection closed unexpectedly",
177
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
178
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
179
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
180
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
181
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
182
+ noMatchingProject: "No matching project found for path: {projectPath}",
183
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
184
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
185
+ createAttachmentFailed: "Échec de la création de la pièce jointe des arguments d'entrée ({status}) : {errorText}",
186
+ attachmentResponseMalformed: "La réponse de création de la pièce jointe ne contenait pas d'id ni d'URI de blob",
187
+ uploadInputArgumentsFailed: "Échec du chargement du fichier des arguments d'entrée ({status}) : {statusText}"
188
+ }
189
+ }
190
+ };
191
+ // src/i18n/locales/ja.json
192
+ var ja_default = {
193
+ remoteAgentBrowser: {
194
+ info: {
195
+ connectingToHub: "Connecting to SignalR hub: {url}",
196
+ remoteAgentStartedExecution: "Remote agent started execution",
197
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
198
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
199
+ distributingPackages: "Distributing packages for {count} project(s)",
200
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
201
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
202
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
203
+ offloadingInputArguments: "入力引数が大きすぎるため ({length} 文字)、インラインで送信できません。ファイル添付としてアップロードします"
204
+ },
205
+ errors: {
206
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
207
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
208
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
209
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
210
+ noResultForProject: "No result for project",
211
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
212
+ hubConnectionClosed: "Hub connection closed unexpectedly",
213
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
214
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
215
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
216
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
217
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
218
+ noMatchingProject: "No matching project found for path: {projectPath}",
219
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
220
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
221
+ createAttachmentFailed: "入力引数の添付ファイルの作成に失敗しました ({status}):{errorText}",
222
+ attachmentResponseMalformed: "添付ファイルの作成応答に id と blob URI が含まれていませんでした",
223
+ uploadInputArgumentsFailed: "入力引数ファイルのアップロードに失敗しました ({status}):{statusText}"
224
+ }
225
+ }
226
+ };
227
+ // src/i18n/locales/ko.json
228
+ var ko_default = {
229
+ remoteAgentBrowser: {
230
+ info: {
231
+ connectingToHub: "Connecting to SignalR hub: {url}",
232
+ remoteAgentStartedExecution: "Remote agent started execution",
233
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
234
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
235
+ distributingPackages: "Distributing packages for {count} project(s)",
236
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
237
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
238
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
239
+ offloadingInputArguments: "입력 인수가 너무 커서({length}자) 인라인으로 보낼 수 없습니다. 파일 첨부로 업로드합니다"
240
+ },
241
+ errors: {
242
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
243
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
244
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
245
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
246
+ noResultForProject: "No result for project",
247
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
248
+ hubConnectionClosed: "Hub connection closed unexpectedly",
249
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
250
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
251
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
252
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
253
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
254
+ noMatchingProject: "No matching project found for path: {projectPath}",
255
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
256
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
257
+ createAttachmentFailed: "입력 인수 첨부 파일을 만들지 못했습니다({status}): {errorText}",
258
+ attachmentResponseMalformed: "첨부 파일 생성 응답에 id와 blob URI가 포함되어 있지 않습니다",
259
+ uploadInputArgumentsFailed: "입력 인수 파일을 업로드하지 못했습니다({status}): {statusText}"
260
+ }
261
+ }
262
+ };
263
+ // src/i18n/locales/pt.json
264
+ var pt_default = {
265
+ remoteAgentBrowser: {
266
+ info: {
267
+ connectingToHub: "Connecting to SignalR hub: {url}",
268
+ remoteAgentStartedExecution: "Remote agent started execution",
269
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
270
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
271
+ distributingPackages: "Distributing packages for {count} project(s)",
272
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
273
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
274
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
275
+ offloadingInputArguments: "Os argumentos de entrada são demasiado grandes ({length} carateres) para serem enviados inline; serão carregados como um anexo de ficheiro"
276
+ },
277
+ errors: {
278
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
279
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
280
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
281
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
282
+ noResultForProject: "No result for project",
283
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
284
+ hubConnectionClosed: "Hub connection closed unexpectedly",
285
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
286
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
287
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
288
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
289
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
290
+ noMatchingProject: "No matching project found for path: {projectPath}",
291
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
292
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
293
+ createAttachmentFailed: "Falha ao criar o anexo dos argumentos de entrada ({status}): {errorText}",
294
+ attachmentResponseMalformed: "A resposta de criação do anexo não incluía um id nem um URI de blob",
295
+ uploadInputArgumentsFailed: "Falha ao carregar o ficheiro de argumentos de entrada ({status}): {statusText}"
296
+ }
297
+ }
298
+ };
299
+ // src/i18n/locales/pt-BR.json
300
+ var pt_BR_default = {
301
+ remoteAgentBrowser: {
302
+ info: {
303
+ connectingToHub: "Connecting to SignalR hub: {url}",
304
+ remoteAgentStartedExecution: "Remote agent started execution",
305
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
306
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
307
+ distributingPackages: "Distributing packages for {count} project(s)",
308
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
309
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
310
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
311
+ offloadingInputArguments: "Os argumentos de entrada são muito grandes ({length} caracteres) para serem enviados inline; eles serão carregados como um anexo de arquivo"
312
+ },
313
+ errors: {
314
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
315
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
316
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
317
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
318
+ noResultForProject: "No result for project",
319
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
320
+ hubConnectionClosed: "Hub connection closed unexpectedly",
321
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
322
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
323
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
324
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
325
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
326
+ noMatchingProject: "No matching project found for path: {projectPath}",
327
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
328
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
329
+ createAttachmentFailed: "Falha ao criar o anexo dos argumentos de entrada ({status}): {errorText}",
330
+ attachmentResponseMalformed: "A resposta de criação do anexo não incluiu um id nem uma URI de blob",
331
+ uploadInputArgumentsFailed: "Falha ao fazer upload do arquivo de argumentos de entrada ({status}): {statusText}"
332
+ }
333
+ }
334
+ };
335
+ // src/i18n/locales/ro.json
336
+ var ro_default = {
337
+ remoteAgentBrowser: {
338
+ info: {
339
+ connectingToHub: "Connecting to SignalR hub: {url}",
340
+ remoteAgentStartedExecution: "Remote agent started execution",
341
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
342
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
343
+ distributingPackages: "Distributing packages for {count} project(s)",
344
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
345
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
346
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
347
+ offloadingInputArguments: "Argumentele de intrare sunt prea mari ({length} caractere) pentru a fi trimise inline; vor fi încărcate ca atașament de fișier"
348
+ },
349
+ errors: {
350
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
351
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
352
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
353
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
354
+ noResultForProject: "No result for project",
355
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
356
+ hubConnectionClosed: "Hub connection closed unexpectedly",
357
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
358
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
359
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
360
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
361
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
362
+ noMatchingProject: "No matching project found for path: {projectPath}",
363
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
364
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
365
+ createAttachmentFailed: "Crearea atașamentului cu argumentele de intrare a eșuat ({status}): {errorText}",
366
+ attachmentResponseMalformed: "Răspunsul de creare a atașamentului nu a inclus un id și un URI de blob",
367
+ uploadInputArgumentsFailed: "Încărcarea fișierului cu argumentele de intrare a eșuat ({status}): {statusText}"
368
+ }
369
+ }
370
+ };
371
+ // src/i18n/locales/ru.json
372
+ var ru_default = {
373
+ remoteAgentBrowser: {
374
+ info: {
375
+ connectingToHub: "Connecting to SignalR hub: {url}",
376
+ remoteAgentStartedExecution: "Remote agent started execution",
377
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
378
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
379
+ distributingPackages: "Distributing packages for {count} project(s)",
380
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
381
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
382
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
383
+ offloadingInputArguments: "Входные аргументы слишком велики ({length} символов) для встроенной отправки; они будут загружены как вложение файла"
384
+ },
385
+ errors: {
386
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
387
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
388
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
389
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
390
+ noResultForProject: "No result for project",
391
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
392
+ hubConnectionClosed: "Hub connection closed unexpectedly",
393
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
394
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
395
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
396
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
397
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
398
+ noMatchingProject: "No matching project found for path: {projectPath}",
399
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
400
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
401
+ createAttachmentFailed: "Не удалось создать вложение с входными аргументами ({status}): {errorText}",
402
+ attachmentResponseMalformed: "Ответ на создание вложения не содержал id и blob-URI",
403
+ uploadInputArgumentsFailed: "Не удалось загрузить файл входных аргументов ({status}): {statusText}"
404
+ }
405
+ }
406
+ };
407
+ // src/i18n/locales/tr.json
408
+ var tr_default = {
409
+ remoteAgentBrowser: {
410
+ info: {
411
+ connectingToHub: "Connecting to SignalR hub: {url}",
412
+ remoteAgentStartedExecution: "Remote agent started execution",
413
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
414
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
415
+ distributingPackages: "Distributing packages for {count} project(s)",
416
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
417
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
418
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
419
+ offloadingInputArguments: "Giriş bağımsız değişkenleri satır içi gönderilemeyecek kadar büyük ({length} karakter); dosya eki olarak yüklenecek"
420
+ },
421
+ errors: {
422
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
423
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
424
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
425
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
426
+ noResultForProject: "No result for project",
427
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
428
+ hubConnectionClosed: "Hub connection closed unexpectedly",
429
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
430
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
431
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
432
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
433
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
434
+ noMatchingProject: "No matching project found for path: {projectPath}",
435
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
436
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
437
+ createAttachmentFailed: "Giriş bağımsız değişkenleri eki oluşturulamadı ({status}): {errorText}",
438
+ attachmentResponseMalformed: "Ek oluşturma yanıtı bir kimlik ve blob URI'si içermiyordu",
439
+ uploadInputArgumentsFailed: "Giriş bağımsız değişkenleri dosyası yüklenemedi ({status}): {statusText}"
440
+ }
441
+ }
442
+ };
443
+ // src/i18n/locales/zh-CN.json
444
+ var zh_CN_default = {
445
+ remoteAgentBrowser: {
446
+ info: {
447
+ connectingToHub: "Connecting to SignalR hub: {url}",
448
+ remoteAgentStartedExecution: "Remote agent started execution",
449
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
450
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
451
+ distributingPackages: "Distributing packages for {count} project(s)",
452
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
453
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
454
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
455
+ offloadingInputArguments: "输入参数过大({length} 个字符),无法内联发送;将作为文件附件上传"
456
+ },
457
+ errors: {
458
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
459
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
460
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
461
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
462
+ noResultForProject: "No result for project",
463
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
464
+ hubConnectionClosed: "Hub connection closed unexpectedly",
465
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
466
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
467
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
468
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
469
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
470
+ noMatchingProject: "No matching project found for path: {projectPath}",
471
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
472
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
473
+ createAttachmentFailed: "无法创建输入参数附件 ({status}):{errorText}",
474
+ attachmentResponseMalformed: "附件创建响应未包含 id 和 blob URI",
475
+ uploadInputArgumentsFailed: "无法上传输入参数文件 ({status}):{statusText}"
476
+ }
477
+ }
478
+ };
479
+ // src/i18n/locales/zh-TW.json
480
+ var zh_TW_default = {
481
+ remoteAgentBrowser: {
482
+ info: {
483
+ connectingToHub: "Connecting to SignalR hub: {url}",
484
+ remoteAgentStartedExecution: "Remote agent started execution",
485
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
486
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
487
+ distributingPackages: "Distributing packages for {count} project(s)",
488
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
489
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
490
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
491
+ offloadingInputArguments: "輸入引數過大({length} 個字元),無法內嵌傳送;將以檔案附件形式上傳"
492
+ },
493
+ errors: {
494
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
495
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
496
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
497
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
498
+ noResultForProject: "No result for project",
499
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
500
+ hubConnectionClosed: "Hub connection closed unexpectedly",
501
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
502
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
503
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
504
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
505
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
506
+ noMatchingProject: "No matching project found for path: {projectPath}",
507
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
508
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
509
+ createAttachmentFailed: "無法建立輸入引數附件 ({status}):{errorText}",
510
+ attachmentResponseMalformed: "附件建立回應未包含 id 和 blob URI",
511
+ uploadInputArgumentsFailed: "無法上傳輸入引數檔案 ({status}):{statusText}"
512
+ }
513
+ }
514
+ };
515
+ // src/i18n/locales/zu.json
516
+ var zu_default = {
517
+ remoteAgentBrowser: {
518
+ info: {
519
+ connectingToHub: "Connecting to SignalR hub: {url}",
520
+ remoteAgentStartedExecution: "Remote agent started execution",
521
+ downloadingArchive: "Downloading pack result archive from bucket {bucketId}",
522
+ extractingArchive: "Extracting archive ({size} bytes) to {path}",
523
+ distributingPackages: "Distributing packages for {count} project(s)",
524
+ cleaningUpTempDir: "Cleaning up temporary directory {path}",
525
+ deletingBucket: "Deleting temporary storage bucket {bucketId}",
526
+ copyingFiles: "Copying {count} file(s) for project {designId} to {path}",
527
+ offloadingInputArguments: "Izimpikiswano zokufaka zinkulu kakhulu ({length} izinhlamvu) ukuze zithunyelwe ngaphakathi; zizolayishwa njengesinamathiselo sefayela"
528
+ },
529
+ errors: {
530
+ missingConnectionInfo: "Missing connection info (cloudUrl, accessToken, or folderId)",
531
+ signalRConnectionFailed: "Failed to connect to SignalR hub",
532
+ hubConnectionFailed: "Failed to connect to SignalR hub at {url}: {message}",
533
+ packSucceededNoBucket: "Pack succeeded but no BucketId was returned",
534
+ noResultForProject: "No result for project",
535
+ beginSessionFailed: "BeginSession failed ({status}): {errorText}",
536
+ hubConnectionClosed: "Hub connection closed unexpectedly",
537
+ packAgentDisconnected: "Pack agent disconnected unexpectedly",
538
+ deleteBucketFailed: "Unable to delete temporary storage bucket on Orchestrator: {statusText}",
539
+ cleanupBucketFailed: "Unable to cleanup remote bucket {bucketId}: {message}",
540
+ getBucketUriFailed: "Failed to get bucket read URI ({status}): {errorText}",
541
+ downloadArchiveFailed: "Failed to download archive from bucket ({status}): {statusText}",
542
+ noMatchingProject: "No matching project found for path: {projectPath}",
543
+ distributePackagesFailed: "Failed to distribute packages for {designId}: {message}",
544
+ sessionTimeout: "Session timed out waiting for projects: received {received} of {expected} expected projects",
545
+ createAttachmentFailed: "Yehlulekile ukudala isinamathiselo sezimpikiswano zokufaka ({status}): {errorText}",
546
+ attachmentResponseMalformed: "Impendulo yokudala isinamathiselo ayifakanga i-id ne-blob URI",
547
+ uploadInputArgumentsFailed: "Yehlulekile ukulayisha ifayela lezimpikiswano zokufaka ({status}): {statusText}"
548
+ }
549
+ }
550
+ };
551
+
552
+ // src/i18n/index.ts
553
+ I18nManager.registerTranslations("en", en);
554
+ I18nManager.registerTranslations("de", de_default);
555
+ I18nManager.registerTranslations("es", es_default);
556
+ I18nManager.registerTranslations("es-MX", es_MX_default);
557
+ I18nManager.registerTranslations("fr", fr_default);
558
+ I18nManager.registerTranslations("ja", ja_default);
559
+ I18nManager.registerTranslations("ko", ko_default);
560
+ I18nManager.registerTranslations("pt", pt_default);
561
+ I18nManager.registerTranslations("pt-BR", pt_BR_default);
562
+ I18nManager.registerTranslations("ro", ro_default);
563
+ I18nManager.registerTranslations("ru", ru_default);
564
+ I18nManager.registerTranslations("tr", tr_default);
565
+ I18nManager.registerTranslations("zh-CN", zh_CN_default);
566
+ I18nManager.registerTranslations("zh-TW", zh_TW_default);
567
+ I18nManager.registerTranslations("zu", zu_default);
568
+
569
+ // src/bundle-operation.ts
570
+ var BundleOperation;
571
+ ((BundleOperation2) => {
572
+ BundleOperation2["Pack"] = "Pack";
573
+ BundleOperation2["Validate"] = "Validate";
574
+ BundleOperation2["Cleanup"] = "Cleanup";
575
+ })(BundleOperation ||= {});
576
+ // src/remote-agent-bundle-executor.ts
577
+ import {
578
+ normalizeIgnoredRules,
579
+ PackJobTargetKind,
580
+ ProjectTypes,
581
+ ToolErrorCodes as ToolErrorCodes2,
582
+ ToolResult as ToolResult2,
583
+ toProjectCleanupInfoFromRemote,
584
+ toRelativeUrl as toRelativeUrl2,
585
+ translate as translate3
586
+ } from "@uipath/solutionpackager-tool-core";
587
+
588
+ // src/pack-result-processor.ts
589
+ import {
590
+ ToolErrorCodes,
591
+ ToolResult,
592
+ toRelativeUrl,
593
+ translate,
594
+ ZipService
595
+ } from "@uipath/solutionpackager-tool-core";
596
+ var DefaultArchiveName = "rpa-packages.zip";
597
+
598
+ class PackResultProcessor {
599
+ fileSystem;
600
+ logger;
601
+ zipService;
602
+ constructor(fileSystem, logger, zipService = new ZipService(fileSystem)) {
603
+ this.fileSystem = fileSystem;
604
+ this.logger = logger;
605
+ this.zipService = zipService;
606
+ }
607
+ async processAsync(bucketId, projects, context, archiveName) {
608
+ const connection = context.connection;
609
+ const results = new Map;
610
+ const tempDir = await this.fileSystem.getTempDir();
611
+ const extractPath = `${tempDir}/pack-result-${context.id}`;
612
+ try {
613
+ this.logger?.info(translate.t("remoteAgentBrowser.info.downloadingArchive", {
614
+ bucketId
615
+ }));
616
+ const zipData = await this.downloadArchiveAsync(bucketId, archiveName || DefaultArchiveName, connection);
617
+ this.logger?.info(translate.t("remoteAgentBrowser.info.extractingArchive", {
618
+ size: zipData.length,
619
+ path: extractPath
620
+ }));
621
+ await this.zipService.extractAsync(zipData, extractPath);
622
+ this.logger?.info(translate.t("remoteAgentBrowser.info.distributingPackages", {
623
+ count: projects.size
624
+ }));
625
+ await this.distributePackages(extractPath, projects, context, results);
626
+ } catch (error) {
627
+ const message = error instanceof Error ? error.message : String(error);
628
+ for (const [projectPath] of projects) {
629
+ if (!results.has(projectPath)) {
630
+ results.set(projectPath, ToolResult.error("PackResultError", message));
631
+ }
632
+ }
633
+ } finally {
634
+ this.logger?.info(translate.t("remoteAgentBrowser.info.cleaningUpTempDir", {
635
+ path: extractPath
636
+ }));
637
+ await this.fileSystem.rm(extractPath).catch(() => {});
638
+ await this.deleteBucketAsync(bucketId, connection);
639
+ }
640
+ return results;
641
+ }
642
+ async downloadArchiveAsync(bucketId, archiveName, connection) {
643
+ const blobAccess = await this.getReadUriAsync(bucketId, archiveName, connection);
644
+ return await this.downloadBlobAsync(blobAccess);
645
+ }
646
+ async deleteBucketAsync(bucketId, connection) {
647
+ try {
648
+ if (!bucketId) {
649
+ return;
650
+ }
651
+ const baseUrl = toRelativeUrl(connection.cloudUrl);
652
+ const url = `${baseUrl}/orchestrator_/odata/Buckets(${bucketId})`;
653
+ this.logger?.info(translate.t("remoteAgentBrowser.info.deletingBucket", {
654
+ bucketId
655
+ }));
656
+ const response = await fetch(url, {
657
+ method: "DELETE",
658
+ headers: {
659
+ Authorization: `Bearer ${connection.accessToken}`,
660
+ "X-UIPATH-OrganizationUnitId": connection.folderId ?? ""
661
+ }
662
+ });
663
+ if (!response.ok) {
664
+ throw new Error(translate.t("remoteAgentBrowser.errors.deleteBucketFailed", { statusText: response.statusText }));
665
+ }
666
+ } catch (error) {
667
+ const message = error instanceof Error ? error.message : String(error);
668
+ this.logger?.warn(translate.t("remoteAgentBrowser.errors.cleanupBucketFailed", {
669
+ bucketId,
670
+ message
671
+ }));
672
+ }
673
+ }
674
+ async getReadUriAsync(bucketId, archiveName, connection) {
675
+ const baseUrl = toRelativeUrl(connection.cloudUrl);
676
+ const url = `${baseUrl}/orchestrator_/odata/Buckets(${bucketId})` + `/UiPath.Server.Configuration.OData.GetReadUri` + `?path=${encodeURIComponent(archiveName)}&expiryInMinutes=0`;
677
+ const response = await fetch(url, {
678
+ method: "GET",
679
+ headers: {
680
+ Authorization: `Bearer ${connection.accessToken}`,
681
+ "X-UIPATH-OrganizationUnitId": connection.folderId ?? ""
682
+ }
683
+ });
684
+ if (!response.ok) {
685
+ const errorText = await response.text();
686
+ throw new Error(translate.t("remoteAgentBrowser.errors.getBucketUriFailed", {
687
+ status: response.status,
688
+ errorText
689
+ }));
690
+ }
691
+ return await response.json();
692
+ }
693
+ async downloadBlobAsync(blobAccess) {
694
+ const headers = {};
695
+ if (blobAccess.Headers) {
696
+ for (const [key, value] of Object.entries(blobAccess.Headers)) {
697
+ headers[key] = value;
698
+ }
699
+ }
700
+ let response;
701
+ try {
702
+ response = await fetch(blobAccess.Uri, {
703
+ method: blobAccess.Verb || "GET",
704
+ headers
705
+ });
706
+ } catch (error) {
707
+ throw new Error(translate.t("remoteAgentBrowser.errors.downloadArchiveUnreachable", {
708
+ host: hostOf(blobAccess.Uri),
709
+ message: error instanceof Error ? error.message : String(error)
710
+ }));
711
+ }
712
+ if (!response.ok) {
713
+ throw new Error(translate.t("remoteAgentBrowser.errors.downloadArchiveFailed", {
714
+ status: response.status,
715
+ statusText: response.statusText
716
+ }));
717
+ }
718
+ const buffer = await response.arrayBuffer();
719
+ return new Uint8Array(buffer);
720
+ }
721
+ async distributePackages(extractPath, projects, context, results) {
722
+ for (const [projectPath, entry] of projects) {
723
+ const project = context.projects.find((p) => p.ProjectPath === projectPath);
724
+ if (!project) {
725
+ results.set(projectPath, ToolResult.error("PackResultError", translate.t("remoteAgentBrowser.errors.noMatchingProject", { projectPath })));
726
+ continue;
727
+ }
728
+ const designId = project.Id;
729
+ const projectFilesDir = `${extractPath}/${designId}`;
730
+ const outputPath = entry.options.outputPath;
731
+ try {
732
+ const exists = await this.fileSystem.exists(projectFilesDir);
733
+ if (!exists) {
734
+ results.set(projectPath, ToolResult.error("PackResultError", translate.t("remoteAgentBrowser.errors.noPackageFromAgent", {
735
+ project: project.ProjectRelativePath,
736
+ projectType: project.Type,
737
+ designId
738
+ })));
739
+ continue;
740
+ }
741
+ const files = await this.fileSystem.readdir(projectFilesDir);
742
+ const outputFiles = [];
743
+ await this.fileSystem.mkdir(outputPath);
744
+ this.logger?.info(translate.t("remoteAgentBrowser.info.copyingFiles", {
745
+ count: files.length,
746
+ designId,
747
+ path: outputPath
748
+ }));
749
+ for (const fileName of files) {
750
+ const srcFile = `${projectFilesDir}/${fileName}`;
751
+ const destFile = `${outputPath}/${fileName}`;
752
+ const data = await this.fileSystem.readFile(srcFile);
753
+ if (data) {
754
+ await this.fileSystem.writeFile(destFile, data);
755
+ outputFiles.push(destFile);
756
+ }
757
+ }
758
+ results.set(projectPath, new ToolResult(ToolErrorCodes.Success, undefined, outputFiles));
759
+ } catch (error) {
760
+ const message = error instanceof Error ? error.message : String(error);
761
+ results.set(projectPath, ToolResult.error("PackResultError", translate.t("remoteAgentBrowser.errors.distributePackagesFailed", { designId, message })));
762
+ }
763
+ }
764
+ }
765
+ }
766
+ function hostOf(uri) {
767
+ try {
768
+ return new URL(uri).host;
769
+ } catch {
770
+ return uri;
771
+ }
772
+ }
773
+
774
+ // src/packager-hub-connection.ts
775
+ import {
776
+ HttpTransportType,
777
+ HubConnectionBuilder,
778
+ HubConnectionState
779
+ } from "@microsoft/signalr";
780
+ import {
781
+ LogMessage,
782
+ translate as translate2
783
+ } from "@uipath/solutionpackager-tool-core";
784
+ class PackagerHubConnection {
785
+ logger;
786
+ hubConnection = null;
787
+ completionResolve = null;
788
+ completionReject = null;
789
+ constructor(logger) {
790
+ this.logger = logger;
791
+ }
792
+ async connectAsync(hubUrl, accessToken) {
793
+ try {
794
+ this.hubConnection = this.buildConnection(hubUrl, accessToken);
795
+ this.registerHandlers();
796
+ this.registerOnClose();
797
+ await this.hubConnection.start();
798
+ } catch (error) {
799
+ if (error instanceof Error && error.message.toLowerCase().includes("websocket")) {
800
+ this.hubConnection = this.buildConnection(hubUrl, accessToken, true);
801
+ this.registerHandlers();
802
+ this.registerOnClose();
803
+ await this.hubConnection.start();
804
+ } else {
805
+ throw error;
806
+ }
807
+ }
808
+ }
809
+ buildConnection(hubUrl, accessToken, disableWs = false) {
810
+ return new HubConnectionBuilder().withUrl(hubUrl, {
811
+ accessTokenFactory: () => accessToken,
812
+ transport: disableWs ? HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling : undefined
813
+ }).withAutomaticReconnect().build();
814
+ }
815
+ registerOnClose() {
816
+ this.hubConnection?.onclose((error) => {
817
+ this.logger?.info(`[PackagerHub] onclose fired. error=${error?.message ?? "none"}, hasReject=${!!this.completionReject}, hasResolve=${!!this.completionResolve}`);
818
+ if (this.completionReject) {
819
+ this.completionReject(error ?? new Error(translate2.t("remoteAgentBrowser.errors.hubConnectionClosed")));
820
+ this.completionResolve = null;
821
+ this.completionReject = null;
822
+ }
823
+ });
824
+ }
825
+ waitForCompletionAsync() {
826
+ return new Promise((resolve, reject) => {
827
+ this.completionResolve = resolve;
828
+ this.completionReject = reject;
829
+ });
830
+ }
831
+ async disconnectAsync() {
832
+ if (this.hubConnection && this.hubConnection.state !== HubConnectionState.Disconnected) {
833
+ await this.hubConnection.stop();
834
+ }
835
+ this.hubConnection = null;
836
+ }
837
+ registerHandlers() {
838
+ if (!this.hubConnection)
839
+ return;
840
+ this.hubConnection.on("SetExecutionCompleted" /* SetExecutionCompleted */, (jsonCommand) => {
841
+ this.onExecutionCompleted(jsonCommand);
842
+ });
843
+ this.hubConnection.on("SetLogMessage" /* SetLogMessage */, (jsonCommand) => {
844
+ this.onLogMessage(jsonCommand);
845
+ });
846
+ this.hubConnection.on("SetExecutionStarted" /* SetExecutionStarted */, (_jsonCommand) => {
847
+ this.logger?.info(translate2.t("remoteAgentBrowser.info.remoteAgentStartedExecution"));
848
+ });
849
+ this.hubConnection.on("PeerDisconnected" /* PeerDisconnected */, () => {
850
+ this.logger?.info(`[PackagerHub] PeerDisconnected received. hasReject=${!!this.completionReject}`);
851
+ if (this.completionReject) {
852
+ this.completionReject(new Error(translate2.t("remoteAgentBrowser.errors.packAgentDisconnected")));
853
+ this.completionResolve = null;
854
+ this.completionReject = null;
855
+ }
856
+ });
857
+ }
858
+ onLogMessage(jsonCommand) {
859
+ if (!this.logger)
860
+ return;
861
+ const command = JSON.parse(jsonCommand);
862
+ const agentLog = command.Argument1;
863
+ const logMessage = new LogMessage(agentLog.message, agentLog.logLevel, {
864
+ source: agentLog.source,
865
+ sourceTarget: agentLog.sourceTarget,
866
+ progress: agentLog.progress,
867
+ code: agentLog.code,
868
+ filePath: agentLog.filePath,
869
+ line: agentLog.line,
870
+ id: agentLog.id
871
+ }, agentLog.timestamp);
872
+ this.logger.logMessage(logMessage);
873
+ }
874
+ onExecutionCompleted(jsonCommand) {
875
+ this.logger?.info(`[PackagerHub] onExecutionCompleted called. hasResolve=${!!this.completionResolve}, raw=${jsonCommand}`);
876
+ if (!this.completionResolve) {
877
+ this.logger?.warn(`[PackagerHub] onExecutionCompleted: completionResolve is null, ignoring result`);
878
+ return;
879
+ }
880
+ const command = JSON.parse(jsonCommand);
881
+ const jobResult = command.Argument1;
882
+ this.logger?.info(`[PackagerHub] onExecutionCompleted parsed: errorCode=${jobResult.ErrorCode}, status=${jobResult.Status}, message=${jobResult.Message}, bucketId=${jobResult.BucketId}, archiveName=${jobResult.ArchiveName}`);
883
+ this.completionResolve({
884
+ errorCode: jobResult.ErrorCode,
885
+ status: jobResult.Status,
886
+ message: jobResult.Message,
887
+ bucketId: jobResult.BucketId,
888
+ archiveName: jobResult.ArchiveName,
889
+ changedFilesByProject: jobResult.ChangedFilesByProject,
890
+ unusedDependenciesByProject: jobResult.UnusedDependenciesByProject
891
+ });
892
+ this.completionResolve = null;
893
+ this.completionReject = null;
894
+ }
895
+ }
896
+
897
+ // src/remote-project-selector.ts
898
+ import {
899
+ toolsFactoryRepository
900
+ } from "@uipath/solutionpackager-tool-core";
901
+
902
+ class RemoteProjectSelector {
903
+ repository;
904
+ constructor(repository = toolsFactoryRepository) {
905
+ this.repository = repository;
906
+ }
907
+ isRemote(projectType) {
908
+ return this.repository.canHandleProject(projectType) && this.isRemoteAgentToolFactory(this.repository.getProjectToolFactory(projectType));
909
+ }
910
+ selectRemoteProjects(projects) {
911
+ return projects.filter((p) => p.ProjectPath != null && this.isRemote(p.Type));
912
+ }
913
+ isRemoteAgentToolFactory(factory) {
914
+ return factory.delegatesToRemoteAgent === true;
915
+ }
916
+ }
917
+
918
+ // src/remote-agent-bundle-executor.ts
919
+ class RemoteAgentBundleExecutor {
920
+ fileSystem;
921
+ selector;
922
+ static SESSION_TIMEOUT_MS = 1800000;
923
+ static JOB_START_TIMEOUT_MS = 300000;
924
+ static JOB_POLL_INTERVAL_MS = 5000;
925
+ static MAX_INLINE_INPUT_ARGUMENTS_LENGTH = 1e4;
926
+ sessions = new Map;
927
+ pendingSessionCreations = new Map;
928
+ constructor(fileSystem, selector = new RemoteProjectSelector) {
929
+ this.fileSystem = fileSystem;
930
+ this.selector = selector;
931
+ }
932
+ async packAsync(options, context) {
933
+ return this.enqueueAsync(context, options.projectPath, {
934
+ operation: "Pack" /* Pack */,
935
+ options,
936
+ resolve: () => {}
937
+ });
938
+ }
939
+ async validateAsync(options, context) {
940
+ return this.enqueueAsync(context, options.projectPath, {
941
+ operation: "Validate" /* Validate */,
942
+ options,
943
+ resolve: () => {}
944
+ });
945
+ }
946
+ async cleanupAsync(options, context) {
947
+ if (context.downloadUrl && !options.dryRun && !context.solutionId && !context.projectId) {
948
+ return ToolResult2.error(ToolErrorCodes2.InternalError, "Cleanup save-back requires a solutionId or projectId for downloaded workspaces.");
949
+ }
950
+ return this.enqueueAsync(context, options.projectPath, {
951
+ operation: "Cleanup" /* Cleanup */,
952
+ options,
953
+ resolve: () => {}
954
+ });
955
+ }
956
+ async skipAsync(operation, projectPath, context) {
957
+ context.logger?.info(`[BundleExecutor] ${operation} skipped for project: ${projectPath}`);
958
+ const session = await this.getSessionAsync(context, operation);
959
+ const rejection = this.checkJoin(session, operation, projectPath);
960
+ if (rejection) {
961
+ return rejection;
962
+ }
963
+ session.skipped.add(projectPath);
964
+ this.runIfCompleteAsync(session, context);
965
+ return ToolResult2.success();
966
+ }
967
+ async enqueueAsync(context, projectPath, entry) {
968
+ context.logger?.info(`[BundleExecutor] ${entry.operation}Async called for project: ${projectPath}`);
969
+ const session = await this.getSessionAsync(context, entry.operation);
970
+ const rejection = this.checkJoin(session, entry.operation, projectPath);
971
+ if (rejection) {
972
+ return rejection;
973
+ }
974
+ const promise = new Promise((resolve) => {
975
+ entry.resolve = resolve;
976
+ });
977
+ session.entries.set(projectPath, entry);
978
+ await this.runIfCompleteAsync(session, context);
979
+ return promise;
980
+ }
981
+ checkJoin(session, operation, projectPath) {
982
+ if (session.operation !== operation) {
983
+ return ToolResult2.error("BundleOperationMismatch", translate3.t("remoteAgentBrowser.errors.bundleOperationMismatch", {
984
+ sessionOperation: session.operation,
985
+ entryOperation: operation
986
+ }));
987
+ }
988
+ if (!session.remoteProjects.some((p) => p.ProjectPath === projectPath)) {
989
+ return ToolResult2.error("PackResultError", translate3.t("remoteAgentBrowser.errors.noMatchingProject", {
990
+ projectPath
991
+ }));
992
+ }
993
+ return;
994
+ }
995
+ async runIfCompleteAsync(session, context) {
996
+ const received = receivedCount(session);
997
+ const expected = session.remoteProjects.length;
998
+ context.logger?.info(`[BundleExecutor] session (${session.operation}): ${received}/${expected} projects received (${session.skipped.size} skipped).`);
999
+ if (received < expected) {
1000
+ return;
1001
+ }
1002
+ clearTimeout(session.timeout);
1003
+ if (session.entries.size > 0) {
1004
+ await this.runAgentAsync(session, context);
1005
+ }
1006
+ this.sessions.delete(context.id);
1007
+ }
1008
+ getSessionAsync(context, operation) {
1009
+ const existing = this.sessions.get(context.id);
1010
+ if (existing) {
1011
+ return Promise.resolve(existing);
1012
+ }
1013
+ let pending = this.pendingSessionCreations.get(context.id);
1014
+ if (!pending) {
1015
+ pending = this.createSessionAsync(context, operation);
1016
+ this.pendingSessionCreations.set(context.id, pending);
1017
+ }
1018
+ return pending;
1019
+ }
1020
+ async createSessionAsync(context, operation) {
1021
+ const session = {
1022
+ operation,
1023
+ remoteProjects: this.selector.selectRemoteProjects(context.projects),
1024
+ entries: new Map,
1025
+ skipped: new Set
1026
+ };
1027
+ session.timeout = setTimeout(() => {
1028
+ if (receivedCount(session) < session.remoteProjects.length) {
1029
+ context.logger?.error(`[BundleExecutor] Session timed out after ${RemoteAgentBundleExecutor.SESSION_TIMEOUT_MS}ms: ` + `received ${receivedCount(session)}/${session.remoteProjects.length} projects`);
1030
+ this.resolveAll(session, ToolResult2.error("SessionTimeoutError", translate3.t("remoteAgentBrowser.errors.sessionTimeout", {
1031
+ received: receivedCount(session),
1032
+ expected: session.remoteProjects.length
1033
+ })));
1034
+ this.sessions.delete(context.id);
1035
+ }
1036
+ }, RemoteAgentBundleExecutor.SESSION_TIMEOUT_MS);
1037
+ this.sessions.set(context.id, session);
1038
+ this.pendingSessionCreations.delete(context.id);
1039
+ return session;
1040
+ }
1041
+ async runAgentAsync(session, context) {
1042
+ context.logger?.info(translate3.t("remoteAgentBrowser.info.startingRemoteAgent", {
1043
+ operation: session.operation,
1044
+ count: session.entries.size,
1045
+ paths: [...session.entries.keys()].join(", ")
1046
+ }));
1047
+ const connection = context.connection;
1048
+ context.logger?.info(`[BundleExecutor] connection info: cloudUrl=${connection?.cloudUrl ?? "MISSING"}, hasToken=${!!connection?.accessToken}, folderId=${connection?.folderId ?? "MISSING"}`);
1049
+ if (!connection?.cloudUrl || !connection.accessToken || !connection.folderId) {
1050
+ this.resolveAll(session, ToolResult2.error("ConnectionError", translate3.t("remoteAgentBrowser.errors.missingConnectionInfo")));
1051
+ return;
1052
+ }
1053
+ const sessionId = crypto.randomUUID();
1054
+ const hubConnection = await this.connectToHubAsync(connection, sessionId, context.logger);
1055
+ if (!hubConnection) {
1056
+ this.resolveAll(session, ToolResult2.error("SignalRConnectionError", translate3.t("remoteAgentBrowser.errors.signalRConnectionFailed")));
1057
+ return;
1058
+ }
1059
+ const stopWatching = new AbortController;
1060
+ try {
1061
+ context.logger?.info(`[BundleExecutor] Sending BeginSession...`);
1062
+ const jobKey = await this.sendBeginSessionAsync(session, context, connection, sessionId);
1063
+ context.logger?.info(`[BundleExecutor] BeginSession succeeded (job ${jobKey ?? "key not returned"}). Waiting for completion...`);
1064
+ const result = await Promise.race([
1065
+ hubConnection.waitForCompletionAsync(),
1066
+ this.failIfJobNeverStartsAsync(jobKey, `${toRelativeUrl2(connection.cloudUrl)}/orchestrator_`, connection, context.logger, stopWatching.signal)
1067
+ ]);
1068
+ context.logger?.info(`[BundleExecutor] Got result: errorCode=${result.errorCode}, status=${result.status}, message=${result.message}, bucketId=${result.bucketId}`);
1069
+ await this.handleAgentResultAsync(result, session, context);
1070
+ } catch (error) {
1071
+ const message = error instanceof Error ? error.message : String(error);
1072
+ context.logger?.error(`[BundleExecutor] runAgentAsync caught error: ${message}`);
1073
+ this.resolveAll(session, ToolResult2.error(`${session.operation}AgentError`, message));
1074
+ } finally {
1075
+ stopWatching.abort();
1076
+ await hubConnection.disconnectAsync();
1077
+ }
1078
+ }
1079
+ async failIfJobNeverStartsAsync(jobKey, orchestratorUrl, connection, logger, signal) {
1080
+ const never = new Promise(() => {});
1081
+ if (!jobKey) {
1082
+ logger?.warn("[BundleExecutor] No job key returned; the job start is not watched.");
1083
+ return never;
1084
+ }
1085
+ const url = `${orchestratorUrl}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${jobKey})`;
1086
+ const headers = orchestratorHeaders(connection);
1087
+ const deadline = Date.now() + RemoteAgentBundleExecutor.JOB_START_TIMEOUT_MS;
1088
+ let job;
1089
+ while (Date.now() < deadline) {
1090
+ await delayAsync(RemoteAgentBundleExecutor.JOB_POLL_INTERVAL_MS, signal);
1091
+ if (signal.aborted)
1092
+ return never;
1093
+ let response;
1094
+ try {
1095
+ response = await fetch(url, { headers, signal });
1096
+ } catch {
1097
+ if (signal.aborted)
1098
+ return never;
1099
+ continue;
1100
+ }
1101
+ if (response.status >= 500) {
1102
+ continue;
1103
+ }
1104
+ if (!response.ok) {
1105
+ logger?.warn(`[BundleExecutor] Cannot watch job ${jobKey} (HTTP ${response.status}); its start is not watched.`);
1106
+ return never;
1107
+ }
1108
+ job = await response.json().catch(() => {
1109
+ return;
1110
+ });
1111
+ if (job?.State && job.State !== "Pending") {
1112
+ logger?.info(`[BundleExecutor] Job ${jobKey} left Pending: ${job.State}`);
1113
+ return never;
1114
+ }
1115
+ }
1116
+ await this.stopPendingJobAsync(job?.Id, jobKey, orchestratorUrl, connection, logger);
1117
+ throw new Error(translate3.t("remoteAgentBrowser.errors.jobStartTimeout", {
1118
+ jobKey,
1119
+ minutes: RemoteAgentBundleExecutor.JOB_START_TIMEOUT_MS / 60000
1120
+ }));
1121
+ }
1122
+ async stopPendingJobAsync(jobId, jobKey, orchestratorUrl, connection, logger) {
1123
+ if (jobId === undefined) {
1124
+ logger?.warn(`[BundleExecutor] Job ${jobKey} has no known id; it was not stopped.`);
1125
+ return;
1126
+ }
1127
+ const url = `${orchestratorUrl}/odata/Jobs(${jobId})/UiPath.Server.Configuration.OData.StopJob`;
1128
+ let problem;
1129
+ try {
1130
+ const response = await fetch(url, {
1131
+ method: "POST",
1132
+ headers: {
1133
+ ...orchestratorHeaders(connection),
1134
+ "Content-Type": "application/json"
1135
+ },
1136
+ body: JSON.stringify({ strategy: "SoftStop" })
1137
+ });
1138
+ problem = response.ok ? undefined : `HTTP ${response.status}`;
1139
+ } catch (error) {
1140
+ problem = error instanceof Error ? error.message : String(error);
1141
+ }
1142
+ if (problem) {
1143
+ logger?.warn(`[BundleExecutor] Could not stop pending job ${jobKey}: ${problem}`);
1144
+ }
1145
+ }
1146
+ async connectToHubAsync(connection, sessionId, logger) {
1147
+ const relativeBase = toRelativeUrl2(connection.cloudUrl);
1148
+ const hubUrl = `${relativeBase}/orchestrator_/signalr/robotdebug?sessionId=${sessionId}`;
1149
+ logger?.info(translate3.t("remoteAgentBrowser.info.connectingToHub", {
1150
+ url: hubUrl
1151
+ }));
1152
+ const hubConnection = new PackagerHubConnection(logger);
1153
+ try {
1154
+ await hubConnection.connectAsync(hubUrl, connection.accessToken);
1155
+ return hubConnection;
1156
+ } catch (error) {
1157
+ const message = error instanceof Error ? error.message : String(error);
1158
+ logger?.error(translate3.t("remoteAgentBrowser.errors.hubConnectionFailed", {
1159
+ url: hubUrl,
1160
+ message
1161
+ }));
1162
+ return null;
1163
+ }
1164
+ }
1165
+ async handleAgentResultAsync(result, session, context) {
1166
+ if (result.errorCode !== 0 || result.status !== 0 /* Succeeded */) {
1167
+ this.resolveAll(session, ToolResult2.error(`${session.operation}AgentError`, result.message ?? translate3.t("remoteAgentBrowser.errors.agentFailed", {
1168
+ operation: session.operation,
1169
+ status: result.status,
1170
+ errorCode: result.errorCode
1171
+ })));
1172
+ return;
1173
+ }
1174
+ if (session.operation === "Pack" /* Pack */) {
1175
+ await this.handlePackBucketAsync(result, session, context);
1176
+ return;
1177
+ }
1178
+ if (session.operation === "Cleanup" /* Cleanup */) {
1179
+ this.resolveCleanup(result, session);
1180
+ return;
1181
+ }
1182
+ this.resolveAll(session, ToolResult2.success());
1183
+ }
1184
+ resolveCleanup(result, session) {
1185
+ for (const { project, entry } of sessionProjects(session)) {
1186
+ const details = {};
1187
+ if (result.changedFilesByProject) {
1188
+ details.changedFilesByProject = result.changedFilesByProject;
1189
+ }
1190
+ const raw = result.unusedDependenciesByProject?.[project.Id];
1191
+ if (raw) {
1192
+ details.projectCleanup = toProjectCleanupInfoFromRemote(raw);
1193
+ }
1194
+ const projectResult = ToolResult2.success();
1195
+ if (Object.keys(details).length > 0) {
1196
+ projectResult.details = details;
1197
+ }
1198
+ entry.resolve(projectResult);
1199
+ }
1200
+ }
1201
+ async handlePackBucketAsync(result, session, context) {
1202
+ if (result.bucketId == null) {
1203
+ this.resolveAll(session, ToolResult2.error("PackAgentError", translate3.t("remoteAgentBrowser.errors.packSucceededNoBucket")));
1204
+ return;
1205
+ }
1206
+ const packEntries = new Map;
1207
+ for (const [projectPath, entry] of session.entries) {
1208
+ if (entry.operation === "Pack" /* Pack */) {
1209
+ packEntries.set(projectPath, { options: entry.options });
1210
+ }
1211
+ }
1212
+ const resultProcessor = new PackResultProcessor(this.fileSystem, context.logger);
1213
+ const perProjectResults = await resultProcessor.processAsync(result.bucketId, packEntries, context, result.archiveName);
1214
+ for (const [projectPath, entry] of session.entries) {
1215
+ const projectResult = perProjectResults.get(projectPath);
1216
+ entry.resolve(projectResult ?? ToolResult2.error("PackResultError", translate3.t("remoteAgentBrowser.errors.noResultForProject")));
1217
+ }
1218
+ }
1219
+ async sendBeginSessionAsync(session, context, connection, sessionId) {
1220
+ const relativeBase = toRelativeUrl2(connection.cloudUrl);
1221
+ const onLocalRobot = context.jobTarget?.kind === PackJobTargetKind.LocalRobot;
1222
+ const url = onLocalRobot ? `${relativeBase}/orchestrator_/api/RobotDebug/BeginSession` : `${relativeBase}/orchestrator_/api/serverless/jobs`;
1223
+ context.logger?.info(`[BundleExecutor] BeginSession URL: ${url} (target=${context.jobTarget?.kind ?? PackJobTargetKind.Serverless})`);
1224
+ const entries = sessionProjects(session);
1225
+ const firstEntry = entries[0].entry;
1226
+ const opts = firstEntry.options;
1227
+ const skipAnalyze = "skipAnalyze" in opts ? opts.skipAnalyze : false;
1228
+ const skipValidate = "skipValidate" in opts ? opts.skipValidate : false;
1229
+ const ignoredRules = normalizeIgnoredRules("ignoredRules" in opts ? opts.ignoredRules : undefined);
1230
+ const executorInfo = {
1231
+ Command: session.operation,
1232
+ SupportedProtocolVersions: [PROTOCOL_VERSION],
1233
+ DownloadUrl: context.downloadUrl ?? "",
1234
+ SolutionId: context.solutionId ?? "",
1235
+ ProjectId: context.projectId ?? "",
1236
+ SessionId: sessionId,
1237
+ ProfileKey: "StudioWeb",
1238
+ LicenseType: "Development",
1239
+ LogLevel: opts.logLevel ?? "Warning",
1240
+ Culture: "en-US",
1241
+ DownloadTimeoutInSeconds: 300,
1242
+ SkipAnalyze: String(skipAnalyze),
1243
+ SkipValidate: String(skipValidate),
1244
+ TargetFramework: context.targetFramework
1245
+ };
1246
+ if (ignoredRules.length > 0) {
1247
+ executorInfo.IgnoredRules = ignoredRules;
1248
+ }
1249
+ const rpaProjects = entries.filter((p) => !isFunctionProject(p) && !isCodedAppProject(p));
1250
+ if (rpaProjects.length > 0) {
1251
+ executorInfo.RpaProjects = rpaProjects.map(toProjectPayload);
1252
+ executorInfo.WorkflowCompilerVersion = context.workflowCompilerVersion ?? "";
1253
+ }
1254
+ const functionProjects = entries.filter(isFunctionProject);
1255
+ if (functionProjects.length > 0) {
1256
+ executorInfo.FunctionProjects = functionProjects.map(toProjectPayload);
1257
+ executorInfo.FunctionsPackagerVersion = context.functionsPackagerVersion ?? "";
1258
+ }
1259
+ const codedAppProjects = entries.filter(isCodedAppProject);
1260
+ if (codedAppProjects.length > 0) {
1261
+ executorInfo.CodedAppProjects = codedAppProjects.map(toProjectPayload);
1262
+ executorInfo.CodedAppsPackagerVersion = context.codedAppsPackagerVersion ?? "";
1263
+ }
1264
+ if (firstEntry.operation === "Pack" /* Pack */) {
1265
+ executorInfo.Configuration = context.configuration;
1266
+ const pkg = firstEntry.options.package;
1267
+ executorInfo.Package = {
1268
+ Name: pkg.id,
1269
+ Version: pkg.version,
1270
+ Author: pkg.author ?? "",
1271
+ Description: pkg.description ?? "",
1272
+ ReleaseNotes: pkg.releaseNotes ?? "",
1273
+ Tags: pkg.tags ?? "",
1274
+ IconUrl: pkg.iconUrl ?? "",
1275
+ ProjectUrl: pkg.projectUrl ?? "",
1276
+ RepositoryType: pkg.repositoryType ?? "",
1277
+ RepositoryUrl: pkg.repositoryUrl ?? "",
1278
+ RepositoryBranch: pkg.repositoryBranch ?? "",
1279
+ RepositoryCommit: pkg.repositoryCommit ?? ""
1280
+ };
1281
+ executorInfo.Name = pkg.id;
1282
+ executorInfo.Version = pkg.version;
1283
+ executorInfo.Author = pkg.author ?? "";
1284
+ executorInfo.Description = pkg.description ?? "";
1285
+ executorInfo.ReleaseNotes = pkg.releaseNotes ?? "";
1286
+ if (context.localSourcePath) {
1287
+ if (onLocalRobot && context.jobTarget?.machineSessionIds?.length) {
1288
+ executorInfo.LocalSourcePath = context.localSourcePath;
1289
+ } else {
1290
+ context.logger?.warn("[BundleExecutor] Dropping localSourcePath: the pack job is not pinned to a local robot machine session.");
1291
+ }
1292
+ }
1293
+ }
1294
+ if (firstEntry.operation === "Cleanup" /* Cleanup */) {
1295
+ executorInfo.DryRun = firstEntry.options.dryRun;
1296
+ executorInfo.SkipImports = firstEntry.options.skipImports;
1297
+ if (context.lockKey) {
1298
+ executorInfo.LockKey = context.lockKey;
1299
+ }
1300
+ }
1301
+ const inputArguments = JSON.stringify(executorInfo);
1302
+ const body = onLocalRobot ? {
1303
+ source: "StudioWeb",
1304
+ targetFramework: context.targetFramework,
1305
+ runtimeType: "Development",
1306
+ runAsMe: true,
1307
+ jobsCount: 1,
1308
+ strategy: "ModernJobsCount",
1309
+ requiresUserInteraction: false,
1310
+ ...context.jobTarget?.machineSessionIds?.length ? {
1311
+ machineSessionIds: context.jobTarget.machineSessionIds
1312
+ } : {}
1313
+ } : {
1314
+ source: "StudioWeb",
1315
+ targetFramework: context.targetFramework,
1316
+ jobType: "PublishStudioProject"
1317
+ };
1318
+ if (inputArguments.length > RemoteAgentBundleExecutor.MAX_INLINE_INPUT_ARGUMENTS_LENGTH) {
1319
+ context.logger?.info(translate3.t("remoteAgentBrowser.info.offloadingInputArguments", { length: inputArguments.length }));
1320
+ body.inputFile = await this.uploadInputArgumentsFileAsync(inputArguments, connection, context.logger);
1321
+ } else {
1322
+ body.inputArguments = inputArguments;
1323
+ }
1324
+ const headers = {
1325
+ "Content-Type": "application/json",
1326
+ Authorization: `Bearer ${connection.accessToken}`,
1327
+ "X-UIPATH-OrganizationUnitId": connection.folderId ?? ""
1328
+ };
1329
+ if (connection.tenantId) {
1330
+ headers["x-uipath-tenantid"] = connection.tenantId;
1331
+ }
1332
+ const response = await fetch(url, {
1333
+ method: "POST",
1334
+ headers,
1335
+ body: JSON.stringify(body)
1336
+ });
1337
+ if (!response.ok) {
1338
+ const errorText = await response.text();
1339
+ throw new Error(translate3.t("remoteAgentBrowser.errors.beginSessionFailed", {
1340
+ status: response.status,
1341
+ errorText
1342
+ }));
1343
+ }
1344
+ const created = await response.json().catch(() => {
1345
+ return;
1346
+ });
1347
+ return created?.jobKey || created?.key || undefined;
1348
+ }
1349
+ async uploadInputArgumentsFileAsync(inputArguments, connection, logger) {
1350
+ const baseUrl = toRelativeUrl2(connection.cloudUrl);
1351
+ const attachmentsUrl = `${baseUrl}/orchestrator_/odata/Attachments`;
1352
+ const headers = {
1353
+ "Content-Type": "application/json",
1354
+ Authorization: `Bearer ${connection.accessToken}`,
1355
+ "X-UIPATH-OrganizationUnitId": connection.folderId ?? ""
1356
+ };
1357
+ if (connection.tenantId) {
1358
+ headers["x-uipath-tenantid"] = connection.tenantId;
1359
+ }
1360
+ const createResponse = await fetch(attachmentsUrl, {
1361
+ method: "POST",
1362
+ headers,
1363
+ body: JSON.stringify({ name: "input.json" })
1364
+ });
1365
+ if (!createResponse.ok) {
1366
+ const errorText = await createResponse.text();
1367
+ throw new Error(translate3.t("remoteAgentBrowser.errors.createAttachmentFailed", { status: createResponse.status, errorText }));
1368
+ }
1369
+ const attachment = await createResponse.json();
1370
+ const attachmentId = attachment.Id ?? attachment.id ?? "";
1371
+ const writeUri = attachment.BlobFileAccess?.Uri ?? attachment.blobFileAccess?.Uri;
1372
+ if (!attachmentId || !writeUri) {
1373
+ throw new Error(translate3.t("remoteAgentBrowser.errors.attachmentResponseMalformed"));
1374
+ }
1375
+ const uploadResponse = await fetch(writeUri, {
1376
+ method: "PUT",
1377
+ headers: {
1378
+ "Content-Type": "application/octet-stream",
1379
+ "x-ms-blob-type": "BlockBlob"
1380
+ },
1381
+ body: inputArguments
1382
+ });
1383
+ if (!uploadResponse.ok) {
1384
+ throw new Error(translate3.t("remoteAgentBrowser.errors.uploadInputArgumentsFailed", {
1385
+ status: uploadResponse.status,
1386
+ statusText: uploadResponse.statusText
1387
+ }));
1388
+ }
1389
+ logger?.info(`[BundleExecutor] Uploaded input arguments as attachment ${attachmentId}`);
1390
+ return attachmentId;
1391
+ }
1392
+ resolveAll(session, result) {
1393
+ for (const [, entry] of session.entries) {
1394
+ entry.resolve(result);
1395
+ }
1396
+ }
1397
+ }
1398
+ function orchestratorHeaders(connection) {
1399
+ const headers = {
1400
+ Authorization: `Bearer ${connection.accessToken}`,
1401
+ "X-UIPATH-OrganizationUnitId": connection.folderId ?? ""
1402
+ };
1403
+ if (connection.tenantId) {
1404
+ headers["x-uipath-tenantid"] = connection.tenantId;
1405
+ }
1406
+ return headers;
1407
+ }
1408
+ function delayAsync(ms, signal) {
1409
+ return new Promise((resolve) => {
1410
+ const timer = setTimeout(done, ms);
1411
+ signal.addEventListener("abort", done, { once: true });
1412
+ function done() {
1413
+ clearTimeout(timer);
1414
+ signal.removeEventListener("abort", done);
1415
+ resolve();
1416
+ }
1417
+ });
1418
+ }
1419
+ function receivedCount(session) {
1420
+ return session.entries.size + session.skipped.size;
1421
+ }
1422
+ function sessionProjects(session) {
1423
+ return session.remoteProjects.flatMap((project) => {
1424
+ const entry = project.ProjectPath != null ? session.entries.get(project.ProjectPath) : undefined;
1425
+ return entry ? [{ project, entry }] : [];
1426
+ });
1427
+ }
1428
+ function toProjectPayload({
1429
+ project,
1430
+ entry
1431
+ }) {
1432
+ const packing = entry.operation === "Pack" /* Pack */;
1433
+ return {
1434
+ RelativePath: project.ProjectRelativePath,
1435
+ DesignId: project.Id,
1436
+ ProjectStorageId: packing ? entry.options.projectStorageId ?? "" : "",
1437
+ PackageId: packing ? entry.options.package.id : ""
1438
+ };
1439
+ }
1440
+ function isFunctionProject({ project }) {
1441
+ return project.Type === ProjectTypes.Function;
1442
+ }
1443
+ function isCodedAppProject({ project }) {
1444
+ return project.Type === ProjectTypes.AppV2;
1445
+ }
1446
+ var PROTOCOL_VERSION = "2.0";
1447
+ var SHARED_EXECUTOR_KEY = Symbol.for("@uipath/packager-remote-agent-browser/bundleExecutor");
1448
+ function getSharedRemoteAgentBundleExecutor(fileSystem) {
1449
+ const global = globalThis;
1450
+ const existing = global[SHARED_EXECUTOR_KEY];
1451
+ if (isBundleExecutor(existing)) {
1452
+ return existing;
1453
+ }
1454
+ const executor = new RemoteAgentBundleExecutor(fileSystem);
1455
+ global[SHARED_EXECUTOR_KEY] = executor;
1456
+ return executor;
1457
+ }
1458
+ function isBundleExecutor(value) {
1459
+ const candidate = value;
1460
+ return typeof candidate?.packAsync === "function" && typeof candidate.validateAsync === "function" && typeof candidate.cleanupAsync === "function" && typeof candidate.skipAsync === "function";
1461
+ }
1462
+ // src/remote-agent-project-tool.ts
1463
+ import {
1464
+ ProjectTool,
1465
+ ToolErrorCodes as ToolErrorCodes3,
1466
+ ToolResult as ToolResult3
1467
+ } from "@uipath/solutionpackager-tool-core";
1468
+ class RemoteAgentProjectTool extends ProjectTool {
1469
+ bundleExecutor;
1470
+ context;
1471
+ constructor(fileSystem, logger, bundleExecutor, context) {
1472
+ super(fileSystem, logger);
1473
+ this.bundleExecutor = bundleExecutor;
1474
+ this.context = context;
1475
+ }
1476
+ async validateAsync(options, _cancellationToken) {
1477
+ if (!this.context) {
1478
+ return missingContext("Validate");
1479
+ }
1480
+ return this.bundleExecutor.skipAsync("Validate" /* Validate */, options.projectPath, this.context);
1481
+ }
1482
+ async packAsync(options, _cancellationToken) {
1483
+ if (!this.context) {
1484
+ return missingContext("Pack");
1485
+ }
1486
+ let projectStorageId;
1487
+ try {
1488
+ projectStorageId = await this.resolveProjectIdAsync(options);
1489
+ } catch (error) {
1490
+ await this.bundleExecutor.skipAsync("Pack" /* Pack */, options.projectPath, this.context);
1491
+ return ToolResult3.error(ToolErrorCodes3.InternalError, error instanceof Error ? error.message : String(error));
1492
+ }
1493
+ return this.bundleExecutor.packAsync({ ...options, projectStorageId }, this.context);
1494
+ }
1495
+ async cleanupAsync(options, _cancellationToken) {
1496
+ if (!this.context) {
1497
+ return missingContext("Cleanup");
1498
+ }
1499
+ return this.bundleExecutor.skipAsync("Cleanup" /* Cleanup */, options.projectPath, this.context);
1500
+ }
1501
+ }
1502
+
1503
+ class RemoteAgentProjectToolFactory {
1504
+ bundleExecutor;
1505
+ delegatesToRemoteAgent = true;
1506
+ constructor(bundleExecutor) {
1507
+ this.bundleExecutor = bundleExecutor;
1508
+ }
1509
+ async createAsync(logger, fileSystem, context) {
1510
+ return this.createTool(fileSystem, logger, this.bundleExecutor ?? getSharedRemoteAgentBundleExecutor(fileSystem), context);
1511
+ }
1512
+ }
1513
+ function missingContext(operation) {
1514
+ return ToolResult3.error(ToolErrorCodes3.InternalError, `${operation} operation requires a project operation context`);
1515
+ }
1516
+ export {
1517
+ BundleOperation,
1518
+ RemoteAgentProjectTool,
1519
+ RemoteAgentProjectToolFactory,
1520
+ getSharedRemoteAgentBundleExecutor
1521
+ };
1522
+
1523
+ //# debugId=48A0D895188D012364756E2164756E21