@camstack/system 1.2.416 → 1.2.418

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 (95) hide show
  1. package/dist/addon-runner.js +9969 -27
  2. package/dist/addon-runner.mjs +9930 -9
  3. package/dist/addon-utils.js +19 -20
  4. package/dist/addon-utils.mjs +1 -2
  5. package/dist/auth/auth-audit-log.d.ts +1 -1
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  10. package/dist/builtins/alerts/alerts.addon.js +1 -1
  11. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  12. package/dist/builtins/autotrack/index.js +1 -1
  13. package/dist/builtins/autotrack/index.mjs +1 -1
  14. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  16. package/dist/builtins/calendars/calendars.addon.js +1 -1
  17. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  18. package/dist/builtins/camera-grid/index.js +1 -1
  19. package/dist/builtins/camera-grid/index.mjs +1 -1
  20. package/dist/builtins/composer/composer.addon.js +2 -2
  21. package/dist/builtins/composer/composer.addon.mjs +2 -2
  22. package/dist/builtins/console-logging/index.js +1 -1
  23. package/dist/builtins/console-logging/index.mjs +1 -1
  24. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  25. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  26. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  27. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  28. package/dist/builtins/hub-forwarder/index.js +1 -1
  29. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  30. package/dist/builtins/keychain/index.js +7 -9
  31. package/dist/builtins/keychain/index.mjs +7 -9
  32. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  33. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  34. package/dist/builtins/local-auth/local-auth.addon.js +5 -3
  35. package/dist/builtins/local-auth/local-auth.addon.mjs +5 -3
  36. package/dist/builtins/local-network/local-network.addon.js +2 -2
  37. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  38. package/dist/builtins/loki-logging/index.js +1 -1
  39. package/dist/builtins/loki-logging/index.mjs +1 -1
  40. package/dist/builtins/native-metrics/native-metrics.addon.js +102 -10
  41. package/dist/builtins/native-metrics/native-metrics.addon.mjs +92 -4
  42. package/dist/builtins/platform-probe/amd-npu.d.ts +6 -0
  43. package/dist/builtins/platform-probe/index.js +317 -19
  44. package/dist/builtins/platform-probe/index.mjs +318 -20
  45. package/dist/builtins/platform-probe/platform-scorer.d.ts +4 -0
  46. package/dist/builtins/platform-probe/windows-hardware.d.ts +77 -0
  47. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  48. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  49. package/dist/builtins/snapshot/index.js +1 -1
  50. package/dist/builtins/snapshot/index.mjs +1 -1
  51. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  52. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  53. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  54. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  55. package/dist/builtins/storage-orchestrator/index.mjs +1 -1
  56. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +83 -3
  57. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +79 -3
  58. package/dist/builtins/system-config/system-config.addon.js +2 -2
  59. package/dist/builtins/system-config/system-config.addon.mjs +2 -2
  60. package/dist/builtins/winston-logging/index.js +1 -1
  61. package/dist/builtins/winston-logging/index.mjs +1 -1
  62. package/dist/{composition-sources-DEZqZLPT.mjs → composition-sources-0cPw9E0M.mjs} +1 -1
  63. package/dist/{composition-sources-DBcOVpGn.js → composition-sources-BVjuMvpb.js} +1 -1
  64. package/dist/{constants-C4jZO_qO.js → constants-Aj0OBqlt.js} +1 -1
  65. package/dist/{constants-BSBtmzm3.mjs → constants-C8T7u1_Z.mjs} +1 -1
  66. package/dist/{event-loop-stall-monitor-LBZskC1S.mjs → custom-action-registry-BQnbN0DP.mjs} +57 -2
  67. package/dist/{event-loop-stall-monitor-E2hFvhDg.js → custom-action-registry-Bf_YnagS.js} +64 -3
  68. package/dist/{dist-DxiDI8hZ.js → dist-DVUg8e1T.js} +56 -182
  69. package/dist/{dist-DwE9yHdk.mjs → dist-DlmdESNT.mjs} +57 -153
  70. package/dist/index.js +22901 -10154
  71. package/dist/index.mjs +22616 -9869
  72. package/dist/{jwt-signing-key-DLbjTIuA.mjs → jwt-signing-key-CGg61A5v.mjs} +1 -1
  73. package/dist/{jwt-signing-key-CsC-FxSm.js → jwt-signing-key-Jyu81jZR.js} +1 -1
  74. package/dist/kernel/moleculer/broker-factory.d.ts +2 -4
  75. package/dist/kernel/transport/local-child-registry.d.ts +1 -1
  76. package/dist/logging/log-redactor.d.ts +1 -1
  77. package/dist/{resource-monitor-B2WZ8_q9.mjs → resource-monitor-Di9daRwI.mjs} +1 -1
  78. package/dist/{resource-monitor-BgWGRxN5.js → resource-monitor-mio9dSCT.js} +5 -5
  79. package/dist/{restore-archive-BtKjaVua.js → restore-archive-Bq5PpQ-H.js} +1 -1
  80. package/dist/{restore-archive-CImzbuRo.mjs → restore-archive-DVo5ooBt.mjs} +1 -1
  81. package/dist/{retired-settings-keys-Cl1tnkmq.js → retired-settings-keys-CihMX6h9.js} +1 -1
  82. package/dist/{retired-settings-keys-D1WsCdUY.mjs → retired-settings-keys-k_XuC-Mt.mjs} +1 -1
  83. package/dist/{tls-C0TRPfqc.js → tls-BgImdxCO.js} +4 -11
  84. package/dist/{tls-D-2dPY-5.mjs → tls-CaOLZ09W.mjs} +5 -12
  85. package/package.json +2 -2
  86. package/dist/amd-npu-B-QyyMyF.js +0 -53
  87. package/dist/amd-npu-Db_SoSuL.mjs +0 -52
  88. package/dist/child-cap-dispatch-B87B0FrC.js +0 -13986
  89. package/dist/child-cap-dispatch-CmfT-OR2.mjs +0 -12916
  90. package/dist/custom-action-registry-B4Cf4O_X.mjs +0 -57
  91. package/dist/custom-action-registry-acBY3mHA.js +0 -62
  92. package/dist/hub-cap-forward-CDiN1p98.mjs +0 -78
  93. package/dist/hub-cap-forward-W8oEm4ME.js +0 -101
  94. package/dist/proc-stat-CbC55Kqi.mjs +0 -92
  95. package/dist/proc-stat-DL-WUOhl.js +0 -127
@@ -1,5 +1,4 @@
1
- import { $r as secretTreeFromPaths, A as LegacyStorageLocationDefaultSchema, At as evictionPolicyOfLocation, Br as isSecretMarker, Dn as resolveLocationMode, Er as collectSecretConfigKeys, G as StorageMigrationJobSchema, Gr as parseJsonObject, H as StorageCleanupJobSchema, Ln as storageCapability, Lt as gbToBytes, Pn as settingsStoreCapability, Rn as storageMigrationCapability, U as StorageLocationModeSchema, Ut as isLocationEnabled, W as StorageLocationTypeSchema, Xn as withLocationMode, Xr as resolveSecretMarkers, Xt as legacyModeOf, _r as REDACTED_SECRET, ai as EventCategory, an as mayWriteToLocation, cn as modeMayWrite, ii as transformSecretWrite, in as mayReadLocation, pr as BaseAddon } from "../../dist-DwE9yHdk.mjs";
2
- import { t as HUB_CAP_FWD_ACTION } from "../../hub-cap-forward-CDiN1p98.mjs";
1
+ import { $r as transformSecretWrite, $t as mayReadLocation, B as StorageLocationModeSchema, Dt as evictionPolicyOfLocation, Gn as withLocationMode, H as StorageMigrationJobSchema, Ir as isSecretMarker, Jr as secretTreeFromPaths, Kr as resolveSecretMarkers, Kt as legacyModeOf, Mn as storageCapability, Nn as storageMigrationCapability, Pt as gbToBytes, Sn as resolveLocationMode, Sr as collectSecretConfigKeys, V as StorageLocationTypeSchema, Vr as parseJsonObject, cr as BaseAddon, ei as EventCategory, en as mayWriteToLocation, fr as REDACTED_SECRET, k as LegacyStorageLocationDefaultSchema, kn as settingsStoreCapability, rn as modeMayWrite, z as StorageCleanupJobSchema, zt as isLocationEnabled } from "../../dist-DlmdESNT.mjs";
3
2
  import { z } from "zod";
4
3
  import { randomUUID } from "node:crypto";
5
4
  import { containsOrEquals, physicalRootOf } from "@camstack/types/node";
@@ -1375,6 +1374,83 @@ var SqliteDrainStateStore = class {
1375
1374
  }
1376
1375
  };
1377
1376
  //#endregion
1377
+ //#region src/kernel/transport/hub-cap-forward.ts
1378
+ /** The Moleculer service name the hub registers for agent→hub cap forwarding. */
1379
+ var HUB_CAP_FWD_SERVICE = "$hub-cap-fwd";
1380
+ /** The Moleculer action (service.action) for hub cap forwarding. */
1381
+ var HUB_CAP_FWD_ACTION = `${HUB_CAP_FWD_SERVICE}.forward`;
1382
+ /**
1383
+ * Drop a `caller` the forwarded args carry. `caller` is the USER identity the
1384
+ * hub's tRPC router injects for `caller: 'required'` methods
1385
+ * (`cap-router-builder.ts`), and providers trust it — `keychainAdmin.reveal`
1386
+ * reads `input.caller.userId`. A call that arrives over the mesh has no user
1387
+ * session behind it, so whatever `caller` it carries is forged (D802). The
1388
+ * args' `callerAddonId` is overwritten or stripped further down by
1389
+ * `stampCallerAddonId`; `caller` had no such guard.
1390
+ */
1391
+ function stripForwardedCaller(args) {
1392
+ if (args === null || typeof args !== "object" || Array.isArray(args)) return args;
1393
+ if (!Object.prototype.hasOwnProperty.call(args, "caller")) return args;
1394
+ const rest = {};
1395
+ for (const [key, value] of Object.entries(args)) if (key !== "caller") rest[key] = value;
1396
+ return rest;
1397
+ }
1398
+ /**
1399
+ * Narrow Moleculer's loosely-typed `ctx.params` to {@link HubCapForwardParams}
1400
+ * without unsafe casts — mirrors `agent-cap-dispatch-service.ts:narrowParams`.
1401
+ */
1402
+ function narrowParams(raw) {
1403
+ if (raw === null || typeof raw !== "object") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
1404
+ const capName = Reflect.get(raw, "capName");
1405
+ const method = Reflect.get(raw, "method");
1406
+ if (typeof capName !== "string" || typeof method !== "string") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
1407
+ const deviceId = Reflect.get(raw, "deviceId");
1408
+ const nodeId = Reflect.get(raw, "nodeId");
1409
+ const native = Reflect.get(raw, "native");
1410
+ const callerAddonId = Reflect.get(raw, "callerAddonId");
1411
+ return {
1412
+ capName,
1413
+ method,
1414
+ args: stripForwardedCaller(Reflect.get(raw, "args")),
1415
+ deviceId: typeof deviceId === "number" ? deviceId : void 0,
1416
+ nodeId: typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0,
1417
+ native: native === true ? true : void 0,
1418
+ callerAddonId: typeof callerAddonId === "string" && callerAddonId.length > 0 ? callerAddonId : void 0
1419
+ };
1420
+ }
1421
+ /**
1422
+ * Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
1423
+ * its broker (only the hub registers it → an agent's `broker.call` for
1424
+ * `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
1425
+ *
1426
+ * @param onUnownedCall The hub's cap routing handler (from
1427
+ * `createParentUnownedCallHandler`). Reused verbatim so
1428
+ * forwarded calls route exactly like a hub-local child's.
1429
+ */
1430
+ function createHubCapForwardService(onUnownedCall, options = {}) {
1431
+ return {
1432
+ name: HUB_CAP_FWD_SERVICE,
1433
+ actions: { forward: { handler: async (ctx) => {
1434
+ const { capName, method, args, deviceId, nodeId, native, callerAddonId } = narrowParams(ctx.params);
1435
+ const sender = typeof ctx.nodeID === "string" ? ctx.nodeID : null;
1436
+ let caller = callerAddonId;
1437
+ if (caller !== void 0 && options.isCallerOnNode !== void 0 && (sender === null || !options.isCallerOnNode(sender, caller))) {
1438
+ options.onRejectedCaller?.(sender ?? "(unknown node)", caller);
1439
+ caller = void 0;
1440
+ }
1441
+ return onUnownedCall({
1442
+ capName,
1443
+ method,
1444
+ args,
1445
+ ...deviceId !== void 0 ? { deviceId } : {},
1446
+ ...nodeId !== void 0 ? { nodeId } : {},
1447
+ ...native === true ? { native: true } : {},
1448
+ ...caller !== void 0 ? { callerAddonId: caller } : {}
1449
+ });
1450
+ } } }
1451
+ };
1452
+ }
1453
+ //#endregion
1378
1454
  //#region src/builtins/storage-orchestrator/hub-settings-forward.ts
1379
1455
  /**
1380
1456
  * The data door with the HUB behind it — an agent's `settings-store` provider.
@@ -4508,4 +4584,4 @@ function parseOrphanStatus(raw) {
4508
4584
  };
4509
4585
  }
4510
4586
  //#endregion
4511
- export { StorageOrchestratorAddon, StorageOrchestratorAddon as default, SqliteLocationStore as i, buildStorageLocationRegistry as n, StorageMigrationCoordinator as r, StorageOrchestratorService as t };
4587
+ export { StorageOrchestratorAddon, StorageOrchestratorAddon as default, stripForwardedCaller as a, SqliteLocationStore as c, createHubCapForwardService as i, HUB_CAP_FWD_ACTION as n, buildStorageLocationRegistry as o, HUB_CAP_FWD_SERVICE as r, StorageMigrationCoordinator as s, StorageOrchestratorService as t };
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DxiDI8hZ.js");
6
+ const require_dist = require("../../dist-DVUg8e1T.js");
7
7
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
- const require_constants$8 = require("../../constants-C4jZO_qO.js");
8
+ const require_constants$8 = require("../../constants-Aj0OBqlt.js");
9
9
  const require_x509_es = require("../../x509.es-Dzl0BbmG.js");
10
10
  const require_src$1 = require("../../src-CnAqG6EF.js");
11
11
  let zod = require("zod");
@@ -1,7 +1,7 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Ar as defineCustomActions, Br as isSecretMarker, Fr as hydrateSchema, Hr as makeSecretMarker, ei as secretTreeFromSchema, fr as errMsg, ii as transformSecretWrite, kr as customAction, pr as BaseAddon, zr as isSecretClear } from "../../dist-DwE9yHdk.mjs";
2
+ import { $r as transformSecretWrite, Er as defineCustomActions, Fr as isSecretClear, Ir as isSecretMarker, Rr as makeSecretMarker, Tr as customAction, Yr as secretTreeFromSchema, cr as BaseAddon, jr as hydrateSchema, sr as errMsg } from "../../dist-DlmdESNT.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
- import { a as MESH_CA_KEY_REF, b as setProcessClusterSecretGate, c as MESH_JOIN_TOKEN_MAX_TTL_SEC, d as CLUSTER_SECRET_REF, i as MESH_CA_FIELD, l as SERVER_AUTH_OID, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID, v as hashClusterSecret } from "../../constants-BSBtmzm3.mjs";
4
+ import { a as MESH_CA_KEY_REF, b as setProcessClusterSecretGate, c as MESH_JOIN_TOKEN_MAX_TTL_SEC, d as CLUSTER_SECRET_REF, i as MESH_CA_FIELD, l as SERVER_AUTH_OID, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID, v as hashClusterSecret } from "../../constants-C8T7u1_Z.mjs";
5
5
  import { a as KeyUsagesExtension, c as Pkcs10CertificateRequestGenerator, d as X509Certificate$1, f as X509CertificateGenerator, i as KeyUsageFlags, n as BasicConstraintsExtension, o as PemConverter, p as cryptoProvider, r as ExtendedKeyUsageExtension, s as Pkcs10CertificateRequest, t as AuthorityKeyIdentifierExtension, u as SubjectKeyIdentifierExtension } from "../../x509.es-CAjSsrkk.mjs";
6
6
  import { t as require_src } from "../../src-hG4grMU4.mjs";
7
7
  import { z } from "zod";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DxiDI8hZ.js");
6
+ const require_dist = require("../../dist-DVUg8e1T.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_chunk.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { en as logDestinationCapability, pr as BaseAddon } from "../../dist-DwE9yHdk.mjs";
1
+ import { Xt as logDestinationCapability, cr as BaseAddon } from "../../dist-DlmdESNT.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  import * as path$1 from "node:path";
4
4
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import { ar as compositionSourceKey, fr as errMsg } from "./dist-DwE9yHdk.mjs";
1
+ import { er as compositionSourceKey, sr as errMsg } from "./dist-DlmdESNT.mjs";
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-DxiDI8hZ.js");
1
+ const require_dist = require("./dist-DVUg8e1T.js");
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-DxiDI8hZ.js");
1
+ const require_dist = require("./dist-DVUg8e1T.js");
2
2
  let node_crypto = require("node:crypto");
3
3
  //#region src/kernel/moleculer/cluster-secret.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Tr as buildSecretRef } from "./dist-DwE9yHdk.mjs";
1
+ import { xr as buildSecretRef } from "./dist-DlmdESNT.mjs";
2
2
  import { createHash, timingSafeEqual } from "node:crypto";
3
3
  //#region src/kernel/moleculer/cluster-secret.ts
4
4
  /**
@@ -1,10 +1,10 @@
1
- import { P as MODEL_FORMATS, Rt as hfModelUrl, T as HF_REPO } from "./dist-DwE9yHdk.mjs";
2
1
  import { createHash } from "node:crypto";
3
2
  import * as path$1 from "node:path";
4
3
  import path from "node:path";
5
4
  import * as fs from "node:fs";
6
5
  import { createReadStream, promises } from "node:fs";
7
6
  import { promisify } from "node:util";
7
+ import { HF_REPO, MODEL_FORMATS, describeCustomActions, hfModelUrl } from "@camstack/types/addon";
8
8
  import { createServer } from "node:http";
9
9
  import { brotliCompress, constants as constants$1, gzip } from "node:zlib";
10
10
  import { PerformanceObserver } from "node:perf_hooks";
@@ -1378,4 +1378,59 @@ function startEventLoopStallMonitor(logger, reportThresholdMs = STALL_REPORT_MS)
1378
1378
  };
1379
1379
  }
1380
1380
  //#endregion
1381
- export { resolveFormatRevision as C, isModelDownloaded as S, downloadModel as _, createFileDataPlaneHandler as a, getModelFilePath as b, parseRangeHeader as c, ModelDownloadService as d, ModelDownloadHttpError as f, downloadFile as g, deleteModelFromDisk as h, startEventLoopStallMonitor as i, parseTokenizedUrl as l, collectModelFiles as m, STALL_TICK_MS as n, contentTypeFor as o, adoptModelRevisions as p, attributeStall as r, createAuthenticatedFileServer as s, STALL_REPORT_MS as t, resolveFilePath as u, ensureModel as v, revisionWeightUrl as w, isModelDownloadHttpError as x, fetchJson as y };
1381
+ //#region src/kernel/custom-action-registry.ts
1382
+ /**
1383
+ * CustomActionRegistry — per-process registry of addon custom actions.
1384
+ *
1385
+ * Populated at boot from each addon's `AddonInitResult.customActions` +
1386
+ * `handleCustomAction` handler. Rejects actions declared with scope other
1387
+ * than 'system' (today only 'system' is runtime-supported; the descriptor
1388
+ * allows future scopes for forward compat).
1389
+ */
1390
+ var CustomActionRegistry = class {
1391
+ byAddon = /* @__PURE__ */ new Map();
1392
+ registerAddon(addonId, catalog, handler) {
1393
+ const actions = /* @__PURE__ */ new Map();
1394
+ for (const [name, spec] of Object.entries(catalog)) {
1395
+ const scope = spec.scope ?? { kind: "system" };
1396
+ if (scope.kind !== "system") throw new Error(`custom action '${addonId}.${name}' declared scope '${scope.kind}' — not yet implemented`);
1397
+ actions.set(name, {
1398
+ spec,
1399
+ handler: (input, caller) => handler(name, input, caller)
1400
+ });
1401
+ }
1402
+ this.byAddon.set(addonId, actions);
1403
+ }
1404
+ unregisterAddon(addonId) {
1405
+ this.byAddon.delete(addonId);
1406
+ }
1407
+ resolve(addonId, action) {
1408
+ return this.byAddon.get(addonId)?.get(action) ?? null;
1409
+ }
1410
+ listActions(addonId) {
1411
+ return [...this.byAddon.get(addonId)?.keys() ?? []];
1412
+ }
1413
+ listAddons() {
1414
+ return [...this.byAddon.keys()];
1415
+ }
1416
+ /**
1417
+ * Every registered catalog with its schemas stripped, keyed by addon id —
1418
+ * what a runner puts in its register frame so the hub learns the catalogs
1419
+ * from the process that owns them (D444). `hostedAddonIds` are the addons
1420
+ * this runner hosts: each is present in the result, with an EMPTY catalog
1421
+ * when it registered none, so the parent can say "declares no actions" per
1422
+ * addon instead of guessing from an absent key.
1423
+ */
1424
+ describeAll(hostedAddonIds) {
1425
+ const out = {};
1426
+ for (const addonId of hostedAddonIds) out[addonId] = {};
1427
+ for (const [addonId, actions] of this.byAddon) {
1428
+ const catalog = {};
1429
+ for (const [name, entry] of actions) catalog[name] = entry.spec;
1430
+ out[addonId] = describeCustomActions(catalog);
1431
+ }
1432
+ return out;
1433
+ }
1434
+ };
1435
+ //#endregion
1436
+ export { isModelDownloaded as C, isModelDownloadHttpError as S, revisionWeightUrl as T, downloadFile as _, startEventLoopStallMonitor as a, fetchJson as b, createAuthenticatedFileServer as c, resolveFilePath as d, ModelDownloadService as f, deleteModelFromDisk as g, collectModelFiles as h, attributeStall as i, parseRangeHeader as l, adoptModelRevisions as m, STALL_REPORT_MS as n, createFileDataPlaneHandler as o, ModelDownloadHttpError as p, STALL_TICK_MS as r, contentTypeFor as s, CustomActionRegistry as t, parseTokenizedUrl as u, downloadModel as v, resolveFormatRevision as w, getModelFilePath as x, ensureModel as y };
@@ -1,11 +1,11 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-DxiDI8hZ.js");
3
2
  let node_crypto = require("node:crypto");
4
3
  let node_path = require("node:path");
5
4
  node_path = require_chunk.__toESM(node_path);
6
5
  let node_fs = require("node:fs");
7
6
  node_fs = require_chunk.__toESM(node_fs);
8
7
  let node_util = require("node:util");
8
+ let _camstack_types_addon = require("@camstack/types/addon");
9
9
  let node_http = require("node:http");
10
10
  let node_zlib = require("node:zlib");
11
11
  let node_perf_hooks = require("node:perf_hooks");
@@ -438,7 +438,7 @@ function readRevisionRecord(modelPath) {
438
438
  }
439
439
  }
440
440
  /** The CamStack model mirror. Every artefact under it has a generated revision. */
441
- var HOSTED_MODEL_MIRROR_PREFIX = require_dist.hfModelUrl(require_dist.HF_REPO, "");
441
+ var HOSTED_MODEL_MIRROR_PREFIX = (0, _camstack_types_addon.hfModelUrl)(_camstack_types_addon.HF_REPO, "");
442
442
  /**
443
443
  * The revision a format must be at — the ONE rule every model download path
444
444
  * reads (D743, D744). An inline `revision` wins; otherwise a format hosted on
@@ -608,7 +608,7 @@ async function adoptModelRevisions(modelsDir, entries) {
608
608
  };
609
609
  }
610
610
  function isModelFormat(value) {
611
- return require_dist.MODEL_FORMATS.some((f) => f === value);
611
+ return _camstack_types_addon.MODEL_FORMATS.some((f) => f === value);
612
612
  }
613
613
  /** Compute the on-disk path for a given model + format, even when not yet downloaded. */
614
614
  function getModelFilePath(modelsDir, entry, format) {
@@ -1379,6 +1379,67 @@ function startEventLoopStallMonitor(logger, reportThresholdMs = STALL_REPORT_MS)
1379
1379
  };
1380
1380
  }
1381
1381
  //#endregion
1382
+ //#region src/kernel/custom-action-registry.ts
1383
+ /**
1384
+ * CustomActionRegistry — per-process registry of addon custom actions.
1385
+ *
1386
+ * Populated at boot from each addon's `AddonInitResult.customActions` +
1387
+ * `handleCustomAction` handler. Rejects actions declared with scope other
1388
+ * than 'system' (today only 'system' is runtime-supported; the descriptor
1389
+ * allows future scopes for forward compat).
1390
+ */
1391
+ var CustomActionRegistry = class {
1392
+ byAddon = /* @__PURE__ */ new Map();
1393
+ registerAddon(addonId, catalog, handler) {
1394
+ const actions = /* @__PURE__ */ new Map();
1395
+ for (const [name, spec] of Object.entries(catalog)) {
1396
+ const scope = spec.scope ?? { kind: "system" };
1397
+ if (scope.kind !== "system") throw new Error(`custom action '${addonId}.${name}' declared scope '${scope.kind}' — not yet implemented`);
1398
+ actions.set(name, {
1399
+ spec,
1400
+ handler: (input, caller) => handler(name, input, caller)
1401
+ });
1402
+ }
1403
+ this.byAddon.set(addonId, actions);
1404
+ }
1405
+ unregisterAddon(addonId) {
1406
+ this.byAddon.delete(addonId);
1407
+ }
1408
+ resolve(addonId, action) {
1409
+ return this.byAddon.get(addonId)?.get(action) ?? null;
1410
+ }
1411
+ listActions(addonId) {
1412
+ return [...this.byAddon.get(addonId)?.keys() ?? []];
1413
+ }
1414
+ listAddons() {
1415
+ return [...this.byAddon.keys()];
1416
+ }
1417
+ /**
1418
+ * Every registered catalog with its schemas stripped, keyed by addon id —
1419
+ * what a runner puts in its register frame so the hub learns the catalogs
1420
+ * from the process that owns them (D444). `hostedAddonIds` are the addons
1421
+ * this runner hosts: each is present in the result, with an EMPTY catalog
1422
+ * when it registered none, so the parent can say "declares no actions" per
1423
+ * addon instead of guessing from an absent key.
1424
+ */
1425
+ describeAll(hostedAddonIds) {
1426
+ const out = {};
1427
+ for (const addonId of hostedAddonIds) out[addonId] = {};
1428
+ for (const [addonId, actions] of this.byAddon) {
1429
+ const catalog = {};
1430
+ for (const [name, entry] of actions) catalog[name] = entry.spec;
1431
+ out[addonId] = (0, _camstack_types_addon.describeCustomActions)(catalog);
1432
+ }
1433
+ return out;
1434
+ }
1435
+ };
1436
+ //#endregion
1437
+ Object.defineProperty(exports, "CustomActionRegistry", {
1438
+ enumerable: true,
1439
+ get: function() {
1440
+ return CustomActionRegistry;
1441
+ }
1442
+ });
1382
1443
  Object.defineProperty(exports, "ModelDownloadHttpError", {
1383
1444
  enumerable: true,
1384
1445
  get: function() {