@camstack/addon-pipeline-orchestrator 1.2.708 → 1.2.709
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/_stub.js +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-C_9hNznz.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-Cy30Rzqj.mjs} +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DNSPEN-1.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CmdMWHWD.mjs +26 -0
- package/dist/{hostInit-_VWK1zem.mjs → hostInit-wjkPXHbU.mjs} +2 -2
- package/dist/index.js +369 -22
- package/dist/index.mjs +369 -22
- package/dist/remoteEntry.js +1 -1
- package/package.json +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DbE7FiOY.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-C0FbsQqI.mjs +0 -26
package/dist/index.mjs
CHANGED
|
@@ -6126,7 +6126,7 @@ var ZodIssueCode = {
|
|
|
6126
6126
|
var ZodFirstPartyTypeKind;
|
|
6127
6127
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6128
6128
|
//#endregion
|
|
6129
|
-
//#region ../types/dist/runtime-capabilities-
|
|
6129
|
+
//#region ../types/dist/runtime-capabilities-ql3VRzQu.mjs
|
|
6130
6130
|
/**
|
|
6131
6131
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6132
6132
|
* window to float samples (D455).
|
|
@@ -6221,6 +6221,57 @@ var AddonMigrationsBlockedError = class extends Error {
|
|
|
6221
6221
|
this.migrationIds = migrationIds;
|
|
6222
6222
|
}
|
|
6223
6223
|
};
|
|
6224
|
+
var SWITCHES = /* @__PURE__ */ new Map();
|
|
6225
|
+
/** The ids the registry is known to hold a row for (hydrated, or told by the hub). */
|
|
6226
|
+
var ROWS = /* @__PURE__ */ new Set();
|
|
6227
|
+
/** The owner addon of an id, learned from its rows and from the helper that serves it. */
|
|
6228
|
+
var OWNER_OF = /* @__PURE__ */ new Map();
|
|
6229
|
+
/** The addons whose registry read answered at least once. */
|
|
6230
|
+
var ANSWERED = /* @__PURE__ */ new Set();
|
|
6231
|
+
/** The addons whose boot has begun reading the registry: only they can be held back. */
|
|
6232
|
+
var HYDRATING = /* @__PURE__ */ new Set();
|
|
6233
|
+
/**
|
|
6234
|
+
* The addons that serve an instance kind and have not been answered by the registry yet. Scoped
|
|
6235
|
+
* per owner: one addon's failed read never turns off another addon's instances, and an addon that
|
|
6236
|
+
* serves no instance kind never enters it.
|
|
6237
|
+
*/
|
|
6238
|
+
var PENDING = /* @__PURE__ */ new Set();
|
|
6239
|
+
/**
|
|
6240
|
+
* An addon's boot is about to read the registry for its rows. From now on, until the registry
|
|
6241
|
+
* answers, its served instance kinds (already built or built later in its boot) fail closed. A
|
|
6242
|
+
* helper used with no addon boot around it (a spec, a tool) is never held back.
|
|
6243
|
+
*/
|
|
6244
|
+
function beginHydration(ownerId) {
|
|
6245
|
+
if (ANSWERED.has(ownerId)) return;
|
|
6246
|
+
HYDRATING.add(ownerId);
|
|
6247
|
+
if (KINDS.has(ownerId)) PENDING.add(ownerId);
|
|
6248
|
+
}
|
|
6249
|
+
/** Whether `ownerId` still waits for the registry to answer (it serves a kind and has no rows yet). */
|
|
6250
|
+
function isHydrationPending(ownerId) {
|
|
6251
|
+
return PENDING.has(ownerId);
|
|
6252
|
+
}
|
|
6253
|
+
/** Record what the hub told: the registry holds a row of `id` in this state. */
|
|
6254
|
+
function recordRegistrySwitch(id, enabled) {
|
|
6255
|
+
SWITCHES.set(id, enabled);
|
|
6256
|
+
ROWS.add(id);
|
|
6257
|
+
}
|
|
6258
|
+
/** Seed the store from the registry rows of `ownerId`; the registry answered, so the owner is known. */
|
|
6259
|
+
function hydrateInstanceSwitches(ownerId, rows) {
|
|
6260
|
+
ANSWERED.add(ownerId);
|
|
6261
|
+
for (const row of rows) {
|
|
6262
|
+
recordRegistrySwitch(row.id, row.enabled);
|
|
6263
|
+
OWNER_OF.set(row.id, ownerId);
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
/** The addon's boot has built every instance kind and read the registry: unknown ids now read on. */
|
|
6267
|
+
function settleHydration(ownerId) {
|
|
6268
|
+
PENDING.delete(ownerId);
|
|
6269
|
+
}
|
|
6270
|
+
var KINDS = /* @__PURE__ */ new Map();
|
|
6271
|
+
/** The instance kinds announced for `ownerId` so far. */
|
|
6272
|
+
function servedInstanceKindsOf(ownerId) {
|
|
6273
|
+
return [...KINDS.get(ownerId)?.values() ?? []];
|
|
6274
|
+
}
|
|
6224
6275
|
/** Is this field's stored value a credential? */
|
|
6225
6276
|
function isSecretConfigField(field) {
|
|
6226
6277
|
if (field.type === "password") return true;
|
|
@@ -6910,6 +6961,32 @@ function switchRecordsOverMigrationApi(api) {
|
|
|
6910
6961
|
};
|
|
6911
6962
|
} };
|
|
6912
6963
|
}
|
|
6964
|
+
/** The record calls the body-to-registry switch migration makes, over the migration API. */
|
|
6965
|
+
function bodySwitchRecordsOverMigrationApi(api) {
|
|
6966
|
+
return { kind: (definition) => {
|
|
6967
|
+
const handle = api.records.kind(definition);
|
|
6968
|
+
return {
|
|
6969
|
+
query: async () => {
|
|
6970
|
+
const rows = [];
|
|
6971
|
+
let cursor;
|
|
6972
|
+
do {
|
|
6973
|
+
const page = await handle.query({
|
|
6974
|
+
limit: 500,
|
|
6975
|
+
...cursor === void 0 ? {} : { cursor }
|
|
6976
|
+
});
|
|
6977
|
+
rows.push(...page.records);
|
|
6978
|
+
cursor = page.nextCursor ?? void 0;
|
|
6979
|
+
} while (cursor !== void 0);
|
|
6980
|
+
return { records: rows };
|
|
6981
|
+
},
|
|
6982
|
+
get: (id) => handle.get({ id }),
|
|
6983
|
+
put: (input, opts) => handle.put({
|
|
6984
|
+
...input,
|
|
6985
|
+
...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
|
|
6986
|
+
})
|
|
6987
|
+
};
|
|
6988
|
+
} };
|
|
6989
|
+
}
|
|
6913
6990
|
function integrationRowsApiOver(api) {
|
|
6914
6991
|
return {
|
|
6915
6992
|
list: async () => (await api.integrations.list({})).integrations,
|
|
@@ -7122,7 +7199,10 @@ function secretArrayPrefixes(path) {
|
|
|
7122
7199
|
}
|
|
7123
7200
|
return prefixes;
|
|
7124
7201
|
}
|
|
7125
|
-
/**
|
|
7202
|
+
/**
|
|
7203
|
+
* The body key the switch USED to live under (D1007, D1015). Nothing writes or reads it any more;
|
|
7204
|
+
* the migrations that move it between the body and the registry name it.
|
|
7205
|
+
*/
|
|
7126
7206
|
var SWITCH_KEY = "enabled";
|
|
7127
7207
|
/**
|
|
7128
7208
|
* The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
|
|
@@ -7232,6 +7312,107 @@ function registrySwitchPortsOver(deps) {
|
|
|
7232
7312
|
};
|
|
7233
7313
|
}
|
|
7234
7314
|
/**
|
|
7315
|
+
* The switch comes back to the registry (D1066), the reverse of {@link registrySwitchToBodyMigration}.
|
|
7316
|
+
* An instance's on/off state lived in its record body (`enabled`, D1007 superseded by D1015); the hub
|
|
7317
|
+
* registry row, keyed by (addon, integration id) like a device, is now the only stored switch.
|
|
7318
|
+
*
|
|
7319
|
+
* For every record of the addon's kind:
|
|
7320
|
+
* - the state is the body's `enabled` (absent means on). When the registry row of that id disagrees,
|
|
7321
|
+
* the BODY wins: it was the only live copy while the body held the switch, and the registry
|
|
7322
|
+
* column of a migrated row was never read;
|
|
7323
|
+
* - a record with no registry row gets one (a services instance, under its addon-minted id);
|
|
7324
|
+
* - the key is then removed from the body, so no second copy remains.
|
|
7325
|
+
* A rerun finds no body that states `enabled` and writes nothing. The registry write goes first, so
|
|
7326
|
+
* a crash between the two steps repeats the pair (idempotent) and never loses a switched-off state.
|
|
7327
|
+
*
|
|
7328
|
+
* It runs in the addon process, after {@link registrySwitchToBodyMigration}, BEFORE the addon
|
|
7329
|
+
* registers its provider.
|
|
7330
|
+
*/
|
|
7331
|
+
function bodySwitchToRegistryId(addonId, date, kindName) {
|
|
7332
|
+
return `${addonId}/${date}-body-switch-to-registry-${kindName}`;
|
|
7333
|
+
}
|
|
7334
|
+
async function moveBodySwitchToRegistry(ports, spec) {
|
|
7335
|
+
const records = await ports.listRecords();
|
|
7336
|
+
const adopted = records.length === 0 ? {
|
|
7337
|
+
created: 0,
|
|
7338
|
+
updated: 0,
|
|
7339
|
+
conflicts: []
|
|
7340
|
+
} : await ports.adoptRows(spec.addonId, records.map((r) => ({
|
|
7341
|
+
id: r.id,
|
|
7342
|
+
name: r.name,
|
|
7343
|
+
enabled: r.enabled,
|
|
7344
|
+
stated: r.stated
|
|
7345
|
+
})));
|
|
7346
|
+
const foreign = new Map(adopted.conflicts.map((c) => [c.id, c.ownerAddonId]));
|
|
7347
|
+
for (const [id, owner] of foreign) await ports.warn(`body switch kept: the registry row "${id}" belongs to addon "${owner}", not "${spec.addonId}"`);
|
|
7348
|
+
const stated = records.filter((r) => r.stated && !foreign.has(r.id));
|
|
7349
|
+
for (const row of stated) await ports.stripSwitch(row.id);
|
|
7350
|
+
const summary = {
|
|
7351
|
+
records: records.length,
|
|
7352
|
+
stripped: stated.length,
|
|
7353
|
+
rowsCreated: adopted.created,
|
|
7354
|
+
rowsCorrected: adopted.updated,
|
|
7355
|
+
conflicts: adopted.conflicts.length
|
|
7356
|
+
};
|
|
7357
|
+
return stated.length === 0 && adopted.created === 0 && adopted.updated === 0 ? {
|
|
7358
|
+
outcome: "already-done",
|
|
7359
|
+
summary
|
|
7360
|
+
} : {
|
|
7361
|
+
outcome: "done",
|
|
7362
|
+
summary
|
|
7363
|
+
};
|
|
7364
|
+
}
|
|
7365
|
+
/** A migration entry: an addon states its kind, nothing else. */
|
|
7366
|
+
function bodySwitchToRegistryMigration(spec) {
|
|
7367
|
+
return {
|
|
7368
|
+
meta: {
|
|
7369
|
+
id: bodySwitchToRegistryId(spec.addonId, spec.date, spec.kindName),
|
|
7370
|
+
owner: spec.addonId,
|
|
7371
|
+
level: "addon-state",
|
|
7372
|
+
seq: spec.seq,
|
|
7373
|
+
dependsOn: spec.followsDate === void 0 ? [] : [registrySwitchToBodyId(spec.addonId, spec.followsDate)],
|
|
7374
|
+
store: "settings",
|
|
7375
|
+
scope: "cluster",
|
|
7376
|
+
onFailure: "block-owner",
|
|
7377
|
+
bodyKind: "procedure",
|
|
7378
|
+
description: "Move the switch of every instance record back to its registry row (creating the row of a services instance) and remove it from the body",
|
|
7379
|
+
fixtureMark: "enabled"
|
|
7380
|
+
},
|
|
7381
|
+
procedure: (ports) => moveBodySwitchToRegistry(ports, { addonId: spec.addonId })
|
|
7382
|
+
};
|
|
7383
|
+
}
|
|
7384
|
+
function bodySwitchPortsOver(deps) {
|
|
7385
|
+
const handle = deps.records.kind({
|
|
7386
|
+
name: deps.kind.name,
|
|
7387
|
+
declaration: deps.kind.declaration,
|
|
7388
|
+
schema: record(string(), unknown())
|
|
7389
|
+
});
|
|
7390
|
+
return {
|
|
7391
|
+
listRecords: async () => {
|
|
7392
|
+
return (await handle.query({ limit: 1e3 })).records.map((r) => {
|
|
7393
|
+
const name = r.data[deps.nameField];
|
|
7394
|
+
return {
|
|
7395
|
+
id: r.id,
|
|
7396
|
+
name: typeof name === "string" ? name : r.id,
|
|
7397
|
+
enabled: r.data[SWITCH_KEY] !== false,
|
|
7398
|
+
stated: SWITCH_KEY in r.data
|
|
7399
|
+
};
|
|
7400
|
+
});
|
|
7401
|
+
},
|
|
7402
|
+
adoptRows: deps.adopt,
|
|
7403
|
+
warn: deps.warn,
|
|
7404
|
+
stripSwitch: async (id) => {
|
|
7405
|
+
const row = await handle.get(id);
|
|
7406
|
+
if (row === null || !("enabled" in row.data)) return;
|
|
7407
|
+
const { [SWITCH_KEY]: _dropped, ...rest } = row.data;
|
|
7408
|
+
await handle.put({
|
|
7409
|
+
id,
|
|
7410
|
+
data: rest
|
|
7411
|
+
}, { ifRev: row.rev });
|
|
7412
|
+
}
|
|
7413
|
+
};
|
|
7414
|
+
}
|
|
7415
|
+
/**
|
|
7235
7416
|
* Build a {@link DurableState} over a single store key. Transport-agnostic:
|
|
7236
7417
|
* `read`/`write` are the addon-store or device-store accessors. The whole
|
|
7237
7418
|
* validated value round-trips on every read/write — the schema is the
|
|
@@ -7263,6 +7444,20 @@ function createDurableState(deps) {
|
|
|
7263
7444
|
};
|
|
7264
7445
|
}
|
|
7265
7446
|
/**
|
|
7447
|
+
* The registry could not be read for the switches of an addon that serves instance kinds, so its
|
|
7448
|
+
* instances read off (D1066). A forked runner treats it as a failed boot: the supervisor respawns
|
|
7449
|
+
* it, bounded and marked terminally failed (D6), rather than leave instances off silently.
|
|
7450
|
+
*/
|
|
7451
|
+
var INSTANCE_SWITCHES_UNREAD_ERROR_NAME = "InstanceSwitchesUnreadError";
|
|
7452
|
+
var InstanceSwitchesUnreadError = class extends Error {
|
|
7453
|
+
ownerId;
|
|
7454
|
+
constructor(ownerId) {
|
|
7455
|
+
super(`'${ownerId}': the registry did not answer for the instance switches; its instances stay off`);
|
|
7456
|
+
this.ownerId = ownerId;
|
|
7457
|
+
this.name = INSTANCE_SWITCHES_UNREAD_ERROR_NAME;
|
|
7458
|
+
}
|
|
7459
|
+
};
|
|
7460
|
+
/**
|
|
7266
7461
|
* Per-node scoping for the shared addon-settings blob.
|
|
7267
7462
|
*
|
|
7268
7463
|
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
@@ -8246,7 +8441,14 @@ var BaseAddon = class {
|
|
|
8246
8441
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
8247
8442
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
8248
8443
|
});
|
|
8444
|
+
await this.hydrateSwitches();
|
|
8249
8445
|
const result = await this.onInitialize();
|
|
8446
|
+
await this.moveLateInstanceKinds();
|
|
8447
|
+
await this.adoptUnrowed();
|
|
8448
|
+
if (this.switchesHydrated) {
|
|
8449
|
+
settleHydration(this.ctx.id);
|
|
8450
|
+
for (const served of servedInstanceKindsOf(this.ctx.id)) await served.reapply();
|
|
8451
|
+
}
|
|
8250
8452
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
8251
8453
|
const normalized = normalizeAddonInitResult(result);
|
|
8252
8454
|
const providers = normalized && "providers" in normalized && normalized.providers ? normalized.providers : [];
|
|
@@ -8286,17 +8488,22 @@ var BaseAddon = class {
|
|
|
8286
8488
|
this.retiredMigrationIds = ids;
|
|
8287
8489
|
}
|
|
8288
8490
|
registrySwitchSpec = null;
|
|
8491
|
+
/** The instance kinds whose switch move this process already ran (or tried), by record kind name. */
|
|
8492
|
+
switchMoved = /* @__PURE__ */ new Set();
|
|
8493
|
+
lastDeclared = [];
|
|
8289
8494
|
registrySwitchBound() {
|
|
8290
|
-
const spec = this.registrySwitchSpec;
|
|
8291
|
-
if (spec === null) return [];
|
|
8292
8495
|
const api = this.ctx.migrationApi;
|
|
8496
|
+
const spec = this.registrySwitchSpec;
|
|
8497
|
+
const kinds = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
|
|
8498
|
+
if (spec === null && kinds.length === 0) return [];
|
|
8293
8499
|
if (api === void 0) {
|
|
8294
8500
|
this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
|
|
8295
8501
|
return [];
|
|
8296
8502
|
}
|
|
8297
|
-
|
|
8503
|
+
const date = "2026-11-06";
|
|
8504
|
+
const moveIn = spec === null ? [] : migrationSet([registrySwitchToBodyMigration({
|
|
8298
8505
|
addonId: this.ctx.id,
|
|
8299
|
-
date
|
|
8506
|
+
date,
|
|
8300
8507
|
seq: 1e3,
|
|
8301
8508
|
initialBody: spec.initialBody
|
|
8302
8509
|
})], (a) => registrySwitchPortsOver({
|
|
@@ -8304,13 +8511,53 @@ var BaseAddon = class {
|
|
|
8304
8511
|
records: switchRecordsOverMigrationApi(a),
|
|
8305
8512
|
kind: spec.kind
|
|
8306
8513
|
})).bind(api);
|
|
8514
|
+
const moveBack = kinds.flatMap(({ kind }, index) => {
|
|
8515
|
+
this.switchMoved.add(kind.name);
|
|
8516
|
+
return migrationSet([bodySwitchToRegistryMigration({
|
|
8517
|
+
addonId: this.ctx.id,
|
|
8518
|
+
date: "2026-11-19",
|
|
8519
|
+
seq: 1001 + index,
|
|
8520
|
+
kindName: kind.name,
|
|
8521
|
+
...spec === null ? {} : { followsDate: date }
|
|
8522
|
+
})], (a) => bodySwitchPortsOver({
|
|
8523
|
+
records: bodySwitchRecordsOverMigrationApi(a),
|
|
8524
|
+
kind,
|
|
8525
|
+
nameField: kind.declaration.entry?.nameField ?? "name",
|
|
8526
|
+
adopt: (addonId, rows) => this.ctx.api.integrations.adoptInstanceRows.mutate({
|
|
8527
|
+
addonId,
|
|
8528
|
+
rows: [...rows]
|
|
8529
|
+
}),
|
|
8530
|
+
warn: async (message) => {
|
|
8531
|
+
await a.log.warn({ message });
|
|
8532
|
+
}
|
|
8533
|
+
})).bind(api);
|
|
8534
|
+
});
|
|
8535
|
+
return [...moveIn, ...moveBack];
|
|
8536
|
+
}
|
|
8537
|
+
/**
|
|
8538
|
+
* A helper built AFTER the addon's migrations ran has a kind that moved nothing yet. Run its
|
|
8539
|
+
* switch move now (the engine replaces an owner's catalogue on every declare, so the whole
|
|
8540
|
+
* declared set goes with it, phased to the late ids), read the registry again, and tell the
|
|
8541
|
+
* addon about every instance that is off so it stops what it started on the default.
|
|
8542
|
+
*/
|
|
8543
|
+
async moveLateInstanceKinds() {
|
|
8544
|
+
const late = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
|
|
8545
|
+
if (late.length === 0) return;
|
|
8546
|
+
try {
|
|
8547
|
+
const only = late.map((k) => bodySwitchToRegistryId(this.ctx.id, "2026-11-19", k.kind.name));
|
|
8548
|
+
await this.runBound(this.lastDeclared, { only });
|
|
8549
|
+
} catch (err) {
|
|
8550
|
+
if (err instanceof AddonMigrationsBlockedError) throw err;
|
|
8551
|
+
this.ctx.logger.error("the late instance switch move failed", { meta: { error: errMsg$2(err) } });
|
|
8552
|
+
}
|
|
8307
8553
|
}
|
|
8308
8554
|
async runBound(declared, options) {
|
|
8555
|
+
this.lastDeclared = declared;
|
|
8309
8556
|
const added = this.registrySwitchBound();
|
|
8310
8557
|
const migrations = [...declared, ...added];
|
|
8311
8558
|
const widened = options?.only === void 0 || added.length === 0 ? options : {
|
|
8312
8559
|
...options,
|
|
8313
|
-
only: [...options.only, ...added.map((m) => m.meta.id)]
|
|
8560
|
+
only: [...new Set([...options.only, ...added.map((m) => m.meta.id)])]
|
|
8314
8561
|
};
|
|
8315
8562
|
const phased = this.retiredMigrationIds.length === 0 ? widened ?? {} : {
|
|
8316
8563
|
...widened,
|
|
@@ -8323,9 +8570,87 @@ var BaseAddon = class {
|
|
|
8323
8570
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
8324
8571
|
}, migrations, this.ctx.logger, phased);
|
|
8325
8572
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
8573
|
+
await this.hydrateSwitches();
|
|
8574
|
+
await this.adoptUnrowed();
|
|
8326
8575
|
return report;
|
|
8327
8576
|
}
|
|
8328
8577
|
/**
|
|
8578
|
+
* Learn the on/off state of this addon's instances from the registry rows (D1066), at boot, after
|
|
8579
|
+
* a migration run, and again through {@link rehydrateSwitches}. It runs on the addon's own boot
|
|
8580
|
+
* path, never inside a method the hub calls into. A registry that cannot answer leaves the
|
|
8581
|
+
* instances of THIS addon reading off (fail closed, per owner) until a read answers.
|
|
8582
|
+
*/
|
|
8583
|
+
switchesHydrated = false;
|
|
8584
|
+
async hydrateSwitches() {
|
|
8585
|
+
beginHydration(this.ctx.id);
|
|
8586
|
+
try {
|
|
8587
|
+
const rows = await this.ctx.api.integrations.listByAddon.query({ addonId: this.ctx.id });
|
|
8588
|
+
hydrateInstanceSwitches(this.ctx.id, rows);
|
|
8589
|
+
this.switchesHydrated = true;
|
|
8590
|
+
return true;
|
|
8591
|
+
} catch (err) {
|
|
8592
|
+
this.ctx.logger.warn("instance switches not read from the registry: instances stay off", { meta: { error: errMsg$2(err) } });
|
|
8593
|
+
return false;
|
|
8594
|
+
}
|
|
8595
|
+
}
|
|
8596
|
+
/**
|
|
8597
|
+
* Every record of a served kind the registry holds no row for (created outside the hub door:
|
|
8598
|
+
* a seed, a store write) is adopted with the state it effectively had, on unless this process
|
|
8599
|
+
* stated it off, so the hub can switch it. A failure is logged; the next hydration retries.
|
|
8600
|
+
*/
|
|
8601
|
+
async adoptUnrowed() {
|
|
8602
|
+
if (!this.switchesHydrated) return;
|
|
8603
|
+
try {
|
|
8604
|
+
for (const served of servedInstanceKindsOf(this.ctx.id)) {
|
|
8605
|
+
const rows = await served.unrowed();
|
|
8606
|
+
if (rows.length === 0) continue;
|
|
8607
|
+
await this.ctx.api.integrations.adoptInstanceRows.mutate({
|
|
8608
|
+
addonId: this.ctx.id,
|
|
8609
|
+
rows: rows.map((r) => ({
|
|
8610
|
+
id: r.id,
|
|
8611
|
+
name: r.name,
|
|
8612
|
+
enabled: r.enabled,
|
|
8613
|
+
stated: false
|
|
8614
|
+
}))
|
|
8615
|
+
});
|
|
8616
|
+
for (const r of rows) recordRegistrySwitch(r.id, r.enabled);
|
|
8617
|
+
}
|
|
8618
|
+
} catch (err) {
|
|
8619
|
+
this.ctx.logger.warn("records without a registry row were not adopted", { meta: { error: errMsg$2(err) } });
|
|
8620
|
+
}
|
|
8621
|
+
}
|
|
8622
|
+
/**
|
|
8623
|
+
* Read the switches from the registry again and announce the states now known, so an addon that
|
|
8624
|
+
* started on the fail-closed default (off) starts what is on. Throws
|
|
8625
|
+
* {@link InstanceSwitchesUnreadError} when the registry still does not answer while this addon
|
|
8626
|
+
* serves instance kinds: a forked runner turns that into a failed boot (the supervisor respawns
|
|
8627
|
+
* it, bounded, D6), an agent or the hub reads again on the next hub connect (event-driven, D3).
|
|
8628
|
+
* An addon with no instance kind has nothing waiting and never throws.
|
|
8629
|
+
*/
|
|
8630
|
+
async rehydrateSwitches() {
|
|
8631
|
+
if (this._ctx === null) return;
|
|
8632
|
+
if (await this.hydrateSwitches()) {
|
|
8633
|
+
await this.adoptUnrowed();
|
|
8634
|
+
settleHydration(this.ctx.id);
|
|
8635
|
+
for (const served of servedInstanceKindsOf(this.ctx.id)) await served.reapply();
|
|
8636
|
+
return;
|
|
8637
|
+
}
|
|
8638
|
+
if (isHydrationPending(this.ctx.id)) throw new InstanceSwitchesUnreadError(this.ctx.id);
|
|
8639
|
+
}
|
|
8640
|
+
/**
|
|
8641
|
+
* Called on the hub-reachable event (instead of `onHubReachable` directly): the switches are
|
|
8642
|
+
* read again, then `onHubReachable` runs. A registry that still does not answer is logged and
|
|
8643
|
+
* left for the next connect.
|
|
8644
|
+
*/
|
|
8645
|
+
async hubReachable() {
|
|
8646
|
+
try {
|
|
8647
|
+
await this.rehydrateSwitches();
|
|
8648
|
+
} catch (err) {
|
|
8649
|
+
this.ctx.logger.warn("instance switches still unread at the hub connect", { meta: { error: errMsg$2(err) } });
|
|
8650
|
+
}
|
|
8651
|
+
await this.onHubReachable();
|
|
8652
|
+
}
|
|
8653
|
+
/**
|
|
8329
8654
|
* Called by the isolated-process runner AFTER `broker.start()`.
|
|
8330
8655
|
* In-process addons never need this because the hub broker is already
|
|
8331
8656
|
* running when `initialize()` fires. For forked children the broker
|
|
@@ -67129,14 +67454,8 @@ var IntegrationWithStateSchema = object({
|
|
|
67129
67454
|
id: string(),
|
|
67130
67455
|
addonId: string(),
|
|
67131
67456
|
name: string(),
|
|
67132
|
-
/**
|
|
67457
|
+
/** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
|
|
67133
67458
|
enabled: boolean(),
|
|
67134
|
-
/**
|
|
67135
|
-
* True when the addon that holds the switch did not answer (down, failed, or keeps no record for
|
|
67136
|
-
* this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
|
|
67137
|
-
* must not draw it as on or off (D315).
|
|
67138
|
-
*/
|
|
67139
|
-
switchUnknown: literal(true).optional(),
|
|
67140
67459
|
info: record(string(), unknown()).readonly(),
|
|
67141
67460
|
/** The discovery candidate this integration was set up from (D984). */
|
|
67142
67461
|
originStableId: string().optional(),
|
|
@@ -67148,14 +67467,8 @@ var IntegrationLiteSchema = object({
|
|
|
67148
67467
|
id: string(),
|
|
67149
67468
|
addonId: string(),
|
|
67150
67469
|
name: string(),
|
|
67151
|
-
/**
|
|
67470
|
+
/** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
|
|
67152
67471
|
enabled: boolean(),
|
|
67153
|
-
/**
|
|
67154
|
-
* True when the addon that holds the switch did not answer (down, failed, or keeps no record for
|
|
67155
|
-
* this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
|
|
67156
|
-
* must not draw it as on or off (D315).
|
|
67157
|
-
*/
|
|
67158
|
-
switchUnknown: literal(true).optional(),
|
|
67159
67472
|
info: record(string(), unknown()).readonly(),
|
|
67160
67473
|
/** The discovery candidate this integration was set up from (D984). */
|
|
67161
67474
|
originStableId: string().optional(),
|
|
@@ -67271,7 +67584,27 @@ var DeleteIntegrationResultSchema = object({
|
|
|
67271
67584
|
success: boolean(),
|
|
67272
67585
|
deletedId: string()
|
|
67273
67586
|
});
|
|
67274
|
-
method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string() }), IntegrationWithStateSchema), method(object({ addonId: string() }), IntegrationLiteSchema.nullable()), method(
|
|
67587
|
+
method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string() }), IntegrationWithStateSchema), method(object({ addonId: string() }), IntegrationLiteSchema.nullable()), method(object({ addonId: string() }), array(IntegrationLiteSchema)), method(object({
|
|
67588
|
+
addonId: string(),
|
|
67589
|
+
rows: array(object({
|
|
67590
|
+
id: string().min(1),
|
|
67591
|
+
name: string(),
|
|
67592
|
+
enabled: boolean(),
|
|
67593
|
+
/** True when the record body STATED the switch: only then does it override an existing row. */
|
|
67594
|
+
stated: boolean()
|
|
67595
|
+
}))
|
|
67596
|
+
}), object({
|
|
67597
|
+
created: number$1().int(),
|
|
67598
|
+
updated: number$1().int(),
|
|
67599
|
+
/** Rows whose id belongs to ANOTHER addon: left untouched, so the caller keeps its own copy. */
|
|
67600
|
+
conflicts: array(object({
|
|
67601
|
+
id: string(),
|
|
67602
|
+
ownerAddonId: string()
|
|
67603
|
+
}))
|
|
67604
|
+
}), {
|
|
67605
|
+
kind: "mutation",
|
|
67606
|
+
auth: "admin"
|
|
67607
|
+
}), method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
|
|
67275
67608
|
kind: "mutation",
|
|
67276
67609
|
auth: "admin"
|
|
67277
67610
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
@@ -100107,6 +100440,13 @@ Object.freeze({
|
|
|
100107
100440
|
access: "create",
|
|
100108
100441
|
role: "admin"
|
|
100109
100442
|
},
|
|
100443
|
+
"integrations.adoptInstanceRows": {
|
|
100444
|
+
capName: "integrations",
|
|
100445
|
+
capScope: "system",
|
|
100446
|
+
addonId: null,
|
|
100447
|
+
access: "create",
|
|
100448
|
+
role: "admin"
|
|
100449
|
+
},
|
|
100110
100450
|
"integrations.delete": {
|
|
100111
100451
|
capName: "integrations",
|
|
100112
100452
|
capScope: "system",
|
|
@@ -100142,6 +100482,13 @@ Object.freeze({
|
|
|
100142
100482
|
access: "view",
|
|
100143
100483
|
role: "admin"
|
|
100144
100484
|
},
|
|
100485
|
+
"integrations.listByAddon": {
|
|
100486
|
+
capName: "integrations",
|
|
100487
|
+
capScope: "system",
|
|
100488
|
+
addonId: null,
|
|
100489
|
+
access: "view",
|
|
100490
|
+
role: "admin"
|
|
100491
|
+
},
|
|
100145
100492
|
"integrations.update": {
|
|
100146
100493
|
capName: "integrations",
|
|
100147
100494
|
capScope: "system",
|
package/dist/remoteEntry.js
CHANGED
|
@@ -30,7 +30,7 @@ async function d(e) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
async function f() {
|
|
33
|
-
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-
|
|
33
|
+
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-Cy30Rzqj.mjs")).catch((e) => {
|
|
34
34
|
throw l = void 0, e;
|
|
35
35
|
}), l;
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-pipeline-orchestrator",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.709",
|
|
4
4
|
"description": "Hub-side camera-to-agent load balancer — tracks runner capacity and dispatches attachCamera calls to the optimal pipeline-runner instance",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
],
|
|
78
78
|
"requires": {
|
|
79
|
-
"server": ">=1.2.
|
|
79
|
+
"server": ">=1.2.911"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"files": [
|