agl 42.0.0 → 42.2.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 +44 -0
- package/dist_serve/bundle.js +2520 -2158
- package/dist_serve/bundle.js.map +2 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +124 -10
- package/dist_ts/classes.accountsactions.d.ts +3 -1
- package/dist_ts/classes.accountsactions.js +16 -1
- package/dist_ts/classes.authstore.d.ts +2 -0
- package/dist_ts/classes.authstore.js +58 -17
- package/dist_ts/classes.cli.js +19 -49
- package/dist_ts/classes.configurationauthority.js +2 -2
- 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.controllerservice.d.ts +20 -2
- package/dist_ts/classes.controllerservice.js +42 -6
- package/dist_ts/classes.flexservice.js +8 -3
- package/dist_ts/classes.inferencegateway.d.ts +30 -2
- package/dist_ts/classes.inferencegateway.js +115 -20
- package/dist_ts/classes.inferencerouter.d.ts +16 -0
- package/dist_ts/classes.inferencerouter.js +5 -3
- package/dist_ts/classes.inferenceservice.js +7 -3
- package/dist_ts/classes.sessionfeed.d.ts +10 -1
- package/dist_ts/classes.sessionfeed.js +12 -2
- package/dist_ts/classes.ticketmodels.js +4 -3
- package/dist_ts/classes.ticketnotifier.js +9 -2
- package/dist_ts/classes.ticketstore.js +9 -5
- package/dist_ts/classes.upgradecoordinator.d.ts +6 -1
- package/dist_ts/classes.upgradecoordinator.js +9 -2
- package/dist_ts/classes.upgradetransaction.d.ts +27 -1
- package/dist_ts/classes.upgradetransaction.js +92 -2
- package/dist_ts/classes.validation.d.ts +2 -0
- package/dist_ts/classes.validation.js +2 -2
- package/dist_ts/configuration/functions.master.d.ts +7 -2
- package/dist_ts/configuration/functions.master.js +7 -4
- package/dist_ts/driver/classes.drivereventrelay.d.ts +1 -1
- package/dist_ts/driver/classes.drivereventrelay.js +3 -3
- package/dist_ts/fleet/classes.boardpump.d.ts +1 -1
- package/dist_ts/fleet/classes.boardpump.js +7 -4
- package/dist_ts/fleet/classes.claudeworkers.d.ts +6 -0
- package/dist_ts/fleet/classes.claudeworkers.js +17 -7
- package/dist_ts/fleet/classes.deploymodels.d.ts +19 -0
- package/dist_ts/fleet/classes.deploymodels.js +140 -0
- package/dist_ts/fleet/functions.validation.d.ts +8 -1
- package/dist_ts/fleet/functions.validation.js +65 -3
- package/dist_ts/fleet/interfaces.workers.d.ts +6 -0
- package/dist_ts/fleet/interfaces.workers.js +65 -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.fleetworkercli.d.ts +16 -3
- package/dist_ts/functions.fleetworkercli.js +21 -7
- package/dist_ts/functions.inferencecli.js +4 -2
- package/dist_ts/functions.mcptickettools.d.ts +1 -0
- package/dist_ts/functions.remotecli.d.ts +1 -1
- package/dist_ts/functions.remotecli.js +12 -7
- package/dist_ts/functions.ticketvalidation.d.ts +36 -3
- package/dist_ts/functions.ticketvalidation.js +45 -14
- package/dist_ts/interfaces.auth.d.ts +1 -1
- package/dist_ts/interfaces.auth.js +7 -1
- package/dist_ts_authswitch/authority-contract.d.ts +23 -0
- package/dist_ts_authswitch/authority-contract.js +1 -1
- package/dist_ts_authswitch/classes.authoritybroker.d.ts +6 -0
- package/dist_ts_authswitch/classes.authoritybroker.js +31 -4
- package/dist_ts_authswitch/classes.authoritycli.d.ts +1 -0
- package/dist_ts_authswitch/classes.authoritycli.js +26 -1
- package/dist_ts_authswitch/classes.authorityclient.d.ts +3 -1
- package/dist_ts_authswitch/classes.authorityclient.js +10 -4
- package/dist_ts_authswitch/classes.authoritydaemon.js +7 -1
- package/dist_ts_authswitch/classes.authorityimport.js +2 -2
- package/dist_ts_authswitch/classes.authoritymodels.d.ts +3 -0
- package/dist_ts_authswitch/classes.authoritymodels.js +10 -3
- package/dist_ts_authswitch/testsupport.js +4 -4
- package/dist_ts_authswitch/ts_migration/0012_account_claude_code.d.ts +11 -0
- package/dist_ts_authswitch/ts_migration/0012_account_claude_code.js +18 -0
- package/dist_ts_authswitch/ts_migration/index.js +3 -1
- package/dist_ts_interfaces/deployments.d.ts +104 -0
- package/dist_ts_interfaces/deployments.js +8 -0
- package/dist_ts_interfaces/devices.d.ts +331 -0
- package/dist_ts_interfaces/devices.js +34 -0
- package/dist_ts_interfaces/fleet.d.ts +2 -0
- package/dist_ts_interfaces/index.d.ts +3 -0
- package/dist_ts_interfaces/index.js +4 -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.accounts.d.ts +18 -0
- package/dist_ts_interfaces/requests.accounts.js +1 -1
- package/dist_ts_interfaces/requests.d.ts +3 -2
- 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/dist_ts_interfaces/tickets.d.ts +53 -4
- package/dist_ts_interfaces/tickets.js +6 -2
- package/dist_ts_migration/index.d.ts +1 -0
- package/dist_ts_migration/index.js +2 -1
- package/dist_ts_migration/v41_ticketmigrationmarkers.d.ts +19 -0
- package/dist_ts_migration/v41_ticketmigrationmarkers.js +85 -0
- package/docs/authswitch.md +6 -0
- package/package.json +5 -5
- package/readme.md +84 -16
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +123 -9
- package/ts/classes.accountsactions.ts +24 -0
- package/ts/classes.authstore.ts +54 -14
- package/ts/classes.cli.ts +17 -54
- package/ts/classes.configurationauthority.ts +1 -1
- package/ts/classes.controller.ts +697 -167
- package/ts/classes.controllerdevices.ts +469 -0
- package/ts/classes.controllerservice.ts +49 -6
- package/ts/classes.flexservice.ts +7 -2
- package/ts/classes.inferencegateway.ts +133 -19
- package/ts/classes.inferencerouter.ts +20 -2
- package/ts/classes.inferenceservice.ts +6 -3
- package/ts/classes.sessionfeed.ts +13 -1
- package/ts/classes.ticketmodels.ts +3 -2
- package/ts/classes.ticketnotifier.ts +8 -1
- package/ts/classes.ticketstore.ts +8 -4
- package/ts/classes.upgradecoordinator.ts +14 -4
- package/ts/classes.upgradetransaction.ts +118 -0
- package/ts/classes.validation.ts +1 -1
- package/ts/configuration/functions.master.ts +6 -3
- package/ts/driver/classes.drivereventrelay.ts +2 -2
- package/ts/fleet/classes.boardpump.ts +7 -4
- package/ts/fleet/classes.claudeworkers.ts +16 -6
- package/ts/fleet/classes.deploymodels.ts +44 -0
- package/ts/fleet/functions.validation.ts +50 -2
- package/ts/fleet/interfaces.workers.ts +56 -1
- package/ts/functions.deviceapi.ts +295 -0
- package/ts/functions.deviceproof.ts +118 -0
- package/ts/functions.fleetworkercli.ts +26 -8
- package/ts/functions.inferencecli.ts +3 -1
- package/ts/functions.remotecli.ts +11 -5
- package/ts/functions.ticketvalidation.ts +48 -13
- package/ts/interfaces.auth.ts +6 -0
- package/ts_authswitch/authority-contract.ts +18 -0
- package/ts_authswitch/classes.authoritybroker.ts +29 -3
- package/ts_authswitch/classes.authoritycli.ts +29 -0
- package/ts_authswitch/classes.authorityclient.ts +12 -4
- package/ts_authswitch/classes.authoritydaemon.ts +8 -1
- package/ts_authswitch/classes.authorityimport.ts +1 -1
- package/ts_authswitch/classes.authoritymodels.ts +5 -1
- package/ts_authswitch/native-contracts.md +10 -0
- package/ts_authswitch/testsupport.ts +3 -3
- package/ts_authswitch/ts_migration/0012_account_claude_code.ts +17 -0
- package/ts_authswitch/ts_migration/index.ts +2 -0
- package/ts_interfaces/deployments.ts +98 -0
- package/ts_interfaces/devices.schema.json +890 -0
- package/ts_interfaces/devices.ts +392 -0
- package/ts_interfaces/fleet.ts +2 -0
- package/ts_interfaces/index.ts +3 -0
- package/ts_interfaces/interfaces.ts +4 -1
- package/ts_interfaces/mcprequests.ts +1 -1
- package/ts_interfaces/requests.accounts.ts +16 -0
- package/ts_interfaces/requests.devices.ts +95 -0
- package/ts_interfaces/requests.ts +12 -0
- package/ts_interfaces/tickets.ts +34 -4
- package/ts_migration/index.ts +1 -0
- package/ts_migration/v41_ticketmigrationmarkers.ts +28 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/classes.accountsreadmodel.ts +12 -1
- package/ts_web/classes.controllersocketclient.ts +27 -0
- package/ts_web/elements.accounts.ts +44 -0
- package/ts_web/elements.devices.ts +752 -0
- package/ts_web/elements.harnesscontrollerapp.ts +18 -1
- package/ts_web/elements.ticketboard.ts +15 -4
package/ts/classes.authstore.ts
CHANGED
|
@@ -3,11 +3,14 @@ import { DriverModel } from './driver/classes.driverstore.js';
|
|
|
3
3
|
import { DirectReportModel } from './driver/classes.directreportstore.js';
|
|
4
4
|
import { SessionFeedAcknowledgementModel } from './classes.sessionfeedacknowledgements.js';
|
|
5
5
|
import { HarnessReleaseModel } from './classes.harnessreleases.js';
|
|
6
|
+
import { DeployObservationModel } from './fleet/classes.deploymodels.js';
|
|
7
|
+
import { TicketMigrationMarkerModel } from '../ts_migration/v41_ticketmigrationmarkers.js';
|
|
6
8
|
import { WorkerCallerBindingModel } from './classes.workercallerbindings.js';
|
|
7
9
|
import { FleetTicketEffectModel } from './fleet/classes.ticketeffects.js';
|
|
8
10
|
import { ControllerCodexOriginMigrationModel } from '../ts_migration/v29_codexorigins.js';
|
|
9
11
|
import { ControllerCodexConnectionStore } from './classes.codexconnectionstore.js';
|
|
10
12
|
import { ControllerTrustedProxySecretModel } from './classes.trustedproxysecrets.js';
|
|
13
|
+
import { ControllerDeviceModel, deleteControllerDevices } from './classes.controllerdevices.js';
|
|
11
14
|
import { ControllerClaudeSessionStore } from './classes.claudesessionstore.js';
|
|
12
15
|
import { ControllerClaudeSessionModel } from './classes.claudesessionmodels.js';
|
|
13
16
|
import { ControllerPendingPromptStore } from './classes.pendingpromptstore.js';
|
|
@@ -785,6 +788,8 @@ const setAuthStoreModelManager = (
|
|
|
785
788
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, SessionFeedAcknowledgementModel);
|
|
786
789
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, FleetTicketEffectModel);
|
|
787
790
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, HarnessReleaseModel);
|
|
791
|
+
plugins.nosqldb.setDefaultManagerForDoc(managerArg, DeployObservationModel);
|
|
792
|
+
plugins.nosqldb.setDefaultManagerForDoc(managerArg, TicketMigrationMarkerModel);
|
|
788
793
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, WorkerCallerBindingModel);
|
|
789
794
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, TicketModel);
|
|
790
795
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, TicketBoardModel);
|
|
@@ -801,6 +806,7 @@ const setAuthStoreModelManager = (
|
|
|
801
806
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, FlexTranscriptGrantModel);
|
|
802
807
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrackedConversationModel);
|
|
803
808
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrustedProxySecretModel);
|
|
809
|
+
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerDeviceModel);
|
|
804
810
|
plugins.nosqldb.setDefaultManagerForDoc(
|
|
805
811
|
managerArg,
|
|
806
812
|
ControllerLegacyManagedSessionMigrationModel,
|
|
@@ -1060,6 +1066,10 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1060
1066
|
await FleetTicketEffectModel.exact.prepare();
|
|
1061
1067
|
await HarnessReleaseModel.init();
|
|
1062
1068
|
await HarnessReleaseModel.exact.prepare();
|
|
1069
|
+
await DeployObservationModel.init();
|
|
1070
|
+
await DeployObservationModel.exact.prepare();
|
|
1071
|
+
await TicketMigrationMarkerModel.init();
|
|
1072
|
+
await TicketMigrationMarkerModel.exact.prepare();
|
|
1063
1073
|
await WorkerCallerBindingModel.init();
|
|
1064
1074
|
await WorkerCallerBindingModel.exact.prepare();
|
|
1065
1075
|
await TicketModel.init();
|
|
@@ -1086,6 +1096,10 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1086
1096
|
await FlexTranscriptGrantModel.init();
|
|
1087
1097
|
await ControllerTrackedConversationModel.init();
|
|
1088
1098
|
await ControllerTrustedProxySecretModel.init();
|
|
1099
|
+
await ControllerDeviceModel.init();
|
|
1100
|
+
// `moveRuntimeConfig` changes the configuration and deletes the paired devices in one transaction.
|
|
1101
|
+
await ControllerAuthModel.exact.prepare();
|
|
1102
|
+
await ControllerDeviceModel.exact.prepare();
|
|
1089
1103
|
await new PostDatabaseDocumentMigrationRunner(this.database).run();
|
|
1090
1104
|
this.initialized = true;
|
|
1091
1105
|
if (!this.closeStarted) this.projectMutationAdmissionOpen = true;
|
|
@@ -1518,6 +1532,8 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1518
1532
|
previous: IControllerRuntimeConfig;
|
|
1519
1533
|
changed: boolean;
|
|
1520
1534
|
enrollmentReset: boolean;
|
|
1535
|
+
/** How many paired devices the move removed: a device signs the public origin, so a new origin removes them all. */
|
|
1536
|
+
devicesRemoved: number;
|
|
1521
1537
|
}> {
|
|
1522
1538
|
const stored = await this.findStoredState();
|
|
1523
1539
|
const current = ControllerAuthModel.exact.toPersisted(stored);
|
|
@@ -1525,23 +1541,47 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1525
1541
|
throw new AuthError('config_mismatch', 'A runtime configuration moves only within its own port.');
|
|
1526
1542
|
}
|
|
1527
1543
|
const previous = cloneRuntimeConfig(current.config);
|
|
1528
|
-
if (runtimeConfigsEqual(current.config, targetArg))
|
|
1544
|
+
if (runtimeConfigsEqual(current.config, targetArg)) {
|
|
1545
|
+
return { previous, changed: false, enrollmentReset: false, devicesRemoved: 0 };
|
|
1546
|
+
}
|
|
1529
1547
|
const enrollmentReset = current.config.publicOrigin !== targetArg.publicOrigin || current.config.rpId !== targetArg.rpId;
|
|
1530
1548
|
if (enrollmentReset) await this.revokeTempPasswords();
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1549
|
+
// Every paired device signs the public origin; none could authenticate at another one. The devices go in the
|
|
1550
|
+
// configuration's own transaction, so a move that fails keeps them along with the old origin.
|
|
1551
|
+
const removesDevices = current.config.publicOrigin !== targetArg.publicOrigin;
|
|
1552
|
+
const controllerId = this.requireControllerId();
|
|
1553
|
+
let devicesRemoved = 0;
|
|
1554
|
+
const session = this.db.createSession();
|
|
1555
|
+
try {
|
|
1556
|
+
await session.withTransaction(async (transactionArg) => {
|
|
1557
|
+
devicesRemoved = 0;
|
|
1558
|
+
const result = await ControllerAuthModel.exact.transition({
|
|
1559
|
+
current: stored,
|
|
1560
|
+
change: (model) => {
|
|
1561
|
+
model.config = cloneRuntimeConfig(targetArg);
|
|
1562
|
+
if (!enrollmentReset) return;
|
|
1563
|
+
model.credentials = [];
|
|
1564
|
+
model.authState = 'setupRequired';
|
|
1565
|
+
model.setup = null;
|
|
1566
|
+
},
|
|
1567
|
+
}, { session: transactionArg });
|
|
1568
|
+
if (result.status !== 'transitioned') {
|
|
1569
|
+
throw new AuthError('concurrent_change', 'The controller configuration changed concurrently and was not moved.');
|
|
1570
|
+
}
|
|
1571
|
+
if (removesDevices) devicesRemoved = await deleteControllerDevices(controllerId, { session: transactionArg });
|
|
1572
|
+
});
|
|
1573
|
+
} catch (errorArg) {
|
|
1574
|
+
if (plugins.nosqldb.SmartdataSession.getCommitOutcome(errorArg) === 'not_committed') throw errorArg;
|
|
1575
|
+
// The commit may have landed: the move stands only if the store shows all of it.
|
|
1576
|
+
const reconciled = ControllerAuthModel.exact.toPersisted(await this.findStoredState());
|
|
1577
|
+
const remaining = removesDevices ? await ControllerDeviceModel.exact.count({ controllerId }) : 0;
|
|
1578
|
+
if (!runtimeConfigsEqual(reconciled.config, targetArg) || remaining !== 0) {
|
|
1579
|
+
throw new AuthError('ambiguous_write', 'The runtime configuration move has an ambiguous outcome.', { cause: errorArg });
|
|
1580
|
+
}
|
|
1581
|
+
} finally {
|
|
1582
|
+
await session.close();
|
|
1543
1583
|
}
|
|
1544
|
-
return { previous, changed: true, enrollmentReset };
|
|
1584
|
+
return { previous, changed: true, enrollmentReset, devicesRemoved };
|
|
1545
1585
|
}
|
|
1546
1586
|
|
|
1547
1587
|
/** Deletes every temporary password of this controller, expired or not. */
|
package/ts/classes.cli.ts
CHANGED
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
assertControllerStatus,
|
|
33
33
|
isLoopbackPortListening,
|
|
34
34
|
queryControllerStatus as queryManagedControllerStatus,
|
|
35
|
-
requestControllerUpgradeLaunch,
|
|
36
35
|
stopRunningController,
|
|
37
36
|
tryQueryControllerStatus as tryQueryManagedControllerStatus,
|
|
38
37
|
waitUntilControllerExited,
|
|
@@ -68,14 +67,13 @@ import {
|
|
|
68
67
|
handoffStalledUpgradeRecoveryUnderLock,
|
|
69
68
|
type IUpgradeWorkerLaunchCandidate,
|
|
70
69
|
inspectOrphanedUpgradeForAdoption,
|
|
71
|
-
|
|
70
|
+
launchUpgradeWorkerUnderLock,
|
|
72
71
|
resolveCurrentCliPath,
|
|
73
72
|
resolveCurrentPnpmGlobalInstallation,
|
|
74
73
|
resolveVerifiedPnpmGlobalShim,
|
|
75
74
|
runUpgradeWorker,
|
|
76
75
|
terminalizeUpgradeWorkerHandoffFailure,
|
|
77
76
|
tryResolveCurrentPnpmGlobalInstallation,
|
|
78
|
-
UpgradeWorkerCandidateDrainageError,
|
|
79
77
|
UpgradeWorkerHandoffError,
|
|
80
78
|
type IPnpmGlobalInstallation,
|
|
81
79
|
} from './classes.upgradetransaction.js';
|
|
@@ -237,7 +235,8 @@ service install writes and enables ${controllerServiceUnitName} for this AGL_HOM
|
|
|
237
235
|
--port; it never starts or stops ${currentRuntimeName}. From then on start, stop, restart and
|
|
238
236
|
upgrade drive that unit, which restarts ${currentRuntimeName} after a failure and starts it at
|
|
239
237
|
login. Move a running detached controller into it with restart; change its
|
|
240
|
-
settings with stop, service install, then start. The unit carries PATH
|
|
238
|
+
settings with stop, service install, then start. The unit carries PATH
|
|
239
|
+
(this shell's, then the directories the installed unit had that it lacks),
|
|
241
240
|
AGL_HOME and the database, harness, certificate and proxy variables, never a
|
|
242
241
|
secret: install refuses while AGL_FORWARD_ENV or a credentialed AGL_MONGO_URL,
|
|
243
242
|
HTTP_PROXY or HTTPS_PROXY is set. A controller behind a TLS reverse proxy runs
|
|
@@ -1518,12 +1517,16 @@ const installControllerService = async (argvArg: TParsedArguments): Promise<void
|
|
|
1518
1517
|
executable,
|
|
1519
1518
|
port,
|
|
1520
1519
|
logFilePath: service.logFilePath(port),
|
|
1520
|
+
keptPath: installed.keptPath,
|
|
1521
1521
|
}, null, 2) + '\n');
|
|
1522
1522
|
return;
|
|
1523
1523
|
}
|
|
1524
1524
|
process.stdout.write([
|
|
1525
1525
|
`${controllerServiceUnitName} ${installed.changed ? 'installed' : 'unchanged'} and enabled: ${installed.record.path}`,
|
|
1526
1526
|
`Runs: ${executable} __serve --service --port ${port}`,
|
|
1527
|
+
...(installed.keptPath.length > 0
|
|
1528
|
+
? [`PATH keeps after this shell's entries what the installed unit had: ${installed.keptPath.join(plugins.path.delimiter)}`]
|
|
1529
|
+
: []),
|
|
1527
1530
|
`Logs: ${service.logFilePath(port)}`,
|
|
1528
1531
|
next,
|
|
1529
1532
|
].join('\n') + '\n');
|
|
@@ -1747,57 +1750,17 @@ const upgradeController = async (argvArg: TParsedArguments): Promise<void> => {
|
|
|
1747
1750
|
gracePeriodMs: payload.gracePeriodMs,
|
|
1748
1751
|
});
|
|
1749
1752
|
try {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
controller: payload.expectedController!,
|
|
1758
|
-
});
|
|
1759
|
-
try {
|
|
1760
|
-
const launched = await requestControllerUpgradeLaunch(port, status, payload.token);
|
|
1761
|
-
worker = {
|
|
1762
|
-
pid: launched.workerPid,
|
|
1763
|
-
cliPath: installation.cliPath,
|
|
1764
|
-
logFilePath: launched.logFilePath,
|
|
1765
|
-
};
|
|
1766
|
-
} finally {
|
|
1767
|
-
await coordinator.removeLaunchGrant(payload.token);
|
|
1768
|
-
}
|
|
1769
|
-
} else {
|
|
1770
|
-
const launched = await launchDetachedUpgradeWorker({ installation, payload });
|
|
1771
|
-
worker = launched;
|
|
1772
|
-
}
|
|
1753
|
+
worker = await launchUpgradeWorkerUnderLock({
|
|
1754
|
+
coordinator,
|
|
1755
|
+
installation,
|
|
1756
|
+
lock: invocationLease,
|
|
1757
|
+
payload,
|
|
1758
|
+
...(status ? { status } : {}),
|
|
1759
|
+
});
|
|
1773
1760
|
} catch (errorArg) {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
? errorArg
|
|
1778
|
-
: new UpgradeWorkerCandidateDrainageError(
|
|
1779
|
-
'The controller upgrade launch failed and candidate drainage cannot be proven by the CLI.',
|
|
1780
|
-
errorArg,
|
|
1781
|
-
);
|
|
1782
|
-
}
|
|
1783
|
-
const transaction = await coordinator.readTransaction(payload.token);
|
|
1784
|
-
if (transaction.worker?.logFilePath) {
|
|
1785
|
-
worker = {
|
|
1786
|
-
pid: transaction.worker.pid,
|
|
1787
|
-
processGroupId: transaction.worker.processGroupId,
|
|
1788
|
-
fingerprint: transaction.worker.fingerprint,
|
|
1789
|
-
cliPath: transaction.worker.cliPath,
|
|
1790
|
-
logFilePath: transaction.worker.logFilePath,
|
|
1791
|
-
};
|
|
1792
|
-
} else {
|
|
1793
|
-
await coordinator.finishTransaction(
|
|
1794
|
-
payload.token,
|
|
1795
|
-
false,
|
|
1796
|
-
'The upgrade worker could not be launched.',
|
|
1797
|
-
errorArg instanceof Error ? errorArg.message : String(errorArg),
|
|
1798
|
-
);
|
|
1799
|
-
throw errorArg;
|
|
1800
|
-
}
|
|
1761
|
+
// A failed launch has released the lock with the failed transaction, or keeps both for a worker that may run.
|
|
1762
|
+
invocationLeaseHandled = true;
|
|
1763
|
+
throw errorArg;
|
|
1801
1764
|
}
|
|
1802
1765
|
try {
|
|
1803
1766
|
try {
|
|
@@ -548,7 +548,7 @@ export class ConfigurationAuthority {
|
|
|
548
548
|
const head = await this.requireResource(inputArg.resourceId);
|
|
549
549
|
const expected = inputArg.expectedRevision === null ? '' : assertRevision(inputArg.expectedRevision, 'Expected master revision');
|
|
550
550
|
if (head.masterRevision !== expected) throw new ConfigurationError('conflict', 'The master changed since this edit started; reload it.');
|
|
551
|
-
const serialized = serializeMaster(validateMaster(inputArg.master));
|
|
551
|
+
const serialized = serializeMaster(validateMaster(inputArg.master, { save: true }));
|
|
552
552
|
const revision = masterRevision(serialized);
|
|
553
553
|
if (revision === head.masterRevision) return { revision };
|
|
554
554
|
const { ConfigurationMasterModel: Master, ConfigurationHeadModel: Head } = this.modelSet;
|