@camstack/system 1.2.140 → 1.2.141
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 +1 -1
- package/dist/addon-runner.mjs +1 -1
- 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/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-linked-devices.d.ts +4 -2
- package/dist/builtins/device-manager/device-manager.addon.js +210 -21
- package/dist/builtins/device-manager/device-manager.addon.mjs +210 -21
- package/dist/builtins/device-manager/device-meta-actions.d.ts +27 -0
- package/dist/builtins/device-manager/device-row-store.d.ts +21 -3
- package/dist/builtins/device-manager/fleet-read-census.d.ts +20 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.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/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.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/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.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 +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- 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-Clses4Bs.mjs → dist-6mn3LQvB.mjs} +2502 -2380
- package/dist/{dist-D5Jhh8Vk.js → dist-BNhvXrQk.js} +2502 -2380
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/kernel/transport/cap-route-resolver.d.ts +11 -1
- package/dist/kernel/transport/child-cap-protocol.d.ts +14 -0
- package/dist/{manifest-python-deps-Dxifi-o0.mjs → manifest-python-deps-D3zYlMEa.mjs} +35 -6
- package/dist/{manifest-python-deps-Bu8H1_rg.js → manifest-python-deps-DBQarwp9.js} +35 -6
- package/dist/{retired-settings-keys-Dflres-F.js → retired-settings-keys-DVgdWTd7.js} +1 -1
- package/dist/{retired-settings-keys-Cr8N6C6X.mjs → retired-settings-keys-SYwVv_Ym.mjs} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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-BNhvXrQk.js");
|
|
4
4
|
const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
|
|
5
5
|
require("./builtins/alerts/index.js");
|
|
6
6
|
const require_formatter = require("./formatter-DqAKDlvN.js");
|
|
@@ -26,7 +26,7 @@ require("./builtins/system-config/index.js");
|
|
|
26
26
|
const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
|
|
27
27
|
const require_file_data_plane = require("./file-data-plane-DO8KbxCe.js");
|
|
28
28
|
const require_tls$1 = require("./tls-u8QCJCFE.js");
|
|
29
|
-
const require_manifest_python_deps = require("./manifest-python-deps-
|
|
29
|
+
const require_manifest_python_deps = require("./manifest-python-deps-DBQarwp9.js");
|
|
30
30
|
const require_resource_monitor = require("./resource-monitor-CdnzxBLP.js");
|
|
31
31
|
const require_custom_action_registry = require("./custom-action-registry-jY0NOZK8.js");
|
|
32
32
|
let zod = require("zod");
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { At as asJsonObject$1, B as extractNestedAddonId, Bt as parseJsonObject, Ct as DEVICE_STATUS_METHOD, Dt as ReadinessRegistry, H as isArrayOutputSchema, Ht as readinessKey, It as expandCapMethods, J as lifecycleJobSchema, K as isVoidInput, Kt as EventCategory$1, Mt as asString$1, Nt as createEvent, Ot as ReadinessTimeoutError, Pt as emitDownForOwnedCaps, Q as looseSchema, St as DEVICE_SETTINGS_CONTRIBUTION_METHODS, U as isCollectionArrayMethod, Ut as resolveCapMount, Vt as parseJsonUnknown$1, W as isObjectInput, Wt as scopeKey, Z as logLevelAtMost, at as resolveMethodAuth, ct as scopesAllowDeviceCap, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, it as procedureAuthKey, jt as asNumber, q as kebabToCamel, st as scopesAllowAddon, t as ALL_CAPABILITY_DEFINITIONS, tt as objectInputDeclaresAddonId, xt as DATAPLANE_SECRET_HEADER$1, y as addonSettingsCapability, yt as errMsg$1 } from "./dist-
|
|
2
|
+
import { At as asJsonObject$1, B as extractNestedAddonId, Bt as parseJsonObject, Ct as DEVICE_STATUS_METHOD, Dt as ReadinessRegistry, H as isArrayOutputSchema, Ht as readinessKey, It as expandCapMethods, J as lifecycleJobSchema, K as isVoidInput, Kt as EventCategory$1, Mt as asString$1, Nt as createEvent, Ot as ReadinessTimeoutError, Pt as emitDownForOwnedCaps, Q as looseSchema, St as DEVICE_SETTINGS_CONTRIBUTION_METHODS, U as isCollectionArrayMethod, Ut as resolveCapMount, Vt as parseJsonUnknown$1, W as isObjectInput, Wt as scopeKey, Z as logLevelAtMost, at as resolveMethodAuth, ct as scopesAllowDeviceCap, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, it as procedureAuthKey, jt as asNumber, q as kebabToCamel, st as scopesAllowAddon, t as ALL_CAPABILITY_DEFINITIONS, tt as objectInputDeclaresAddonId, xt as DATAPLANE_SECRET_HEADER$1, y as addonSettingsCapability, yt as errMsg$1 } from "./dist-6mn3LQvB.mjs";
|
|
3
3
|
import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
|
|
4
4
|
import "./builtins/alerts/index.mjs";
|
|
5
5
|
import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
|
|
@@ -25,7 +25,7 @@ import "./builtins/system-config/index.mjs";
|
|
|
25
25
|
import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
|
|
26
26
|
import { a as parseTokenizedUrl, c as collectModelFiles, d as downloadModel, f as ensureModel, h as isModelDownloaded, i as parseRangeHeader, l as deleteModelFromDisk, m as getModelFilePath, n as contentTypeFor, o as resolveFilePath, p as fetchJson, r as createAuthenticatedFileServer, s as ModelDownloadService, t as createFileDataPlaneHandler, u as downloadFile } from "./file-data-plane-BhKdxJgf.mjs";
|
|
27
27
|
import { C as registerLanHttpHandler, S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, b as bindPendingLanHttp, c as loadTlsCert, d as collectCertIdentity, f as CA_VALIDITY_DAYS, g as evaluateExistingCert, h as SERVER_AUTH_OID, i as writeExtraSans, l as reissueTlsLeaf, m as MAX_LEAF_VALIDITY_DAYS, n as readTlsAccessStatus, o as validateUploadedTls, p as LEAF_RENEWAL_WINDOW_DAYS, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, u as CA_COMMON_NAME, v as allFamiliesListenHost, x as closeLanHttp, y as applyLanHttp } from "./tls-CQhPGSJm.mjs";
|
|
28
|
-
import { $ as buildUdsNativeCapProxy, A as createParentUnownedCallHandler, At as createV8Reclaimer, B as AGENT_CAP_FWD_SERVICE, C as brokerTransportLink, Ct as createAddonDataPlaneFacility, D as HUB_CAP_FWD_ACTION, Dt as HEAP_WATCH_WARN_RATIO, E as localProviderLink, Et as HEAP_WATCH_INTERVAL_MS, F as createUdsLoggerWithControl, G as createLocalTransport, H as CapRouteError, I as LocalChildClient, J as SocketChannel, K as UdsLocalTransportClient, L as LocalChildRegistry, M as createUdsEventBus, Mt as startHeapWatch, N as udsChildLogToWorkerEntry, Nt as startRunnerHeapWatch, O as HUB_CAP_FWD_SERVICE, Ot as RUNNER_HEAP_WATCH_INTERVAL_MS, P as createUdsLogger, Pt as strandedMb, Q as buildNativeCapProxy, R as UDS_NO_ROUTE_PREFIX, S as brokerCallForCap, St as runNpm, T as ipcParentLink, Tt as HEAP_RECLAIM_TRIGGER_MB, U as classifyCapRoute, V as CapRouteResolver, W as callWithServiceDiscovery, X as FrameDecoder, Y as localEndpointPath, Z as encodeFrame, _ as createKernelHwAccel, _t as CapabilityUnavailableError, a as getWorkerDeviceRegistry, at as createAddonService, b as __resetCapUsageRegistryForTests, bt as resolveAddonClass, c as setHubConnected, ct as capActionName, d as getBrokerEventBus, dt as capServiceName, et as createBrokerDeviceManagerApi, f as getMoleculerEventStats, ft as parseCapAction, g as AddonDepsManager, gt as CapabilityHandle, h as subscribePassthrough, ht as DeviceRegistry, i as createUdsAddonContext, j as createUdsEventBridge, jt as shouldReclaim, k as createHubCapForwardService, kt as buildHeapSample, l as EVENT_TOPIC_PREFIX, lt as capActionSuffix, m as setNodeEventInterest, mt as serializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as validateProviderRegistrations, p as registerEventBusService, pt as deserializeTypedArrays, q as UdsLocalTransportServer, r as createAddonContext, rt as mountNativeCapService, s as getOrInitReadinessRegistryForClient, st as NATIVE_PROVIDER_SERVICE_INFIX, t as installManifestPythonDeps, u as clusterEventTopic, ut as capBareAction, v as resolveHwAccel, vt as copyBundledNativeModules, w as buildLinkChain, wt as HEAP_RECLAIM_MIN_INTERVAL_MS, x as getCapUsageRegistry, xt as resolveNpmInvocation, y as CapUsageRegistry, yt as installManifestNativeDeps, z as AGENT_CAP_FWD_ACTION } from "./manifest-python-deps-
|
|
28
|
+
import { $ as buildUdsNativeCapProxy, A as createParentUnownedCallHandler, At as createV8Reclaimer, B as AGENT_CAP_FWD_SERVICE, C as brokerTransportLink, Ct as createAddonDataPlaneFacility, D as HUB_CAP_FWD_ACTION, Dt as HEAP_WATCH_WARN_RATIO, E as localProviderLink, Et as HEAP_WATCH_INTERVAL_MS, F as createUdsLoggerWithControl, G as createLocalTransport, H as CapRouteError, I as LocalChildClient, J as SocketChannel, K as UdsLocalTransportClient, L as LocalChildRegistry, M as createUdsEventBus, Mt as startHeapWatch, N as udsChildLogToWorkerEntry, Nt as startRunnerHeapWatch, O as HUB_CAP_FWD_SERVICE, Ot as RUNNER_HEAP_WATCH_INTERVAL_MS, P as createUdsLogger, Pt as strandedMb, Q as buildNativeCapProxy, R as UDS_NO_ROUTE_PREFIX, S as brokerCallForCap, St as runNpm, T as ipcParentLink, Tt as HEAP_RECLAIM_TRIGGER_MB, U as classifyCapRoute, V as CapRouteResolver, W as callWithServiceDiscovery, X as FrameDecoder, Y as localEndpointPath, Z as encodeFrame, _ as createKernelHwAccel, _t as CapabilityUnavailableError, a as getWorkerDeviceRegistry, at as createAddonService, b as __resetCapUsageRegistryForTests, bt as resolveAddonClass, c as setHubConnected, ct as capActionName, d as getBrokerEventBus, dt as capServiceName, et as createBrokerDeviceManagerApi, f as getMoleculerEventStats, ft as parseCapAction, g as AddonDepsManager, gt as CapabilityHandle, h as subscribePassthrough, ht as DeviceRegistry, i as createUdsAddonContext, j as createUdsEventBridge, jt as shouldReclaim, k as createHubCapForwardService, kt as buildHeapSample, l as EVENT_TOPIC_PREFIX, lt as capActionSuffix, m as setNodeEventInterest, mt as serializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as validateProviderRegistrations, p as registerEventBusService, pt as deserializeTypedArrays, q as UdsLocalTransportServer, r as createAddonContext, rt as mountNativeCapService, s as getOrInitReadinessRegistryForClient, st as NATIVE_PROVIDER_SERVICE_INFIX, t as installManifestPythonDeps, u as clusterEventTopic, ut as capBareAction, v as resolveHwAccel, vt as copyBundledNativeModules, w as buildLinkChain, wt as HEAP_RECLAIM_MIN_INTERVAL_MS, x as getCapUsageRegistry, xt as resolveNpmInvocation, y as CapUsageRegistry, yt as installManifestNativeDeps, z as AGENT_CAP_FWD_ACTION } from "./manifest-python-deps-D3zYlMEa.mjs";
|
|
29
29
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-BWmQ5i-o.mjs";
|
|
30
30
|
import { t as CustomActionRegistry } from "./custom-action-registry-F__gp_VX.mjs";
|
|
31
31
|
import { z } from "zod";
|
|
@@ -193,8 +193,18 @@ export declare class CapRouteResolver {
|
|
|
193
193
|
* `hub-local-uds` caller that already knows the addonId (`buildCapCallFn`)
|
|
194
194
|
* talks to `LocalChildRegistry.callCapOnChild` directly rather than through
|
|
195
195
|
* `dispatch`.
|
|
196
|
+
* @param callerAddonId Optional out-of-band CALLER-identity hint — the
|
|
197
|
+
* addon that ORIGINATED the call, distinct from `addonId` above (which
|
|
198
|
+
* names the resolved PROVIDER, not the caller). Set by
|
|
199
|
+
* `onUnownedCall` from `CapCallInput.callerAddonId`
|
|
200
|
+
* (`LocalChildRegistry` stamped it off the registered `childId`). Only
|
|
201
|
+
* the `hub-in-process` branch consumes it — merged into `args` so a
|
|
202
|
+
* diagnostic tool deep in that provider (e.g. device-manager's
|
|
203
|
+
* fleet-read census) can read it without every provider method changing
|
|
204
|
+
* signature, the same "extra field the provider destructures or
|
|
205
|
+
* ignores" convention `nodeId` already uses on this path.
|
|
196
206
|
*/
|
|
197
|
-
dispatch(route: CapRoute, method: string, args: unknown, addonId?: string): Promise<unknown>;
|
|
207
|
+
dispatch(route: CapRoute, method: string, args: unknown, addonId?: string, callerAddonId?: string): Promise<unknown>;
|
|
198
208
|
/**
|
|
199
209
|
* Inner dispatch: may throw CapRouteError (validation failures) or arbitrary
|
|
200
210
|
* transport errors. The outer `dispatch` wraps non-CapRouteErrors.
|
|
@@ -136,6 +136,20 @@ export interface CapCallMessage {
|
|
|
136
136
|
* the child dispatch falls back to its sole provider for the cap.
|
|
137
137
|
*/
|
|
138
138
|
readonly addonId?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Out-of-band CALLER-identity hint — the addon that ORIGINATED this call,
|
|
141
|
+
* as distinct from {@link addonId} (which names the resolved PROVIDER).
|
|
142
|
+
* Set ONLY by `LocalChildRegistry` when it turns a registered child's
|
|
143
|
+
* `cap-call-out` into a `CapCallInput` for `onUnownedCall`: the parent
|
|
144
|
+
* already knows which `childId` sent the message (it owns the UDS
|
|
145
|
+
* connection the frame arrived on), and stamps it here rather than
|
|
146
|
+
* trusting anything the child claims in its `args`. Absent for a call that
|
|
147
|
+
* did not arrive over the cap channel (hub-in-process, HTTP/tRPC) — those
|
|
148
|
+
* callers are attributed by other means (see
|
|
149
|
+
* `fleet-read-census.ts#siteOf`). A provider that does not care about its
|
|
150
|
+
* caller simply never reads it.
|
|
151
|
+
*/
|
|
152
|
+
readonly callerAddonId?: string;
|
|
139
153
|
/**
|
|
140
154
|
* Native-only routing hint — see {@link CapCallOutMessage.native}. Carried
|
|
141
155
|
* here because `CapCallInput` (the type every parent-side router takes) is
|
|
@@ -4735,6 +4735,24 @@ function extractNodeId(args) {
|
|
|
4735
4735
|
const raw = Reflect.get(args, "nodeId");
|
|
4736
4736
|
return typeof raw === "string" && raw.length > 0 ? raw : void 0;
|
|
4737
4737
|
}
|
|
4738
|
+
/**
|
|
4739
|
+
* Merge `callerAddonId` into `args` as an extra field — the SAME "provider
|
|
4740
|
+
* destructures what it needs and ignores the rest" convention
|
|
4741
|
+
* {@link extractNodeId} already relies on for the inline `nodeId` pin.
|
|
4742
|
+
* `undefined` (the overwhelmingly common case: no caller hint, or the census
|
|
4743
|
+
* consuming it is disarmed) returns `args` unchanged — no allocation. A
|
|
4744
|
+
* non-object `args` (or `null`/array) is returned unchanged too: there is
|
|
4745
|
+
* nowhere to attach an extra key without changing the payload's shape, and a
|
|
4746
|
+
* provider taking a bare value never reads `callerAddonId` off it anyway.
|
|
4747
|
+
*/
|
|
4748
|
+
function withCallerAddonId(args, callerAddonId) {
|
|
4749
|
+
if (callerAddonId === void 0) return args;
|
|
4750
|
+
if (args === null || typeof args !== "object" || Array.isArray(args)) return args;
|
|
4751
|
+
return {
|
|
4752
|
+
...args,
|
|
4753
|
+
callerAddonId
|
|
4754
|
+
};
|
|
4755
|
+
}
|
|
4738
4756
|
var CapRouteResolver = class {
|
|
4739
4757
|
hubNodeId;
|
|
4740
4758
|
broker;
|
|
@@ -4802,10 +4820,20 @@ var CapRouteResolver = class {
|
|
|
4802
4820
|
* `hub-local-uds` caller that already knows the addonId (`buildCapCallFn`)
|
|
4803
4821
|
* talks to `LocalChildRegistry.callCapOnChild` directly rather than through
|
|
4804
4822
|
* `dispatch`.
|
|
4823
|
+
* @param callerAddonId Optional out-of-band CALLER-identity hint — the
|
|
4824
|
+
* addon that ORIGINATED the call, distinct from `addonId` above (which
|
|
4825
|
+
* names the resolved PROVIDER, not the caller). Set by
|
|
4826
|
+
* `onUnownedCall` from `CapCallInput.callerAddonId`
|
|
4827
|
+
* (`LocalChildRegistry` stamped it off the registered `childId`). Only
|
|
4828
|
+
* the `hub-in-process` branch consumes it — merged into `args` so a
|
|
4829
|
+
* diagnostic tool deep in that provider (e.g. device-manager's
|
|
4830
|
+
* fleet-read census) can read it without every provider method changing
|
|
4831
|
+
* signature, the same "extra field the provider destructures or
|
|
4832
|
+
* ignores" convention `nodeId` already uses on this path.
|
|
4805
4833
|
*/
|
|
4806
|
-
async dispatch(route, method, args, addonId) {
|
|
4834
|
+
async dispatch(route, method, args, addonId, callerAddonId) {
|
|
4807
4835
|
try {
|
|
4808
|
-
return await this.dispatchInner(route, method, args, addonId);
|
|
4836
|
+
return await this.dispatchInner(route, method, args, addonId, callerAddonId);
|
|
4809
4837
|
} catch (err) {
|
|
4810
4838
|
if (err instanceof CapRouteError) throw err;
|
|
4811
4839
|
const nodeId = this.routeNodeId(route);
|
|
@@ -4824,9 +4852,9 @@ var CapRouteResolver = class {
|
|
|
4824
4852
|
* Inner dispatch: may throw CapRouteError (validation failures) or arbitrary
|
|
4825
4853
|
* transport errors. The outer `dispatch` wraps non-CapRouteErrors.
|
|
4826
4854
|
*/
|
|
4827
|
-
async dispatchInner(route, method, args, addonId) {
|
|
4855
|
+
async dispatchInner(route, method, args, addonId, callerAddonId) {
|
|
4828
4856
|
switch (route.kind) {
|
|
4829
|
-
case "hub-in-process": return route.ref.invoke(method, args);
|
|
4857
|
+
case "hub-in-process": return route.ref.invoke(method, withCallerAddonId(args, callerAddonId));
|
|
4830
4858
|
case "hub-local-uds": {
|
|
4831
4859
|
const registry = this.hubLocalRegistry;
|
|
4832
4860
|
if (registry === null) throw new CapRouteError(route.capName, method, {
|
|
@@ -5368,7 +5396,8 @@ var LocalChildRegistry = class {
|
|
|
5368
5396
|
args: out.args,
|
|
5369
5397
|
...out.deviceId !== void 0 ? { deviceId: out.deviceId } : {},
|
|
5370
5398
|
...out.nodeId !== void 0 ? { nodeId: out.nodeId } : {},
|
|
5371
|
-
...out.native === true ? { native: true } : {}
|
|
5399
|
+
...out.native === true ? { native: true } : {},
|
|
5400
|
+
...childId !== null ? { callerAddonId: childId } : {}
|
|
5372
5401
|
};
|
|
5373
5402
|
const pinnedNodeId = out.nodeId ?? extractNodeId(out.args);
|
|
5374
5403
|
const pinTargetsThisNode = pinnedNodeId !== void 0 && this.ownNodeId !== void 0 && pinnedNodeId === this.ownNodeId;
|
|
@@ -5977,7 +6006,7 @@ function createParentUnownedCallHandler(deps) {
|
|
|
5977
6006
|
...nodeId !== void 0 ? { nodeId } : {},
|
|
5978
6007
|
...deviceId !== void 0 ? { deviceId } : {}
|
|
5979
6008
|
});
|
|
5980
|
-
return await resolver.dispatch(route, input.method, input.args);
|
|
6009
|
+
return input.callerAddonId !== void 0 ? await resolver.dispatch(route, input.method, input.args, void 0, input.callerAddonId) : await resolver.dispatch(route, input.method, input.args);
|
|
5981
6010
|
} catch (err) {
|
|
5982
6011
|
if (!(err instanceof CapRouteError) || err.reason !== "no-provider") throw err;
|
|
5983
6012
|
}
|
|
@@ -4739,6 +4739,24 @@ function extractNodeId(args) {
|
|
|
4739
4739
|
const raw = Reflect.get(args, "nodeId");
|
|
4740
4740
|
return typeof raw === "string" && raw.length > 0 ? raw : void 0;
|
|
4741
4741
|
}
|
|
4742
|
+
/**
|
|
4743
|
+
* Merge `callerAddonId` into `args` as an extra field — the SAME "provider
|
|
4744
|
+
* destructures what it needs and ignores the rest" convention
|
|
4745
|
+
* {@link extractNodeId} already relies on for the inline `nodeId` pin.
|
|
4746
|
+
* `undefined` (the overwhelmingly common case: no caller hint, or the census
|
|
4747
|
+
* consuming it is disarmed) returns `args` unchanged — no allocation. A
|
|
4748
|
+
* non-object `args` (or `null`/array) is returned unchanged too: there is
|
|
4749
|
+
* nowhere to attach an extra key without changing the payload's shape, and a
|
|
4750
|
+
* provider taking a bare value never reads `callerAddonId` off it anyway.
|
|
4751
|
+
*/
|
|
4752
|
+
function withCallerAddonId(args, callerAddonId) {
|
|
4753
|
+
if (callerAddonId === void 0) return args;
|
|
4754
|
+
if (args === null || typeof args !== "object" || Array.isArray(args)) return args;
|
|
4755
|
+
return {
|
|
4756
|
+
...args,
|
|
4757
|
+
callerAddonId
|
|
4758
|
+
};
|
|
4759
|
+
}
|
|
4742
4760
|
var CapRouteResolver = class {
|
|
4743
4761
|
hubNodeId;
|
|
4744
4762
|
broker;
|
|
@@ -4806,10 +4824,20 @@ var CapRouteResolver = class {
|
|
|
4806
4824
|
* `hub-local-uds` caller that already knows the addonId (`buildCapCallFn`)
|
|
4807
4825
|
* talks to `LocalChildRegistry.callCapOnChild` directly rather than through
|
|
4808
4826
|
* `dispatch`.
|
|
4827
|
+
* @param callerAddonId Optional out-of-band CALLER-identity hint — the
|
|
4828
|
+
* addon that ORIGINATED the call, distinct from `addonId` above (which
|
|
4829
|
+
* names the resolved PROVIDER, not the caller). Set by
|
|
4830
|
+
* `onUnownedCall` from `CapCallInput.callerAddonId`
|
|
4831
|
+
* (`LocalChildRegistry` stamped it off the registered `childId`). Only
|
|
4832
|
+
* the `hub-in-process` branch consumes it — merged into `args` so a
|
|
4833
|
+
* diagnostic tool deep in that provider (e.g. device-manager's
|
|
4834
|
+
* fleet-read census) can read it without every provider method changing
|
|
4835
|
+
* signature, the same "extra field the provider destructures or
|
|
4836
|
+
* ignores" convention `nodeId` already uses on this path.
|
|
4809
4837
|
*/
|
|
4810
|
-
async dispatch(route, method, args, addonId) {
|
|
4838
|
+
async dispatch(route, method, args, addonId, callerAddonId) {
|
|
4811
4839
|
try {
|
|
4812
|
-
return await this.dispatchInner(route, method, args, addonId);
|
|
4840
|
+
return await this.dispatchInner(route, method, args, addonId, callerAddonId);
|
|
4813
4841
|
} catch (err) {
|
|
4814
4842
|
if (err instanceof CapRouteError) throw err;
|
|
4815
4843
|
const nodeId = this.routeNodeId(route);
|
|
@@ -4828,9 +4856,9 @@ var CapRouteResolver = class {
|
|
|
4828
4856
|
* Inner dispatch: may throw CapRouteError (validation failures) or arbitrary
|
|
4829
4857
|
* transport errors. The outer `dispatch` wraps non-CapRouteErrors.
|
|
4830
4858
|
*/
|
|
4831
|
-
async dispatchInner(route, method, args, addonId) {
|
|
4859
|
+
async dispatchInner(route, method, args, addonId, callerAddonId) {
|
|
4832
4860
|
switch (route.kind) {
|
|
4833
|
-
case "hub-in-process": return route.ref.invoke(method, args);
|
|
4861
|
+
case "hub-in-process": return route.ref.invoke(method, withCallerAddonId(args, callerAddonId));
|
|
4834
4862
|
case "hub-local-uds": {
|
|
4835
4863
|
const registry = this.hubLocalRegistry;
|
|
4836
4864
|
if (registry === null) throw new CapRouteError(route.capName, method, {
|
|
@@ -5372,7 +5400,8 @@ var LocalChildRegistry = class {
|
|
|
5372
5400
|
args: out.args,
|
|
5373
5401
|
...out.deviceId !== void 0 ? { deviceId: out.deviceId } : {},
|
|
5374
5402
|
...out.nodeId !== void 0 ? { nodeId: out.nodeId } : {},
|
|
5375
|
-
...out.native === true ? { native: true } : {}
|
|
5403
|
+
...out.native === true ? { native: true } : {},
|
|
5404
|
+
...childId !== null ? { callerAddonId: childId } : {}
|
|
5376
5405
|
};
|
|
5377
5406
|
const pinnedNodeId = out.nodeId ?? extractNodeId(out.args);
|
|
5378
5407
|
const pinTargetsThisNode = pinnedNodeId !== void 0 && this.ownNodeId !== void 0 && pinnedNodeId === this.ownNodeId;
|
|
@@ -5981,7 +6010,7 @@ function createParentUnownedCallHandler(deps) {
|
|
|
5981
6010
|
...nodeId !== void 0 ? { nodeId } : {},
|
|
5982
6011
|
...deviceId !== void 0 ? { deviceId } : {}
|
|
5983
6012
|
});
|
|
5984
|
-
return await resolver.dispatch(route, input.method, input.args);
|
|
6013
|
+
return input.callerAddonId !== void 0 ? await resolver.dispatch(route, input.method, input.args, void 0, input.callerAddonId) : await resolver.dispatch(route, input.method, input.args);
|
|
5985
6014
|
} catch (err) {
|
|
5986
6015
|
if (!(err instanceof CapRouteError) || err.reason !== "no-provider") throw err;
|
|
5987
6016
|
}
|