@camstack/types 1.1.2 → 1.1.4

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.
@@ -229,9 +229,17 @@ export declare abstract class BaseAddon<TConfig extends object = Record<string,
229
229
  */
230
230
  private emitReadinessForProviders;
231
231
  /**
232
- * Resolve the shared models directory path via the storage capability.
233
- * Falls back to `camstack-data/models` if storage is unavailable.
234
- * Used by inference addons (detection-pipeline, audio-classifier, embedding-encoder).
232
+ * Resolve the shared, node-local models directory: `<nodeDataDir>/models`.
233
+ *
234
+ * This is the SINGLE centralized models-dir resolver for every inference addon
235
+ * (detection-pipeline, audio-analyzer, embedding-encoder, model-studio). It is
236
+ * anchored at the node's own writable data root (`ctx.nodeDataDir`, i.e.
237
+ * `CAMSTACK_DATA` ?? the kernel boot dir) — never the hub-singleton `storage`
238
+ * cap, which returns the hub's `/data/models` to every node and breaks any node
239
+ * whose real data dir differs (e.g. the macOS electron agent).
240
+ *
241
+ * `node:path`/`node:fs` are imported dynamically so the `@camstack/types` root
242
+ * barrel (re-exported into browser bundles) stays free of node builtins.
235
243
  */
236
244
  protected resolveModelsDir(): Promise<string>;
237
245
  /**
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DQ586nj1.js");
2
+ const require_sleep = require("./sleep-C9nrFlOu.js");
3
3
  const require_err_msg = require("./err-msg-COpsHMw2.js");
4
4
  exports.BaseAddon = require_sleep.BaseAddon;
5
5
  exports.DATAPLANE_SECRET_HEADER = require_sleep.DATAPLANE_SECRET_HEADER;
package/dist/addon.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { A as ReadinessTimeoutError, D as parseJsonUnknown, N as scopeKey, O as DATAPLANE_SECRET_HEADER, S as asJsonObject, a as adminUiCapability, at as BaseAddon, ht as DisposerChain, i as deviceOpsCapability, k as ReadinessRegistry, lt as emitReadiness, mt as EventCategory, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, t as sleep, w as asString, y as DeviceType } from "./sleep-BV7rLc6Y.mjs";
1
+ import { A as ReadinessTimeoutError, D as parseJsonUnknown, N as scopeKey, O as DATAPLANE_SECRET_HEADER, S as asJsonObject, a as adminUiCapability, at as BaseAddon, ht as DisposerChain, i as deviceOpsCapability, k as ReadinessRegistry, lt as emitReadiness, mt as EventCategory, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, t as sleep, w as asString, y as DeviceType } from "./sleep-_J5S7OEP.mjs";
2
2
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
3
3
  export { BaseAddon, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, ReadinessTimeoutError, adminUiCapability, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, normalizeAddonInitResult, parseJsonUnknown, scopeKey, sleep };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DQ586nj1.js");
2
+ const require_sleep = require("./sleep-C9nrFlOu.js");
3
3
  const require_err_msg = require("./err-msg-COpsHMw2.js");
4
4
  let zod = require("zod");
5
5
  //#region src/health/wiring-health.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as SubscribeFramesInputSchema, A as ReadinessTimeoutError, B as CameraStreamSchema, C as asNumber, D as parseJsonUnknown, E as parseJsonObject, F as BrokerStatusSchema, G as FrameHandleSchema, H as DecodedFrameSchema, I as CAM_PROFILE_ORDER, J as ProfileSlotStatusSchema, K as ProfileRtspEntrySchema, L as CamProfileSchema, M as readinessKey, N as scopeKey, O as DATAPLANE_SECRET_HEADER, P as BrokerStatsSchema, Q as SubscribeAudioChunksResultSchema, R as CamStreamKindSchema, S as asJsonObject, T as parseJsonArray, U as EncodedPacketSchema, V as DecodedAudioChunkSchema, W as FrameHandleFormatSchema, X as StreamSourceSchema, Y as StreamSourceEntrySchema, Z as SubscribeAudioChunksInputSchema, _ as DeviceFeature, a as adminUiCapability, at as BaseAddon, b as asBoolean, c as createMirrorSource, ct as createEvent, d as DEVICE_STATUS_METHOD, dt as WELL_KNOWN_TABS, et as SubscribeFramesResultSchema, f as event, ft as WELL_KNOWN_TAB_MAP, g as ChargingStatus, h as method, ht as DisposerChain, i as deviceOpsCapability, it as selectAssignedProfileSlots, j as emitDownForOwnedCaps, k as ReadinessRegistry, l as createSliceHandle, lt as emitReadiness, m as isDeviceConfigCap, mt as EventCategory, n as sleepCancellable, nt as makeSourceBrokerId, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, pt as hydrateSchema, q as ProfileSlotSchema, r as RawStateResultSchema, rt as parseProfileBrokerId, s as createLazyTrpcSource, st as createDurableState, t as sleep, tt as makeProfileBrokerId, u as DEVICE_SETTINGS_CONTRIBUTION_METHODS, ut as isEvent, v as DeviceRole, w as asString, x as asJsonArray, y as DeviceType, z as CamStreamResolutionSchema } from "./sleep-BV7rLc6Y.mjs";
1
+ import { $ as SubscribeFramesInputSchema, A as ReadinessTimeoutError, B as CameraStreamSchema, C as asNumber, D as parseJsonUnknown, E as parseJsonObject, F as BrokerStatusSchema, G as FrameHandleSchema, H as DecodedFrameSchema, I as CAM_PROFILE_ORDER, J as ProfileSlotStatusSchema, K as ProfileRtspEntrySchema, L as CamProfileSchema, M as readinessKey, N as scopeKey, O as DATAPLANE_SECRET_HEADER, P as BrokerStatsSchema, Q as SubscribeAudioChunksResultSchema, R as CamStreamKindSchema, S as asJsonObject, T as parseJsonArray, U as EncodedPacketSchema, V as DecodedAudioChunkSchema, W as FrameHandleFormatSchema, X as StreamSourceSchema, Y as StreamSourceEntrySchema, Z as SubscribeAudioChunksInputSchema, _ as DeviceFeature, a as adminUiCapability, at as BaseAddon, b as asBoolean, c as createMirrorSource, ct as createEvent, d as DEVICE_STATUS_METHOD, dt as WELL_KNOWN_TABS, et as SubscribeFramesResultSchema, f as event, ft as WELL_KNOWN_TAB_MAP, g as ChargingStatus, h as method, ht as DisposerChain, i as deviceOpsCapability, it as selectAssignedProfileSlots, j as emitDownForOwnedCaps, k as ReadinessRegistry, l as createSliceHandle, lt as emitReadiness, m as isDeviceConfigCap, mt as EventCategory, n as sleepCancellable, nt as makeSourceBrokerId, o as createDeviceProxy, ot as normalizeAddonInitResult, p as expandCapMethods, pt as hydrateSchema, q as ProfileSlotSchema, r as RawStateResultSchema, rt as parseProfileBrokerId, s as createLazyTrpcSource, st as createDurableState, t as sleep, tt as makeProfileBrokerId, u as DEVICE_SETTINGS_CONTRIBUTION_METHODS, ut as isEvent, v as DeviceRole, w as asString, x as asJsonArray, y as DeviceType, z as CamStreamResolutionSchema } from "./sleep-_J5S7OEP.mjs";
2
2
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/health/wiring-health.ts
@@ -395,10 +395,17 @@ export interface AddonContext<TConfig = Record<string, unknown>> {
395
395
  readonly addonConfig: Readonly<TConfig>;
396
396
  /**
397
397
  * Private data directory for this addon.
398
- * Resolved via storageProvider.resolve('addons-data', '{addonId}/').
399
- * The addon owns this directory exclusively.
398
+ * `<nodeDataDir>/addons-data/{addonId}` — the addon owns it exclusively.
400
399
  */
401
400
  readonly dataDir: string;
401
+ /**
402
+ * Node-local data ROOT for this node (`CAMSTACK_DATA` ?? the kernel boot dir).
403
+ * The single, centralized anchor for internal per-node working directories
404
+ * (models, logs, addons-data). Always writable on the local node — unlike the
405
+ * hub-singleton `storage` cap, which returns the hub's path to every node.
406
+ * Use this (never `api.storage.resolve`) for internal node-local dirs.
407
+ */
408
+ readonly nodeDataDir: string;
402
409
  /** Infrastructure services provided by the kernel. */
403
410
  readonly kernel: IKernelServices;
404
411
  /**
@@ -1211,15 +1211,24 @@ var BaseAddon = class {
1211
1211
  } catch {}
1212
1212
  }
1213
1213
  /**
1214
- * Resolve the shared models directory path via the storage capability.
1215
- * Falls back to `camstack-data/models` if storage is unavailable.
1216
- * Used by inference addons (detection-pipeline, audio-classifier, embedding-encoder).
1214
+ * Resolve the shared, node-local models directory: `<nodeDataDir>/models`.
1215
+ *
1216
+ * This is the SINGLE centralized models-dir resolver for every inference addon
1217
+ * (detection-pipeline, audio-analyzer, embedding-encoder, model-studio). It is
1218
+ * anchored at the node's own writable data root (`ctx.nodeDataDir`, i.e.
1219
+ * `CAMSTACK_DATA` ?? the kernel boot dir) — never the hub-singleton `storage`
1220
+ * cap, which returns the hub's `/data/models` to every node and breaks any node
1221
+ * whose real data dir differs (e.g. the macOS electron agent).
1222
+ *
1223
+ * `node:path`/`node:fs` are imported dynamically so the `@camstack/types` root
1224
+ * barrel (re-exported into browser bundles) stays free of node builtins.
1217
1225
  */
1218
1226
  async resolveModelsDir() {
1219
- return this.ctx.api.storage.resolve.query({
1220
- location: "models",
1221
- relativePath: ""
1222
- }).catch(() => "camstack-data/models");
1227
+ const { join } = await import("node:path");
1228
+ const { promises: fsp } = await import("node:fs");
1229
+ const dir = join(this.ctx.nodeDataDir, "models");
1230
+ await fsp.mkdir(dir, { recursive: true });
1231
+ return dir;
1223
1232
  }
1224
1233
  /**
1225
1234
  * Access the runtime capability registry for in-process provider lookups.
@@ -1211,15 +1211,24 @@ var BaseAddon = class {
1211
1211
  } catch {}
1212
1212
  }
1213
1213
  /**
1214
- * Resolve the shared models directory path via the storage capability.
1215
- * Falls back to `camstack-data/models` if storage is unavailable.
1216
- * Used by inference addons (detection-pipeline, audio-classifier, embedding-encoder).
1214
+ * Resolve the shared, node-local models directory: `<nodeDataDir>/models`.
1215
+ *
1216
+ * This is the SINGLE centralized models-dir resolver for every inference addon
1217
+ * (detection-pipeline, audio-analyzer, embedding-encoder, model-studio). It is
1218
+ * anchored at the node's own writable data root (`ctx.nodeDataDir`, i.e.
1219
+ * `CAMSTACK_DATA` ?? the kernel boot dir) — never the hub-singleton `storage`
1220
+ * cap, which returns the hub's `/data/models` to every node and breaks any node
1221
+ * whose real data dir differs (e.g. the macOS electron agent).
1222
+ *
1223
+ * `node:path`/`node:fs` are imported dynamically so the `@camstack/types` root
1224
+ * barrel (re-exported into browser bundles) stays free of node builtins.
1217
1225
  */
1218
1226
  async resolveModelsDir() {
1219
- return this.ctx.api.storage.resolve.query({
1220
- location: "models",
1221
- relativePath: ""
1222
- }).catch(() => "camstack-data/models");
1227
+ const { join } = await import("node:path");
1228
+ const { promises: fsp } = await import("node:fs");
1229
+ const dir = join(this.ctx.nodeDataDir, "models");
1230
+ await fsp.mkdir(dir, { recursive: true });
1231
+ return dir;
1223
1232
  }
1224
1233
  /**
1225
1234
  * Access the runtime capability registry for in-process provider lookups.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",