@camstack/types 1.2.569 → 1.2.571
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 +13 -0
- package/dist/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/capabilities/error.cap.d.ts +135 -0
- package/dist/capabilities/index.d.ts +3 -1
- package/dist/capabilities/terminal-session.cap.d.ts +30 -4
- package/dist/client.js +14 -0
- package/dist/client.mjs +14 -0
- package/dist/device/base-device.d.ts +15 -0
- package/dist/device/device-error-episode.d.ts +24 -0
- package/dist/generated/addon-api.d.ts +21 -0
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/cap-status-types.d.ts +3 -1
- package/dist/generated/cap-vocabulary.d.ts +1 -1
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/device-local-state.d.ts +3 -0
- package/dist/generated/device-proxy.d.ts +3 -0
- package/dist/generated/device-scoped-caps.d.ts +1 -1
- package/dist/generated/history-catalog.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +1 -1
- package/dist/generated/runtime-state-durability.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +271 -5
- package/dist/index.mjs +264 -6
- package/dist/{sleep-DbhT0DWV.mjs → sleep-BnR9qGOv.mjs} +54 -2
- package/dist/{sleep-DR76P1OE.js → sleep-Cr2-wtyQ.js} +54 -2
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ import type { doNotDisturbCapability } from '../capabilities/do-not-disturb.cap.
|
|
|
38
38
|
import type { doorbellCapability } from '../capabilities/doorbell.cap.js';
|
|
39
39
|
import type { energySystemCapability } from '../capabilities/energy-system.cap.js';
|
|
40
40
|
import type { enumSensorCapability } from '../capabilities/enum-sensor.cap.js';
|
|
41
|
+
import type { errorCapability } from '../capabilities/error.cap.js';
|
|
41
42
|
import type { eventEmitterCapability } from '../capabilities/event-emitter.cap.js';
|
|
42
43
|
import type { fanControlCapability } from '../capabilities/fan-control.cap.js';
|
|
43
44
|
import type { featureProbeCapability } from '../capabilities/feature-probe.cap.js';
|
|
@@ -158,6 +159,7 @@ export interface DeviceProxyState {
|
|
|
158
159
|
readonly doorbell: SliceHandle<InferRuntimeState<typeof doorbellCapability>>;
|
|
159
160
|
readonly energySystem: SliceHandle<InferRuntimeState<typeof energySystemCapability>>;
|
|
160
161
|
readonly enumSensor: SliceHandle<InferRuntimeState<typeof enumSensorCapability>>;
|
|
162
|
+
readonly error: SliceHandle<InferRuntimeState<typeof errorCapability>>;
|
|
161
163
|
readonly eventEmitter: SliceHandle<InferRuntimeState<typeof eventEmitterCapability>>;
|
|
162
164
|
readonly fanControl: SliceHandle<InferRuntimeState<typeof fanControlCapability>>;
|
|
163
165
|
readonly featureProbe: SliceHandle<InferRuntimeState<typeof featureProbeCapability>>;
|
|
@@ -273,6 +275,7 @@ export interface DeviceProxy {
|
|
|
273
275
|
readonly doorbell?: InferDeviceProxyCap<typeof doorbellCapability>;
|
|
274
276
|
readonly energySystem?: InferDeviceProxyCap<typeof energySystemCapability>;
|
|
275
277
|
readonly enumSensor?: InferDeviceProxyCap<typeof enumSensorCapability>;
|
|
278
|
+
readonly error?: InferDeviceProxyCap<typeof errorCapability>;
|
|
276
279
|
readonly eventEmitter?: InferDeviceProxyCap<typeof eventEmitterCapability>;
|
|
277
280
|
readonly fanControl?: InferDeviceProxyCap<typeof fanControlCapability>;
|
|
278
281
|
readonly featureProbe?: InferDeviceProxyCap<typeof featureProbeCapability>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* can answer "may a rule actuate this?" without importing the schema barrel
|
|
6
6
|
* (~144MB RSS per runner, D28).
|
|
7
7
|
*
|
|
8
|
-
* Coverage:
|
|
8
|
+
* Coverage: 107 device-scoped capabilities.
|
|
9
9
|
*/
|
|
10
10
|
export declare const DEVICE_SCOPED_CAPS: ReadonlySet<string>;
|
|
11
11
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CapabilityHistoryField, CapabilityHistoryItems } from '../capabilities/capability-definition.js';
|
|
2
2
|
/**
|
|
3
3
|
* Cap history catalog, projected from every `*.cap.ts` `history` block.
|
|
4
|
-
* 45 caps with series (104 series),
|
|
4
|
+
* 45 caps with series (104 series), 39 caps answered `'none'`.
|
|
5
5
|
* Field keys are `runtimeState` paths (`a.b` into fixed objects only).
|
|
6
6
|
*/
|
|
7
7
|
export declare const HISTORY_CATALOG: Readonly<Record<string, Readonly<Record<string, CapabilityHistoryField>>>>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* scope+access check inside `protectedProcedure` (see
|
|
7
7
|
* `server/backend/src/api/trpc/trpc.middleware.ts`).
|
|
8
8
|
*
|
|
9
|
-
* Coverage:
|
|
9
|
+
* Coverage: 1494 method paths across 208 capabilities.
|
|
10
10
|
*/
|
|
11
11
|
import type { MethodRole } from '../auth/viewer-access.js';
|
|
12
12
|
import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* system-scope cap that takes a deviceId was previously never device-filtered
|
|
7
7
|
* — see the generator header).
|
|
8
8
|
*
|
|
9
|
-
* Coverage:
|
|
9
|
+
* Coverage: 623 methods carry a device reference, of which
|
|
10
10
|
* 196 are on SYSTEM-scope caps.
|
|
11
11
|
*
|
|
12
12
|
* Top-level fields, number arrays, and one-level arrays of objects carrying
|
|
@@ -16,7 +16,7 @@ export interface RuntimeStatePolicy {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
19
|
-
* `runtimeState`.
|
|
19
|
+
* `runtimeState`. 85 caps: 43 `restored`, 42 `session`.
|
|
20
20
|
*
|
|
21
21
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
22
22
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -132,7 +132,7 @@ export interface SystemProxy {
|
|
|
132
132
|
readonly streamBroker: Pick<InferProvider<typeof streamBrokerCapability>, 'fetchEventMedia' | 'listAllCameraStreams' | 'listAllProfileSlots' | 'getBrokerStats' | 'probeStream' | 'listClients' | 'getLiveViewerCounts' | 'killClient' | 'getStreamUrl' | 'getStreamWithCodec' | 'releaseStreamWithCodec' | 'acquireEgressTranscode' | 'releaseEgressTranscode' | 'subscribeAudioChunks' | 'pullAudioChunks' | 'unsubscribeAudioChunks' | 'setPreBufferDuration' | 'getPreBufferInfo' | 'getRtspPort' | 'getAllRtspEntries' | 'getRtspEntry' | 'regenerateRtspToken' | 'setRtspEnabled' | 'isRtspEnabled'>;
|
|
133
133
|
readonly system: Pick<InferProvider<typeof systemCapability>, 'info' | 'health' | 'featureFlags' | 'networkAddresses' | 'getRetentionConfig' | 'setRetentionConfig' | 'forceRetentionCleanup' | 'getSiteLocation' | 'setSiteLocation' | 'detectSiteLocation' | 'getRequestCensus' | 'getLoadContributions' | 'getFailureContributions' | 'getLoggingSettings' | 'setLoggingSettings' | 'debugWatch'>;
|
|
134
134
|
readonly template: Pick<InferProvider<typeof templateCapability>, 'list' | 'get' | 'create' | 'update' | 'delete'>;
|
|
135
|
-
readonly terminalSession: Pick<InferProvider<typeof terminalSessionCapability>, 'listProfiles' | 'listLegacyCameras' | 'adoptLegacyMonitor' | 'listSessions' | 'openSession' | 'resize' | 'pullOutput' | 'writeInput' | 'close'>;
|
|
135
|
+
readonly terminalSession: Pick<InferProvider<typeof terminalSessionCapability>, 'listProfiles' | 'listLegacyCameras' | 'adoptLegacyMonitor' | 'listSessions' | 'serverShellStatus' | 'openSession' | 'resize' | 'pullOutput' | 'writeInput' | 'close'>;
|
|
136
136
|
readonly toast: Pick<InferProvider<typeof toastCapability>, 'onToast'>;
|
|
137
137
|
readonly training: Pick<InferProvider<typeof trainingCapability>, 'listBaseModels' | 'planJob' | 'startJob' | 'startJobBatch' | 'listJobs' | 'getJob' | 'cancelJob' | 'getJobResult' | 'listCanaryTargets' | 'registerResult' | 'canaryResult' | 'rollbackCanary' | 'discardResult'>;
|
|
138
138
|
readonly turnProvider: Pick<InferProvider<typeof turnProviderCapability>, 'getTurnServers'>;
|
package/dist/index.d.ts
CHANGED
|
@@ -275,6 +275,7 @@ export type { DeviceRestoreRetrySchedulerOptions, InitialRestoreFailure, Permane
|
|
|
275
275
|
export { DEVICE_RESTORE_RETRY_CONCURRENCY, DEVICE_RESTORE_RETRY_DELAYS_MS, DeviceRestoreRetryScheduler, } from './device/device-restore-retry.js';
|
|
276
276
|
export type { IDeviceRuntimeState, RuntimeStateWriteFailed, RuntimeStateWriter, } from './device/device-runtime-state.js';
|
|
277
277
|
export { DeviceRuntimeState } from './device/device-runtime-state.js';
|
|
278
|
+
export { buildDeviceErrorAlert, type DeviceErrorEdge, deviceErrorAlertId, deviceErrorEdge, } from './device/device-error-episode.js';
|
|
278
279
|
export type { SliceEventBus, SliceHandle, SliceHandleApi, SliceHandleSource, } from './device/device-state-handle.js';
|
|
279
280
|
export { createEventBusSliceSource, createLazyTrpcSource, createMirrorSource, createSliceHandle, } from './device/device-state-handle.js';
|
|
280
281
|
export { ChargingStatus, DeviceFeature, DeviceRole, DeviceType, featuresOfBoundCaps, } from './device/device-type.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-Cr2-wtyQ.js");
|
|
3
3
|
const require_event_category = require("./event-category-d9kiqCqC.js");
|
|
4
4
|
const require_composed_stable_id = require("./composed-stable-id-C3NfRTj8.js");
|
|
5
5
|
const require_implemented_methods = require("./implemented-methods-C7ScGvEz.js");
|
|
@@ -50773,7 +50773,7 @@ function groupTemplate(id) {
|
|
|
50773
50773
|
//#region src/generated/history-catalog.ts
|
|
50774
50774
|
/**
|
|
50775
50775
|
* Cap history catalog, projected from every `*.cap.ts` `history` block.
|
|
50776
|
-
* 45 caps with series (104 series),
|
|
50776
|
+
* 45 caps with series (104 series), 39 caps answered `'none'`.
|
|
50777
50777
|
* Field keys are `runtimeState` paths (`a.b` into fixed objects only).
|
|
50778
50778
|
*/
|
|
50779
50779
|
var HISTORY_CATALOG = {
|
|
@@ -51345,6 +51345,7 @@ var HISTORY_NONE_CAPS = [
|
|
|
51345
51345
|
"control",
|
|
51346
51346
|
"day-night",
|
|
51347
51347
|
"doorbell",
|
|
51348
|
+
"error",
|
|
51348
51349
|
"event-emitter",
|
|
51349
51350
|
"feature-probe",
|
|
51350
51351
|
"group-active",
|
|
@@ -60738,6 +60739,87 @@ var enumSensorCapability = {
|
|
|
60738
60739
|
}
|
|
60739
60740
|
};
|
|
60740
60741
|
//#endregion
|
|
60742
|
+
//#region src/capabilities/error.cap.ts
|
|
60743
|
+
/** How loudly a fault wants the operator. Both tiers raise the attention event. */
|
|
60744
|
+
var DeviceErrorSeveritySchema = zod.z.enum(["warning", "error"]);
|
|
60745
|
+
/** One fault of a device that can raise several at once. */
|
|
60746
|
+
var DeviceFaultSchema = zod.z.object({
|
|
60747
|
+
/** The device's own code, as the vendor names it. */
|
|
60748
|
+
code: zod.z.string(),
|
|
60749
|
+
/** Already translated by the provider (it owns the vendor vocabulary). */
|
|
60750
|
+
label: zod.z.string(),
|
|
60751
|
+
severity: DeviceErrorSeveritySchema
|
|
60752
|
+
});
|
|
60753
|
+
/**
|
|
60754
|
+
* The fault a device reports right now. One slice per device.
|
|
60755
|
+
*
|
|
60756
|
+
* `active` is tri-state: `null` is "the provider has not read it yet" and is
|
|
60757
|
+
* never drawn as "no fault" nor as a fault (D315, D393). The provider filters
|
|
60758
|
+
* what is not a fault (a completion or reminder code) BEFORE it writes `true`.
|
|
60759
|
+
*
|
|
60760
|
+
* The cap's name is the key a template reads (`{{ alias.error.label }}`, D1021).
|
|
60761
|
+
*/
|
|
60762
|
+
var ErrorStatusSchema = zod.z.object({
|
|
60763
|
+
active: zod.z.boolean().nullable(),
|
|
60764
|
+
/** The code of the principal fault; `null` when none (or unknown). */
|
|
60765
|
+
code: zod.z.string().nullable(),
|
|
60766
|
+
/** The principal fault's words, provider-translated; `null` when none. */
|
|
60767
|
+
label: zod.z.string().nullable(),
|
|
60768
|
+
severity: DeviceErrorSeveritySchema,
|
|
60769
|
+
/** Ms epoch the current fault started; `null` when none or not known. */
|
|
60770
|
+
since: zod.z.number().nullable(),
|
|
60771
|
+
/** Every fault, for a device that raises several. The principal is the first. */
|
|
60772
|
+
faults: zod.z.array(DeviceFaultSchema).optional(),
|
|
60773
|
+
/** Ms epoch of the last read the provider made of the fault. */
|
|
60774
|
+
lastFetchedAt: zod.z.number()
|
|
60775
|
+
});
|
|
60776
|
+
/** The slice before the provider has read anything: unknown, not "fine". */
|
|
60777
|
+
var ERROR_STATUS_COLD = {
|
|
60778
|
+
active: null,
|
|
60779
|
+
code: null,
|
|
60780
|
+
label: null,
|
|
60781
|
+
severity: "error",
|
|
60782
|
+
since: null,
|
|
60783
|
+
lastFetchedAt: 0
|
|
60784
|
+
};
|
|
60785
|
+
var errorCapability = {
|
|
60786
|
+
name: "error",
|
|
60787
|
+
scope: "device",
|
|
60788
|
+
deviceNative: true,
|
|
60789
|
+
mode: "singleton",
|
|
60790
|
+
methods: {},
|
|
60791
|
+
status: {
|
|
60792
|
+
schema: ErrorStatusSchema,
|
|
60793
|
+
kind: "push",
|
|
60794
|
+
empty: ERROR_STATUS_COLD
|
|
60795
|
+
},
|
|
60796
|
+
runtimeState: ErrorStatusSchema,
|
|
60797
|
+
/**
|
|
60798
|
+
* Runtime-state durability: **restored** — the previous observation is what
|
|
60799
|
+
* lets the first reading after a restart be a COMPARISON: a fault that was
|
|
60800
|
+
* already open must not announce itself a second time.
|
|
60801
|
+
*
|
|
60802
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
60803
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
60804
|
+
*/
|
|
60805
|
+
durability: "restored",
|
|
60806
|
+
volatileStateFields: ["lastFetchedAt"],
|
|
60807
|
+
/** The fault itself is carried by the attention alerts; no series is recorded. */
|
|
60808
|
+
history: "none",
|
|
60809
|
+
vocabulary: {
|
|
60810
|
+
noun: require_sleep.t("Fault", "Guasto"),
|
|
60811
|
+
order: 5265,
|
|
60812
|
+
state: [{
|
|
60813
|
+
kind: "boolean",
|
|
60814
|
+
field: "active",
|
|
60815
|
+
label: require_sleep.t("Fault", "Guasto"),
|
|
60816
|
+
whenTrue: require_sleep.t("When {device} reports a fault", "Quando {device} segnala un guasto"),
|
|
60817
|
+
whenFalse: require_sleep.t("When the fault of {device} clears", "Quando il guasto di {device} si risolve"),
|
|
60818
|
+
icon: "triangle-alert"
|
|
60819
|
+
}]
|
|
60820
|
+
}
|
|
60821
|
+
};
|
|
60822
|
+
//#endregion
|
|
60741
60823
|
//#region src/capabilities/face-gallery.cap.ts
|
|
60742
60824
|
var IdentitySchema = zod.z.object({
|
|
60743
60825
|
id: zod.z.string(),
|
|
@@ -97788,6 +97870,17 @@ var TerminalOutputEventSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
|
97788
97870
|
exitCode: zod.z.number().int(),
|
|
97789
97871
|
signal: zod.z.number().int().optional()
|
|
97790
97872
|
})]);
|
|
97873
|
+
var ServerShellRefusalSchema = zod.z.object({
|
|
97874
|
+
code: zod.z.literal("server-shell-disabled"),
|
|
97875
|
+
nodeId: zod.z.string(),
|
|
97876
|
+
message: zod.z.string()
|
|
97877
|
+
});
|
|
97878
|
+
var ServerShellStatusSchema = zod.z.object({
|
|
97879
|
+
nodeId: zod.z.string(),
|
|
97880
|
+
enabled: zod.z.boolean(),
|
|
97881
|
+
idleMinutes: zod.z.number().int().positive(),
|
|
97882
|
+
refusal: ServerShellRefusalSchema.nullable()
|
|
97883
|
+
});
|
|
97791
97884
|
var TerminalOutputBatchSchema = zod.z.object({
|
|
97792
97885
|
cursor: zod.z.number().int().nonnegative(),
|
|
97793
97886
|
reset: zod.z.boolean(),
|
|
@@ -97821,6 +97914,11 @@ var terminalSessionCapability = {
|
|
|
97821
97914
|
/** Live sessions currently hosted by the provider. */
|
|
97822
97915
|
listSessions: require_sleep.method(zod.z.void(), zod.z.array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }),
|
|
97823
97916
|
/**
|
|
97917
|
+
* Whether this node has opted in to the server shell. The refusal names
|
|
97918
|
+
* the node when the opt-in is off. The boolean is decided in the provider.
|
|
97919
|
+
*/
|
|
97920
|
+
serverShellStatus: require_sleep.method(zod.z.void(), ServerShellStatusSchema, { auth: "admin" }),
|
|
97921
|
+
/**
|
|
97824
97922
|
* Spawn a pty for an allowlisted profile at the given grid size and return
|
|
97825
97923
|
* its session id. Output/input then flow over the data plane by that id.
|
|
97826
97924
|
*/
|
|
@@ -97834,7 +97932,8 @@ var terminalSessionCapability = {
|
|
|
97834
97932
|
environment: zod.z.array(zod.z.string().max(4096)).max(64).optional()
|
|
97835
97933
|
}), TerminalSessionInfoSchema, {
|
|
97836
97934
|
kind: "mutation",
|
|
97837
|
-
auth: "admin"
|
|
97935
|
+
auth: "admin",
|
|
97936
|
+
caller: "required"
|
|
97838
97937
|
}),
|
|
97839
97938
|
/** Resize a live session's pty (reflows the running program). */
|
|
97840
97939
|
resize: require_sleep.method(zod.z.object({
|
|
@@ -97863,6 +97962,7 @@ var terminalSessionCapability = {
|
|
|
97863
97962
|
}), TerminalOutputBatchSchema, {
|
|
97864
97963
|
kind: "mutation",
|
|
97865
97964
|
auth: "admin",
|
|
97965
|
+
caller: "required",
|
|
97866
97966
|
timeoutMs: 15e3
|
|
97867
97967
|
}),
|
|
97868
97968
|
/** Write terminal input through the node-routable capability plane. */
|
|
@@ -97876,7 +97976,8 @@ var terminalSessionCapability = {
|
|
|
97876
97976
|
/** Terminate a live session and release its pty. */
|
|
97877
97977
|
close: require_sleep.method(zod.z.object({ sessionId: zod.z.string() }), zod.z.void(), {
|
|
97878
97978
|
kind: "mutation",
|
|
97879
|
-
auth: "admin"
|
|
97979
|
+
auth: "admin",
|
|
97980
|
+
caller: "required"
|
|
97880
97981
|
})
|
|
97881
97982
|
},
|
|
97882
97983
|
vocabulary: { notOperatorFacing: require_sleep.NOT_A_DEVICE.CLUSTER }
|
|
@@ -101338,6 +101439,7 @@ var CAPABILITY_NAMES = {
|
|
|
101338
101439
|
embeddingEncoder: "embedding-encoder",
|
|
101339
101440
|
energySystem: "energy-system",
|
|
101340
101441
|
enumSensor: "enum-sensor",
|
|
101442
|
+
error: "error",
|
|
101341
101443
|
eventEmitter: "event-emitter",
|
|
101342
101444
|
faceGallery: "face-gallery",
|
|
101343
101445
|
failureContribution: "failure-contribution",
|
|
@@ -101764,6 +101866,10 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
101764
101866
|
key: "enumSensor",
|
|
101765
101867
|
name: "enum-sensor"
|
|
101766
101868
|
},
|
|
101869
|
+
{
|
|
101870
|
+
key: "error",
|
|
101871
|
+
name: "error"
|
|
101872
|
+
},
|
|
101767
101873
|
{
|
|
101768
101874
|
key: "eventEmitter",
|
|
101769
101875
|
name: "event-emitter"
|
|
@@ -102387,6 +102493,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
102387
102493
|
embeddingEncoderCapability,
|
|
102388
102494
|
energySystemCapability,
|
|
102389
102495
|
enumSensorCapability,
|
|
102496
|
+
errorCapability,
|
|
102390
102497
|
eventEmitterCapability,
|
|
102391
102498
|
faceGalleryCapability,
|
|
102392
102499
|
failureContributionCapability,
|
|
@@ -110057,6 +110164,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
110057
110164
|
doorbell: doorbellCapability,
|
|
110058
110165
|
energySystem: energySystemCapability,
|
|
110059
110166
|
enumSensor: enumSensorCapability,
|
|
110167
|
+
error: errorCapability,
|
|
110060
110168
|
eventEmitter: eventEmitterCapability,
|
|
110061
110169
|
fanControl: fanControlCapability,
|
|
110062
110170
|
featureProbe: featureProbeCapability,
|
|
@@ -110119,6 +110227,56 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
110119
110227
|
zones: zonesCapability
|
|
110120
110228
|
};
|
|
110121
110229
|
//#endregion
|
|
110230
|
+
//#region src/device/device-error-episode.ts
|
|
110231
|
+
/**
|
|
110232
|
+
* The edge between two readings, or `null` for no edge.
|
|
110233
|
+
*
|
|
110234
|
+
* - `null`/cold → `true` is a START (a fault already open at boot is one);
|
|
110235
|
+
* - `true` → `false` is a RESOLVE;
|
|
110236
|
+
* - an UNKNOWN reading (`active: null`) is never an edge, in either direction —
|
|
110237
|
+
* a failed read must neither raise nor close an episode (D393, D49);
|
|
110238
|
+
* - `true` → `true` is the same episode, whatever the code did.
|
|
110239
|
+
*/
|
|
110240
|
+
function deviceErrorEdge(previous, next) {
|
|
110241
|
+
if (next.active === true && previous?.active !== true) return "start";
|
|
110242
|
+
if (next.active === false && previous?.active === true) return "resolve";
|
|
110243
|
+
return null;
|
|
110244
|
+
}
|
|
110245
|
+
function deviceErrorAlertId(deviceId) {
|
|
110246
|
+
return `device-error:${String(deviceId)}`;
|
|
110247
|
+
}
|
|
110248
|
+
/** The alert that opens an episode. `since` is the fault's own start, else `now`. */
|
|
110249
|
+
function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
|
|
110250
|
+
const label = status.label ?? status.code ?? "Fault";
|
|
110251
|
+
const startedAt = status.since ?? now;
|
|
110252
|
+
const alertId = deviceErrorAlertId(deviceId);
|
|
110253
|
+
return {
|
|
110254
|
+
id: alertId,
|
|
110255
|
+
category: "device.error",
|
|
110256
|
+
severity: "critical",
|
|
110257
|
+
title: `${deviceName}: ${label}`,
|
|
110258
|
+
message: `${deviceName} reports a fault: ${label}.`,
|
|
110259
|
+
action: {
|
|
110260
|
+
label: "Open device",
|
|
110261
|
+
href: `/devices/${String(deviceId)}`,
|
|
110262
|
+
navigation: "app"
|
|
110263
|
+
},
|
|
110264
|
+
status: "active",
|
|
110265
|
+
read: false,
|
|
110266
|
+
createdAt: now,
|
|
110267
|
+
updatedAt: now,
|
|
110268
|
+
source: {
|
|
110269
|
+
type: "device",
|
|
110270
|
+
id: String(deviceId)
|
|
110271
|
+
},
|
|
110272
|
+
metadata: {
|
|
110273
|
+
episodeId: `${alertId}@${String(startedAt)}`,
|
|
110274
|
+
code: status.code,
|
|
110275
|
+
deviceSeverity: status.severity
|
|
110276
|
+
}
|
|
110277
|
+
};
|
|
110278
|
+
}
|
|
110279
|
+
//#endregion
|
|
110122
110280
|
//#region src/device/base-device.ts
|
|
110123
110281
|
var BaseDevice = class {
|
|
110124
110282
|
id;
|
|
@@ -110419,6 +110577,68 @@ var BaseDevice = class {
|
|
|
110419
110577
|
} catch (err) {}
|
|
110420
110578
|
}
|
|
110421
110579
|
/**
|
|
110580
|
+
* Declare that this device can report a fault (the `error` cap). The slice
|
|
110581
|
+
* starts UNKNOWN — a restored slice is kept, so a fault that was open before
|
|
110582
|
+
* a restart is compared, not announced again.
|
|
110583
|
+
*/
|
|
110584
|
+
registerErrorCap() {
|
|
110585
|
+
this.ctx.registerNativeCap?.(errorCapability, {});
|
|
110586
|
+
if (this.runtimeState.getCapState(errorCapability.name) === void 0) this.setCapSlice(errorCapability, ERROR_STATUS_COLD);
|
|
110587
|
+
}
|
|
110588
|
+
/**
|
|
110589
|
+
* Publish the device's fault. The slice is written; on an EDGE (a fault
|
|
110590
|
+
* starts, or one resolves) an attention episode opens or closes through the
|
|
110591
|
+
* alerts cap, which the notification center announces as
|
|
110592
|
+
* `device-attention-required` / `-resolved`. An unknown reading is never an
|
|
110593
|
+
* edge. No rule exists by default: it notifies when the operator makes one.
|
|
110594
|
+
*/
|
|
110595
|
+
async publishError(reading) {
|
|
110596
|
+
const previous = this.getCapSlice(errorCapability);
|
|
110597
|
+
if (reading.active === null && previous !== null && previous.active !== null) return;
|
|
110598
|
+
const now = Date.now();
|
|
110599
|
+
const edge = deviceErrorEdge(previous, reading);
|
|
110600
|
+
const next = edge === "start" && reading.since === null ? {
|
|
110601
|
+
...reading,
|
|
110602
|
+
since: now
|
|
110603
|
+
} : reading;
|
|
110604
|
+
this.setCapSlice(errorCapability, next);
|
|
110605
|
+
if (edge === null) return;
|
|
110606
|
+
const alerts = this.ctx.api.alerts;
|
|
110607
|
+
if (alerts === void 0) {
|
|
110608
|
+
this.ctx.logger.warn("device error: attention event skipped — alerts capability missing", {
|
|
110609
|
+
tags: { deviceId: this.id },
|
|
110610
|
+
meta: { edge }
|
|
110611
|
+
});
|
|
110612
|
+
return;
|
|
110613
|
+
}
|
|
110614
|
+
try {
|
|
110615
|
+
if (edge === "start") await alerts.emit.mutate(buildDeviceErrorAlert(this.id, this.name, next, now));
|
|
110616
|
+
else await alerts.update.mutate({
|
|
110617
|
+
alertId: deviceErrorAlertId(this.id),
|
|
110618
|
+
patch: {
|
|
110619
|
+
status: "completed",
|
|
110620
|
+
read: true,
|
|
110621
|
+
updatedAt: now
|
|
110622
|
+
}
|
|
110623
|
+
});
|
|
110624
|
+
this.ctx.logger.info(`device error: ${edge === "start" ? "raised" : "resolved"}`, {
|
|
110625
|
+
tags: { deviceId: this.id },
|
|
110626
|
+
meta: {
|
|
110627
|
+
code: next.code,
|
|
110628
|
+
label: next.label
|
|
110629
|
+
}
|
|
110630
|
+
});
|
|
110631
|
+
} catch (err) {
|
|
110632
|
+
this.ctx.logger.warn("device error: attention event failed", {
|
|
110633
|
+
tags: { deviceId: this.id },
|
|
110634
|
+
meta: {
|
|
110635
|
+
edge,
|
|
110636
|
+
error: require_composed_stable_id.errMsg(err)
|
|
110637
|
+
}
|
|
110638
|
+
});
|
|
110639
|
+
}
|
|
110640
|
+
}
|
|
110641
|
+
/**
|
|
110422
110642
|
* Typed read-through to a cap-keyed runtime-state slice. Drivers
|
|
110423
110643
|
* call `this.getCapSlice(batteryCapability)` and the return type
|
|
110424
110644
|
* is inferred from the cap's `runtimeState` Zod schema — no string
|
|
@@ -119797,6 +120017,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
119797
120017
|
access: "view",
|
|
119798
120018
|
role: "viewer"
|
|
119799
120019
|
},
|
|
120020
|
+
"error.getStatus": {
|
|
120021
|
+
capName: "error",
|
|
120022
|
+
capScope: "device",
|
|
120023
|
+
addonId: null,
|
|
120024
|
+
access: "view",
|
|
120025
|
+
role: "viewer"
|
|
120026
|
+
},
|
|
119800
120027
|
"eventEmitter.getStatus": {
|
|
119801
120028
|
capName: "event-emitter",
|
|
119802
120029
|
capScope: "device",
|
|
@@ -126055,6 +126282,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
126055
126282
|
access: "create",
|
|
126056
126283
|
role: "admin"
|
|
126057
126284
|
},
|
|
126285
|
+
"terminalSession.serverShellStatus": {
|
|
126286
|
+
capName: "terminal-session",
|
|
126287
|
+
capScope: "system",
|
|
126288
|
+
addonId: null,
|
|
126289
|
+
access: "view",
|
|
126290
|
+
role: "admin"
|
|
126291
|
+
},
|
|
126058
126292
|
"terminalSession.writeInput": {
|
|
126059
126293
|
capName: "terminal-session",
|
|
126060
126294
|
capScope: "system",
|
|
@@ -127026,6 +127260,7 @@ var KNOWN_CAP_NAMES = [
|
|
|
127026
127260
|
"embedding-encoder",
|
|
127027
127261
|
"energy-system",
|
|
127028
127262
|
"enum-sensor",
|
|
127263
|
+
"error",
|
|
127029
127264
|
"event-emitter",
|
|
127030
127265
|
"face-gallery",
|
|
127031
127266
|
"failure-contribution",
|
|
@@ -127200,6 +127435,7 @@ var DEVICE_CAP_NAMES = [
|
|
|
127200
127435
|
"doorbell",
|
|
127201
127436
|
"energy-system",
|
|
127202
127437
|
"enum-sensor",
|
|
127438
|
+
"error",
|
|
127203
127439
|
"event-emitter",
|
|
127204
127440
|
"fan-control",
|
|
127205
127441
|
"feature-probe",
|
|
@@ -129329,6 +129565,7 @@ var CAP_NAMES_WITH_STATUS = [
|
|
|
129329
129565
|
"doorbell",
|
|
129330
129566
|
"energy-system",
|
|
129331
129567
|
"enum-sensor",
|
|
129568
|
+
"error",
|
|
129332
129569
|
"event-emitter",
|
|
129333
129570
|
"fan-control",
|
|
129334
129571
|
"feature-probe",
|
|
@@ -130374,6 +130611,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
130374
130611
|
form: "single",
|
|
130375
130612
|
optional: false
|
|
130376
130613
|
}],
|
|
130614
|
+
"error.getStatus": [{
|
|
130615
|
+
name: "deviceId",
|
|
130616
|
+
form: "single",
|
|
130617
|
+
optional: false
|
|
130618
|
+
}],
|
|
130377
130619
|
"eventEmitter.getStatus": [{
|
|
130378
130620
|
name: "deviceId",
|
|
130379
130621
|
form: "single",
|
|
@@ -132767,7 +133009,7 @@ function getCapsByProviderKind(kind) {
|
|
|
132767
133009
|
//#region src/generated/runtime-state-durability.ts
|
|
132768
133010
|
/**
|
|
132769
133011
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
132770
|
-
* `runtimeState`.
|
|
133012
|
+
* `runtimeState`. 85 caps: 43 `restored`, 42 `session`.
|
|
132771
133013
|
*
|
|
132772
133014
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
132773
133015
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -132870,6 +133112,10 @@ var RUNTIME_STATE_POLICY = {
|
|
|
132870
133112
|
durability: "restored",
|
|
132871
133113
|
volatileFields: ["lastFetchedAt", "timestamp"]
|
|
132872
133114
|
},
|
|
133115
|
+
"error": {
|
|
133116
|
+
durability: "restored",
|
|
133117
|
+
volatileFields: ["lastFetchedAt"]
|
|
133118
|
+
},
|
|
132873
133119
|
"event-emitter": {
|
|
132874
133120
|
durability: "session",
|
|
132875
133121
|
volatileFields: []
|
|
@@ -133148,6 +133394,7 @@ var RESTORED_CAP_NAMES = [
|
|
|
133148
133394
|
"device-status",
|
|
133149
133395
|
"doorbell",
|
|
133150
133396
|
"enum-sensor",
|
|
133397
|
+
"error",
|
|
133151
133398
|
"flood",
|
|
133152
133399
|
"gas",
|
|
133153
133400
|
"humidity-sensor",
|
|
@@ -134517,6 +134764,7 @@ function createSystemProxy(api) {
|
|
|
134517
134764
|
listLegacyCameras: (input) => dispatch("terminalSession", "listLegacyCameras", "query", input),
|
|
134518
134765
|
adoptLegacyMonitor: (input) => dispatch("terminalSession", "adoptLegacyMonitor", "mutation", input),
|
|
134519
134766
|
listSessions: (input) => dispatch("terminalSession", "listSessions", "query", input),
|
|
134767
|
+
serverShellStatus: (input) => dispatch("terminalSession", "serverShellStatus", "query", input),
|
|
134520
134768
|
openSession: (input) => dispatch("terminalSession", "openSession", "mutation", input),
|
|
134521
134769
|
resize: (input) => dispatch("terminalSession", "resize", "mutation", input),
|
|
134522
134770
|
pullOutput: (input) => dispatch("terminalSession", "pullOutput", "mutation", input),
|
|
@@ -138409,6 +138657,16 @@ var NC_TEMPLATE_VARS = [
|
|
|
138409
138657
|
fields: [...RULE_TEXT],
|
|
138410
138658
|
kinds: ["sensor"]
|
|
138411
138659
|
},
|
|
138660
|
+
{
|
|
138661
|
+
name: "sensorState",
|
|
138662
|
+
label: "Sensor state",
|
|
138663
|
+
description: "The state a sensor, button or lock moved to, in the notification language (unlocked, open, pressed); empty when the event has no state.",
|
|
138664
|
+
example: "unlocked",
|
|
138665
|
+
group: "sensor",
|
|
138666
|
+
families: ["rule"],
|
|
138667
|
+
fields: [...RULE_TEXT],
|
|
138668
|
+
kinds: ["sensor"]
|
|
138669
|
+
},
|
|
138412
138670
|
{
|
|
138413
138671
|
name: "duration",
|
|
138414
138672
|
label: "Cycle duration",
|
|
@@ -147330,11 +147588,13 @@ exports.DeviceCredentialSchema = DeviceCredentialSchema;
|
|
|
147330
147588
|
exports.DeviceCredentialStatusSchema = DeviceCredentialStatusSchema;
|
|
147331
147589
|
exports.DeviceDataEntrySchema = DeviceDataEntrySchema;
|
|
147332
147590
|
exports.DeviceEnrollProofSchema = DeviceEnrollProofSchema;
|
|
147591
|
+
exports.DeviceErrorSeveritySchema = DeviceErrorSeveritySchema;
|
|
147333
147592
|
exports.DeviceExportExposeInputSchema = ExposeInputSchema;
|
|
147334
147593
|
exports.DeviceExportInstancePinSchema = InstancePinSchema;
|
|
147335
147594
|
exports.DeviceExportSetExposedNameInputSchema = SetExposedNameInputSchema;
|
|
147336
147595
|
exports.DeviceExportStatusSchema = DeviceExportStatusSchema;
|
|
147337
147596
|
exports.DeviceExportUnexposeInputSchema = UnexposeInputSchema;
|
|
147597
|
+
exports.DeviceFaultSchema = DeviceFaultSchema;
|
|
147338
147598
|
exports.DeviceFeature = require_composed_stable_id.DeviceFeature;
|
|
147339
147599
|
exports.DeviceFiredMatchSchema = DeviceFiredMatchSchema;
|
|
147340
147600
|
exports.DeviceFiredWatch = DeviceFiredWatch;
|
|
@@ -147426,6 +147686,7 @@ exports.EMBEDDING_REQUIREMENTS_UNAVAILABLE = EMBEDDING_REQUIREMENTS_UNAVAILABLE;
|
|
|
147426
147686
|
exports.EMPTY_AUTOMATION_STATE = EMPTY_AUTOMATION_STATE;
|
|
147427
147687
|
exports.EMPTY_REMOTE_ASSUMED_STATE = EMPTY_REMOTE_ASSUMED_STATE;
|
|
147428
147688
|
exports.EMPTY_REMOTE_CONFIG = EMPTY_REMOTE_CONFIG;
|
|
147689
|
+
exports.ERROR_STATUS_COLD = ERROR_STATUS_COLD;
|
|
147429
147690
|
exports.ESTIMATE_COMPUTE_RATIO_MAX = ESTIMATE_COMPUTE_RATIO_MAX;
|
|
147430
147691
|
exports.ESTIMATE_COMPUTE_RATIO_MIN = ESTIMATE_COMPUTE_RATIO_MIN;
|
|
147431
147692
|
exports.EVENTFUL_CAP_NAMES = EVENTFUL_CAP_NAMES;
|
|
@@ -147484,6 +147745,7 @@ exports.EnumSensorDateTimeFormatSchema = EnumSensorDateTimeFormatSchema;
|
|
|
147484
147745
|
exports.EnumSensorStatusSchema = EnumSensorStatusSchema;
|
|
147485
147746
|
exports.ErrorCodeSchema = require_sleep.ErrorCodeSchema;
|
|
147486
147747
|
exports.ErrorI18nPayloadSchema = require_sleep.ErrorI18nPayloadSchema;
|
|
147748
|
+
exports.ErrorStatusSchema = ErrorStatusSchema;
|
|
147487
147749
|
exports.EventCategory = require_event_category.EventCategory;
|
|
147488
147750
|
exports.EventDensityBucketSchema = EventDensityBucketSchema;
|
|
147489
147751
|
exports.EventDensityForDeviceSchema = EventDensityForDeviceSchema;
|
|
@@ -149403,6 +149665,7 @@ exports.buildBenchStepTree = buildBenchStepTree;
|
|
|
149403
149665
|
exports.buildCapabilityLookup = buildCapabilityLookup;
|
|
149404
149666
|
exports.buildDeviceAdminUrl = buildDeviceAdminUrl;
|
|
149405
149667
|
exports.buildDeviceEnrollmentLink = buildDeviceEnrollmentLink;
|
|
149668
|
+
exports.buildDeviceErrorAlert = buildDeviceErrorAlert;
|
|
149406
149669
|
exports.buildDeviceSignatureMessage = buildDeviceSignatureMessage;
|
|
149407
149670
|
exports.buildDraftJsonSchema = buildDraftJsonSchema;
|
|
149408
149671
|
exports.buildDraftPrompt = buildDraftPrompt;
|
|
@@ -149671,6 +149934,8 @@ exports.deviceAttentionKind = deviceAttentionKind;
|
|
|
149671
149934
|
exports.deviceBackendToFormat = deviceBackendToFormat;
|
|
149672
149935
|
exports.deviceCredentialsCapability = deviceCredentialsCapability;
|
|
149673
149936
|
exports.deviceCustomAction = require_sleep.deviceCustomAction;
|
|
149937
|
+
exports.deviceErrorAlertId = deviceErrorAlertId;
|
|
149938
|
+
exports.deviceErrorEdge = deviceErrorEdge;
|
|
149674
149939
|
exports.deviceExportCapability = deviceExportCapability;
|
|
149675
149940
|
exports.deviceExportStatusInstanceOf = statusInstanceOf;
|
|
149676
149941
|
exports.deviceExtensionCapability = deviceExtensionCapability;
|
|
@@ -149731,6 +149996,7 @@ exports.enumerateInferenceDevices = enumerateInferenceDevices;
|
|
|
149731
149996
|
exports.enumerateItemArrayFields = enumerateItemArrayFields;
|
|
149732
149997
|
exports.enumerateSchemaFields = enumerateSchemaFields;
|
|
149733
149998
|
exports.errMsg = require_composed_stable_id.errMsg;
|
|
149999
|
+
exports.errorCapability = errorCapability;
|
|
149734
150000
|
exports.estimateNodeBenchmarkDurationMs = estimateNodeBenchmarkDurationMs;
|
|
149735
150001
|
exports.evaluateAggregate = evaluateAggregate;
|
|
149736
150002
|
exports.evaluateAst = require_implemented_methods.evaluateAst;
|