@camstack/system 1.1.35 → 1.1.36
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/dist/addon-runner.js +87 -35
- package/dist/addon-runner.mjs +87 -35
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{dist-DlGZpWo8.mjs → dist-C7oOY4iL.mjs} +80 -118
- package/dist/{dist-DriXJoVg.js → dist-COIhbSao.js} +80 -118
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/kernel/moleculer/child-cap-descriptors.d.ts +34 -0
- package/dist/kernel/moleculer/child-cap-dispatch.d.ts +10 -2
- package/dist/kernel/transport/child-cap-protocol.d.ts +20 -0
- package/dist/{manifest-python-deps-MUu1e33G.mjs → manifest-python-deps-BYIV8-rc.mjs} +5 -3
- package/dist/{manifest-python-deps-jZA_Qorz.js → manifest-python-deps-CZFqI4wp.js} +5 -3
- package/package.json +1 -1
package/dist/addon-runner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_manifest_python_deps = require("./manifest-python-deps-
|
|
2
|
+
const require_manifest_python_deps = require("./manifest-python-deps-CZFqI4wp.js");
|
|
3
3
|
const require_custom_action_registry = require("./custom-action-registry-vLYEFTtv.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -115,6 +115,17 @@ function isCapMethod(value) {
|
|
|
115
115
|
return typeof value === "function";
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
+
* Extract a string `addonId` out of arbitrary method args — the fallback
|
|
119
|
+
* provider-selection hint for calls that arrive WITHOUT the out-of-band
|
|
120
|
+
* `CapCallMessage.addonId` (e.g. a sibling child's unowned collection call
|
|
121
|
+
* forwarded by the parent, where the raw input still carries `addonId`).
|
|
122
|
+
*/
|
|
123
|
+
function extractArgsAddonId(args) {
|
|
124
|
+
if (args === null || typeof args !== "object") return void 0;
|
|
125
|
+
const raw = Reflect.get(args, "addonId");
|
|
126
|
+
return typeof raw === "string" ? raw : void 0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
118
129
|
* Creates a unified dispatcher that routes a {@link CapCallInput} to either a
|
|
119
130
|
* device-scoped or singleton provider, then invokes the requested method.
|
|
120
131
|
*
|
|
@@ -123,12 +134,13 @@ function isCapMethod(value) {
|
|
|
123
134
|
function createChildCapDispatch(deps) {
|
|
124
135
|
return async (call) => {
|
|
125
136
|
const { capName, method, args, deviceId } = call;
|
|
137
|
+
const addonId = call.addonId ?? extractArgsAddonId(args);
|
|
126
138
|
let provider;
|
|
127
139
|
if (deviceId !== void 0) {
|
|
128
|
-
provider = deps.getDeviceProvider(capName, deviceId) ?? deps.getSingletonProvider(capName);
|
|
140
|
+
provider = deps.getDeviceProvider(capName, deviceId) ?? deps.getSingletonProvider(capName, addonId);
|
|
129
141
|
if (provider == null) throw new Error(`child-cap-dispatch: no provider for '${capName}' (device '${String(deviceId)}' or singleton)`);
|
|
130
142
|
} else {
|
|
131
|
-
provider = deps.getSingletonProvider(capName);
|
|
143
|
+
provider = deps.getSingletonProvider(capName, addonId);
|
|
132
144
|
if (provider == null) throw new Error(`child-cap-dispatch: no singleton provider for '${capName}'`);
|
|
133
145
|
}
|
|
134
146
|
const fn = Reflect.get(provider, method);
|
|
@@ -137,6 +149,51 @@ function createChildCapDispatch(deps) {
|
|
|
137
149
|
};
|
|
138
150
|
}
|
|
139
151
|
//#endregion
|
|
152
|
+
//#region src/kernel/moleculer/child-cap-descriptors.ts
|
|
153
|
+
/**
|
|
154
|
+
* Builds the {@link ChildCapDescriptor} array that the UDS child transport
|
|
155
|
+
* sends to the parent on registration.
|
|
156
|
+
*
|
|
157
|
+
* - Singleton caps come from the runner UNION manifest (all caps registered by
|
|
158
|
+
* every addon in this runner). One descriptor per unique (addonId, capName)
|
|
159
|
+
* pair, mode `'singleton'` and no `deviceId`. The `addonId` stamp lets the
|
|
160
|
+
* parent's manifest builder register each hosted addon's caps under the
|
|
161
|
+
* REAL addon id — a GROUPED runner (`execution.group`) hosts several addons,
|
|
162
|
+
* and deduplicating by capName alone would collapse two co-located providers
|
|
163
|
+
* of the same collection cap (e.g. `network-access` from cloudflare-tunnel
|
|
164
|
+
* AND tailscale-ingress) into one descriptor registered under a synthetic
|
|
165
|
+
* `addonId = childId` (the group name) — the "@camstack/addon-net-access"
|
|
166
|
+
* admin-UI bug.
|
|
167
|
+
* - Device-scoped caps come from the native-cap snapshot — one descriptor per
|
|
168
|
+
* (capName, deviceId) pair, mode `'collection'`, stamped with the owning
|
|
169
|
+
* addon's id.
|
|
170
|
+
*
|
|
171
|
+
* Pure module — extracted from `addon-runner.ts` (whose `main()` runs at
|
|
172
|
+
* import time) so it is unit-testable.
|
|
173
|
+
*/
|
|
174
|
+
function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
175
|
+
const descriptors = [];
|
|
176
|
+
const seen = /* @__PURE__ */ new Set();
|
|
177
|
+
for (const entry of manifest) for (const capName of entry.capabilities) {
|
|
178
|
+
const key = `${entry.addonId}::${capName}`;
|
|
179
|
+
if (!seen.has(key)) {
|
|
180
|
+
seen.add(key);
|
|
181
|
+
descriptors.push({
|
|
182
|
+
capName,
|
|
183
|
+
mode: "singleton",
|
|
184
|
+
addonId: entry.addonId
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (const { capName, addonId, deviceIds } of nativeCapSnapshot) for (const deviceId of deviceIds) descriptors.push({
|
|
189
|
+
capName,
|
|
190
|
+
mode: "collection",
|
|
191
|
+
deviceId,
|
|
192
|
+
addonId
|
|
193
|
+
});
|
|
194
|
+
return descriptors;
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
140
197
|
//#region src/kernel/moleculer/child-addon-call-dispatch.ts
|
|
141
198
|
function isRecord$1(value) {
|
|
142
199
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -333,33 +390,6 @@ async function loadAddonModule(addonId, addonDir) {
|
|
|
333
390
|
AddonClass
|
|
334
391
|
};
|
|
335
392
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Builds the {@link ChildCapDescriptor} array that the UDS child transport
|
|
338
|
-
* sends to the parent on registration.
|
|
339
|
-
*
|
|
340
|
-
* - Singleton caps come from the runner UNION manifest (all caps registered by
|
|
341
|
-
* every addon in this runner). One descriptor per unique cap name, mode
|
|
342
|
-
* `'singleton'` and no `deviceId`.
|
|
343
|
-
* - Device-scoped caps come from the native-cap snapshot — one descriptor per
|
|
344
|
-
* (capName, deviceId) pair, mode `'collection'`.
|
|
345
|
-
*/
|
|
346
|
-
function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
347
|
-
const descriptors = [];
|
|
348
|
-
const seen = /* @__PURE__ */ new Set();
|
|
349
|
-
for (const entry of manifest) for (const capName of entry.capabilities) if (!seen.has(capName)) {
|
|
350
|
-
seen.add(capName);
|
|
351
|
-
descriptors.push({
|
|
352
|
-
capName,
|
|
353
|
-
mode: "singleton"
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
for (const { capName, deviceIds } of nativeCapSnapshot) for (const deviceId of deviceIds) descriptors.push({
|
|
357
|
-
capName,
|
|
358
|
-
mode: "collection",
|
|
359
|
-
deviceId
|
|
360
|
-
});
|
|
361
|
-
return descriptors;
|
|
362
|
-
}
|
|
363
393
|
async function main() {
|
|
364
394
|
const runnerId = process.env["CAMSTACK_RUNNER_ID"];
|
|
365
395
|
const addonsJson = process.env["CAMSTACK_RUNNER_ADDONS"];
|
|
@@ -427,14 +457,34 @@ async function main() {
|
|
|
427
457
|
const runnerManifest = [];
|
|
428
458
|
/**
|
|
429
459
|
* Aggregated singleton (system-scoped) providers across ALL addons in this
|
|
430
|
-
* runner — keyed
|
|
431
|
-
* singleton calls (no Moleculer).
|
|
432
|
-
*
|
|
460
|
+
* runner — keyed capName → (addonId → provider). Read by the UDS child-cap
|
|
461
|
+
* dispatch to resolve singleton calls (no Moleculer). The nested per-addon
|
|
462
|
+
* keying matters for GROUPED runners (`execution.group`): two co-located
|
|
463
|
+
* addons can register the SAME collection cap (e.g. `network-access` from
|
|
464
|
+
* cloudflare-tunnel AND tailscale-ingress) — a flat capName map would keep
|
|
465
|
+
* only the last-registered provider. Populated during the addon-init loop;
|
|
466
|
+
* a cap-call that arrives before its addon initialises is rejected by the
|
|
433
467
|
* dispatcher (the parent only routes caps the child has registered via the
|
|
434
468
|
* UDS `register`/`updateCaps` handshake).
|
|
435
469
|
*/
|
|
436
470
|
const allSingletonProviders = /* @__PURE__ */ new Map();
|
|
437
471
|
/**
|
|
472
|
+
* Resolve a singleton provider for the dispatcher: exact (capName, addonId)
|
|
473
|
+
* match when the hint names a hosted provider, else the cap's first
|
|
474
|
+
* registered provider (an unmatched `addonId` is method DATA — e.g.
|
|
475
|
+
* `addons.restartAddon({ addonId })` — not a routing key).
|
|
476
|
+
*/
|
|
477
|
+
const resolveSingletonProvider = (capName, addonId) => {
|
|
478
|
+
const byAddon = allSingletonProviders.get(capName);
|
|
479
|
+
if (!byAddon || byAddon.size === 0) return null;
|
|
480
|
+
if (addonId !== void 0) {
|
|
481
|
+
const exact = byAddon.get(addonId);
|
|
482
|
+
if (exact !== void 0) return exact;
|
|
483
|
+
}
|
|
484
|
+
const first = byAddon.values().next();
|
|
485
|
+
return first.done ? null : first.value;
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
438
488
|
* Per-addon route-provider map — keyed by addonId → the addon's live
|
|
439
489
|
* `addon-routes` provider object. Resolves `getRouteProvider(addonId)`
|
|
440
490
|
* per-addon rather than returning a single global provider. Populated
|
|
@@ -473,7 +523,7 @@ async function main() {
|
|
|
473
523
|
childId: runnerId,
|
|
474
524
|
caps: buildChildCapDescriptors(runnerManifest, require_manifest_python_deps.getWorkerNativeCapSnapshot()),
|
|
475
525
|
dispatch: createChildCapDispatch({
|
|
476
|
-
getSingletonProvider: (capName) =>
|
|
526
|
+
getSingletonProvider: (capName, addonId) => resolveSingletonProvider(capName, addonId),
|
|
477
527
|
getDeviceProvider: (capName, deviceId) => require_manifest_python_deps.getWorkerNativeCapProvider(capName, deviceId) ?? null
|
|
478
528
|
})
|
|
479
529
|
});
|
|
@@ -538,7 +588,9 @@ async function main() {
|
|
|
538
588
|
context.registerProvider(capName, reg.provider);
|
|
539
589
|
const prov = reg.provider;
|
|
540
590
|
if (prov !== null && typeof prov === "object" && !Array.isArray(prov)) {
|
|
541
|
-
allSingletonProviders.
|
|
591
|
+
const byAddon = allSingletonProviders.get(capName) ?? /* @__PURE__ */ new Map();
|
|
592
|
+
byAddon.set(spec.addonId, prov);
|
|
593
|
+
allSingletonProviders.set(capName, byAddon);
|
|
542
594
|
if (capName === "addon-routes") addonRouteProviders.set(spec.addonId, prov);
|
|
543
595
|
}
|
|
544
596
|
}
|
package/dist/addon-runner.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as createUdsLoggerWithControl, I as LocalChildClient, i as createUdsAddonContext, it as setWorkerNativeCapsChangeListener, nt as getWorkerNativeCapSnapshot, ot as validateProviderRegistrations, t as installManifestPythonDeps, tt as getWorkerNativeCapProvider, vt as installManifestNativeDeps, yt as resolveAddonClass } from "./manifest-python-deps-
|
|
1
|
+
import { F as createUdsLoggerWithControl, I as LocalChildClient, i as createUdsAddonContext, it as setWorkerNativeCapsChangeListener, nt as getWorkerNativeCapSnapshot, ot as validateProviderRegistrations, t as installManifestPythonDeps, tt as getWorkerNativeCapProvider, vt as installManifestNativeDeps, yt as resolveAddonClass } from "./manifest-python-deps-BYIV8-rc.mjs";
|
|
2
2
|
import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
|
|
3
3
|
import { register } from "node:module";
|
|
4
4
|
import * as fs from "node:fs";
|
|
@@ -111,6 +111,17 @@ function isCapMethod(value) {
|
|
|
111
111
|
return typeof value === "function";
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
+
* Extract a string `addonId` out of arbitrary method args — the fallback
|
|
115
|
+
* provider-selection hint for calls that arrive WITHOUT the out-of-band
|
|
116
|
+
* `CapCallMessage.addonId` (e.g. a sibling child's unowned collection call
|
|
117
|
+
* forwarded by the parent, where the raw input still carries `addonId`).
|
|
118
|
+
*/
|
|
119
|
+
function extractArgsAddonId(args) {
|
|
120
|
+
if (args === null || typeof args !== "object") return void 0;
|
|
121
|
+
const raw = Reflect.get(args, "addonId");
|
|
122
|
+
return typeof raw === "string" ? raw : void 0;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
114
125
|
* Creates a unified dispatcher that routes a {@link CapCallInput} to either a
|
|
115
126
|
* device-scoped or singleton provider, then invokes the requested method.
|
|
116
127
|
*
|
|
@@ -119,12 +130,13 @@ function isCapMethod(value) {
|
|
|
119
130
|
function createChildCapDispatch(deps) {
|
|
120
131
|
return async (call) => {
|
|
121
132
|
const { capName, method, args, deviceId } = call;
|
|
133
|
+
const addonId = call.addonId ?? extractArgsAddonId(args);
|
|
122
134
|
let provider;
|
|
123
135
|
if (deviceId !== void 0) {
|
|
124
|
-
provider = deps.getDeviceProvider(capName, deviceId) ?? deps.getSingletonProvider(capName);
|
|
136
|
+
provider = deps.getDeviceProvider(capName, deviceId) ?? deps.getSingletonProvider(capName, addonId);
|
|
125
137
|
if (provider == null) throw new Error(`child-cap-dispatch: no provider for '${capName}' (device '${String(deviceId)}' or singleton)`);
|
|
126
138
|
} else {
|
|
127
|
-
provider = deps.getSingletonProvider(capName);
|
|
139
|
+
provider = deps.getSingletonProvider(capName, addonId);
|
|
128
140
|
if (provider == null) throw new Error(`child-cap-dispatch: no singleton provider for '${capName}'`);
|
|
129
141
|
}
|
|
130
142
|
const fn = Reflect.get(provider, method);
|
|
@@ -133,6 +145,51 @@ function createChildCapDispatch(deps) {
|
|
|
133
145
|
};
|
|
134
146
|
}
|
|
135
147
|
//#endregion
|
|
148
|
+
//#region src/kernel/moleculer/child-cap-descriptors.ts
|
|
149
|
+
/**
|
|
150
|
+
* Builds the {@link ChildCapDescriptor} array that the UDS child transport
|
|
151
|
+
* sends to the parent on registration.
|
|
152
|
+
*
|
|
153
|
+
* - Singleton caps come from the runner UNION manifest (all caps registered by
|
|
154
|
+
* every addon in this runner). One descriptor per unique (addonId, capName)
|
|
155
|
+
* pair, mode `'singleton'` and no `deviceId`. The `addonId` stamp lets the
|
|
156
|
+
* parent's manifest builder register each hosted addon's caps under the
|
|
157
|
+
* REAL addon id — a GROUPED runner (`execution.group`) hosts several addons,
|
|
158
|
+
* and deduplicating by capName alone would collapse two co-located providers
|
|
159
|
+
* of the same collection cap (e.g. `network-access` from cloudflare-tunnel
|
|
160
|
+
* AND tailscale-ingress) into one descriptor registered under a synthetic
|
|
161
|
+
* `addonId = childId` (the group name) — the "@camstack/addon-net-access"
|
|
162
|
+
* admin-UI bug.
|
|
163
|
+
* - Device-scoped caps come from the native-cap snapshot — one descriptor per
|
|
164
|
+
* (capName, deviceId) pair, mode `'collection'`, stamped with the owning
|
|
165
|
+
* addon's id.
|
|
166
|
+
*
|
|
167
|
+
* Pure module — extracted from `addon-runner.ts` (whose `main()` runs at
|
|
168
|
+
* import time) so it is unit-testable.
|
|
169
|
+
*/
|
|
170
|
+
function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
171
|
+
const descriptors = [];
|
|
172
|
+
const seen = /* @__PURE__ */ new Set();
|
|
173
|
+
for (const entry of manifest) for (const capName of entry.capabilities) {
|
|
174
|
+
const key = `${entry.addonId}::${capName}`;
|
|
175
|
+
if (!seen.has(key)) {
|
|
176
|
+
seen.add(key);
|
|
177
|
+
descriptors.push({
|
|
178
|
+
capName,
|
|
179
|
+
mode: "singleton",
|
|
180
|
+
addonId: entry.addonId
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (const { capName, addonId, deviceIds } of nativeCapSnapshot) for (const deviceId of deviceIds) descriptors.push({
|
|
185
|
+
capName,
|
|
186
|
+
mode: "collection",
|
|
187
|
+
deviceId,
|
|
188
|
+
addonId
|
|
189
|
+
});
|
|
190
|
+
return descriptors;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
136
193
|
//#region src/kernel/moleculer/child-addon-call-dispatch.ts
|
|
137
194
|
function isRecord$1(value) {
|
|
138
195
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -329,33 +386,6 @@ async function loadAddonModule(addonId, addonDir) {
|
|
|
329
386
|
AddonClass
|
|
330
387
|
};
|
|
331
388
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Builds the {@link ChildCapDescriptor} array that the UDS child transport
|
|
334
|
-
* sends to the parent on registration.
|
|
335
|
-
*
|
|
336
|
-
* - Singleton caps come from the runner UNION manifest (all caps registered by
|
|
337
|
-
* every addon in this runner). One descriptor per unique cap name, mode
|
|
338
|
-
* `'singleton'` and no `deviceId`.
|
|
339
|
-
* - Device-scoped caps come from the native-cap snapshot — one descriptor per
|
|
340
|
-
* (capName, deviceId) pair, mode `'collection'`.
|
|
341
|
-
*/
|
|
342
|
-
function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
343
|
-
const descriptors = [];
|
|
344
|
-
const seen = /* @__PURE__ */ new Set();
|
|
345
|
-
for (const entry of manifest) for (const capName of entry.capabilities) if (!seen.has(capName)) {
|
|
346
|
-
seen.add(capName);
|
|
347
|
-
descriptors.push({
|
|
348
|
-
capName,
|
|
349
|
-
mode: "singleton"
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
for (const { capName, deviceIds } of nativeCapSnapshot) for (const deviceId of deviceIds) descriptors.push({
|
|
353
|
-
capName,
|
|
354
|
-
mode: "collection",
|
|
355
|
-
deviceId
|
|
356
|
-
});
|
|
357
|
-
return descriptors;
|
|
358
|
-
}
|
|
359
389
|
async function main() {
|
|
360
390
|
const runnerId = process.env["CAMSTACK_RUNNER_ID"];
|
|
361
391
|
const addonsJson = process.env["CAMSTACK_RUNNER_ADDONS"];
|
|
@@ -423,14 +453,34 @@ async function main() {
|
|
|
423
453
|
const runnerManifest = [];
|
|
424
454
|
/**
|
|
425
455
|
* Aggregated singleton (system-scoped) providers across ALL addons in this
|
|
426
|
-
* runner — keyed
|
|
427
|
-
* singleton calls (no Moleculer).
|
|
428
|
-
*
|
|
456
|
+
* runner — keyed capName → (addonId → provider). Read by the UDS child-cap
|
|
457
|
+
* dispatch to resolve singleton calls (no Moleculer). The nested per-addon
|
|
458
|
+
* keying matters for GROUPED runners (`execution.group`): two co-located
|
|
459
|
+
* addons can register the SAME collection cap (e.g. `network-access` from
|
|
460
|
+
* cloudflare-tunnel AND tailscale-ingress) — a flat capName map would keep
|
|
461
|
+
* only the last-registered provider. Populated during the addon-init loop;
|
|
462
|
+
* a cap-call that arrives before its addon initialises is rejected by the
|
|
429
463
|
* dispatcher (the parent only routes caps the child has registered via the
|
|
430
464
|
* UDS `register`/`updateCaps` handshake).
|
|
431
465
|
*/
|
|
432
466
|
const allSingletonProviders = /* @__PURE__ */ new Map();
|
|
433
467
|
/**
|
|
468
|
+
* Resolve a singleton provider for the dispatcher: exact (capName, addonId)
|
|
469
|
+
* match when the hint names a hosted provider, else the cap's first
|
|
470
|
+
* registered provider (an unmatched `addonId` is method DATA — e.g.
|
|
471
|
+
* `addons.restartAddon({ addonId })` — not a routing key).
|
|
472
|
+
*/
|
|
473
|
+
const resolveSingletonProvider = (capName, addonId) => {
|
|
474
|
+
const byAddon = allSingletonProviders.get(capName);
|
|
475
|
+
if (!byAddon || byAddon.size === 0) return null;
|
|
476
|
+
if (addonId !== void 0) {
|
|
477
|
+
const exact = byAddon.get(addonId);
|
|
478
|
+
if (exact !== void 0) return exact;
|
|
479
|
+
}
|
|
480
|
+
const first = byAddon.values().next();
|
|
481
|
+
return first.done ? null : first.value;
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
434
484
|
* Per-addon route-provider map — keyed by addonId → the addon's live
|
|
435
485
|
* `addon-routes` provider object. Resolves `getRouteProvider(addonId)`
|
|
436
486
|
* per-addon rather than returning a single global provider. Populated
|
|
@@ -469,7 +519,7 @@ async function main() {
|
|
|
469
519
|
childId: runnerId,
|
|
470
520
|
caps: buildChildCapDescriptors(runnerManifest, getWorkerNativeCapSnapshot()),
|
|
471
521
|
dispatch: createChildCapDispatch({
|
|
472
|
-
getSingletonProvider: (capName) =>
|
|
522
|
+
getSingletonProvider: (capName, addonId) => resolveSingletonProvider(capName, addonId),
|
|
473
523
|
getDeviceProvider: (capName, deviceId) => getWorkerNativeCapProvider(capName, deviceId) ?? null
|
|
474
524
|
})
|
|
475
525
|
});
|
|
@@ -534,7 +584,9 @@ async function main() {
|
|
|
534
584
|
context.registerProvider(capName, reg.provider);
|
|
535
585
|
const prov = reg.provider;
|
|
536
586
|
if (prov !== null && typeof prov === "object" && !Array.isArray(prov)) {
|
|
537
|
-
allSingletonProviders.
|
|
587
|
+
const byAddon = allSingletonProviders.get(capName) ?? /* @__PURE__ */ new Map();
|
|
588
|
+
byAddon.set(spec.addonId, prov);
|
|
589
|
+
allSingletonProviders.set(capName, byAddon);
|
|
538
590
|
if (capName === "addon-routes") addonRouteProviders.set(spec.addonId, prov);
|
|
539
591
|
}
|
|
540
592
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errMsg, et as BaseAddon, f as addonPagesCapability, st as EventCategory } from "../../dist-
|
|
1
|
+
import { $ as errMsg, et as BaseAddon, f as addonPagesCapability, st as EventCategory } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errMsg, et as BaseAddon, m as addonWidgetsCapability, st as EventCategory } from "../../dist-
|
|
1
|
+
import { $ as errMsg, et as BaseAddon, m as addonWidgetsCapability, st as EventCategory } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
//#region src/builtins/alerts/alerts.addon.ts
|
|
8
8
|
var CATEGORY_MAPPINGS = {
|
|
9
9
|
"addon.crashed": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errMsg, et as BaseAddon, h as alertsCapability, mt as createEvent, n as AlertSchema, st as EventCategory } from "../../dist-
|
|
1
|
+
import { $ as errMsg, et as BaseAddon, h as alertsCapability, mt as createEvent, n as AlertSchema, st as EventCategory } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
//#region src/builtins/alerts/alerts.addon.ts
|
|
3
3
|
var CATEGORY_MAPPINGS = {
|
|
4
4
|
"addon.crashed": {
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
let node_fs$1 = require_chunk.__toESM(node_fs, 1);
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { et as BaseAddon, st as EventCategory, v as backupCapability } from "../../dist-
|
|
1
|
+
import { et as BaseAddon, st as EventCategory, v as backupCapability } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import Kt from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as logDestinationCapability, et as BaseAddon } from "../../dist-
|
|
1
|
+
import { P as logDestinationCapability, et as BaseAddon } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let _camstack_types_node = require("@camstack/types/node");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errMsg, C as enumerateItemArrayFields, D as getByPath, Q as validateExpressionSource, R as normalizeUnit, S as deviceStatusCapability, T as evaluateLinkExpression, Tt as sleep, W as setByPath, X as toExpressionValue, a as DeviceStatusSchema, at as DeviceRole, b as deviceManagerCapability, c as STREAM_PROFILE_META, et as BaseAddon, g as applyTransform, i as CAP_NAMES_WITH_STATUS, it as DeviceFeature, ot as DeviceType, st as EventCategory, t as ALL_CAPABILITY_DEFINITIONS, ut as WELL_KNOWN_TAB_MAP, w as enumerateSchemaFields, x as deviceStateCapability, y as buildStreamParamsConfigSchema, yt as isDeviceConfigCap, z as parseStreamParamsFormPatch } from "../../dist-
|
|
1
|
+
import { $ as errMsg, C as enumerateItemArrayFields, D as getByPath, Q as validateExpressionSource, R as normalizeUnit, S as deviceStatusCapability, T as evaluateLinkExpression, Tt as sleep, W as setByPath, X as toExpressionValue, a as DeviceStatusSchema, at as DeviceRole, b as deviceManagerCapability, c as STREAM_PROFILE_META, et as BaseAddon, g as applyTransform, i as CAP_NAMES_WITH_STATUS, it as DeviceFeature, ot as DeviceType, st as EventCategory, t as ALL_CAPABILITY_DEFINITIONS, ut as WELL_KNOWN_TAB_MAP, w as enumerateSchemaFields, x as deviceStateCapability, y as buildStreamParamsConfigSchema, yt as isDeviceConfigCap, z as parseStreamParamsFormPatch } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { canonicalDeviceFingerprint } from "@camstack/types/node";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
9
9
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as logDestinationCapability, et as BaseAddon } from "../../dist-
|
|
1
|
+
import { P as logDestinationCapability, et as BaseAddon } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
4
4
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
node_crypto = require_chunk.__toESM(node_crypto);
|
|
9
9
|
let crypto$1 = require("crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as userManagementCapability, _ as authProviderCapability, d as UserRecordSchema, et as BaseAddon, l as ScopedTokenSchema, r as ApiKeyRecordSchema } from "../../dist-
|
|
1
|
+
import { Z as userManagementCapability, _ as authProviderCapability, d as UserRecordSchema, et as BaseAddon, l as ScopedTokenSchema, r as ApiKeyRecordSchema } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import * as crypto$1 from "node:crypto";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
4
4
|
let node_os = require("node:os");
|
|
5
5
|
node_os = require_chunk.__toESM(node_os);
|
|
6
6
|
//#region src/builtins/local-network/local-network.addon.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as localNetworkCapability, et as BaseAddon, st as EventCategory } from "../../dist-
|
|
1
|
+
import { N as localNetworkCapability, et as BaseAddon, st as EventCategory } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
//#region src/builtins/local-network/local-network.addon.ts
|
|
4
4
|
/**
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
node_fs = require_chunk.__toESM(node_fs);
|
|
9
9
|
let node_child_process = require("node:child_process");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as metricsProviderCapability, et as BaseAddon, mt as createEvent, st as EventCategory } from "../../dist-
|
|
1
|
+
import { I as metricsProviderCapability, et as BaseAddon, mt as createEvent, st as EventCategory } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import { execFile, execFileSync } from "node:child_process";
|
|
4
4
|
import { promisify } from "node:util";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
node_fs = require_chunk.__toESM(node_fs);
|
|
9
9
|
let node_child_process = require("node:child_process");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errMsg, B as platformProbeCapability, U as scoreRuntimes, et as BaseAddon, gt as emitReadiness, st as EventCategory } from "../../dist-
|
|
1
|
+
import { $ as errMsg, B as platformProbeCapability, U as scoreRuntimes, et as BaseAddon, gt as emitReadiness, st as EventCategory } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import { execFile } from "node:child_process";
|
|
4
4
|
import { promisify } from "node:util";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
8
8
|
/**
|
|
9
9
|
* Reconcile the durable `enabledProviders` set against authoritative
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { et as BaseAddon, st as EventCategory } from "../../dist-
|
|
1
|
+
import { et as BaseAddon, st as EventCategory } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
3
3
|
/**
|
|
4
4
|
* Reconcile the durable `enabledProviders` set against authoritative
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_child_process = require("node:child_process");
|
|
8
8
|
//#region src/builtins/snapshot/snapshot.addon.ts
|
|
9
9
|
/** Default cache window for non-battery cams (seconds). 10s feels live. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errMsg, K as snapshotCapability, L as nodePin, Y as streamQualityLabel, et as BaseAddon, it as DeviceFeature, ot as DeviceType } from "../../dist-
|
|
1
|
+
import { $ as errMsg, K as snapshotCapability, L as nodePin, Y as streamQualityLabel, et as BaseAddon, it as DeviceFeature, ot as DeviceType } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
//#region src/builtins/snapshot/snapshot.addon.ts
|
|
4
4
|
/** Default cache window for non-battery cams (seconds). 10s feels live. */
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
node_fs = require_chunk.__toESM(node_fs);
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as filesystemBrowseCapability, J as storageProviderCapability, et as BaseAddon } from "../../dist-
|
|
1
|
+
import { E as filesystemBrowseCapability, J as storageProviderCapability, et as BaseAddon } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let better_sqlite3 = require("better-sqlite3");
|
|
9
9
|
better_sqlite3 = require_chunk.__toESM(better_sqlite3);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errMsg, G as settingsStoreCapability, dt as asJsonObject, et as BaseAddon, s as RUNTIME_DEFAULTS, xt as parseJsonUnknown } from "../../dist-
|
|
1
|
+
import { $ as errMsg, G as settingsStoreCapability, dt as asJsonObject, et as BaseAddon, s as RUNTIME_DEFAULTS, xt as parseJsonUnknown } from "../../dist-C7oOY4iL.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import Database from "better-sqlite3";
|
|
4
4
|
//#region src/builtins/sqlite-storage/sqlite-settings-backend.ts
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
|
9
9
|
let node_fs_promises = require("node:fs/promises");
|