@camstack/types 1.2.14 → 1.2.15

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.d.ts CHANGED
@@ -26,6 +26,8 @@ export { DisposerChain } from './disposer-chain.js';
26
26
  export { ReadinessRegistry, ReadinessTimeoutError, scopeKey, } from './readiness/readiness-registry.js';
27
27
  export { DATAPLANE_SECRET_HEADER } from './interfaces/addon-data-plane.js';
28
28
  export { expandCapMethods } from './capabilities/capability-definition.js';
29
+ export { nodePin, readNodePin } from './cap-call-context.js';
30
+ export { COLLECTION_ARRAY_METHODS, isCollectionArrayMethodName, } from './generated/collection-array-methods.js';
29
31
  export { deviceOpsCapability } from './capabilities/device-ops.cap.js';
30
32
  export { createDeviceProxy } from './generated/device-proxy.js';
31
33
  export { BaseAddon, normalizeAddonInitResult } from './addon/base-addon.js';
package/dist/addon.js CHANGED
@@ -1,8 +1,63 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BG8hQTA8.js");
2
+ const require_sleep = require("./sleep-DRg9F6JJ.js");
3
3
  const require_event_category = require("./event-category-Cdyife4p.js");
4
4
  const require_err_msg = require("./err-msg-COpsHMw2.js");
5
+ //#region src/generated/collection-array-methods.ts
6
+ /**
7
+ * AUTO-GENERATED by scripts/generate-collection-array-methods.ts — DO NOT EDIT.
8
+ *
9
+ * For every COLLECTION-mode capability, the array-returning (non-subscription)
10
+ * method names the hub fans across providers. The addon-runner uses this to
11
+ * reproduce the hub's graceful "provider skips an unimplemented collection
12
+ * method" behaviour (see child-cap-dispatch) WITHOUT importing the schema
13
+ * barrel (`ALL_CAPABILITY_DEFINITIONS`), which would cost ~144MB RSS per
14
+ * forked runner. See docs/decisions/adr-0028.md.
15
+ *
16
+ * Coverage: 16 collection caps, 28 array methods.
17
+ */
18
+ var COLLECTION_ARRAY_METHODS = Object.freeze({
19
+ "addon-pages-source": ["listPages"],
20
+ "addon-routes": ["getRoutes"],
21
+ "addon-widgets-source": ["listWidgets"],
22
+ "broker": ["list", "listProviders"],
23
+ "custom-model-registry": ["listModels"],
24
+ "device-export": ["listExposedDevices", "listSupportedDeviceKinds"],
25
+ "device-provider": ["discoverDevices", "getDevices"],
26
+ "llm": [
27
+ "getDefaults",
28
+ "getUsage",
29
+ "listModelCatalog",
30
+ "listModels",
31
+ "listNodeModels",
32
+ "listProfileKinds",
33
+ "listProfiles",
34
+ "listRuntimeNodes"
35
+ ],
36
+ "log-destination": ["query"],
37
+ "login-method": ["getLoginMethods"],
38
+ "mqtt-broker": ["listBrokers"],
39
+ "network-access": ["listEndpoints"],
40
+ "notification-output": [
41
+ "discoverTargets",
42
+ "listTargetKinds",
43
+ "listTargets"
44
+ ],
45
+ "storage-provider": ["list"],
46
+ "turn-provider": ["getTurnServers"],
47
+ "user-passkeys": ["listPasskeys"]
48
+ });
49
+ /**
50
+ * True when `method` on cap `capName` is a COLLECTION cap's array-returning
51
+ * (non-subscription) method — the schema-free runner-side equivalent of
52
+ * `isCollectionArrayMethod(capDefsByName.get(capName), method)`.
53
+ */
54
+ function isCollectionArrayMethodName(capName, method) {
55
+ const methods = COLLECTION_ARRAY_METHODS[capName];
56
+ return methods !== void 0 && methods.includes(method);
57
+ }
58
+ //#endregion
5
59
  exports.BaseAddon = require_sleep.BaseAddon;
60
+ exports.COLLECTION_ARRAY_METHODS = COLLECTION_ARRAY_METHODS;
6
61
  exports.DATAPLANE_SECRET_HEADER = require_sleep.DATAPLANE_SECRET_HEADER;
7
62
  exports.DeviceType = require_sleep.DeviceType;
8
63
  exports.DisposerChain = require_sleep.DisposerChain;
@@ -17,8 +72,11 @@ exports.deviceOpsCapability = require_sleep.deviceOpsCapability;
17
72
  exports.emitReadiness = require_sleep.emitReadiness;
18
73
  exports.errMsg = require_err_msg.errMsg;
19
74
  exports.expandCapMethods = require_sleep.expandCapMethods;
75
+ exports.isCollectionArrayMethodName = isCollectionArrayMethodName;
76
+ exports.nodePin = require_sleep.nodePin;
20
77
  exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
21
78
  exports.parseJsonUnknown = require_sleep.parseJsonUnknown;
79
+ exports.readNodePin = require_sleep.readNodePin;
22
80
  exports.scopeKey = require_sleep.scopeKey;
23
81
  exports.sleep = require_sleep.sleep;
24
82
  exports.viewerUiCapability = require_sleep.viewerUiCapability;
package/dist/addon.mjs CHANGED
@@ -1,4 +1,58 @@
1
- import { A as parseJsonUnknown, D as asString, I as scopeKey, M as ReadinessRegistry, N as ReadinessTimeoutError, S as DeviceType, T as asJsonObject, a as viewerUiCapability, bt as DisposerChain, ct as BaseAddon, ft as emitReadiness, i as deviceOpsCapability, j as DATAPLANE_SECRET_HEADER, lt as normalizeAddonInitResult, m as expandCapMethods, o as adminUiCapability, s as createDeviceProxy, t as sleep } from "./sleep-DiOnzenz.mjs";
1
+ import { A as parseJsonUnknown, Ct as DisposerChain, D as asString, F as ReadinessRegistry, I as ReadinessTimeoutError, M as nodePin, N as readNodePin, P as DATAPLANE_SECRET_HEADER, S as DeviceType, T as asJsonObject, a as viewerUiCapability, dt as BaseAddon, ft as normalizeAddonInitResult, ht as emitReadiness, i as deviceOpsCapability, m as expandCapMethods, o as adminUiCapability, s as createDeviceProxy, t as sleep, z as scopeKey } from "./sleep-C3ceNSsf.mjs";
2
2
  import { t as EventCategory } from "./event-category-BLcNejAE.mjs";
3
3
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
4
- export { BaseAddon, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, ReadinessTimeoutError, adminUiCapability, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, normalizeAddonInitResult, parseJsonUnknown, scopeKey, sleep, viewerUiCapability };
4
+ //#region src/generated/collection-array-methods.ts
5
+ /**
6
+ * AUTO-GENERATED by scripts/generate-collection-array-methods.ts — DO NOT EDIT.
7
+ *
8
+ * For every COLLECTION-mode capability, the array-returning (non-subscription)
9
+ * method names the hub fans across providers. The addon-runner uses this to
10
+ * reproduce the hub's graceful "provider skips an unimplemented collection
11
+ * method" behaviour (see child-cap-dispatch) WITHOUT importing the schema
12
+ * barrel (`ALL_CAPABILITY_DEFINITIONS`), which would cost ~144MB RSS per
13
+ * forked runner. See docs/decisions/adr-0028.md.
14
+ *
15
+ * Coverage: 16 collection caps, 28 array methods.
16
+ */
17
+ var COLLECTION_ARRAY_METHODS = Object.freeze({
18
+ "addon-pages-source": ["listPages"],
19
+ "addon-routes": ["getRoutes"],
20
+ "addon-widgets-source": ["listWidgets"],
21
+ "broker": ["list", "listProviders"],
22
+ "custom-model-registry": ["listModels"],
23
+ "device-export": ["listExposedDevices", "listSupportedDeviceKinds"],
24
+ "device-provider": ["discoverDevices", "getDevices"],
25
+ "llm": [
26
+ "getDefaults",
27
+ "getUsage",
28
+ "listModelCatalog",
29
+ "listModels",
30
+ "listNodeModels",
31
+ "listProfileKinds",
32
+ "listProfiles",
33
+ "listRuntimeNodes"
34
+ ],
35
+ "log-destination": ["query"],
36
+ "login-method": ["getLoginMethods"],
37
+ "mqtt-broker": ["listBrokers"],
38
+ "network-access": ["listEndpoints"],
39
+ "notification-output": [
40
+ "discoverTargets",
41
+ "listTargetKinds",
42
+ "listTargets"
43
+ ],
44
+ "storage-provider": ["list"],
45
+ "turn-provider": ["getTurnServers"],
46
+ "user-passkeys": ["listPasskeys"]
47
+ });
48
+ /**
49
+ * True when `method` on cap `capName` is a COLLECTION cap's array-returning
50
+ * (non-subscription) method — the schema-free runner-side equivalent of
51
+ * `isCollectionArrayMethod(capDefsByName.get(capName), method)`.
52
+ */
53
+ function isCollectionArrayMethodName(capName, method) {
54
+ const methods = COLLECTION_ARRAY_METHODS[capName];
55
+ return methods !== void 0 && methods.includes(method);
56
+ }
57
+ //#endregion
58
+ export { BaseAddon, COLLECTION_ARRAY_METHODS, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, ReadinessTimeoutError, adminUiCapability, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, isCollectionArrayMethodName, nodePin, normalizeAddonInitResult, parseJsonUnknown, readNodePin, scopeKey, sleep, viewerUiCapability };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * AUTO-GENERATED by scripts/generate-collection-array-methods.ts — DO NOT EDIT.
3
+ *
4
+ * For every COLLECTION-mode capability, the array-returning (non-subscription)
5
+ * method names the hub fans across providers. The addon-runner uses this to
6
+ * reproduce the hub's graceful "provider skips an unimplemented collection
7
+ * method" behaviour (see child-cap-dispatch) WITHOUT importing the schema
8
+ * barrel (`ALL_CAPABILITY_DEFINITIONS`), which would cost ~144MB RSS per
9
+ * forked runner. See docs/decisions/adr-0028.md.
10
+ *
11
+ * Coverage: 16 collection caps, 28 array methods.
12
+ */
13
+ export declare const COLLECTION_ARRAY_METHODS: Readonly<Record<string, readonly string[]>>;
14
+ /**
15
+ * True when `method` on cap `capName` is a COLLECTION cap's array-returning
16
+ * (non-subscription) method — the schema-free runner-side equivalent of
17
+ * `isCollectionArrayMethod(capDefsByName.get(capName), method)`.
18
+ */
19
+ export declare function isCollectionArrayMethodName(capName: string, method: string): boolean;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BG8hQTA8.js");
2
+ const require_sleep = require("./sleep-DRg9F6JJ.js");
3
3
  const require_event_category = require("./event-category-Cdyife4p.js");
4
4
  const require_enums = require("./enums.js");
5
5
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -1704,47 +1704,6 @@ var RUNTIME_DEFAULTS = {
1704
1704
  "auth.tokenExpiry": "7d"
1705
1705
  };
1706
1706
  //#endregion
1707
- //#region src/cap-call-context.ts
1708
- /**
1709
- * Per-call node pinning for `ctx.api` capability calls.
1710
- *
1711
- * A capability call normally resolves to its DEFAULT provider — a `singleton`
1712
- * cap resolves to the hub, a device-scoped cap to the device's owning node. To
1713
- * query a SPECIFIC node's provider instead (e.g. a remote agent's own
1714
- * in-process `platform-probe` hardware, which the hub cannot probe), pin the
1715
- * call to that node.
1716
- *
1717
- * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
1718
- * method args), so capability method signatures stay `nodeId`-free — node
1719
- * targeting is a property of the CALL, not of the method. The transport lifts
1720
- * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
1721
- * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
1722
- * which classifies a pinned agent node as `agent-child-forward`
1723
- * (`$agent-cap-fwd.forward` → the agent's in-process provider).
1724
- *
1725
- * Usage at a call site:
1726
- *
1727
- * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
1728
- */
1729
- /** tRPC `op.context` key carrying a per-call node pin. */
1730
- var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
1731
- /**
1732
- * Build the tRPC request options that pin a single capability call to `nodeId`.
1733
- * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
1734
- */
1735
- function nodePin(nodeId) {
1736
- return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
1737
- }
1738
- /**
1739
- * Read a per-call node pin out of a tRPC `op.context` (transport side).
1740
- * Returns the pinned nodeId, or `undefined` when no pin is present.
1741
- */
1742
- function readNodePin(context) {
1743
- if (context === null || typeof context !== "object") return void 0;
1744
- const value = Reflect.get(context, CAP_NODE_PIN_CONTEXT_KEY);
1745
- return typeof value === "string" ? value : void 0;
1746
- }
1747
- //#endregion
1748
1707
  //#region src/utils/hf-url.ts
1749
1708
  function hfModelUrl(repo, path) {
1750
1709
  return `https://huggingface.co/${repo}/resolve/main/${path}`;
@@ -33001,7 +32960,7 @@ exports.CAM_PROFILE_ORDER = require_sleep.CAM_PROFILE_ORDER;
33001
32960
  exports.CAPABILITY_NAMES = CAPABILITY_NAMES;
33002
32961
  exports.CAPABILITY_ROUTER_KEYS = CAPABILITY_ROUTER_KEYS;
33003
32962
  exports.CAP_NAMES_WITH_STATUS = CAP_NAMES_WITH_STATUS;
33004
- exports.CAP_NODE_PIN_CONTEXT_KEY = CAP_NODE_PIN_CONTEXT_KEY;
32963
+ exports.CAP_NODE_PIN_CONTEXT_KEY = require_sleep.CAP_NODE_PIN_CONTEXT_KEY;
33005
32964
  exports.CAP_PROVIDER_KIND_MAP = CAP_PROVIDER_KIND_MAP;
33006
32965
  exports.COCO_80_LABELS = COCO_80_LABELS;
33007
32966
  exports.COCO_TO_MACRO = COCO_TO_MACRO;
@@ -33738,7 +33697,7 @@ exports.mqttBrokerCapability = mqttBrokerCapability;
33738
33697
  exports.nativeObjectDetectionCapability = nativeObjectDetectionCapability;
33739
33698
  exports.networkAccessCapability = networkAccessCapability;
33740
33699
  exports.networkQualityCapability = networkQualityCapability;
33741
- exports.nodePin = nodePin;
33700
+ exports.nodePin = require_sleep.nodePin;
33742
33701
  exports.nodesCapability = nodesCapability;
33743
33702
  exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
33744
33703
  exports.normalizeUnit = normalizeUnit;
@@ -33774,7 +33733,7 @@ exports.procedureAuthKey = procedureAuthKey;
33774
33733
  exports.ptzAutotrackCapability = ptzAutotrackCapability;
33775
33734
  exports.ptzCapability = ptzCapability;
33776
33735
  exports.pythonScriptForBackend = pythonScriptForBackend;
33777
- exports.readNodePin = readNodePin;
33736
+ exports.readNodePin = require_sleep.readNodePin;
33778
33737
  exports.readinessKey = require_sleep.readinessKey;
33779
33738
  exports.rebootCapability = rebootCapability;
33780
33739
  exports.recordingCapability = recordingCapability;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as StreamSourceSchema, A as parseJsonUnknown, B as CamProfileSchema, C as asBoolean, D as asString, E as asNumber, F as readinessKey, G as DecodedFrameSchema, H as CamStreamResolutionSchema, I as scopeKey, J as FrameHandleSchema, K as EncodedPacketSchema, L as BrokerStatsSchema, M as ReadinessRegistry, N as ReadinessTimeoutError, O as parseJsonArray, P as emitDownForOwnedCaps, Q as StreamSourceEntrySchema, R as BrokerStatusSchema, S as DeviceType, T as asJsonObject, U as CameraStreamSchema, V as CamStreamKindSchema, W as DecodedAudioChunkSchema, X as ProfileSlotSchema, Y as ProfileRtspEntrySchema, Z as ProfileSlotStatusSchema, _ as resolveCapMount, _t as collectHydratedFieldValues, a as viewerUiCapability, at as makeSourceBrokerId, b as DeviceFeature, bt as DisposerChain, c as createLazyTrpcSource, ct as BaseAddon, d as DEVICE_SETTINGS_CONTRIBUTION_METHODS, dt as createEvent, et as SubscribeAudioChunksInputSchema, f as DEVICE_STATUS_METHOD, ft as emitReadiness, g as method, gt as collectHydratedFieldEntries, h as isDeviceConfigCap, ht as WELL_KNOWN_TAB_MAP, i as deviceOpsCapability, it as makeProfileBrokerId, j as DATAPLANE_SECRET_HEADER, k as parseJsonObject, l as createMirrorSource, lt as normalizeAddonInitResult, m as expandCapMethods, mt as WELL_KNOWN_TABS, n as sleepCancellable, nt as SubscribeFramesInputSchema, o as adminUiCapability, ot as parseProfileBrokerId, p as event, pt as isEvent, q as FrameHandleFormatSchema, r as RawStateResultSchema, rt as SubscribeFramesResultSchema, s as createDeviceProxy, st as selectAssignedProfileSlots, t as sleep, tt as SubscribeAudioChunksResultSchema, u as createSliceHandle, ut as createDurableState, v as systemMethod, vt as hydrateSchema, w as asJsonArray, x as DeviceRole, y as ChargingStatus, yt as resolveHydratedFieldValue, z as CAM_PROFILE_ORDER } from "./sleep-DiOnzenz.mjs";
1
+ import { $ as ProfileSlotSchema, A as parseJsonUnknown, B as BrokerStatsSchema, C as asBoolean, Ct as DisposerChain, D as asString, E as asNumber, F as ReadinessRegistry, G as CamStreamResolutionSchema, H as CAM_PROFILE_ORDER, I as ReadinessTimeoutError, J as DecodedFrameSchema, K as CameraStreamSchema, L as emitDownForOwnedCaps, M as nodePin, N as readNodePin, O as parseJsonArray, P as DATAPLANE_SECRET_HEADER, Q as ProfileRtspEntrySchema, R as readinessKey, S as DeviceType, St as resolveHydratedFieldValue, T as asJsonObject, U as CamProfileSchema, V as BrokerStatusSchema, W as CamStreamKindSchema, X as FrameHandleFormatSchema, Y as EncodedPacketSchema, Z as FrameHandleSchema, _ as resolveCapMount, _t as WELL_KNOWN_TABS, a as viewerUiCapability, at as SubscribeFramesInputSchema, b as DeviceFeature, bt as collectHydratedFieldValues, c as createLazyTrpcSource, ct as makeSourceBrokerId, d as DEVICE_SETTINGS_CONTRIBUTION_METHODS, dt as BaseAddon, et as ProfileSlotStatusSchema, f as DEVICE_STATUS_METHOD, ft as normalizeAddonInitResult, g as method, gt as isEvent, h as isDeviceConfigCap, ht as emitReadiness, i as deviceOpsCapability, it as SubscribeAudioChunksResultSchema, j as CAP_NODE_PIN_CONTEXT_KEY, k as parseJsonObject, l as createMirrorSource, lt as parseProfileBrokerId, m as expandCapMethods, mt as createEvent, n as sleepCancellable, nt as StreamSourceSchema, o as adminUiCapability, ot as SubscribeFramesResultSchema, p as event, pt as createDurableState, q as DecodedAudioChunkSchema, r as RawStateResultSchema, rt as SubscribeAudioChunksInputSchema, s as createDeviceProxy, st as makeProfileBrokerId, t as sleep, tt as StreamSourceEntrySchema, u as createSliceHandle, ut as selectAssignedProfileSlots, v as systemMethod, vt as WELL_KNOWN_TAB_MAP, w as asJsonArray, x as DeviceRole, xt as hydrateSchema, y as ChargingStatus, yt as collectHydratedFieldEntries, z as scopeKey } from "./sleep-C3ceNSsf.mjs";
2
2
  import { t as EventCategory } from "./event-category-BLcNejAE.mjs";
3
3
  import { EventSourceType } from "./enums.mjs";
4
4
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
@@ -1703,47 +1703,6 @@ var RUNTIME_DEFAULTS = {
1703
1703
  "auth.tokenExpiry": "7d"
1704
1704
  };
1705
1705
  //#endregion
1706
- //#region src/cap-call-context.ts
1707
- /**
1708
- * Per-call node pinning for `ctx.api` capability calls.
1709
- *
1710
- * A capability call normally resolves to its DEFAULT provider — a `singleton`
1711
- * cap resolves to the hub, a device-scoped cap to the device's owning node. To
1712
- * query a SPECIFIC node's provider instead (e.g. a remote agent's own
1713
- * in-process `platform-probe` hardware, which the hub cannot probe), pin the
1714
- * call to that node.
1715
- *
1716
- * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
1717
- * method args), so capability method signatures stay `nodeId`-free — node
1718
- * targeting is a property of the CALL, not of the method. The transport lifts
1719
- * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
1720
- * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
1721
- * which classifies a pinned agent node as `agent-child-forward`
1722
- * (`$agent-cap-fwd.forward` → the agent's in-process provider).
1723
- *
1724
- * Usage at a call site:
1725
- *
1726
- * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
1727
- */
1728
- /** tRPC `op.context` key carrying a per-call node pin. */
1729
- var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
1730
- /**
1731
- * Build the tRPC request options that pin a single capability call to `nodeId`.
1732
- * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
1733
- */
1734
- function nodePin(nodeId) {
1735
- return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
1736
- }
1737
- /**
1738
- * Read a per-call node pin out of a tRPC `op.context` (transport side).
1739
- * Returns the pinned nodeId, or `undefined` when no pin is present.
1740
- */
1741
- function readNodePin(context) {
1742
- if (context === null || typeof context !== "object") return void 0;
1743
- const value = Reflect.get(context, CAP_NODE_PIN_CONTEXT_KEY);
1744
- return typeof value === "string" ? value : void 0;
1745
- }
1746
- //#endregion
1747
1706
  //#region src/utils/hf-url.ts
1748
1707
  function hfModelUrl(repo, path) {
1749
1708
  return `https://huggingface.co/${repo}/resolve/main/${path}`;
@@ -1880,6 +1880,47 @@ function emitDownForOwnedCaps(registry, owned) {
1880
1880
  */
1881
1881
  var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
1882
1882
  //#endregion
1883
+ //#region src/cap-call-context.ts
1884
+ /**
1885
+ * Per-call node pinning for `ctx.api` capability calls.
1886
+ *
1887
+ * A capability call normally resolves to its DEFAULT provider — a `singleton`
1888
+ * cap resolves to the hub, a device-scoped cap to the device's owning node. To
1889
+ * query a SPECIFIC node's provider instead (e.g. a remote agent's own
1890
+ * in-process `platform-probe` hardware, which the hub cannot probe), pin the
1891
+ * call to that node.
1892
+ *
1893
+ * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
1894
+ * method args), so capability method signatures stay `nodeId`-free — node
1895
+ * targeting is a property of the CALL, not of the method. The transport lifts
1896
+ * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
1897
+ * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
1898
+ * which classifies a pinned agent node as `agent-child-forward`
1899
+ * (`$agent-cap-fwd.forward` → the agent's in-process provider).
1900
+ *
1901
+ * Usage at a call site:
1902
+ *
1903
+ * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
1904
+ */
1905
+ /** tRPC `op.context` key carrying a per-call node pin. */
1906
+ var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
1907
+ /**
1908
+ * Build the tRPC request options that pin a single capability call to `nodeId`.
1909
+ * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
1910
+ */
1911
+ function nodePin(nodeId) {
1912
+ return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
1913
+ }
1914
+ /**
1915
+ * Read a per-call node pin out of a tRPC `op.context` (transport side).
1916
+ * Returns the pinned nodeId, or `undefined` when no pin is present.
1917
+ */
1918
+ function readNodePin(context) {
1919
+ if (context === null || typeof context !== "object") return void 0;
1920
+ const value = Reflect.get(context, CAP_NODE_PIN_CONTEXT_KEY);
1921
+ return typeof value === "string" ? value : void 0;
1922
+ }
1923
+ //#endregion
1883
1924
  //#region src/utils/json-safe.ts
1884
1925
  /**
1885
1926
  * Type-safe JSON parsing helpers.
@@ -3456,4 +3497,4 @@ function sleepCancellable(ms, signal) {
3456
3497
  });
3457
3498
  }
3458
3499
  //#endregion
3459
- export { StreamSourceSchema as $, parseJsonUnknown as A, CamProfileSchema as B, asBoolean as C, asString as D, asNumber as E, readinessKey as F, DecodedFrameSchema as G, CamStreamResolutionSchema as H, scopeKey as I, FrameHandleSchema as J, EncodedPacketSchema as K, BrokerStatsSchema as L, ReadinessRegistry as M, ReadinessTimeoutError as N, parseJsonArray as O, emitDownForOwnedCaps as P, StreamSourceEntrySchema$1 as Q, BrokerStatusSchema as R, DeviceType as S, asJsonObject as T, CameraStreamSchema as U, CamStreamKindSchema as V, DecodedAudioChunkSchema as W, ProfileSlotSchema as X, ProfileRtspEntrySchema as Y, ProfileSlotStatusSchema as Z, resolveCapMount as _, collectHydratedFieldValues as _t, viewerUiCapability as a, makeSourceBrokerId as at, DeviceFeature as b, DisposerChain as bt, createLazyTrpcSource as c, BaseAddon as ct, DEVICE_SETTINGS_CONTRIBUTION_METHODS as d, createEvent as dt, SubscribeAudioChunksInputSchema as et, DEVICE_STATUS_METHOD as f, emitReadiness as ft, method as g, collectHydratedFieldEntries as gt, isDeviceConfigCap as h, WELL_KNOWN_TAB_MAP as ht, deviceOpsCapability as i, makeProfileBrokerId as it, DATAPLANE_SECRET_HEADER as j, parseJsonObject as k, createMirrorSource as l, normalizeAddonInitResult as lt, expandCapMethods as m, WELL_KNOWN_TABS as mt, sleepCancellable as n, SubscribeFramesInputSchema as nt, adminUiCapability as o, parseProfileBrokerId as ot, event as p, isEvent as pt, FrameHandleFormatSchema as q, RawStateResultSchema as r, SubscribeFramesResultSchema as rt, createDeviceProxy as s, selectAssignedProfileSlots as st, sleep as t, SubscribeAudioChunksResultSchema as tt, createSliceHandle as u, createDurableState as ut, systemMethod as v, hydrateSchema as vt, asJsonArray as w, DeviceRole as x, ChargingStatus as y, resolveHydratedFieldValue as yt, CAM_PROFILE_ORDER as z };
3500
+ export { ProfileSlotSchema as $, parseJsonUnknown as A, BrokerStatsSchema as B, asBoolean as C, DisposerChain as Ct, asString as D, asNumber as E, ReadinessRegistry as F, CamStreamResolutionSchema as G, CAM_PROFILE_ORDER as H, ReadinessTimeoutError as I, DecodedFrameSchema as J, CameraStreamSchema as K, emitDownForOwnedCaps as L, nodePin as M, readNodePin as N, parseJsonArray as O, DATAPLANE_SECRET_HEADER as P, ProfileRtspEntrySchema as Q, readinessKey as R, DeviceType as S, resolveHydratedFieldValue as St, asJsonObject as T, CamProfileSchema as U, BrokerStatusSchema as V, CamStreamKindSchema as W, FrameHandleFormatSchema as X, EncodedPacketSchema as Y, FrameHandleSchema as Z, resolveCapMount as _, WELL_KNOWN_TABS as _t, viewerUiCapability as a, SubscribeFramesInputSchema as at, DeviceFeature as b, collectHydratedFieldValues as bt, createLazyTrpcSource as c, makeSourceBrokerId as ct, DEVICE_SETTINGS_CONTRIBUTION_METHODS as d, BaseAddon as dt, ProfileSlotStatusSchema as et, DEVICE_STATUS_METHOD as f, normalizeAddonInitResult as ft, method as g, isEvent as gt, isDeviceConfigCap as h, emitReadiness as ht, deviceOpsCapability as i, SubscribeAudioChunksResultSchema as it, CAP_NODE_PIN_CONTEXT_KEY as j, parseJsonObject as k, createMirrorSource as l, parseProfileBrokerId as lt, expandCapMethods as m, createEvent as mt, sleepCancellable as n, StreamSourceSchema as nt, adminUiCapability as o, SubscribeFramesResultSchema as ot, event as p, createDurableState as pt, DecodedAudioChunkSchema as q, RawStateResultSchema as r, SubscribeAudioChunksInputSchema as rt, createDeviceProxy as s, makeProfileBrokerId as st, sleep as t, StreamSourceEntrySchema$1 as tt, createSliceHandle as u, selectAssignedProfileSlots as ut, systemMethod as v, WELL_KNOWN_TAB_MAP as vt, asJsonArray as w, DeviceRole as x, hydrateSchema as xt, ChargingStatus as y, collectHydratedFieldEntries as yt, scopeKey as z };
@@ -1880,6 +1880,47 @@ function emitDownForOwnedCaps(registry, owned) {
1880
1880
  */
1881
1881
  var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
1882
1882
  //#endregion
1883
+ //#region src/cap-call-context.ts
1884
+ /**
1885
+ * Per-call node pinning for `ctx.api` capability calls.
1886
+ *
1887
+ * A capability call normally resolves to its DEFAULT provider — a `singleton`
1888
+ * cap resolves to the hub, a device-scoped cap to the device's owning node. To
1889
+ * query a SPECIFIC node's provider instead (e.g. a remote agent's own
1890
+ * in-process `platform-probe` hardware, which the hub cannot probe), pin the
1891
+ * call to that node.
1892
+ *
1893
+ * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
1894
+ * method args), so capability method signatures stay `nodeId`-free — node
1895
+ * targeting is a property of the CALL, not of the method. The transport lifts
1896
+ * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
1897
+ * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
1898
+ * which classifies a pinned agent node as `agent-child-forward`
1899
+ * (`$agent-cap-fwd.forward` → the agent's in-process provider).
1900
+ *
1901
+ * Usage at a call site:
1902
+ *
1903
+ * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
1904
+ */
1905
+ /** tRPC `op.context` key carrying a per-call node pin. */
1906
+ var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
1907
+ /**
1908
+ * Build the tRPC request options that pin a single capability call to `nodeId`.
1909
+ * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
1910
+ */
1911
+ function nodePin(nodeId) {
1912
+ return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
1913
+ }
1914
+ /**
1915
+ * Read a per-call node pin out of a tRPC `op.context` (transport side).
1916
+ * Returns the pinned nodeId, or `undefined` when no pin is present.
1917
+ */
1918
+ function readNodePin(context) {
1919
+ if (context === null || typeof context !== "object") return void 0;
1920
+ const value = Reflect.get(context, CAP_NODE_PIN_CONTEXT_KEY);
1921
+ return typeof value === "string" ? value : void 0;
1922
+ }
1923
+ //#endregion
1883
1924
  //#region src/utils/json-safe.ts
1884
1925
  /**
1885
1926
  * Type-safe JSON parsing helpers.
@@ -3480,6 +3521,12 @@ Object.defineProperty(exports, "CAM_PROFILE_ORDER", {
3480
3521
  return CAM_PROFILE_ORDER;
3481
3522
  }
3482
3523
  });
3524
+ Object.defineProperty(exports, "CAP_NODE_PIN_CONTEXT_KEY", {
3525
+ enumerable: true,
3526
+ get: function() {
3527
+ return CAP_NODE_PIN_CONTEXT_KEY;
3528
+ }
3529
+ });
3483
3530
  Object.defineProperty(exports, "CamProfileSchema", {
3484
3531
  enumerable: true,
3485
3532
  get: function() {
@@ -3816,6 +3863,12 @@ Object.defineProperty(exports, "method", {
3816
3863
  return method;
3817
3864
  }
3818
3865
  });
3866
+ Object.defineProperty(exports, "nodePin", {
3867
+ enumerable: true,
3868
+ get: function() {
3869
+ return nodePin;
3870
+ }
3871
+ });
3819
3872
  Object.defineProperty(exports, "normalizeAddonInitResult", {
3820
3873
  enumerable: true,
3821
3874
  get: function() {
@@ -3846,6 +3899,12 @@ Object.defineProperty(exports, "parseProfileBrokerId", {
3846
3899
  return parseProfileBrokerId;
3847
3900
  }
3848
3901
  });
3902
+ Object.defineProperty(exports, "readNodePin", {
3903
+ enumerable: true,
3904
+ get: function() {
3905
+ return readNodePin;
3906
+ }
3907
+ });
3849
3908
  Object.defineProperty(exports, "readinessKey", {
3850
3909
  enumerable: true,
3851
3910
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.14",
3
+ "version": "1.2.15",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",