@camstack/server 1.2.729 → 1.2.731
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/CHANGELOG.md +18 -0
- package/dist/api/core/server-management.provider.js +10 -3
- package/dist/api/trpc/generated-cap-mounts.js +4 -1
- package/dist/api/trpc/generated-cap-routers.js +1864 -1765
- package/dist/boot/boot-config.js +2 -46
- package/dist/launch-args.js +72 -34
- package/dist/main.js +2 -1
- package/package.json +17 -19
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-BXB7X23w.mjs → agent-https-AJPmB73W.mjs} +1 -1
- package/system/dist/{agent-https-BMmfwElS.js → agent-https-CLJhq0GZ.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +6 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +1361 -440
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +1360 -440
- package/system/dist/builtins/core-blocks/fan-presets-action-source.d.ts +35 -0
- package/system/dist/builtins/core-blocks/fan-presets-service.d.ts +83 -0
- package/system/dist/builtins/core-blocks/fan-presets-wiring.d.ts +31 -0
- package/system/dist/builtins/core-blocks/record-kinds.d.ts +15 -0
- package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +84 -0
- package/system/dist/builtins/core-blocks/timed-run/timed-run-wiring.d.ts +21 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +285 -285
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{composition-sources-D6b0p8Hl.js → composition-sources-BNBlJAgu.js} +1 -1
- package/system/dist/{composition-sources-BCfgVe9V.mjs → composition-sources-D-S2hhdw.mjs} +1 -1
- package/system/dist/{constants-ePrW9DMj.js → constants-CKwdQTnw.js} +1 -1
- package/system/dist/{constants-BQLyzulL.mjs → constants-DmithOex.mjs} +1 -1
- package/system/dist/{coral-accelerators-DBlgWB8k.mjs → coral-accelerators-BW3OcrLD.mjs} +6 -6
- package/system/dist/{custom-action-registry-oHl1xltx.mjs → custom-action-registry-BIJZBObd.mjs} +37 -37
- package/system/dist/{device-ca-C8X1AGHU.mjs → device-ca-D-Cvxobt.mjs} +1 -1
- package/system/dist/{device-ca-Dh9wjg_e.js → device-ca-TbdQfW4d.js} +1 -1
- package/system/dist/{dist-D-7p7cJp.js → dist-dQKZfa3-.js} +43443 -42687
- package/system/dist/{dist-XvOCXwnA.mjs → dist-yrk6fm65.mjs} +42934 -42238
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CGwz5__T.mjs → hub-mdns-ciao-Cae5VWUc.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-BFZZAJIx.js → hub-mdns-ciao-DP3_GNZw.js} +2 -2
- package/system/dist/index.d.ts +1 -1
- package/system/dist/index.js +19 -9
- package/system/dist/index.mjs +230 -221
- package/system/dist/kernel/heap-watch.d.ts +7 -2
- package/system/dist/{restore-archive-B3M3ZwAl.mjs → restore-archive-BJ5gxMvf.mjs} +150 -150
- package/system/dist/{restore-archive-3e5X8g6h.js → restore-archive-X9c_wEBY.js} +1 -1
- package/system/dist/{retention-BPxZj_Qf.mjs → retention-DBrdAv12.mjs} +1 -1
- package/system/dist/{retention-DacNjIXz.js → retention-DRT2wUyB.js} +1 -1
- package/system/dist/{wal-maintenance-C4K7pX1x.mjs → wal-maintenance-Bi4yImEY.mjs} +0 -0
- package/system/dist/{wal-maintenance-Dguwwx4N.js → wal-maintenance-hsgNGrjh.js} +0 -0
- package/system/package.json +10 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists every fan preset as an `action-source` entry so the surfaces that
|
|
3
|
+
* publish actions (a scene, a switch, a button — D968) offer "set the fan to
|
|
4
|
+
* Night" without knowing what a fan preset is. The entry id is
|
|
5
|
+
* `<addonId>:fan-preset:<deviceId>/<presetId>`; running it applies the preset
|
|
6
|
+
* and FAILS the run when any step did not apply, naming the first one.
|
|
7
|
+
*/
|
|
8
|
+
import { type ActionEntry, type IActionSourceProvider, type IFanPresetsProvider, type IScopedLogger } from "@camstack/types";
|
|
9
|
+
import type { FanPresetsDevices, FanPresetsStore } from "./fan-presets-service.js";
|
|
10
|
+
export interface FanPresetActionSourceDeps {
|
|
11
|
+
readonly presets: Pick<IFanPresetsProvider, "applyPreset">;
|
|
12
|
+
readonly devices: Pick<FanPresetsDevices, "describe">;
|
|
13
|
+
readonly store: Pick<FanPresetsStore, "listAll">;
|
|
14
|
+
/** The addon that declares the entries (the id prefix). */
|
|
15
|
+
readonly addonId: string;
|
|
16
|
+
readonly logger: IScopedLogger;
|
|
17
|
+
}
|
|
18
|
+
interface ParsedPresetAction {
|
|
19
|
+
readonly deviceId: number;
|
|
20
|
+
readonly presetId: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function fanPresetActionId(addonId: string, deviceId: number, presetId: string): string;
|
|
23
|
+
export declare function parseFanPresetActionId(addonId: string, actionId: string): ParsedPresetAction | null;
|
|
24
|
+
export declare class FanPresetActionSource implements IActionSourceProvider {
|
|
25
|
+
private readonly deps;
|
|
26
|
+
constructor(deps: FanPresetActionSourceDeps);
|
|
27
|
+
listActions(_input: Record<string, never>): Promise<ActionEntry[]>;
|
|
28
|
+
runAction(input: {
|
|
29
|
+
actionId: string;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
stopAction(input: {
|
|
32
|
+
actionId: string;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `fan-presets` cap: named settings an operator composes for a fan — its
|
|
3
|
+
* own fields (speed, oscillation, direction, native preset) and the devices
|
|
4
|
+
* that sit in the same container (a light, a control). A preset is a short
|
|
5
|
+
* sequence of action steps kept in the fan's settings store (D865, key
|
|
6
|
+
* `fanPresets`).
|
|
7
|
+
*
|
|
8
|
+
* Decisions that shape this file:
|
|
9
|
+
* - **A step may only touch the fan or one of its siblings.** The sibling
|
|
10
|
+
* set is the children of the fan's parent device (the container), or the
|
|
11
|
+
* fan's own children when it has none. Checked at save AND again at apply,
|
|
12
|
+
* because the container changes after a preset was written.
|
|
13
|
+
* - **Apply runs the shared step runner** (`buildActionSteps` + `runSteps`),
|
|
14
|
+
* in order, stopping at the first failure; every step is reported and a
|
|
15
|
+
* failure names its step (D391). Nothing the operator did not write runs.
|
|
16
|
+
* - **Capture never stores a guess.** A reading that is unknown is left out
|
|
17
|
+
* and named, never written as 0 (D393).
|
|
18
|
+
*/
|
|
19
|
+
import { type CapCall, type ControlStatus, type FanControlStatus, type FanPreset, type IFanPresetsProvider, type IScopedLogger, type SwitchStatus, DeviceType } from "@camstack/types";
|
|
20
|
+
/** The per-device store the presets live in. */
|
|
21
|
+
export interface FanPresetsStore {
|
|
22
|
+
read(deviceId: number): Promise<readonly FanPreset[]>;
|
|
23
|
+
write(deviceId: number, presets: readonly FanPreset[]): Promise<void>;
|
|
24
|
+
/** Every fan that has at least one preset. */
|
|
25
|
+
listAll(): Promise<ReadonlyMap<number, readonly FanPreset[]>>;
|
|
26
|
+
}
|
|
27
|
+
export interface FanPresetDeviceFacts {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly type: DeviceType;
|
|
30
|
+
readonly parentDeviceId: number | null;
|
|
31
|
+
}
|
|
32
|
+
export interface FanPresetsDevices {
|
|
33
|
+
describe(deviceId: number): Promise<FanPresetDeviceFacts | null>;
|
|
34
|
+
childrenOf(parentDeviceId: number): Promise<readonly number[]>;
|
|
35
|
+
}
|
|
36
|
+
/** Current values, each null when no source answers (D393). */
|
|
37
|
+
export interface FanPresetsReadings {
|
|
38
|
+
fan(deviceId: number): Promise<FanControlStatus | null>;
|
|
39
|
+
control(deviceId: number): Promise<ControlStatus | null>;
|
|
40
|
+
switchState(deviceId: number): Promise<SwitchStatus | null>;
|
|
41
|
+
}
|
|
42
|
+
export interface FanPresetsServiceDeps {
|
|
43
|
+
readonly store: FanPresetsStore;
|
|
44
|
+
readonly devices: FanPresetsDevices;
|
|
45
|
+
readonly readings: FanPresetsReadings;
|
|
46
|
+
/** Runs one device cap call; throws when it fails. */
|
|
47
|
+
invoke(call: CapCall): Promise<void>;
|
|
48
|
+
readonly logger: IScopedLogger;
|
|
49
|
+
readonly now?: () => number;
|
|
50
|
+
}
|
|
51
|
+
type SetResult = Awaited<ReturnType<IFanPresetsProvider["setPresets"]>>;
|
|
52
|
+
type ApplyResult = Awaited<ReturnType<IFanPresetsProvider["applyPreset"]>>;
|
|
53
|
+
type CaptureResult = Awaited<ReturnType<IFanPresetsProvider["capturePreset"]>>;
|
|
54
|
+
type CaptureInput = Parameters<IFanPresetsProvider["capturePreset"]>[0];
|
|
55
|
+
export declare class FanPresetsService implements IFanPresetsProvider {
|
|
56
|
+
private readonly deps;
|
|
57
|
+
constructor(deps: FanPresetsServiceDeps);
|
|
58
|
+
getPresets(input: {
|
|
59
|
+
deviceId: number;
|
|
60
|
+
}): Promise<FanPreset[]>;
|
|
61
|
+
setPresets(input: {
|
|
62
|
+
deviceId: number;
|
|
63
|
+
presets: FanPreset[];
|
|
64
|
+
}): Promise<SetResult>;
|
|
65
|
+
applyPreset(input: {
|
|
66
|
+
deviceId: number;
|
|
67
|
+
presetId: string;
|
|
68
|
+
}): Promise<ApplyResult>;
|
|
69
|
+
capturePreset(input: CaptureInput): Promise<CaptureResult>;
|
|
70
|
+
private captureFanFields;
|
|
71
|
+
/** The steps the caller composed, each refreshed with its current value. */
|
|
72
|
+
private captureGiven;
|
|
73
|
+
/** Every switch and control in the fan's container, read as they are now. */
|
|
74
|
+
private captureSiblings;
|
|
75
|
+
private fanFieldStep;
|
|
76
|
+
private siblingStep;
|
|
77
|
+
/** The fan and every device in its container. */
|
|
78
|
+
private siblingsOf;
|
|
79
|
+
private judgeStep;
|
|
80
|
+
/** Every step reported, the offending ones `refused`, nothing run; null when all pass. */
|
|
81
|
+
private refusedSteps;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the `fan-presets` runtime out of what core-blocks owns: the
|
|
3
|
+
* per-device settings store (D865: a fan's presets live under the key
|
|
4
|
+
* `fanPresets`) and the cluster API (a device's type and container, the
|
|
5
|
+
* current readings, the cap call a step makes).
|
|
6
|
+
*
|
|
7
|
+
* Kept out of `core-blocks.addon.ts` so the seams are read and specced
|
|
8
|
+
* without booting the addon.
|
|
9
|
+
*/
|
|
10
|
+
import { type AddonApi, type AddonContext, type IScopedLogger } from "@camstack/types";
|
|
11
|
+
import { FanPresetActionSource } from "./fan-presets-action-source.js";
|
|
12
|
+
import { FanPresetsService, type FanPresetsDevices, type FanPresetsReadings, type FanPresetsStore } from "./fan-presets-service.js";
|
|
13
|
+
/** The key of the device's settings store that holds a fan's presets. */
|
|
14
|
+
export declare const FAN_PRESETS_STORE_KEY = "fanPresets";
|
|
15
|
+
type DeviceSettings = Pick<NonNullable<AddonContext["settings"]>, "readDeviceStore" | "writeDeviceStore" | "readDeviceStoreBatch" | "listDeviceStoreIds">;
|
|
16
|
+
export interface FanPresetsRuntimeDeps {
|
|
17
|
+
readonly settings: DeviceSettings;
|
|
18
|
+
readonly api: () => AddonApi | undefined;
|
|
19
|
+
readonly addonId: string;
|
|
20
|
+
readonly logger: IScopedLogger;
|
|
21
|
+
}
|
|
22
|
+
export interface FanPresetsRuntime {
|
|
23
|
+
readonly presets: FanPresetsService;
|
|
24
|
+
readonly actionSource: FanPresetActionSource;
|
|
25
|
+
}
|
|
26
|
+
export declare function fanPresetsStoreOver(settings: DeviceSettings, logger: IScopedLogger): FanPresetsStore;
|
|
27
|
+
export declare function fanPresetsDevicesOver(api: () => AddonApi | undefined): FanPresetsDevices;
|
|
28
|
+
/** A reading that errors or does not parse is unknown (null), never a default (D393). */
|
|
29
|
+
export declare function fanPresetsReadingsOver(api: () => AddonApi | undefined, logger: IScopedLogger): FanPresetsReadings;
|
|
30
|
+
export declare function buildFanPresetsRuntime(deps: FanPresetsRuntimeDeps): FanPresetsRuntime;
|
|
31
|
+
export {};
|
|
@@ -65,7 +65,21 @@ export type TemplateRowBody = {
|
|
|
65
65
|
readonly updatedAt: number;
|
|
66
66
|
};
|
|
67
67
|
export declare const TemplateRowBodySchema: z.ZodType<TemplateRowBody>;
|
|
68
|
+
/**
|
|
69
|
+
* A pending timed run (D993): the device is on and the hub owes it an off at
|
|
70
|
+
* `activeUntil`. One row per device, written BEFORE the device is switched on,
|
|
71
|
+
* so a crash can only ever cost a harmless extra off at boot. Row id = the
|
|
72
|
+
* deviceId.
|
|
73
|
+
*/
|
|
74
|
+
export type TimedRunRowBody = {
|
|
75
|
+
readonly activeUntil: number;
|
|
76
|
+
readonly requestedBy: string | null;
|
|
77
|
+
readonly requestedAt: number;
|
|
78
|
+
readonly actuator: "switch" | "pet-fountain";
|
|
79
|
+
};
|
|
80
|
+
export declare const TimedRunRowBodySchema: z.ZodType<TimedRunRowBody>;
|
|
68
81
|
export type CoreBlocksRecordKindsMap = {
|
|
82
|
+
readonly "timed-runs": DefinedRecordKind<z.ZodType<TimedRunRowBody>>;
|
|
69
83
|
readonly blocks: DefinedRecordKind<z.ZodType<CoreBlockRowBody>>;
|
|
70
84
|
readonly runs: DefinedRecordKind<z.ZodType<RunsRowBody>>;
|
|
71
85
|
readonly actions: DefinedRecordKind<z.ZodType<ActionRowBody>>;
|
|
@@ -81,3 +95,4 @@ export declare const coreBlocksSettingsRecordKind: DefinedRecordKind<z.ZodType<C
|
|
|
81
95
|
export declare const coreBlocksRunsRecordKind: DefinedRecordKind<z.ZodType<RunsRowBody>>;
|
|
82
96
|
export declare const coreBlocksActionsRecordKind: DefinedRecordKind<z.ZodType<ActionRowBody>>;
|
|
83
97
|
export declare const coreBlocksActionLinksRecordKind: DefinedRecordKind<z.ZodType<ActionLinksRowBody>>;
|
|
98
|
+
export declare const coreBlocksTimedRunsRecordKind: DefinedRecordKind<z.ZodType<TimedRunRowBody>>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `timed-run` provider of core-blocks (D993): switch a device on, and the
|
|
3
|
+
* hub owes it an off after a chosen time.
|
|
4
|
+
*
|
|
5
|
+
* DURABLE. The deadline is a row per device, written BEFORE the device is
|
|
6
|
+
* switched on, so a crash between the two can only cost a harmless extra off at
|
|
7
|
+
* boot, never a device left running with nobody to stop it.
|
|
8
|
+
*
|
|
9
|
+
* ONE time-ordered timer (D983): only the earliest deadline is armed, and when
|
|
10
|
+
* it fires the next one is armed. Not a timer per device.
|
|
11
|
+
*
|
|
12
|
+
* D49: the off is a one-shot. It is issued once, never gated on a read, and a
|
|
13
|
+
* failed off is logged with the device tag and not retried in a loop; the row is
|
|
14
|
+
* dropped either way so a boot does not re-issue it forever.
|
|
15
|
+
*
|
|
16
|
+
* A manual off (the switch observed off, the pump observed stopped) cancels the
|
|
17
|
+
* pending deadline silently: the operator already did what the timer would do.
|
|
18
|
+
*/
|
|
19
|
+
import { DeviceType, type IScopedLogger, type ITimedRunProvider, type TimedRunActuator, type TimedRunStatus } from "@camstack/types";
|
|
20
|
+
import type { PowerSourceScheduler } from "../power-source-service.js";
|
|
21
|
+
import type { TimedRunRowBody } from "../record-kinds.js";
|
|
22
|
+
/** The stored deadlines, one per device. */
|
|
23
|
+
export interface TimedRunRows {
|
|
24
|
+
readonly get: (deviceId: number) => Promise<TimedRunRowBody | null>;
|
|
25
|
+
readonly put: (deviceId: number, body: TimedRunRowBody) => Promise<void>;
|
|
26
|
+
readonly remove: (deviceId: number) => Promise<void>;
|
|
27
|
+
readonly all: () => Promise<readonly {
|
|
28
|
+
readonly deviceId: number;
|
|
29
|
+
readonly body: TimedRunRowBody;
|
|
30
|
+
}[]>;
|
|
31
|
+
}
|
|
32
|
+
export interface TimedRunActuation {
|
|
33
|
+
/** Throws when the device does not take the command. */
|
|
34
|
+
readonly set: (deviceId: number, actuator: TimedRunActuator, on: boolean) => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export interface TimedRunServiceDeps {
|
|
37
|
+
readonly rows: TimedRunRows;
|
|
38
|
+
readonly deviceTypeOf: (deviceId: number) => Promise<DeviceType | null>;
|
|
39
|
+
readonly actuation: TimedRunActuation;
|
|
40
|
+
/** Mirror the slice into the device state; failures are logged by the service. */
|
|
41
|
+
readonly publish: (deviceId: number, status: TimedRunStatus) => Promise<void>;
|
|
42
|
+
readonly scheduler: PowerSourceScheduler;
|
|
43
|
+
readonly now: () => number;
|
|
44
|
+
/** Off observations this soon after our own on command are stale echoes, not a manual off. */
|
|
45
|
+
readonly settleMs: number;
|
|
46
|
+
readonly logger: IScopedLogger;
|
|
47
|
+
}
|
|
48
|
+
export interface ObservedDeviceState {
|
|
49
|
+
readonly deviceId: number;
|
|
50
|
+
readonly capName: string;
|
|
51
|
+
readonly slice: Readonly<Record<string, unknown>>;
|
|
52
|
+
}
|
|
53
|
+
export declare const TIMED_RUN_SETTLE_MS: number;
|
|
54
|
+
export declare class TimedRunService implements ITimedRunProvider {
|
|
55
|
+
private readonly deps;
|
|
56
|
+
/** Pending deadlines, mirrored from the rows. */
|
|
57
|
+
private readonly pending;
|
|
58
|
+
/** When our own on command last resolved, per device. */
|
|
59
|
+
private readonly switchedOnAt;
|
|
60
|
+
private timer;
|
|
61
|
+
private armedFor;
|
|
62
|
+
private inflight;
|
|
63
|
+
private stopped;
|
|
64
|
+
constructor(deps: TimedRunServiceDeps);
|
|
65
|
+
getStatus: ITimedRunProvider["getStatus"];
|
|
66
|
+
runFor: ITimedRunProvider["runFor"];
|
|
67
|
+
cancel: ITimedRunProvider["cancel"];
|
|
68
|
+
/** Feed one `DeviceStateChanged`: a manual off cancels the pending deadline. */
|
|
69
|
+
onDeviceState(state: ObservedDeviceState): Promise<void>;
|
|
70
|
+
/** Boot: a passed deadline is switched off once, a future one is re-armed. */
|
|
71
|
+
reconcile(): Promise<void>;
|
|
72
|
+
/** Resolves when every deadline that already fired has been carried out. */
|
|
73
|
+
settled(): Promise<void>;
|
|
74
|
+
stop(): void;
|
|
75
|
+
private forget;
|
|
76
|
+
private statusOf;
|
|
77
|
+
private publishStatus;
|
|
78
|
+
/** Arm the ONE timer for the earliest pending deadline. */
|
|
79
|
+
private rearm;
|
|
80
|
+
private onTimer;
|
|
81
|
+
private queueExpire;
|
|
82
|
+
/** The one-shot off. Logged on failure, never retried (D49). */
|
|
83
|
+
private expire;
|
|
84
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wires `TimedRunService` to the hub: its rows (the `timed-runs` kind), the
|
|
3
|
+
* device registry for a device's type, the device caps for the on/off command
|
|
4
|
+
* and `deviceState.setCapSlice` for the mirrored slice.
|
|
5
|
+
*/
|
|
6
|
+
import { type AddonApi, type IScopedLogger, type RecordsAccess } from "@camstack/types";
|
|
7
|
+
import { TimedRunService } from "./timed-run-service.js";
|
|
8
|
+
export interface TimedRunWiringDeps {
|
|
9
|
+
readonly records: RecordsAccess;
|
|
10
|
+
readonly api: () => AddonApi | undefined;
|
|
11
|
+
readonly logger: IScopedLogger;
|
|
12
|
+
}
|
|
13
|
+
export declare function buildTimedRunService(deps: TimedRunWiringDeps): TimedRunService;
|
|
14
|
+
/**
|
|
15
|
+
* Re-arm the stored deadlines. ARMED, never awaited: the registry is a hub-core
|
|
16
|
+
* cap, answerable only after boot, so a first attempt may find it not ready. A
|
|
17
|
+
* failed read changes nothing (D49) and is tried again a bounded number of times.
|
|
18
|
+
*/
|
|
19
|
+
export declare function armTimedRuns(service: TimedRunService, logger: IScopedLogger, options: {
|
|
20
|
+
readonly isDisposed: () => boolean;
|
|
21
|
+
}): Promise<void>;
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_retention = require("../../retention-
|
|
6
|
+
const require_dist = require("../../dist-dQKZfa3-.js");
|
|
7
|
+
const require_retention = require("../../retention-DRT2wUyB.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
//#region src/builtins/device-history/capture/point-writer.ts
|
|
10
10
|
var FLUSH_INTERVAL_MS = 1e4;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { S as subjectIdOf, _ as readUnit, a as FIVE_MINUTES_MS, b as SeriesRegistry, c as bucketEndOf, d as CAP_KEY_PREFIX, f as CaptureEngine, g as readPath, h as catalogMetrics, i as DAY_MS, l as bucketStartOf, m as capSeriesKey, n as RetentionJob, o as HOUR_MS, p as capItemSeriesKey, r as DepartureTracker, s as ROLLUP_GRACE_MS, t as DEFAULT_RETENTION, u as floorTo, v as DeviceDirectory, x as identityOf, y as isRealDeviceType } from "../../retention-
|
|
1
|
+
import { $n as deviceHistoryCapability, Hs as DeviceType, Ws as EventCategory, as as emitReadiness, ct as HISTORY_ITEM_CATALOG, lo as wattMillisecondsToKwh, ls as historyUnitFor, ms as isReadingQuantity, nr as deviceRunsCapability, q as DeviceRunSchema, rs as defineRecordKinds, st as HISTORY_CATALOG, tr as deviceRemovalHookCapability, un as armRemovalReconcile, uo as BaseAddon, z as DEVICE_HISTORY_ENERGY_KEY } from "../../dist-yrk6fm65.mjs";
|
|
2
|
+
import { S as subjectIdOf, _ as readUnit, a as FIVE_MINUTES_MS, b as SeriesRegistry, c as bucketEndOf, d as CAP_KEY_PREFIX, f as CaptureEngine, g as readPath, h as catalogMetrics, i as DAY_MS, l as bucketStartOf, m as capSeriesKey, n as RetentionJob, o as HOUR_MS, p as capItemSeriesKey, r as DepartureTracker, s as ROLLUP_GRACE_MS, t as DEFAULT_RETENTION, u as floorTo, v as DeviceDirectory, x as identityOf, y as isRealDeviceType } from "../../retention-DBrdAv12.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/builtins/device-history/capture/point-writer.ts
|
|
5
5
|
var FLUSH_INTERVAL_MS = 1e4;
|
|
@@ -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-dQKZfa3-.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
|
|
9
9
|
const require_prefix_walk = require("../../prefix-walk-Dv6MLZlM.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as collectZodSecretPaths, As as resolveSecretMarkers, Bn as createDeviceExtensionProvider, Bs as DeviceFeature, Cn as canonicalIconKey, F as DAY_NAMES, Hs as DeviceType, Is as toSecretFieldView, J as DeviceStatusSchema, Ji as runtimeStatePolicyFor, Jn as defineExtensionSlotProvider, Kr as locationIconKey, Ls as transformSecretWrite, Ms as secretTreeFromPaths, Ps as sleep$1, Qn as deviceExtensionCapability, Ro as SECRET_CLEAR, Rs as userError, Rt as STREAM_PROFILE_META, Uo as WELL_KNOWN_TAB_MAP, Us as errMsg, Vr as legacyAutoLinkIds, Vs as DeviceRole, Ws as EventCategory, Y as DeviceTombstoneSchema, _s as isSecretMarkerLike, aa as siteZoneKey, at as FieldClaimSchema, bn as buildStreamParamsConfigSchema, bt as MINUTES_PER_DAY, dr as expandContainer, ds as isDeviceConfigCap, er as deviceManagerCapability, fi as normalizeUnit, g as CAMERA_SWITCH_ORDER, gs as isSecretMarker, hs as isSecretClear, ir as deviceStatusCapability, it as FieldClaimModeSchema, o as ALL_CAPABILITY_DEFINITIONS, or as enumerateItemArrayFields, ps as isKeychainStoredField, rr as deviceStateCapability, rs as defineRecordKinds, sr as enumerateSchemaFields, uo as BaseAddon, v as CAP_NAMES_WITH_STATUS, xr as formatMinutes, yi as parseStreamParamsFormPatch } from "../../dist-yrk6fm65.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
|
|
4
4
|
import { t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
|
|
@@ -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-dQKZfa3-.js");
|
|
7
7
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
8
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
9
9
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Yr as logDestinationCapability, uo as BaseAddon } from "../../dist-yrk6fm65.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
3
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
4
4
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -3,10 +3,10 @@ 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_device_ca = require("../../device-ca-
|
|
6
|
+
const require_dist = require("../../dist-dQKZfa3-.js");
|
|
7
|
+
const require_device_ca = require("../../device-ca-TbdQfW4d.js");
|
|
8
8
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
9
|
-
const require_constants = require("../../constants-
|
|
9
|
+
const require_constants = require("../../constants-CKwdQTnw.js");
|
|
10
10
|
const require_platform_key_source = require("../../platform-key-source-Di7HrlGR.js");
|
|
11
11
|
let node_crypto = require("node:crypto");
|
|
12
12
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-
|
|
1
|
+
import { Br as keychainCapability, Cs as normalizeSecretOwner, Es as parseSecretRef, Ws as EventCategory, gt as KeychainResetRecordSchema, ht as KeychainAuditEntrySchema, mt as KEYCHAIN_RESET_TRIGGER_ACTOR, rs as defineRecordKinds, ss as formatSecretScope, uo as BaseAddon, zr as keychainAdminCapability } from "../../dist-yrk6fm65.mjs";
|
|
2
|
+
import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-D-Cvxobt.mjs";
|
|
3
3
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
4
|
-
import { a as MESH_CA_KEY_REF } from "../../constants-
|
|
4
|
+
import { a as MESH_CA_KEY_REF } from "../../constants-DmithOex.mjs";
|
|
5
5
|
import { n as getPlatformKeychainKey } from "../../platform-key-source-BWlq0jjn.mjs";
|
|
6
6
|
import { createCipheriv, createDecipheriv, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
7
7
|
import { restrictDirToOwnerSync, restrictFileToOwnerSync, writeOwnerOnlyFileSync } from "@camstack/types/node";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-dQKZfa3-.js");
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
5
5
|
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $r as mayWriteToLocation, Nt as RecordingStatusSchema, Us as errMsg, Ws as EventCategory, es as createEvent, jt as RECORDING_SOURCE_CAMSTACK_ADDON, uo as BaseAddon } from "../../dist-yrk6fm65.mjs";
|
|
2
2
|
import * as fsp from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { constants } from "node:fs";
|
|
@@ -3,10 +3,10 @@ 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-dQKZfa3-.js");
|
|
7
7
|
const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
|
|
8
8
|
const require_ms$1 = require("../../ms-LB3giGoU.js");
|
|
9
|
-
const require_device_ca = require("../../device-ca-
|
|
9
|
+
const require_device_ca = require("../../device-ca-TbdQfW4d.js");
|
|
10
10
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
11
11
|
let zod = require("zod");
|
|
12
12
|
let node_crypto = require("node:crypto");
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { A as CredentialTokenClaimsSchema, Dt as PreferenceDeviceIdSchema, Et as PREFERENCES_MAX_VALUE_BYTES, Mr as isCredentialTokenPayload, Ot as PreferenceNamespaceSchema, Qt as UserRecordSchema, R as DEVICE_ENROLLMENT_TTL_MS, Rs as userError, Ut as SsoBridgeClaimsSchema, V as DEVICE_NONCE_TTL_MS, Vt as ScopedTokenSchema, Xt as TokenScopeSchema, Zn as deviceCredentialsCapability, br as formatDeviceRevoker, dn as authProviderCapability, gs as isSecretMarker, kt as PreferenceValueSchema, rs as defineRecordKinds, uo as BaseAddon, vn as buildDeviceEnrollmentLink, w as CREDENTIAL_TOKEN_AUDIENCE, xa as userManagementCapability, yn as buildDeviceSignatureMessage, ys as makeSecretMarker } from "../../dist-yrk6fm65.mjs";
|
|
3
3
|
import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
|
|
4
4
|
import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
|
|
5
|
-
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-
|
|
5
|
+
import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-D-Cvxobt.mjs";
|
|
6
6
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import * as crypto$1 from "node:crypto";
|
|
9
9
|
import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
10
10
|
import nodeCrypto from "crypto";
|
|
11
11
|
import * as path$1 from "node:path";
|
|
12
|
-
import * as fs
|
|
12
|
+
import * as fs from "node:fs";
|
|
13
13
|
//#region ../../node_modules/bcryptjs/index.js
|
|
14
14
|
/**
|
|
15
15
|
* The random implementation to use as a fallback.
|
|
@@ -11912,8 +11912,8 @@ var LocalAuthAddon = class extends BaseAddon {
|
|
|
11912
11912
|
users: this.userManager,
|
|
11913
11913
|
dataDir: this.ctx.nodeDataDir,
|
|
11914
11914
|
fs: {
|
|
11915
|
-
exists: (filePath) => fs
|
|
11916
|
-
remove: (filePath) => fs
|
|
11915
|
+
exists: (filePath) => fs.existsSync(filePath),
|
|
11916
|
+
remove: (filePath) => fs.rmSync(filePath, { force: true })
|
|
11917
11917
|
},
|
|
11918
11918
|
logger: this.ctx.logger
|
|
11919
11919
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
4
|
-
const require_hub_mdns_ciao = require("../../hub-mdns-ciao-
|
|
3
|
+
const require_dist = require("../../dist-dQKZfa3-.js");
|
|
4
|
+
const require_hub_mdns_ciao = require("../../hub-mdns-ciao-DP3_GNZw.js");
|
|
5
5
|
let zod = require("zod");
|
|
6
6
|
let node_net = require("node:net");
|
|
7
7
|
let node_os = require("node:os");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as ensureTlsCert, I as readLanHttpState, N as applyLanHttp, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, d as servedHttpsLeafFingerprint, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, y as writeExtraSans } from "../../hub-mdns-ciao-
|
|
1
|
+
import { Bi as resolveHubAddressRoles, Ca as validateCustomAddress, En as checkRoleAddress, Gr as localNetworkCapability, Ii as resolveAppConnections, Nr as isDefaultAppConnectionEndpoint, Tt as NetworkTunnelStartedDataSchema, Us as errMsg, Wi as resolveNotificationTapAddress, Ws as EventCategory, _ as CAMSTACK_APP_LINK_ORIGIN, bi as pickAppLinkHub, kr as isAppLinkBase, lt as HUB_MDNS_SERVICE_TYPE, ra as shortHostname, uo as BaseAddon, ut as HUB_MDNS_TXT_KEYS } from "../../dist-yrk6fm65.mjs";
|
|
2
|
+
import { E as ensureTlsCert, I as readLanHttpState, N as applyLanHttp, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, d as servedHttpsLeafFingerprint, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, y as writeExtraSans } from "../../hub-mdns-ciao-Cae5VWUc.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { isIP } from "node:net";
|
|
5
5
|
import * as os$1 from "node:os";
|
|
@@ -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-dQKZfa3-.js");
|
|
7
7
|
const require_log_read_filter = require("../../log-read-filter-Bi066jwU.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/loki-logging/loki-payload.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Yr as logDestinationCapability, uo as BaseAddon } from "../../dist-yrk6fm65.mjs";
|
|
2
2
|
import { n as compileLogFilter, o as lineMatches } from "../../log-read-filter-D7Ev3zm-.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/loki-logging/loki-payload.ts
|
|
@@ -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-dQKZfa3-.js");
|
|
7
7
|
let node_fs_promises = require("node:fs/promises");
|
|
8
8
|
let node_util = require("node:util");
|
|
9
9
|
let node_os = require("node:os");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Li as resolveBucketMs, Mt as ROOT_BUCKET_KEY, Us as errMsg, Ws as EventCategory, Zt as UNATTRIBUTED_BUCKET_KEY, es as createEvent, ji as reducePoints, ri as metricsProviderCapability, uo as BaseAddon, yr as foldSnapshotByFunction } from "../../dist-yrk6fm65.mjs";
|
|
2
2
|
import { access, readFile, readdir } from "node:fs/promises";
|
|
3
3
|
import { promisify } from "node:util";
|
|
4
4
|
import * as os$1 from "node:os";
|
|
5
5
|
import { platform } from "node:os";
|
|
6
|
-
import * as fs
|
|
6
|
+
import * as fs from "node:fs";
|
|
7
7
|
import { constants, readFileSync } from "node:fs";
|
|
8
8
|
import { execFile } from "node:child_process";
|
|
9
9
|
//#region src/builtins/native-metrics/cgroup-memory.ts
|
|
@@ -1686,7 +1686,7 @@ var NativeMetricsProvider = class {
|
|
|
1686
1686
|
let swapUsedBytes = 0;
|
|
1687
1687
|
let swapTotalBytes = 0;
|
|
1688
1688
|
if (IS_LINUX) try {
|
|
1689
|
-
const meminfo = fs
|
|
1689
|
+
const meminfo = fs.readFileSync("/proc/meminfo", "utf-8");
|
|
1690
1690
|
const availKb = meminfo.match(/MemAvailable:\s+(\d+)/)?.[1];
|
|
1691
1691
|
if (availKb !== void 0) available = parseInt(availKb, 10) * 1024;
|
|
1692
1692
|
const swapTotal = parseInt(meminfo.match(/SwapTotal:\s+(\d+)/)?.[1] ?? "0", 10) * 1024;
|
|
@@ -1779,7 +1779,7 @@ async function sampleMacMemory(provider) {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
function getDiskSpaceInternal(dirPath) {
|
|
1781
1781
|
return new Promise((resolve, reject) => {
|
|
1782
|
-
fs
|
|
1782
|
+
fs.statfs(dirPath, (err, stats) => {
|
|
1783
1783
|
if (err) return reject(err);
|
|
1784
1784
|
const totalBytes = stats.blocks * stats.bsize;
|
|
1785
1785
|
const availableBytes = stats.bavail * stats.bsize;
|
|
@@ -1797,7 +1797,7 @@ function getDiskSpaceInternal(dirPath) {
|
|
|
1797
1797
|
async function takeDiskIoSnapshot() {
|
|
1798
1798
|
const now = Date.now();
|
|
1799
1799
|
if (IS_LINUX) try {
|
|
1800
|
-
const data = fs
|
|
1800
|
+
const data = fs.readFileSync("/proc/diskstats", "utf-8");
|
|
1801
1801
|
let readOps = 0, readBytes = 0, writeOps = 0, writeBytes = 0;
|
|
1802
1802
|
for (const line of data.split("\n")) {
|
|
1803
1803
|
const parts = line.trim().split(/\s+/);
|
|
@@ -1828,7 +1828,7 @@ async function takeDiskIoSnapshot() {
|
|
|
1828
1828
|
async function takeNetworkIoSnapshot() {
|
|
1829
1829
|
const now = Date.now();
|
|
1830
1830
|
if (IS_LINUX) try {
|
|
1831
|
-
const data = fs
|
|
1831
|
+
const data = fs.readFileSync("/proc/net/dev", "utf-8");
|
|
1832
1832
|
let rxBytes = 0, txBytes = 0, rxPackets = 0, txPackets = 0, rxErrors = 0, txErrors = 0;
|
|
1833
1833
|
for (const line of data.split("\n")) {
|
|
1834
1834
|
const match = line.match(/^\s*(\w+):\s+(.+)$/);
|
|
@@ -1889,7 +1889,7 @@ async function takeNetworkIoSnapshot() {
|
|
|
1889
1889
|
}
|
|
1890
1890
|
async function getCpuTemperatureInternal() {
|
|
1891
1891
|
if (IS_LINUX) for (const p of ["/sys/class/thermal/thermal_zone0/temp", "/sys/class/hwmon/hwmon0/temp1_input"]) try {
|
|
1892
|
-
const raw = fs
|
|
1892
|
+
const raw = fs.readFileSync(p, "utf-8").trim();
|
|
1893
1893
|
const millideg = parseInt(raw, 10);
|
|
1894
1894
|
if (!isNaN(millideg)) return Math.round(millideg / 100) / 10;
|
|
1895
1895
|
} catch {
|
|
@@ -1940,10 +1940,10 @@ function getProcessResources() {
|
|
|
1940
1940
|
let threadCount = 0;
|
|
1941
1941
|
if (IS_LINUX) {
|
|
1942
1942
|
try {
|
|
1943
|
-
openFds = fs
|
|
1943
|
+
openFds = fs.readdirSync(`/proc/${process.pid}/fd`).length;
|
|
1944
1944
|
} catch {}
|
|
1945
1945
|
try {
|
|
1946
|
-
const match = fs
|
|
1946
|
+
const match = fs.readFileSync(`/proc/${process.pid}/status`, "utf-8").match(/Threads:\s+(\d+)/);
|
|
1947
1947
|
if (match) threadCount = parseInt(match[1], 10);
|
|
1948
1948
|
} catch {}
|
|
1949
1949
|
}
|
|
@@ -1958,7 +1958,7 @@ function getProcessResources() {
|
|
|
1958
1958
|
function getPressure(resource) {
|
|
1959
1959
|
if (!IS_LINUX) return null;
|
|
1960
1960
|
try {
|
|
1961
|
-
const data = fs
|
|
1961
|
+
const data = fs.readFileSync(`/proc/pressure/${resource}`, "utf-8");
|
|
1962
1962
|
const parseLine = (prefix) => {
|
|
1963
1963
|
const match = data.match(new RegExp(`${prefix} avg10=(\\d+\\.\\d+) avg60=(\\d+\\.\\d+) avg300=(\\d+\\.\\d+)`));
|
|
1964
1964
|
if (!match) return null;
|
|
@@ -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-dQKZfa3-.js");
|
|
7
7
|
const require_coral_accelerators = require("../../coral-accelerators-BSVsBVzt.js");
|
|
8
8
|
let node_path = require("node:path");
|
|
9
9
|
node_path = require_chunk.__toESM(node_path);
|