@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.
@@ -0,0 +1,17 @@
1
+ import { type IFileSystem, type IProjectPackOptions, type IToolLogger, type IZipService, type ProjectOperationContext, ToolResult } from "@uipath/solutionpackager-tool-core";
2
+ interface ProjectResultEntry {
3
+ options: IProjectPackOptions;
4
+ }
5
+ export declare class PackResultProcessor {
6
+ private readonly fileSystem;
7
+ private readonly logger?;
8
+ private readonly zipService;
9
+ constructor(fileSystem: IFileSystem, logger?: IToolLogger | undefined, zipService?: IZipService);
10
+ processAsync(bucketId: number, projects: Map<string, ProjectResultEntry>, context: ProjectOperationContext, archiveName?: string): Promise<Map<string, ToolResult>>;
11
+ private downloadArchiveAsync;
12
+ private deleteBucketAsync;
13
+ private getReadUriAsync;
14
+ private downloadBlobAsync;
15
+ private distributePackages;
16
+ }
17
+ export {};
@@ -0,0 +1,37 @@
1
+ import { type IToolLogger, type RemoteWorkflowCompilerCleanupPayload as RemoteProjectCleanup } from "@uipath/solutionpackager-tool-core";
2
+ /** @public */
3
+ export declare enum CompletedStatus {
4
+ Succeeded = 0,
5
+ Stopped = 1,
6
+ Failed = 2
7
+ }
8
+ export interface PackAgentResult {
9
+ errorCode: number;
10
+ status: CompletedStatus;
11
+ message?: string;
12
+ bucketId?: number;
13
+ /**
14
+ * Pack only: the archive's file name in the bucket. Agents that predate it
15
+ * do not send it; they upload `rpa-packages.zip`.
16
+ */
17
+ archiveName?: string;
18
+ /** Cleanup only: files changed per project design id, relative to each project. */
19
+ changedFilesByProject?: Record<string, string[]>;
20
+ /** Cleanup only: raw per-project cleanup payload, keyed by project design id. */
21
+ unusedDependenciesByProject?: Record<string, RemoteProjectCleanup>;
22
+ }
23
+ export declare class PackagerHubConnection {
24
+ private readonly logger?;
25
+ private hubConnection;
26
+ private completionResolve;
27
+ private completionReject;
28
+ constructor(logger?: IToolLogger | undefined);
29
+ connectAsync(hubUrl: string, accessToken: string): Promise<void>;
30
+ private buildConnection;
31
+ private registerOnClose;
32
+ waitForCompletionAsync(): Promise<PackAgentResult>;
33
+ disconnectAsync(): Promise<void>;
34
+ private registerHandlers;
35
+ private onLogMessage;
36
+ private onExecutionCompleted;
37
+ }
@@ -0,0 +1,103 @@
1
+ import { type IFileSystem, type IProjectCleanupOptions, type IProjectPackOptions, type IProjectValidateOptions, type ProjectOperationContext, ToolResult } from "@uipath/solutionpackager-tool-core";
2
+ import { BundleOperation } from "./bundle-operation.js";
3
+ import { RemoteProjectSelector } from "./remote-project-selector.js";
4
+ /**
5
+ * Hands one project to the remote agent. Every call for one operation context,
6
+ * whatever the project's type, joins the same bundle and so the same
7
+ * Orchestrator job.
8
+ */
9
+ export interface IRemoteAgentBundleExecutor {
10
+ packAsync(options: IProjectPackOptions, context: ProjectOperationContext): Promise<ToolResult>;
11
+ validateAsync(options: IProjectValidateOptions, context: ProjectOperationContext): Promise<ToolResult>;
12
+ cleanupAsync(options: IProjectCleanupOptions, context: ProjectOperationContext): Promise<ToolResult>;
13
+ /**
14
+ * Tells the bundle that a remote project's tool has nothing for the agent
15
+ * to do in `operation`, so the bundle stops waiting for it and leaves it
16
+ * out of the job. When every remote project is skipped, no job starts.
17
+ * Resolves once the skip is recorded, without waiting for the job.
18
+ */
19
+ skipAsync(operation: BundleOperation, projectPath: string, context: ProjectOperationContext): Promise<ToolResult>;
20
+ }
21
+ /**
22
+ * Coordinates one remote-agent run for every remote project of an operation
23
+ * context. Tools of any remote project type submit their project; once
24
+ * every project the context will send has arrived, the executor starts a
25
+ * single Orchestrator job for all of them and resolves each caller with its
26
+ * own result.
27
+ *
28
+ * Which projects to wait for comes from {@link RemoteProjectSelector}, so the
29
+ * bundle spans every remote factory that is actually registered, not just the
30
+ * one that created the tool.
31
+ */
32
+ export declare class RemoteAgentBundleExecutor implements IRemoteAgentBundleExecutor {
33
+ private readonly fileSystem;
34
+ private readonly selector;
35
+ static readonly SESSION_TIMEOUT_MS = 1800000;
36
+ /**
37
+ * How long the agent job may stay Pending. A job no robot picks up would
38
+ * otherwise keep the operation waiting for a result that never comes.
39
+ */
40
+ static readonly JOB_START_TIMEOUT_MS = 300000;
41
+ static readonly JOB_POLL_INTERVAL_MS = 5000;
42
+ /**
43
+ * Maximum length (in characters) of the inline `inputArguments` payload
44
+ * accepted by the serverless jobs endpoint. Beyond this the arguments must
45
+ * be uploaded as a file attachment and referenced via `inputFile`.
46
+ */
47
+ static readonly MAX_INLINE_INPUT_ARGUMENTS_LENGTH = 10000;
48
+ private readonly sessions;
49
+ private readonly pendingSessionCreations;
50
+ constructor(fileSystem: IFileSystem, selector?: RemoteProjectSelector);
51
+ packAsync(options: IProjectPackOptions, context: ProjectOperationContext): Promise<ToolResult>;
52
+ validateAsync(options: IProjectValidateOptions, context: ProjectOperationContext): Promise<ToolResult>;
53
+ cleanupAsync(options: IProjectCleanupOptions, context: ProjectOperationContext): Promise<ToolResult>;
54
+ skipAsync(operation: BundleOperation, projectPath: string, context: ProjectOperationContext): Promise<ToolResult>;
55
+ private enqueueAsync;
56
+ /** Why `projectPath` may not join `session` for `operation`, if it may not. */
57
+ private checkJoin;
58
+ /**
59
+ * Once every remote project has been submitted or skipped, runs the job
60
+ * for the submitted ones, or closes the session when all were skipped.
61
+ */
62
+ private runIfCompleteAsync;
63
+ private getSessionAsync;
64
+ private createSessionAsync;
65
+ private runAgentAsync;
66
+ /**
67
+ * Rejects when the agent job is still Pending after
68
+ * {@link JOB_START_TIMEOUT_MS}, after asking Orchestrator to stop it so it
69
+ * cannot run later for a caller that has given up. Never resolves: once
70
+ * the job has started, or when it cannot be watched, the agent's own
71
+ * result (or the hub closing) settles the operation.
72
+ */
73
+ private failIfJobNeverStartsAsync;
74
+ private stopPendingJobAsync;
75
+ private connectToHubAsync;
76
+ private handleAgentResultAsync;
77
+ /**
78
+ * The agent removed unused items in-place and (for cloud solutions) saved the
79
+ * solution back to StudioWeb; there is no bucket to download. Resolve each
80
+ * project with its own result carrying the changed files (the full map, which
81
+ * solution-cleanup-service unions) and that project's cleanup payload mapped
82
+ * to the generic {@link toProjectCleanupInfo} shape.
83
+ */
84
+ private resolveCleanup;
85
+ private handlePackBucketAsync;
86
+ private sendBeginSessionAsync;
87
+ /**
88
+ * Uploads the input arguments JSON as a file attachment and returns the
89
+ * attachment id, to be passed as `inputFile` on the serverless job request.
90
+ * Mirrors the two-step flow used by the Orchestrator UI: create the
91
+ * attachment (which returns a signed blob write URI) then PUT the contents
92
+ * to that URI using the storage-provided headers.
93
+ */
94
+ private uploadInputArgumentsFileAsync;
95
+ private resolveAll;
96
+ }
97
+ /**
98
+ * The bundle executor shared by every remote-agent tool factory in this
99
+ * runtime, created on first use with the file system of the first caller.
100
+ * Every factory must go through it for the RPA, Function and coded app
101
+ * projects of one pack to land in the same agent job.
102
+ */
103
+ export declare function getSharedRemoteAgentBundleExecutor(fileSystem: IFileSystem): IRemoteAgentBundleExecutor;
@@ -0,0 +1,41 @@
1
+ import { type IFileSystem, type IProjectCleanupOptions, type IProjectPackOptions, type IProjectValidateOptions, type IToolLogger, type ProjectOperationContext, ProjectTool, type ProjectType, ToolResult } from "@uipath/solutionpackager-tool-core";
2
+ import { type IRemoteAgentBundleExecutor } from "./remote-agent-bundle-executor.js";
3
+ import type { IRemoteAgentToolFactory } from "./remote-project-selector.js";
4
+ /**
5
+ * A browser tool whose projects only pack on the Remote Agent: pack goes to
6
+ * the shared bundle executor, while validate and cleanup have nothing for the
7
+ * agent to do and tell the bundle to skip the project, so the other projects'
8
+ * job no longer waits for it and no job starts when nothing else needs one.
9
+ * Restore and build keep the base no-ops.
10
+ *
11
+ * A subclass names the project id the package gets. The agent packs a
12
+ * throwaway copy of the project, so an id it minted there would change on
13
+ * every pack.
14
+ */
15
+ export declare abstract class RemoteAgentProjectTool extends ProjectTool {
16
+ protected readonly bundleExecutor: IRemoteAgentBundleExecutor;
17
+ protected readonly context?: ProjectOperationContext | undefined;
18
+ constructor(fileSystem: IFileSystem, logger: IToolLogger, bundleExecutor: IRemoteAgentBundleExecutor, context?: ProjectOperationContext | undefined);
19
+ /** The project id the agent's package carries, sent as `ProjectStorageId`. */
20
+ protected abstract resolveProjectIdAsync(options: IProjectPackOptions): Promise<string>;
21
+ validateAsync(options: IProjectValidateOptions, _cancellationToken?: AbortSignal): Promise<ToolResult>;
22
+ packAsync(options: IProjectPackOptions, _cancellationToken?: AbortSignal): Promise<ToolResult>;
23
+ cleanupAsync(options: IProjectCleanupOptions, _cancellationToken?: AbortSignal): Promise<ToolResult>;
24
+ }
25
+ /**
26
+ * Factory for a {@link RemoteAgentProjectTool}. Its tools use the given
27
+ * bundle executor, by default the one every remote factory shares, so all the
28
+ * remote projects of a pack land in one agent job.
29
+ */
30
+ export declare abstract class RemoteAgentProjectToolFactory implements IRemoteAgentToolFactory {
31
+ private readonly bundleExecutor?;
32
+ readonly delegatesToRemoteAgent = true;
33
+ abstract readonly supportedTypes: readonly ProjectType[];
34
+ /**
35
+ * @param bundleExecutor Executor to delegate to; defaults to the shared
36
+ * one. Tests pass their own.
37
+ */
38
+ constructor(bundleExecutor?: IRemoteAgentBundleExecutor | undefined);
39
+ createAsync(logger: IToolLogger, fileSystem: IFileSystem, context?: ProjectOperationContext): Promise<ProjectTool>;
40
+ protected abstract createTool(fileSystem: IFileSystem, logger: IToolLogger, bundleExecutor: IRemoteAgentBundleExecutor, context?: ProjectOperationContext): ProjectTool;
41
+ }
@@ -0,0 +1,33 @@
1
+ import { type IProjectToolFactory, type IToolsFactoryRepository, type ProjectType, type UiPathProject } from "@uipath/solutionpackager-tool-core";
2
+ /**
3
+ * A project tool factory whose tools hand their projects to the shared
4
+ * remote-agent bundle executor. {@link RemoteProjectSelector} looks for this
5
+ * marker on the registered factories, so every factory that delegates to the
6
+ * executor must carry it.
7
+ */
8
+ export interface IRemoteAgentToolFactory extends IProjectToolFactory {
9
+ readonly delegatesToRemoteAgent: true;
10
+ }
11
+ /**
12
+ * Decides which projects the remote agent processes: those whose type is
13
+ * packed by a tool that delegates to it.
14
+ *
15
+ * It asks the tools-factory registry — the same lookup the packager uses to
16
+ * dispatch each project — so a remote factory that lost its type to a local
17
+ * one (the first registration wins) never makes the bundle wait for a project
18
+ * that will not come.
19
+ */
20
+ export declare class RemoteProjectSelector {
21
+ private readonly repository;
22
+ constructor(repository?: IToolsFactoryRepository);
23
+ /** Whether projects of `projectType` are processed by the remote agent. */
24
+ isRemote(projectType: ProjectType): boolean;
25
+ /** The projects of an operation that will join the remote-agent bundle. */
26
+ selectRemoteProjects(projects: readonly UiPathProject[]): UiPathProject[];
27
+ /**
28
+ * Read off the marker rather than a class: factories implement
29
+ * {@link IRemoteAgentToolFactory}, they do not extend anything `instanceof`
30
+ * could check.
31
+ */
32
+ private isRemoteAgentToolFactory;
33
+ }
package/package.json CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
- "name": "@uipath/packager-remote-agent-browser",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@uipath/packager-remote-agent-browser",
3
+ "version": "1.205.0-preview.258",
4
+ "description": "UiPath Remote Agent bundling for browser packager tools",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./dist/index.js"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/UiPath/cli.git",
12
+ "directory": "packages/packager/packager-remote-agent-browser"
13
+ },
14
+ "publishConfig": {
15
+ "registry": "https://registry.npmjs.org/"
16
+ },
17
+ "types": "./dist/index.d.ts",
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "author": "UiPath",
22
+ "license": "SEE LICENSE IN LICENSE.txt",
23
+ "peerDependencies": {
24
+ "@uipath/solutionpackager-tool-core": "1.205.0",
25
+ "@microsoft/signalr": ">=7 <11"
26
+ },
27
+ "gitHead": "8f629ee9fa89abf94f197436a60cb3b9620f8b27"
28
+ }