@camstack/system 1.2.61 → 1.2.62

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.
Files changed (52) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/device-aggregation.d.ts +49 -2
  14. package/dist/builtins/device-manager/device-manager.addon.js +60 -5
  15. package/dist/builtins/device-manager/device-manager.addon.mjs +60 -5
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  18. package/dist/builtins/hub-forwarder/index.js +1 -1
  19. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  24. package/dist/builtins/local-network/local-network.addon.js +1 -1
  25. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  26. package/dist/builtins/loki-logging/index.js +1 -1
  27. package/dist/builtins/loki-logging/index.mjs +1 -1
  28. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  30. package/dist/builtins/platform-probe/index.js +1 -1
  31. package/dist/builtins/platform-probe/index.mjs +1 -1
  32. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  34. package/dist/builtins/snapshot/index.js +1 -1
  35. package/dist/builtins/snapshot/index.mjs +1 -1
  36. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  38. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  39. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  40. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  41. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  42. package/dist/builtins/system-config/system-config.addon.js +1 -1
  43. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  44. package/dist/builtins/winston-logging/index.js +1 -1
  45. package/dist/builtins/winston-logging/index.mjs +1 -1
  46. package/dist/{dist-BN681PgO.js → dist-DgPUarcs.js} +135 -0
  47. package/dist/{dist-L6QPJWsr.mjs → dist-DnKpFaP1.mjs} +135 -0
  48. package/dist/index.js +207 -4
  49. package/dist/index.mjs +204 -5
  50. package/dist/kernel/addon-residue.d.ts +49 -0
  51. package/dist/kernel/index.d.ts +2 -0
  52. package/package.json +1 -1
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 { $ as procedureAuthKey, Ct as asJsonObject$1, Dt as emitDownForOwnedCaps, Et as createEvent, Ft as readinessKey, H as kebabToCamel, It as resolveCapMount, K as logLevelAtMost, L as isArrayOutputSchema, Lt as scopeKey, Nt as parseJsonObject, P as extractNestedAddonId, Pt as parseJsonUnknown$1, R as isCollectionArrayMethod, Tt as asString$1, U as lifecycleJobSchema, V as isVoidInput, X as objectInputDeclaresAddonId, bt as ReadinessRegistry, c as METHOD_ACCESS_MAP, ft as errMsg$1, gt as DEVICE_STATUS_METHOD, h as addonSettingsCapability, ht as DEVICE_SETTINGS_CONTRIBUTION_METHODS, kt as expandCapMethods, l as RUNTIME_DEFAULTS, mt as DATAPLANE_SECRET_HEADER$1, q as looseSchema, t as ALL_CAPABILITY_DEFINITIONS, wt as asNumber, xt as ReadinessTimeoutError, z as isObjectInput, zt as EventCategory$1 } from "./dist-L6QPJWsr.mjs";
2
+ import { $ as procedureAuthKey, Ct as asJsonObject$1, Dt as emitDownForOwnedCaps, Et as createEvent, Ft as readinessKey, H as kebabToCamel, It as resolveCapMount, K as logLevelAtMost, L as isArrayOutputSchema, Lt as scopeKey, Nt as parseJsonObject, P as extractNestedAddonId, Pt as parseJsonUnknown$1, R as isCollectionArrayMethod, Tt as asString$1, U as lifecycleJobSchema, V as isVoidInput, X as objectInputDeclaresAddonId, bt as ReadinessRegistry, c as METHOD_ACCESS_MAP, ft as errMsg$1, gt as DEVICE_STATUS_METHOD, h as addonSettingsCapability, ht as DEVICE_SETTINGS_CONTRIBUTION_METHODS, kt as expandCapMethods, l as RUNTIME_DEFAULTS, mt as DATAPLANE_SECRET_HEADER$1, q as looseSchema, t as ALL_CAPABILITY_DEFINITIONS, wt as asNumber, xt as ReadinessTimeoutError, z as isObjectInput, zt as EventCategory$1 } from "./dist-DnKpFaP1.mjs";
3
3
  import { a as downloadModel, c as getModelFilePath, d as contentTypeFor, f as createAuthenticatedFileServer, h as resolveFilePath, i as downloadFile, l as isModelDownloaded, m as parseTokenizedUrl, n as collectModelFiles, o as ensureModel, p as parseRangeHeader, r as deleteModelFromDisk, s as fetchJson, t as ModelDownloadService, u as createFileDataPlaneHandler } from "./model-download-service-D8B-4ktF.mjs";
4
4
  import { $ as buildNativeCapProxy, A as createHubCapForwardService, B as AGENT_CAP_FWD_ACTION, C as brokerTransportLink, Ct as resolveAddonClass, D as localProviderLink, E as ipcParentLink, F as createUdsLogger, G as callWithServiceDiscovery, H as CapRouteResolver, I as createUdsLoggerWithControl, J as UdsLocalTransportServer, K as createLocalTransport, L as LocalChildClient, M as createUdsEventBridge, N as createUdsEventBus, O as HUB_CAP_FWD_ACTION, P as udsChildLogToWorkerEntry, Q as encodeFrame, R as LocalChildRegistry, S as brokerCallForCap, St as runNpm, T as ipcChildLink, U as CapRouteError, V as AGENT_CAP_FWD_SERVICE, W as classifyCapRoute, X as localEndpointPath, Y as SocketChannel, Z as FrameDecoder, _ as createKernelHwAccel, _t as CapabilityHandle, a as getWorkerDeviceRegistry, b as __resetCapUsageRegistryForTests, bt as installManifestNativeDeps, c as setHubConnected, ct as NATIVE_PROVIDER_SERVICE_INFIX, d as getBrokerEventBus, dt as capBareAction, et as buildUdsNativeCapProxy, f as getMoleculerEventStats, ft as capServiceName, g as AddonDepsManager, gt as DeviceRegistry, h as subscribePassthrough, ht as serializeTypedArrays, i as createUdsAddonContext, it as mountNativeCapService, j as createParentUnownedCallHandler, k as HUB_CAP_FWD_SERVICE, l as EVENT_TOPIC_PREFIX, lt as capActionName, m as setNodeEventInterest, mt as deserializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as createAddonService, p as registerEventBusService, pt as parseCapAction, q as UdsLocalTransportClient, r as createAddonContext, s as getOrInitReadinessRegistryForClient, st as validateProviderRegistrations, t as installManifestPythonDeps, tt as createBrokerDeviceManagerApi, u as clusterEventTopic, ut as capActionSuffix, v as resolveHwAccel, vt as CapabilityUnavailableError, w as buildLinkChain, wt as createAddonDataPlaneFacility, x as getCapUsageRegistry, xt as resolveNpmInvocation, y as CapUsageRegistry, yt as copyBundledNativeModules, z as UDS_NO_ROUTE_PREFIX } from "./manifest-python-deps-CX5tGRqf.mjs";
5
5
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-BkP504Vq.mjs";
@@ -3348,7 +3348,12 @@ var MANIFEST_VERSION = 1;
3348
3348
  * workspace source. Trusting the dirent there finds zero addons on disk, which
3349
3349
  * with pruning would empty a developer's manifest on the next boot.
3350
3350
  */
3351
- function isDirLike(p) {
3351
+ /** `@camstack/system` → `system`: the directory a package must live in. */
3352
+ function packageDirName$1(declaredName) {
3353
+ const slash = declaredName.lastIndexOf("/");
3354
+ return slash === -1 ? declaredName : declaredName.slice(slash + 1);
3355
+ }
3356
+ function isDirLike$1(p) {
3352
3357
  try {
3353
3358
  return fs$17.statSync(p).isDirectory();
3354
3359
  } catch {
@@ -3482,10 +3487,10 @@ var AddonManifest = class {
3482
3487
  /** Package name → version, for every ADDON package actually installed. */
3483
3488
  const onDisk = /* @__PURE__ */ new Map();
3484
3489
  for (const scope of fs$17.readdirSync(addonsDir, { withFileTypes: true })) {
3485
- if (!scope.name.startsWith("@") || !isDirLike(path$39.join(addonsDir, scope.name))) continue;
3490
+ if (!scope.name.startsWith("@") || !isDirLike$1(path$39.join(addonsDir, scope.name))) continue;
3486
3491
  const scopeDir = path$39.join(addonsDir, scope.name);
3487
3492
  for (const pkg of fs$17.readdirSync(scopeDir, { withFileTypes: true })) {
3488
- if (!isDirLike(path$39.join(scopeDir, pkg.name))) continue;
3493
+ if (!isDirLike$1(path$39.join(scopeDir, pkg.name))) continue;
3489
3494
  const pkgJsonPath = path$39.join(scopeDir, pkg.name, "package.json");
3490
3495
  if (!fs$17.existsSync(pkgJsonPath)) continue;
3491
3496
  let pkgJson;
@@ -3499,6 +3504,7 @@ var AddonManifest = class {
3499
3504
  if (!pkgJson.name || !pkgJson.version) continue;
3500
3505
  const addons = pkgJson.camstack?.addons;
3501
3506
  if (!Array.isArray(addons) || addons.length === 0) continue;
3507
+ if (packageDirName$1(pkgJson.name) !== pkg.name) continue;
3502
3508
  onDisk.set(pkgJson.name, pkgJson.version);
3503
3509
  }
3504
3510
  }
@@ -5016,6 +5022,199 @@ function isDirEntry(entry, parentDir) {
5016
5022
  return false;
5017
5023
  }
5018
5024
  //#endregion
5025
+ //#region src/kernel/addon-residue.ts
5026
+ /**
5027
+ * Residue quarantine for the ONE addon root.
5028
+ *
5029
+ * ── The bug class this closes ──────────────────────────────────────────────
5030
+ * `<dataDir>/addons/@camstack/<pkg>` is the only directory a node loads addons
5031
+ * from. Renaming a package inside it does NOT archive it — the directory name
5032
+ * is decoration, and three independent consumers key on the `package.json`
5033
+ * they find inside:
5034
+ *
5035
+ * - `AddonLoader.loadFromDirectory` walks `@scope/*` and loads anything with
5036
+ * a `package.json`; its skip list is keyed on the PACKAGE name, so
5037
+ * `@camstack/system.bak-pre-unshadow` was never skipped;
5038
+ * - the agent's `resolveAddonPackageDirs` scans on the same rule;
5039
+ * - `AddonManifest.reconcileFromDisk` does `onDisk.set(pkgJson.name, …)`,
5040
+ * so the backup's version becomes the version the manifest — and every
5041
+ * surface reading it — REPORTS.
5042
+ *
5043
+ * Measured 2026-08-07/08 on the live cluster:
5044
+ *
5045
+ * little-unraid `@camstack/system.bak-pre-unshadow` — no package.json left,
5046
+ * so not loadable, but the agent main process held five live
5047
+ * mappings of `better_sqlite3.node` out of it (D87).
5048
+ * macmini `@camstack/system.bak-pre-1272-1786129145` — still declares
5049
+ * `@camstack/system@1.2.3` (17 days old, 97 MB). The data root
5050
+ * has NO `addons/@camstack/system` directory at all, yet the
5051
+ * manifest reports `@camstack/system 1.2.3` — read straight
5052
+ * out of the backup. The live process still had the backup's
5053
+ * `better_sqlite3.node` mapped `txt` against a 1.2.61 closure.
5054
+ *
5055
+ * ── Why quarantine and not delete ─────────────────────────────────────────
5056
+ * The same evening, a cleanup that DELETED what it judged to be a shadow copy
5057
+ * removed the only builtins an agent had and gutted the node. So this never
5058
+ * deletes: it renames out of the scanned root into `.quarantine/`, logs every
5059
+ * move by name, reason and both paths, and leaves the bytes recoverable. A
5060
+ * silent sweep reads as "nothing was here", which is the failure mode that
5061
+ * made the original one unobservable.
5062
+ *
5063
+ * `.quarantine` sits beside `.staging` / `.backups` / `.evicting` under the
5064
+ * addon root: dot-prefixed, carrying no `package.json` at its top level, so no
5065
+ * scanner descends into it.
5066
+ */
5067
+ /** Where residue is moved to, relative to the addon root. */
5068
+ var QUARANTINE_DIRNAME = ".quarantine";
5069
+ /**
5070
+ * A backup marker: a `.bak` / `.old` / `.orig` segment, not merely those
5071
+ * letters. `.backups` — the installer's own rollback store — must NOT match,
5072
+ * and it is also excluded by the dot rule below; the pattern stays tight
5073
+ * anyway so the two guards are independent.
5074
+ */
5075
+ var BACKUP_MARKER = /\.(bak|old|orig)(?![a-z])/i;
5076
+ /** Installer-owned stores and node's own tree. Never candidates. */
5077
+ function isReservedDir(dirName) {
5078
+ return dirName.startsWith(".") || dirName === "node_modules";
5079
+ }
5080
+ /** `@camstack/system` → `system`; `foo` → `foo`. */
5081
+ function packageDirName(declaredName) {
5082
+ const slash = declaredName.lastIndexOf("/");
5083
+ return slash === -1 ? declaredName : declaredName.slice(slash + 1);
5084
+ }
5085
+ /**
5086
+ * Is this directory residue? Returns the verdict, or null to keep it.
5087
+ *
5088
+ * A directory with no `package.json` is NOT residue on that ground alone —
5089
+ * `models/`, a half-finished copy, a scratch dir are all absence, not a
5090
+ * rename. Only a backup marker condemns one.
5091
+ */
5092
+ function classifyAddonDir(candidate) {
5093
+ const { dirName, declaredName } = candidate;
5094
+ if (isReservedDir(dirName)) return null;
5095
+ if (BACKUP_MARKER.test(dirName)) return {
5096
+ dirName,
5097
+ declaredName,
5098
+ reason: "backup-residue"
5099
+ };
5100
+ if (declaredName !== null && packageDirName(declaredName) !== dirName) return {
5101
+ dirName,
5102
+ declaredName,
5103
+ reason: "name-mismatch"
5104
+ };
5105
+ return null;
5106
+ }
5107
+ function selectAddonResidue(candidates) {
5108
+ const out = [];
5109
+ for (const candidate of candidates) {
5110
+ const verdict = classifyAddonDir(candidate);
5111
+ if (verdict !== null) out.push(verdict);
5112
+ }
5113
+ return out;
5114
+ }
5115
+ function readDeclaredName(dir) {
5116
+ try {
5117
+ const parsed = JSON.parse(fs$17.readFileSync(path$39.join(dir, "package.json"), "utf-8"));
5118
+ if (typeof parsed !== "object" || parsed === null) return null;
5119
+ const name = parsed.name;
5120
+ return typeof name === "string" ? name : null;
5121
+ } catch {
5122
+ return null;
5123
+ }
5124
+ }
5125
+ function readDeclaredVersion(dir) {
5126
+ try {
5127
+ const parsed = JSON.parse(fs$17.readFileSync(path$39.join(dir, "package.json"), "utf-8"));
5128
+ if (typeof parsed !== "object" || parsed === null) return null;
5129
+ const version = parsed.version;
5130
+ return typeof version === "string" ? version : null;
5131
+ } catch {
5132
+ return null;
5133
+ }
5134
+ }
5135
+ function isDirLike(p) {
5136
+ try {
5137
+ return fs$17.statSync(p).isDirectory();
5138
+ } catch {
5139
+ return false;
5140
+ }
5141
+ }
5142
+ /** `<scope>__<dir>`, suffixed until free — two sweeps must not overwrite. */
5143
+ function freeQuarantineTarget(store, scope, dirName) {
5144
+ const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
5145
+ let candidate = path$39.join(store, base);
5146
+ let n = 1;
5147
+ while (fs$17.existsSync(candidate)) {
5148
+ candidate = path$39.join(store, `${base}-${n}`);
5149
+ n += 1;
5150
+ }
5151
+ return candidate;
5152
+ }
5153
+ /**
5154
+ * Move every residue directory under `addonsDir` into `addonsDir/.quarantine`.
5155
+ *
5156
+ * Runs at boot, BEFORE anything scans the root or seeds into it — a residue
5157
+ * that is still present when the loader walks has already been installed.
5158
+ * Never throws, never deletes; a move that fails is reported and left in
5159
+ * place, which is strictly better than a half-moved package.
5160
+ */
5161
+ function quarantineAddonResidue(addonsDir, log) {
5162
+ const quarantined = [];
5163
+ const failed = [];
5164
+ if (!fs$17.existsSync(addonsDir)) return {
5165
+ quarantined,
5166
+ failed
5167
+ };
5168
+ const store = path$39.join(addonsDir, QUARANTINE_DIRNAME);
5169
+ const scan = (parent, scope) => {
5170
+ let names;
5171
+ try {
5172
+ names = fs$17.readdirSync(parent);
5173
+ } catch {
5174
+ return;
5175
+ }
5176
+ for (const dirName of names) {
5177
+ const full = path$39.join(parent, dirName);
5178
+ if (!isDirLike(full)) continue;
5179
+ if (scope === null && dirName.startsWith("@")) {
5180
+ scan(full, dirName);
5181
+ continue;
5182
+ }
5183
+ const verdict = classifyAddonDir({
5184
+ dirName,
5185
+ declaredName: readDeclaredName(full)
5186
+ });
5187
+ if (verdict === null) continue;
5188
+ const version = readDeclaredVersion(full);
5189
+ const to = freeQuarantineTarget(store, scope, dirName);
5190
+ try {
5191
+ fs$17.mkdirSync(store, { recursive: true });
5192
+ fs$17.renameSync(full, to);
5193
+ } catch (err) {
5194
+ const error = err instanceof Error ? err.message : String(err);
5195
+ failed.push({
5196
+ ...verdict,
5197
+ from: full,
5198
+ error
5199
+ });
5200
+ log(`[addons] residue quarantine FAILED for ${full} (${verdict.reason}) — ${error}. It stays on the addon root and will be loaded, scanned and reported as an install.`);
5201
+ continue;
5202
+ }
5203
+ quarantined.push({
5204
+ ...verdict,
5205
+ from: full,
5206
+ to
5207
+ });
5208
+ log(`[addons] quarantined ${verdict.reason} ${full} → ${to} (declares ${verdict.declaredName ?? "no package name"}${version === null ? "" : `@${version}`}). A renamed package dir is INSTALLED, not archived — nothing was deleted.`);
5209
+ }
5210
+ };
5211
+ scan(addonsDir, null);
5212
+ return {
5213
+ quarantined,
5214
+ failed
5215
+ };
5216
+ }
5217
+ //#endregion
5019
5218
  //#region src/kernel/workspace-detect.ts
5020
5219
  /**
5021
5220
  * Detect whether we're running inside the monorepo workspace.
@@ -94627,4 +94826,4 @@ var LifecycleJobEngine = class {
94627
94826
  }
94628
94827
  };
94629
94828
  //#endregion
94630
- export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AGENT_READINESS_SERVICE_NAME, ALL_CAPABILITY_DEFINITIONS, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AlertCenterAddon, ApiKeyManager, AuthManager, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CORE_CAP_SERVICE_NAME, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CoreBlocksAddon, CustomActionRegistry, DEFAULT_DATA_PATH, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DataPlaneRegistry, DeviceManagerAddon, DeviceRegistry, DeviceStore, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_CAP_FWD_ACTION, HUB_CAP_FWD_SERVICE, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, INFRA_CAPABILITIES, IntegrationRegistry, JobJournal, LifecycleJobEngine, LifecycleStateMachine, LivenessMonitorAddon, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, LokiDestination, LokiLoggingAddon, METHOD_ACCESS_MAP, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NATIVE_SCAN_DEPTH, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, PYTHON_VERSION, PipelineRunner, PipelineValidator, PythonEnvManager, RESTART_MARKER_FILE, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, ScopedLogger, ScopedTokenManager, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemConfigAddon, SystemEventBus, TRADITIONAL_NATIVE_PACKAGES, ToastService, UDS_NO_ROUTE_PREFIX, UdsLocalTransportClient, UdsLocalTransportServer, UserManager, WinstonDestination, WinstonLoggingAddon, __resetCapUsageRegistryForTests, adaptBrokerToCluster, addonSettingsCapability, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildBinaryPath, buildCapRouters, buildHeapSample, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildStorageLocationRegistry, buildUdsNativeCapProxy, builderMountedCapNames, callRegisterNodeWithRetry, callWithServiceDiscovery, capActionName, capActionSuffix, capBareAction, capServiceName, classifyCapRoute, clearPendingRestart, clusterEventTopic, clusterSecretMatches, collectModelFiles, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonService, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCoreCapService, createFileDataPlaneHandler, createHubCapForwardService, createHubService, createKernelHwAccel, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, createV8Reclaimer, deleteModelFromDisk, deriveAgentListenPort, describeProviderKindDrift, detectWorkspacePackagesDir, downloadBinary, downloadFile, downloadModel, emitDownForOwnedCaps, encodeFrame, ensureAddonNativePrebuilds, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensureNativePrebuilds, ensurePython, ensureTlsCert, expandCapMethods, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getModelFilePath, getMoleculerEventStats, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hasDotNode, hashClusterSecret, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcChildLink, ipcParentLink, isAddonDeploySource, isArrayOutputSchema, isClusterSecretMismatchError, isCollectionArrayMethod, isInfraCapability, isModelDownloaded, isSourceNewer, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, parseCapAction, parseRangeHeader, parseTokenizedUrl, proxyToUpstream, readPendingRestart, readinessKey, registerEventBusService, resolveFilePath, resolveHwAccel, resolveNpmInvocation, runNpm, scheduleSelfRestart, scopeKey, scopesAllowDeviceCap, serializeTypedArrays, setHubConnected, setNodeEventInterest, shouldReclaim, startHeapWatch, strandedMb, stripCamstackDeps, subscribePassthrough, udsChildLogToWorkerEntry, validateProviderRegistrations, writePendingRestart };
94829
+ export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AGENT_READINESS_SERVICE_NAME, ALL_CAPABILITY_DEFINITIONS, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AlertCenterAddon, ApiKeyManager, AuthManager, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CORE_CAP_SERVICE_NAME, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CoreBlocksAddon, CustomActionRegistry, DEFAULT_DATA_PATH, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DataPlaneRegistry, DeviceManagerAddon, DeviceRegistry, DeviceStore, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_CAP_FWD_ACTION, HUB_CAP_FWD_SERVICE, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, INFRA_CAPABILITIES, IntegrationRegistry, JobJournal, LifecycleJobEngine, LifecycleStateMachine, LivenessMonitorAddon, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, LokiDestination, LokiLoggingAddon, METHOD_ACCESS_MAP, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NATIVE_SCAN_DEPTH, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, PYTHON_VERSION, PipelineRunner, PipelineValidator, PythonEnvManager, QUARANTINE_DIRNAME, RESTART_MARKER_FILE, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, ScopedLogger, ScopedTokenManager, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemConfigAddon, SystemEventBus, TRADITIONAL_NATIVE_PACKAGES, ToastService, UDS_NO_ROUTE_PREFIX, UdsLocalTransportClient, UdsLocalTransportServer, UserManager, WinstonDestination, WinstonLoggingAddon, __resetCapUsageRegistryForTests, adaptBrokerToCluster, addonSettingsCapability, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildBinaryPath, buildCapRouters, buildHeapSample, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildStorageLocationRegistry, buildUdsNativeCapProxy, builderMountedCapNames, callRegisterNodeWithRetry, callWithServiceDiscovery, capActionName, capActionSuffix, capBareAction, capServiceName, classifyAddonDir, classifyCapRoute, clearPendingRestart, clusterEventTopic, clusterSecretMatches, collectModelFiles, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonService, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCoreCapService, createFileDataPlaneHandler, createHubCapForwardService, createHubService, createKernelHwAccel, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, createV8Reclaimer, deleteModelFromDisk, deriveAgentListenPort, describeProviderKindDrift, detectWorkspacePackagesDir, downloadBinary, downloadFile, downloadModel, emitDownForOwnedCaps, encodeFrame, ensureAddonNativePrebuilds, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensureNativePrebuilds, ensurePython, ensureTlsCert, expandCapMethods, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getModelFilePath, getMoleculerEventStats, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hasDotNode, hashClusterSecret, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcChildLink, ipcParentLink, isAddonDeploySource, isArrayOutputSchema, isClusterSecretMismatchError, isCollectionArrayMethod, isInfraCapability, isModelDownloaded, isSourceNewer, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, parseCapAction, parseRangeHeader, parseTokenizedUrl, proxyToUpstream, quarantineAddonResidue, readPendingRestart, readinessKey, registerEventBusService, resolveFilePath, resolveHwAccel, resolveNpmInvocation, runNpm, scheduleSelfRestart, scopeKey, scopesAllowDeviceCap, selectAddonResidue, serializeTypedArrays, setHubConnected, setNodeEventInterest, shouldReclaim, startHeapWatch, strandedMb, stripCamstackDeps, subscribePassthrough, udsChildLogToWorkerEntry, validateProviderRegistrations, writePendingRestart };
@@ -0,0 +1,49 @@
1
+ /** Where residue is moved to, relative to the addon root. */
2
+ export declare const QUARANTINE_DIRNAME = ".quarantine";
3
+ export type ResidueReason =
4
+ /** The directory name carries a backup marker — `.bak…`, `.old…`, `.orig…`. */
5
+ 'backup-residue'
6
+ /** The directory declares a package whose name is not this directory. */
7
+ | 'name-mismatch';
8
+ export interface AddonDirCandidate {
9
+ /** Directory basename under the addon root (or under its `@scope`). */
10
+ readonly dirName: string;
11
+ /** `name` from the directory's `package.json`; null when absent/unreadable. */
12
+ readonly declaredName: string | null;
13
+ }
14
+ export interface ResidueVerdict extends AddonDirCandidate {
15
+ readonly reason: ResidueReason;
16
+ }
17
+ /**
18
+ * Is this directory residue? Returns the verdict, or null to keep it.
19
+ *
20
+ * A directory with no `package.json` is NOT residue on that ground alone —
21
+ * `models/`, a half-finished copy, a scratch dir are all absence, not a
22
+ * rename. Only a backup marker condemns one.
23
+ */
24
+ export declare function classifyAddonDir(candidate: AddonDirCandidate): ResidueVerdict | null;
25
+ export declare function selectAddonResidue(candidates: readonly AddonDirCandidate[]): readonly ResidueVerdict[];
26
+ export interface QuarantinedEntry extends ResidueVerdict {
27
+ /** Absolute path the residue occupied under the addon root. */
28
+ readonly from: string;
29
+ /** Absolute path it now occupies under `.quarantine/`. */
30
+ readonly to: string;
31
+ }
32
+ export interface ResidueQuarantineFailure extends ResidueVerdict {
33
+ readonly from: string;
34
+ readonly error: string;
35
+ }
36
+ export interface ResidueQuarantineResult {
37
+ readonly quarantined: readonly QuarantinedEntry[];
38
+ /** Residue that could not be moved. Reported, never fatal. */
39
+ readonly failed: readonly ResidueQuarantineFailure[];
40
+ }
41
+ /**
42
+ * Move every residue directory under `addonsDir` into `addonsDir/.quarantine`.
43
+ *
44
+ * Runs at boot, BEFORE anything scans the root or seeds into it — a residue
45
+ * that is still present when the loader walks has already been installed.
46
+ * Never throws, never deletes; a move that fails is reported and left in
47
+ * place, which is strictly better than a half-moved package.
48
+ */
49
+ export declare function quarantineAddonResidue(addonsDir: string, log: (message: string) => void): ResidueQuarantineResult;
@@ -5,6 +5,8 @@ export type { AddonInstallerConfig, InstallSource, InstalledPackage } from './ad
5
5
  export { AddonInstaller } from './addon-installer.js';
6
6
  export type { AddonInstallSource, AddonManifestEntry, AddonManifestFile } from './addon-manifest.js';
7
7
  export { AddonManifest } from './addon-manifest.js';
8
+ export type { AddonDirCandidate, QuarantinedEntry, ResidueQuarantineResult, ResidueReason, ResidueVerdict, } from './addon-residue.js';
9
+ export { QUARANTINE_DIRNAME, classifyAddonDir, quarantineAddonResidue, selectAddonResidue, } from './addon-residue.js';
8
10
  export { copyDirRecursive, ensureDir, stripCamstackDeps, copyExtraFileDirs, ensureLibraryBuilt, installPackageFromNpm, isSourceNewer, } from './fs-utils.js';
9
11
  export { detectWorkspacePackagesDir } from './workspace-detect.js';
10
12
  export { RESTART_MARKER_FILE, clearPendingRestart, getRestartMarkerPath, readPendingRestart, scheduleSelfRestart, writePendingRestart, } from './restart-coordinator.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.61",
3
+ "version": "1.2.62",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",