agl 42.0.0 → 42.1.0
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/changelog.md +6 -0
- package/dist_serve/bundle.js +2493 -2143
- package/dist_serve/bundle.js.map +2 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +2 -2
- package/dist_ts/classes.authstore.d.ts +2 -0
- package/dist_ts/classes.authstore.js +50 -17
- package/dist_ts/classes.controller.d.ts +71 -2
- package/dist_ts/classes.controller.js +500 -113
- package/dist_ts/classes.controllerdevices.d.ts +128 -0
- package/dist_ts/classes.controllerdevices.js +472 -0
- package/dist_ts/classes.sessionfeed.d.ts +10 -1
- package/dist_ts/classes.sessionfeed.js +12 -2
- package/dist_ts/classes.validation.d.ts +2 -0
- package/dist_ts/classes.validation.js +2 -2
- package/dist_ts/functions.deviceapi.d.ts +28 -0
- package/dist_ts/functions.deviceapi.js +246 -0
- package/dist_ts/functions.deviceproof.d.ts +33 -0
- package/dist_ts/functions.deviceproof.js +93 -0
- package/dist_ts/functions.remotecli.d.ts +1 -1
- package/dist_ts/functions.remotecli.js +12 -7
- package/dist_ts/interfaces.auth.d.ts +1 -1
- package/dist_ts/interfaces.auth.js +6 -1
- package/dist_ts_interfaces/devices.d.ts +331 -0
- package/dist_ts_interfaces/devices.js +34 -0
- package/dist_ts_interfaces/index.d.ts +2 -0
- package/dist_ts_interfaces/index.js +3 -1
- package/dist_ts_interfaces/interfaces.d.ts +4 -2
- package/dist_ts_interfaces/interfaces.js +3 -2
- package/dist_ts_interfaces/mcprequests.d.ts +1 -1
- package/dist_ts_interfaces/requests.d.ts +2 -1
- package/dist_ts_interfaces/requests.devices.d.ts +89 -0
- package/dist_ts_interfaces/requests.devices.js +2 -0
- package/dist_ts_interfaces/requests.js +1 -1
- package/package.json +1 -1
- package/readme.md +36 -4
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +2 -2
- package/ts/classes.authstore.ts +46 -14
- package/ts/classes.controller.ts +697 -167
- package/ts/classes.controllerdevices.ts +469 -0
- package/ts/classes.sessionfeed.ts +13 -1
- package/ts/classes.validation.ts +1 -1
- package/ts/functions.deviceapi.ts +295 -0
- package/ts/functions.deviceproof.ts +118 -0
- package/ts/functions.remotecli.ts +11 -5
- package/ts/interfaces.auth.ts +5 -0
- package/ts_interfaces/devices.schema.json +890 -0
- package/ts_interfaces/devices.ts +392 -0
- package/ts_interfaces/index.ts +2 -0
- package/ts_interfaces/interfaces.ts +4 -1
- package/ts_interfaces/mcprequests.ts +1 -1
- package/ts_interfaces/requests.devices.ts +95 -0
- package/ts_interfaces/requests.ts +10 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/classes.controllersocketclient.ts +27 -0
- package/ts_web/elements.devices.ts +752 -0
- package/ts_web/elements.harnesscontrollerapp.ts +18 -1
package/readme.md
CHANGED
|
@@ -2947,13 +2947,13 @@ A failure reference from the Errors dialog appears in those logs on the line the
|
|
|
2947
2947
|
|
|
2948
2948
|
41.1.0 and the later 41.x releases are the ones this release rolls back to. This release keeps a port's trusted-proxy secret sealed in the controller's database and never exports it, and `agl remote set` can store gateway sources, which 41.x cannot enforce. To roll back a port that this release serves behind a TLS reverse proxy:
|
|
2949
2949
|
|
|
2950
|
-
1. Stop the controller and run `agl remote unset --port <port>`. It moves the port back to `http://localhost:<port>` and removes its passkey, so the next start prints a setup code. A 41.x controller refuses to start on a configuration with gateway sources, and its refusal names this command.
|
|
2950
|
+
1. Stop the controller and run `agl remote unset --port <port>`. It moves the port back to `http://localhost:<port>` and removes its passkey and every paired device, so the next start prints a setup code. A 41.x controller refuses to start on a configuration with gateway sources, and its refusal names this command.
|
|
2951
2951
|
2. Roll back and start the controller. Roll back only while no upgrade is open: 41.x refuses an upgrade transaction this release created.
|
|
2952
2952
|
3. To serve 41.x behind the proxy again, generate a new secret and set it both on the proxy route (`X-Harness-Controller-Proxy-Secret`) and in `AGL_TRUSTED_PROXY_SECRET`, as 41.x's readme describes. 41.x fixes a port's public origin and TLS mode on its first start, so that is a port that has not been started yet.
|
|
2953
2953
|
|
|
2954
2954
|
A recovery of AGL 42 that would roll a stalled upgrade back to a release older than 42 first checks the port's stored configuration: while it names gateway sources (`agl remote set --gateway-source`), which such a release refuses to start on and has no command to remove, it restores nothing and asks you to run `agl remote unset --port 4097` with 42, still installed, and then `agl upgrade --port 4097` again. Whether the release it would put back supports gateway sources is what that release's package declares (`controllerGatewaySourcesVersion`), as the upgrade recorded it when it started.
|
|
2955
2955
|
|
|
2956
|
-
The audit events of types 41.x does not know (`remote.*`) stay in the audit log and are pruned with the others.
|
|
2956
|
+
The audit events of types 41.x does not know (`remote.*`, `device.*`) stay in the audit log and are pruned with the others.
|
|
2957
2957
|
|
|
2958
2958
|
### Migrating From `hcon`
|
|
2959
2959
|
|
|
@@ -3078,7 +3078,8 @@ agl start --port 4097 # prints the setup code for https://agl.example.com
|
|
|
3078
3078
|
- The controller keeps its id (`controller:4097`) and all of its data: projects, conversations, tickets, settings and the audit trail. Only the public origin, the WebAuthn RP ID (the origin's hostname when `--rp-id` is omitted; IP addresses and public suffixes are refused) and the gateway sources change.
|
|
3079
3079
|
- A passkey belongs to its RP ID. When the origin or RP ID changes, the passkey is removed and every temporary password revoked, so nothing that signed in to the old origin signs in to the new one. The next `agl start` prints a fresh setup code to its terminal, never to a log: enroll the passkey at the new origin with it. Running `remote set` again with only other gateway sources keeps the passkey.
|
|
3080
3080
|
- `--gateway-source` names an address the proxy's connections arrive from (IPv4 or IPv6, repeatable, at most 16). Without one only a reverse proxy on this host reaches the controller.
|
|
3081
|
-
-
|
|
3081
|
+
- A paired device signs the public origin (see Paired Devices), so a changed origin removes every paired device as well; `remote set` says how many. Changing only the gateway sources or the RP ID keeps them.
|
|
3082
|
+
- `agl remote unset --port 4097` moves the port back to `http://localhost:4097` (RP ID `localhost`): it removes the passkey and every paired device, revokes every temporary password and forgets the trusted-proxy secret. The next start prints a setup code.
|
|
3082
3083
|
- Both refuse while anything listens on the port, take start admission (no upgrade runs meanwhile), run as the local OS user (the trust `agl temp-password` has) and are audited as `remote.set` or `remote.unset`, attempted and then succeeded or failed, with the OS user and process and the public origin and RP ID the move goes from and to (never a secret).
|
|
3083
3084
|
- A start never moves a port: one that asks for another `--public-origin`, `--rp-id` or TLS mode is refused and names `agl remote set`. A new port can still start behind a reverse proxy on this host directly: `agl start --public-origin https://agl.example.com --rp-id agl.example.com --behind-tls-proxy`.
|
|
3084
3085
|
|
|
@@ -3135,11 +3136,42 @@ sudo ufw status verbose # the allow is listed before the deny, and no broader
|
|
|
3135
3136
|
|
|
3136
3137
|
The gateway source is the address the proxy's connections arrive from on this host. A router that translates addresses between the proxy and this host puts its own address there, and every host behind it then passes the source check: route without translation, or put the proxy on this host's network.
|
|
3137
3138
|
|
|
3139
|
+
## Paired Devices
|
|
3140
|
+
|
|
3141
|
+
A phone or a desktop app pairs with a controller and then reaches it as a device: it lists the session feed, reads a session's transcript, sends a message to a session and answers its permissions and questions. A device reaches nothing else: no terminals, settings, accounts, tickets, browsers or files. It connects through the controller's public HTTPS origin (Remote Browser Access), so a controller in local mode pairs no device.
|
|
3142
|
+
|
|
3143
|
+
### Pairing a device
|
|
3144
|
+
|
|
3145
|
+
**Settings → Devices → Pair a device** makes a single-use pairing code and shows it as a QR code, with its expiry:
|
|
3146
|
+
|
|
3147
|
+
- The code is 32 random bytes, valid for five minutes and once; at most four wait at once, and closing the dialog withdraws its code. Codes live only in the controller's memory, so a restart voids them. The QR code carries `agl-pair:?origin=<public origin>&controller=<controller id>&code=<code>`. Anyone who has the code can pair until it expires: show it only to the device you pair.
|
|
3148
|
+
- A device without a camera, such as the Linux desktop app, pairs with the same code as a pairing link: **Copy pairing link** beside the QR code puts exactly the QR code's `agl-pair:` link on the clipboard, and you paste it into the app on that device. Nothing is copied unless you press it, and the button is there only while a code waits and the page may write the clipboard (an HTTPS or localhost page). The link is the same single-use, five-minute code, not a second one, and AGL does not clear the clipboard afterwards: paste it only on the device you pair, and close the dialog to withdraw an unused code.
|
|
3149
|
+
- The app makes its own P-256 key (on an iPhone in the Secure Enclave), signs the code with it and sends its name, model and public key. The controller keeps the public key and nothing secret.
|
|
3150
|
+
- The dialog then shows the device's name and its key fingerprint (SHA-256 of the key, the first 16 bytes as eight groups of four hex digits), which the app shows too. Compare the two, above all after pairing by a copied link; if they differ, **Revoke** in the same dialog removes the device at once.
|
|
3151
|
+
- A controller holds at most 16 devices.
|
|
3152
|
+
|
|
3153
|
+
Each connection of a device authenticates on its own: the controller hands it a nonce, the device signs it with its key, and the connection holds the device's authentication on the server side until it closes. The signed messages bind the controller id, the public origin and the code or nonce, so a signature made for one controller or origin is useless at another.
|
|
3154
|
+
|
|
3155
|
+
### Managing devices
|
|
3156
|
+
|
|
3157
|
+
Settings → Devices lists every paired device with its model, when it paired, whether it is connected now and when it last connected. A device's page shows its key fingerprint and id. **Revoke** deletes the device and closes every connection of it at once with WebSocket close code 4403; the device must pair again with a new code. Moving the controller to another public origin with `agl remote set` or `agl remote unset` removes every device, since each signed the old origin; the devices go in the same transaction as the move, so a move that fails keeps them. Pairing, authentication and revocation are audited (`device.pairing.begin`, `device.pair`, `device.auth`, `device.revoke`), and every request of a device is audited under `device:<id>`.
|
|
3158
|
+
|
|
3159
|
+
### The device protocol
|
|
3160
|
+
|
|
3161
|
+
The device API is its own contract, separate from the browser's: `ts_interfaces/devices.ts` in the package, and the same contracts as JSON Schema in `ts_interfaces/devices.schema.json` (each contract's request and response, and every named type they reach). A device asks `device.hello` for the device protocol version (`major` 1, `minor` 0) and speaks one major; within it, changes only add. Apps generate their clients from these files.
|
|
3162
|
+
|
|
3163
|
+
- Before it is authenticated a connection reaches `device.hello`, `device.pair`, `device.auth.challenge` and `device.auth.prove`, under the controller's limits for unauthenticated requests: per connection, and in total together with the browser's sign-in requests. After that it reaches `device.sessions.list`, `device.session.read`, `device.session.send`, `device.permission.reply` and `device.question.reply`, under the limits of the owner's browser. A device never reaches a method of the browser, and the browser never one of a device. A connection is one or the other for its whole life: a connection signed in as the browser cannot authenticate as a device, and one a device authenticated cannot sign in as the browser.
|
|
3164
|
+
- The feed is the sidebar's session feed without terminal rows, host directories or tickets. A transcript page reduces a tool call to its name, title and status; its input and output stay on the controller. `device.session.read` without `before` returns the newest page, sized by the controller whatever `limit` says; with `before` it returns the next older page of `limit` messages (1 to 50, default 20). A device names a session only by the feed's row id, and reaches only what the feed lists.
|
|
3165
|
+
- A message from a device is a direct message (it queues behind a running turn), never the browser's shared draft. A native session AGL does not write to (another process runs it, a fleet worker owns it) refuses it, as it refuses the browser.
|
|
3166
|
+
- The controller pushes a device an allowlist of events in their own shape: feed changes, a session's change, its streaming text (snapshots and exact deltas) and a resynchronization request. Every other event, and every event about a session the feed does not list, stays on the controller. A device that falls behind by 256 events or 4 MiB is resynchronized alone.
|
|
3167
|
+
- Through the gateway, a device's WebSocket upgrade carries the public origin as `Origin`, like a browser's (Admission).
|
|
3168
|
+
|
|
3138
3169
|
## Security Boundaries
|
|
3139
3170
|
|
|
3140
3171
|
- Local mode binds the controller to loopback only, and so does TLS-proxy mode without a gateway source. With one, a request from off loopback needs a configured gateway source address and the trusted-proxy secret, and only loopback connects without an `Origin`.
|
|
3141
3172
|
- The trusted-proxy secret is generated and TPM2-sealed in the controller's database; it is never read from the environment, written to a file or logged.
|
|
3142
|
-
- Only `agl remote`, run by the local OS user against a stopped controller, changes a port's public origin, RP ID, TLS mode or gateway sources, and a changed origin or RP ID removes the passkey.
|
|
3173
|
+
- Only `agl remote`, run by the local OS user against a stopped controller, changes a port's public origin, RP ID, TLS mode or gateway sources, and a changed origin or RP ID removes the passkey (a changed origin every paired device too).
|
|
3174
|
+
- A paired device holds its own key; the controller stores only its public key. A device reaches only the device scope (feed, bounded reads, direct sends, permission and question answers), each connection proves the key over a fresh nonce, and revoking a device closes its connections at once. Pairing codes are single-use, live five minutes in memory only, and pairing is refused in local mode.
|
|
3143
3175
|
- The private OpenCode server always remains on loopback and uses a generated per-process password.
|
|
3144
3176
|
- Application RPC starts only after the exact TypedSocket package-major handshake.
|
|
3145
3177
|
- The management endpoint (`/management/typedrequest`, used by the CLI and the upgrade worker) answers only an HTTP `POST` of `application/json` from a loopback peer (`127.0.0.1` or `::1`), addressed to `127.0.0.1:<port>`, with no `Origin` and no forwarding header (`Forwarded`, `X-Forwarded-*`, `X-Real-IP`, `X-Harness-Controller-Proxy-Secret`), so a browser or a request a proxy forwards is refused, also in proxy mode. It serves only the status read and the upgrade methods; each upgrade method authorises itself against the upgrade token and its one-time grant, as it does over the socket, and every upgrade request counts against the controller's global unauthenticated preflight limit.
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3765,7 +3765,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
|
|
|
3765
3765
|
},
|
|
3766
3766
|
"protocolVersion": {
|
|
3767
3767
|
"type": "number",
|
|
3768
|
-
"const":
|
|
3768
|
+
"const": 49
|
|
3769
3769
|
},
|
|
3770
3770
|
"upgradeManagementVersion": {
|
|
3771
3771
|
"type": "number"
|
|
@@ -3891,7 +3891,7 @@ export const AGL_API_SURFACE: plugins.flexTypedRequest.IFlexTypedRequestSurface
|
|
|
3891
3891
|
],
|
|
3892
3892
|
"additionalProperties": false
|
|
3893
3893
|
},
|
|
3894
|
-
"declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion:
|
|
3894
|
+
"declaration": "interface IControllerStatus {\n packageName: string;\n packageVersion: string;\n protocolVersion: 49;\n upgradeManagementVersion: number;\n /**\n * The protocol of the controller's loopback management endpoint (`controllerManagementProtocolVersion`); absent\n * from a controller older than the endpoint, which this release refuses to manage.\n */\n managementProtocolVersion?: number;\n controllerPid: number;\n processGroupId: number;\n processFingerprint: string;\n processMode: TControllerProcessMode;\n lifecycleState: TControllerLifecycleState;\n startedAt: number;\n setupRequired: boolean;\n /** Present when the controller runs as the systemd user unit (`agl service install`); absent for a detached or foreground one. */\n serviceUnit?: \"agl-controller.service\";\n /** The TLS mode of the runtime configuration the controller runs with; absent until it is resolved. */\n tlsMode?: TControllerTlsMode;\n upgrade?: IControllerUpgradeStatus;\n /** AGL's inference proxy, by state only; details need a signed-in owner (`controller.proxy.status.get`). */\n proxy?: { state: TControllerProxyState };\n harnesses: Array<{\n harnessId: TControllerSessionHarnessId;\n pid?: number;\n state: TControllerHarnessLifecycleState;\n healthy: boolean;\n version?: string;\n supportsLocalAttachments?: boolean;\n connectionMode?: 'local' | 'shared' | 'remote';\n diagnostic?: IControllerCodexDiagnostic;\n /** Codex only: automatic reconnection of this entry's profile to the local shared app-server. */\n rejoin?: IControllerCodexRejoinStatus;\n /**\n * Codex only, on the controller status: every connected or required profile. The entry's\n * `healthy` is then true only when each of them is, apart from a profile on an account Codex\n * cannot run on now, listed `stopped` with an `account_unavailable` diagnostic that says why;\n * its other members describe the default profile.\n */\n profiles?: IControllerCodexProfileStatus[];\n }>;\n}"
|
|
3895
3895
|
},
|
|
3896
3896
|
{
|
|
3897
3897
|
"name": "IControllerTerminalResource",
|
package/ts/classes.authstore.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { FleetTicketEffectModel } from './fleet/classes.ticketeffects.js';
|
|
|
8
8
|
import { ControllerCodexOriginMigrationModel } from '../ts_migration/v29_codexorigins.js';
|
|
9
9
|
import { ControllerCodexConnectionStore } from './classes.codexconnectionstore.js';
|
|
10
10
|
import { ControllerTrustedProxySecretModel } from './classes.trustedproxysecrets.js';
|
|
11
|
+
import { ControllerDeviceModel, deleteControllerDevices } from './classes.controllerdevices.js';
|
|
11
12
|
import { ControllerClaudeSessionStore } from './classes.claudesessionstore.js';
|
|
12
13
|
import { ControllerClaudeSessionModel } from './classes.claudesessionmodels.js';
|
|
13
14
|
import { ControllerPendingPromptStore } from './classes.pendingpromptstore.js';
|
|
@@ -801,6 +802,7 @@ const setAuthStoreModelManager = (
|
|
|
801
802
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, FlexTranscriptGrantModel);
|
|
802
803
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrackedConversationModel);
|
|
803
804
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrustedProxySecretModel);
|
|
805
|
+
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerDeviceModel);
|
|
804
806
|
plugins.nosqldb.setDefaultManagerForDoc(
|
|
805
807
|
managerArg,
|
|
806
808
|
ControllerLegacyManagedSessionMigrationModel,
|
|
@@ -1086,6 +1088,10 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1086
1088
|
await FlexTranscriptGrantModel.init();
|
|
1087
1089
|
await ControllerTrackedConversationModel.init();
|
|
1088
1090
|
await ControllerTrustedProxySecretModel.init();
|
|
1091
|
+
await ControllerDeviceModel.init();
|
|
1092
|
+
// `moveRuntimeConfig` changes the configuration and deletes the paired devices in one transaction.
|
|
1093
|
+
await ControllerAuthModel.exact.prepare();
|
|
1094
|
+
await ControllerDeviceModel.exact.prepare();
|
|
1089
1095
|
await new PostDatabaseDocumentMigrationRunner(this.database).run();
|
|
1090
1096
|
this.initialized = true;
|
|
1091
1097
|
if (!this.closeStarted) this.projectMutationAdmissionOpen = true;
|
|
@@ -1518,6 +1524,8 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1518
1524
|
previous: IControllerRuntimeConfig;
|
|
1519
1525
|
changed: boolean;
|
|
1520
1526
|
enrollmentReset: boolean;
|
|
1527
|
+
/** How many paired devices the move removed: a device signs the public origin, so a new origin removes them all. */
|
|
1528
|
+
devicesRemoved: number;
|
|
1521
1529
|
}> {
|
|
1522
1530
|
const stored = await this.findStoredState();
|
|
1523
1531
|
const current = ControllerAuthModel.exact.toPersisted(stored);
|
|
@@ -1525,23 +1533,47 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1525
1533
|
throw new AuthError('config_mismatch', 'A runtime configuration moves only within its own port.');
|
|
1526
1534
|
}
|
|
1527
1535
|
const previous = cloneRuntimeConfig(current.config);
|
|
1528
|
-
if (runtimeConfigsEqual(current.config, targetArg))
|
|
1536
|
+
if (runtimeConfigsEqual(current.config, targetArg)) {
|
|
1537
|
+
return { previous, changed: false, enrollmentReset: false, devicesRemoved: 0 };
|
|
1538
|
+
}
|
|
1529
1539
|
const enrollmentReset = current.config.publicOrigin !== targetArg.publicOrigin || current.config.rpId !== targetArg.rpId;
|
|
1530
1540
|
if (enrollmentReset) await this.revokeTempPasswords();
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1541
|
+
// Every paired device signs the public origin; none could authenticate at another one. The devices go in the
|
|
1542
|
+
// configuration's own transaction, so a move that fails keeps them along with the old origin.
|
|
1543
|
+
const removesDevices = current.config.publicOrigin !== targetArg.publicOrigin;
|
|
1544
|
+
const controllerId = this.requireControllerId();
|
|
1545
|
+
let devicesRemoved = 0;
|
|
1546
|
+
const session = this.db.createSession();
|
|
1547
|
+
try {
|
|
1548
|
+
await session.withTransaction(async (transactionArg) => {
|
|
1549
|
+
devicesRemoved = 0;
|
|
1550
|
+
const result = await ControllerAuthModel.exact.transition({
|
|
1551
|
+
current: stored,
|
|
1552
|
+
change: (model) => {
|
|
1553
|
+
model.config = cloneRuntimeConfig(targetArg);
|
|
1554
|
+
if (!enrollmentReset) return;
|
|
1555
|
+
model.credentials = [];
|
|
1556
|
+
model.authState = 'setupRequired';
|
|
1557
|
+
model.setup = null;
|
|
1558
|
+
},
|
|
1559
|
+
}, { session: transactionArg });
|
|
1560
|
+
if (result.status !== 'transitioned') {
|
|
1561
|
+
throw new AuthError('concurrent_change', 'The controller configuration changed concurrently and was not moved.');
|
|
1562
|
+
}
|
|
1563
|
+
if (removesDevices) devicesRemoved = await deleteControllerDevices(controllerId, { session: transactionArg });
|
|
1564
|
+
});
|
|
1565
|
+
} catch (errorArg) {
|
|
1566
|
+
if (plugins.nosqldb.SmartdataSession.getCommitOutcome(errorArg) === 'not_committed') throw errorArg;
|
|
1567
|
+
// The commit may have landed: the move stands only if the store shows all of it.
|
|
1568
|
+
const reconciled = ControllerAuthModel.exact.toPersisted(await this.findStoredState());
|
|
1569
|
+
const remaining = removesDevices ? await ControllerDeviceModel.exact.count({ controllerId }) : 0;
|
|
1570
|
+
if (!runtimeConfigsEqual(reconciled.config, targetArg) || remaining !== 0) {
|
|
1571
|
+
throw new AuthError('ambiguous_write', 'The runtime configuration move has an ambiguous outcome.', { cause: errorArg });
|
|
1572
|
+
}
|
|
1573
|
+
} finally {
|
|
1574
|
+
await session.close();
|
|
1543
1575
|
}
|
|
1544
|
-
return { previous, changed: true, enrollmentReset };
|
|
1576
|
+
return { previous, changed: true, enrollmentReset, devicesRemoved };
|
|
1545
1577
|
}
|
|
1546
1578
|
|
|
1547
1579
|
/** Deletes every temporary password of this controller, expired or not. */
|