@uipath/delegate-sdk 1.202.0 → 1.203.0-preview.20260924122926

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/README.md CHANGED
@@ -45,7 +45,7 @@ import { runLoginFlow } from '@uipath/delegate-sdk';
45
45
  const auth = await runLoginFlow({ env: 'production' }); // 'alpha' | 'staging' | 'production'
46
46
  ```
47
47
 
48
- `runLoginFlow` runs OAuth PKCE in your browser and saves to `~/.aria/sdk-auth.json` (`env`, or an explicit `baseUrl`, is required — there is no default cloud; `tenant` picks a tenant by name, `silent: true` suppresses the console output). The browser is sent back to a loopback listener on `http://localhost:8055/oidc/login`; when that port is busy the login falls back to 42042, then 8104 (the three callbacks registered for the built-in client — 8104 is `uip login`'s fixed port, so it is tried last):
48
+ `runLoginFlow` runs OAuth PKCE in your browser and saves to `~/.aria/sdk-auth.json` (`env` for a UiPath cloud, or `baseUrl` for an [Automation Suite or other self-hosted deployment](#automation-suite-and-other-self-hosted-deployments), is required — there is no default deployment; `tenant` picks a tenant by name, `silent: true` suppresses the console output). The browser is sent back to a loopback listener on `http://localhost:8055/oidc/login`; when that port is busy the login falls back to 42042, then 8104 (the three callbacks registered for the built-in client — 8104 is `uip login`'s fixed port, so it is tried last):
49
49
 
50
50
  ```json
51
51
  {
@@ -73,9 +73,34 @@ saveAuthData(await switchTenant(auth, 'Finance'));
73
73
 
74
74
  **Following a saved login**: `readSavedAuthRecord(filePath)` reads one file as `SdkAuthData`, without network calls or fallback to another login; missing or invalid records return `null`. Capture `grantIdentity(auth)` when the host starts, compare later reads with `sameGrantIdentity(pinned, grantIdentity(candidate))`, and pass the pin as `refreshAccessToken(auth, { authFilePath, pinnedIdentity })`. Refresh runs under the SDK's cross-process lock and checks the supplied credentials, a peer's rotation adopted from the file, and the refreshed grant against the pin before returning or saving anything. Without a pin, it uses the supplied credentials' identity. Unknown client/subject fields remain compatible with legacy records; org and tenant must always match. Hosts do not need to snapshot or restore the auth file after a rejected refresh: a foreign grant is never written, and the login's pending marker stays set so the consumed refresh token is not replayed (it needs a new login).
75
75
 
76
+ ### Automation Suite and other self-hosted deployments
77
+
78
+ Anything that is not one of the named clouds — Automation Suite, Dedicated, Public Sector — is signed into by URL instead of by name:
79
+
80
+ ```ts
81
+ const auth = await runLoginFlow({ baseUrl: 'https://automationsuite.contoso.com' });
82
+ ```
83
+
84
+ (`delegate-cli login --url https://automationsuite.contoso.com` from the CLI.) A tenant path or a trailing `/identity_` is accepted and reduced to the origin, so the URL you already have to hand works. Non-`https` URLs and URLs with embedded credentials are refused.
85
+
86
+ **Requirements**
87
+
88
+ - **Automation Suite 26.10 or later with the Delegate service installed.** Older deployments are refused at login (see below).
89
+ - **An identity client the deployment accepts.** The built-in client is a registration on the UiPath clouds; if the deployment rejects it with `invalid_client`, register your own external application there and set `UIPATH_CLIENT_ID` — see the next section for the redirect URIs and scopes to register.
90
+ - **A trusted certificate.** If the deployment uses a private certificate authority, point Node at it with `NODE_EXTRA_CA_CERTS=/path/to/ca.pem`. Do not disable certificate verification: sign-in and token requests carry credentials.
91
+
92
+ **What login checks, and when.** Two questions, deliberately asked at two different moments:
93
+
94
+ 1. *Before the browser opens*, `GET {url}/identity_/.well-known/openid-configuration` — proving a UiPath Identity is mounted there, and yielding the authorize/token endpoints the flow then uses. All three advertised URLs must sit on the origin you named, so a host that merely proxies a UiPath-shaped document cannot redirect the sign-in elsewhere. This fails closed: nothing reaches a browser until it passes.
95
+ 2. *After the token exchange and tenant selection*, an authenticated `GET {url}/{org}/{tenant}/delegate_/v1/config` — the same read-only request `delegate-cli models` and `runHealthCheck` make. On Automation Suite (`IS_AUTOMATION_SUITE: true`) the backend must list `delegate` in `SUPPORTED_SHELL_APPS`; the key is absent on pre-26.10 images by construction, so its absence is the version gate (the Orchestrator version cannot tell those images apart). A deployment whose Delegate service is missing, unreachable or too old is refused before anything is written to disk. A UiPath cloud is never asked.
96
+
97
+ `runLoginFlow({ skipEnvCheck: true })` (`delegate-cli login --skip-env-check`) skips both and assumes the `{url}/identity_/connect/...` endpoint shape. It exists for a deployment that puts discovery behind an ingress rule, or serves Identity from a different origin than the one being signed into; it also gives up the diagnosis when something is genuinely wrong.
98
+
99
+ Everything after login is deployment-agnostic: org/tenant lookup, token refresh, and the backend URL all use the same `{base}/{org}/{tenant}/<service>_` routing the clouds use. The one exception is the interop sidecar's OIDC issuer, which the SDK pins for you — see [Computer use & interop lifecycle](#computer-use--interop-lifecycle).
100
+
76
101
  ### Using your own identity app
77
102
 
78
- By default the SDK authenticates as a built-in UiPath **public** client (PKCE, no secret): `Orchestrator.HYOA.CLI`, the same client `uip login` uses, whose loopback callback is registered on alpha, staging and production. To use your own identity app instead, override the client id — and, for a confidential app, the secret:
103
+ By default the SDK authenticates as a built-in UiPath **public** client (PKCE, no secret): `Orchestrator.HYOA.CLI`, the same client `uip login` uses, whose loopback callback is registered on alpha, staging and production. A self-hosted deployment may not have that registration, in which case the token exchange fails with `invalid_client` and the error says so. To use your own identity app instead, override the client id — and, for a confidential app, the secret:
79
104
 
80
105
  ```bash
81
106
  export UIPATH_CLIENT_ID=<your-client-id>
@@ -117,9 +142,11 @@ When `autoSpawnInterop` is on (and no `interopUrl` was supplied), the SDK spawns
117
142
  |---|---|---|
118
143
  | default | fresh per invocation | killed on exit |
119
144
  | `keepInteropAlive: true` | reuse PID-file process, else spawn | left running |
120
- | `new InteropProcess().stop({ force: true })` | — | force-kill PID-file process |
145
+ | `new InteropProcess().stop({ force: true })` | — | force-kill every PID-file process |
146
+
147
+ PID files: `~/.delegate-sdk/interop.pid` for the UiPath clouds, plus one `interop-<hash>.pid` per self-hosted deployment. Stale entries (dead process or `/health` not responding) are cleaned up automatically.
121
148
 
122
- PID file: `~/.delegate-sdk/interop.pid`. Stale entries (dead process or `/health` not responding) are cleaned up automatically.
149
+ **OIDC issuer on a self-hosted deployment**: the interop resolves its trusted token issuers *once at startup*. Given no `--base-url` it trusts only the three UiPath clouds, so an interop started that way rejects every call made with an Automation Suite token — as a 401, with nothing pointing at the cause. The SDK therefore starts it with `--base-url=<deployment origin>` whenever `auth.baseUrl` is a self-hosted deployment, and records it in a PID file of that deployment's own. Interops for different deployments therefore run side by side: starting a session against one never stops the interop another live session is using. A cloud login deliberately keeps the default three issuers, so a reused interop still works across an alpha→staging switch. `runHealthCheck` spawns its interop with the same pin.
123
150
 
124
151
  **Turn-policy snapshots**: the interop denies governed endpoints (filesystem, shell, Office, PDF, computer use) unless the request carries an `X-Delegate-Policy-Snapshot` header naming a pre-registered snapshot. The SDK handles this automatically whenever an interop is engaged: it registers a full-access global snapshot per agent turn (and one ambient snapshot for interop calls made outside any turn) and attaches the header. Registration needs an organization id from the auth provider; without one, turns fail with "Local access policy could not be selected".
125
152
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/index.mjs
3
- size: 59729033 bytes
4
- sha256: aa7570400618057a20ea929fbb30aa70fad5f202034e29a47aba98a1a0a5e96d
3
+ size: 60680376 bytes
4
+ sha256: 4798f78e74d85d630e4c42b71419e635ef92a797b5c07decaadfcd632427c464
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/delegate-sdk",
3
- "version": "1.202.0",
3
+ "version": "1.203.0-preview.20260924122926",
4
4
  "description": "UiPath Delegate SDK - Programmatic agent interface",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",
@@ -50,9 +50,9 @@
50
50
  "zod-to-json-schema": "^3.25.1"
51
51
  },
52
52
  "optionalDependencies": {
53
- "@uipath/delegate-runtime-darwin-arm64": "1.202.0",
54
- "@uipath/delegate-runtime-win32-x64": "1.202.0",
55
- "@uipath/delegate-runtime-linux-x64": "1.202.0"
53
+ "@uipath/delegate-runtime-darwin-arm64": "1.203.0-preview.20260924122926",
54
+ "@uipath/delegate-runtime-win32-x64": "1.203.0-preview.20260924122926",
55
+ "@uipath/delegate-runtime-linux-x64": "1.203.0-preview.20260924122926"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/node": "^22.0.0",