@camstack/system 1.0.2
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/addon-api-factory.d.ts +35 -0
- package/dist/addon-routes/addon-route-registry.d.ts +37 -0
- package/dist/addon-runner.js +599 -0
- package/dist/addon-runner.mjs +597 -0
- package/dist/auth/api-key-manager.d.ts +26 -0
- package/dist/auth/auth-manager.d.ts +109 -0
- package/dist/auth/parse-record.d.ts +18 -0
- package/dist/auth/scope-matcher.d.ts +7 -0
- package/dist/auth/scoped-token-manager.d.ts +40 -0
- package/dist/auth/totp-manager.d.ts +51 -0
- package/dist/auth/user-manager.d.ts +34 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +53 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +259 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +251 -0
- package/dist/builtins/addon-pages-aggregator/dedupe-pages.d.ts +6 -0
- package/dist/builtins/addon-pages-aggregator/index.d.ts +1 -0
- package/dist/builtins/addon-pages-aggregator/index.js +8 -0
- package/dist/builtins/addon-pages-aggregator/index.mjs +2 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +47 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +228 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +220 -0
- package/dist/builtins/addon-widgets-aggregator/index.d.ts +1 -0
- package/dist/builtins/addon-widgets-aggregator/index.js +8 -0
- package/dist/builtins/addon-widgets-aggregator/index.mjs +2 -0
- package/dist/builtins/alerts/alerts.addon.d.ts +81 -0
- package/dist/builtins/alerts/alerts.addon.js +601 -0
- package/dist/builtins/alerts/alerts.addon.mjs +595 -0
- package/dist/builtins/alerts/index.d.ts +1 -0
- package/dist/builtins/alerts/index.js +4 -0
- package/dist/builtins/alerts/index.mjs +2 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +147 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2229 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2220 -0
- package/dist/builtins/backup-orchestrator/cron-helpers.d.ts +23 -0
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +72 -0
- package/dist/builtins/backup-orchestrator/download-helpers.d.ts +12 -0
- package/dist/builtins/backup-orchestrator/index.d.ts +2 -0
- package/dist/builtins/backup-orchestrator/index.js +8 -0
- package/dist/builtins/backup-orchestrator/index.mjs +2 -0
- package/dist/builtins/backup-orchestrator/manifest-store.d.ts +77 -0
- package/dist/builtins/console-logging/console-destination.d.ts +13 -0
- package/dist/builtins/console-logging/console-logging.addon.d.ts +25 -0
- package/dist/builtins/console-logging/index.d.ts +3 -0
- package/dist/builtins/console-logging/index.js +104 -0
- package/dist/builtins/console-logging/index.mjs +95 -0
- package/dist/builtins/device-manager/device-config-contribution.d.ts +32 -0
- package/dist/builtins/device-manager/device-event-propagator.d.ts +26 -0
- package/dist/builtins/device-manager/device-link-overlay.d.ts +23 -0
- package/dist/builtins/device-manager/device-link-resolver.d.ts +15 -0
- package/dist/builtins/device-manager/device-manager.addon.d.ts +452 -0
- package/dist/builtins/device-manager/device-manager.addon.js +3299 -0
- package/dist/builtins/device-manager/device-manager.addon.mjs +3292 -0
- package/dist/builtins/device-manager/index.d.ts +2 -0
- package/dist/builtins/device-manager/index.js +8 -0
- package/dist/builtins/device-manager/index.mjs +2 -0
- package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +44 -0
- package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +15 -0
- package/dist/builtins/hub-forwarder/index.d.ts +3 -0
- package/dist/builtins/hub-forwarder/index.js +154 -0
- package/dist/builtins/hub-forwarder/index.mjs +145 -0
- package/dist/builtins/local-auth/auth-schema.d.ts +26 -0
- package/dist/builtins/local-auth/index.d.ts +1 -0
- package/dist/builtins/local-auth/index.js +4 -0
- package/dist/builtins/local-auth/index.mjs +2 -0
- package/dist/builtins/local-auth/local-auth.addon.d.ts +18 -0
- package/dist/builtins/local-auth/local-auth.addon.js +8094 -0
- package/dist/builtins/local-auth/local-auth.addon.mjs +8063 -0
- package/dist/builtins/local-auth/oauth-grants.d.ts +45 -0
- package/dist/builtins/local-auth/oauth-session-manager.d.ts +50 -0
- package/dist/builtins/local-network/index.d.ts +2 -0
- package/dist/builtins/local-network/index.js +10 -0
- package/dist/builtins/local-network/index.mjs +2 -0
- package/dist/builtins/local-network/local-network.addon.d.ts +150 -0
- package/dist/builtins/local-network/local-network.addon.js +489 -0
- package/dist/builtins/local-network/local-network.addon.mjs +477 -0
- package/dist/builtins/native-metrics/index.d.ts +2 -0
- package/dist/builtins/native-metrics/native-metrics-provider.d.ts +48 -0
- package/dist/builtins/native-metrics/native-metrics.addon.d.ts +73 -0
- package/dist/builtins/native-metrics/native-metrics.addon.js +922 -0
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +914 -0
- package/dist/builtins/platform-probe/hardware-decode-accel-probe.d.ts +37 -0
- package/dist/builtins/platform-probe/hardware-encoder-probe.d.ts +13 -0
- package/dist/builtins/platform-probe/index.d.ts +22 -0
- package/dist/builtins/platform-probe/index.js +834 -0
- package/dist/builtins/platform-probe/index.mjs +822 -0
- package/dist/builtins/platform-probe/inference-config-resolver.d.ts +29 -0
- package/dist/builtins/platform-probe/intel-accelerators.d.ts +11 -0
- package/dist/builtins/platform-probe/platform-scorer.d.ts +30 -0
- package/dist/builtins/platform-probe/runtime-packages.d.ts +6 -0
- package/dist/builtins/remote-access-orchestrator/enabled-providers-reconcile.d.ts +96 -0
- package/dist/builtins/remote-access-orchestrator/index.d.ts +1 -0
- package/dist/builtins/remote-access-orchestrator/index.js +8 -0
- package/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +40 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +214 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +208 -0
- package/dist/builtins/shared/settle-sources.d.ts +22 -0
- package/dist/builtins/snapshot/index.d.ts +2 -0
- package/dist/builtins/snapshot/index.js +494 -0
- package/dist/builtins/snapshot/index.mjs +488 -0
- package/dist/builtins/snapshot/snapshot.addon.d.ts +120 -0
- package/dist/builtins/sqlite-storage/config-store.d.ts +8 -0
- package/dist/builtins/sqlite-storage/device-store.d.ts +23 -0
- package/dist/builtins/sqlite-storage/filesystem-browse-provider.d.ts +25 -0
- package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +83 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +32 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +396 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +388 -0
- package/dist/builtins/sqlite-storage/index.d.ts +8 -0
- package/dist/builtins/sqlite-storage/index.js +62 -0
- package/dist/builtins/sqlite-storage/index.mjs +49 -0
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +27 -0
- package/dist/builtins/sqlite-storage/path-guard.d.ts +4 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +102 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +14 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +644 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +636 -0
- package/dist/builtins/storage-orchestrator/index.d.ts +6 -0
- package/dist/builtins/storage-orchestrator/index.js +10 -0
- package/dist/builtins/storage-orchestrator/index.mjs +2 -0
- package/dist/builtins/storage-orchestrator/location-store.d.ts +49 -0
- package/dist/builtins/storage-orchestrator/provider-discovery.d.ts +10 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +103 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1138 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1128 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +236 -0
- package/dist/builtins/storage-orchestrator/storage-pressure-manager.d.ts +38 -0
- package/dist/builtins/system-backup/system-backup.service.d.ts +137 -0
- package/dist/builtins/system-config/index.d.ts +1 -0
- package/dist/builtins/system-config/index.js +8 -0
- package/dist/builtins/system-config/index.mjs +2 -0
- package/dist/builtins/system-config/system-config.addon.d.ts +10 -0
- package/dist/builtins/system-config/system-config.addon.js +232 -0
- package/dist/builtins/system-config/system-config.addon.mjs +226 -0
- package/dist/builtins/winston-logging/index.d.ts +3 -0
- package/dist/builtins/winston-logging/index.js +156 -0
- package/dist/builtins/winston-logging/index.mjs +144 -0
- package/dist/builtins/winston-logging/winston-destination.d.ts +21 -0
- package/dist/builtins/winston-logging/winston-logging.addon.d.ts +19 -0
- package/dist/chunk-CNf5ZN-e.mjs +37 -0
- package/dist/chunk-Cek0wNdY.js +64 -0
- package/dist/download/model-download-service.d.ts +41 -0
- package/dist/download/model-downloader.d.ts +31 -0
- package/dist/events/event-bus.d.ts +10 -0
- package/dist/events/system-event-bus.d.ts +14 -0
- package/dist/feature/feature-manager.d.ts +11 -0
- package/dist/formatter-B7qW8bPJ.mjs +162 -0
- package/dist/formatter-DqAKDlvN.js +167 -0
- package/dist/http/authenticated-file-server.d.ts +53 -0
- package/dist/http/data-plane-registry.d.ts +23 -0
- package/dist/http/file-data-plane.d.ts +10 -0
- package/dist/http/reverse-proxy.d.ts +15 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +93485 -0
- package/dist/index.mjs +93179 -0
- package/dist/intel-accelerators-Gg0P5mnl.js +20 -0
- package/dist/intel-accelerators-hGgpZ0pX.mjs +19 -0
- package/dist/kernel/addon-class-resolver.d.ts +4 -0
- package/dist/kernel/addon-engine-manager.d.ts +22 -0
- package/dist/kernel/addon-health-monitor.d.ts +154 -0
- package/dist/kernel/addon-installer.d.ts +208 -0
- package/dist/kernel/addon-loader.d.ts +106 -0
- package/dist/kernel/addon-manifest.d.ts +77 -0
- package/dist/kernel/capability-handle.d.ts +46 -0
- package/dist/kernel/capability-registry.d.ts +412 -0
- package/dist/kernel/config-manager.d.ts +212 -0
- package/dist/kernel/config-schema.d.ts +93 -0
- package/dist/kernel/custom-action-registry.d.ts +23 -0
- package/dist/kernel/deps/addon-deps-manager.d.ts +19 -0
- package/dist/kernel/deps/manifest-native-deps.d.ts +25 -0
- package/dist/kernel/deps/manifest-python-deps.d.ts +20 -0
- package/dist/kernel/device-registry.d.ts +29 -0
- package/dist/kernel/fs-utils.d.ts +41 -0
- package/dist/kernel/hwaccel/hwaccel-resolver.d.ts +19 -0
- package/dist/kernel/hwaccel/hwaccel-service.d.ts +4 -0
- package/dist/kernel/index.d.ts +74 -0
- package/dist/kernel/infra-capabilities.d.ts +13 -0
- package/dist/kernel/moleculer/addon-context-factory.d.ts +91 -0
- package/dist/kernel/moleculer/addon-data-plane-facility.d.ts +19 -0
- package/dist/kernel/moleculer/addon-runner.d.ts +1 -0
- package/dist/kernel/moleculer/addon-service-factory.d.ts +50 -0
- package/dist/kernel/moleculer/broker-factory.d.ts +50 -0
- package/dist/kernel/moleculer/cap-usage-registry.d.ts +46 -0
- package/dist/kernel/moleculer/capabilities-access.d.ts +21 -0
- package/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +46 -0
- package/dist/kernel/moleculer/child-cap-dispatch.d.ts +20 -0
- package/dist/kernel/moleculer/cluster-secret.d.ts +15 -0
- package/dist/kernel/moleculer/core-cap-service.d.ts +50 -0
- package/dist/kernel/moleculer/crash-supervisor.d.ts +50 -0
- package/dist/kernel/moleculer/device-cap-proxy.d.ts +79 -0
- package/dist/kernel/moleculer/event-bus-core.d.ts +53 -0
- package/dist/kernel/moleculer/event-bus.d.ts +53 -0
- package/dist/kernel/moleculer/hub-log-forwarder.d.ts +36 -0
- package/dist/kernel/moleculer/hub-service.d.ts +35 -0
- package/dist/kernel/moleculer/node-registry.d.ts +126 -0
- package/dist/kernel/moleculer/process-context.d.ts +4 -0
- package/dist/kernel/moleculer/process-service.d.ts +72 -0
- package/dist/kernel/moleculer/provider-registry.d.ts +28 -0
- package/dist/kernel/moleculer/readiness-context.d.ts +62 -0
- package/dist/kernel/moleculer/readiness-service.d.ts +7 -0
- package/dist/kernel/moleculer/register-node-client.d.ts +35 -0
- package/dist/kernel/moleculer/remote-logger.d.ts +43 -0
- package/dist/kernel/moleculer/resilient-cap-call.d.ts +28 -0
- package/dist/kernel/moleculer/stream-probe-service.d.ts +9 -0
- package/dist/kernel/moleculer/trpc-links.d.ts +189 -0
- package/dist/kernel/moleculer/typed-array-serde.d.ts +25 -0
- package/dist/kernel/moleculer/worker-device-restore.d.ts +10 -0
- package/dist/kernel/provider-kind-drift.d.ts +12 -0
- package/dist/kernel/restart-coordinator.d.ts +90 -0
- package/dist/kernel/storage-location-registry.d.ts +40 -0
- package/dist/kernel/transport/cap-action-name.d.ts +100 -0
- package/dist/kernel/transport/cap-route-resolver.d.ts +148 -0
- package/dist/kernel/transport/cap-route.d.ts +148 -0
- package/dist/kernel/transport/child-cap-protocol.d.ts +136 -0
- package/dist/kernel/transport/create-local-transport.d.ts +7 -0
- package/dist/kernel/transport/frame-codec.d.ts +7 -0
- package/dist/kernel/transport/index.d.ts +27 -0
- package/dist/kernel/transport/local-child-client.d.ts +136 -0
- package/dist/kernel/transport/local-child-registry.d.ts +179 -0
- package/dist/kernel/transport/local-endpoint-path.d.ts +6 -0
- package/dist/kernel/transport/local-transport.d.ts +46 -0
- package/dist/kernel/transport/parent-unowned-call.d.ts +75 -0
- package/dist/kernel/transport/socket-channel.d.ts +27 -0
- package/dist/kernel/transport/uds-event-bridge.d.ts +36 -0
- package/dist/kernel/transport/uds-event-bus.d.ts +22 -0
- package/dist/kernel/transport/uds-local-transport.d.ts +18 -0
- package/dist/kernel/transport/uds-log-ingest.d.ts +28 -0
- package/dist/kernel/transport/uds-logger.d.ts +44 -0
- package/dist/kernel/utils/ring-buffer.d.ts +15 -0
- package/dist/kernel/workspace-detect.d.ts +9 -0
- package/dist/lifecycle/lifecycle-state-machine.d.ts +28 -0
- package/dist/logging/formatter.d.ts +30 -0
- package/dist/logging/log-manager.d.ts +54 -0
- package/dist/logging/log-ring-buffer.d.ts +47 -0
- package/dist/logging/partitioned-log-buffer.d.ts +35 -0
- package/dist/logging/scoped-logger.d.ts +17 -0
- package/dist/main-DNnMW7Z2.js +9983 -0
- package/dist/main-rtjOwPBR.mjs +9976 -0
- package/dist/manifest-python-deps-D1DbAQEv.js +6724 -0
- package/dist/manifest-python-deps-DZsKTbs1.mjs +6315 -0
- package/dist/network/network-quality.d.ts +11 -0
- package/dist/notification/notification-service.d.ts +37 -0
- package/dist/notification/toast-service.d.ts +22 -0
- package/dist/pipeline/engine-manager-resolver.d.ts +15 -0
- package/dist/pipeline/pipeline-runner.d.ts +8 -0
- package/dist/pipeline/pipeline-validator.d.ts +13 -0
- package/dist/process/resource-monitor.d.ts +11 -0
- package/dist/python/python-env-manager.d.ts +12 -0
- package/dist/repl/interfaces.d.ts +31 -0
- package/dist/repl/repl-engine.d.ts +8 -0
- package/dist/resource-monitor-ClDGFyf6.mjs +57 -0
- package/dist/resource-monitor-IIEanuJt.js +74 -0
- package/dist/settle-sources-Bhsy57y-.js +38 -0
- package/dist/settle-sources-CDtNC8ub.mjs +33 -0
- package/dist/storage/fs-storage-backend.d.ts +40 -0
- package/dist/storage/storage-location-manager.d.ts +23 -0
- package/dist/storage/storage-manager.d.ts +83 -0
- package/dist/tar-BgAEMRBR.js +5434 -0
- package/dist/tar-ByMOPNM0.mjs +5429 -0
- package/dist/tls/cert-manager.d.ts +26 -0
- package/dist/tls/index.d.ts +1 -0
- package/package.json +343 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IScopedLogger, IEventBus } from '@camstack/types';
|
|
2
|
+
export type ElementState = 'stopped' | 'starting' | 'running' | 'stopping' | 'error' | 'disabled';
|
|
3
|
+
export interface ElementStatus {
|
|
4
|
+
state: ElementState;
|
|
5
|
+
error?: string;
|
|
6
|
+
startedAt?: number;
|
|
7
|
+
stoppedAt?: number;
|
|
8
|
+
restartCount: number;
|
|
9
|
+
uptime: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class LifecycleStateMachine {
|
|
12
|
+
private readonly elementId;
|
|
13
|
+
private readonly elementType;
|
|
14
|
+
private readonly eventBus;
|
|
15
|
+
private readonly logger;
|
|
16
|
+
private _state;
|
|
17
|
+
private _error?;
|
|
18
|
+
private _startedAt?;
|
|
19
|
+
private _stoppedAt?;
|
|
20
|
+
private _restartCount;
|
|
21
|
+
private _hasStartedOnce;
|
|
22
|
+
constructor(elementId: string, elementType: 'provider' | 'device' | 'addon' | 'process', eventBus: IEventBus, logger: IScopedLogger);
|
|
23
|
+
get state(): ElementState;
|
|
24
|
+
getStatus(): ElementStatus;
|
|
25
|
+
transition(to: ElementState, error?: string): boolean;
|
|
26
|
+
incrementRestartCount(): void;
|
|
27
|
+
private isValidTransition;
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LogEntry } from '@camstack/types';
|
|
2
|
+
/** Options for `formatLogLine`. */
|
|
3
|
+
export interface FormatLogLineOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Emit ANSI colour codes. When omitted, falls back to the shell-env
|
|
6
|
+
* heuristic (`NO_COLOR`/`FORCE_COLOR`/`isTTY`). Destinations that
|
|
7
|
+
* always target a console (ConsoleDestination, HubForwarderDestination)
|
|
8
|
+
* pass `true`; file sinks (Winston JSON) pass `false` so logs on disk
|
|
9
|
+
* stay plain text regardless of the shell env.
|
|
10
|
+
*
|
|
11
|
+
* `NO_COLOR=1` in the environment still wins — consumer opt-in beats
|
|
12
|
+
* producer opt-in, matching the https://no-color.org/ convention.
|
|
13
|
+
*/
|
|
14
|
+
readonly colorize?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Render a `LogEntry` as one complete console line — no trailing newline.
|
|
18
|
+
* Caller appends `\n` (file sinks) or relies on `console.log` (stdout sink).
|
|
19
|
+
*
|
|
20
|
+
* PID column prefers `entry.tags.pid` when set (so forked-worker entries
|
|
21
|
+
* carry the worker's OS pid even when the hub renders them), falling back
|
|
22
|
+
* to the renderer's own `process.pid`.
|
|
23
|
+
*
|
|
24
|
+
* Colours (when enabled) follow the NestJS convention: the level token
|
|
25
|
+
* AND the message body share the level colour (green/yellow/red/gray for
|
|
26
|
+
* info/warn/error/debug). Brand, device context, scope and meta keep
|
|
27
|
+
* their fixed hues so the structural fields stay visually distinct from
|
|
28
|
+
* the message content.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatLogLine(entry: LogEntry, options?: FormatLogLineOptions): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { LogEntry, LogFilter } from './log-ring-buffer.js';
|
|
2
|
+
import { IScopedLogger } from './scoped-logger.js';
|
|
3
|
+
export interface ILogDestination {
|
|
4
|
+
initialize(): Promise<void>;
|
|
5
|
+
shutdown(): Promise<void>;
|
|
6
|
+
write(entry: LogEntry): void;
|
|
7
|
+
query?(filter: LogFilter): Promise<readonly LogEntry[]>;
|
|
8
|
+
}
|
|
9
|
+
export declare class LogManager {
|
|
10
|
+
private readonly ringBuffer;
|
|
11
|
+
private readonly destinations;
|
|
12
|
+
private readonly subscribers;
|
|
13
|
+
private deviceNameLookup;
|
|
14
|
+
/** `perAddonCapacity` bounds EACH addon's bucket, not the total — a chatty
|
|
15
|
+
* addon evicts only its own lines, so quiet addons keep their sparse history.
|
|
16
|
+
* See {@link PartitionedLogBuffer}. */
|
|
17
|
+
constructor(perAddonCapacity?: number);
|
|
18
|
+
/**
|
|
19
|
+
* Register a callback that resolves `deviceId → deviceName`. Called
|
|
20
|
+
* for every emitted entry that carries `tags.deviceId` but no
|
|
21
|
+
* explicit `tags.deviceName` — the LogManager injects the resolved
|
|
22
|
+
* name directly into the entry's tags BEFORE ring-buffer / destination
|
|
23
|
+
* write, so every destination (local console, file, remote forwarder,
|
|
24
|
+
* addon-bundled copies of core) sees the enriched shape regardless of
|
|
25
|
+
* which module instance the destination was built from.
|
|
26
|
+
*/
|
|
27
|
+
setDeviceNameLookup(lookup: ((deviceId: number) => string | null) | null): void;
|
|
28
|
+
createLogger(scope?: string): IScopedLogger;
|
|
29
|
+
private enrichDeviceName;
|
|
30
|
+
/** Subscribe to live logs matching a filter. Returns an unsubscribe function. */
|
|
31
|
+
subscribe(filter: Partial<LogFilter>, callback: (entry: LogEntry) => void): () => void;
|
|
32
|
+
private matchesFilter;
|
|
33
|
+
/**
|
|
34
|
+
* Register a log destination.
|
|
35
|
+
*
|
|
36
|
+
* @param opts.replay If true (default), replay every entry currently in
|
|
37
|
+
* the ring buffer to the new destination before live
|
|
38
|
+
* traffic starts. Lets a destination added mid-boot
|
|
39
|
+
* still receive boot-time log entries.
|
|
40
|
+
*/
|
|
41
|
+
addDestination(dest: ILogDestination, opts?: {
|
|
42
|
+
replay?: boolean;
|
|
43
|
+
}): void;
|
|
44
|
+
removeDestination(dest: ILogDestination): void;
|
|
45
|
+
query(filter: LogFilter): LogEntry[];
|
|
46
|
+
/**
|
|
47
|
+
* Drop ring-buffer entries matching `filter`. Returns the count
|
|
48
|
+
* removed. Backs the UI's "Clear logs" admin action so an operator
|
|
49
|
+
* can wipe the historical window for a scope (per-device, per-addon,
|
|
50
|
+
* agent-level) without restarting the server. External destinations
|
|
51
|
+
* (file, forwarder) are NOT touched — only the in-memory ring.
|
|
52
|
+
*/
|
|
53
|
+
clear(filter?: LogFilter): number;
|
|
54
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LogLevel, LogEntry, LogFilter, LogTags } from '@camstack/types';
|
|
2
|
+
export type { LogLevel, LogEntry, LogFilter };
|
|
3
|
+
/**
|
|
4
|
+
* Per-tag filter matcher with semantic-aware comparisons:
|
|
5
|
+
*
|
|
6
|
+
* `addonId` — matches the entry's bare addon id (strips any `@<workerId>`
|
|
7
|
+
* qualifier added by the cap-router for remote providers).
|
|
8
|
+
* So a UI filter for `audio-classifier` matches both the
|
|
9
|
+
* addon's own log lines and bridge management lines whose
|
|
10
|
+
* addonId is logged as `audio-classifier@dev-agent-0/audio-classifier`.
|
|
11
|
+
*
|
|
12
|
+
* `agentId` — matches when ANY of these hold:
|
|
13
|
+
* * the entry was emitted by that agent (`agentId` exact)
|
|
14
|
+
* * the entry's `nodeId` IS that agent (single-node case)
|
|
15
|
+
* * the entry's `nodeId` starts with `<agent>/` (worker
|
|
16
|
+
* inside that agent — e.g. `dev-agent-0/audio-classifier`)
|
|
17
|
+
* Captures all the log emission paths for an addon hosted
|
|
18
|
+
* on the agent regardless of who actually emitted the line.
|
|
19
|
+
*
|
|
20
|
+
* any other key — exact match (legacy semantics).
|
|
21
|
+
*
|
|
22
|
+
* Returns `true` when ALL filter keys match (AND), `false` otherwise.
|
|
23
|
+
* `undefined` filter values are skipped.
|
|
24
|
+
*/
|
|
25
|
+
export declare function matchesLogTags(entryTags: LogTags | undefined, filterTags: Partial<LogTags>): boolean;
|
|
26
|
+
export declare class LogRingBuffer {
|
|
27
|
+
private readonly capacity;
|
|
28
|
+
private readonly buffer;
|
|
29
|
+
private head;
|
|
30
|
+
private count;
|
|
31
|
+
constructor(capacity?: number);
|
|
32
|
+
push(entry: LogEntry): void;
|
|
33
|
+
getAll(): LogEntry[];
|
|
34
|
+
query(filter: LogFilter): LogEntry[];
|
|
35
|
+
/**
|
|
36
|
+
* Drop entries that match `filter`. Returns the number of entries
|
|
37
|
+
* removed. Triggered by the UI's "Clear logs" button so the operator
|
|
38
|
+
* can wipe the historical buffer for a specific scope (per-device,
|
|
39
|
+
* per-addon, per-agent) — without it, closing and reopening the
|
|
40
|
+
* panel re-populates the cleared rows from the server's ring buffer.
|
|
41
|
+
*
|
|
42
|
+
* Filter semantics mirror `query` (same level / since / until / tags
|
|
43
|
+
* handling) — whatever you'd see listed by `query(filter)` is what
|
|
44
|
+
* gets removed.
|
|
45
|
+
*/
|
|
46
|
+
clear(filter?: LogFilter): number;
|
|
47
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LogEntry, LogFilter } from '@camstack/types';
|
|
2
|
+
/**
|
|
3
|
+
* A log buffer partitioned into one fixed-capacity {@link LogRingBuffer} per
|
|
4
|
+
* `addonId`. A chatty addon (e.g. detection-pipeline) only ever evicts its OWN
|
|
5
|
+
* bucket, so a quiet addon's sparse lines (e.g. a HomeAssistant `image` entity)
|
|
6
|
+
* survive far longer than they would in a single shared FIFO ring.
|
|
7
|
+
*
|
|
8
|
+
* Drop-in for {@link LogRingBuffer} from {@link LogManager}'s perspective —
|
|
9
|
+
* exposes the same `push` / `getAll` / `query` / `clear` surface. Total memory
|
|
10
|
+
* is bounded by `perAddonCapacity × (number of distinct addons seen)`; quiet
|
|
11
|
+
* buckets never grow past the handful of lines they actually emit.
|
|
12
|
+
*/
|
|
13
|
+
export declare class PartitionedLogBuffer {
|
|
14
|
+
private readonly perAddonCapacity;
|
|
15
|
+
private readonly buffers;
|
|
16
|
+
constructor(perAddonCapacity?: number);
|
|
17
|
+
private bufferFor;
|
|
18
|
+
push(entry: LogEntry): void;
|
|
19
|
+
/** Every retained entry across all buckets, newest-first (mirrors
|
|
20
|
+
* {@link LogRingBuffer.getAll}). Used to replay history to a destination. */
|
|
21
|
+
getAll(): LogEntry[];
|
|
22
|
+
/**
|
|
23
|
+
* Query across buckets. When the filter pins an `addonId`, only that addon's
|
|
24
|
+
* bucket is scanned (the common case — the device/addon Logs tab). Otherwise
|
|
25
|
+
* every bucket is scanned, merged newest-first, then limited — so a
|
|
26
|
+
* `deviceId`-only filter (a device's own Logs tab) still finds its lines
|
|
27
|
+
* regardless of which addon emitted them.
|
|
28
|
+
*/
|
|
29
|
+
query(filter: LogFilter): LogEntry[];
|
|
30
|
+
clear(filter?: LogFilter): number;
|
|
31
|
+
/** The bucket key a filter pins to via `tags.addonId`, or null when the
|
|
32
|
+
* filter doesn't constrain the addon (→ scan all buckets). */
|
|
33
|
+
private pinnedAddonKey;
|
|
34
|
+
private mergeNewestFirst;
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IScopedLogger, LogExtras, LogTags } from '@camstack/types';
|
|
2
|
+
import { LogEntry } from './log-ring-buffer.js';
|
|
3
|
+
export type { IScopedLogger };
|
|
4
|
+
export declare class ScopedLogger implements IScopedLogger {
|
|
5
|
+
private readonly scope;
|
|
6
|
+
private readonly writeFn;
|
|
7
|
+
private readonly tags?;
|
|
8
|
+
constructor(scope: string | undefined, writeFn: (entry: LogEntry) => void, tags?: LogTags | undefined);
|
|
9
|
+
debug(message: string, extras?: LogExtras): void;
|
|
10
|
+
info(message: string, extras?: LogExtras): void;
|
|
11
|
+
warn(message: string, extras?: LogExtras): void;
|
|
12
|
+
error(message: string, extras?: LogExtras): void;
|
|
13
|
+
child(childScope: string): IScopedLogger;
|
|
14
|
+
withTags(tags: LogTags): IScopedLogger;
|
|
15
|
+
private write;
|
|
16
|
+
private mergeTags;
|
|
17
|
+
}
|