@camstack/system 1.2.415 → 1.2.417
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon-runner.js +9969 -27
- package/dist/addon-runner.mjs +9930 -9
- package/dist/addon-utils.js +19 -20
- package/dist/addon-utils.mjs +1 -2
- package/dist/auth/auth-audit-log.d.ts +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +3 -3
- package/dist/builtins/keychain/index.mjs +3 -3
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +12 -9
- package/dist/builtins/local-auth/local-auth.addon.mjs +7 -4
- package/dist/builtins/local-network/hub-mdns-ciao.d.ts +7 -0
- package/dist/builtins/local-network/hub-mdns.d.ts +58 -0
- package/dist/builtins/local-network/local-network.addon.d.ts +11 -0
- package/dist/builtins/local-network/local-network.addon.js +194 -3
- package/dist/builtins/local-network/local-network.addon.mjs +195 -3
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +102 -10
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +92 -4
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/index.mjs +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +84 -5
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +80 -5
- package/dist/builtins/system-config/system-config.addon.js +80 -785
- package/dist/builtins/system-config/system-config.addon.mjs +52 -757
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-YlkCjf-1.js → composition-sources-ChAX2Kdo.js} +1 -1
- package/dist/{composition-sources-CXxkMoXq.mjs → composition-sources-CndJVssc.mjs} +1 -1
- package/dist/{constants-BT-fudVK.mjs → constants-BzxwnfDc.mjs} +1 -1
- package/dist/{constants-DChnQrhM.js → constants-VXvZkGgw.js} +1 -1
- package/dist/{event-loop-stall-monitor-LZvGqiHI.js → custom-action-registry-Bb28ibZV.js} +63 -1
- package/dist/{event-loop-stall-monitor-BEfMVUxz.mjs → custom-action-registry-DHv0kYcT.mjs} +58 -2
- package/dist/{dist-CvarXqQt.js → dist-BMOD9OyH.js} +32 -111
- package/dist/{dist-dEsHYY8m.mjs → dist-H_RapIeM.mjs} +21 -100
- package/dist/index.js +22786 -10067
- package/dist/index.mjs +22602 -9883
- package/dist/{jwt-signing-key-CfiteETM.js → jwt-signing-key-BiKHENST.js} +1 -1
- package/dist/{jwt-signing-key-SFIxaH2x.mjs → jwt-signing-key-xQxqpwMC.mjs} +1 -1
- package/dist/kernel/moleculer/broker-factory.d.ts +2 -4
- package/dist/kernel/transport/local-child-registry.d.ts +1 -1
- package/dist/lib-B_R6sPC3.mjs +7106 -0
- package/dist/lib-DOJ5yyWA.js +7110 -0
- package/dist/logging/log-redactor.d.ts +1 -1
- package/dist/{ms-DlIWNkkk.mjs → ms-CgH2OFlD.mjs} +2 -42
- package/dist/{ms-t68_FaqE.js → ms-LB3giGoU.js} +1 -48
- package/dist/{resource-monitor-B2WZ8_q9.mjs → resource-monitor-Di9daRwI.mjs} +1 -1
- package/dist/{resource-monitor-BgWGRxN5.js → resource-monitor-mio9dSCT.js} +5 -5
- package/dist/{restore-archive-CAw_3iNq.js → restore-archive-BobsETEp.js} +1 -1
- package/dist/{restore-archive-Bww1Fl04.mjs → restore-archive-CCAQicV-.mjs} +1 -1
- package/dist/{retired-settings-keys-YLflwTPH.js → retired-settings-keys-BMq2u4Wv.js} +1 -1
- package/dist/{retired-settings-keys-ChQ3qH-V.mjs → retired-settings-keys-CwL4zHLg.mjs} +1 -1
- package/dist/safe-buffer-B1OjL1I9.mjs +42 -0
- package/dist/safe-buffer-D3aoa-7X.js +46 -0
- package/dist/src-CnAqG6EF.js +714 -0
- package/dist/src-hG4grMU4.mjs +709 -0
- package/dist/{tls-BWpwU-d5.js → tls-C0TRPfqc.js} +1 -1
- package/dist/{tls-C2NT-Orr.mjs → tls-D-2dPY-5.mjs} +1 -1
- package/dist/{x509.es-Xf3K_brW.mjs → x509.es-CAjSsrkk.mjs} +643 -2
- package/dist/{x509.es-BhTzcFhZ.js → x509.es-Dzl0BbmG.js} +653 -0
- package/package.json +3 -2
- package/dist/child-cap-dispatch-DFBrdGH2.js +0 -13986
- package/dist/child-cap-dispatch-SF8oiwgo.mjs +0 -12916
- package/dist/custom-action-registry-B4Cf4O_X.mjs +0 -57
- package/dist/custom-action-registry-acBY3mHA.js +0 -62
- package/dist/hub-cap-forward-CDiN1p98.mjs +0 -78
- package/dist/hub-cap-forward-W8oEm4ME.js +0 -101
- package/dist/proc-stat-CbC55Kqi.mjs +0 -92
- package/dist/proc-stat-DL-WUOhl.js +0 -127
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as parseProcStat, i as nodeProcReader, n as elapsedSecSince, o as parseProcStatusRss, r as lifetimeCpuPercent, t as commandFromCmdline } from "../../proc-stat-CbC55Kqi.mjs";
|
|
1
|
+
import { Dr as createEvent, Ft as foldSnapshotByFunction, Sn as resolveBucketMs, dr as errMsg, fr as BaseAddon, on as metricsProviderCapability, ri as EventCategory, yn as reducePoints } from "../../dist-H_RapIeM.mjs";
|
|
3
2
|
import { access, readFile, readdir } from "node:fs/promises";
|
|
4
3
|
import * as os from "node:os";
|
|
5
4
|
import { platform } from "node:os";
|
|
@@ -2121,7 +2120,7 @@ var NativeMetricsProvider = class {
|
|
|
2121
2120
|
return getCpuTemperatureInternal();
|
|
2122
2121
|
}
|
|
2123
2122
|
async getProcessStats(input) {
|
|
2124
|
-
const { getPidStats } = await import("../../resource-monitor-
|
|
2123
|
+
const { getPidStats } = await import("../../resource-monitor-Di9daRwI.mjs").then((n) => n.r);
|
|
2125
2124
|
const raw = await getPidStats(input.pids);
|
|
2126
2125
|
const result = [];
|
|
2127
2126
|
for (const [pid, s] of raw) result.push({
|
|
@@ -2457,6 +2456,95 @@ function execAsync(cmd, args, timeoutMs = 5e3) {
|
|
|
2457
2456
|
});
|
|
2458
2457
|
});
|
|
2459
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Parse one `/proc/<pid>/stat` line. `null` for a line that does not parse —
|
|
2461
|
+
* a process that exited between the readdir and the read leaves a truncated
|
|
2462
|
+
* or empty file, and that is normal, not an error.
|
|
2463
|
+
*/
|
|
2464
|
+
function parseProcStat(line) {
|
|
2465
|
+
const close = line.lastIndexOf(")");
|
|
2466
|
+
const open = line.indexOf("(");
|
|
2467
|
+
if (close < 0 || open < 0 || close < open) return null;
|
|
2468
|
+
const pid = Number(line.slice(0, open).trim());
|
|
2469
|
+
const comm = line.slice(open + 1, close);
|
|
2470
|
+
const rest = line.slice(close + 1).trim().split(/\s+/);
|
|
2471
|
+
const state = rest[0];
|
|
2472
|
+
const ppid = Number(rest[1]);
|
|
2473
|
+
const pgid = Number(rest[2]);
|
|
2474
|
+
const utime = Number(rest[11]);
|
|
2475
|
+
const stime = Number(rest[12]);
|
|
2476
|
+
const startTicks = Number(rest[19]);
|
|
2477
|
+
const rssPages = Number(rest[21]);
|
|
2478
|
+
if (state === void 0 || state === "") return null;
|
|
2479
|
+
if (![
|
|
2480
|
+
pid,
|
|
2481
|
+
ppid,
|
|
2482
|
+
pgid,
|
|
2483
|
+
utime,
|
|
2484
|
+
stime,
|
|
2485
|
+
startTicks,
|
|
2486
|
+
rssPages
|
|
2487
|
+
].every(Number.isFinite)) return null;
|
|
2488
|
+
return {
|
|
2489
|
+
pid,
|
|
2490
|
+
comm,
|
|
2491
|
+
state,
|
|
2492
|
+
ppid,
|
|
2493
|
+
pgid,
|
|
2494
|
+
ticks: utime + stime,
|
|
2495
|
+
startTicks,
|
|
2496
|
+
rssPages
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
function statusKb(status, key) {
|
|
2500
|
+
const match = status.match(new RegExp(`^${key}:\\s+(\\d+)`, "m"));
|
|
2501
|
+
return match ? parseInt(match[1], 10) * 1024 : void 0;
|
|
2502
|
+
}
|
|
2503
|
+
/** Read `VmRSS` / `RssAnon` / `RssFile` (kB in the file) out of `/proc/<pid>/status`. */
|
|
2504
|
+
function parseProcStatusRss(status) {
|
|
2505
|
+
return {
|
|
2506
|
+
rssBytes: statusKb(status, "VmRSS"),
|
|
2507
|
+
privateBytes: statusKb(status, "RssAnon"),
|
|
2508
|
+
sharedBytes: statusKb(status, "RssFile")
|
|
2509
|
+
};
|
|
2510
|
+
}
|
|
2511
|
+
/** Seconds the process has been alive — `ps etime`, whole seconds. */
|
|
2512
|
+
function elapsedSecSince(input) {
|
|
2513
|
+
return Math.max(0, Math.floor(input.uptimeSec - input.startTicks / 100));
|
|
2514
|
+
}
|
|
2515
|
+
/**
|
|
2516
|
+
* `ps pcpu`: CPU time over elapsed time, as a percentage with one decimal.
|
|
2517
|
+
*
|
|
2518
|
+
* This is deliberately the LIFETIME average `ps` prints, not an instantaneous
|
|
2519
|
+
* rate: the columns fed from it have always shown that quantity, and the
|
|
2520
|
+
* instantaneous split is a different number with a different owner
|
|
2521
|
+
* (`cpuMainPercent` / `cpuGcPercent` from `thread-cpu-sampler.ts`). A process
|
|
2522
|
+
* with no elapsed window yet reports 0, never a division by zero.
|
|
2523
|
+
*/
|
|
2524
|
+
function lifetimeCpuPercent(input) {
|
|
2525
|
+
const elapsedSec = input.uptimeSec - input.startTicks / 100;
|
|
2526
|
+
if (!(elapsedSec > 0)) return 0;
|
|
2527
|
+
const cpuSec = input.ticks / 100;
|
|
2528
|
+
return Math.round(cpuSec / elapsedSec * 1e3) / 10;
|
|
2529
|
+
}
|
|
2530
|
+
var PID_RE = /^\d+$/;
|
|
2531
|
+
var nodeProcReader = {
|
|
2532
|
+
listPids: async () => (await readdir("/proc")).filter((entry) => PID_RE.test(entry)).map((entry) => Number(entry)),
|
|
2533
|
+
readStat: (pid) => readFile(`/proc/${pid}/stat`, "latin1"),
|
|
2534
|
+
readStatus: (pid) => readFile(`/proc/${pid}/status`, "latin1"),
|
|
2535
|
+
readCmdline: (pid) => readFile(`/proc/${pid}/cmdline`, "latin1"),
|
|
2536
|
+
readUptimeSec: async () => {
|
|
2537
|
+
const [first] = (await readFile("/proc/uptime", "latin1")).trim().split(/\s+/);
|
|
2538
|
+
const seconds = Number(first);
|
|
2539
|
+
if (!Number.isFinite(seconds)) throw new Error(`/proc/uptime unreadable: ${String(first)}`);
|
|
2540
|
+
return seconds;
|
|
2541
|
+
}
|
|
2542
|
+
};
|
|
2543
|
+
/** `ps command=`: argv joined by spaces, or `[comm]` when there is no argv. */
|
|
2544
|
+
function commandFromCmdline(cmdline, comm) {
|
|
2545
|
+
const joined = cmdline.split("\0").filter((part) => part.length > 0).join(" ");
|
|
2546
|
+
return joined.length > 0 ? joined : `[${comm}]`;
|
|
2547
|
+
}
|
|
2460
2548
|
//#endregion
|
|
2461
2549
|
//#region src/builtins/native-metrics/proc-process-table.ts
|
|
2462
2550
|
/**
|
|
@@ -3474,4 +3562,4 @@ var NativeMetricsAddon = class NativeMetricsAddon extends BaseAddon {
|
|
|
3474
3562
|
}
|
|
3475
3563
|
};
|
|
3476
3564
|
//#endregion
|
|
3477
|
-
export { NativeMetricsAddon as default,
|
|
3565
|
+
export { NativeMetricsProvider as a, NativeMetricsAddon as default, parseProcStatusRss as i, nodeProcReader as n, parseProcStat as r, lifetimeCpuPercent as t };
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-BMOD9OyH.js");
|
|
7
7
|
let node_os = require("node:os");
|
|
8
8
|
node_os = require_chunk.__toESM(node_os);
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as __toESM } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Et as enumerateInferenceDevices, Mn as scoreRuntimes, dr as errMsg, fr as BaseAddon, gn as platformProbeCapability, jr as emitReadiness, ri as EventCategory } from "../../dist-H_RapIeM.mjs";
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
5
|
import { execFile } from "node:child_process";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-BMOD9OyH.js");
|
|
7
7
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
8
8
|
/**
|
|
9
9
|
* Reconcile the durable `enabledProviders` set against authoritative
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fr as BaseAddon, ri as EventCategory } from "../../dist-H_RapIeM.mjs";
|
|
2
2
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
3
3
|
/**
|
|
4
4
|
* Reconcile the durable `enabledProviders` set against authoritative
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-BMOD9OyH.js");
|
|
7
7
|
const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as bareAddonId, Fn as snapshotCapability, Hr as nodePin, Vn as streamQualityLabel, a as BatteryStatusSchema, an as memoizePinnedFfmpeg, bt as deriveBatteryPresence, cr as DeviceFeature, dr as errMsg, et as batteryCapability, fr as BaseAddon, ri as EventCategory, ur as DeviceType } from "../../dist-H_RapIeM.mjs";
|
|
2
2
|
import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-BMOD9OyH.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs_promises = require("node:fs/promises");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Pt as filesystemBrowseCapability, fr as BaseAddon, zn as storageProviderCapability } from "../../dist-H_RapIeM.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StorageOrchestratorAddon,
|
|
1
|
+
import { StorageOrchestratorAddon, c as SqliteLocationStore, s as StorageMigrationCoordinator, t as StorageOrchestratorService } from "./storage-orchestrator.addon.mjs";
|
|
2
2
|
export { SqliteLocationStore, StorageMigrationCoordinator, StorageOrchestratorAddon, StorageOrchestratorAddon as default, StorageOrchestratorService };
|
|
@@ -3,8 +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-
|
|
7
|
-
const require_hub_cap_forward = require("../../hub-cap-forward-W8oEm4ME.js");
|
|
6
|
+
const require_dist = require("../../dist-BMOD9OyH.js");
|
|
8
7
|
let zod = require("zod");
|
|
9
8
|
let node_crypto = require("node:crypto");
|
|
10
9
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -1380,6 +1379,83 @@ var SqliteDrainStateStore = class {
|
|
|
1380
1379
|
}
|
|
1381
1380
|
};
|
|
1382
1381
|
//#endregion
|
|
1382
|
+
//#region src/kernel/transport/hub-cap-forward.ts
|
|
1383
|
+
/** The Moleculer service name the hub registers for agent→hub cap forwarding. */
|
|
1384
|
+
var HUB_CAP_FWD_SERVICE = "$hub-cap-fwd";
|
|
1385
|
+
/** The Moleculer action (service.action) for hub cap forwarding. */
|
|
1386
|
+
var HUB_CAP_FWD_ACTION = `${HUB_CAP_FWD_SERVICE}.forward`;
|
|
1387
|
+
/**
|
|
1388
|
+
* Drop a `caller` the forwarded args carry. `caller` is the USER identity the
|
|
1389
|
+
* hub's tRPC router injects for `caller: 'required'` methods
|
|
1390
|
+
* (`cap-router-builder.ts`), and providers trust it — `keychainAdmin.reveal`
|
|
1391
|
+
* reads `input.caller.userId`. A call that arrives over the mesh has no user
|
|
1392
|
+
* session behind it, so whatever `caller` it carries is forged (D802). The
|
|
1393
|
+
* args' `callerAddonId` is overwritten or stripped further down by
|
|
1394
|
+
* `stampCallerAddonId`; `caller` had no such guard.
|
|
1395
|
+
*/
|
|
1396
|
+
function stripForwardedCaller(args) {
|
|
1397
|
+
if (args === null || typeof args !== "object" || Array.isArray(args)) return args;
|
|
1398
|
+
if (!Object.prototype.hasOwnProperty.call(args, "caller")) return args;
|
|
1399
|
+
const rest = {};
|
|
1400
|
+
for (const [key, value] of Object.entries(args)) if (key !== "caller") rest[key] = value;
|
|
1401
|
+
return rest;
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Narrow Moleculer's loosely-typed `ctx.params` to {@link HubCapForwardParams}
|
|
1405
|
+
* without unsafe casts — mirrors `agent-cap-dispatch-service.ts:narrowParams`.
|
|
1406
|
+
*/
|
|
1407
|
+
function narrowParams(raw) {
|
|
1408
|
+
if (raw === null || typeof raw !== "object") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
1409
|
+
const capName = Reflect.get(raw, "capName");
|
|
1410
|
+
const method = Reflect.get(raw, "method");
|
|
1411
|
+
if (typeof capName !== "string" || typeof method !== "string") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
1412
|
+
const deviceId = Reflect.get(raw, "deviceId");
|
|
1413
|
+
const nodeId = Reflect.get(raw, "nodeId");
|
|
1414
|
+
const native = Reflect.get(raw, "native");
|
|
1415
|
+
const callerAddonId = Reflect.get(raw, "callerAddonId");
|
|
1416
|
+
return {
|
|
1417
|
+
capName,
|
|
1418
|
+
method,
|
|
1419
|
+
args: stripForwardedCaller(Reflect.get(raw, "args")),
|
|
1420
|
+
deviceId: typeof deviceId === "number" ? deviceId : void 0,
|
|
1421
|
+
nodeId: typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0,
|
|
1422
|
+
native: native === true ? true : void 0,
|
|
1423
|
+
callerAddonId: typeof callerAddonId === "string" && callerAddonId.length > 0 ? callerAddonId : void 0
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
|
|
1428
|
+
* its broker (only the hub registers it → an agent's `broker.call` for
|
|
1429
|
+
* `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
|
|
1430
|
+
*
|
|
1431
|
+
* @param onUnownedCall The hub's cap routing handler (from
|
|
1432
|
+
* `createParentUnownedCallHandler`). Reused verbatim so
|
|
1433
|
+
* forwarded calls route exactly like a hub-local child's.
|
|
1434
|
+
*/
|
|
1435
|
+
function createHubCapForwardService(onUnownedCall, options = {}) {
|
|
1436
|
+
return {
|
|
1437
|
+
name: HUB_CAP_FWD_SERVICE,
|
|
1438
|
+
actions: { forward: { handler: async (ctx) => {
|
|
1439
|
+
const { capName, method, args, deviceId, nodeId, native, callerAddonId } = narrowParams(ctx.params);
|
|
1440
|
+
const sender = typeof ctx.nodeID === "string" ? ctx.nodeID : null;
|
|
1441
|
+
let caller = callerAddonId;
|
|
1442
|
+
if (caller !== void 0 && options.isCallerOnNode !== void 0 && (sender === null || !options.isCallerOnNode(sender, caller))) {
|
|
1443
|
+
options.onRejectedCaller?.(sender ?? "(unknown node)", caller);
|
|
1444
|
+
caller = void 0;
|
|
1445
|
+
}
|
|
1446
|
+
return onUnownedCall({
|
|
1447
|
+
capName,
|
|
1448
|
+
method,
|
|
1449
|
+
args,
|
|
1450
|
+
...deviceId !== void 0 ? { deviceId } : {},
|
|
1451
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
1452
|
+
...native === true ? { native: true } : {},
|
|
1453
|
+
...caller !== void 0 ? { callerAddonId: caller } : {}
|
|
1454
|
+
});
|
|
1455
|
+
} } }
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1383
1459
|
//#region src/builtins/storage-orchestrator/hub-settings-forward.ts
|
|
1384
1460
|
/**
|
|
1385
1461
|
* The data door with the HUB behind it — an agent's `settings-store` provider.
|
|
@@ -1513,7 +1589,7 @@ function resolveHubSettingsForward(options) {
|
|
|
1513
1589
|
const broker = options.broker;
|
|
1514
1590
|
if (!broker) return null;
|
|
1515
1591
|
options.logger.info("storage-orchestrator: no local data-store engine on this node — the data door forwards to the hub");
|
|
1516
|
-
return createHubSettingsForward((envelope) => broker.call(
|
|
1592
|
+
return createHubSettingsForward((envelope) => broker.call(HUB_CAP_FWD_ACTION, {
|
|
1517
1593
|
capName: envelope.capName,
|
|
1518
1594
|
method: envelope.method,
|
|
1519
1595
|
args: envelope.args
|
|
@@ -3992,8 +4068,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
3992
4068
|
timestamp: /* @__PURE__ */ new Date(),
|
|
3993
4069
|
source: {
|
|
3994
4070
|
type: "addon",
|
|
3995
|
-
id: this.
|
|
3996
|
-
nodeId: ctx.nodeId
|
|
4071
|
+
id: this.ctx.id
|
|
3997
4072
|
},
|
|
3998
4073
|
category,
|
|
3999
4074
|
data: {
|
|
@@ -4514,9 +4589,13 @@ function parseOrphanStatus(raw) {
|
|
|
4514
4589
|
};
|
|
4515
4590
|
}
|
|
4516
4591
|
//#endregion
|
|
4592
|
+
exports.HUB_CAP_FWD_ACTION = HUB_CAP_FWD_ACTION;
|
|
4593
|
+
exports.HUB_CAP_FWD_SERVICE = HUB_CAP_FWD_SERVICE;
|
|
4517
4594
|
exports.SqliteLocationStore = SqliteLocationStore;
|
|
4518
4595
|
exports.StorageMigrationCoordinator = StorageMigrationCoordinator;
|
|
4519
4596
|
exports.StorageOrchestratorAddon = StorageOrchestratorAddon;
|
|
4520
4597
|
exports.default = StorageOrchestratorAddon;
|
|
4521
4598
|
exports.StorageOrchestratorService = StorageOrchestratorService;
|
|
4522
4599
|
exports.buildStorageLocationRegistry = buildStorageLocationRegistry;
|
|
4600
|
+
exports.createHubCapForwardService = createHubCapForwardService;
|
|
4601
|
+
exports.stripForwardedCaller = stripForwardedCaller;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as HUB_CAP_FWD_ACTION } from "../../hub-cap-forward-CDiN1p98.mjs";
|
|
1
|
+
import { A as LegacyStorageLocationDefaultSchema, At as evictionPolicyOfLocation, En as resolveLocationMode, G as StorageMigrationJobSchema, H as StorageCleanupJobSchema, In as storageCapability, Ln as storageMigrationCapability, Lt as gbToBytes, Nn as settingsStoreCapability, Tr as collectSecretConfigKeys, U as StorageLocationModeSchema, Ut as isLocationEnabled, W as StorageLocationTypeSchema, Wr as parseJsonObject, Xt as legacyModeOf, Yn as withLocationMode, Yr as resolveSecretMarkers, Zr as secretTreeFromPaths, fr as BaseAddon, gr as REDACTED_SECRET, in as mayWriteToLocation, ni as transformSecretWrite, ri as EventCategory, rn as mayReadLocation, sn as modeMayWrite, zr as isSecretMarker } from "../../dist-H_RapIeM.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.
|
|
@@ -3987,8 +4063,7 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
3987
4063
|
timestamp: /* @__PURE__ */ new Date(),
|
|
3988
4064
|
source: {
|
|
3989
4065
|
type: "addon",
|
|
3990
|
-
id: this.
|
|
3991
|
-
nodeId: ctx.nodeId
|
|
4066
|
+
id: this.ctx.id
|
|
3992
4067
|
},
|
|
3993
4068
|
category,
|
|
3994
4069
|
data: {
|
|
@@ -4509,4 +4584,4 @@ function parseOrphanStatus(raw) {
|
|
|
4509
4584
|
};
|
|
4510
4585
|
}
|
|
4511
4586
|
//#endregion
|
|
4512
|
-
export { StorageOrchestratorAddon, StorageOrchestratorAddon as default, SqliteLocationStore as i,
|
|
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 };
|