@camstack/server 1.2.769 → 1.2.771
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 +12 -0
- package/dist/api/core/cap-providers.js +4 -193
- package/dist/api/trpc/generated-cap-routers.js +40 -30
- package/dist/core/addon/addon-registry.service.js +100 -65
- package/dist/core/addon/group-respawn-ledger.js +59 -0
- package/dist/core/addon/integration-visibility.js +0 -5
- package/dist/core/addon/runner-convergence.js +36 -0
- package/package.json +8 -17
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-C_rkCAus.mjs → agent-https-BGRPCKwT.mjs} +1 -1
- package/system/dist/{agent-https-Cw5Wc_ip.js → agent-https-mq6d71iq.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +17 -10
- package/system/dist/builtins/keychain/index.mjs +17 -10
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +3 -10
- package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +1 -11
- package/system/dist/builtins/sqlite-storage/integration-rows-ports.d.ts +13 -15
- package/system/dist/builtins/sqlite-storage/migrations/legacy-integration-rows-door.d.ts +31 -0
- package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +39 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +48 -5
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +48 -5
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-DXSWU1PY.js → capture-engine--FQ8NUHh.js} +1 -1
- package/system/dist/{capture-engine-Kl46lSBi.mjs → capture-engine-Cmx7DIzV.mjs} +1 -1
- package/system/dist/{composition-sources-ClCP809M.mjs → composition-sources-Bd09D5f4.mjs} +1 -1
- package/system/dist/{composition-sources-Cq0IeRv9.js → composition-sources-cvZAN87H.js} +1 -1
- package/system/dist/{constants-CDxTuuXp.mjs → constants-Dce28BAx.mjs} +1 -1
- package/system/dist/{constants-CI5ySMIj.js → constants-gM9xHjyj.js} +1 -1
- package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
- package/system/dist/{custom-action-registry-BIJZBObd.mjs → custom-action-registry-oHl1xltx.mjs} +37 -37
- package/system/dist/{device-ca-DPvU-3TE.js → device-ca-BmeH6Y9E.js} +1 -1
- package/system/dist/{device-ca-uRLJ8-jZ.mjs → device-ca-DcMuT-Yp.mjs} +1 -1
- package/system/dist/{dist-C_SNsYGY.mjs → dist-C3WXy3Ix.mjs} +78 -55
- package/system/dist/{dist-BDixk7cu.js → dist-Dtw1sIeQ.js} +78 -55
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-7uRbexmH.js → hub-mdns-ciao-C49eqyby.js} +2 -2
- package/system/dist/{hub-mdns-ciao-ea1EwFAF.mjs → hub-mdns-ciao-Dfue_0kR.mjs} +2 -2
- package/system/dist/index.d.ts +1 -1
- package/system/dist/index.js +42 -230
- package/system/dist/index.mjs +262 -450
- package/system/dist/legacy-integration-rows-door-B8_XCqUX.js +290 -0
- package/system/dist/legacy-integration-rows-door-DK42Bh2Q.mjs +255 -0
- package/system/dist/migrations/hub/2026-11-05-drop-integration-settings.d.ts +16 -0
- package/system/dist/{restore-archive-D0y_tFM2.mjs → restore-archive-C0YDO-qd.mjs} +94 -94
- package/system/dist/{restore-archive-CpTnlXUA.js → restore-archive-DuktQtye.js} +1 -1
- package/system/dist/{wal-maintenance-Dy4gxMdb.js → wal-maintenance-BEo-y-cQ.js} +0 -0
- package/system/dist/{wal-maintenance-BvxzVfje.mjs → wal-maintenance-DhuvKiGK.mjs} +0 -0
- package/system/package.json +1 -1
- package/dist/api/core/integration-secrets.js +0 -96
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.771] - 2026-11-05
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Updating one addon in a shared runner no longer skips the restart when another member of that runner was restarted moments earlier, so the new code actually loads.
|
|
15
|
+
|
|
16
|
+
## [1.2.770] - 2026-11-05
|
|
17
|
+
|
|
18
|
+
### Removed
|
|
19
|
+
|
|
20
|
+
- The hub no longer keeps a second settings store: create writes the instance record, and settings with no instance provider are dropped
|
|
21
|
+
|
|
10
22
|
## [1.2.769] - 2026-11-05
|
|
11
23
|
|
|
12
24
|
### Changed
|
|
@@ -72,7 +72,6 @@ exports.dispatchCustomAction = dispatchCustomAction;
|
|
|
72
72
|
exports.buildAddonsProvider = buildAddonsProvider;
|
|
73
73
|
const integration_role_js_1 = require("./integration-role.js");
|
|
74
74
|
const integration_instances_provider_js_1 = require("../../core/addon/integration-instances-provider.js");
|
|
75
|
-
const integration_secrets_1 = require("./integration-secrets");
|
|
76
75
|
const node_crypto_1 = require("node:crypto");
|
|
77
76
|
const os = __importStar(require("node:os"));
|
|
78
77
|
const system_1 = require("@camstack/server/system");
|
|
@@ -751,39 +750,6 @@ function buildNodesProvider(agentRegistry, moleculer, addonRegistry, getNodeRoot
|
|
|
751
750
|
},
|
|
752
751
|
};
|
|
753
752
|
}
|
|
754
|
-
/**
|
|
755
|
-
* The keychain handle a hub door uses for an integration's addon (D787), or
|
|
756
|
-
* `null` when this registry predates the keychain (a test double, an older
|
|
757
|
-
* kernel) — the door then stores the settings as it always did.
|
|
758
|
-
*/
|
|
759
|
-
function ownerSecrets(ar, owner) {
|
|
760
|
-
return typeof ar.secretsForOwner === 'function' ? ar.secretsForOwner(owner) : null;
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* The integration settings keys the addon's own form stores in the keychain
|
|
764
|
-
* (by schema type, D783) — so the admin read can withhold a plaintext under one
|
|
765
|
-
* of them. Empty when the schema cannot be read (logged): markers are still
|
|
766
|
-
* withheld, and a coerced marker is caught without a schema.
|
|
767
|
-
*/
|
|
768
|
-
async function integrationSecretKeys(ar, addonId, logger) {
|
|
769
|
-
try {
|
|
770
|
-
const provider = ar
|
|
771
|
-
.getCapabilityRegistry()
|
|
772
|
-
.getSingleton('addon-settings');
|
|
773
|
-
const schema = await provider?.getGlobalSettings({
|
|
774
|
-
addonId,
|
|
775
|
-
nodeId: 'hub',
|
|
776
|
-
});
|
|
777
|
-
return (0, types_1.collectKeychainStoredKeys)(schema ?? null);
|
|
778
|
-
}
|
|
779
|
-
catch (err) {
|
|
780
|
-
logger.warn('integration settings: addon schema unreadable — plaintext secrets not detectable', {
|
|
781
|
-
tags: { addonId },
|
|
782
|
-
meta: { phase: 'getSettings', error: (0, types_1.errMsg)(err) },
|
|
783
|
-
});
|
|
784
|
-
return new Set();
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
753
|
function requireIntegrationRegistry(ar) {
|
|
788
754
|
const reg = ar.getIntegrationRegistry();
|
|
789
755
|
if (!reg)
|
|
@@ -1027,9 +993,7 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1027
993
|
},
|
|
1028
994
|
getByAddonId: async (input) => requireIntegrationRegistry(ar).getIntegrationByAddonId(input.addonId),
|
|
1029
995
|
create: async (input) => {
|
|
1030
|
-
const {
|
|
1031
|
-
// Settings are written AFTER the row exists: a secret's ref is scoped
|
|
1032
|
-
// to the integration id (D787).
|
|
996
|
+
const { settings, ...rest } = input;
|
|
1033
997
|
const payload = rest;
|
|
1034
998
|
const reg = requireIntegrationRegistry(ar);
|
|
1035
999
|
logger.info('request', {
|
|
@@ -1143,40 +1107,15 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1143
1107
|
return integration;
|
|
1144
1108
|
}
|
|
1145
1109
|
if (settings !== undefined && Object.keys(settings).length > 0) {
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
onOrphaned: (refs) => logger.warn('dropped keychain refs could not be deleted', {
|
|
1150
|
-
meta: { refs: [...refs] },
|
|
1151
|
-
}),
|
|
1152
|
-
}, {
|
|
1153
|
-
integrationId: integration.id,
|
|
1154
|
-
settings,
|
|
1155
|
-
secretKeys: secretKeys ?? [],
|
|
1156
|
-
operatorWrite: true,
|
|
1110
|
+
logger.warn('settings dropped — the addon has no instance record to store them', {
|
|
1111
|
+
tags: { integrationId: integration.id, addonId: integration.addonId },
|
|
1112
|
+
meta: { phase: 'create', keys: Object.keys(settings) },
|
|
1157
1113
|
});
|
|
1158
1114
|
}
|
|
1159
1115
|
logger.info('persisted', {
|
|
1160
1116
|
tags: { integrationId: integration.id, addonId: integration.addonId },
|
|
1161
1117
|
meta: { phase: 'create' },
|
|
1162
1118
|
});
|
|
1163
|
-
const hasSettings = settings != null && Object.keys(settings).length > 0;
|
|
1164
|
-
if (!skipRestart && hasSettings) {
|
|
1165
|
-
logger.info('settings present — restarting addon', {
|
|
1166
|
-
tags: { addonId: input.addonId },
|
|
1167
|
-
meta: { phase: 'create' },
|
|
1168
|
-
});
|
|
1169
|
-
await ar.restartAddon(input.addonId);
|
|
1170
|
-
logger.info('addon restart complete', {
|
|
1171
|
-
tags: { addonId: input.addonId },
|
|
1172
|
-
meta: { phase: 'create' },
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
else {
|
|
1176
|
-
logger.info('skipping restart (no settings or skipRestart=true)', {
|
|
1177
|
-
meta: { phase: 'create' },
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
1119
|
return integration;
|
|
1181
1120
|
},
|
|
1182
1121
|
update: async (input) => {
|
|
@@ -1363,134 +1302,6 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1363
1302
|
});
|
|
1364
1303
|
return { success: true, deletedId: input.id };
|
|
1365
1304
|
},
|
|
1366
|
-
getSettings: async (input) => {
|
|
1367
|
-
const reg = requireIntegrationRegistry(ar);
|
|
1368
|
-
const integration = await reg.getIntegration(input.id);
|
|
1369
|
-
if (!integration)
|
|
1370
|
-
throw new Error(`Integration "${input.id}" not found`);
|
|
1371
|
-
const instances = getInstancesProvider(ar, integration.addonId);
|
|
1372
|
-
if (instances !== null) {
|
|
1373
|
-
const instance = await instances.getInstance({ id: input.id });
|
|
1374
|
-
if (instance !== null && instance !== undefined)
|
|
1375
|
-
return instance.formValues;
|
|
1376
|
-
// No instance record carries this id: it is a legacy row the addon has not moved yet
|
|
1377
|
-
// (its migration reads it here), so answer the row, never an empty object (D1007).
|
|
1378
|
-
}
|
|
1379
|
-
// The integration's own addon (the caller the transport stamped) reads
|
|
1380
|
-
// its secrets resolved; anyone else — the admin form — reads "set"
|
|
1381
|
-
// views, never a value (D787, D789).
|
|
1382
|
-
const caller = Reflect.get(input, 'callerAddonId');
|
|
1383
|
-
const forOwner = typeof caller === 'string' &&
|
|
1384
|
-
(caller === integration.addonId || ar.runnerIdFor(integration.addonId) === caller);
|
|
1385
|
-
// The schema is asked only for the admin read: the owner reads this at
|
|
1386
|
-
// its own boot, and asking it for its schema then would call back into it.
|
|
1387
|
-
const secretKeys = forOwner
|
|
1388
|
-
? undefined
|
|
1389
|
-
: await integrationSecretKeys(ar, integration.addonId, logger);
|
|
1390
|
-
return (0, integration_secrets_1.readIntegrationSettings)({
|
|
1391
|
-
registry: reg,
|
|
1392
|
-
secrets: forOwner ? ownerSecrets(ar, integration.addonId) : null,
|
|
1393
|
-
}, {
|
|
1394
|
-
integrationId: input.id,
|
|
1395
|
-
forOwner,
|
|
1396
|
-
...(secretKeys !== undefined ? { secretKeys } : {}),
|
|
1397
|
-
onSuspectSecret: (suspect) => logger.error(suspect.kind === 'coerced-marker'
|
|
1398
|
-
? 'integration secret is "[object Object]" — a keychain marker was coerced to text; the addon is sending it as the credential; re-type it'
|
|
1399
|
-
: 'integration secret stored as PLAINTEXT under a keychain-declared key — withheld from the form; re-type it to move it into the keychain', {
|
|
1400
|
-
tags: { integrationId: input.id, addonId: integration.addonId },
|
|
1401
|
-
meta: {
|
|
1402
|
-
phase: 'getSettings',
|
|
1403
|
-
key: suspect.key,
|
|
1404
|
-
kind: suspect.kind,
|
|
1405
|
-
forOwner,
|
|
1406
|
-
},
|
|
1407
|
-
}),
|
|
1408
|
-
});
|
|
1409
|
-
},
|
|
1410
|
-
setSettings: async (input) => {
|
|
1411
|
-
const reg = requireIntegrationRegistry(ar);
|
|
1412
|
-
const integration = await reg.getIntegration(input.id);
|
|
1413
|
-
if (!integration) {
|
|
1414
|
-
logger.warn('not found', {
|
|
1415
|
-
tags: { integrationId: input.id },
|
|
1416
|
-
meta: { phase: 'setSettings' },
|
|
1417
|
-
});
|
|
1418
|
-
throw new Error(`Integration "${input.id}" not found`);
|
|
1419
|
-
}
|
|
1420
|
-
const settingsKeys = Object.keys(input.settings);
|
|
1421
|
-
logger.info('request', {
|
|
1422
|
-
tags: { integrationId: input.id, addonId: integration.addonId },
|
|
1423
|
-
meta: { phase: 'setSettings', keys: settingsKeys },
|
|
1424
|
-
});
|
|
1425
|
-
const instances = getInstancesProvider(ar, integration.addonId);
|
|
1426
|
-
if (instances !== null) {
|
|
1427
|
-
// The addon re-applies the change itself (its `onChanged`): no respawn.
|
|
1428
|
-
await instances.updateInstance({
|
|
1429
|
-
id: input.id,
|
|
1430
|
-
values: input.settings,
|
|
1431
|
-
});
|
|
1432
|
-
logger.info('persisted as an instance record (no restart)', {
|
|
1433
|
-
tags: { integrationId: input.id, addonId: integration.addonId },
|
|
1434
|
-
meta: { phase: 'setSettings' },
|
|
1435
|
-
});
|
|
1436
|
-
return { success: true };
|
|
1437
|
-
}
|
|
1438
|
-
await (0, integration_secrets_1.writeIntegrationSettings)({
|
|
1439
|
-
registry: reg,
|
|
1440
|
-
secrets: ownerSecrets(ar, integration.addonId),
|
|
1441
|
-
onOrphaned: (refs) => logger.warn('dropped keychain refs could not be deleted', {
|
|
1442
|
-
meta: { refs: [...refs] },
|
|
1443
|
-
}),
|
|
1444
|
-
}, {
|
|
1445
|
-
integrationId: input.id,
|
|
1446
|
-
settings: input.settings,
|
|
1447
|
-
secretKeys: input.secretKeys ?? [],
|
|
1448
|
-
// The integration's own addon writing back is not the operator.
|
|
1449
|
-
operatorWrite: typeof Reflect.get(input, 'callerAddonId') !== 'string',
|
|
1450
|
-
});
|
|
1451
|
-
// Only the integration's own addon may skip the respawn: it reconciles
|
|
1452
|
-
// the change in-process, so an unrelated caller cannot leave an addon
|
|
1453
|
-
// running on settings it never reloaded.
|
|
1454
|
-
const callerAddon = Reflect.get(input, 'callerAddonId');
|
|
1455
|
-
if (input.skipRestart === true &&
|
|
1456
|
-
typeof callerAddon === 'string' &&
|
|
1457
|
-
(callerAddon === integration.addonId || ar.runnerIdFor(integration.addonId) === callerAddon)) {
|
|
1458
|
-
logger.info('persisted — the owner applies it in-process, no restart', {
|
|
1459
|
-
tags: { addonId: integration.addonId },
|
|
1460
|
-
meta: { phase: 'setSettings' },
|
|
1461
|
-
});
|
|
1462
|
-
return { success: true };
|
|
1463
|
-
}
|
|
1464
|
-
logger.info('persisted — restarting addon', {
|
|
1465
|
-
tags: { addonId: integration.addonId },
|
|
1466
|
-
meta: { phase: 'setSettings' },
|
|
1467
|
-
});
|
|
1468
|
-
await ar.restartAddon(integration.addonId);
|
|
1469
|
-
logger.info('addon restart complete', {
|
|
1470
|
-
tags: { addonId: integration.addonId },
|
|
1471
|
-
meta: { phase: 'setSettings' },
|
|
1472
|
-
});
|
|
1473
|
-
return { success: true };
|
|
1474
|
-
},
|
|
1475
|
-
clearSettings: async (input) => {
|
|
1476
|
-
const reg = requireIntegrationRegistry(ar);
|
|
1477
|
-
const integration = await reg.getIntegration(input.id);
|
|
1478
|
-
if (!integration)
|
|
1479
|
-
throw new Error(`Integration "${input.id}" not found`);
|
|
1480
|
-
// Only the integration's own addon clears its rows, after it moved them (D1007).
|
|
1481
|
-
const caller = Reflect.get(input, 'callerAddonId');
|
|
1482
|
-
const isOwner = typeof caller === 'string' &&
|
|
1483
|
-
(caller === integration.addonId || ar.runnerIdFor(integration.addonId) === caller);
|
|
1484
|
-
if (!isOwner) {
|
|
1485
|
-
throw new Error(`Integration "${input.id}" settings can be cleared only by its own addon (${integration.addonId})`);
|
|
1486
|
-
}
|
|
1487
|
-
const cleared = await (0, system_1.clearIntegrationRows)({ registry: reg, secrets: ownerSecrets(ar, integration.addonId) }, input.id);
|
|
1488
|
-
logger.info('legacy settings cleared', {
|
|
1489
|
-
tags: { integrationId: input.id, addonId: integration.addonId },
|
|
1490
|
-
meta: { phase: 'clearSettings', ...cleared },
|
|
1491
|
-
});
|
|
1492
|
-
return cleared;
|
|
1493
|
-
},
|
|
1494
1305
|
getAvailableTypes: async () => {
|
|
1495
1306
|
const reg = requireIntegrationRegistry(ar);
|
|
1496
1307
|
const addons = ar.listAddons();
|
|
@@ -5576,36 +5576,6 @@ function createCapRouter_integrations(getProvider, createRemoteProxy) {
|
|
|
5576
5576
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
5577
5577
|
return p.delete(methodInput);
|
|
5578
5578
|
}),
|
|
5579
|
-
getSettings: trpc_middleware_js_1.adminProcedure
|
|
5580
|
-
.input(types_72.integrationsCapability.methods.getSettings.input.loose())
|
|
5581
|
-
.output(types_72.integrationsCapability.methods.getSettings.output)
|
|
5582
|
-
.query(async ({ input, ctx }) => {
|
|
5583
|
-
const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
|
|
5584
|
-
const { nodeId, ...methodInput } = parsedInput;
|
|
5585
|
-
const p = resolveProvider('integrations', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
5586
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
5587
|
-
return p.getSettings(methodInput);
|
|
5588
|
-
}),
|
|
5589
|
-
setSettings: trpc_middleware_js_1.adminProcedure
|
|
5590
|
-
.input(types_72.integrationsCapability.methods.setSettings.input.loose())
|
|
5591
|
-
.output(types_72.integrationsCapability.methods.setSettings.output)
|
|
5592
|
-
.mutation(async ({ input, ctx }) => {
|
|
5593
|
-
const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
|
|
5594
|
-
const { nodeId, ...methodInput } = parsedInput;
|
|
5595
|
-
const p = resolveProvider('integrations', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
5596
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
5597
|
-
return p.setSettings(methodInput);
|
|
5598
|
-
}),
|
|
5599
|
-
clearSettings: trpc_middleware_js_1.adminProcedure
|
|
5600
|
-
.input(types_72.integrationsCapability.methods.clearSettings.input.loose())
|
|
5601
|
-
.output(types_72.integrationsCapability.methods.clearSettings.output)
|
|
5602
|
-
.mutation(async ({ input, ctx }) => {
|
|
5603
|
-
const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
|
|
5604
|
-
const { nodeId, ...methodInput } = parsedInput;
|
|
5605
|
-
const p = resolveProvider('integrations', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
5606
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
5607
|
-
return p.clearSettings(methodInput);
|
|
5608
|
-
}),
|
|
5609
5579
|
getAvailableTypes: trpc_middleware_js_1.adminProcedure
|
|
5610
5580
|
.input(zod_1.z.object({ nodeId: zod_1.z.string().optional() }).optional())
|
|
5611
5581
|
.output(types_72.integrationsCapability.methods.getAvailableTypes.output)
|
|
@@ -6997,6 +6967,46 @@ function createCapRouter_migrations(getProvider, createRemoteProxy) {
|
|
|
6997
6967
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
6998
6968
|
return p.finishMigration(methodInput);
|
|
6999
6969
|
}),
|
|
6970
|
+
readLegacyIntegrationRows: trpc_middleware_js_1.adminProcedure
|
|
6971
|
+
.input(types_89.migrationsCapability.methods.readLegacyIntegrationRows.input.loose())
|
|
6972
|
+
.output(types_89.migrationsCapability.methods.readLegacyIntegrationRows.output)
|
|
6973
|
+
.query(async ({ input, ctx }) => {
|
|
6974
|
+
const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
|
|
6975
|
+
const { nodeId, ...methodInput } = parsedInput;
|
|
6976
|
+
const p = resolveProvider('migrations', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
6977
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
6978
|
+
return p.readLegacyIntegrationRows(methodInput);
|
|
6979
|
+
}),
|
|
6980
|
+
clearLegacyIntegrationRows: trpc_middleware_js_1.adminProcedure
|
|
6981
|
+
.input(types_89.migrationsCapability.methods.clearLegacyIntegrationRows.input.loose())
|
|
6982
|
+
.output(types_89.migrationsCapability.methods.clearLegacyIntegrationRows.output)
|
|
6983
|
+
.mutation(async ({ input, ctx }) => {
|
|
6984
|
+
const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
|
|
6985
|
+
const { nodeId, ...methodInput } = parsedInput;
|
|
6986
|
+
const p = resolveProvider('migrations', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
6987
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
6988
|
+
return p.clearLegacyIntegrationRows(methodInput);
|
|
6989
|
+
}),
|
|
6990
|
+
patchLegacyIntegrationRows: trpc_middleware_js_1.adminProcedure
|
|
6991
|
+
.input(types_89.migrationsCapability.methods.patchLegacyIntegrationRows.input.loose())
|
|
6992
|
+
.output(types_89.migrationsCapability.methods.patchLegacyIntegrationRows.output)
|
|
6993
|
+
.mutation(async ({ input, ctx }) => {
|
|
6994
|
+
const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
|
|
6995
|
+
const { nodeId, ...methodInput } = parsedInput;
|
|
6996
|
+
const p = resolveProvider('migrations', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
6997
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
6998
|
+
return p.patchLegacyIntegrationRows(methodInput);
|
|
6999
|
+
}),
|
|
7000
|
+
deleteLegacyIntegrationRowKeys: trpc_middleware_js_1.adminProcedure
|
|
7001
|
+
.input(types_89.migrationsCapability.methods.deleteLegacyIntegrationRowKeys.input.loose())
|
|
7002
|
+
.output(types_89.migrationsCapability.methods.deleteLegacyIntegrationRowKeys.output)
|
|
7003
|
+
.mutation(async ({ input, ctx }) => {
|
|
7004
|
+
const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
|
|
7005
|
+
const { nodeId, ...methodInput } = parsedInput;
|
|
7006
|
+
const p = resolveProvider('migrations', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
7007
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
7008
|
+
return p.deleteLegacyIntegrationRowKeys(methodInput);
|
|
7009
|
+
}),
|
|
7000
7010
|
});
|
|
7001
7011
|
}
|
|
7002
7012
|
function createCapRouter_modelConvert(getProvider, createRemoteProxy) {
|
|
@@ -60,6 +60,7 @@ const materialize_route_path_js_1 = require("./materialize-route-path.js");
|
|
|
60
60
|
const package_dir_utils_1 = require("./package-dir-utils");
|
|
61
61
|
const legacy_package_names_1 = require("../../legacy-package-names");
|
|
62
62
|
const prune_misplaced_addons_js_1 = require("./prune-misplaced-addons.js");
|
|
63
|
+
const group_respawn_ledger_1 = require("./group-respawn-ledger");
|
|
63
64
|
const runner_convergence_1 = require("./runner-convergence");
|
|
64
65
|
const runner_serialization_1 = require("./runner-serialization");
|
|
65
66
|
const runner_spawn_fanout_js_1 = require("./runner-spawn-fanout.js");
|
|
@@ -135,15 +136,6 @@ function isSettingsStore(backend) {
|
|
|
135
136
|
function isAddonRoutesInvoker(provider) {
|
|
136
137
|
return typeof Reflect.get(provider, 'invoke') === 'function';
|
|
137
138
|
}
|
|
138
|
-
/**
|
|
139
|
-
* Window within which a second `restart:true` respawn of the SAME group runner
|
|
140
|
-
* is coalesced to a no-op (a package reload loops `restartAddon` over every
|
|
141
|
-
* group member — see `recentGroupRespawns`). Chosen comfortably longer than a
|
|
142
|
-
* single group respawn (child fork + init) so all members of one reload pass
|
|
143
|
-
* fall inside it, and short enough that a genuinely independent later restart
|
|
144
|
-
* still respawns.
|
|
145
|
-
*/
|
|
146
|
-
const GROUP_RESPAWN_COALESCE_MS = 10_000;
|
|
147
139
|
const ROUTE_METHODS = [
|
|
148
140
|
'GET',
|
|
149
141
|
'POST',
|
|
@@ -322,16 +314,12 @@ class AddonRegistryService {
|
|
|
322
314
|
*/
|
|
323
315
|
restartingAddons = new Map();
|
|
324
316
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* group (all members reboot from fresh on-disk code), so the 2nd..Nth
|
|
330
|
-
* restarts must NOT respawn again — that churns the runner N times and risks
|
|
331
|
-
* tripping the crash circuit-breaker. Consulted by `ensureForkedRunner`; only
|
|
332
|
-
* groups (roster > 1) are coalesced, so solo-addon restart stays byte-identical.
|
|
317
|
+
* Group-runner restart claims. A fork covers only requests that had already
|
|
318
|
+
* been made when it started, so a second member swapped while — or just
|
|
319
|
+
* after — a sibling's respawn still gets a process that loaded its code.
|
|
320
|
+
* Solo runners never enter the ledger (their restart stays one fork).
|
|
333
321
|
*/
|
|
334
|
-
|
|
322
|
+
groupRespawns = (0, group_respawn_ledger_1.createGroupRespawnLedger)();
|
|
335
323
|
logger;
|
|
336
324
|
addonLoader;
|
|
337
325
|
healthMonitor;
|
|
@@ -1491,17 +1479,23 @@ class AddonRegistryService {
|
|
|
1491
1479
|
// InferenceCapabilitiesService removed — now lives in pipeline-executor addon.
|
|
1492
1480
|
// Use capabilityRegistry.getSingleton('pipeline-executor') instead.
|
|
1493
1481
|
/** Log a standardized lifecycle line for addon start/restart */
|
|
1494
|
-
logAddonLifecycle(event, id, mode) {
|
|
1482
|
+
logAddonLifecycle(event, id, mode, pids) {
|
|
1495
1483
|
const entry = this.addonEntries.get(id);
|
|
1496
1484
|
if (!entry)
|
|
1497
1485
|
return;
|
|
1498
1486
|
const agentName = process.env.CAMSTACK_AGENT_NAME ?? 'hub';
|
|
1499
1487
|
const platform = `${os.platform()}/${os.arch()}`;
|
|
1500
|
-
const
|
|
1488
|
+
const runnerPid = pids !== undefined && pids.pidAfter !== null
|
|
1489
|
+
? `, runner pid ${pids.pidBefore ?? 'none'} -> ${pids.pidAfter}`
|
|
1490
|
+
: '';
|
|
1491
|
+
const message = `Addon ${event} — v${entry.packageVersion} (${entry.packageName}), ${mode}, ${platform}, agent: ${agentName}${runnerPid}`;
|
|
1501
1492
|
// Log under AddonRegistry scope
|
|
1502
1493
|
this.logger.info(message, {
|
|
1503
1494
|
tags: { addonId: id, agentId: agentName },
|
|
1504
|
-
meta: {
|
|
1495
|
+
meta: {
|
|
1496
|
+
phase: 'lifecycle',
|
|
1497
|
+
...(pids !== undefined ? { pidBefore: pids.pidBefore, pidAfter: pids.pidAfter } : {}),
|
|
1498
|
+
},
|
|
1505
1499
|
});
|
|
1506
1500
|
// Also log under the addon's own tagged logger so it appears in the per-addon
|
|
1507
1501
|
// log viewer. No scope — brand bracket shows the addon id.
|
|
@@ -1951,7 +1945,23 @@ class AddonRegistryService {
|
|
|
1951
1945
|
const preRegistered = new Set(entry.declaredCapabilities
|
|
1952
1946
|
.map((cap) => cap.name)
|
|
1953
1947
|
.filter((name) => this.capabilityRegistry.getProviderByAddon(name, addonId) != null));
|
|
1954
|
-
await this.ensureForkedRunner(addonId, { restart: true });
|
|
1948
|
+
const outcome = await this.ensureForkedRunner(addonId, { restart: true });
|
|
1949
|
+
// `Addon restarted — vX` is a claim that a process with that version
|
|
1950
|
+
// is up. The registry row's version was refreshed from disk before
|
|
1951
|
+
// this call, so the line is true only when the runner pid changed
|
|
1952
|
+
// (the new child loads disk at fork). A coalesced no-op used to log
|
|
1953
|
+
// the new version against the previous pid.
|
|
1954
|
+
if (!outcome.live) {
|
|
1955
|
+
this.logger.warn('Addon restart did not start a runner process with the swapped code', {
|
|
1956
|
+
tags: { addonId },
|
|
1957
|
+
meta: {
|
|
1958
|
+
pidBefore: outcome.pidBefore,
|
|
1959
|
+
pidAfter: outcome.pidAfter,
|
|
1960
|
+
version: entry.packageVersion,
|
|
1961
|
+
},
|
|
1962
|
+
});
|
|
1963
|
+
return { success: false, error: 'runner process did not change' };
|
|
1964
|
+
}
|
|
1955
1965
|
// The respawn resolves as soon as the child is up, not when its
|
|
1956
1966
|
// capabilities are re-registered. Callers (integrations.create, UI forms) may
|
|
1957
1967
|
// immediately try to route to the provider and hit a transient null. Block here
|
|
@@ -2008,7 +2018,7 @@ class AddonRegistryService {
|
|
|
2008
2018
|
// every roster member (custom actions live in the hub-side
|
|
2009
2019
|
// `CustomActionRegistry`, which the process spawn never touches — a
|
|
2010
2020
|
// hot-update would otherwise silently drop them).
|
|
2011
|
-
this.logAddonLifecycle('restarted', addonId, 'isolated');
|
|
2021
|
+
this.logAddonLifecycle('restarted', addonId, 'isolated', outcome);
|
|
2012
2022
|
this.emitAddonLifecycleEvent('addon.restarted', addonId);
|
|
2013
2023
|
return { success: true };
|
|
2014
2024
|
}
|
|
@@ -3460,17 +3470,23 @@ class AddonRegistryService {
|
|
|
3460
3470
|
}
|
|
3461
3471
|
/**
|
|
3462
3472
|
* Snapshot of the live runner subprocesses (`$process.list`), reduced to the
|
|
3463
|
-
* `{ runnerId, addonIds }` shape the convergence planner
|
|
3464
|
-
* on any broker error so the caller
|
|
3465
|
-
* throwing — a missing list can only
|
|
3473
|
+
* `{ runnerId, addonIds, pid }` shape the convergence planner and the
|
|
3474
|
+
* lifecycle log need. Returns `[]` on any broker error so the caller
|
|
3475
|
+
* degrades to a fresh spawn rather than throwing — a missing list can only
|
|
3476
|
+
* mean "nothing is running".
|
|
3466
3477
|
*/
|
|
3467
3478
|
async listRunnerProcesses() {
|
|
3468
3479
|
try {
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
const
|
|
3473
|
-
|
|
3480
|
+
const raw = await this.broker.call('$process.list');
|
|
3481
|
+
if (!Array.isArray(raw))
|
|
3482
|
+
return [];
|
|
3483
|
+
const rows = [];
|
|
3484
|
+
for (const item of raw) {
|
|
3485
|
+
const row = (0, runner_convergence_1.parseListedRunner)(item);
|
|
3486
|
+
if (row)
|
|
3487
|
+
rows.push(row);
|
|
3488
|
+
}
|
|
3489
|
+
return rows;
|
|
3474
3490
|
}
|
|
3475
3491
|
catch {
|
|
3476
3492
|
return [];
|
|
@@ -3488,16 +3504,15 @@ class AddonRegistryService {
|
|
|
3488
3504
|
* via `buildAddonGroupPlan` (the same authority the boot plan uses), then
|
|
3489
3505
|
* converges the live process topology onto that roster (see
|
|
3490
3506
|
* `planRunnerConvergence`): stop stale/mismatched runners, then spawn or
|
|
3491
|
-
* restart the group runner.
|
|
3492
|
-
*
|
|
3493
|
-
*
|
|
3494
|
-
* byte-identical to the pre-group solo path.
|
|
3507
|
+
* restart the group runner. A groupless addon keys to a size-1 roster whose
|
|
3508
|
+
* runner id is its own id, so its behaviour is byte-identical to the
|
|
3509
|
+
* pre-group solo path.
|
|
3495
3510
|
*
|
|
3496
|
-
* `opts.restart` respawns
|
|
3497
|
-
*
|
|
3498
|
-
*
|
|
3499
|
-
* a
|
|
3500
|
-
*
|
|
3511
|
+
* `opts.restart` respawns even when the roster already matches, so the child
|
|
3512
|
+
* loads the on-disk bundle (D5 — no in-process reload). A second member of
|
|
3513
|
+
* the same group shares that fork only when the fork starts AFTER its
|
|
3514
|
+
* request; a fork already in flight, or one that already finished, does not
|
|
3515
|
+
* — the second swap may have landed since. Solo addons always fork.
|
|
3501
3516
|
*/
|
|
3502
3517
|
/**
|
|
3503
3518
|
* One converge at a time per runner. See `runner-serialization.ts` for the
|
|
@@ -3514,26 +3529,20 @@ class AddonRegistryService {
|
|
|
3514
3529
|
const roster = this.buildAddonGroupPlan([...this.addonEntries.keys()]).get(runnerId) ?? [
|
|
3515
3530
|
{ addonId, addonDir: entry.addonDir },
|
|
3516
3531
|
];
|
|
3517
|
-
//
|
|
3518
|
-
//
|
|
3519
|
-
//
|
|
3520
|
-
|
|
3521
|
-
// coalesce window, downgrade a restart request to a plain topology check so
|
|
3522
|
-
// the 2nd..Nth members don't churn the runner. Solo addons (roster == 1) are
|
|
3523
|
-
// never coalesced — their behaviour stays byte-identical.
|
|
3524
|
-
const effectiveRestart = opts.restart &&
|
|
3525
|
-
roster.length > 1 &&
|
|
3526
|
-
Date.now() - (this.recentGroupRespawns.get(runnerId) ?? 0) < GROUP_RESPAWN_COALESCE_MS
|
|
3527
|
-
? false
|
|
3528
|
-
: opts.restart;
|
|
3532
|
+
// Claim before the queue so a member that arrives while this one is
|
|
3533
|
+
// waiting is visible to the fork that has not started yet. Solo runners
|
|
3534
|
+
// (roster of one) never claim — each of their restarts forks.
|
|
3535
|
+
const epoch = opts.restart && roster.length > 1 ? this.groupRespawns.claim(runnerId) : 0;
|
|
3529
3536
|
// EVERYTHING from here is one atomic unit per runner. The read decides what
|
|
3530
3537
|
// to stop and what to spawn, so a second converge that reads before this
|
|
3531
3538
|
// one has spawned decides to spawn too — and the child nobody tracks keeps
|
|
3532
3539
|
// running. `process-service`'s own lock cannot see this: it makes each
|
|
3533
3540
|
// action atomic, and the unit that matters is the sequence.
|
|
3534
3541
|
return this.serializeRunner(runnerId, async () => {
|
|
3542
|
+
const covered = epoch > 0 && this.groupRespawns.covered(runnerId, epoch);
|
|
3535
3543
|
const running = await this.listRunnerProcesses();
|
|
3536
|
-
const
|
|
3544
|
+
const pidBefore = running.find((row) => row.name === runnerId)?.pid ?? null;
|
|
3545
|
+
const plan = (0, runner_convergence_1.planRunnerConvergence)(runnerId, roster.map((r) => r.addonId), running, { restart: opts.restart && !covered });
|
|
3537
3546
|
// 1. Tear down every stale/mismatched runner that hosts a roster member.
|
|
3538
3547
|
for (const name of plan.stop) {
|
|
3539
3548
|
await this.broker.call('$process.stop', { name }).catch((err) => {
|
|
@@ -3542,24 +3551,24 @@ class AddonRegistryService {
|
|
|
3542
3551
|
});
|
|
3543
3552
|
});
|
|
3544
3553
|
}
|
|
3545
|
-
// 2. Bring the target runner to the correct roster.
|
|
3554
|
+
// 2. Bring the target runner to the correct roster. The cover snapshot
|
|
3555
|
+
// is the last synchronous read before the fork, so a swap that lands
|
|
3556
|
+
// while the child is starting is NOT credited to this process.
|
|
3557
|
+
let pidAfter = pidBefore;
|
|
3546
3558
|
if (plan.action === 'spawn') {
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
// A concurrent path may have won the spawn race — treat "already
|
|
3551
|
-
// running" as success (idempotent), rethrow anything else.
|
|
3552
|
-
if (!/already running/i.test((0, types_2.errMsg)(err)))
|
|
3553
|
-
throw err;
|
|
3554
|
-
});
|
|
3555
|
-
this.recentGroupRespawns.set(runnerId, Date.now());
|
|
3559
|
+
const coverThrough = epoch > 0 ? this.groupRespawns.coverThrough(runnerId) : 0;
|
|
3560
|
+
pidAfter = await this.spawnGroupRunner(runnerId, roster, pidBefore);
|
|
3561
|
+
this.noteGroupFork(epoch, runnerId, coverThrough, pidBefore, pidAfter);
|
|
3556
3562
|
}
|
|
3557
3563
|
else if (plan.action === 'restart') {
|
|
3558
|
-
const
|
|
3564
|
+
const coverThrough = epoch > 0 ? this.groupRespawns.coverThrough(runnerId) : 0;
|
|
3565
|
+
const raw = await this.broker.call('$process.restart', { name: runnerId });
|
|
3566
|
+
const res = (0, runner_convergence_1.readRestartReply)(raw);
|
|
3559
3567
|
if (!res.success) {
|
|
3560
3568
|
throw new Error(`Process restart failed: ${res.reason ?? 'unknown'}`);
|
|
3561
3569
|
}
|
|
3562
|
-
|
|
3570
|
+
pidAfter = res.pid;
|
|
3571
|
+
this.noteGroupFork(epoch, runnerId, coverThrough, pidBefore, pidAfter);
|
|
3563
3572
|
}
|
|
3564
3573
|
// 3. Bookkeeping for EVERY roster member. Mark each member initialized so
|
|
3565
3574
|
// the in-process core-builtin boot passes skip them. The custom-action
|
|
@@ -3571,8 +3580,34 @@ class AddonRegistryService {
|
|
|
3571
3580
|
if (memberEntry)
|
|
3572
3581
|
memberEntry.initialized = true;
|
|
3573
3582
|
}
|
|
3583
|
+
if (plan.action === 'none' && covered) {
|
|
3584
|
+
const remembered = this.groupRespawns.pids(runnerId);
|
|
3585
|
+
return (0, group_respawn_ledger_1.forkedRunnerOutcome)(remembered.pidBefore, remembered.pidAfter);
|
|
3586
|
+
}
|
|
3587
|
+
return (0, group_respawn_ledger_1.forkedRunnerOutcome)(pidBefore, pidAfter);
|
|
3574
3588
|
});
|
|
3575
3589
|
}
|
|
3590
|
+
// Spawn the roster. A lost race ("already running") is the pid already up.
|
|
3591
|
+
async spawnGroupRunner(runnerId, roster, pidBefore) {
|
|
3592
|
+
try {
|
|
3593
|
+
const spawned = await this.broker.call('$process.spawnRunner', {
|
|
3594
|
+
runnerId,
|
|
3595
|
+
addons: roster,
|
|
3596
|
+
});
|
|
3597
|
+
return (0, runner_convergence_1.readProcessPid)(spawned);
|
|
3598
|
+
}
|
|
3599
|
+
catch (err) {
|
|
3600
|
+
if (!/already running/i.test((0, types_2.errMsg)(err)))
|
|
3601
|
+
throw err;
|
|
3602
|
+
const running = await this.listRunnerProcesses();
|
|
3603
|
+
return running.find((row) => row.name === runnerId)?.pid ?? pidBefore;
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
noteGroupFork(epoch, runnerId, coverThrough, pidBefore, pidAfter) {
|
|
3607
|
+
if (epoch === 0)
|
|
3608
|
+
return;
|
|
3609
|
+
this.groupRespawns.markForked(runnerId, coverThrough, { pidBefore, pidAfter });
|
|
3610
|
+
}
|
|
3576
3611
|
/**
|
|
3577
3612
|
* Apply the custom-action catalogs a UDS child DESCRIBED in its register
|
|
3578
3613
|
* frame (`RegisteredChild.customActions`, schemas stripped) to the hub-wide
|