@camstack/types 1.2.8 → 1.2.9
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.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/capabilities/custom-actions.d.ts +19 -0
- package/dist/capabilities/day-night.cap.d.ts +8 -8
- package/dist/capabilities/face-gallery.cap.d.ts +12 -0
- package/dist/capabilities/index.d.ts +28 -31
- package/dist/capabilities/notification-rules.cap.d.ts +698 -5
- package/dist/capabilities/notifier.cap.d.ts +3 -3
- package/dist/capabilities/toast.cap.d.ts +2 -2
- package/dist/catalogs/nc-taxonomy.d.ts +53 -0
- package/dist/enums/event-category.d.ts +0 -3
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/{event-category-D4HJq7Mw.mjs → event-category-BLcNejAE.mjs} +0 -3
- package/dist/{event-category-CGj9fI4L.js → event-category-Cdyife4p.js} +0 -3
- package/dist/generated/addon-api.d.ts +474 -334
- package/dist/generated/capability-router-map.d.ts +2 -5
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1357 -981
- package/dist/index.mjs +1190 -824
- package/dist/interfaces/addon.d.ts +2 -2
- package/dist/interfaces/capability.d.ts +0 -1
- package/dist/interfaces/event-bus.d.ts +0 -16
- package/dist/{sleep-D1IRluEi.js → sleep-BG8hQTA8.js} +1 -1
- package/dist/{sleep-BTyHhhpv.mjs → sleep-DiOnzenz.mjs} +1 -1
- package/package.json +1 -1
- package/dist/capabilities/advanced-notifier.cap.d.ts +0 -256
- package/dist/interfaces/advanced-notifier.d.ts +0 -73
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
3
|
-
const require_event_category = require("./event-category-
|
|
2
|
+
const require_sleep = require("./sleep-BG8hQTA8.js");
|
|
3
|
+
const require_event_category = require("./event-category-Cdyife4p.js");
|
|
4
4
|
const require_enums = require("./enums.js");
|
|
5
5
|
const require_err_msg = require("./err-msg-COpsHMw2.js");
|
|
6
6
|
let zod = require("zod");
|
|
@@ -2945,6 +2945,63 @@ function subKindsOf(macro) {
|
|
|
2945
2945
|
return out;
|
|
2946
2946
|
}
|
|
2947
2947
|
//#endregion
|
|
2948
|
+
//#region src/catalogs/nc-taxonomy.ts
|
|
2949
|
+
/**
|
|
2950
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
2951
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
2952
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
2953
|
+
* taxonomy surface (timeline, filters, event page).
|
|
2954
|
+
*
|
|
2955
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
2956
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
2957
|
+
* for the `classes` / `classesExclude` conditions.
|
|
2958
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
2959
|
+
* the same class picker, grouped under an Audio header.
|
|
2960
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
2961
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
2962
|
+
*
|
|
2963
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
2964
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
2965
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
2966
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
2967
|
+
*/
|
|
2968
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
2969
|
+
var NcTaxonomyEntrySchema = zod.z.object({
|
|
2970
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
2971
|
+
kind: zod.z.string(),
|
|
2972
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
2973
|
+
label: zod.z.string(),
|
|
2974
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
2975
|
+
parentKind: zod.z.string().nullable()
|
|
2976
|
+
});
|
|
2977
|
+
/** The complete NC picker taxonomy — three grouped buckets. */
|
|
2978
|
+
var NcTaxonomySchema = zod.z.object({
|
|
2979
|
+
videoClasses: zod.z.array(NcTaxonomyEntrySchema),
|
|
2980
|
+
audioKinds: zod.z.array(NcTaxonomyEntrySchema),
|
|
2981
|
+
labels: zod.z.array(NcTaxonomyEntrySchema)
|
|
2982
|
+
});
|
|
2983
|
+
function toEntry(kind, label, parentKind) {
|
|
2984
|
+
return {
|
|
2985
|
+
kind,
|
|
2986
|
+
label,
|
|
2987
|
+
parentKind
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
/**
|
|
2991
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
2992
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
2993
|
+
*/
|
|
2994
|
+
function buildNcTaxonomy() {
|
|
2995
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
2996
|
+
return {
|
|
2997
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
2998
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
2999
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
3000
|
+
};
|
|
3001
|
+
}
|
|
3002
|
+
/** The frozen NC taxonomy, derived once from the taxonomy dictionary. */
|
|
3003
|
+
var NC_TAXONOMY = Object.freeze(buildNcTaxonomy());
|
|
3004
|
+
//#endregion
|
|
2948
3005
|
//#region src/types/device-type.ts
|
|
2949
3006
|
var DEVICE_TYPE_INFO = { ["camera"]: {
|
|
2950
3007
|
type: "camera",
|
|
@@ -13583,7 +13640,8 @@ function createSystemProxy(api) {
|
|
|
13583
13640
|
deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
|
|
13584
13641
|
setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
|
|
13585
13642
|
testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
|
|
13586
|
-
getConditionCatalog: (input) => dispatch("notificationRules", "getConditionCatalog", "query", input)
|
|
13643
|
+
getConditionCatalog: (input) => dispatch("notificationRules", "getConditionCatalog", "query", input),
|
|
13644
|
+
getHistory: (input) => dispatch("notificationRules", "getHistory", "query", input)
|
|
13587
13645
|
},
|
|
13588
13646
|
pipelineExecutor: {
|
|
13589
13647
|
getAvailableEngines: (input) => dispatch("pipelineExecutor", "getAvailableEngines", "query", input),
|
|
@@ -14853,108 +14911,6 @@ var addonWidgetsCapability = {
|
|
|
14853
14911
|
methods: { listWidgets: require_sleep.method(zod.z.void(), zod.z.array(EnrichedWidgetMetadataSchema).readonly()) }
|
|
14854
14912
|
};
|
|
14855
14913
|
//#endregion
|
|
14856
|
-
//#region src/capabilities/advanced-notifier.cap.ts
|
|
14857
|
-
var NotificationRuleConditionsSchema = zod.z.object({
|
|
14858
|
-
deviceIds: zod.z.array(zod.z.number()).readonly().optional(),
|
|
14859
|
-
classNames: zod.z.array(zod.z.string()).readonly().optional(),
|
|
14860
|
-
zoneIds: zod.z.array(zod.z.string()).readonly().optional(),
|
|
14861
|
-
minConfidence: zod.z.number().optional(),
|
|
14862
|
-
source: zod.z.enum([
|
|
14863
|
-
"pipeline",
|
|
14864
|
-
"onboard",
|
|
14865
|
-
"any"
|
|
14866
|
-
]).optional(),
|
|
14867
|
-
schedule: zod.z.object({
|
|
14868
|
-
days: zod.z.array(zod.z.number()).readonly(),
|
|
14869
|
-
startHour: zod.z.number(),
|
|
14870
|
-
endHour: zod.z.number()
|
|
14871
|
-
}).optional(),
|
|
14872
|
-
cooldownSeconds: zod.z.number().optional(),
|
|
14873
|
-
minDwellSeconds: zod.z.number().optional(),
|
|
14874
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
14875
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
14876
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
14877
|
-
eventTypeTokens: zod.z.array(zod.z.string()).readonly().optional(),
|
|
14878
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
14879
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
14880
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
14881
|
-
clipDescription: zod.z.object({
|
|
14882
|
-
text: zod.z.string().min(1),
|
|
14883
|
-
minSimilarity: zod.z.number().min(0).max(1)
|
|
14884
|
-
}).optional(),
|
|
14885
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
14886
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
14887
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
14888
|
-
* vehicle/person> is seen". */
|
|
14889
|
-
labels: zod.z.array(zod.z.string()).readonly().optional()
|
|
14890
|
-
});
|
|
14891
|
-
var NotificationRuleTemplateSchema = zod.z.object({
|
|
14892
|
-
title: zod.z.string(),
|
|
14893
|
-
body: zod.z.string(),
|
|
14894
|
-
imageMode: zod.z.enum([
|
|
14895
|
-
"crop",
|
|
14896
|
-
"annotated",
|
|
14897
|
-
"full",
|
|
14898
|
-
"none"
|
|
14899
|
-
])
|
|
14900
|
-
});
|
|
14901
|
-
var NotificationRuleSchema = zod.z.object({
|
|
14902
|
-
id: zod.z.string(),
|
|
14903
|
-
name: zod.z.string(),
|
|
14904
|
-
enabled: zod.z.boolean(),
|
|
14905
|
-
eventTypes: zod.z.array(zod.z.string()).readonly(),
|
|
14906
|
-
conditions: NotificationRuleConditionsSchema,
|
|
14907
|
-
outputs: zod.z.array(zod.z.string()).readonly(),
|
|
14908
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
14909
|
-
priority: zod.z.enum([
|
|
14910
|
-
"low",
|
|
14911
|
-
"normal",
|
|
14912
|
-
"high",
|
|
14913
|
-
"critical"
|
|
14914
|
-
])
|
|
14915
|
-
});
|
|
14916
|
-
var NotificationTestResultSchema = zod.z.object({
|
|
14917
|
-
ruleId: zod.z.string(),
|
|
14918
|
-
eventId: zod.z.string(),
|
|
14919
|
-
timestamp: zod.z.number(),
|
|
14920
|
-
wouldFire: zod.z.boolean(),
|
|
14921
|
-
reason: zod.z.string().optional()
|
|
14922
|
-
});
|
|
14923
|
-
var NotificationHistoryEntrySchema = zod.z.object({
|
|
14924
|
-
id: zod.z.string(),
|
|
14925
|
-
ruleId: zod.z.string(),
|
|
14926
|
-
ruleName: zod.z.string(),
|
|
14927
|
-
eventId: zod.z.string(),
|
|
14928
|
-
timestamp: zod.z.number(),
|
|
14929
|
-
outputs: zod.z.array(zod.z.string()).readonly(),
|
|
14930
|
-
success: zod.z.boolean(),
|
|
14931
|
-
error: zod.z.string().optional(),
|
|
14932
|
-
deviceId: zod.z.number().optional()
|
|
14933
|
-
});
|
|
14934
|
-
var NotificationHistoryFilterSchema = zod.z.object({
|
|
14935
|
-
ruleId: zod.z.string().optional(),
|
|
14936
|
-
deviceId: zod.z.number().optional(),
|
|
14937
|
-
from: zod.z.number().optional(),
|
|
14938
|
-
to: zod.z.number().optional(),
|
|
14939
|
-
limit: zod.z.number().optional()
|
|
14940
|
-
});
|
|
14941
|
-
var advancedNotifierCapability = {
|
|
14942
|
-
name: "advanced-notifier",
|
|
14943
|
-
scope: "system",
|
|
14944
|
-
mode: "singleton",
|
|
14945
|
-
internal: true,
|
|
14946
|
-
methods: {
|
|
14947
|
-
getRules: require_sleep.method(zod.z.void(), zod.z.object({ rules: zod.z.array(NotificationRuleSchema).readonly() })),
|
|
14948
|
-
upsertRule: require_sleep.method(zod.z.object({ rule: NotificationRuleSchema }), zod.z.object({ success: zod.z.literal(true) }), { kind: "mutation" }),
|
|
14949
|
-
deleteRule: require_sleep.method(zod.z.object({ ruleId: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), { kind: "mutation" }),
|
|
14950
|
-
testRule: require_sleep.method(zod.z.object({
|
|
14951
|
-
ruleId: zod.z.string(),
|
|
14952
|
-
lookbackMinutes: zod.z.number()
|
|
14953
|
-
}), zod.z.object({ results: zod.z.array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }),
|
|
14954
|
-
getHistory: require_sleep.method(zod.z.object({ filter: NotificationHistoryFilterSchema.optional() }), zod.z.object({ entries: zod.z.array(NotificationHistoryEntrySchema).readonly() }))
|
|
14955
|
-
}
|
|
14956
|
-
};
|
|
14957
|
-
//#endregion
|
|
14958
14914
|
//#region src/capabilities/alerts.cap.ts
|
|
14959
14915
|
/**
|
|
14960
14916
|
* Alerts capability — collection-based internal alert system.
|
|
@@ -15297,119 +15253,6 @@ var authProviderCapability = {
|
|
|
15297
15253
|
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
15298
15254
|
mount: { kind: "skip" }
|
|
15299
15255
|
};
|
|
15300
|
-
//#endregion
|
|
15301
|
-
//#region src/capabilities/login-method.cap.ts
|
|
15302
|
-
/**
|
|
15303
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
15304
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15305
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15306
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15307
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15308
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
15309
|
-
*
|
|
15310
|
-
* A contribution is a discriminated union on `kind`:
|
|
15311
|
-
*
|
|
15312
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
15313
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15314
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15315
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15316
|
-
* login page needs NO change.
|
|
15317
|
-
*
|
|
15318
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15319
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15320
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15321
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15322
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15323
|
-
*
|
|
15324
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15325
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15326
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15327
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15328
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15329
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15330
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15331
|
-
* decision.
|
|
15332
|
-
*
|
|
15333
|
-
* Every contribution carries a `stage`:
|
|
15334
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15335
|
-
* magic-link buttons; a future usernameless passkey).
|
|
15336
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15337
|
-
* returned `factors` (passkey-as-2FA today).
|
|
15338
|
-
*
|
|
15339
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15340
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15341
|
-
* tRPC router.
|
|
15342
|
-
*/
|
|
15343
|
-
/** When a login method renders in the two-phase login flow. */
|
|
15344
|
-
var LoginStageEnum = zod.z.enum(["primary", "second-factor"]);
|
|
15345
|
-
/**
|
|
15346
|
-
* A declarative redirect button — the login page navigates to `startUrl`.
|
|
15347
|
-
* OIDC and magic-link contribute this; a future SSO addon does too.
|
|
15348
|
-
*/
|
|
15349
|
-
var RedirectLoginMethodSchema = zod.z.object({
|
|
15350
|
-
kind: zod.z.literal("redirect"),
|
|
15351
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15352
|
-
id: zod.z.string(),
|
|
15353
|
-
/** Operator-facing button label. */
|
|
15354
|
-
label: zod.z.string(),
|
|
15355
|
-
/** lucide-react icon name. */
|
|
15356
|
-
icon: zod.z.string().optional(),
|
|
15357
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15358
|
-
startUrl: zod.z.string(),
|
|
15359
|
-
stage: LoginStageEnum
|
|
15360
|
-
});
|
|
15361
|
-
/**
|
|
15362
|
-
* A Module-Federation widget the login page mounts for an in-page
|
|
15363
|
-
* ceremony. `bundle` + `addonId` let `auth.listLoginMethods` stamp a
|
|
15364
|
-
* public `bundleUrl`; `remote` is the MF descriptor `loadRemoteBundle`
|
|
15365
|
-
* consumes. No `bundleUrl` here — it is server-stamped on the public
|
|
15366
|
-
* output so the addon never encodes the static-route scheme.
|
|
15367
|
-
*/
|
|
15368
|
-
var WidgetLoginMethodSchema = zod.z.object({
|
|
15369
|
-
kind: zod.z.literal("widget"),
|
|
15370
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15371
|
-
id: zod.z.string(),
|
|
15372
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15373
|
-
addonId: zod.z.string(),
|
|
15374
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15375
|
-
bundle: zod.z.string(),
|
|
15376
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15377
|
-
remote: WidgetRemoteSchema,
|
|
15378
|
-
stage: LoginStageEnum
|
|
15379
|
-
});
|
|
15380
|
-
/**
|
|
15381
|
-
* A declarative WebAuthn ceremony the shell renders natively (no remote
|
|
15382
|
-
* code). Carries the addon's EFFECTIVE `rpId`/`origin` so the shell can
|
|
15383
|
-
* gate visibility (IP-literal origin, hostname/rpId mismatch) before ever
|
|
15384
|
-
* showing the button — the contribution itself stays unconditional.
|
|
15385
|
-
*/
|
|
15386
|
-
var PasskeyLoginMethodSchema = zod.z.object({
|
|
15387
|
-
kind: zod.z.literal("passkey"),
|
|
15388
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15389
|
-
id: zod.z.string(),
|
|
15390
|
-
/** Operator-facing button label. */
|
|
15391
|
-
label: zod.z.string(),
|
|
15392
|
-
stage: LoginStageEnum,
|
|
15393
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15394
|
-
rpId: zod.z.string(),
|
|
15395
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15396
|
-
origin: zod.z.string().nullable()
|
|
15397
|
-
});
|
|
15398
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15399
|
-
var LoginMethodContributionSchema = zod.z.discriminatedUnion("kind", [
|
|
15400
|
-
RedirectLoginMethodSchema,
|
|
15401
|
-
WidgetLoginMethodSchema,
|
|
15402
|
-
PasskeyLoginMethodSchema
|
|
15403
|
-
]);
|
|
15404
|
-
var loginMethodCapability = {
|
|
15405
|
-
name: "login-method",
|
|
15406
|
-
scope: "system",
|
|
15407
|
-
mode: "collection",
|
|
15408
|
-
internal: true,
|
|
15409
|
-
methods: { getLoginMethods: require_sleep.method(zod.z.void(), zod.z.array(LoginMethodContributionSchema).readonly()) },
|
|
15410
|
-
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
15411
|
-
mount: { kind: "skip" }
|
|
15412
|
-
};
|
|
15413
15256
|
/**
|
|
15414
15257
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
15415
15258
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -16065,7 +15908,8 @@ function customAction(input, output, options) {
|
|
|
16065
15908
|
output,
|
|
16066
15909
|
kind: options?.kind ?? "query",
|
|
16067
15910
|
auth: options?.auth ?? "protected",
|
|
16068
|
-
scope: options?.scope ?? { kind: "system" }
|
|
15911
|
+
scope: options?.scope ?? { kind: "system" },
|
|
15912
|
+
...options?.caller ? { caller: "required" } : {}
|
|
16069
15913
|
};
|
|
16070
15914
|
}
|
|
16071
15915
|
function deviceCustomAction(input, output, options) {
|
|
@@ -17670,227 +17514,686 @@ var filesystemBrowseCapability = {
|
|
|
17670
17514
|
}
|
|
17671
17515
|
};
|
|
17672
17516
|
//#endregion
|
|
17673
|
-
//#region src/capabilities/
|
|
17674
|
-
|
|
17675
|
-
|
|
17676
|
-
|
|
17677
|
-
|
|
17678
|
-
|
|
17679
|
-
|
|
17680
|
-
|
|
17681
|
-
|
|
17682
|
-
|
|
17683
|
-
|
|
17684
|
-
|
|
17685
|
-
|
|
17686
|
-
tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
17687
|
-
});
|
|
17688
|
-
var logDestinationCapability = {
|
|
17689
|
-
name: "log-destination",
|
|
17690
|
-
scope: "system",
|
|
17691
|
-
mode: "collection",
|
|
17692
|
-
internal: true,
|
|
17693
|
-
methods: {
|
|
17694
|
-
write: require_sleep.method(LogEntrySchema, zod.z.void(), { kind: "mutation" }),
|
|
17695
|
-
query: require_sleep.method(zod.z.object({
|
|
17696
|
-
scope: zod.z.array(zod.z.string()).optional(),
|
|
17697
|
-
level: LogLevelSchema.optional(),
|
|
17698
|
-
since: zod.z.date().optional(),
|
|
17699
|
-
until: zod.z.date().optional(),
|
|
17700
|
-
limit: zod.z.number().optional(),
|
|
17701
|
-
tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
17702
|
-
}), zod.z.array(LogEntrySchema).readonly())
|
|
17703
|
-
},
|
|
17704
|
-
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
17705
|
-
mount: { kind: "skip" }
|
|
17706
|
-
};
|
|
17707
|
-
//#endregion
|
|
17708
|
-
//#region src/capabilities/metrics-provider.cap.ts
|
|
17709
|
-
var CpuBreakdownSchema = zod.z.object({
|
|
17710
|
-
total: zod.z.number(),
|
|
17711
|
-
user: zod.z.number(),
|
|
17712
|
-
system: zod.z.number(),
|
|
17713
|
-
irq: zod.z.number(),
|
|
17714
|
-
nice: zod.z.number(),
|
|
17715
|
-
loadAvg: zod.z.tuple([
|
|
17716
|
-
zod.z.number(),
|
|
17717
|
-
zod.z.number(),
|
|
17718
|
-
zod.z.number()
|
|
17719
|
-
]),
|
|
17720
|
-
cores: zod.z.number()
|
|
17721
|
-
});
|
|
17722
|
-
var MemoryInfoSchema = zod.z.object({
|
|
17723
|
-
percent: zod.z.number(),
|
|
17724
|
-
totalBytes: zod.z.number(),
|
|
17725
|
-
usedBytes: zod.z.number(),
|
|
17726
|
-
availableBytes: zod.z.number(),
|
|
17727
|
-
swapUsedBytes: zod.z.number(),
|
|
17728
|
-
swapTotalBytes: zod.z.number()
|
|
17729
|
-
});
|
|
17730
|
-
var DiskIoSnapshotSchema = zod.z.object({
|
|
17731
|
-
readBytes: zod.z.number(),
|
|
17732
|
-
writeBytes: zod.z.number(),
|
|
17733
|
-
readOps: zod.z.number(),
|
|
17734
|
-
writeOps: zod.z.number(),
|
|
17735
|
-
timestampMs: zod.z.number()
|
|
17736
|
-
});
|
|
17737
|
-
var NetworkIoSnapshotSchema = zod.z.object({
|
|
17738
|
-
rxBytes: zod.z.number(),
|
|
17739
|
-
txBytes: zod.z.number(),
|
|
17740
|
-
rxPackets: zod.z.number(),
|
|
17741
|
-
txPackets: zod.z.number(),
|
|
17742
|
-
rxErrors: zod.z.number(),
|
|
17743
|
-
txErrors: zod.z.number(),
|
|
17744
|
-
timestampMs: zod.z.number()
|
|
17517
|
+
//#region src/capabilities/llm-shared.ts
|
|
17518
|
+
/**
|
|
17519
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
17520
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
17521
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
17522
|
+
*
|
|
17523
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
17524
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
17525
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
17526
|
+
*/
|
|
17527
|
+
var LlmUsageSchema = zod.z.object({
|
|
17528
|
+
inputTokens: zod.z.number(),
|
|
17529
|
+
outputTokens: zod.z.number()
|
|
17745
17530
|
});
|
|
17746
|
-
var
|
|
17747
|
-
|
|
17531
|
+
var LlmErrorCodeSchema = zod.z.enum([
|
|
17532
|
+
"timeout",
|
|
17533
|
+
"rate-limited",
|
|
17534
|
+
"auth",
|
|
17535
|
+
"refusal",
|
|
17536
|
+
"bad-request",
|
|
17537
|
+
"unavailable",
|
|
17538
|
+
"no-profile",
|
|
17539
|
+
"budget-exceeded",
|
|
17540
|
+
"adapter-error"
|
|
17541
|
+
]);
|
|
17542
|
+
var LlmGenerateOkSchema = zod.z.object({
|
|
17543
|
+
ok: zod.z.literal(true),
|
|
17544
|
+
text: zod.z.string(),
|
|
17748
17545
|
model: zod.z.string(),
|
|
17749
|
-
|
|
17750
|
-
|
|
17751
|
-
|
|
17546
|
+
usage: LlmUsageSchema,
|
|
17547
|
+
truncated: zod.z.boolean(),
|
|
17548
|
+
latencyMs: zod.z.number()
|
|
17752
17549
|
});
|
|
17753
|
-
var
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17550
|
+
var LlmGenerateErrSchema = zod.z.object({
|
|
17551
|
+
ok: zod.z.literal(false),
|
|
17552
|
+
code: LlmErrorCodeSchema,
|
|
17553
|
+
message: zod.z.string(),
|
|
17554
|
+
retryAfterMs: zod.z.number().optional()
|
|
17758
17555
|
});
|
|
17759
|
-
var
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17556
|
+
var LlmGenerateResultSchema = zod.z.discriminatedUnion("ok", [LlmGenerateOkSchema, LlmGenerateErrSchema]);
|
|
17557
|
+
/**
|
|
17558
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
17559
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
17560
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
17561
|
+
*/
|
|
17562
|
+
var LlmImageSchema = zod.z.object({
|
|
17563
|
+
bytes: zod.z.instanceof(Uint8Array),
|
|
17564
|
+
mimeType: zod.z.string()
|
|
17763
17565
|
});
|
|
17764
|
-
var
|
|
17765
|
-
|
|
17766
|
-
|
|
17566
|
+
var LlmGenerateBaseInputSchema = zod.z.object({
|
|
17567
|
+
/** Collection routing (the notification-output posture). */
|
|
17568
|
+
addonId: zod.z.string().optional(),
|
|
17569
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
17570
|
+
profileId: zod.z.string().optional(),
|
|
17571
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
17572
|
+
consumer: zod.z.string(),
|
|
17573
|
+
system: zod.z.string().optional(),
|
|
17574
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
17575
|
+
prompt: zod.z.string(),
|
|
17576
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
17577
|
+
jsonSchema: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
17578
|
+
/** Per-call override of the profile default. */
|
|
17579
|
+
maxTokens: zod.z.number().int().positive().optional(),
|
|
17580
|
+
temperature: zod.z.number().optional()
|
|
17767
17581
|
});
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17771
|
-
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17582
|
+
//#endregion
|
|
17583
|
+
//#region src/capabilities/llm-runtime.cap.ts
|
|
17584
|
+
/**
|
|
17585
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
17586
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
17587
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
17588
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
17589
|
+
* this only through the `llm` cap's methods.
|
|
17590
|
+
*
|
|
17591
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
17592
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
17593
|
+
* watchdog — operator decision #3).
|
|
17594
|
+
*/
|
|
17595
|
+
var ManagedModelRefSchema = zod.z.discriminatedUnion("kind", [
|
|
17596
|
+
zod.z.object({
|
|
17597
|
+
kind: zod.z.literal("catalog"),
|
|
17598
|
+
catalogId: zod.z.string()
|
|
17778
17599
|
}),
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
*/
|
|
17801
|
-
|
|
17802
|
-
/**
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
sharedBytes: zod.z.number().optional()
|
|
17600
|
+
zod.z.object({
|
|
17601
|
+
kind: zod.z.literal("url"),
|
|
17602
|
+
url: zod.z.string(),
|
|
17603
|
+
sha256: zod.z.string().optional()
|
|
17604
|
+
}),
|
|
17605
|
+
zod.z.object({
|
|
17606
|
+
kind: zod.z.literal("path"),
|
|
17607
|
+
path: zod.z.string()
|
|
17608
|
+
})
|
|
17609
|
+
]);
|
|
17610
|
+
var ManagedRuntimeConfigSchema = zod.z.object({
|
|
17611
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
17612
|
+
nodeId: zod.z.string(),
|
|
17613
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
17614
|
+
engine: zod.z.enum(["llama-cpp"]),
|
|
17615
|
+
model: ManagedModelRefSchema,
|
|
17616
|
+
contextSize: zod.z.number().int().default(4096),
|
|
17617
|
+
/** 0 = CPU-only. */
|
|
17618
|
+
gpuLayers: zod.z.number().int().default(0),
|
|
17619
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
17620
|
+
threads: zod.z.number().int().optional(),
|
|
17621
|
+
/** Concurrent slots. */
|
|
17622
|
+
parallel: zod.z.number().int().default(1),
|
|
17623
|
+
/** Else lazy: first generate boots it. */
|
|
17624
|
+
autoStart: zod.z.boolean().default(false),
|
|
17625
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
17626
|
+
idleStopMinutes: zod.z.number().int().default(30)
|
|
17807
17627
|
});
|
|
17808
|
-
var
|
|
17809
|
-
|
|
17628
|
+
var LlmRuntimeStatusSchema = zod.z.object({
|
|
17629
|
+
/** Status is ALWAYS node-qualified. */
|
|
17810
17630
|
nodeId: zod.z.string(),
|
|
17811
|
-
role: zod.z.enum(["hub", "worker"]),
|
|
17812
|
-
pid: zod.z.number(),
|
|
17813
17631
|
state: zod.z.enum([
|
|
17814
|
-
"starting",
|
|
17815
|
-
"running",
|
|
17816
|
-
"stopping",
|
|
17817
17632
|
"stopped",
|
|
17818
|
-
"
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
pid: zod.z.number(),
|
|
17824
|
-
ppid: zod.z.number(),
|
|
17825
|
-
pgid: zod.z.number(),
|
|
17826
|
-
classification: zod.z.enum([
|
|
17827
|
-
"root",
|
|
17828
|
-
"managed",
|
|
17829
|
-
"system",
|
|
17830
|
-
"ghost"
|
|
17633
|
+
"downloading",
|
|
17634
|
+
"starting",
|
|
17635
|
+
"ready",
|
|
17636
|
+
"crashed",
|
|
17637
|
+
"failed"
|
|
17831
17638
|
]),
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
17843
|
-
orphaned: zod.z.boolean()
|
|
17844
|
-
});
|
|
17845
|
-
var KillProcessInputSchema = zod.z.object({
|
|
17846
|
-
pid: zod.z.number(),
|
|
17847
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
17848
|
-
force: zod.z.boolean().optional()
|
|
17639
|
+
pid: zod.z.number().optional(),
|
|
17640
|
+
port: zod.z.number().optional(),
|
|
17641
|
+
modelPath: zod.z.string().optional(),
|
|
17642
|
+
modelId: zod.z.string().optional(),
|
|
17643
|
+
downloadProgress: zod.z.number().min(0).max(1).optional(),
|
|
17644
|
+
lastError: zod.z.string().optional(),
|
|
17645
|
+
crashesInWindow: zod.z.number(),
|
|
17646
|
+
/** Child RSS (sampled best-effort). */
|
|
17647
|
+
memoryBytes: zod.z.number().optional(),
|
|
17648
|
+
vramBytes: zod.z.number().optional()
|
|
17849
17649
|
});
|
|
17850
|
-
var
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17650
|
+
var LlmNodeModelSchema = zod.z.object({
|
|
17651
|
+
file: zod.z.string(),
|
|
17652
|
+
sizeBytes: zod.z.number(),
|
|
17653
|
+
catalogId: zod.z.string().optional(),
|
|
17654
|
+
installedAt: zod.z.number().optional()
|
|
17854
17655
|
});
|
|
17855
|
-
var
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
17859
|
-
success: zod.z.boolean(),
|
|
17860
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
17861
|
-
path: zod.z.string().optional(),
|
|
17862
|
-
/** Process pid that was signalled. */
|
|
17863
|
-
pid: zod.z.number().optional(),
|
|
17864
|
-
reason: zod.z.string().optional()
|
|
17656
|
+
var LlmRuntimeDiskUsageSchema = zod.z.object({
|
|
17657
|
+
nodeId: zod.z.string(),
|
|
17658
|
+
modelsBytes: zod.z.number(),
|
|
17659
|
+
freeBytes: zod.z.number().optional()
|
|
17865
17660
|
});
|
|
17866
|
-
var
|
|
17867
|
-
|
|
17868
|
-
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
diskPercent: zod.z.number().optional(),
|
|
17872
|
-
temperature: zod.z.number().optional(),
|
|
17873
|
-
gpuPercent: zod.z.number().optional(),
|
|
17874
|
-
gpuMemoryPercent: zod.z.number().optional()
|
|
17661
|
+
var LlmRuntimeCompleteInputSchema = LlmGenerateBaseInputSchema.extend({
|
|
17662
|
+
images: zod.z.array(LlmImageSchema).optional(),
|
|
17663
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
17664
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
17665
|
+
timeoutMs: zod.z.number().int().positive().optional()
|
|
17875
17666
|
});
|
|
17876
|
-
var
|
|
17877
|
-
name: "
|
|
17667
|
+
var llmRuntimeCapability = {
|
|
17668
|
+
name: "llm-runtime",
|
|
17878
17669
|
scope: "system",
|
|
17879
17670
|
mode: "singleton",
|
|
17671
|
+
internal: true,
|
|
17880
17672
|
methods: {
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17673
|
+
complete: require_sleep.method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
|
|
17674
|
+
ensureStarted: require_sleep.method(zod.z.object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
17675
|
+
kind: "mutation",
|
|
17676
|
+
auth: "admin"
|
|
17677
|
+
}),
|
|
17678
|
+
stop: require_sleep.method(zod.z.object({}), zod.z.void(), {
|
|
17679
|
+
kind: "mutation",
|
|
17680
|
+
auth: "admin"
|
|
17681
|
+
}),
|
|
17682
|
+
status: require_sleep.method(zod.z.object({}), LlmRuntimeStatusSchema),
|
|
17683
|
+
installModel: require_sleep.method(zod.z.object({ model: ManagedModelRefSchema }), zod.z.void(), {
|
|
17684
|
+
kind: "mutation",
|
|
17685
|
+
auth: "admin"
|
|
17686
|
+
}),
|
|
17687
|
+
deleteModel: require_sleep.method(zod.z.object({ file: zod.z.string() }), zod.z.void(), {
|
|
17688
|
+
kind: "mutation",
|
|
17689
|
+
auth: "admin"
|
|
17690
|
+
}),
|
|
17691
|
+
listLocalModels: require_sleep.method(zod.z.object({}), zod.z.array(LlmNodeModelSchema)),
|
|
17692
|
+
getDiskUsage: require_sleep.method(zod.z.object({}), LlmRuntimeDiskUsageSchema)
|
|
17693
|
+
}
|
|
17694
|
+
};
|
|
17695
|
+
//#endregion
|
|
17696
|
+
//#region src/capabilities/llm.cap.ts
|
|
17697
|
+
/**
|
|
17698
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
17699
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
17700
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
17701
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
17702
|
+
* (hub-placed); the cap stays open for future providers.
|
|
17703
|
+
*
|
|
17704
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
17705
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
17706
|
+
* write; a stored key NEVER round-trips to a client.
|
|
17707
|
+
*/
|
|
17708
|
+
var LlmProfileKindSchema = zod.z.enum([
|
|
17709
|
+
"openai-compatible",
|
|
17710
|
+
"openai",
|
|
17711
|
+
"anthropic",
|
|
17712
|
+
"google",
|
|
17713
|
+
"managed-local"
|
|
17714
|
+
]);
|
|
17715
|
+
var LlmProfileSchema = zod.z.object({
|
|
17716
|
+
id: zod.z.string(),
|
|
17717
|
+
name: zod.z.string(),
|
|
17718
|
+
kind: LlmProfileKindSchema,
|
|
17719
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
17720
|
+
addonId: zod.z.string(),
|
|
17721
|
+
enabled: zod.z.boolean(),
|
|
17722
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
17723
|
+
model: zod.z.string(),
|
|
17724
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
17725
|
+
baseUrl: zod.z.string().optional(),
|
|
17726
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
17727
|
+
apiKey: zod.z.string().optional(),
|
|
17728
|
+
supportsVision: zod.z.boolean(),
|
|
17729
|
+
temperature: zod.z.number().min(0).max(2).optional(),
|
|
17730
|
+
maxTokens: zod.z.number().int().positive().optional(),
|
|
17731
|
+
timeoutMs: zod.z.number().int().positive().default(6e4),
|
|
17732
|
+
extraHeaders: zod.z.record(zod.z.string(), zod.z.string()).optional(),
|
|
17733
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
17734
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
17735
|
+
});
|
|
17736
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
17737
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
17738
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
17739
|
+
var ConfigSchemaPassthrough$1 = zod.z.unknown();
|
|
17740
|
+
var LlmProfileKindDescriptorSchema = zod.z.object({
|
|
17741
|
+
kind: LlmProfileKindSchema,
|
|
17742
|
+
label: zod.z.string(),
|
|
17743
|
+
icon: zod.z.string(),
|
|
17744
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
17745
|
+
addonId: zod.z.string(),
|
|
17746
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
17747
|
+
});
|
|
17748
|
+
var LlmDefaultSelectorSchema = zod.z.union([zod.z.object({ consumer: zod.z.string() }), zod.z.object({ purpose: zod.z.enum(["text", "vision"]) })]);
|
|
17749
|
+
var LlmDefaultSchema = zod.z.object({
|
|
17750
|
+
selector: LlmDefaultSelectorSchema,
|
|
17751
|
+
profileId: zod.z.string()
|
|
17752
|
+
});
|
|
17753
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
17754
|
+
var LlmUsageRollupSchema = zod.z.object({
|
|
17755
|
+
day: zod.z.string(),
|
|
17756
|
+
consumer: zod.z.string(),
|
|
17757
|
+
profileId: zod.z.string(),
|
|
17758
|
+
calls: zod.z.number(),
|
|
17759
|
+
okCalls: zod.z.number(),
|
|
17760
|
+
errorCalls: zod.z.number(),
|
|
17761
|
+
inputTokens: zod.z.number(),
|
|
17762
|
+
outputTokens: zod.z.number(),
|
|
17763
|
+
avgLatencyMs: zod.z.number()
|
|
17764
|
+
});
|
|
17765
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
17766
|
+
var ManagedModelCatalogEntrySchema = zod.z.object({
|
|
17767
|
+
id: zod.z.string(),
|
|
17768
|
+
label: zod.z.string(),
|
|
17769
|
+
family: zod.z.string(),
|
|
17770
|
+
purpose: zod.z.enum(["text", "vision"]),
|
|
17771
|
+
url: zod.z.string(),
|
|
17772
|
+
sha256: zod.z.string(),
|
|
17773
|
+
sizeBytes: zod.z.number(),
|
|
17774
|
+
quantization: zod.z.string(),
|
|
17775
|
+
/** Load-time guidance shown in the picker. */
|
|
17776
|
+
minRamBytes: zod.z.number(),
|
|
17777
|
+
contextSizeDefault: zod.z.number().int(),
|
|
17778
|
+
/** Vision models: companion projector file. */
|
|
17779
|
+
mmprojUrl: zod.z.string().optional()
|
|
17780
|
+
});
|
|
17781
|
+
var LlmRuntimeNodeSchema = zod.z.object({
|
|
17782
|
+
nodeId: zod.z.string(),
|
|
17783
|
+
reachable: zod.z.boolean(),
|
|
17784
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
17785
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
17786
|
+
error: zod.z.string().optional()
|
|
17787
|
+
});
|
|
17788
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: zod.z.array(LlmImageSchema).min(1) });
|
|
17789
|
+
var ProfileRefInputSchema = zod.z.object({
|
|
17790
|
+
addonId: zod.z.string(),
|
|
17791
|
+
profileId: zod.z.string()
|
|
17792
|
+
});
|
|
17793
|
+
var llmCapability = {
|
|
17794
|
+
name: "llm",
|
|
17795
|
+
scope: "system",
|
|
17796
|
+
mode: "collection",
|
|
17797
|
+
internal: false,
|
|
17798
|
+
providerKind: "ai",
|
|
17799
|
+
/** `nodeId` inputs below are DATA (the hub provider pins itself), never routing. */
|
|
17800
|
+
nodeIdMode: "data",
|
|
17801
|
+
methods: {
|
|
17802
|
+
generate: require_sleep.method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
|
|
17803
|
+
generateVision: require_sleep.method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
|
|
17804
|
+
listProfileKinds: require_sleep.method(zod.z.object({}), zod.z.array(LlmProfileKindDescriptorSchema)),
|
|
17805
|
+
listProfiles: require_sleep.method(zod.z.object({}), zod.z.array(LlmProfileSchema)),
|
|
17806
|
+
upsertProfile: require_sleep.method(zod.z.object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
17807
|
+
kind: "mutation",
|
|
17808
|
+
auth: "admin"
|
|
17809
|
+
}),
|
|
17810
|
+
deleteProfile: require_sleep.method(ProfileRefInputSchema, zod.z.void(), {
|
|
17811
|
+
kind: "mutation",
|
|
17812
|
+
auth: "admin"
|
|
17813
|
+
}),
|
|
17814
|
+
testProfile: require_sleep.method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
17815
|
+
kind: "mutation",
|
|
17816
|
+
auth: "admin"
|
|
17817
|
+
}),
|
|
17818
|
+
/** Live vendor enumeration (GET /models etc.). */
|
|
17819
|
+
listModels: require_sleep.method(ProfileRefInputSchema, zod.z.array(zod.z.string())),
|
|
17820
|
+
getDefaults: require_sleep.method(zod.z.object({}), zod.z.array(LlmDefaultSchema)),
|
|
17821
|
+
setDefault: require_sleep.method(zod.z.object({
|
|
17822
|
+
selector: LlmDefaultSelectorSchema,
|
|
17823
|
+
profileId: zod.z.string().nullable()
|
|
17824
|
+
}), zod.z.void(), {
|
|
17825
|
+
kind: "mutation",
|
|
17826
|
+
auth: "admin"
|
|
17827
|
+
}),
|
|
17828
|
+
getUsage: require_sleep.method(zod.z.object({
|
|
17829
|
+
since: zod.z.number().optional(),
|
|
17830
|
+
until: zod.z.number().optional(),
|
|
17831
|
+
consumer: zod.z.string().optional(),
|
|
17832
|
+
profileId: zod.z.string().optional()
|
|
17833
|
+
}), zod.z.array(LlmUsageRollupSchema)),
|
|
17834
|
+
listModelCatalog: require_sleep.method(zod.z.object({}), zod.z.array(ManagedModelCatalogEntrySchema)),
|
|
17835
|
+
listRuntimeNodes: require_sleep.method(zod.z.object({}), zod.z.array(LlmRuntimeNodeSchema)),
|
|
17836
|
+
listNodeModels: require_sleep.method(zod.z.object({ nodeId: zod.z.string() }), zod.z.array(LlmNodeModelSchema)),
|
|
17837
|
+
installModel: require_sleep.method(zod.z.object({
|
|
17838
|
+
nodeId: zod.z.string(),
|
|
17839
|
+
model: ManagedModelRefSchema
|
|
17840
|
+
}), zod.z.void(), {
|
|
17841
|
+
kind: "mutation",
|
|
17842
|
+
auth: "admin"
|
|
17843
|
+
}),
|
|
17844
|
+
deleteModel: require_sleep.method(zod.z.object({
|
|
17845
|
+
nodeId: zod.z.string(),
|
|
17846
|
+
file: zod.z.string()
|
|
17847
|
+
}), zod.z.void(), {
|
|
17848
|
+
kind: "mutation",
|
|
17849
|
+
auth: "admin"
|
|
17850
|
+
}),
|
|
17851
|
+
getRuntimeStatus: require_sleep.method(ProfileRefInputSchema, LlmRuntimeStatusSchema),
|
|
17852
|
+
startRuntime: require_sleep.method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
17853
|
+
kind: "mutation",
|
|
17854
|
+
auth: "admin"
|
|
17855
|
+
}),
|
|
17856
|
+
stopRuntime: require_sleep.method(ProfileRefInputSchema, zod.z.void(), {
|
|
17857
|
+
kind: "mutation",
|
|
17858
|
+
auth: "admin"
|
|
17859
|
+
})
|
|
17860
|
+
}
|
|
17861
|
+
};
|
|
17862
|
+
//#endregion
|
|
17863
|
+
//#region src/capabilities/log-destination.cap.ts
|
|
17864
|
+
var LogLevelSchema = zod.z.enum([
|
|
17865
|
+
"debug",
|
|
17866
|
+
"info",
|
|
17867
|
+
"warn",
|
|
17868
|
+
"error"
|
|
17869
|
+
]);
|
|
17870
|
+
var LogEntrySchema = zod.z.object({
|
|
17871
|
+
timestamp: zod.z.date(),
|
|
17872
|
+
level: LogLevelSchema,
|
|
17873
|
+
scope: zod.z.array(zod.z.string()),
|
|
17874
|
+
message: zod.z.string(),
|
|
17875
|
+
meta: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
17876
|
+
tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
17877
|
+
});
|
|
17878
|
+
var logDestinationCapability = {
|
|
17879
|
+
name: "log-destination",
|
|
17880
|
+
scope: "system",
|
|
17881
|
+
mode: "collection",
|
|
17882
|
+
internal: true,
|
|
17883
|
+
methods: {
|
|
17884
|
+
write: require_sleep.method(LogEntrySchema, zod.z.void(), { kind: "mutation" }),
|
|
17885
|
+
query: require_sleep.method(zod.z.object({
|
|
17886
|
+
scope: zod.z.array(zod.z.string()).optional(),
|
|
17887
|
+
level: LogLevelSchema.optional(),
|
|
17888
|
+
since: zod.z.date().optional(),
|
|
17889
|
+
until: zod.z.date().optional(),
|
|
17890
|
+
limit: zod.z.number().optional(),
|
|
17891
|
+
tags: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
17892
|
+
}), zod.z.array(LogEntrySchema).readonly())
|
|
17893
|
+
},
|
|
17894
|
+
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
17895
|
+
mount: { kind: "skip" }
|
|
17896
|
+
};
|
|
17897
|
+
//#endregion
|
|
17898
|
+
//#region src/capabilities/login-method.cap.ts
|
|
17899
|
+
/**
|
|
17900
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
17901
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
17902
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
17903
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
17904
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
17905
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
17906
|
+
*
|
|
17907
|
+
* A contribution is a discriminated union on `kind`:
|
|
17908
|
+
*
|
|
17909
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
17910
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
17911
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
17912
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
17913
|
+
* login page needs NO change.
|
|
17914
|
+
*
|
|
17915
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
17916
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
17917
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
17918
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
17919
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
17920
|
+
*
|
|
17921
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
17922
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
17923
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
17924
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
17925
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
17926
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
17927
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
17928
|
+
* decision.
|
|
17929
|
+
*
|
|
17930
|
+
* Every contribution carries a `stage`:
|
|
17931
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
17932
|
+
* magic-link buttons; a future usernameless passkey).
|
|
17933
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
17934
|
+
* returned `factors` (passkey-as-2FA today).
|
|
17935
|
+
*
|
|
17936
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
17937
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
17938
|
+
* tRPC router.
|
|
17939
|
+
*/
|
|
17940
|
+
/** When a login method renders in the two-phase login flow. */
|
|
17941
|
+
var LoginStageEnum = zod.z.enum(["primary", "second-factor"]);
|
|
17942
|
+
/**
|
|
17943
|
+
* A declarative redirect button — the login page navigates to `startUrl`.
|
|
17944
|
+
* OIDC and magic-link contribute this; a future SSO addon does too.
|
|
17945
|
+
*/
|
|
17946
|
+
var RedirectLoginMethodSchema = zod.z.object({
|
|
17947
|
+
kind: zod.z.literal("redirect"),
|
|
17948
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
17949
|
+
id: zod.z.string(),
|
|
17950
|
+
/** Operator-facing button label. */
|
|
17951
|
+
label: zod.z.string(),
|
|
17952
|
+
/** lucide-react icon name. */
|
|
17953
|
+
icon: zod.z.string().optional(),
|
|
17954
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
17955
|
+
startUrl: zod.z.string(),
|
|
17956
|
+
stage: LoginStageEnum
|
|
17957
|
+
});
|
|
17958
|
+
/**
|
|
17959
|
+
* A Module-Federation widget the login page mounts for an in-page
|
|
17960
|
+
* ceremony. `bundle` + `addonId` let `auth.listLoginMethods` stamp a
|
|
17961
|
+
* public `bundleUrl`; `remote` is the MF descriptor `loadRemoteBundle`
|
|
17962
|
+
* consumes. No `bundleUrl` here — it is server-stamped on the public
|
|
17963
|
+
* output so the addon never encodes the static-route scheme.
|
|
17964
|
+
*/
|
|
17965
|
+
var WidgetLoginMethodSchema = zod.z.object({
|
|
17966
|
+
kind: zod.z.literal("widget"),
|
|
17967
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
17968
|
+
id: zod.z.string(),
|
|
17969
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
17970
|
+
addonId: zod.z.string(),
|
|
17971
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
17972
|
+
bundle: zod.z.string(),
|
|
17973
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
17974
|
+
remote: WidgetRemoteSchema,
|
|
17975
|
+
stage: LoginStageEnum
|
|
17976
|
+
});
|
|
17977
|
+
/**
|
|
17978
|
+
* A declarative WebAuthn ceremony the shell renders natively (no remote
|
|
17979
|
+
* code). Carries the addon's EFFECTIVE `rpId`/`origin` so the shell can
|
|
17980
|
+
* gate visibility (IP-literal origin, hostname/rpId mismatch) before ever
|
|
17981
|
+
* showing the button — the contribution itself stays unconditional.
|
|
17982
|
+
*/
|
|
17983
|
+
var PasskeyLoginMethodSchema = zod.z.object({
|
|
17984
|
+
kind: zod.z.literal("passkey"),
|
|
17985
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
17986
|
+
id: zod.z.string(),
|
|
17987
|
+
/** Operator-facing button label. */
|
|
17988
|
+
label: zod.z.string(),
|
|
17989
|
+
stage: LoginStageEnum,
|
|
17990
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
17991
|
+
rpId: zod.z.string(),
|
|
17992
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
17993
|
+
origin: zod.z.string().nullable()
|
|
17994
|
+
});
|
|
17995
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
17996
|
+
var LoginMethodContributionSchema = zod.z.discriminatedUnion("kind", [
|
|
17997
|
+
RedirectLoginMethodSchema,
|
|
17998
|
+
WidgetLoginMethodSchema,
|
|
17999
|
+
PasskeyLoginMethodSchema
|
|
18000
|
+
]);
|
|
18001
|
+
var loginMethodCapability = {
|
|
18002
|
+
name: "login-method",
|
|
18003
|
+
scope: "system",
|
|
18004
|
+
mode: "collection",
|
|
18005
|
+
internal: true,
|
|
18006
|
+
methods: { getLoginMethods: require_sleep.method(zod.z.void(), zod.z.array(LoginMethodContributionSchema).readonly()) },
|
|
18007
|
+
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
18008
|
+
mount: { kind: "skip" }
|
|
18009
|
+
};
|
|
18010
|
+
//#endregion
|
|
18011
|
+
//#region src/capabilities/metrics-provider.cap.ts
|
|
18012
|
+
var CpuBreakdownSchema = zod.z.object({
|
|
18013
|
+
total: zod.z.number(),
|
|
18014
|
+
user: zod.z.number(),
|
|
18015
|
+
system: zod.z.number(),
|
|
18016
|
+
irq: zod.z.number(),
|
|
18017
|
+
nice: zod.z.number(),
|
|
18018
|
+
loadAvg: zod.z.tuple([
|
|
18019
|
+
zod.z.number(),
|
|
18020
|
+
zod.z.number(),
|
|
18021
|
+
zod.z.number()
|
|
18022
|
+
]),
|
|
18023
|
+
cores: zod.z.number()
|
|
18024
|
+
});
|
|
18025
|
+
var MemoryInfoSchema = zod.z.object({
|
|
18026
|
+
percent: zod.z.number(),
|
|
18027
|
+
totalBytes: zod.z.number(),
|
|
18028
|
+
usedBytes: zod.z.number(),
|
|
18029
|
+
availableBytes: zod.z.number(),
|
|
18030
|
+
swapUsedBytes: zod.z.number(),
|
|
18031
|
+
swapTotalBytes: zod.z.number()
|
|
18032
|
+
});
|
|
18033
|
+
var DiskIoSnapshotSchema = zod.z.object({
|
|
18034
|
+
readBytes: zod.z.number(),
|
|
18035
|
+
writeBytes: zod.z.number(),
|
|
18036
|
+
readOps: zod.z.number(),
|
|
18037
|
+
writeOps: zod.z.number(),
|
|
18038
|
+
timestampMs: zod.z.number()
|
|
18039
|
+
});
|
|
18040
|
+
var NetworkIoSnapshotSchema = zod.z.object({
|
|
18041
|
+
rxBytes: zod.z.number(),
|
|
18042
|
+
txBytes: zod.z.number(),
|
|
18043
|
+
rxPackets: zod.z.number(),
|
|
18044
|
+
txPackets: zod.z.number(),
|
|
18045
|
+
rxErrors: zod.z.number(),
|
|
18046
|
+
txErrors: zod.z.number(),
|
|
18047
|
+
timestampMs: zod.z.number()
|
|
18048
|
+
});
|
|
18049
|
+
var MetricsGpuInfoSchema = zod.z.object({
|
|
18050
|
+
utilization: zod.z.number(),
|
|
18051
|
+
model: zod.z.string(),
|
|
18052
|
+
memoryUsedBytes: zod.z.number(),
|
|
18053
|
+
memoryTotalBytes: zod.z.number(),
|
|
18054
|
+
temperature: zod.z.number().nullable()
|
|
18055
|
+
});
|
|
18056
|
+
var ProcessResourceInfoSchema = zod.z.object({
|
|
18057
|
+
openFds: zod.z.number(),
|
|
18058
|
+
threadCount: zod.z.number(),
|
|
18059
|
+
activeHandles: zod.z.number(),
|
|
18060
|
+
activeRequests: zod.z.number()
|
|
18061
|
+
});
|
|
18062
|
+
var PressureAvgsSchema = zod.z.object({
|
|
18063
|
+
avg10: zod.z.number(),
|
|
18064
|
+
avg60: zod.z.number(),
|
|
18065
|
+
avg300: zod.z.number()
|
|
18066
|
+
});
|
|
18067
|
+
var PressureInfoSchema = zod.z.object({
|
|
18068
|
+
some: PressureAvgsSchema,
|
|
18069
|
+
full: PressureAvgsSchema.nullable()
|
|
18070
|
+
});
|
|
18071
|
+
var SystemResourceSnapshotSchema = zod.z.object({
|
|
18072
|
+
cpu: CpuBreakdownSchema,
|
|
18073
|
+
memory: MemoryInfoSchema,
|
|
18074
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
18075
|
+
network: NetworkIoSnapshotSchema,
|
|
18076
|
+
disk: DiskIoSnapshotSchema,
|
|
18077
|
+
pressure: zod.z.object({
|
|
18078
|
+
cpu: PressureInfoSchema.nullable(),
|
|
18079
|
+
memory: PressureInfoSchema.nullable(),
|
|
18080
|
+
io: PressureInfoSchema.nullable()
|
|
18081
|
+
}),
|
|
18082
|
+
process: ProcessResourceInfoSchema,
|
|
18083
|
+
cpuTemperature: zod.z.number().nullable(),
|
|
18084
|
+
timestampMs: zod.z.number()
|
|
18085
|
+
});
|
|
18086
|
+
var DiskSpaceInfoSchema = zod.z.object({
|
|
18087
|
+
path: zod.z.string(),
|
|
18088
|
+
totalBytes: zod.z.number(),
|
|
18089
|
+
usedBytes: zod.z.number(),
|
|
18090
|
+
availableBytes: zod.z.number(),
|
|
18091
|
+
percent: zod.z.number()
|
|
18092
|
+
});
|
|
18093
|
+
var PidResourceStatsSchema = zod.z.object({
|
|
18094
|
+
pid: zod.z.number(),
|
|
18095
|
+
cpu: zod.z.number(),
|
|
18096
|
+
memory: zod.z.number(),
|
|
18097
|
+
/**
|
|
18098
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
18099
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
18100
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
18101
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
18102
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
18103
|
+
*/
|
|
18104
|
+
privateBytes: zod.z.number().optional(),
|
|
18105
|
+
/**
|
|
18106
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
18107
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
18108
|
+
*/
|
|
18109
|
+
sharedBytes: zod.z.number().optional()
|
|
18110
|
+
});
|
|
18111
|
+
var AddonInstanceSchema = zod.z.object({
|
|
18112
|
+
addonId: zod.z.string(),
|
|
18113
|
+
nodeId: zod.z.string(),
|
|
18114
|
+
role: zod.z.enum(["hub", "worker"]),
|
|
18115
|
+
pid: zod.z.number(),
|
|
18116
|
+
state: zod.z.enum([
|
|
18117
|
+
"starting",
|
|
18118
|
+
"running",
|
|
18119
|
+
"stopping",
|
|
18120
|
+
"stopped",
|
|
18121
|
+
"crashed"
|
|
18122
|
+
]),
|
|
18123
|
+
uptimeSec: zod.z.number()
|
|
18124
|
+
});
|
|
18125
|
+
var NodeProcessSchema = zod.z.object({
|
|
18126
|
+
pid: zod.z.number(),
|
|
18127
|
+
ppid: zod.z.number(),
|
|
18128
|
+
pgid: zod.z.number(),
|
|
18129
|
+
classification: zod.z.enum([
|
|
18130
|
+
"root",
|
|
18131
|
+
"managed",
|
|
18132
|
+
"system",
|
|
18133
|
+
"ghost"
|
|
18134
|
+
]),
|
|
18135
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
18136
|
+
addonId: zod.z.string().nullable(),
|
|
18137
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
18138
|
+
nodeId: zod.z.string().nullable(),
|
|
18139
|
+
/** Truncated command line. */
|
|
18140
|
+
command: zod.z.string(),
|
|
18141
|
+
cpuPercent: zod.z.number(),
|
|
18142
|
+
memoryRssBytes: zod.z.number(),
|
|
18143
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
18144
|
+
uptimeSec: zod.z.number(),
|
|
18145
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
18146
|
+
orphaned: zod.z.boolean()
|
|
18147
|
+
});
|
|
18148
|
+
var KillProcessInputSchema = zod.z.object({
|
|
18149
|
+
pid: zod.z.number(),
|
|
18150
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
18151
|
+
force: zod.z.boolean().optional()
|
|
18152
|
+
});
|
|
18153
|
+
var KillProcessResultSchema = zod.z.object({
|
|
18154
|
+
success: zod.z.boolean(),
|
|
18155
|
+
reason: zod.z.string().optional(),
|
|
18156
|
+
signal: zod.z.enum(["SIGTERM", "SIGKILL"]).optional()
|
|
18157
|
+
});
|
|
18158
|
+
var DumpHeapSnapshotInputSchema = zod.z.object({
|
|
18159
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
18160
|
+
addonId: zod.z.string() });
|
|
18161
|
+
var DumpHeapSnapshotResultSchema = zod.z.object({
|
|
18162
|
+
success: zod.z.boolean(),
|
|
18163
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
18164
|
+
path: zod.z.string().optional(),
|
|
18165
|
+
/** Process pid that was signalled. */
|
|
18166
|
+
pid: zod.z.number().optional(),
|
|
18167
|
+
reason: zod.z.string().optional()
|
|
18168
|
+
});
|
|
18169
|
+
var SystemMetricsSchema = zod.z.object({
|
|
18170
|
+
cpuPercent: zod.z.number(),
|
|
18171
|
+
memoryPercent: zod.z.number(),
|
|
18172
|
+
memoryUsedMB: zod.z.number(),
|
|
18173
|
+
memoryTotalMB: zod.z.number(),
|
|
18174
|
+
diskPercent: zod.z.number().optional(),
|
|
18175
|
+
temperature: zod.z.number().optional(),
|
|
18176
|
+
gpuPercent: zod.z.number().optional(),
|
|
18177
|
+
gpuMemoryPercent: zod.z.number().optional()
|
|
18178
|
+
});
|
|
18179
|
+
var metricsProviderCapability = {
|
|
18180
|
+
name: "metrics-provider",
|
|
18181
|
+
scope: "system",
|
|
18182
|
+
mode: "singleton",
|
|
18183
|
+
methods: {
|
|
18184
|
+
/** Fresh, full system snapshot (triggers OS-level collection). */
|
|
18185
|
+
collectSnapshot: require_sleep.method(zod.z.void(), SystemResourceSnapshotSchema),
|
|
18186
|
+
/** Most recent cached snapshot from the background sampler, or null pre-first-sample. */
|
|
18187
|
+
getCached: require_sleep.method(zod.z.void(), SystemResourceSnapshotSchema.nullable()),
|
|
18188
|
+
/** Light-weight cached summary for heartbeats and list views. */
|
|
18189
|
+
getCurrent: require_sleep.method(zod.z.void(), SystemMetricsSchema),
|
|
18190
|
+
/** Disk space for the given mount/path. */
|
|
18191
|
+
getDiskSpace: require_sleep.method(zod.z.object({ dirPath: zod.z.string() }), DiskSpaceInfoSchema),
|
|
18192
|
+
/** GPU info (null if unavailable). */
|
|
18193
|
+
getGpuInfo: require_sleep.method(zod.z.void(), MetricsGpuInfoSchema.nullable()),
|
|
18194
|
+
/** CPU temperature in °C (null if unavailable). */
|
|
18195
|
+
getCpuTemperature: require_sleep.method(zod.z.void(), zod.z.number().nullable()),
|
|
18196
|
+
/** Per-PID resource stats. Missing/dead PIDs are omitted from the result. */
|
|
17894
18197
|
getProcessStats: require_sleep.method(zod.z.object({ pids: zod.z.array(zod.z.number()) }), zod.z.array(PidResourceStatsSchema)),
|
|
17895
18198
|
/**
|
|
17896
18199
|
* List addon instances known to this node — one entry per forked worker
|
|
@@ -18308,14 +18611,14 @@ var TargetKindCapsSchema = zod.z.object({
|
|
|
18308
18611
|
* the union is large and not meant for runtime validation here; the exported
|
|
18309
18612
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
18310
18613
|
*/
|
|
18311
|
-
var ConfigSchemaPassthrough
|
|
18614
|
+
var ConfigSchemaPassthrough = zod.z.unknown();
|
|
18312
18615
|
var TargetKindSchema = zod.z.object({
|
|
18313
18616
|
kind: zod.z.string(),
|
|
18314
18617
|
label: zod.z.string(),
|
|
18315
18618
|
icon: zod.z.string(),
|
|
18316
18619
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18317
18620
|
addonId: zod.z.string(),
|
|
18318
|
-
configSchema: ConfigSchemaPassthrough
|
|
18621
|
+
configSchema: ConfigSchemaPassthrough,
|
|
18319
18622
|
supportsDiscovery: zod.z.boolean(),
|
|
18320
18623
|
caps: TargetKindCapsSchema
|
|
18321
18624
|
});
|
|
@@ -18413,8 +18716,27 @@ var notificationOutputCapability = {
|
|
|
18413
18716
|
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
18414
18717
|
* schema/interface drift is explicitly not repeated).
|
|
18415
18718
|
*/
|
|
18416
|
-
/**
|
|
18417
|
-
|
|
18719
|
+
/**
|
|
18720
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
18721
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
18722
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
18723
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
18724
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
18725
|
+
* change of a LINKED device, one row per linked camera)
|
|
18726
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
18727
|
+
* delivery / pick-up)
|
|
18728
|
+
*
|
|
18729
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
18730
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
18731
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
18732
|
+
* one trigger.
|
|
18733
|
+
*/
|
|
18734
|
+
var NcDeliverySchema = zod.z.enum([
|
|
18735
|
+
"immediate",
|
|
18736
|
+
"track-end",
|
|
18737
|
+
"device-event",
|
|
18738
|
+
"package-event"
|
|
18739
|
+
]);
|
|
18418
18740
|
/**
|
|
18419
18741
|
* `maxPerTrack` for `immediate` rules is FIXED at 1 (D-3): a single track
|
|
18420
18742
|
* fires an immediate rule at most once, enforced durably by the outbox
|
|
@@ -18442,6 +18764,33 @@ var NcPlateMatcherSchema = zod.z.object({
|
|
|
18442
18764
|
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
18443
18765
|
maxDistance: zod.z.number().int().min(0).max(3).default(1)
|
|
18444
18766
|
});
|
|
18767
|
+
/**
|
|
18768
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
18769
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
18770
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
18771
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
18772
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
18773
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
18774
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
18775
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
18776
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
18777
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
18778
|
+
* (declared SQLite collection, reseeded on boot).
|
|
18779
|
+
*/
|
|
18780
|
+
var NcOccupancyConditionSchema = zod.z.object({
|
|
18781
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
18782
|
+
zoneId: zod.z.string().optional(),
|
|
18783
|
+
/** Object class to count; absent = any class. */
|
|
18784
|
+
className: zod.z.string().optional(),
|
|
18785
|
+
op: zod.z.enum([
|
|
18786
|
+
"became-occupied",
|
|
18787
|
+
"became-free",
|
|
18788
|
+
">=",
|
|
18789
|
+
"<="
|
|
18790
|
+
]).default("became-occupied"),
|
|
18791
|
+
count: zod.z.number().int().min(0).default(1),
|
|
18792
|
+
sustainSeconds: zod.z.number().int().min(0).max(3600).default(15)
|
|
18793
|
+
});
|
|
18445
18794
|
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
18446
18795
|
var NcZoneConditionSchema = zod.z.object({
|
|
18447
18796
|
ids: zod.z.array(zod.z.string().min(1)).min(1),
|
|
@@ -18477,7 +18826,104 @@ var NcConditionsSchema = zod.z.object({
|
|
|
18477
18826
|
*/
|
|
18478
18827
|
identities: zod.z.array(zod.z.string().min(1)).optional(),
|
|
18479
18828
|
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
18480
|
-
plates: NcPlateMatcherSchema.optional()
|
|
18829
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
18830
|
+
/**
|
|
18831
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
18832
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
18833
|
+
* identity display name). A record with NO label passes (nothing to
|
|
18834
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
18835
|
+
*/
|
|
18836
|
+
identitiesExclude: zod.z.array(zod.z.string().min(1)).optional(),
|
|
18837
|
+
/**
|
|
18838
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
18839
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
18840
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
18841
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
18842
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
18843
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
18844
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
18845
|
+
*/
|
|
18846
|
+
minImportance: zod.z.number().min(0).max(1).optional(),
|
|
18847
|
+
/**
|
|
18848
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
18849
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
18850
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
18851
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
18852
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
18853
|
+
*/
|
|
18854
|
+
minDwellSeconds: zod.z.number().min(0).optional(),
|
|
18855
|
+
/**
|
|
18856
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
18857
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
18858
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
18859
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
18860
|
+
* tracks carry `sensor`.
|
|
18861
|
+
*/
|
|
18862
|
+
source: zod.z.enum([
|
|
18863
|
+
"pipeline",
|
|
18864
|
+
"onboard",
|
|
18865
|
+
"sensor",
|
|
18866
|
+
"any"
|
|
18867
|
+
]).optional(),
|
|
18868
|
+
/**
|
|
18869
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
18870
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
18871
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
18872
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
18873
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
18874
|
+
*
|
|
18875
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
18876
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
18877
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
18878
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
18879
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
18880
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
18881
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
18882
|
+
* one track the higher of the two is used. A track that ended with no
|
|
18883
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
18884
|
+
* closed for it (an un-recognized subject).
|
|
18885
|
+
*/
|
|
18886
|
+
minLabelConfidence: zod.z.number().min(0).max(1).optional(),
|
|
18887
|
+
/**
|
|
18888
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
18889
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
18890
|
+
* against the token carried on the device-event subject (extracted from the
|
|
18891
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
18892
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
18893
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
18894
|
+
*/
|
|
18895
|
+
eventTypeTokens: zod.z.array(zod.z.string().min(1)).optional(),
|
|
18896
|
+
/**
|
|
18897
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
18898
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
18899
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
18900
|
+
*/
|
|
18901
|
+
sensorKinds: zod.z.array(zod.z.string().min(1)).optional(),
|
|
18902
|
+
/**
|
|
18903
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
18904
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
18905
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
18906
|
+
* on the package-event trigger).
|
|
18907
|
+
*/
|
|
18908
|
+
packagePhase: zod.z.enum([
|
|
18909
|
+
"delivered",
|
|
18910
|
+
"picked-up",
|
|
18911
|
+
"both"
|
|
18912
|
+
]).optional(),
|
|
18913
|
+
/**
|
|
18914
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
18915
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
18916
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
18917
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
18918
|
+
*/
|
|
18919
|
+
customZones: zod.z.array(MaskPolygonShapeSchema).optional(),
|
|
18920
|
+
/**
|
|
18921
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
18922
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
18923
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
18924
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
18925
|
+
*/
|
|
18926
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
18481
18927
|
});
|
|
18482
18928
|
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
18483
18929
|
var NcRuleTargetSchema = zod.z.object({
|
|
@@ -18491,12 +18937,21 @@ var NcRuleTargetSchema = zod.z.object({
|
|
|
18491
18937
|
params: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
18492
18938
|
});
|
|
18493
18939
|
/**
|
|
18494
|
-
* Media attachment policy (P1 still-image subset).
|
|
18495
|
-
* AVAILABLE
|
|
18496
|
-
*
|
|
18940
|
+
* Media attachment policy (P1 still-image subset).
|
|
18941
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
18942
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
18943
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
18944
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
18945
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
18946
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
18947
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
18948
|
+
* name), so the choice never drifts from the record that fired it.
|
|
18949
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
18950
|
+
* - `none` — no attachment.
|
|
18497
18951
|
*/
|
|
18498
18952
|
var NcMediaPolicySchema = zod.z.object({ attach: zod.z.enum([
|
|
18499
18953
|
"best",
|
|
18954
|
+
"best-matching",
|
|
18500
18955
|
"keyFrame",
|
|
18501
18956
|
"none"
|
|
18502
18957
|
]).default("best") });
|
|
@@ -18525,21 +18980,46 @@ var NcRuleInputSchema = zod.z.object({
|
|
|
18525
18980
|
body: zod.z.string().max(2e3).optional()
|
|
18526
18981
|
}).optional(),
|
|
18527
18982
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
18528
|
-
priority: zod.z.number().int().min(1).max(5).default(3)
|
|
18983
|
+
priority: zod.z.number().int().min(1).max(5).default(3),
|
|
18984
|
+
/**
|
|
18985
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
18986
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
18987
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
18988
|
+
*/
|
|
18989
|
+
ownerUserId: zod.z.string().optional()
|
|
18529
18990
|
});
|
|
18530
|
-
/**
|
|
18531
|
-
|
|
18991
|
+
/**
|
|
18992
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
18993
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
18994
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
18995
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
18996
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
18997
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
18998
|
+
* `updateRule` patch.
|
|
18999
|
+
*/
|
|
19000
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: zod.z.array(zod.z.string()).optional() });
|
|
18532
19001
|
/** A persisted rule. */
|
|
18533
19002
|
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
18534
19003
|
id: zod.z.string(),
|
|
18535
19004
|
/** userId of the admin who created the rule (server-stamped caller). */
|
|
18536
19005
|
createdBy: zod.z.string(),
|
|
18537
19006
|
createdAt: zod.z.number(),
|
|
18538
|
-
updatedAt: zod.z.number()
|
|
19007
|
+
updatedAt: zod.z.number(),
|
|
19008
|
+
/**
|
|
19009
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
19010
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
19011
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
19012
|
+
*/
|
|
19013
|
+
disabledTargetIds: zod.z.array(zod.z.string()).default([])
|
|
18539
19014
|
});
|
|
18540
19015
|
var NcTestResultSchema = zod.z.object({
|
|
18541
19016
|
recordId: zod.z.string(),
|
|
18542
|
-
recordKind: zod.z.enum([
|
|
19017
|
+
recordKind: zod.z.enum([
|
|
19018
|
+
"object-event",
|
|
19019
|
+
"track",
|
|
19020
|
+
"device-event",
|
|
19021
|
+
"package-event"
|
|
19022
|
+
]),
|
|
18543
19023
|
deviceId: zod.z.number(),
|
|
18544
19024
|
timestamp: zod.z.number(),
|
|
18545
19025
|
wouldFire: zod.z.boolean(),
|
|
@@ -18557,7 +19037,10 @@ var NcConditionDescriptorSchema = zod.z.object({
|
|
|
18557
19037
|
"zones",
|
|
18558
19038
|
"quality",
|
|
18559
19039
|
"label",
|
|
18560
|
-
"schedule"
|
|
19040
|
+
"schedule",
|
|
19041
|
+
"device",
|
|
19042
|
+
"package",
|
|
19043
|
+
"occupancy"
|
|
18561
19044
|
]),
|
|
18562
19045
|
label: zod.z.string(),
|
|
18563
19046
|
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
@@ -18565,10 +19048,15 @@ var NcConditionDescriptorSchema = zod.z.object({
|
|
|
18565
19048
|
"deviceIdList",
|
|
18566
19049
|
"stringList",
|
|
18567
19050
|
"number01",
|
|
19051
|
+
"number",
|
|
19052
|
+
"sourceSelect",
|
|
18568
19053
|
"zoneSelection",
|
|
18569
19054
|
"zoneIdList",
|
|
18570
19055
|
"schedule",
|
|
18571
|
-
"plateMatcher"
|
|
19056
|
+
"plateMatcher",
|
|
19057
|
+
"packagePhase",
|
|
19058
|
+
"polygonDraw",
|
|
19059
|
+
"occupancy"
|
|
18572
19060
|
]),
|
|
18573
19061
|
operator: zod.z.enum([
|
|
18574
19062
|
"in",
|
|
@@ -18595,7 +19083,12 @@ var NC_CONDITION_CATALOG = [
|
|
|
18595
19083
|
label: "Cameras",
|
|
18596
19084
|
valueType: "deviceIdList",
|
|
18597
19085
|
operator: "in",
|
|
18598
|
-
appliesTo: [
|
|
19086
|
+
appliesTo: [
|
|
19087
|
+
"immediate",
|
|
19088
|
+
"track-end",
|
|
19089
|
+
"device-event",
|
|
19090
|
+
"package-event"
|
|
19091
|
+
],
|
|
18599
19092
|
phase: "P1",
|
|
18600
19093
|
description: "Restrict the rule to these devices; absent = all devices."
|
|
18601
19094
|
},
|
|
@@ -18605,7 +19098,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
18605
19098
|
label: "Object classes",
|
|
18606
19099
|
valueType: "stringList",
|
|
18607
19100
|
operator: "in",
|
|
18608
|
-
appliesTo: [
|
|
19101
|
+
appliesTo: [
|
|
19102
|
+
"immediate",
|
|
19103
|
+
"track-end",
|
|
19104
|
+
"package-event"
|
|
19105
|
+
],
|
|
18609
19106
|
phase: "P1",
|
|
18610
19107
|
description: "Any overlap with the detection class set passes."
|
|
18611
19108
|
},
|
|
@@ -18615,7 +19112,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
18615
19112
|
label: "Excluded classes",
|
|
18616
19113
|
valueType: "stringList",
|
|
18617
19114
|
operator: "notIn",
|
|
18618
|
-
appliesTo: [
|
|
19115
|
+
appliesTo: [
|
|
19116
|
+
"immediate",
|
|
19117
|
+
"track-end",
|
|
19118
|
+
"package-event"
|
|
19119
|
+
],
|
|
18619
19120
|
phase: "P1"
|
|
18620
19121
|
},
|
|
18621
19122
|
{
|
|
@@ -18624,7 +19125,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
18624
19125
|
label: "Minimum confidence",
|
|
18625
19126
|
valueType: "number01",
|
|
18626
19127
|
operator: "gte",
|
|
18627
|
-
appliesTo: [
|
|
19128
|
+
appliesTo: [
|
|
19129
|
+
"immediate",
|
|
19130
|
+
"track-end",
|
|
19131
|
+
"package-event"
|
|
19132
|
+
],
|
|
18628
19133
|
phase: "P1"
|
|
18629
19134
|
},
|
|
18630
19135
|
{
|
|
@@ -18633,7 +19138,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
18633
19138
|
label: "Zones",
|
|
18634
19139
|
valueType: "zoneSelection",
|
|
18635
19140
|
operator: "anyOf",
|
|
18636
|
-
appliesTo: [
|
|
19141
|
+
appliesTo: [
|
|
19142
|
+
"immediate",
|
|
19143
|
+
"track-end",
|
|
19144
|
+
"package-event"
|
|
19145
|
+
],
|
|
18637
19146
|
phase: "P1",
|
|
18638
19147
|
description: "Admin zone ids; quantifier any/all over the visited set."
|
|
18639
19148
|
},
|
|
@@ -18643,7 +19152,11 @@ var NC_CONDITION_CATALOG = [
|
|
|
18643
19152
|
label: "Excluded zones",
|
|
18644
19153
|
valueType: "zoneIdList",
|
|
18645
19154
|
operator: "notIn",
|
|
18646
|
-
appliesTo: [
|
|
19155
|
+
appliesTo: [
|
|
19156
|
+
"immediate",
|
|
19157
|
+
"track-end",
|
|
19158
|
+
"package-event"
|
|
19159
|
+
],
|
|
18647
19160
|
phase: "P1"
|
|
18648
19161
|
},
|
|
18649
19162
|
{
|
|
@@ -18660,423 +19173,287 @@ var NC_CONDITION_CATALOG = [
|
|
|
18660
19173
|
id: "identities",
|
|
18661
19174
|
group: "label",
|
|
18662
19175
|
label: "Identities",
|
|
18663
|
-
valueType: "stringList",
|
|
18664
|
-
operator: "in",
|
|
18665
|
-
appliesTo: ["immediate", "track-end"],
|
|
18666
|
-
phase: "P1",
|
|
18667
|
-
description: "P1: matched against the identity display name on the record label."
|
|
18668
|
-
},
|
|
18669
|
-
{
|
|
18670
|
-
id: "plates",
|
|
18671
|
-
group: "label",
|
|
18672
|
-
label: "License plates",
|
|
18673
|
-
valueType: "plateMatcher",
|
|
18674
|
-
operator: "fuzzyIn",
|
|
18675
|
-
appliesTo: ["immediate", "track-end"],
|
|
18676
|
-
phase: "P1",
|
|
18677
|
-
description: "Levenshtein-tolerant match against the plate text."
|
|
18678
|
-
},
|
|
18679
|
-
{
|
|
18680
|
-
id: "
|
|
18681
|
-
group: "
|
|
18682
|
-
label: "
|
|
18683
|
-
valueType: "
|
|
18684
|
-
operator: "
|
|
18685
|
-
appliesTo: ["immediate", "track-end"],
|
|
18686
|
-
phase: "P1",
|
|
18687
|
-
description: "
|
|
18688
|
-
}
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
|
|
18716
|
-
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
|
|
18733
|
-
|
|
18734
|
-
|
|
18735
|
-
|
|
18736
|
-
|
|
18737
|
-
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
|
|
18754
|
-
|
|
18755
|
-
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
|
|
18784
|
-
|
|
18785
|
-
|
|
18786
|
-
|
|
18787
|
-
|
|
18788
|
-
|
|
18789
|
-
|
|
18790
|
-
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
//#endregion
|
|
18803
|
-
//#region src/capabilities/llm-runtime.cap.ts
|
|
18804
|
-
/**
|
|
18805
|
-
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
18806
|
-
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
18807
|
-
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
18808
|
-
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
18809
|
-
* this only through the `llm` cap's methods.
|
|
18810
|
-
*
|
|
18811
|
-
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
18812
|
-
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
18813
|
-
* watchdog — operator decision #3).
|
|
18814
|
-
*/
|
|
18815
|
-
var ManagedModelRefSchema = zod.z.discriminatedUnion("kind", [
|
|
18816
|
-
zod.z.object({
|
|
18817
|
-
kind: zod.z.literal("catalog"),
|
|
18818
|
-
catalogId: zod.z.string()
|
|
18819
|
-
}),
|
|
18820
|
-
zod.z.object({
|
|
18821
|
-
kind: zod.z.literal("url"),
|
|
18822
|
-
url: zod.z.string(),
|
|
18823
|
-
sha256: zod.z.string().optional()
|
|
18824
|
-
}),
|
|
18825
|
-
zod.z.object({
|
|
18826
|
-
kind: zod.z.literal("path"),
|
|
18827
|
-
path: zod.z.string()
|
|
18828
|
-
})
|
|
18829
|
-
]);
|
|
18830
|
-
var ManagedRuntimeConfigSchema = zod.z.object({
|
|
18831
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
18832
|
-
nodeId: zod.z.string(),
|
|
18833
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
18834
|
-
engine: zod.z.enum(["llama-cpp"]),
|
|
18835
|
-
model: ManagedModelRefSchema,
|
|
18836
|
-
contextSize: zod.z.number().int().default(4096),
|
|
18837
|
-
/** 0 = CPU-only. */
|
|
18838
|
-
gpuLayers: zod.z.number().int().default(0),
|
|
18839
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
18840
|
-
threads: zod.z.number().int().optional(),
|
|
18841
|
-
/** Concurrent slots. */
|
|
18842
|
-
parallel: zod.z.number().int().default(1),
|
|
18843
|
-
/** Else lazy: first generate boots it. */
|
|
18844
|
-
autoStart: zod.z.boolean().default(false),
|
|
18845
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
18846
|
-
idleStopMinutes: zod.z.number().int().default(30)
|
|
18847
|
-
});
|
|
18848
|
-
var LlmRuntimeStatusSchema = zod.z.object({
|
|
18849
|
-
/** Status is ALWAYS node-qualified. */
|
|
18850
|
-
nodeId: zod.z.string(),
|
|
18851
|
-
state: zod.z.enum([
|
|
18852
|
-
"stopped",
|
|
18853
|
-
"downloading",
|
|
18854
|
-
"starting",
|
|
18855
|
-
"ready",
|
|
18856
|
-
"crashed",
|
|
18857
|
-
"failed"
|
|
18858
|
-
]),
|
|
18859
|
-
pid: zod.z.number().optional(),
|
|
18860
|
-
port: zod.z.number().optional(),
|
|
18861
|
-
modelPath: zod.z.string().optional(),
|
|
18862
|
-
modelId: zod.z.string().optional(),
|
|
18863
|
-
downloadProgress: zod.z.number().min(0).max(1).optional(),
|
|
18864
|
-
lastError: zod.z.string().optional(),
|
|
18865
|
-
crashesInWindow: zod.z.number(),
|
|
18866
|
-
/** Child RSS (sampled best-effort). */
|
|
18867
|
-
memoryBytes: zod.z.number().optional(),
|
|
18868
|
-
vramBytes: zod.z.number().optional()
|
|
18869
|
-
});
|
|
18870
|
-
var LlmNodeModelSchema = zod.z.object({
|
|
18871
|
-
file: zod.z.string(),
|
|
18872
|
-
sizeBytes: zod.z.number(),
|
|
18873
|
-
catalogId: zod.z.string().optional(),
|
|
18874
|
-
installedAt: zod.z.number().optional()
|
|
18875
|
-
});
|
|
18876
|
-
var LlmRuntimeDiskUsageSchema = zod.z.object({
|
|
18877
|
-
nodeId: zod.z.string(),
|
|
18878
|
-
modelsBytes: zod.z.number(),
|
|
18879
|
-
freeBytes: zod.z.number().optional()
|
|
18880
|
-
});
|
|
18881
|
-
var LlmRuntimeCompleteInputSchema = LlmGenerateBaseInputSchema.extend({
|
|
18882
|
-
images: zod.z.array(LlmImageSchema).optional(),
|
|
18883
|
-
runtime: ManagedRuntimeConfigSchema,
|
|
18884
|
-
/** The managed profile's timeout, threaded by the hub provider. */
|
|
18885
|
-
timeoutMs: zod.z.number().int().positive().optional()
|
|
18886
|
-
});
|
|
18887
|
-
var llmRuntimeCapability = {
|
|
18888
|
-
name: "llm-runtime",
|
|
18889
|
-
scope: "system",
|
|
18890
|
-
mode: "singleton",
|
|
18891
|
-
internal: true,
|
|
18892
|
-
methods: {
|
|
18893
|
-
complete: require_sleep.method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
|
|
18894
|
-
ensureStarted: require_sleep.method(zod.z.object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
18895
|
-
kind: "mutation",
|
|
18896
|
-
auth: "admin"
|
|
18897
|
-
}),
|
|
18898
|
-
stop: require_sleep.method(zod.z.object({}), zod.z.void(), {
|
|
18899
|
-
kind: "mutation",
|
|
18900
|
-
auth: "admin"
|
|
18901
|
-
}),
|
|
18902
|
-
status: require_sleep.method(zod.z.object({}), LlmRuntimeStatusSchema),
|
|
18903
|
-
installModel: require_sleep.method(zod.z.object({ model: ManagedModelRefSchema }), zod.z.void(), {
|
|
18904
|
-
kind: "mutation",
|
|
18905
|
-
auth: "admin"
|
|
18906
|
-
}),
|
|
18907
|
-
deleteModel: require_sleep.method(zod.z.object({ file: zod.z.string() }), zod.z.void(), {
|
|
18908
|
-
kind: "mutation",
|
|
18909
|
-
auth: "admin"
|
|
18910
|
-
}),
|
|
18911
|
-
listLocalModels: require_sleep.method(zod.z.object({}), zod.z.array(LlmNodeModelSchema)),
|
|
18912
|
-
getDiskUsage: require_sleep.method(zod.z.object({}), LlmRuntimeDiskUsageSchema)
|
|
19176
|
+
valueType: "stringList",
|
|
19177
|
+
operator: "in",
|
|
19178
|
+
appliesTo: ["immediate", "track-end"],
|
|
19179
|
+
phase: "P1",
|
|
19180
|
+
description: "P1: matched against the identity display name on the record label."
|
|
19181
|
+
},
|
|
19182
|
+
{
|
|
19183
|
+
id: "plates",
|
|
19184
|
+
group: "label",
|
|
19185
|
+
label: "License plates",
|
|
19186
|
+
valueType: "plateMatcher",
|
|
19187
|
+
operator: "fuzzyIn",
|
|
19188
|
+
appliesTo: ["immediate", "track-end"],
|
|
19189
|
+
phase: "P1",
|
|
19190
|
+
description: "Levenshtein-tolerant match against the plate text."
|
|
19191
|
+
},
|
|
19192
|
+
{
|
|
19193
|
+
id: "identitiesExclude",
|
|
19194
|
+
group: "label",
|
|
19195
|
+
label: "Excluded identities",
|
|
19196
|
+
valueType: "stringList",
|
|
19197
|
+
operator: "notIn",
|
|
19198
|
+
appliesTo: ["immediate", "track-end"],
|
|
19199
|
+
phase: "P1",
|
|
19200
|
+
description: "Veto by identity display name (mirror of Identities; absent label passes)."
|
|
19201
|
+
},
|
|
19202
|
+
{
|
|
19203
|
+
id: "minLabelConfidence",
|
|
19204
|
+
group: "label",
|
|
19205
|
+
label: "Minimum label confidence",
|
|
19206
|
+
valueType: "number01",
|
|
19207
|
+
operator: "gte",
|
|
19208
|
+
appliesTo: ["track-end"],
|
|
19209
|
+
phase: "P1",
|
|
19210
|
+
description: "Best identity/plate recognition match confidence [0,1] for the label the track carries at close (peak assigned-identity cosine / peak plate OCR score; the higher of the two when both were read). Distinct from detection confidence. Fails closed for a track that ended un-recognized."
|
|
19211
|
+
},
|
|
19212
|
+
{
|
|
19213
|
+
id: "minImportance",
|
|
19214
|
+
group: "quality",
|
|
19215
|
+
label: "Minimum importance",
|
|
19216
|
+
valueType: "number01",
|
|
19217
|
+
operator: "gte",
|
|
19218
|
+
appliesTo: ["track-end"],
|
|
19219
|
+
phase: "P1",
|
|
19220
|
+
description: "Server-computed key-event importance [0,1]; track-end rules only (importance is scored at close). Fails when the record has none."
|
|
19221
|
+
},
|
|
19222
|
+
{
|
|
19223
|
+
id: "minDwellSeconds",
|
|
19224
|
+
group: "quality",
|
|
19225
|
+
label: "Minimum dwell (seconds)",
|
|
19226
|
+
valueType: "number",
|
|
19227
|
+
operator: "gte",
|
|
19228
|
+
appliesTo: ["track-end"],
|
|
19229
|
+
phase: "P1",
|
|
19230
|
+
description: "Track lifespan in seconds (lastSeen − firstSeen); track-end rules only."
|
|
19231
|
+
},
|
|
19232
|
+
{
|
|
19233
|
+
id: "source",
|
|
19234
|
+
group: "scope",
|
|
19235
|
+
label: "Detection source",
|
|
19236
|
+
valueType: "sourceSelect",
|
|
19237
|
+
operator: "in",
|
|
19238
|
+
appliesTo: [
|
|
19239
|
+
"immediate",
|
|
19240
|
+
"track-end",
|
|
19241
|
+
"device-event",
|
|
19242
|
+
"package-event"
|
|
19243
|
+
],
|
|
19244
|
+
phase: "P1",
|
|
19245
|
+
description: "pipeline / onboard / sensor; a record with no stamped source counts as pipeline."
|
|
19246
|
+
},
|
|
19247
|
+
{
|
|
19248
|
+
id: "sensorKinds",
|
|
19249
|
+
group: "device",
|
|
19250
|
+
label: "Sensor kinds",
|
|
19251
|
+
valueType: "stringList",
|
|
19252
|
+
operator: "in",
|
|
19253
|
+
appliesTo: ["device-event"],
|
|
19254
|
+
phase: "P1",
|
|
19255
|
+
description: "Sensor/control taxonomy kinds (doorbell / contact / button / …) matched against the persisted device event."
|
|
19256
|
+
},
|
|
19257
|
+
{
|
|
19258
|
+
id: "eventTypeTokens",
|
|
19259
|
+
group: "device",
|
|
19260
|
+
label: "Event-type tokens",
|
|
19261
|
+
valueType: "stringList",
|
|
19262
|
+
operator: "in",
|
|
19263
|
+
appliesTo: ["device-event"],
|
|
19264
|
+
phase: "P1",
|
|
19265
|
+
description: "Raw device event-type tokens (e.g. doorbell press / press_long) from the event-emitter slice; absent on doorbell-pulse / passive sensors."
|
|
19266
|
+
},
|
|
19267
|
+
{
|
|
19268
|
+
id: "packagePhase",
|
|
19269
|
+
group: "package",
|
|
19270
|
+
label: "Package phase",
|
|
19271
|
+
valueType: "packagePhase",
|
|
19272
|
+
operator: "in",
|
|
19273
|
+
appliesTo: ["package-event"],
|
|
19274
|
+
phase: "P1",
|
|
19275
|
+
description: "Delivered / picked-up / both."
|
|
19276
|
+
},
|
|
19277
|
+
{
|
|
19278
|
+
id: "occupancy",
|
|
19279
|
+
group: "occupancy",
|
|
19280
|
+
label: "Occupancy",
|
|
19281
|
+
valueType: "occupancy",
|
|
19282
|
+
operator: "anyOf",
|
|
19283
|
+
appliesTo: ["device-event"],
|
|
19284
|
+
phase: "P1",
|
|
19285
|
+
description: "ZoneAnalytics occupancy edge (optionally zone/class-scoped): count crosses the threshold and holds for sustainSeconds. Fail-closed on a missing snapshot."
|
|
19286
|
+
},
|
|
19287
|
+
{
|
|
19288
|
+
id: "customZones",
|
|
19289
|
+
group: "zones",
|
|
19290
|
+
label: "Custom zones",
|
|
19291
|
+
valueType: "polygonDraw",
|
|
19292
|
+
operator: "anyOf",
|
|
19293
|
+
appliesTo: [
|
|
19294
|
+
"immediate",
|
|
19295
|
+
"track-end",
|
|
19296
|
+
"package-event"
|
|
19297
|
+
],
|
|
19298
|
+
phase: "P1",
|
|
19299
|
+
description: "User-drawn polygons; a detection whose bbox overlaps any polygon matches."
|
|
19300
|
+
},
|
|
19301
|
+
{
|
|
19302
|
+
id: "schedule",
|
|
19303
|
+
group: "schedule",
|
|
19304
|
+
label: "Schedule",
|
|
19305
|
+
valueType: "schedule",
|
|
19306
|
+
operator: "withinSchedule",
|
|
19307
|
+
appliesTo: [
|
|
19308
|
+
"immediate",
|
|
19309
|
+
"track-end",
|
|
19310
|
+
"device-event",
|
|
19311
|
+
"package-event"
|
|
19312
|
+
],
|
|
19313
|
+
phase: "P1",
|
|
19314
|
+
description: "Weekly activation windows (invertible); absent = always active."
|
|
18913
19315
|
}
|
|
18914
|
-
|
|
18915
|
-
//#endregion
|
|
18916
|
-
//#region src/capabilities/llm.cap.ts
|
|
19316
|
+
];
|
|
18917
19317
|
/**
|
|
18918
|
-
*
|
|
18919
|
-
*
|
|
18920
|
-
*
|
|
18921
|
-
*
|
|
18922
|
-
*
|
|
19318
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
19319
|
+
* durable outbox row's own status (single source of truth):
|
|
19320
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
19321
|
+
* - `sent` — delivered (terminal)
|
|
19322
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
19323
|
+
* backend rejection / a deleted target (terminal; carries
|
|
19324
|
+
* the failure `error`)
|
|
18923
19325
|
*
|
|
18924
|
-
*
|
|
18925
|
-
*
|
|
18926
|
-
* write; a stored key NEVER round-trips to a client.
|
|
19326
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
19327
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
18927
19328
|
*/
|
|
18928
|
-
var
|
|
18929
|
-
"
|
|
18930
|
-
"
|
|
18931
|
-
"
|
|
18932
|
-
"google",
|
|
18933
|
-
"managed-local"
|
|
19329
|
+
var NcHistoryStatusSchema = zod.z.enum([
|
|
19330
|
+
"pending",
|
|
19331
|
+
"sent",
|
|
19332
|
+
"dead"
|
|
18934
19333
|
]);
|
|
18935
|
-
|
|
18936
|
-
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
temperature: zod.z.number().min(0).max(2).optional(),
|
|
18950
|
-
maxTokens: zod.z.number().int().positive().optional(),
|
|
18951
|
-
timeoutMs: zod.z.number().int().positive().default(6e4),
|
|
18952
|
-
extraHeaders: zod.z.record(zod.z.string(), zod.z.string()).optional(),
|
|
18953
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
18954
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
18955
|
-
});
|
|
18956
|
-
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
18957
|
-
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
18958
|
-
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
18959
|
-
var ConfigSchemaPassthrough = zod.z.unknown();
|
|
18960
|
-
var LlmProfileKindDescriptorSchema = zod.z.object({
|
|
18961
|
-
kind: LlmProfileKindSchema,
|
|
18962
|
-
label: zod.z.string(),
|
|
18963
|
-
icon: zod.z.string(),
|
|
18964
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
18965
|
-
addonId: zod.z.string(),
|
|
18966
|
-
configSchema: ConfigSchemaPassthrough
|
|
18967
|
-
});
|
|
18968
|
-
var LlmDefaultSelectorSchema = zod.z.union([zod.z.object({ consumer: zod.z.string() }), zod.z.object({ purpose: zod.z.enum(["text", "vision"]) })]);
|
|
18969
|
-
var LlmDefaultSchema = zod.z.object({
|
|
18970
|
-
selector: LlmDefaultSelectorSchema,
|
|
18971
|
-
profileId: zod.z.string()
|
|
18972
|
-
});
|
|
18973
|
-
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
18974
|
-
var LlmUsageRollupSchema = zod.z.object({
|
|
18975
|
-
day: zod.z.string(),
|
|
18976
|
-
consumer: zod.z.string(),
|
|
18977
|
-
profileId: zod.z.string(),
|
|
18978
|
-
calls: zod.z.number(),
|
|
18979
|
-
okCalls: zod.z.number(),
|
|
18980
|
-
errorCalls: zod.z.number(),
|
|
18981
|
-
inputTokens: zod.z.number(),
|
|
18982
|
-
outputTokens: zod.z.number(),
|
|
18983
|
-
avgLatencyMs: zod.z.number()
|
|
19334
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
19335
|
+
var NcHistoryRecordKindSchema = zod.z.enum([
|
|
19336
|
+
"object-event",
|
|
19337
|
+
"track-end",
|
|
19338
|
+
"device-event",
|
|
19339
|
+
"package-event"
|
|
19340
|
+
]);
|
|
19341
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
19342
|
+
var NcHistorySubjectSchema = zod.z.object({
|
|
19343
|
+
className: zod.z.string(),
|
|
19344
|
+
label: zod.z.string().optional(),
|
|
19345
|
+
confidence: zod.z.number().optional(),
|
|
19346
|
+
zones: zod.z.array(zod.z.string()),
|
|
19347
|
+
timestamp: zod.z.number()
|
|
18984
19348
|
});
|
|
18985
|
-
/**
|
|
18986
|
-
|
|
19349
|
+
/**
|
|
19350
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
19351
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
19352
|
+
* NO second write path, so history can never drift from delivery state).
|
|
19353
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
19354
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
19355
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
19356
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
19357
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
19358
|
+
* P1 (admin scope only).
|
|
19359
|
+
*/
|
|
19360
|
+
var NcHistoryEntrySchema = zod.z.object({
|
|
19361
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
18987
19362
|
id: zod.z.string(),
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
/**
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19363
|
+
ruleId: zod.z.string(),
|
|
19364
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
19365
|
+
ruleName: zod.z.string(),
|
|
19366
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
19367
|
+
delivery: NcDeliverySchema,
|
|
19368
|
+
targetId: zod.z.string(),
|
|
19369
|
+
deviceId: zod.z.number(),
|
|
19370
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
19371
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
19372
|
+
recordId: zod.z.string(),
|
|
19373
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
19374
|
+
trackId: zod.z.string().optional(),
|
|
19375
|
+
status: NcHistoryStatusSchema,
|
|
19376
|
+
/** Delivery attempts made so far. */
|
|
19377
|
+
attempts: zod.z.number().int(),
|
|
19378
|
+
/** Fire time (outbox enqueue). */
|
|
19379
|
+
createdAt: zod.z.number(),
|
|
19380
|
+
/** Last transition time (terminal for sent / dead). */
|
|
19381
|
+
updatedAt: zod.z.number(),
|
|
19382
|
+
/** Failure detail — present on a `dead` row. */
|
|
19383
|
+
error: zod.z.string().optional(),
|
|
19384
|
+
subject: NcHistorySubjectSchema
|
|
19007
19385
|
});
|
|
19008
|
-
|
|
19009
|
-
var
|
|
19010
|
-
|
|
19011
|
-
|
|
19386
|
+
/** `getHistory` default page size + hard ceiling (bounded output). */
|
|
19387
|
+
var NC_HISTORY_LIMIT_DEFAULT = 100;
|
|
19388
|
+
var NC_HISTORY_LIMIT_MAX = 500;
|
|
19389
|
+
/**
|
|
19390
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
19391
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
19392
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
19393
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
19394
|
+
*/
|
|
19395
|
+
var NcHistoryFilterSchema = zod.z.object({
|
|
19396
|
+
ruleId: zod.z.string().optional(),
|
|
19397
|
+
deviceId: zod.z.number().optional(),
|
|
19398
|
+
status: NcHistoryStatusSchema.optional(),
|
|
19399
|
+
since: zod.z.number().optional(),
|
|
19400
|
+
until: zod.z.number().optional(),
|
|
19401
|
+
limit: zod.z.number().int().min(1).max(500).default(100)
|
|
19012
19402
|
});
|
|
19013
|
-
var
|
|
19014
|
-
name: "
|
|
19403
|
+
var notificationRulesCapability = {
|
|
19404
|
+
name: "notification-rules",
|
|
19015
19405
|
scope: "system",
|
|
19016
|
-
mode: "
|
|
19017
|
-
internal: false,
|
|
19018
|
-
providerKind: "ai",
|
|
19019
|
-
/** `nodeId` inputs below are DATA (the hub provider pins itself), never routing. */
|
|
19020
|
-
nodeIdMode: "data",
|
|
19406
|
+
mode: "singleton",
|
|
19021
19407
|
methods: {
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
|
|
19025
|
-
listProfiles: require_sleep.method(zod.z.object({}), zod.z.array(LlmProfileSchema)),
|
|
19026
|
-
upsertProfile: require_sleep.method(zod.z.object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
19027
|
-
kind: "mutation",
|
|
19028
|
-
auth: "admin"
|
|
19029
|
-
}),
|
|
19030
|
-
deleteProfile: require_sleep.method(ProfileRefInputSchema, zod.z.void(), {
|
|
19031
|
-
kind: "mutation",
|
|
19032
|
-
auth: "admin"
|
|
19033
|
-
}),
|
|
19034
|
-
testProfile: require_sleep.method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
19408
|
+
listRules: require_sleep.method(zod.z.object({}), zod.z.object({ rules: zod.z.array(NcRuleSchema) }), { auth: "admin" }),
|
|
19409
|
+
getRule: require_sleep.method(zod.z.object({ ruleId: zod.z.string() }), zod.z.object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }),
|
|
19410
|
+
createRule: require_sleep.method(zod.z.object({ rule: NcRuleInputSchema }), zod.z.object({ rule: NcRuleSchema }), {
|
|
19035
19411
|
kind: "mutation",
|
|
19036
|
-
auth: "admin"
|
|
19412
|
+
auth: "admin",
|
|
19413
|
+
caller: "required"
|
|
19037
19414
|
}),
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
selector: LlmDefaultSelectorSchema,
|
|
19043
|
-
profileId: zod.z.string().nullable()
|
|
19044
|
-
}), zod.z.void(), {
|
|
19415
|
+
updateRule: require_sleep.method(zod.z.object({
|
|
19416
|
+
ruleId: zod.z.string(),
|
|
19417
|
+
patch: NcRulePatchSchema
|
|
19418
|
+
}), zod.z.object({ rule: NcRuleSchema }), {
|
|
19045
19419
|
kind: "mutation",
|
|
19046
|
-
auth: "admin"
|
|
19420
|
+
auth: "admin",
|
|
19421
|
+
caller: "required"
|
|
19047
19422
|
}),
|
|
19048
|
-
|
|
19049
|
-
since: zod.z.number().optional(),
|
|
19050
|
-
until: zod.z.number().optional(),
|
|
19051
|
-
consumer: zod.z.string().optional(),
|
|
19052
|
-
profileId: zod.z.string().optional()
|
|
19053
|
-
}), zod.z.array(LlmUsageRollupSchema)),
|
|
19054
|
-
listModelCatalog: require_sleep.method(zod.z.object({}), zod.z.array(ManagedModelCatalogEntrySchema)),
|
|
19055
|
-
listRuntimeNodes: require_sleep.method(zod.z.object({}), zod.z.array(LlmRuntimeNodeSchema)),
|
|
19056
|
-
listNodeModels: require_sleep.method(zod.z.object({ nodeId: zod.z.string() }), zod.z.array(LlmNodeModelSchema)),
|
|
19057
|
-
installModel: require_sleep.method(zod.z.object({
|
|
19058
|
-
nodeId: zod.z.string(),
|
|
19059
|
-
model: ManagedModelRefSchema
|
|
19060
|
-
}), zod.z.void(), {
|
|
19423
|
+
deleteRule: require_sleep.method(zod.z.object({ ruleId: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), {
|
|
19061
19424
|
kind: "mutation",
|
|
19062
19425
|
auth: "admin"
|
|
19063
19426
|
}),
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
}), zod.z.
|
|
19427
|
+
setRuleEnabled: require_sleep.method(zod.z.object({
|
|
19428
|
+
ruleId: zod.z.string(),
|
|
19429
|
+
enabled: zod.z.boolean()
|
|
19430
|
+
}), zod.z.object({ success: zod.z.literal(true) }), {
|
|
19068
19431
|
kind: "mutation",
|
|
19069
19432
|
auth: "admin"
|
|
19070
19433
|
}),
|
|
19071
|
-
|
|
19072
|
-
|
|
19434
|
+
/**
|
|
19435
|
+
* Dry-run a rule against recently persisted records (object events for
|
|
19436
|
+
* `immediate`, closed tracks for `track-end`). Mutation kind only to
|
|
19437
|
+
* carry the full rule object safely; no side effects.
|
|
19438
|
+
*/
|
|
19439
|
+
testRule: require_sleep.method(zod.z.object({
|
|
19440
|
+
rule: NcRuleInputSchema,
|
|
19441
|
+
lookbackMinutes: zod.z.number().int().min(1).max(1440).default(60)
|
|
19442
|
+
}), zod.z.object({ results: zod.z.array(NcTestResultSchema) }), {
|
|
19073
19443
|
kind: "mutation",
|
|
19074
19444
|
auth: "admin"
|
|
19075
19445
|
}),
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19446
|
+
getConditionCatalog: require_sleep.method(zod.z.object({}), zod.z.object({ catalog: zod.z.array(NcConditionDescriptorSchema) })),
|
|
19447
|
+
/**
|
|
19448
|
+
* Queryable delivery history — a read-only view over the durable outbox
|
|
19449
|
+
* (fired rule, subject summary, target, status, timestamps, error on a
|
|
19450
|
+
* dead row). Newest-first, bounded by `filter.limit`. Retention follows
|
|
19451
|
+
* the outbox's own terminal-row prune horizon (no separate history
|
|
19452
|
+
* horizon — single collection, single source of truth). Admin-only in
|
|
19453
|
+
* P1 (no user dimension); the P2 viewer History screen adds per-caller
|
|
19454
|
+
* scoping on the same method.
|
|
19455
|
+
*/
|
|
19456
|
+
getHistory: require_sleep.method(zod.z.object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), zod.z.object({ entries: zod.z.array(NcHistoryEntrySchema) }), { auth: "admin" })
|
|
19080
19457
|
}
|
|
19081
19458
|
};
|
|
19082
19459
|
//#endregion
|
|
@@ -19956,110 +20333,6 @@ var pipelineAnalyticsCapability = {
|
|
|
19956
20333
|
}
|
|
19957
20334
|
};
|
|
19958
20335
|
//#endregion
|
|
19959
|
-
//#region src/capabilities/sensor-event-kinds.ts
|
|
19960
|
-
/**
|
|
19961
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
19962
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
19963
|
-
* caps into per-camera event-kind descriptors.
|
|
19964
|
-
*
|
|
19965
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
19966
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
19967
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
19968
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
19969
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
19970
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
19971
|
-
* eventful cap is missing.
|
|
19972
|
-
*/
|
|
19973
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
19974
|
-
var LEGACY_ICON = {
|
|
19975
|
-
motion: "motion",
|
|
19976
|
-
audio: "audio",
|
|
19977
|
-
person: "person",
|
|
19978
|
-
vehicle: "vehicle",
|
|
19979
|
-
animal: "animal",
|
|
19980
|
-
package: "package",
|
|
19981
|
-
door: "door",
|
|
19982
|
-
pir: "pir",
|
|
19983
|
-
smoke: "smoke",
|
|
19984
|
-
water: "water",
|
|
19985
|
-
button: "button",
|
|
19986
|
-
generic: "generic",
|
|
19987
|
-
gas: "smoke",
|
|
19988
|
-
vibration: "generic",
|
|
19989
|
-
tamper: "generic",
|
|
19990
|
-
presence: "person",
|
|
19991
|
-
lock: "generic",
|
|
19992
|
-
siren: "generic",
|
|
19993
|
-
switch: "generic",
|
|
19994
|
-
doorbell: "button"
|
|
19995
|
-
};
|
|
19996
|
-
function legacyIcon(iconId) {
|
|
19997
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
19998
|
-
}
|
|
19999
|
-
/**
|
|
20000
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
20001
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
20002
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
20003
|
-
*/
|
|
20004
|
-
var CAP_TO_KIND = {
|
|
20005
|
-
contact: "contact",
|
|
20006
|
-
motion: "motion-sensor",
|
|
20007
|
-
smoke: "smoke",
|
|
20008
|
-
flood: "flood",
|
|
20009
|
-
gas: "gas",
|
|
20010
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
20011
|
-
vibration: "vibration",
|
|
20012
|
-
tamper: "tamper",
|
|
20013
|
-
presence: "presence",
|
|
20014
|
-
"enum-sensor": "enum-sensor",
|
|
20015
|
-
"event-emitter": "device-event",
|
|
20016
|
-
"lock-control": "lock",
|
|
20017
|
-
switch: "switch",
|
|
20018
|
-
button: "button",
|
|
20019
|
-
doorbell: "doorbell"
|
|
20020
|
-
};
|
|
20021
|
-
function buildDescriptor(capName, kind) {
|
|
20022
|
-
const t = EVENT_TAXONOMY[kind];
|
|
20023
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
20024
|
-
return {
|
|
20025
|
-
...t,
|
|
20026
|
-
icon: legacyIcon(t.iconId)
|
|
20027
|
-
};
|
|
20028
|
-
}
|
|
20029
|
-
/**
|
|
20030
|
-
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
20031
|
-
* contributes one entry per bound cap present in this map.
|
|
20032
|
-
*/
|
|
20033
|
-
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
20034
|
-
/** The cap names covered by the taxonomy (for the anti-drift guard). */
|
|
20035
|
-
var EVENTFUL_CAP_NAMES = Object.keys(CAP_TO_KIND);
|
|
20036
|
-
/**
|
|
20037
|
-
* Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
|
|
20038
|
-
* per-device `source`. Returns null when `kind` is not in the taxonomy.
|
|
20039
|
-
* This is THE bridge from the serializable taxonomy dictionary to the cap
|
|
20040
|
-
* wire shape — every event-kind descriptor the server emits goes through it,
|
|
20041
|
-
* so color/iconId/labelKey are never re-declared at a call site.
|
|
20042
|
-
*/
|
|
20043
|
-
function buildEventKindDescriptor(kind, source) {
|
|
20044
|
-
const t = EVENT_TAXONOMY[kind];
|
|
20045
|
-
if (t === void 0) return null;
|
|
20046
|
-
return {
|
|
20047
|
-
kind: t.kind,
|
|
20048
|
-
labelKey: t.labelKey,
|
|
20049
|
-
label: t.label,
|
|
20050
|
-
color: t.color,
|
|
20051
|
-
iconId: t.iconId,
|
|
20052
|
-
icon: legacyIcon(t.iconId),
|
|
20053
|
-
category: t.category,
|
|
20054
|
-
parentKind: t.parentKind,
|
|
20055
|
-
level: t.level,
|
|
20056
|
-
source: {
|
|
20057
|
-
capName: source.capName,
|
|
20058
|
-
deviceId: source.deviceId
|
|
20059
|
-
}
|
|
20060
|
-
};
|
|
20061
|
-
}
|
|
20062
|
-
//#endregion
|
|
20063
20336
|
//#region src/capabilities/pipeline-orchestrator.cap.ts
|
|
20064
20337
|
var CameraPipelineConfigSchema = zod.z.object({
|
|
20065
20338
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
@@ -20816,6 +21089,110 @@ var pipelineOrchestratorCapability = {
|
|
|
20816
21089
|
}
|
|
20817
21090
|
};
|
|
20818
21091
|
//#endregion
|
|
21092
|
+
//#region src/capabilities/sensor-event-kinds.ts
|
|
21093
|
+
/**
|
|
21094
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
21095
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
21096
|
+
* caps into per-camera event-kind descriptors.
|
|
21097
|
+
*
|
|
21098
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
21099
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
21100
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
21101
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
21102
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
21103
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
21104
|
+
* eventful cap is missing.
|
|
21105
|
+
*/
|
|
21106
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
21107
|
+
var LEGACY_ICON = {
|
|
21108
|
+
motion: "motion",
|
|
21109
|
+
audio: "audio",
|
|
21110
|
+
person: "person",
|
|
21111
|
+
vehicle: "vehicle",
|
|
21112
|
+
animal: "animal",
|
|
21113
|
+
package: "package",
|
|
21114
|
+
door: "door",
|
|
21115
|
+
pir: "pir",
|
|
21116
|
+
smoke: "smoke",
|
|
21117
|
+
water: "water",
|
|
21118
|
+
button: "button",
|
|
21119
|
+
generic: "generic",
|
|
21120
|
+
gas: "smoke",
|
|
21121
|
+
vibration: "generic",
|
|
21122
|
+
tamper: "generic",
|
|
21123
|
+
presence: "person",
|
|
21124
|
+
lock: "generic",
|
|
21125
|
+
siren: "generic",
|
|
21126
|
+
switch: "generic",
|
|
21127
|
+
doorbell: "button"
|
|
21128
|
+
};
|
|
21129
|
+
function legacyIcon(iconId) {
|
|
21130
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
21131
|
+
}
|
|
21132
|
+
/**
|
|
21133
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
21134
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
21135
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
21136
|
+
*/
|
|
21137
|
+
var CAP_TO_KIND = {
|
|
21138
|
+
contact: "contact",
|
|
21139
|
+
motion: "motion-sensor",
|
|
21140
|
+
smoke: "smoke",
|
|
21141
|
+
flood: "flood",
|
|
21142
|
+
gas: "gas",
|
|
21143
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
21144
|
+
vibration: "vibration",
|
|
21145
|
+
tamper: "tamper",
|
|
21146
|
+
presence: "presence",
|
|
21147
|
+
"enum-sensor": "enum-sensor",
|
|
21148
|
+
"event-emitter": "device-event",
|
|
21149
|
+
"lock-control": "lock",
|
|
21150
|
+
switch: "switch",
|
|
21151
|
+
button: "button",
|
|
21152
|
+
doorbell: "doorbell"
|
|
21153
|
+
};
|
|
21154
|
+
function buildDescriptor(capName, kind) {
|
|
21155
|
+
const t = EVENT_TAXONOMY[kind];
|
|
21156
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
21157
|
+
return {
|
|
21158
|
+
...t,
|
|
21159
|
+
icon: legacyIcon(t.iconId)
|
|
21160
|
+
};
|
|
21161
|
+
}
|
|
21162
|
+
/**
|
|
21163
|
+
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
21164
|
+
* contributes one entry per bound cap present in this map.
|
|
21165
|
+
*/
|
|
21166
|
+
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
21167
|
+
/** The cap names covered by the taxonomy (for the anti-drift guard). */
|
|
21168
|
+
var EVENTFUL_CAP_NAMES = Object.keys(CAP_TO_KIND);
|
|
21169
|
+
/**
|
|
21170
|
+
* Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
|
|
21171
|
+
* per-device `source`. Returns null when `kind` is not in the taxonomy.
|
|
21172
|
+
* This is THE bridge from the serializable taxonomy dictionary to the cap
|
|
21173
|
+
* wire shape — every event-kind descriptor the server emits goes through it,
|
|
21174
|
+
* so color/iconId/labelKey are never re-declared at a call site.
|
|
21175
|
+
*/
|
|
21176
|
+
function buildEventKindDescriptor(kind, source) {
|
|
21177
|
+
const t = EVENT_TAXONOMY[kind];
|
|
21178
|
+
if (t === void 0) return null;
|
|
21179
|
+
return {
|
|
21180
|
+
kind: t.kind,
|
|
21181
|
+
labelKey: t.labelKey,
|
|
21182
|
+
label: t.label,
|
|
21183
|
+
color: t.color,
|
|
21184
|
+
iconId: t.iconId,
|
|
21185
|
+
icon: legacyIcon(t.iconId),
|
|
21186
|
+
category: t.category,
|
|
21187
|
+
parentKind: t.parentKind,
|
|
21188
|
+
level: t.level,
|
|
21189
|
+
source: {
|
|
21190
|
+
capName: source.capName,
|
|
21191
|
+
deviceId: source.deviceId
|
|
21192
|
+
}
|
|
21193
|
+
};
|
|
21194
|
+
}
|
|
21195
|
+
//#endregion
|
|
20819
21196
|
//#region src/capabilities/server-management.cap.ts
|
|
20820
21197
|
/**
|
|
20821
21198
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
@@ -22981,7 +23358,28 @@ var FaceInfoSchema = zod.z.object({
|
|
|
22981
23358
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
22982
23359
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
22983
23360
|
* back to the inline `base64` face crop. */
|
|
22984
|
-
keyFrameMediaKey: zod.z.string().optional()
|
|
23361
|
+
keyFrameMediaKey: zod.z.string().optional(),
|
|
23362
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
23363
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
23364
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
23365
|
+
* faces that were never auto-recognized. */
|
|
23366
|
+
bestMatchScore: zod.z.number().optional(),
|
|
23367
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
23368
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
23369
|
+
* legacy rows / runners that reported no native measure. */
|
|
23370
|
+
nativeFaceShortSidePx: zod.z.number().optional(),
|
|
23371
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
23372
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
23373
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
23374
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
23375
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
23376
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
23377
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
23378
|
+
suggestedIdentityId: zod.z.string().optional(),
|
|
23379
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
23380
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
23381
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
23382
|
+
suggestedMatchScore: zod.z.number().optional()
|
|
22985
23383
|
});
|
|
22986
23384
|
var FaceFilterEnum = zod.z.enum([
|
|
22987
23385
|
"unassigned",
|
|
@@ -25643,7 +26041,6 @@ var CAPABILITY_NAMES = {
|
|
|
25643
26041
|
addonWidgetsSource: "addon-widgets-source",
|
|
25644
26042
|
addons: "addons",
|
|
25645
26043
|
adminUi: "admin-ui",
|
|
25646
|
-
advancedNotifier: "advanced-notifier",
|
|
25647
26044
|
airQualitySensor: "air-quality-sensor",
|
|
25648
26045
|
alarmPanel: "alarm-panel",
|
|
25649
26046
|
alerts: "alerts",
|
|
@@ -25816,10 +26213,6 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
25816
26213
|
key: "adminUi",
|
|
25817
26214
|
name: "admin-ui"
|
|
25818
26215
|
},
|
|
25819
|
-
{
|
|
25820
|
-
key: "advancedNotifier",
|
|
25821
|
-
name: "advanced-notifier"
|
|
25822
|
-
},
|
|
25823
26216
|
{
|
|
25824
26217
|
key: "airQualitySensor",
|
|
25825
26218
|
name: "air-quality-sensor"
|
|
@@ -26372,7 +26765,6 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
26372
26765
|
addonWidgetsSourceCapability,
|
|
26373
26766
|
addonsCapability,
|
|
26374
26767
|
require_sleep.adminUiCapability,
|
|
26375
|
-
advancedNotifierCapability,
|
|
26376
26768
|
airQualitySensorCapability,
|
|
26377
26769
|
alarmPanelCapability,
|
|
26378
26770
|
alertsCapability,
|
|
@@ -26863,36 +27255,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
26863
27255
|
addonId: null,
|
|
26864
27256
|
access: "view"
|
|
26865
27257
|
},
|
|
26866
|
-
"advancedNotifier.deleteRule": {
|
|
26867
|
-
capName: "advanced-notifier",
|
|
26868
|
-
capScope: "system",
|
|
26869
|
-
addonId: null,
|
|
26870
|
-
access: "delete"
|
|
26871
|
-
},
|
|
26872
|
-
"advancedNotifier.getHistory": {
|
|
26873
|
-
capName: "advanced-notifier",
|
|
26874
|
-
capScope: "system",
|
|
26875
|
-
addonId: null,
|
|
26876
|
-
access: "view"
|
|
26877
|
-
},
|
|
26878
|
-
"advancedNotifier.getRules": {
|
|
26879
|
-
capName: "advanced-notifier",
|
|
26880
|
-
capScope: "system",
|
|
26881
|
-
addonId: null,
|
|
26882
|
-
access: "view"
|
|
26883
|
-
},
|
|
26884
|
-
"advancedNotifier.testRule": {
|
|
26885
|
-
capName: "advanced-notifier",
|
|
26886
|
-
capScope: "system",
|
|
26887
|
-
addonId: null,
|
|
26888
|
-
access: "create"
|
|
26889
|
-
},
|
|
26890
|
-
"advancedNotifier.upsertRule": {
|
|
26891
|
-
capName: "advanced-notifier",
|
|
26892
|
-
capScope: "system",
|
|
26893
|
-
addonId: null,
|
|
26894
|
-
access: "create"
|
|
26895
|
-
},
|
|
26896
27258
|
"alarmPanel.arm": {
|
|
26897
27259
|
capName: "alarm-panel",
|
|
26898
27260
|
capScope: "device",
|
|
@@ -29215,6 +29577,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
29215
29577
|
addonId: null,
|
|
29216
29578
|
access: "view"
|
|
29217
29579
|
},
|
|
29580
|
+
"notificationRules.getHistory": {
|
|
29581
|
+
capName: "notification-rules",
|
|
29582
|
+
capScope: "system",
|
|
29583
|
+
addonId: null,
|
|
29584
|
+
access: "view"
|
|
29585
|
+
},
|
|
29218
29586
|
"notificationRules.getRule": {
|
|
29219
29587
|
capName: "notification-rules",
|
|
29220
29588
|
capScope: "system",
|
|
@@ -31459,7 +31827,6 @@ var KNOWN_CAP_NAMES = [
|
|
|
31459
31827
|
"addon-widgets-source",
|
|
31460
31828
|
"addons",
|
|
31461
31829
|
"admin-ui",
|
|
31462
|
-
"advanced-notifier",
|
|
31463
31830
|
"alarm-panel",
|
|
31464
31831
|
"alerts",
|
|
31465
31832
|
"audio-analysis",
|
|
@@ -31635,7 +32002,6 @@ var SYSTEM_CAP_NAMES = [
|
|
|
31635
32002
|
"addon-widgets-source",
|
|
31636
32003
|
"addons",
|
|
31637
32004
|
"admin-ui",
|
|
31638
|
-
"advanced-notifier",
|
|
31639
32005
|
"alerts",
|
|
31640
32006
|
"audio-analyzer",
|
|
31641
32007
|
"audio-codec",
|
|
@@ -32648,7 +33014,10 @@ exports.MotionZoneRegionSchema = MotionZoneRegionSchema;
|
|
|
32648
33014
|
exports.MotionZoneStatusSchema = MotionZoneStatusSchema;
|
|
32649
33015
|
exports.MqttBrokerStatusSchema = StatusSchema;
|
|
32650
33016
|
exports.NC_CONDITION_CATALOG = NC_CONDITION_CATALOG;
|
|
33017
|
+
exports.NC_HISTORY_LIMIT_DEFAULT = NC_HISTORY_LIMIT_DEFAULT;
|
|
33018
|
+
exports.NC_HISTORY_LIMIT_MAX = NC_HISTORY_LIMIT_MAX;
|
|
32651
33019
|
exports.NC_MAX_PER_TRACK_IMMEDIATE = NC_MAX_PER_TRACK_IMMEDIATE;
|
|
33020
|
+
exports.NC_TAXONOMY = NC_TAXONOMY;
|
|
32652
33021
|
exports.NativeCropBboxSchema = NativeCropBboxSchema;
|
|
32653
33022
|
exports.NativeCropRefSchema = NativeCropRefSchema;
|
|
32654
33023
|
exports.NativeCropResultSchema = NativeCropResultSchema;
|
|
@@ -32659,7 +33028,13 @@ exports.NativeObjectDetectionStatusSchema = NativeObjectDetectionStatusSchema;
|
|
|
32659
33028
|
exports.NcConditionDescriptorSchema = NcConditionDescriptorSchema;
|
|
32660
33029
|
exports.NcConditionsSchema = NcConditionsSchema;
|
|
32661
33030
|
exports.NcDeliverySchema = NcDeliverySchema;
|
|
33031
|
+
exports.NcHistoryEntrySchema = NcHistoryEntrySchema;
|
|
33032
|
+
exports.NcHistoryFilterSchema = NcHistoryFilterSchema;
|
|
33033
|
+
exports.NcHistoryRecordKindSchema = NcHistoryRecordKindSchema;
|
|
33034
|
+
exports.NcHistoryStatusSchema = NcHistoryStatusSchema;
|
|
33035
|
+
exports.NcHistorySubjectSchema = NcHistorySubjectSchema;
|
|
32662
33036
|
exports.NcMediaPolicySchema = NcMediaPolicySchema;
|
|
33037
|
+
exports.NcOccupancyConditionSchema = NcOccupancyConditionSchema;
|
|
32663
33038
|
exports.NcPlateMatcherSchema = NcPlateMatcherSchema;
|
|
32664
33039
|
exports.NcRuleInputSchema = NcRuleInputSchema;
|
|
32665
33040
|
exports.NcRulePatchSchema = NcRulePatchSchema;
|
|
@@ -32667,6 +33042,8 @@ exports.NcRuleSchema = NcRuleSchema;
|
|
|
32667
33042
|
exports.NcRuleTargetSchema = NcRuleTargetSchema;
|
|
32668
33043
|
exports.NcScheduleSchema = NcScheduleSchema;
|
|
32669
33044
|
exports.NcScheduleWindowSchema = NcScheduleWindowSchema;
|
|
33045
|
+
exports.NcTaxonomyEntrySchema = NcTaxonomyEntrySchema;
|
|
33046
|
+
exports.NcTaxonomySchema = NcTaxonomySchema;
|
|
32670
33047
|
exports.NcTestResultSchema = NcTestResultSchema;
|
|
32671
33048
|
exports.NcThrottleSchema = NcThrottleSchema;
|
|
32672
33049
|
exports.NcZoneConditionSchema = NcZoneConditionSchema;
|
|
@@ -32675,8 +33052,6 @@ exports.NetworkAddressSchema = NetworkAddressSchema;
|
|
|
32675
33052
|
exports.NetworkEndpointSchema = NetworkEndpointSchema;
|
|
32676
33053
|
exports.NotificationActionSchema = NotificationActionSchema;
|
|
32677
33054
|
exports.NotificationFormatSchema = NotificationFormatSchema;
|
|
32678
|
-
exports.NotificationHistoryEntrySchema = NotificationHistoryEntrySchema;
|
|
32679
|
-
exports.NotificationRuleSchema = NotificationRuleSchema;
|
|
32680
33055
|
exports.NotificationSchema = NotificationSchema;
|
|
32681
33056
|
exports.NotifierStatusSchema = NotifierStatusSchema;
|
|
32682
33057
|
exports.NumericSensorStatusSchema = NumericSensorStatusSchema;
|
|
@@ -32737,6 +33112,7 @@ exports.PtzAutotrackSettingsSchema = PtzAutotrackSettingsSchema;
|
|
|
32737
33112
|
exports.PtzAutotrackStatusSchema = PtzAutotrackStatusSchema;
|
|
32738
33113
|
exports.PtzAutotrackTargetOptionSchema = PtzAutotrackTargetOptionSchema;
|
|
32739
33114
|
exports.PtzMoveCommandSchema = PtzMoveCommandSchema;
|
|
33115
|
+
exports.PtzOptionsSchema = PtzOptionsSchema;
|
|
32740
33116
|
exports.PtzPositionSchema = PtzPositionSchema;
|
|
32741
33117
|
exports.PtzPresetSchema = PtzPresetSchema;
|
|
32742
33118
|
exports.PtzStatusSchema = PtzStatusSchema;
|
|
@@ -32932,7 +33308,6 @@ exports.addonWidgetsCapability = addonWidgetsCapability;
|
|
|
32932
33308
|
exports.addonWidgetsSourceCapability = addonWidgetsSourceCapability;
|
|
32933
33309
|
exports.addonsCapability = addonsCapability;
|
|
32934
33310
|
exports.adminUiCapability = require_sleep.adminUiCapability;
|
|
32935
|
-
exports.advancedNotifierCapability = advancedNotifierCapability;
|
|
32936
33311
|
exports.airQualitySensorCapability = airQualitySensorCapability;
|
|
32937
33312
|
exports.alarmPanelCapability = alarmPanelCapability;
|
|
32938
33313
|
exports.alertsCapability = alertsCapability;
|
|
@@ -32960,6 +33335,7 @@ exports.brokerCapability = brokerCapability;
|
|
|
32960
33335
|
exports.buildAddonRouteProvider = buildAddonRouteProvider;
|
|
32961
33336
|
exports.buildEventKindDescriptor = buildEventKindDescriptor;
|
|
32962
33337
|
exports.buildModelVariantGroups = buildModelVariantGroups;
|
|
33338
|
+
exports.buildNcTaxonomy = buildNcTaxonomy;
|
|
32963
33339
|
exports.buildStreamParamsConfigSchema = buildStreamParamsConfigSchema;
|
|
32964
33340
|
exports.buttonCapability = buttonCapability;
|
|
32965
33341
|
exports.cameraCredentialsCapability = cameraCredentialsCapability;
|