@camstack/system 1.2.8 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon-runner.js +6 -6
- package/dist/addon-runner.mjs +6 -6
- package/dist/addon-utils.js +1 -1
- package/dist/addon-utils.mjs +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +29 -1
- package/dist/builtins/snapshot/index.mjs +29 -1
- package/dist/builtins/snapshot/snapshot.addon.d.ts +6 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +12 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +48 -7
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +48 -7
- package/dist/builtins/storage-orchestrator/storage-pressure-manager.d.ts +27 -0
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{custom-action-registry-BEXwC-oo.mjs → custom-action-registry-F__gp_VX.mjs} +1 -1
- package/dist/{custom-action-registry-vLYEFTtv.js → custom-action-registry-jY0NOZK8.js} +1 -1
- package/dist/{dist-CdgScQ3H.js → dist-BQOCTD5b.js} +1664 -1434
- package/dist/{dist-CxM20CkF.mjs → dist-DpKeSZel.mjs} +1659 -1435
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/kernel/custom-action-registry.d.ts +3 -3
- package/dist/kernel/transport/child-cap-protocol.d.ts +11 -1
- package/dist/{manifest-python-deps-CUHn5wqq.js → manifest-python-deps-1I7WdPDD.js} +5 -3
- package/dist/{manifest-python-deps-CcW0WpfS.mjs → manifest-python-deps-I2MGvDvo.mjs} +5 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-BLcNejAE.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -149,9 +149,6 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
149
149
|
EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
|
|
150
150
|
EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
|
|
151
151
|
EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
|
|
152
|
-
/** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
|
|
153
|
-
* thumb is a scrub gap the recorder's keyframe backfill covers. */
|
|
154
|
-
EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
|
|
155
152
|
/** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
|
|
156
153
|
* progress bar the client reconciles via `recordingExport.getExport`. */
|
|
157
154
|
EventCategory["RecordingExportProgress"] = "recording.export.progress";
|
|
@@ -4292,6 +4289,59 @@ for (const l of AUDIO_MACRO_LABELS) {
|
|
|
4292
4289
|
/** The complete taxonomy dictionary, keyed by kind. */
|
|
4293
4290
|
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
4294
4291
|
/**
|
|
4292
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
4293
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
4294
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
4295
|
+
* taxonomy surface (timeline, filters, event page).
|
|
4296
|
+
*
|
|
4297
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
4298
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
4299
|
+
* for the `classes` / `classesExclude` conditions.
|
|
4300
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
4301
|
+
* the same class picker, grouped under an Audio header.
|
|
4302
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
4303
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
4304
|
+
*
|
|
4305
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
4306
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
4307
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
4308
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
4309
|
+
*/
|
|
4310
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
4311
|
+
var NcTaxonomyEntrySchema = z.object({
|
|
4312
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
4313
|
+
kind: z.string(),
|
|
4314
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
4315
|
+
label: z.string(),
|
|
4316
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
4317
|
+
parentKind: z.string().nullable()
|
|
4318
|
+
});
|
|
4319
|
+
z.object({
|
|
4320
|
+
videoClasses: z.array(NcTaxonomyEntrySchema),
|
|
4321
|
+
audioKinds: z.array(NcTaxonomyEntrySchema),
|
|
4322
|
+
labels: z.array(NcTaxonomyEntrySchema)
|
|
4323
|
+
});
|
|
4324
|
+
function toEntry(kind, label, parentKind) {
|
|
4325
|
+
return {
|
|
4326
|
+
kind,
|
|
4327
|
+
label,
|
|
4328
|
+
parentKind
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
/**
|
|
4332
|
+
* Build the NC taxonomy from `EVENT_TAXONOMY`. Insertion order is preserved
|
|
4333
|
+
* (macros before their subs), which the client relies on for stable grouping.
|
|
4334
|
+
*/
|
|
4335
|
+
function buildNcTaxonomy() {
|
|
4336
|
+
const all = Object.values(EVENT_TAXONOMY);
|
|
4337
|
+
return {
|
|
4338
|
+
videoClasses: all.filter((e) => e.category === "detection").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
4339
|
+
audioKinds: all.filter((e) => e.category === "audio" && e.level === "sub").map((e) => toEntry(e.kind, e.label, e.parentKind)),
|
|
4340
|
+
labels: all.filter((e) => e.category === "sensor" || e.category === "control").map((e) => toEntry(e.kind, e.label, e.parentKind))
|
|
4341
|
+
};
|
|
4342
|
+
}
|
|
4343
|
+
Object.freeze(buildNcTaxonomy());
|
|
4344
|
+
/**
|
|
4295
4345
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
4296
4346
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
4297
4347
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -12427,106 +12477,6 @@ var addonWidgetsCapability = {
|
|
|
12427
12477
|
mode: "singleton",
|
|
12428
12478
|
methods: { listWidgets: method(z.void(), z.array(EnrichedWidgetMetadataSchema).readonly()) }
|
|
12429
12479
|
};
|
|
12430
|
-
var NotificationRuleConditionsSchema = z.object({
|
|
12431
|
-
deviceIds: z.array(z.number()).readonly().optional(),
|
|
12432
|
-
classNames: z.array(z.string()).readonly().optional(),
|
|
12433
|
-
zoneIds: z.array(z.string()).readonly().optional(),
|
|
12434
|
-
minConfidence: z.number().optional(),
|
|
12435
|
-
source: z.enum([
|
|
12436
|
-
"pipeline",
|
|
12437
|
-
"onboard",
|
|
12438
|
-
"any"
|
|
12439
|
-
]).optional(),
|
|
12440
|
-
schedule: z.object({
|
|
12441
|
-
days: z.array(z.number()).readonly(),
|
|
12442
|
-
startHour: z.number(),
|
|
12443
|
-
endHour: z.number()
|
|
12444
|
-
}).optional(),
|
|
12445
|
-
cooldownSeconds: z.number().optional(),
|
|
12446
|
-
minDwellSeconds: z.number().optional(),
|
|
12447
|
-
/** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
|
|
12448
|
-
* carrying a matching `data.eventType` string pass this condition. Rules without this field are
|
|
12449
|
-
* unaffected (back-compat). Distinct from `rule.eventTypes` which holds EventCategory strings. */
|
|
12450
|
-
eventTypeTokens: z.array(z.string()).readonly().optional(),
|
|
12451
|
-
/** Match detections whose CLIP image embedding is semantically similar to this free-text
|
|
12452
|
-
* description. Requires the embedding-encoder cap to have pre-warmed the text vector.
|
|
12453
|
-
* `minSimilarity` is the cosine similarity threshold in [0, 1]. */
|
|
12454
|
-
clipDescription: z.object({
|
|
12455
|
-
text: z.string().min(1),
|
|
12456
|
-
minSimilarity: z.number().min(0).max(1)
|
|
12457
|
-
}).optional(),
|
|
12458
|
-
/** Match events whose recognized-entity label (face identity name or plate
|
|
12459
|
-
* vehicle name, propagated onto `event.data.label`) is one of these values.
|
|
12460
|
-
* Empty/absent → unaffected (back-compat). Enables "notify me when <named
|
|
12461
|
-
* vehicle/person> is seen". */
|
|
12462
|
-
labels: z.array(z.string()).readonly().optional()
|
|
12463
|
-
});
|
|
12464
|
-
var NotificationRuleTemplateSchema = z.object({
|
|
12465
|
-
title: z.string(),
|
|
12466
|
-
body: z.string(),
|
|
12467
|
-
imageMode: z.enum([
|
|
12468
|
-
"crop",
|
|
12469
|
-
"annotated",
|
|
12470
|
-
"full",
|
|
12471
|
-
"none"
|
|
12472
|
-
])
|
|
12473
|
-
});
|
|
12474
|
-
var NotificationRuleSchema = z.object({
|
|
12475
|
-
id: z.string(),
|
|
12476
|
-
name: z.string(),
|
|
12477
|
-
enabled: z.boolean(),
|
|
12478
|
-
eventTypes: z.array(z.string()).readonly(),
|
|
12479
|
-
conditions: NotificationRuleConditionsSchema,
|
|
12480
|
-
outputs: z.array(z.string()).readonly(),
|
|
12481
|
-
template: NotificationRuleTemplateSchema.optional(),
|
|
12482
|
-
priority: z.enum([
|
|
12483
|
-
"low",
|
|
12484
|
-
"normal",
|
|
12485
|
-
"high",
|
|
12486
|
-
"critical"
|
|
12487
|
-
])
|
|
12488
|
-
});
|
|
12489
|
-
var NotificationTestResultSchema = z.object({
|
|
12490
|
-
ruleId: z.string(),
|
|
12491
|
-
eventId: z.string(),
|
|
12492
|
-
timestamp: z.number(),
|
|
12493
|
-
wouldFire: z.boolean(),
|
|
12494
|
-
reason: z.string().optional()
|
|
12495
|
-
});
|
|
12496
|
-
var NotificationHistoryEntrySchema = z.object({
|
|
12497
|
-
id: z.string(),
|
|
12498
|
-
ruleId: z.string(),
|
|
12499
|
-
ruleName: z.string(),
|
|
12500
|
-
eventId: z.string(),
|
|
12501
|
-
timestamp: z.number(),
|
|
12502
|
-
outputs: z.array(z.string()).readonly(),
|
|
12503
|
-
success: z.boolean(),
|
|
12504
|
-
error: z.string().optional(),
|
|
12505
|
-
deviceId: z.number().optional()
|
|
12506
|
-
});
|
|
12507
|
-
var NotificationHistoryFilterSchema = z.object({
|
|
12508
|
-
ruleId: z.string().optional(),
|
|
12509
|
-
deviceId: z.number().optional(),
|
|
12510
|
-
from: z.number().optional(),
|
|
12511
|
-
to: z.number().optional(),
|
|
12512
|
-
limit: z.number().optional()
|
|
12513
|
-
});
|
|
12514
|
-
var advancedNotifierCapability = {
|
|
12515
|
-
name: "advanced-notifier",
|
|
12516
|
-
scope: "system",
|
|
12517
|
-
mode: "singleton",
|
|
12518
|
-
internal: true,
|
|
12519
|
-
methods: {
|
|
12520
|
-
getRules: method(z.void(), z.object({ rules: z.array(NotificationRuleSchema).readonly() })),
|
|
12521
|
-
upsertRule: method(z.object({ rule: NotificationRuleSchema }), z.object({ success: z.literal(true) }), { kind: "mutation" }),
|
|
12522
|
-
deleteRule: method(z.object({ ruleId: z.string() }), z.object({ success: z.literal(true) }), { kind: "mutation" }),
|
|
12523
|
-
testRule: method(z.object({
|
|
12524
|
-
ruleId: z.string(),
|
|
12525
|
-
lookbackMinutes: z.number()
|
|
12526
|
-
}), z.object({ results: z.array(NotificationTestResultSchema).readonly() }), { kind: "mutation" }),
|
|
12527
|
-
getHistory: method(z.object({ filter: NotificationHistoryFilterSchema.optional() }), z.object({ entries: z.array(NotificationHistoryEntrySchema).readonly() }))
|
|
12528
|
-
}
|
|
12529
|
-
};
|
|
12530
12480
|
/**
|
|
12531
12481
|
* Alerts capability — collection-based internal alert system.
|
|
12532
12482
|
*
|
|
@@ -12827,117 +12777,6 @@ var authProviderCapability = {
|
|
|
12827
12777
|
mount: { kind: "skip" }
|
|
12828
12778
|
};
|
|
12829
12779
|
/**
|
|
12830
|
-
* `login-method` — collection cap through which auth addons contribute
|
|
12831
|
-
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
12832
|
-
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
12833
|
-
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
12834
|
-
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
12835
|
-
* procedure aggregates them for the unauthenticated login page.
|
|
12836
|
-
*
|
|
12837
|
-
* A contribution is a discriminated union on `kind`:
|
|
12838
|
-
*
|
|
12839
|
-
* - `redirect` — a declarative button. The login page renders a generic
|
|
12840
|
-
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
12841
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
12842
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
12843
|
-
* login page needs NO change.
|
|
12844
|
-
*
|
|
12845
|
-
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
12846
|
-
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
12847
|
-
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
12848
|
-
* mechanism kept for future use; no shipped addon uses it on the login
|
|
12849
|
-
* page (the passkey ceremony below runs natively in the shell instead).
|
|
12850
|
-
*
|
|
12851
|
-
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
12852
|
-
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
12853
|
-
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
12854
|
-
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
12855
|
-
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
12856
|
-
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
12857
|
-
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
12858
|
-
* decision.
|
|
12859
|
-
*
|
|
12860
|
-
* Every contribution carries a `stage`:
|
|
12861
|
-
* - `primary` — shown on the first credentials screen (OIDC /
|
|
12862
|
-
* magic-link buttons; a future usernameless passkey).
|
|
12863
|
-
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
12864
|
-
* returned `factors` (passkey-as-2FA today).
|
|
12865
|
-
*
|
|
12866
|
-
* `mount: skip` — the cap is read server-side by the core auth router
|
|
12867
|
-
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
12868
|
-
* tRPC router.
|
|
12869
|
-
*/
|
|
12870
|
-
/** When a login method renders in the two-phase login flow. */
|
|
12871
|
-
var LoginStageEnum = z.enum(["primary", "second-factor"]);
|
|
12872
|
-
/**
|
|
12873
|
-
* A declarative redirect button — the login page navigates to `startUrl`.
|
|
12874
|
-
* OIDC and magic-link contribute this; a future SSO addon does too.
|
|
12875
|
-
*/
|
|
12876
|
-
var RedirectLoginMethodSchema = z.object({
|
|
12877
|
-
kind: z.literal("redirect"),
|
|
12878
|
-
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
12879
|
-
id: z.string(),
|
|
12880
|
-
/** Operator-facing button label. */
|
|
12881
|
-
label: z.string(),
|
|
12882
|
-
/** lucide-react icon name. */
|
|
12883
|
-
icon: z.string().optional(),
|
|
12884
|
-
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
12885
|
-
startUrl: z.string(),
|
|
12886
|
-
stage: LoginStageEnum
|
|
12887
|
-
});
|
|
12888
|
-
/**
|
|
12889
|
-
* A Module-Federation widget the login page mounts for an in-page
|
|
12890
|
-
* ceremony. `bundle` + `addonId` let `auth.listLoginMethods` stamp a
|
|
12891
|
-
* public `bundleUrl`; `remote` is the MF descriptor `loadRemoteBundle`
|
|
12892
|
-
* consumes. No `bundleUrl` here — it is server-stamped on the public
|
|
12893
|
-
* output so the addon never encodes the static-route scheme.
|
|
12894
|
-
*/
|
|
12895
|
-
var WidgetLoginMethodSchema = z.object({
|
|
12896
|
-
kind: z.literal("widget"),
|
|
12897
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
12898
|
-
id: z.string(),
|
|
12899
|
-
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
12900
|
-
addonId: z.string(),
|
|
12901
|
-
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
12902
|
-
bundle: z.string(),
|
|
12903
|
-
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
12904
|
-
remote: WidgetRemoteSchema,
|
|
12905
|
-
stage: LoginStageEnum
|
|
12906
|
-
});
|
|
12907
|
-
/**
|
|
12908
|
-
* A declarative WebAuthn ceremony the shell renders natively (no remote
|
|
12909
|
-
* code). Carries the addon's EFFECTIVE `rpId`/`origin` so the shell can
|
|
12910
|
-
* gate visibility (IP-literal origin, hostname/rpId mismatch) before ever
|
|
12911
|
-
* showing the button — the contribution itself stays unconditional.
|
|
12912
|
-
*/
|
|
12913
|
-
var PasskeyLoginMethodSchema = z.object({
|
|
12914
|
-
kind: z.literal("passkey"),
|
|
12915
|
-
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
12916
|
-
id: z.string(),
|
|
12917
|
-
/** Operator-facing button label. */
|
|
12918
|
-
label: z.string(),
|
|
12919
|
-
stage: LoginStageEnum,
|
|
12920
|
-
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
12921
|
-
rpId: z.string(),
|
|
12922
|
-
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
12923
|
-
origin: z.string().nullable()
|
|
12924
|
-
});
|
|
12925
|
-
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
12926
|
-
var LoginMethodContributionSchema = z.discriminatedUnion("kind", [
|
|
12927
|
-
RedirectLoginMethodSchema,
|
|
12928
|
-
WidgetLoginMethodSchema,
|
|
12929
|
-
PasskeyLoginMethodSchema
|
|
12930
|
-
]);
|
|
12931
|
-
var loginMethodCapability = {
|
|
12932
|
-
name: "login-method",
|
|
12933
|
-
scope: "system",
|
|
12934
|
-
mode: "collection",
|
|
12935
|
-
internal: true,
|
|
12936
|
-
methods: { getLoginMethods: method(z.void(), z.array(LoginMethodContributionSchema).readonly()) },
|
|
12937
|
-
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
12938
|
-
mount: { kind: "skip" }
|
|
12939
|
-
};
|
|
12940
|
-
/**
|
|
12941
12780
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
12942
12781
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
12943
12782
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -15077,1269 +14916,1658 @@ var filesystemBrowseCapability = {
|
|
|
15077
14916
|
})
|
|
15078
14917
|
}
|
|
15079
14918
|
};
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
14919
|
+
/**
|
|
14920
|
+
* Shared LLM generate contracts — imported by BOTH `llm.cap.ts` (consumer
|
|
14921
|
+
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
14922
|
+
* caps stay wire-compatible without a circular cap→cap import.
|
|
14923
|
+
*
|
|
14924
|
+
* Errors are a discriminated-union RESULT, never thrown: the shape survives
|
|
14925
|
+
* every transport tier structurally, and failed calls still write usage rows.
|
|
14926
|
+
* Token counts only in v1 — no costUsd (operator decision, 2026-07-15).
|
|
14927
|
+
*/
|
|
14928
|
+
var LlmUsageSchema = z.object({
|
|
14929
|
+
inputTokens: z.number(),
|
|
14930
|
+
outputTokens: z.number()
|
|
14931
|
+
});
|
|
14932
|
+
var LlmErrorCodeSchema = z.enum([
|
|
14933
|
+
"timeout",
|
|
14934
|
+
"rate-limited",
|
|
14935
|
+
"auth",
|
|
14936
|
+
"refusal",
|
|
14937
|
+
"bad-request",
|
|
14938
|
+
"unavailable",
|
|
14939
|
+
"no-profile",
|
|
14940
|
+
"budget-exceeded",
|
|
14941
|
+
"adapter-error"
|
|
15085
14942
|
]);
|
|
15086
|
-
var
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
14943
|
+
var LlmGenerateOkSchema = z.object({
|
|
14944
|
+
ok: z.literal(true),
|
|
14945
|
+
text: z.string(),
|
|
14946
|
+
model: z.string(),
|
|
14947
|
+
usage: LlmUsageSchema,
|
|
14948
|
+
truncated: z.boolean(),
|
|
14949
|
+
latencyMs: z.number()
|
|
15093
14950
|
});
|
|
15094
|
-
var
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
|
|
15099
|
-
methods: {
|
|
15100
|
-
write: method(LogEntrySchema, z.void(), { kind: "mutation" }),
|
|
15101
|
-
query: method(z.object({
|
|
15102
|
-
scope: z.array(z.string()).optional(),
|
|
15103
|
-
level: LogLevelSchema.optional(),
|
|
15104
|
-
since: z.date().optional(),
|
|
15105
|
-
until: z.date().optional(),
|
|
15106
|
-
limit: z.number().optional(),
|
|
15107
|
-
tags: z.record(z.string(), z.string()).optional()
|
|
15108
|
-
}), z.array(LogEntrySchema).readonly())
|
|
15109
|
-
},
|
|
15110
|
-
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
15111
|
-
mount: { kind: "skip" }
|
|
15112
|
-
};
|
|
15113
|
-
var CpuBreakdownSchema = z.object({
|
|
15114
|
-
total: z.number(),
|
|
15115
|
-
user: z.number(),
|
|
15116
|
-
system: z.number(),
|
|
15117
|
-
irq: z.number(),
|
|
15118
|
-
nice: z.number(),
|
|
15119
|
-
loadAvg: z.tuple([
|
|
15120
|
-
z.number(),
|
|
15121
|
-
z.number(),
|
|
15122
|
-
z.number()
|
|
15123
|
-
]),
|
|
15124
|
-
cores: z.number()
|
|
14951
|
+
var LlmGenerateErrSchema = z.object({
|
|
14952
|
+
ok: z.literal(false),
|
|
14953
|
+
code: LlmErrorCodeSchema,
|
|
14954
|
+
message: z.string(),
|
|
14955
|
+
retryAfterMs: z.number().optional()
|
|
15125
14956
|
});
|
|
15126
|
-
var
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
readBytes: z.number(),
|
|
15136
|
-
writeBytes: z.number(),
|
|
15137
|
-
readOps: z.number(),
|
|
15138
|
-
writeOps: z.number(),
|
|
15139
|
-
timestampMs: z.number()
|
|
15140
|
-
});
|
|
15141
|
-
var NetworkIoSnapshotSchema = z.object({
|
|
15142
|
-
rxBytes: z.number(),
|
|
15143
|
-
txBytes: z.number(),
|
|
15144
|
-
rxPackets: z.number(),
|
|
15145
|
-
txPackets: z.number(),
|
|
15146
|
-
rxErrors: z.number(),
|
|
15147
|
-
txErrors: z.number(),
|
|
15148
|
-
timestampMs: z.number()
|
|
15149
|
-
});
|
|
15150
|
-
var MetricsGpuInfoSchema = z.object({
|
|
15151
|
-
utilization: z.number(),
|
|
15152
|
-
model: z.string(),
|
|
15153
|
-
memoryUsedBytes: z.number(),
|
|
15154
|
-
memoryTotalBytes: z.number(),
|
|
15155
|
-
temperature: z.number().nullable()
|
|
15156
|
-
});
|
|
15157
|
-
var ProcessResourceInfoSchema = z.object({
|
|
15158
|
-
openFds: z.number(),
|
|
15159
|
-
threadCount: z.number(),
|
|
15160
|
-
activeHandles: z.number(),
|
|
15161
|
-
activeRequests: z.number()
|
|
15162
|
-
});
|
|
15163
|
-
var PressureAvgsSchema = z.object({
|
|
15164
|
-
avg10: z.number(),
|
|
15165
|
-
avg60: z.number(),
|
|
15166
|
-
avg300: z.number()
|
|
14957
|
+
var LlmGenerateResultSchema = z.discriminatedUnion("ok", [LlmGenerateOkSchema, LlmGenerateErrSchema]);
|
|
14958
|
+
/**
|
|
14959
|
+
* `Uint8Array` is the sanctioned binary convention — superjson + the UDS
|
|
14960
|
+
* MsgPack channel round-trip typed arrays (embedding-encoder.cap.ts:29,
|
|
14961
|
+
* notification-output.cap.ts:27-31 precedents).
|
|
14962
|
+
*/
|
|
14963
|
+
var LlmImageSchema = z.object({
|
|
14964
|
+
bytes: z.instanceof(Uint8Array),
|
|
14965
|
+
mimeType: z.string()
|
|
15167
14966
|
});
|
|
15168
|
-
var
|
|
15169
|
-
|
|
15170
|
-
|
|
14967
|
+
var LlmGenerateBaseInputSchema = z.object({
|
|
14968
|
+
/** Collection routing (the notification-output posture). */
|
|
14969
|
+
addonId: z.string().optional(),
|
|
14970
|
+
/** Explicit profile; else the resolution chain (spec §3). */
|
|
14971
|
+
profileId: z.string().optional(),
|
|
14972
|
+
/** MANDATORY usage tag: 'ai-summary', 'notifier-rules', 'adhoc-ui', … */
|
|
14973
|
+
consumer: z.string(),
|
|
14974
|
+
system: z.string().optional(),
|
|
14975
|
+
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
14976
|
+
prompt: z.string(),
|
|
14977
|
+
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
14978
|
+
jsonSchema: z.record(z.string(), z.unknown()).optional(),
|
|
14979
|
+
/** Per-call override of the profile default. */
|
|
14980
|
+
maxTokens: z.number().int().positive().optional(),
|
|
14981
|
+
temperature: z.number().optional()
|
|
15171
14982
|
});
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
14983
|
+
/**
|
|
14984
|
+
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
14985
|
+
* on EVERY node where `addon-ai` is installed; the hub `llm` provider reaches
|
|
14986
|
+
* a specific node's runtime with `nodePin(profile.runtime.nodeId)` — normal
|
|
14987
|
+
* cap routing, zero bespoke plumbing. `internal: true`: the operator reaches
|
|
14988
|
+
* this only through the `llm` cap's methods.
|
|
14989
|
+
*
|
|
14990
|
+
* One running llama-server child per node in v1 (models are RAM-heavy).
|
|
14991
|
+
* Resource ceiling = llama-server flags + idleStopMinutes ONLY (no RSS
|
|
14992
|
+
* watchdog — operator decision #3).
|
|
14993
|
+
*/
|
|
14994
|
+
var ManagedModelRefSchema = z.discriminatedUnion("kind", [
|
|
14995
|
+
z.object({
|
|
14996
|
+
kind: z.literal("catalog"),
|
|
14997
|
+
catalogId: z.string()
|
|
15182
14998
|
}),
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
*/
|
|
15205
|
-
|
|
15206
|
-
/**
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
sharedBytes: z.number().optional()
|
|
14999
|
+
z.object({
|
|
15000
|
+
kind: z.literal("url"),
|
|
15001
|
+
url: z.string(),
|
|
15002
|
+
sha256: z.string().optional()
|
|
15003
|
+
}),
|
|
15004
|
+
z.object({
|
|
15005
|
+
kind: z.literal("path"),
|
|
15006
|
+
path: z.string()
|
|
15007
|
+
})
|
|
15008
|
+
]);
|
|
15009
|
+
var ManagedRuntimeConfigSchema = z.object({
|
|
15010
|
+
/** WHERE the runtime lives — hub or any agent. */
|
|
15011
|
+
nodeId: z.string(),
|
|
15012
|
+
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
15013
|
+
engine: z.enum(["llama-cpp"]),
|
|
15014
|
+
model: ManagedModelRefSchema,
|
|
15015
|
+
contextSize: z.number().int().default(4096),
|
|
15016
|
+
/** 0 = CPU-only. */
|
|
15017
|
+
gpuLayers: z.number().int().default(0),
|
|
15018
|
+
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
15019
|
+
threads: z.number().int().optional(),
|
|
15020
|
+
/** Concurrent slots. */
|
|
15021
|
+
parallel: z.number().int().default(1),
|
|
15022
|
+
/** Else lazy: first generate boots it. */
|
|
15023
|
+
autoStart: z.boolean().default(false),
|
|
15024
|
+
/** 0 = never; frees RAM after quiet periods. */
|
|
15025
|
+
idleStopMinutes: z.number().int().default(30)
|
|
15211
15026
|
});
|
|
15212
|
-
var
|
|
15213
|
-
|
|
15027
|
+
var LlmRuntimeStatusSchema = z.object({
|
|
15028
|
+
/** Status is ALWAYS node-qualified. */
|
|
15214
15029
|
nodeId: z.string(),
|
|
15215
|
-
role: z.enum(["hub", "worker"]),
|
|
15216
|
-
pid: z.number(),
|
|
15217
15030
|
state: z.enum([
|
|
15218
|
-
"starting",
|
|
15219
|
-
"running",
|
|
15220
|
-
"stopping",
|
|
15221
15031
|
"stopped",
|
|
15222
|
-
"
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
pid: z.number(),
|
|
15228
|
-
ppid: z.number(),
|
|
15229
|
-
pgid: z.number(),
|
|
15230
|
-
classification: z.enum([
|
|
15231
|
-
"root",
|
|
15232
|
-
"managed",
|
|
15233
|
-
"system",
|
|
15234
|
-
"ghost"
|
|
15032
|
+
"downloading",
|
|
15033
|
+
"starting",
|
|
15034
|
+
"ready",
|
|
15035
|
+
"crashed",
|
|
15036
|
+
"failed"
|
|
15235
15037
|
]),
|
|
15236
|
-
/** `$process` addon binding when `managed`, else null. */
|
|
15237
|
-
addonId: z.string().nullable(),
|
|
15238
|
-
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15239
|
-
nodeId: z.string().nullable(),
|
|
15240
|
-
/** Truncated command line. */
|
|
15241
|
-
command: z.string(),
|
|
15242
|
-
cpuPercent: z.number(),
|
|
15243
|
-
memoryRssBytes: z.number(),
|
|
15244
|
-
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15245
|
-
uptimeSec: z.number(),
|
|
15246
|
-
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15247
|
-
orphaned: z.boolean()
|
|
15248
|
-
});
|
|
15249
|
-
var KillProcessInputSchema = z.object({
|
|
15250
|
-
pid: z.number(),
|
|
15251
|
-
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15252
|
-
force: z.boolean().optional()
|
|
15253
|
-
});
|
|
15254
|
-
var KillProcessResultSchema = z.object({
|
|
15255
|
-
success: z.boolean(),
|
|
15256
|
-
reason: z.string().optional(),
|
|
15257
|
-
signal: z.enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15258
|
-
});
|
|
15259
|
-
var DumpHeapSnapshotInputSchema = z.object({
|
|
15260
|
-
/** The addon whose runner should dump a heap snapshot. */
|
|
15261
|
-
addonId: z.string() });
|
|
15262
|
-
var DumpHeapSnapshotResultSchema = z.object({
|
|
15263
|
-
success: z.boolean(),
|
|
15264
|
-
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15265
|
-
path: z.string().optional(),
|
|
15266
|
-
/** Process pid that was signalled. */
|
|
15267
15038
|
pid: z.number().optional(),
|
|
15268
|
-
|
|
15039
|
+
port: z.number().optional(),
|
|
15040
|
+
modelPath: z.string().optional(),
|
|
15041
|
+
modelId: z.string().optional(),
|
|
15042
|
+
downloadProgress: z.number().min(0).max(1).optional(),
|
|
15043
|
+
lastError: z.string().optional(),
|
|
15044
|
+
crashesInWindow: z.number(),
|
|
15045
|
+
/** Child RSS (sampled best-effort). */
|
|
15046
|
+
memoryBytes: z.number().optional(),
|
|
15047
|
+
vramBytes: z.number().optional()
|
|
15269
15048
|
});
|
|
15270
|
-
var
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
diskPercent: z.number().optional(),
|
|
15276
|
-
temperature: z.number().optional(),
|
|
15277
|
-
gpuPercent: z.number().optional(),
|
|
15278
|
-
gpuMemoryPercent: z.number().optional()
|
|
15049
|
+
var LlmNodeModelSchema = z.object({
|
|
15050
|
+
file: z.string(),
|
|
15051
|
+
sizeBytes: z.number(),
|
|
15052
|
+
catalogId: z.string().optional(),
|
|
15053
|
+
installedAt: z.number().optional()
|
|
15279
15054
|
});
|
|
15280
|
-
var
|
|
15281
|
-
|
|
15055
|
+
var LlmRuntimeDiskUsageSchema = z.object({
|
|
15056
|
+
nodeId: z.string(),
|
|
15057
|
+
modelsBytes: z.number(),
|
|
15058
|
+
freeBytes: z.number().optional()
|
|
15059
|
+
});
|
|
15060
|
+
var llmRuntimeCapability = {
|
|
15061
|
+
name: "llm-runtime",
|
|
15282
15062
|
scope: "system",
|
|
15283
15063
|
mode: "singleton",
|
|
15064
|
+
internal: true,
|
|
15284
15065
|
methods: {
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
getDiskSpace: method(z.object({ dirPath: z.string() }), DiskSpaceInfoSchema),
|
|
15293
|
-
/** GPU info (null if unavailable). */
|
|
15294
|
-
getGpuInfo: method(z.void(), MetricsGpuInfoSchema.nullable()),
|
|
15295
|
-
/** CPU temperature in °C (null if unavailable). */
|
|
15296
|
-
getCpuTemperature: method(z.void(), z.number().nullable()),
|
|
15297
|
-
/** Per-PID resource stats. Missing/dead PIDs are omitted from the result. */
|
|
15298
|
-
getProcessStats: method(z.object({ pids: z.array(z.number()) }), z.array(PidResourceStatsSchema)),
|
|
15299
|
-
/**
|
|
15300
|
-
* List addon instances known to this node — one entry per forked worker
|
|
15301
|
-
* plus a synthetic 'hub' entry representing the local hub process.
|
|
15302
|
-
* Used by benchmarks/observability to detect whether a given addon runs
|
|
15303
|
-
* in its own process (measurable independently) or inline with the hub.
|
|
15304
|
-
*/
|
|
15305
|
-
listAddonInstances: method(z.void(), z.array(AddonInstanceSchema).readonly()),
|
|
15306
|
-
/**
|
|
15307
|
-
* Resource stats for the process hosting the given addon.
|
|
15308
|
-
* Returns null when the addon runs in-process on the hub (can't measure
|
|
15309
|
-
* independently — caller should detect via listAddonInstances). Returns
|
|
15310
|
-
* hub process stats for addonId '$hub'.
|
|
15311
|
-
*/
|
|
15312
|
-
getAddonStats: method(z.object({ addonId: z.string() }), PidResourceStatsSchema.nullable()),
|
|
15313
|
-
/**
|
|
15314
|
-
* Snapshot of every camstack-related process on this node with a
|
|
15315
|
-
* ghost/managed/root classification. Powers the Cluster → Agent →
|
|
15316
|
-
* Processes tab: cross-references `$process.list` against a `ps` scan
|
|
15317
|
-
* so orphaned trees (PPID=1) or unknown children show up as `ghost`
|
|
15318
|
-
* and can be killed from the UI.
|
|
15319
|
-
*/
|
|
15320
|
-
listNodeProcesses: method(z.void(), z.array(NodeProcessSchema).readonly()),
|
|
15321
|
-
/**
|
|
15322
|
-
* Send SIGTERM (or SIGKILL when `force`) to a pid inside this node's
|
|
15323
|
-
* process tree. The provider refuses pids that aren't in the live
|
|
15324
|
-
* `listNodeProcesses()` snapshot — callers can't use this endpoint
|
|
15325
|
-
* to kill arbitrary system processes.
|
|
15326
|
-
*/
|
|
15327
|
-
killProcess: method(KillProcessInputSchema, KillProcessResultSchema, {
|
|
15066
|
+
complete: method(LlmGenerateBaseInputSchema.extend({
|
|
15067
|
+
images: z.array(LlmImageSchema).optional(),
|
|
15068
|
+
runtime: ManagedRuntimeConfigSchema,
|
|
15069
|
+
/** The managed profile's timeout, threaded by the hub provider. */
|
|
15070
|
+
timeoutMs: z.number().int().positive().optional()
|
|
15071
|
+
}), LlmGenerateResultSchema, { kind: "mutation" }),
|
|
15072
|
+
ensureStarted: method(z.object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
|
|
15328
15073
|
kind: "mutation",
|
|
15329
15074
|
auth: "admin"
|
|
15330
15075
|
}),
|
|
15331
|
-
|
|
15332
|
-
* Tell the addon's forked runner to write a V8 heap snapshot to disk (via
|
|
15333
|
-
* SIGUSR2 — the runner's diagnostic handler). Also logs its
|
|
15334
|
-
* `process.memoryUsage()` + heap-space breakdown. Refuses pids not in the
|
|
15335
|
-
* live `listNodeProcesses()` snapshot. Use for deep per-addon memory
|
|
15336
|
-
* attribution; copy the returned path off the node to analyze.
|
|
15337
|
-
*/
|
|
15338
|
-
dumpHeapSnapshot: method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
15076
|
+
stop: method(z.object({}), z.void(), {
|
|
15339
15077
|
kind: "mutation",
|
|
15340
15078
|
auth: "admin"
|
|
15341
|
-
})
|
|
15079
|
+
}),
|
|
15080
|
+
status: method(z.object({}), LlmRuntimeStatusSchema),
|
|
15081
|
+
installModel: method(z.object({ model: ManagedModelRefSchema }), z.void(), {
|
|
15082
|
+
kind: "mutation",
|
|
15083
|
+
auth: "admin"
|
|
15084
|
+
}),
|
|
15085
|
+
deleteModel: method(z.object({ file: z.string() }), z.void(), {
|
|
15086
|
+
kind: "mutation",
|
|
15087
|
+
auth: "admin"
|
|
15088
|
+
}),
|
|
15089
|
+
listLocalModels: method(z.object({}), z.array(LlmNodeModelSchema)),
|
|
15090
|
+
getDiskUsage: method(z.object({}), LlmRuntimeDiskUsageSchema)
|
|
15342
15091
|
}
|
|
15343
15092
|
};
|
|
15344
|
-
var modelConvertCapability = {
|
|
15345
|
-
name: "model-convert",
|
|
15346
|
-
scope: "system",
|
|
15347
|
-
mode: "singleton",
|
|
15348
|
-
internal: true,
|
|
15349
|
-
methods: { convert: method(z.object({
|
|
15350
|
-
sourceUrl: z.string(),
|
|
15351
|
-
metadata: ModelConvertMetadataSchema,
|
|
15352
|
-
targets: z.array(ConvertTargetSchema).min(1).readonly(),
|
|
15353
|
-
calibrationRef: z.string().optional(),
|
|
15354
|
-
sessionId: z.string().optional()
|
|
15355
|
-
}), ConvertResultSchema, {
|
|
15356
|
-
kind: "mutation",
|
|
15357
|
-
auth: "admin",
|
|
15358
|
-
timeoutMs: 6e5
|
|
15359
|
-
}) }
|
|
15360
|
-
};
|
|
15361
|
-
var modelDistributorCapability = {
|
|
15362
|
-
name: "model-distributor",
|
|
15363
|
-
scope: "system",
|
|
15364
|
-
mode: "singleton",
|
|
15365
|
-
internal: true,
|
|
15366
|
-
methods: { distributeModel: method(z.object({
|
|
15367
|
-
nodeId: z.string(),
|
|
15368
|
-
modelId: z.string(),
|
|
15369
|
-
format: z.enum(MODEL_FORMATS),
|
|
15370
|
-
entry: ModelCatalogEntrySchema
|
|
15371
|
-
}), z.object({
|
|
15372
|
-
ok: z.boolean(),
|
|
15373
|
-
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15374
|
-
sha256: z.string(),
|
|
15375
|
-
bytes: z.number(),
|
|
15376
|
-
/** The target node's modelsDir the artifact landed in. */
|
|
15377
|
-
path: z.string()
|
|
15378
|
-
}), {
|
|
15379
|
-
kind: "mutation",
|
|
15380
|
-
auth: "admin"
|
|
15381
|
-
}) }
|
|
15382
|
-
};
|
|
15383
|
-
/**
|
|
15384
|
-
* `mqtt-broker` — broker-registry cap.
|
|
15385
|
-
*
|
|
15386
|
-
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15387
|
-
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15388
|
-
* and (b) the connection details a consumer addon needs to spin up
|
|
15389
|
-
* its OWN `mqtt.js` client.
|
|
15390
|
-
*
|
|
15391
|
-
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15392
|
-
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15393
|
-
* refcount bookkeeping that addons would rather own themselves. The
|
|
15394
|
-
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15395
|
-
* features anyway — give it the connection config, get out of the way.
|
|
15396
|
-
*
|
|
15397
|
-
* Consumer flow:
|
|
15398
|
-
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15399
|
-
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15400
|
-
* client.subscribe('zigbee2mqtt/+')
|
|
15401
|
-
*
|
|
15402
|
-
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15403
|
-
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15404
|
-
* broker in the registry — its lifecycle is owned by the addon that
|
|
15405
|
-
* spawned it.
|
|
15406
|
-
*/
|
|
15407
|
-
var BrokerKindSchema = z.enum(["external", "embedded"]);
|
|
15408
15093
|
/**
|
|
15409
|
-
*
|
|
15094
|
+
* `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
|
|
15095
|
+
* methods concat-fan across providers; single-row methods route to ONE
|
|
15096
|
+
* provider by the `addonId` in the call input (the notification-output
|
|
15097
|
+
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
15098
|
+
* (hub-placed); the cap stays open for future providers.
|
|
15410
15099
|
*
|
|
15411
|
-
*
|
|
15412
|
-
*
|
|
15413
|
-
*
|
|
15414
|
-
* - `unreachable` — TCP connect timed out / refused
|
|
15415
|
-
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15100
|
+
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
15101
|
+
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
15102
|
+
* write; a stored key NEVER round-trips to a client.
|
|
15416
15103
|
*/
|
|
15417
|
-
var
|
|
15418
|
-
"
|
|
15419
|
-
"
|
|
15420
|
-
"
|
|
15421
|
-
"
|
|
15422
|
-
"
|
|
15104
|
+
var LlmProfileKindSchema = z.enum([
|
|
15105
|
+
"openai-compatible",
|
|
15106
|
+
"openai",
|
|
15107
|
+
"anthropic",
|
|
15108
|
+
"google",
|
|
15109
|
+
"managed-local"
|
|
15423
15110
|
]);
|
|
15424
|
-
var
|
|
15111
|
+
var LlmProfileSchema = z.object({
|
|
15425
15112
|
id: z.string(),
|
|
15426
15113
|
name: z.string(),
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15114
|
+
kind: LlmProfileKindSchema,
|
|
15115
|
+
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
15116
|
+
addonId: z.string(),
|
|
15117
|
+
enabled: z.boolean(),
|
|
15118
|
+
/** Vendor model id, or the managed runtime's loaded model. */
|
|
15119
|
+
model: z.string(),
|
|
15120
|
+
/** Required for openai-compatible; override for cloud kinds. */
|
|
15121
|
+
baseUrl: z.string().optional(),
|
|
15122
|
+
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
15123
|
+
apiKey: z.string().optional(),
|
|
15124
|
+
supportsVision: z.boolean(),
|
|
15125
|
+
temperature: z.number().min(0).max(2).optional(),
|
|
15126
|
+
maxTokens: z.number().int().positive().optional(),
|
|
15127
|
+
timeoutMs: z.number().int().positive().default(6e4),
|
|
15128
|
+
extraHeaders: z.record(z.string(), z.string()).optional(),
|
|
15129
|
+
/** kind === 'managed-local' only (spec §4). */
|
|
15130
|
+
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15436
15131
|
});
|
|
15437
|
-
/**
|
|
15438
|
-
*
|
|
15439
|
-
*
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15449
|
-
* with its own discriminator (addon id, instance id) so reconnects
|
|
15450
|
-
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15451
|
-
* broker).
|
|
15452
|
-
*/
|
|
15453
|
-
clientIdPrefix: z.string().optional()
|
|
15132
|
+
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
15133
|
+
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
15134
|
+
* notification-output.cap.ts:151); the exported TS type re-tightens it. */
|
|
15135
|
+
var ConfigSchemaPassthrough$1 = z.unknown();
|
|
15136
|
+
var LlmProfileKindDescriptorSchema = z.object({
|
|
15137
|
+
kind: LlmProfileKindSchema,
|
|
15138
|
+
label: z.string(),
|
|
15139
|
+
icon: z.string(),
|
|
15140
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15141
|
+
addonId: z.string(),
|
|
15142
|
+
configSchema: ConfigSchemaPassthrough$1
|
|
15454
15143
|
});
|
|
15455
|
-
var
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
password: z.string().optional(),
|
|
15460
|
-
clientIdPrefix: z.string().optional()
|
|
15144
|
+
var LlmDefaultSelectorSchema = z.union([z.object({ consumer: z.string() }), z.object({ purpose: z.enum(["text", "vision"]) })]);
|
|
15145
|
+
var LlmDefaultSchema = z.object({
|
|
15146
|
+
selector: LlmDefaultSelectorSchema,
|
|
15147
|
+
profileId: z.string()
|
|
15461
15148
|
});
|
|
15462
|
-
|
|
15463
|
-
var
|
|
15464
|
-
|
|
15465
|
-
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15474
|
-
allowAnonymous: z.boolean().default(false),
|
|
15475
|
-
/** Optional shared username/password for clients. */
|
|
15476
|
-
username: z.string().optional(),
|
|
15477
|
-
password: z.string().optional()
|
|
15149
|
+
/** Server-side rollup row — getUsage never dumps raw call rows (spec §6). */
|
|
15150
|
+
var LlmUsageRollupSchema = z.object({
|
|
15151
|
+
day: z.string(),
|
|
15152
|
+
consumer: z.string(),
|
|
15153
|
+
profileId: z.string(),
|
|
15154
|
+
calls: z.number(),
|
|
15155
|
+
okCalls: z.number(),
|
|
15156
|
+
errorCalls: z.number(),
|
|
15157
|
+
inputTokens: z.number(),
|
|
15158
|
+
outputTokens: z.number(),
|
|
15159
|
+
avgLatencyMs: z.number()
|
|
15478
15160
|
});
|
|
15479
|
-
|
|
15161
|
+
/** LLM-facing view over the reused ModelCatalogEntry mechanism (spec §4.2). */
|
|
15162
|
+
var ManagedModelCatalogEntrySchema = z.object({
|
|
15480
15163
|
id: z.string(),
|
|
15481
|
-
|
|
15164
|
+
label: z.string(),
|
|
15165
|
+
family: z.string(),
|
|
15166
|
+
purpose: z.enum(["text", "vision"]),
|
|
15167
|
+
url: z.string(),
|
|
15168
|
+
sha256: z.string(),
|
|
15169
|
+
sizeBytes: z.number(),
|
|
15170
|
+
quantization: z.string(),
|
|
15171
|
+
/** Load-time guidance shown in the picker. */
|
|
15172
|
+
minRamBytes: z.number(),
|
|
15173
|
+
contextSizeDefault: z.number().int(),
|
|
15174
|
+
/** Vision models: companion projector file. */
|
|
15175
|
+
mmprojUrl: z.string().optional()
|
|
15482
15176
|
});
|
|
15483
|
-
var
|
|
15484
|
-
|
|
15485
|
-
|
|
15177
|
+
var LlmRuntimeNodeSchema = z.object({
|
|
15178
|
+
nodeId: z.string(),
|
|
15179
|
+
reachable: z.boolean(),
|
|
15180
|
+
status: LlmRuntimeStatusSchema.optional(),
|
|
15181
|
+
disk: LlmRuntimeDiskUsageSchema.optional(),
|
|
15182
|
+
error: z.string().optional()
|
|
15486
15183
|
});
|
|
15487
|
-
var
|
|
15488
|
-
|
|
15184
|
+
var GenerateVisionInputSchema = LlmGenerateBaseInputSchema.extend({ images: z.array(LlmImageSchema).min(1) });
|
|
15185
|
+
var ProfileRefInputSchema = z.object({
|
|
15186
|
+
addonId: z.string(),
|
|
15187
|
+
profileId: z.string()
|
|
15188
|
+
});
|
|
15189
|
+
var llmCapability = {
|
|
15190
|
+
name: "llm",
|
|
15489
15191
|
scope: "system",
|
|
15490
15192
|
mode: "collection",
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
},
|
|
15193
|
+
internal: false,
|
|
15194
|
+
providerKind: "ai",
|
|
15195
|
+
/** `nodeId` inputs below are DATA (the hub provider pins itself), never routing. */
|
|
15196
|
+
nodeIdMode: "data",
|
|
15496
15197
|
methods: {
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
|
|
15504
|
-
|
|
15198
|
+
generate: method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
|
|
15199
|
+
generateVision: method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }),
|
|
15200
|
+
listProfileKinds: method(z.object({}), z.array(LlmProfileKindDescriptorSchema)),
|
|
15201
|
+
listProfiles: method(z.object({}), z.array(LlmProfileSchema)),
|
|
15202
|
+
upsertProfile: method(z.object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
15203
|
+
kind: "mutation",
|
|
15204
|
+
auth: "admin"
|
|
15205
|
+
}),
|
|
15206
|
+
deleteProfile: method(ProfileRefInputSchema, z.void(), {
|
|
15207
|
+
kind: "mutation",
|
|
15208
|
+
auth: "admin"
|
|
15209
|
+
}),
|
|
15210
|
+
testProfile: method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
15211
|
+
kind: "mutation",
|
|
15212
|
+
auth: "admin"
|
|
15213
|
+
}),
|
|
15214
|
+
/** Live vendor enumeration (GET /models etc.). */
|
|
15215
|
+
listModels: method(ProfileRefInputSchema, z.array(z.string())),
|
|
15216
|
+
getDefaults: method(z.object({}), z.array(LlmDefaultSchema)),
|
|
15217
|
+
setDefault: method(z.object({
|
|
15218
|
+
selector: LlmDefaultSelectorSchema,
|
|
15219
|
+
profileId: z.string().nullable()
|
|
15220
|
+
}), z.void(), {
|
|
15221
|
+
kind: "mutation",
|
|
15222
|
+
auth: "admin"
|
|
15223
|
+
}),
|
|
15224
|
+
getUsage: method(z.object({
|
|
15225
|
+
since: z.number().optional(),
|
|
15226
|
+
until: z.number().optional(),
|
|
15227
|
+
consumer: z.string().optional(),
|
|
15228
|
+
profileId: z.string().optional()
|
|
15229
|
+
}), z.array(LlmUsageRollupSchema)),
|
|
15230
|
+
listModelCatalog: method(z.object({}), z.array(ManagedModelCatalogEntrySchema)),
|
|
15231
|
+
listRuntimeNodes: method(z.object({}), z.array(LlmRuntimeNodeSchema)),
|
|
15232
|
+
listNodeModels: method(z.object({ nodeId: z.string() }), z.array(LlmNodeModelSchema)),
|
|
15233
|
+
installModel: method(z.object({
|
|
15234
|
+
nodeId: z.string(),
|
|
15235
|
+
model: ManagedModelRefSchema
|
|
15236
|
+
}), z.void(), {
|
|
15237
|
+
kind: "mutation",
|
|
15238
|
+
auth: "admin"
|
|
15239
|
+
}),
|
|
15240
|
+
deleteModel: method(z.object({
|
|
15241
|
+
nodeId: z.string(),
|
|
15242
|
+
file: z.string()
|
|
15243
|
+
}), z.void(), {
|
|
15244
|
+
kind: "mutation",
|
|
15245
|
+
auth: "admin"
|
|
15246
|
+
}),
|
|
15247
|
+
getRuntimeStatus: method(ProfileRefInputSchema, LlmRuntimeStatusSchema),
|
|
15248
|
+
startRuntime: method(ProfileRefInputSchema, LlmRuntimeStatusSchema, {
|
|
15249
|
+
kind: "mutation",
|
|
15250
|
+
auth: "admin"
|
|
15251
|
+
}),
|
|
15252
|
+
stopRuntime: method(ProfileRefInputSchema, z.void(), {
|
|
15253
|
+
kind: "mutation",
|
|
15254
|
+
auth: "admin"
|
|
15255
|
+
})
|
|
15505
15256
|
}
|
|
15506
15257
|
};
|
|
15507
|
-
var
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
var
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
15521
|
-
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
15522
|
-
* the originating provider config (mode + sourcePort) so the
|
|
15523
|
-
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
15524
|
-
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
15525
|
-
*/
|
|
15526
|
-
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
15527
|
-
/**
|
|
15528
|
-
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
15529
|
-
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
15530
|
-
*/
|
|
15531
|
-
id: z.string(),
|
|
15532
|
-
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
15533
|
-
label: z.string(),
|
|
15534
|
-
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15535
|
-
mode: z.string().optional(),
|
|
15536
|
-
/** Originating local port the ingress fronts (informational). */
|
|
15537
|
-
sourcePort: z.number().optional()
|
|
15258
|
+
var LogLevelSchema = z.enum([
|
|
15259
|
+
"debug",
|
|
15260
|
+
"info",
|
|
15261
|
+
"warn",
|
|
15262
|
+
"error"
|
|
15263
|
+
]);
|
|
15264
|
+
var LogEntrySchema = z.object({
|
|
15265
|
+
timestamp: z.date(),
|
|
15266
|
+
level: LogLevelSchema,
|
|
15267
|
+
scope: z.array(z.string()),
|
|
15268
|
+
message: z.string(),
|
|
15269
|
+
meta: z.record(z.string(), z.unknown()).optional(),
|
|
15270
|
+
tags: z.record(z.string(), z.string()).optional()
|
|
15538
15271
|
});
|
|
15539
|
-
var
|
|
15540
|
-
name: "
|
|
15272
|
+
var logDestinationCapability = {
|
|
15273
|
+
name: "log-destination",
|
|
15541
15274
|
scope: "system",
|
|
15542
15275
|
mode: "collection",
|
|
15543
|
-
|
|
15276
|
+
internal: true,
|
|
15544
15277
|
methods: {
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15278
|
+
write: method(LogEntrySchema, z.void(), { kind: "mutation" }),
|
|
15279
|
+
query: method(z.object({
|
|
15280
|
+
scope: z.array(z.string()).optional(),
|
|
15281
|
+
level: LogLevelSchema.optional(),
|
|
15282
|
+
since: z.date().optional(),
|
|
15283
|
+
until: z.date().optional(),
|
|
15284
|
+
limit: z.number().optional(),
|
|
15285
|
+
tags: z.record(z.string(), z.string()).optional()
|
|
15286
|
+
}), z.array(LogEntrySchema).readonly())
|
|
15287
|
+
},
|
|
15288
|
+
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
15289
|
+
mount: { kind: "skip" }
|
|
15556
15290
|
};
|
|
15557
15291
|
/**
|
|
15558
|
-
*
|
|
15292
|
+
* `login-method` — collection cap through which auth addons contribute
|
|
15293
|
+
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
15294
|
+
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
15295
|
+
* every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
|
|
15296
|
+
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
15297
|
+
* procedure aggregates them for the unauthenticated login page.
|
|
15559
15298
|
*
|
|
15560
|
-
*
|
|
15561
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
15562
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
15563
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
15564
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
15565
|
-
* message to what the kind supports — callers never special-case a service.
|
|
15299
|
+
* A contribution is a discriminated union on `kind`:
|
|
15566
15300
|
*
|
|
15567
|
-
*
|
|
15568
|
-
*
|
|
15569
|
-
* `
|
|
15570
|
-
*
|
|
15571
|
-
*
|
|
15572
|
-
* alternative would fork the UI per addon and cannot host the
|
|
15573
|
-
* discovery→adopt flow.
|
|
15574
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
15575
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
15576
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
15577
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
15578
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
15579
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
15580
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
15581
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
15582
|
-
* base64 fallback needed.
|
|
15301
|
+
* - `redirect` — a declarative button. The login page renders a generic
|
|
15302
|
+
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
15303
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
|
|
15304
|
+
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
15305
|
+
* login page needs NO change.
|
|
15583
15306
|
*
|
|
15584
|
-
*
|
|
15585
|
-
*
|
|
15586
|
-
*
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
*
|
|
15590
|
-
*
|
|
15307
|
+
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
15308
|
+
* `loadRemoteBundle`) for an in-page ceremony. `auth.listLoginMethods`
|
|
15309
|
+
* stamps a public `bundleUrl` from `addonId` + `bundle`. Generic
|
|
15310
|
+
* mechanism kept for future use; no shipped addon uses it on the login
|
|
15311
|
+
* page (the passkey ceremony below runs natively in the shell instead).
|
|
15312
|
+
*
|
|
15313
|
+
* - `passkey` — a declarative WebAuthn ceremony the shell renders
|
|
15314
|
+
* natively (`@simplewebauthn/browser` lives in `addon-admin-ui`, not in
|
|
15315
|
+
* a remotely-loaded bundle). Carries the addon's effective `rpId` /
|
|
15316
|
+
* `origin` (from its `resolveRpID()` / `resolveOrigin()`) so the shell
|
|
15317
|
+
* can gate visibility (IP-literal origin, hostname/rpId mismatch) WITHOUT
|
|
15318
|
+
* fetching any remote code pre-auth. Contribution stays unconditional —
|
|
15319
|
+
* enrollment state is never leaked pre-auth; visibility is a shell
|
|
15320
|
+
* decision.
|
|
15321
|
+
*
|
|
15322
|
+
* Every contribution carries a `stage`:
|
|
15323
|
+
* - `primary` — shown on the first credentials screen (OIDC /
|
|
15324
|
+
* magic-link buttons; a future usernameless passkey).
|
|
15325
|
+
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
15326
|
+
* returned `factors` (passkey-as-2FA today).
|
|
15327
|
+
*
|
|
15328
|
+
* `mount: skip` — the cap is read server-side by the core auth router
|
|
15329
|
+
* (`registry.getCollection('login-method')`), never mounted as its own
|
|
15330
|
+
* tRPC router.
|
|
15591
15331
|
*/
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
"video",
|
|
15595
|
-
"gif",
|
|
15596
|
-
"audio",
|
|
15597
|
-
"icon"
|
|
15598
|
-
]);
|
|
15332
|
+
/** When a login method renders in the two-phase login flow. */
|
|
15333
|
+
var LoginStageEnum = z.enum(["primary", "second-factor"]);
|
|
15599
15334
|
/**
|
|
15600
|
-
* A
|
|
15601
|
-
*
|
|
15602
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
15603
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
15335
|
+
* A declarative redirect button — the login page navigates to `startUrl`.
|
|
15336
|
+
* OIDC and magic-link contribute this; a future SSO addon does too.
|
|
15604
15337
|
*/
|
|
15605
|
-
var
|
|
15606
|
-
|
|
15607
|
-
|
|
15608
|
-
bytes: z.instanceof(Uint8Array).optional(),
|
|
15609
|
-
mime: z.string().optional(),
|
|
15610
|
-
name: z.string().optional()
|
|
15611
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
15612
|
-
var NotificationFormatSchema = z.enum([
|
|
15613
|
-
"text",
|
|
15614
|
-
"markdown",
|
|
15615
|
-
"html"
|
|
15616
|
-
]);
|
|
15617
|
-
/** A single tap-through action button. */
|
|
15618
|
-
var NotificationActionSchema = z.object({
|
|
15338
|
+
var RedirectLoginMethodSchema = z.object({
|
|
15339
|
+
kind: z.literal("redirect"),
|
|
15340
|
+
/** Stable id within the login-method set (e.g. `auth-oidc/google`). */
|
|
15619
15341
|
id: z.string(),
|
|
15342
|
+
/** Operator-facing button label. */
|
|
15620
15343
|
label: z.string(),
|
|
15621
|
-
|
|
15344
|
+
/** lucide-react icon name. */
|
|
15345
|
+
icon: z.string().optional(),
|
|
15346
|
+
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
15347
|
+
startUrl: z.string(),
|
|
15348
|
+
stage: LoginStageEnum
|
|
15622
15349
|
});
|
|
15623
15350
|
/**
|
|
15624
|
-
*
|
|
15625
|
-
* `
|
|
15626
|
-
*
|
|
15627
|
-
*
|
|
15628
|
-
*
|
|
15629
|
-
* `priority` for that one target.
|
|
15351
|
+
* A Module-Federation widget the login page mounts for an in-page
|
|
15352
|
+
* ceremony. `bundle` + `addonId` let `auth.listLoginMethods` stamp a
|
|
15353
|
+
* public `bundleUrl`; `remote` is the MF descriptor `loadRemoteBundle`
|
|
15354
|
+
* consumes. No `bundleUrl` here — it is server-stamped on the public
|
|
15355
|
+
* output so the addon never encodes the static-route scheme.
|
|
15630
15356
|
*/
|
|
15631
|
-
var
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
format: NotificationFormatSchema.default("text"),
|
|
15635
|
-
priority: z.number().int().min(1).max(5).default(3),
|
|
15636
|
-
level: z.string().optional(),
|
|
15637
|
-
attachments: z.array(AttachmentSchema).optional(),
|
|
15638
|
-
clickUrl: z.string().optional(),
|
|
15639
|
-
actions: z.array(NotificationActionSchema).optional(),
|
|
15640
|
-
sound: z.string().optional(),
|
|
15641
|
-
ttl: z.number().optional(),
|
|
15642
|
-
tag: z.string().optional(),
|
|
15643
|
-
deviceId: z.number().optional(),
|
|
15644
|
-
eventId: z.string().optional(),
|
|
15645
|
-
metadata: z.record(z.string(), z.unknown()).optional()
|
|
15646
|
-
});
|
|
15647
|
-
/** One declared native severity/priority level for a kind. */
|
|
15648
|
-
var TargetKindLevelSchema = z.object({
|
|
15357
|
+
var WidgetLoginMethodSchema = z.object({
|
|
15358
|
+
kind: z.literal("widget"),
|
|
15359
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
|
|
15649
15360
|
id: z.string(),
|
|
15650
|
-
|
|
15651
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
15652
|
-
ordinal: z.number().int().min(1).max(5).nullable(),
|
|
15653
|
-
flags: z.object({
|
|
15654
|
-
critical: z.boolean().optional(),
|
|
15655
|
-
silent: z.boolean().optional(),
|
|
15656
|
-
noPush: z.boolean().optional()
|
|
15657
|
-
}).optional(),
|
|
15658
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
15659
|
-
requires: z.array(z.string()).optional(),
|
|
15660
|
-
description: z.string().optional()
|
|
15661
|
-
});
|
|
15662
|
-
/** Attachment capabilities for a kind (drives the degrade engine + test panel). */
|
|
15663
|
-
var TargetKindAttachmentsCapsSchema = z.object({
|
|
15664
|
-
mediaTypes: z.array(AttachmentMediaTypeSchema),
|
|
15665
|
-
mode: z.enum([
|
|
15666
|
-
"url",
|
|
15667
|
-
"bytes",
|
|
15668
|
-
"both"
|
|
15669
|
-
]),
|
|
15670
|
-
max: z.number().int().nonnegative(),
|
|
15671
|
-
maxBytes: z.number().int().positive().optional()
|
|
15672
|
-
});
|
|
15673
|
-
/** The full capability block consulted before dispatch. */
|
|
15674
|
-
var TargetKindCapsSchema = z.object({
|
|
15675
|
-
attachments: TargetKindAttachmentsCapsSchema,
|
|
15676
|
-
/** Max action buttons (0 = none). */
|
|
15677
|
-
actions: z.number().int().nonnegative(),
|
|
15678
|
-
levels: z.array(TargetKindLevelSchema),
|
|
15679
|
-
format: z.array(NotificationFormatSchema),
|
|
15680
|
-
clickUrl: z.boolean(),
|
|
15681
|
-
sound: z.boolean(),
|
|
15682
|
-
ttl: z.boolean(),
|
|
15683
|
-
bodyMaxLen: z.number().int().positive()
|
|
15684
|
-
});
|
|
15685
|
-
/**
|
|
15686
|
-
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
15687
|
-
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
15688
|
-
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
15689
|
-
* the union is large and not meant for runtime validation here; the exported
|
|
15690
|
-
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15691
|
-
*/
|
|
15692
|
-
var ConfigSchemaPassthrough$1 = z.unknown();
|
|
15693
|
-
var TargetKindSchema = z.object({
|
|
15694
|
-
kind: z.string(),
|
|
15695
|
-
label: z.string(),
|
|
15696
|
-
icon: z.string(),
|
|
15697
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
15361
|
+
/** Owning addon id — drives the public bundle URL + the MF namespace. */
|
|
15698
15362
|
addonId: z.string(),
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
|
|
15363
|
+
/** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
|
|
15364
|
+
bundle: z.string(),
|
|
15365
|
+
/** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
|
|
15366
|
+
remote: WidgetRemoteSchema,
|
|
15367
|
+
stage: LoginStageEnum
|
|
15702
15368
|
});
|
|
15703
15369
|
/**
|
|
15704
|
-
* A
|
|
15705
|
-
*
|
|
15706
|
-
*
|
|
15370
|
+
* A declarative WebAuthn ceremony the shell renders natively (no remote
|
|
15371
|
+
* code). Carries the addon's EFFECTIVE `rpId`/`origin` so the shell can
|
|
15372
|
+
* gate visibility (IP-literal origin, hostname/rpId mismatch) before ever
|
|
15373
|
+
* showing the button — the contribution itself stays unconditional.
|
|
15707
15374
|
*/
|
|
15708
|
-
var
|
|
15375
|
+
var PasskeyLoginMethodSchema = z.object({
|
|
15376
|
+
kind: z.literal("passkey"),
|
|
15377
|
+
/** Stable id within the login-method set (e.g. `auth-webauthn/passkey-direct-login`). */
|
|
15709
15378
|
id: z.string(),
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
var DiscoveredTargetSchema = z.object({
|
|
15718
|
-
kind: z.string(),
|
|
15719
|
-
suggestedName: z.string(),
|
|
15720
|
-
config: z.record(z.string(), z.unknown())
|
|
15721
|
-
});
|
|
15722
|
-
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
15723
|
-
var RenderedAsSchema = z.object({
|
|
15724
|
-
level: z.string(),
|
|
15725
|
-
format: NotificationFormatSchema,
|
|
15726
|
-
attachmentsSent: z.number().int().nonnegative(),
|
|
15727
|
-
actionsSent: z.number().int().nonnegative(),
|
|
15728
|
-
truncated: z.boolean(),
|
|
15729
|
-
dropped: z.array(z.string())
|
|
15730
|
-
});
|
|
15731
|
-
var SendResultSchema = z.object({
|
|
15732
|
-
success: z.boolean(),
|
|
15733
|
-
error: z.string().optional(),
|
|
15734
|
-
renderedAs: RenderedAsSchema.optional()
|
|
15379
|
+
/** Operator-facing button label. */
|
|
15380
|
+
label: z.string(),
|
|
15381
|
+
stage: LoginStageEnum,
|
|
15382
|
+
/** Effective WebAuthn RP ID (`resolveRpID()`) — the shell gates visibility on it. */
|
|
15383
|
+
rpId: z.string(),
|
|
15384
|
+
/** Effective expected origin (`resolveOrigin()`), null when unconfigured. */
|
|
15385
|
+
origin: z.string().nullable()
|
|
15735
15386
|
});
|
|
15736
|
-
/**
|
|
15737
|
-
var
|
|
15738
|
-
|
|
15739
|
-
|
|
15387
|
+
/** One login-method contribution — redirect button, pre-auth widget, or native passkey ceremony. */
|
|
15388
|
+
var LoginMethodContributionSchema = z.discriminatedUnion("kind", [
|
|
15389
|
+
RedirectLoginMethodSchema,
|
|
15390
|
+
WidgetLoginMethodSchema,
|
|
15391
|
+
PasskeyLoginMethodSchema
|
|
15392
|
+
]);
|
|
15393
|
+
var loginMethodCapability = {
|
|
15394
|
+
name: "login-method",
|
|
15740
15395
|
scope: "system",
|
|
15741
15396
|
mode: "collection",
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
kind: z.string(),
|
|
15747
|
-
config: z.record(z.string(), z.unknown()).optional()
|
|
15748
|
-
}), z.array(DiscoveredTargetSchema)),
|
|
15749
|
-
send: method(z.object({
|
|
15750
|
-
targetId: z.string(),
|
|
15751
|
-
notification: NotificationSchema
|
|
15752
|
-
}), SendResultSchema, { kind: "mutation" }),
|
|
15753
|
-
testTarget: method(z.object({
|
|
15754
|
-
targetId: z.string(),
|
|
15755
|
-
sample: NotificationSchema.optional()
|
|
15756
|
-
}), TestResultSchema, { kind: "mutation" }),
|
|
15757
|
-
upsertTarget: method(z.object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }),
|
|
15758
|
-
deleteTarget: method(z.object({ targetId: z.string() }), z.void(), { kind: "mutation" }),
|
|
15759
|
-
setTargetEnabled: method(z.object({
|
|
15760
|
-
targetId: z.string(),
|
|
15761
|
-
enabled: z.boolean()
|
|
15762
|
-
}), z.void(), { kind: "mutation" })
|
|
15763
|
-
}
|
|
15397
|
+
internal: true,
|
|
15398
|
+
methods: { getLoginMethods: method(z.void(), z.array(LoginMethodContributionSchema).readonly()) },
|
|
15399
|
+
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
15400
|
+
mount: { kind: "skip" }
|
|
15764
15401
|
};
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
|
|
15768
|
-
|
|
15769
|
-
|
|
15770
|
-
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
15778
|
-
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
15779
|
-
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
15780
|
-
* by id; per-backend params are a passthrough blob capped by the
|
|
15781
|
-
* target kind's own caps/degrade engine).
|
|
15782
|
-
*
|
|
15783
|
-
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
15784
|
-
* server-injected caller identity — the first `caller: 'required'`
|
|
15785
|
-
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
15786
|
-
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
15787
|
-
* windows, and the optional label/identity/plate matchers. User rules,
|
|
15788
|
-
* private zones, per-recipient fan-out and the wider condition table are
|
|
15789
|
-
* P2+ (see spec §7).
|
|
15790
|
-
*
|
|
15791
|
-
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
15792
|
-
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
15793
|
-
* schema/interface drift is explicitly not repeated).
|
|
15794
|
-
*/
|
|
15795
|
-
/** D-3: the urgency of a rule — which persistence moment evaluates it. */
|
|
15796
|
-
var NcDeliverySchema = z.enum(["immediate", "track-end"]);
|
|
15797
|
-
/** One weekly activation window. `startMinute > endMinute` crosses midnight. */
|
|
15798
|
-
var NcScheduleWindowSchema = z.object({
|
|
15799
|
-
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
15800
|
-
days: z.array(z.number().int().min(0).max(6)).min(1),
|
|
15801
|
-
startMinute: z.number().int().min(0).max(1439),
|
|
15802
|
-
endMinute: z.number().int().min(0).max(1439)
|
|
15803
|
-
});
|
|
15804
|
-
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
15805
|
-
var NcScheduleSchema = z.object({
|
|
15806
|
-
windows: z.array(NcScheduleWindowSchema).min(1),
|
|
15807
|
-
/** IANA timezone; default = hub host timezone. */
|
|
15808
|
-
timezone: z.string().optional(),
|
|
15809
|
-
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
15810
|
-
invert: z.boolean().optional()
|
|
15402
|
+
var CpuBreakdownSchema = z.object({
|
|
15403
|
+
total: z.number(),
|
|
15404
|
+
user: z.number(),
|
|
15405
|
+
system: z.number(),
|
|
15406
|
+
irq: z.number(),
|
|
15407
|
+
nice: z.number(),
|
|
15408
|
+
loadAvg: z.tuple([
|
|
15409
|
+
z.number(),
|
|
15410
|
+
z.number(),
|
|
15411
|
+
z.number()
|
|
15412
|
+
]),
|
|
15413
|
+
cores: z.number()
|
|
15811
15414
|
});
|
|
15812
|
-
|
|
15813
|
-
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
|
|
15415
|
+
var MemoryInfoSchema = z.object({
|
|
15416
|
+
percent: z.number(),
|
|
15417
|
+
totalBytes: z.number(),
|
|
15418
|
+
usedBytes: z.number(),
|
|
15419
|
+
availableBytes: z.number(),
|
|
15420
|
+
swapUsedBytes: z.number(),
|
|
15421
|
+
swapTotalBytes: z.number()
|
|
15817
15422
|
});
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15423
|
+
var DiskIoSnapshotSchema = z.object({
|
|
15424
|
+
readBytes: z.number(),
|
|
15425
|
+
writeBytes: z.number(),
|
|
15426
|
+
readOps: z.number(),
|
|
15427
|
+
writeOps: z.number(),
|
|
15428
|
+
timestampMs: z.number()
|
|
15823
15429
|
});
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15430
|
+
var NetworkIoSnapshotSchema = z.object({
|
|
15431
|
+
rxBytes: z.number(),
|
|
15432
|
+
txBytes: z.number(),
|
|
15433
|
+
rxPackets: z.number(),
|
|
15434
|
+
txPackets: z.number(),
|
|
15435
|
+
rxErrors: z.number(),
|
|
15436
|
+
txErrors: z.number(),
|
|
15437
|
+
timestampMs: z.number()
|
|
15438
|
+
});
|
|
15439
|
+
var MetricsGpuInfoSchema = z.object({
|
|
15440
|
+
utilization: z.number(),
|
|
15441
|
+
model: z.string(),
|
|
15442
|
+
memoryUsedBytes: z.number(),
|
|
15443
|
+
memoryTotalBytes: z.number(),
|
|
15444
|
+
temperature: z.number().nullable()
|
|
15445
|
+
});
|
|
15446
|
+
var ProcessResourceInfoSchema = z.object({
|
|
15447
|
+
openFds: z.number(),
|
|
15448
|
+
threadCount: z.number(),
|
|
15449
|
+
activeHandles: z.number(),
|
|
15450
|
+
activeRequests: z.number()
|
|
15451
|
+
});
|
|
15452
|
+
var PressureAvgsSchema = z.object({
|
|
15453
|
+
avg10: z.number(),
|
|
15454
|
+
avg60: z.number(),
|
|
15455
|
+
avg300: z.number()
|
|
15456
|
+
});
|
|
15457
|
+
var PressureInfoSchema = z.object({
|
|
15458
|
+
some: PressureAvgsSchema,
|
|
15459
|
+
full: PressureAvgsSchema.nullable()
|
|
15460
|
+
});
|
|
15461
|
+
var SystemResourceSnapshotSchema = z.object({
|
|
15462
|
+
cpu: CpuBreakdownSchema,
|
|
15463
|
+
memory: MemoryInfoSchema,
|
|
15464
|
+
gpu: MetricsGpuInfoSchema.nullable(),
|
|
15465
|
+
network: NetworkIoSnapshotSchema,
|
|
15466
|
+
disk: DiskIoSnapshotSchema,
|
|
15467
|
+
pressure: z.object({
|
|
15468
|
+
cpu: PressureInfoSchema.nullable(),
|
|
15469
|
+
memory: PressureInfoSchema.nullable(),
|
|
15470
|
+
io: PressureInfoSchema.nullable()
|
|
15471
|
+
}),
|
|
15472
|
+
process: ProcessResourceInfoSchema,
|
|
15473
|
+
cpuTemperature: z.number().nullable(),
|
|
15474
|
+
timestampMs: z.number()
|
|
15475
|
+
});
|
|
15476
|
+
var DiskSpaceInfoSchema = z.object({
|
|
15477
|
+
path: z.string(),
|
|
15478
|
+
totalBytes: z.number(),
|
|
15479
|
+
usedBytes: z.number(),
|
|
15480
|
+
availableBytes: z.number(),
|
|
15481
|
+
percent: z.number()
|
|
15482
|
+
});
|
|
15483
|
+
var PidResourceStatsSchema = z.object({
|
|
15484
|
+
pid: z.number(),
|
|
15485
|
+
cpu: z.number(),
|
|
15486
|
+
memory: z.number(),
|
|
15841
15487
|
/**
|
|
15842
|
-
*
|
|
15843
|
-
*
|
|
15488
|
+
* Private (anonymous) resident bytes — the per-process V8 heap + native
|
|
15489
|
+
* allocations NOT shared with other processes (Linux RssAnon). This is the
|
|
15490
|
+
* "real" per-runner cost; summing it across runners is meaningful, unlike
|
|
15491
|
+
* `memory` (RSS), which double-counts the shared mmap'd framework code.
|
|
15492
|
+
* Undefined where /proc is unavailable (e.g. macOS).
|
|
15844
15493
|
*/
|
|
15845
|
-
|
|
15494
|
+
privateBytes: z.number().optional(),
|
|
15846
15495
|
/**
|
|
15847
|
-
*
|
|
15848
|
-
*
|
|
15849
|
-
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
15496
|
+
* Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
|
|
15497
|
+
* code shared copy-on-write across runners. Undefined on macOS.
|
|
15850
15498
|
*/
|
|
15851
|
-
|
|
15852
|
-
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
15853
|
-
plates: NcPlateMatcherSchema.optional()
|
|
15499
|
+
sharedBytes: z.number().optional()
|
|
15854
15500
|
});
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15501
|
+
var AddonInstanceSchema = z.object({
|
|
15502
|
+
addonId: z.string(),
|
|
15503
|
+
nodeId: z.string(),
|
|
15504
|
+
role: z.enum(["hub", "worker"]),
|
|
15505
|
+
pid: z.number(),
|
|
15506
|
+
state: z.enum([
|
|
15507
|
+
"starting",
|
|
15508
|
+
"running",
|
|
15509
|
+
"stopping",
|
|
15510
|
+
"stopped",
|
|
15511
|
+
"crashed"
|
|
15512
|
+
]),
|
|
15513
|
+
uptimeSec: z.number()
|
|
15865
15514
|
});
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
])
|
|
15876
|
-
/**
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15515
|
+
var NodeProcessSchema = z.object({
|
|
15516
|
+
pid: z.number(),
|
|
15517
|
+
ppid: z.number(),
|
|
15518
|
+
pgid: z.number(),
|
|
15519
|
+
classification: z.enum([
|
|
15520
|
+
"root",
|
|
15521
|
+
"managed",
|
|
15522
|
+
"system",
|
|
15523
|
+
"ghost"
|
|
15524
|
+
]),
|
|
15525
|
+
/** `$process` addon binding when `managed`, else null. */
|
|
15526
|
+
addonId: z.string().nullable(),
|
|
15527
|
+
/** Kernel-reported nodeId when the process is a known agent/worker. */
|
|
15528
|
+
nodeId: z.string().nullable(),
|
|
15529
|
+
/** Truncated command line. */
|
|
15530
|
+
command: z.string(),
|
|
15531
|
+
cpuPercent: z.number(),
|
|
15532
|
+
memoryRssBytes: z.number(),
|
|
15533
|
+
/** Wall-clock uptime (seconds). Parsed from `ps etime`. */
|
|
15534
|
+
uptimeSec: z.number(),
|
|
15535
|
+
/** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
|
|
15536
|
+
orphaned: z.boolean()
|
|
15881
15537
|
});
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
delivery: NcDeliverySchema,
|
|
15887
|
-
conditions: NcConditionsSchema.default({}),
|
|
15888
|
-
schedule: NcScheduleSchema.optional(),
|
|
15889
|
-
targets: z.array(NcRuleTargetSchema).min(1),
|
|
15890
|
-
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
15891
|
-
throttle: NcThrottleSchema.default({
|
|
15892
|
-
cooldownSec: 60,
|
|
15893
|
-
scope: "rule-device"
|
|
15894
|
-
}),
|
|
15895
|
-
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
15896
|
-
template: z.object({
|
|
15897
|
-
title: z.string().max(500).optional(),
|
|
15898
|
-
body: z.string().max(2e3).optional()
|
|
15899
|
-
}).optional(),
|
|
15900
|
-
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
15901
|
-
priority: z.number().int().min(1).max(5).default(3)
|
|
15538
|
+
var KillProcessInputSchema = z.object({
|
|
15539
|
+
pid: z.number(),
|
|
15540
|
+
/** Force = SIGKILL. Default is SIGTERM. */
|
|
15541
|
+
force: z.boolean().optional()
|
|
15902
15542
|
});
|
|
15903
|
-
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
id: z.string(),
|
|
15908
|
-
/** userId of the admin who created the rule (server-stamped caller). */
|
|
15909
|
-
createdBy: z.string(),
|
|
15910
|
-
createdAt: z.number(),
|
|
15911
|
-
updatedAt: z.number()
|
|
15543
|
+
var KillProcessResultSchema = z.object({
|
|
15544
|
+
success: z.boolean(),
|
|
15545
|
+
reason: z.string().optional(),
|
|
15546
|
+
signal: z.enum(["SIGTERM", "SIGKILL"]).optional()
|
|
15912
15547
|
});
|
|
15913
|
-
var
|
|
15914
|
-
|
|
15915
|
-
|
|
15916
|
-
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
|
|
15548
|
+
var DumpHeapSnapshotInputSchema = z.object({
|
|
15549
|
+
/** The addon whose runner should dump a heap snapshot. */
|
|
15550
|
+
addonId: z.string() });
|
|
15551
|
+
var DumpHeapSnapshotResultSchema = z.object({
|
|
15552
|
+
success: z.boolean(),
|
|
15553
|
+
/** Path of the written .heapsnapshot inside the runner's container/host. */
|
|
15554
|
+
path: z.string().optional(),
|
|
15555
|
+
/** Process pid that was signalled. */
|
|
15556
|
+
pid: z.number().optional(),
|
|
15557
|
+
reason: z.string().optional()
|
|
15923
15558
|
});
|
|
15924
|
-
var
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
|
|
15932
|
-
|
|
15933
|
-
"schedule"
|
|
15934
|
-
]),
|
|
15935
|
-
label: z.string(),
|
|
15936
|
-
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
15937
|
-
valueType: z.enum([
|
|
15938
|
-
"deviceIdList",
|
|
15939
|
-
"stringList",
|
|
15940
|
-
"number01",
|
|
15941
|
-
"zoneSelection",
|
|
15942
|
-
"zoneIdList",
|
|
15943
|
-
"schedule",
|
|
15944
|
-
"plateMatcher"
|
|
15945
|
-
]),
|
|
15946
|
-
operator: z.enum([
|
|
15947
|
-
"in",
|
|
15948
|
-
"notIn",
|
|
15949
|
-
"anyOf",
|
|
15950
|
-
"allOf",
|
|
15951
|
-
"gte",
|
|
15952
|
-
"fuzzyIn",
|
|
15953
|
-
"withinSchedule"
|
|
15954
|
-
]),
|
|
15955
|
-
/** Which delivery kinds the condition applies to. */
|
|
15956
|
-
appliesTo: z.array(NcDeliverySchema),
|
|
15957
|
-
phase: z.string(),
|
|
15958
|
-
description: z.string().optional()
|
|
15559
|
+
var SystemMetricsSchema = z.object({
|
|
15560
|
+
cpuPercent: z.number(),
|
|
15561
|
+
memoryPercent: z.number(),
|
|
15562
|
+
memoryUsedMB: z.number(),
|
|
15563
|
+
memoryTotalMB: z.number(),
|
|
15564
|
+
diskPercent: z.number().optional(),
|
|
15565
|
+
temperature: z.number().optional(),
|
|
15566
|
+
gpuPercent: z.number().optional(),
|
|
15567
|
+
gpuMemoryPercent: z.number().optional()
|
|
15959
15568
|
});
|
|
15960
|
-
var
|
|
15961
|
-
name: "
|
|
15569
|
+
var metricsProviderCapability = {
|
|
15570
|
+
name: "metrics-provider",
|
|
15962
15571
|
scope: "system",
|
|
15963
15572
|
mode: "singleton",
|
|
15964
15573
|
methods: {
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15574
|
+
/** Fresh, full system snapshot (triggers OS-level collection). */
|
|
15575
|
+
collectSnapshot: method(z.void(), SystemResourceSnapshotSchema),
|
|
15576
|
+
/** Most recent cached snapshot from the background sampler, or null pre-first-sample. */
|
|
15577
|
+
getCached: method(z.void(), SystemResourceSnapshotSchema.nullable()),
|
|
15578
|
+
/** Light-weight cached summary for heartbeats and list views. */
|
|
15579
|
+
getCurrent: method(z.void(), SystemMetricsSchema),
|
|
15580
|
+
/** Disk space for the given mount/path. */
|
|
15581
|
+
getDiskSpace: method(z.object({ dirPath: z.string() }), DiskSpaceInfoSchema),
|
|
15582
|
+
/** GPU info (null if unavailable). */
|
|
15583
|
+
getGpuInfo: method(z.void(), MetricsGpuInfoSchema.nullable()),
|
|
15584
|
+
/** CPU temperature in °C (null if unavailable). */
|
|
15585
|
+
getCpuTemperature: method(z.void(), z.number().nullable()),
|
|
15586
|
+
/** Per-PID resource stats. Missing/dead PIDs are omitted from the result. */
|
|
15587
|
+
getProcessStats: method(z.object({ pids: z.array(z.number()) }), z.array(PidResourceStatsSchema)),
|
|
15588
|
+
/**
|
|
15589
|
+
* List addon instances known to this node — one entry per forked worker
|
|
15590
|
+
* plus a synthetic 'hub' entry representing the local hub process.
|
|
15591
|
+
* Used by benchmarks/observability to detect whether a given addon runs
|
|
15592
|
+
* in its own process (measurable independently) or inline with the hub.
|
|
15593
|
+
*/
|
|
15594
|
+
listAddonInstances: method(z.void(), z.array(AddonInstanceSchema).readonly()),
|
|
15595
|
+
/**
|
|
15596
|
+
* Resource stats for the process hosting the given addon.
|
|
15597
|
+
* Returns null when the addon runs in-process on the hub (can't measure
|
|
15598
|
+
* independently — caller should detect via listAddonInstances). Returns
|
|
15599
|
+
* hub process stats for addonId '$hub'.
|
|
15600
|
+
*/
|
|
15601
|
+
getAddonStats: method(z.object({ addonId: z.string() }), PidResourceStatsSchema.nullable()),
|
|
15602
|
+
/**
|
|
15603
|
+
* Snapshot of every camstack-related process on this node with a
|
|
15604
|
+
* ghost/managed/root classification. Powers the Cluster → Agent →
|
|
15605
|
+
* Processes tab: cross-references `$process.list` against a `ps` scan
|
|
15606
|
+
* so orphaned trees (PPID=1) or unknown children show up as `ghost`
|
|
15607
|
+
* and can be killed from the UI.
|
|
15608
|
+
*/
|
|
15609
|
+
listNodeProcesses: method(z.void(), z.array(NodeProcessSchema).readonly()),
|
|
15610
|
+
/**
|
|
15611
|
+
* Send SIGTERM (or SIGKILL when `force`) to a pid inside this node's
|
|
15612
|
+
* process tree. The provider refuses pids that aren't in the live
|
|
15613
|
+
* `listNodeProcesses()` snapshot — callers can't use this endpoint
|
|
15614
|
+
* to kill arbitrary system processes.
|
|
15615
|
+
*/
|
|
15616
|
+
killProcess: method(KillProcessInputSchema, KillProcessResultSchema, {
|
|
15988
15617
|
kind: "mutation",
|
|
15989
15618
|
auth: "admin"
|
|
15990
15619
|
}),
|
|
15991
15620
|
/**
|
|
15992
|
-
*
|
|
15993
|
-
*
|
|
15994
|
-
*
|
|
15621
|
+
* Tell the addon's forked runner to write a V8 heap snapshot to disk (via
|
|
15622
|
+
* SIGUSR2 — the runner's diagnostic handler). Also logs its
|
|
15623
|
+
* `process.memoryUsage()` + heap-space breakdown. Refuses pids not in the
|
|
15624
|
+
* live `listNodeProcesses()` snapshot. Use for deep per-addon memory
|
|
15625
|
+
* attribution; copy the returned path off the node to analyze.
|
|
15995
15626
|
*/
|
|
15996
|
-
|
|
15997
|
-
rule: NcRuleInputSchema,
|
|
15998
|
-
lookbackMinutes: z.number().int().min(1).max(1440).default(60)
|
|
15999
|
-
}), z.object({ results: z.array(NcTestResultSchema) }), {
|
|
15627
|
+
dumpHeapSnapshot: method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
|
|
16000
15628
|
kind: "mutation",
|
|
16001
15629
|
auth: "admin"
|
|
16002
|
-
})
|
|
16003
|
-
getConditionCatalog: method(z.object({}), z.object({ catalog: z.array(NcConditionDescriptorSchema) }))
|
|
15630
|
+
})
|
|
16004
15631
|
}
|
|
16005
15632
|
};
|
|
15633
|
+
var modelConvertCapability = {
|
|
15634
|
+
name: "model-convert",
|
|
15635
|
+
scope: "system",
|
|
15636
|
+
mode: "singleton",
|
|
15637
|
+
internal: true,
|
|
15638
|
+
methods: { convert: method(z.object({
|
|
15639
|
+
sourceUrl: z.string(),
|
|
15640
|
+
metadata: ModelConvertMetadataSchema,
|
|
15641
|
+
targets: z.array(ConvertTargetSchema).min(1).readonly(),
|
|
15642
|
+
calibrationRef: z.string().optional(),
|
|
15643
|
+
sessionId: z.string().optional()
|
|
15644
|
+
}), ConvertResultSchema, {
|
|
15645
|
+
kind: "mutation",
|
|
15646
|
+
auth: "admin",
|
|
15647
|
+
timeoutMs: 6e5
|
|
15648
|
+
}) }
|
|
15649
|
+
};
|
|
15650
|
+
var modelDistributorCapability = {
|
|
15651
|
+
name: "model-distributor",
|
|
15652
|
+
scope: "system",
|
|
15653
|
+
mode: "singleton",
|
|
15654
|
+
internal: true,
|
|
15655
|
+
methods: { distributeModel: method(z.object({
|
|
15656
|
+
nodeId: z.string(),
|
|
15657
|
+
modelId: z.string(),
|
|
15658
|
+
format: z.enum(MODEL_FORMATS),
|
|
15659
|
+
entry: ModelCatalogEntrySchema
|
|
15660
|
+
}), z.object({
|
|
15661
|
+
ok: z.boolean(),
|
|
15662
|
+
/** sha256 of the staged tarball (empty for a hub-local no-op). */
|
|
15663
|
+
sha256: z.string(),
|
|
15664
|
+
bytes: z.number(),
|
|
15665
|
+
/** The target node's modelsDir the artifact landed in. */
|
|
15666
|
+
path: z.string()
|
|
15667
|
+
}), {
|
|
15668
|
+
kind: "mutation",
|
|
15669
|
+
auth: "admin"
|
|
15670
|
+
}) }
|
|
15671
|
+
};
|
|
16006
15672
|
/**
|
|
16007
|
-
*
|
|
16008
|
-
* surface) and `llm-runtime.cap.ts` (node-side managed executor) so the two
|
|
16009
|
-
* caps stay wire-compatible without a circular cap→cap import.
|
|
15673
|
+
* `mqtt-broker` — broker-registry cap.
|
|
16010
15674
|
*
|
|
16011
|
-
*
|
|
16012
|
-
*
|
|
16013
|
-
*
|
|
15675
|
+
* NOT a pub/sub proxy. The cap exposes (a) a registry of configured
|
|
15676
|
+
* MQTT brokers (external + optionally an embedded `aedes`-backed one)
|
|
15677
|
+
* and (b) the connection details a consumer addon needs to spin up
|
|
15678
|
+
* its OWN `mqtt.js` client.
|
|
15679
|
+
*
|
|
15680
|
+
* Why: pub/sub routing over the system event-bus loses fidelity
|
|
15681
|
+
* (callback shape, QoS guarantees, will/retain semantics) and adds
|
|
15682
|
+
* refcount bookkeeping that addons would rather own themselves. The
|
|
15683
|
+
* canonical consumer (`addon-export-ha-mqtt`) needs raw `mqtt.js`
|
|
15684
|
+
* features anyway — give it the connection config, get out of the way.
|
|
15685
|
+
*
|
|
15686
|
+
* Consumer flow:
|
|
15687
|
+
* const cfg = await ctx.api.mqttBroker.getBrokerConfig({ id })
|
|
15688
|
+
* const client = mqtt.connect(cfg.url, { username: cfg.username, … })
|
|
15689
|
+
* client.subscribe('zigbee2mqtt/+')
|
|
15690
|
+
*
|
|
15691
|
+
* Collection mode: multiple brokers (e.g. one local mosquitto + one
|
|
15692
|
+
* cloud bridge). The "embedded" entry (when present) is just another
|
|
15693
|
+
* broker in the registry — its lifecycle is owned by the addon that
|
|
15694
|
+
* spawned it.
|
|
16014
15695
|
*/
|
|
16015
|
-
var
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
"
|
|
16027
|
-
"
|
|
16028
|
-
"
|
|
15696
|
+
var BrokerKindSchema = z.enum(["external", "embedded"]);
|
|
15697
|
+
/**
|
|
15698
|
+
* Broker live-probe status.
|
|
15699
|
+
*
|
|
15700
|
+
* - `connected` — last probe completed a clean CONNACK
|
|
15701
|
+
* - `disconnected` — no probe has run yet (cold cache)
|
|
15702
|
+
* - `auth-failed` — CONNACK refused with auth error (RC 4 / 5)
|
|
15703
|
+
* - `unreachable` — TCP connect timed out / refused
|
|
15704
|
+
* - `tls-error` — TLS handshake failed (cert / SNI / cipher)
|
|
15705
|
+
*/
|
|
15706
|
+
var BrokerStatusSchema$1 = z.enum([
|
|
15707
|
+
"connected",
|
|
15708
|
+
"disconnected",
|
|
15709
|
+
"auth-failed",
|
|
15710
|
+
"unreachable",
|
|
15711
|
+
"tls-error"
|
|
16029
15712
|
]);
|
|
16030
|
-
var
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
latencyMs: z.number()
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
retryAfterMs: z.number().optional()
|
|
15713
|
+
var BrokerInfoSchema = z.object({
|
|
15714
|
+
id: z.string(),
|
|
15715
|
+
name: z.string(),
|
|
15716
|
+
url: z.string(),
|
|
15717
|
+
kind: BrokerKindSchema,
|
|
15718
|
+
status: BrokerStatusSchema$1,
|
|
15719
|
+
latencyMs: z.number().nullable(),
|
|
15720
|
+
error: z.string().optional(),
|
|
15721
|
+
/** Embedded brokers only: number of MQTT clients currently connected. */
|
|
15722
|
+
connectedClients: z.number().int().nonnegative().optional(),
|
|
15723
|
+
/** Epoch ms of the last live probe (external) or aedes snapshot (embedded). */
|
|
15724
|
+
lastCheckedAt: z.number().optional()
|
|
16043
15725
|
});
|
|
16044
|
-
var LlmGenerateResultSchema = z.discriminatedUnion("ok", [LlmGenerateOkSchema, LlmGenerateErrSchema]);
|
|
16045
15726
|
/**
|
|
16046
|
-
*
|
|
16047
|
-
*
|
|
16048
|
-
*
|
|
15727
|
+
* Connection details — what a consumer needs to call
|
|
15728
|
+
* `mqtt.connect(url, options)`. We split URL + credentials so the
|
|
15729
|
+
* consumer can pass them as `mqtt.connect(url, { username, password })`
|
|
15730
|
+
* instead of stuffing creds into the URL (which leaks them into logs).
|
|
16049
15731
|
*/
|
|
16050
|
-
var
|
|
16051
|
-
|
|
16052
|
-
|
|
15732
|
+
var BrokerConnectionDetailsSchema = z.object({
|
|
15733
|
+
url: z.string(),
|
|
15734
|
+
username: z.string().optional(),
|
|
15735
|
+
password: z.string().optional(),
|
|
15736
|
+
/**
|
|
15737
|
+
* Suggested prefix for `clientId`. Each consumer should suffix this
|
|
15738
|
+
* with its own discriminator (addon id, instance id) so reconnects
|
|
15739
|
+
* don't kick each other off (MQTT spec: clientId must be unique per
|
|
15740
|
+
* broker).
|
|
15741
|
+
*/
|
|
15742
|
+
clientIdPrefix: z.string().optional()
|
|
16053
15743
|
});
|
|
16054
|
-
var
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
consumer: z.string(),
|
|
16061
|
-
system: z.string().optional(),
|
|
16062
|
-
/** v1: single-turn. `messages[]` is a v2 additive field. */
|
|
16063
|
-
prompt: z.string(),
|
|
16064
|
-
/** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
|
|
16065
|
-
jsonSchema: z.record(z.string(), z.unknown()).optional(),
|
|
16066
|
-
/** Per-call override of the profile default. */
|
|
16067
|
-
maxTokens: z.number().int().positive().optional(),
|
|
16068
|
-
temperature: z.number().optional()
|
|
15744
|
+
var AddBrokerInputSchema = z.object({
|
|
15745
|
+
name: z.string().min(1),
|
|
15746
|
+
url: z.string().regex(/^(mqtt|mqtts|ws|wss):\/\//, "URL must start with mqtt(s):// or ws(s)://"),
|
|
15747
|
+
username: z.string().optional(),
|
|
15748
|
+
password: z.string().optional(),
|
|
15749
|
+
clientIdPrefix: z.string().optional()
|
|
16069
15750
|
});
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
z.
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
z.object({
|
|
16087
|
-
kind: z.literal("url"),
|
|
16088
|
-
url: z.string(),
|
|
16089
|
-
sha256: z.string().optional()
|
|
16090
|
-
}),
|
|
16091
|
-
z.object({
|
|
16092
|
-
kind: z.literal("path"),
|
|
16093
|
-
path: z.string()
|
|
16094
|
-
})
|
|
16095
|
-
]);
|
|
16096
|
-
var ManagedRuntimeConfigSchema = z.object({
|
|
16097
|
-
/** WHERE the runtime lives — hub or any agent. */
|
|
16098
|
-
nodeId: z.string(),
|
|
16099
|
-
/** Closed for v1; 'ollama' is a v2 candidate. */
|
|
16100
|
-
engine: z.enum(["llama-cpp"]),
|
|
16101
|
-
model: ManagedModelRefSchema,
|
|
16102
|
-
contextSize: z.number().int().default(4096),
|
|
16103
|
-
/** 0 = CPU-only. */
|
|
16104
|
-
gpuLayers: z.number().int().default(0),
|
|
16105
|
-
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
16106
|
-
threads: z.number().int().optional(),
|
|
16107
|
-
/** Concurrent slots. */
|
|
16108
|
-
parallel: z.number().int().default(1),
|
|
16109
|
-
/** Else lazy: first generate boots it. */
|
|
16110
|
-
autoStart: z.boolean().default(false),
|
|
16111
|
-
/** 0 = never; frees RAM after quiet periods. */
|
|
16112
|
-
idleStopMinutes: z.number().int().default(30)
|
|
15751
|
+
var AddBrokerResultSchema = z.object({ id: z.string() });
|
|
15752
|
+
var IdInputSchema = z.object({ id: z.string() });
|
|
15753
|
+
var TestResultSchema$1 = z.discriminatedUnion("ok", [z.object({
|
|
15754
|
+
ok: z.literal(true),
|
|
15755
|
+
latencyMs: z.number()
|
|
15756
|
+
}), z.object({
|
|
15757
|
+
ok: z.literal(false),
|
|
15758
|
+
error: z.string()
|
|
15759
|
+
})]);
|
|
15760
|
+
var StartEmbeddedInputSchema = z.object({
|
|
15761
|
+
port: z.number().int().min(1).max(65535).default(1883),
|
|
15762
|
+
/** Allow anonymous connect (no username/password). Default: false. */
|
|
15763
|
+
allowAnonymous: z.boolean().default(false),
|
|
15764
|
+
/** Optional shared username/password for clients. */
|
|
15765
|
+
username: z.string().optional(),
|
|
15766
|
+
password: z.string().optional()
|
|
16113
15767
|
});
|
|
16114
|
-
var
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
state: z.enum([
|
|
16118
|
-
"stopped",
|
|
16119
|
-
"downloading",
|
|
16120
|
-
"starting",
|
|
16121
|
-
"ready",
|
|
16122
|
-
"crashed",
|
|
16123
|
-
"failed"
|
|
16124
|
-
]),
|
|
16125
|
-
pid: z.number().optional(),
|
|
16126
|
-
port: z.number().optional(),
|
|
16127
|
-
modelPath: z.string().optional(),
|
|
16128
|
-
modelId: z.string().optional(),
|
|
16129
|
-
downloadProgress: z.number().min(0).max(1).optional(),
|
|
16130
|
-
lastError: z.string().optional(),
|
|
16131
|
-
crashesInWindow: z.number(),
|
|
16132
|
-
/** Child RSS (sampled best-effort). */
|
|
16133
|
-
memoryBytes: z.number().optional(),
|
|
16134
|
-
vramBytes: z.number().optional()
|
|
15768
|
+
var StartEmbeddedResultSchema = z.object({
|
|
15769
|
+
id: z.string(),
|
|
15770
|
+
url: z.string()
|
|
16135
15771
|
});
|
|
16136
|
-
var
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
catalogId: z.string().optional(),
|
|
16140
|
-
installedAt: z.number().optional()
|
|
15772
|
+
var StatusSchema = z.object({
|
|
15773
|
+
brokerCount: z.number(),
|
|
15774
|
+
embeddedRunning: z.boolean()
|
|
16141
15775
|
});
|
|
16142
|
-
var
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
15776
|
+
var mqttBrokerCapability = {
|
|
15777
|
+
name: "mqtt-broker",
|
|
15778
|
+
scope: "system",
|
|
15779
|
+
mode: "collection",
|
|
15780
|
+
providerKind: "broker",
|
|
15781
|
+
status: {
|
|
15782
|
+
schema: StatusSchema,
|
|
15783
|
+
kind: "poll"
|
|
15784
|
+
},
|
|
15785
|
+
methods: {
|
|
15786
|
+
listBrokers: method(z.void(), z.array(BrokerInfoSchema)),
|
|
15787
|
+
getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
|
|
15788
|
+
addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
|
|
15789
|
+
removeBroker: method(IdInputSchema, z.void(), { kind: "mutation" }),
|
|
15790
|
+
testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
|
|
15791
|
+
startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
|
|
15792
|
+
stopEmbeddedBroker: method(IdInputSchema, z.void(), { kind: "mutation" }),
|
|
15793
|
+
getStatus: method(z.void(), StatusSchema)
|
|
15794
|
+
}
|
|
15795
|
+
};
|
|
15796
|
+
var NetworkEndpointSchema = z.object({
|
|
15797
|
+
url: z.string(),
|
|
15798
|
+
hostname: z.string(),
|
|
15799
|
+
port: z.number(),
|
|
15800
|
+
protocol: z.enum(["http", "https"])
|
|
16146
15801
|
});
|
|
16147
|
-
var
|
|
16148
|
-
|
|
15802
|
+
var NetworkAccessStatusSchema = z.object({
|
|
15803
|
+
connected: z.boolean(),
|
|
15804
|
+
endpoint: NetworkEndpointSchema.nullable(),
|
|
15805
|
+
error: z.string().optional()
|
|
15806
|
+
});
|
|
15807
|
+
/**
|
|
15808
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
15809
|
+
* MORE than one ingress concurrently (Tailscale Ingress with mixed
|
|
15810
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
15811
|
+
* the originating provider config (mode + sourcePort) so the
|
|
15812
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
15813
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
15814
|
+
*/
|
|
15815
|
+
var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
15816
|
+
/**
|
|
15817
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
15818
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
15819
|
+
*/
|
|
15820
|
+
id: z.string(),
|
|
15821
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
15822
|
+
label: z.string(),
|
|
15823
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
15824
|
+
mode: z.string().optional(),
|
|
15825
|
+
/** Originating local port the ingress fronts (informational). */
|
|
15826
|
+
sourcePort: z.number().optional()
|
|
15827
|
+
});
|
|
15828
|
+
var networkAccessCapability = {
|
|
15829
|
+
name: "network-access",
|
|
16149
15830
|
scope: "system",
|
|
16150
|
-
mode: "
|
|
16151
|
-
|
|
15831
|
+
mode: "collection",
|
|
15832
|
+
providerKind: "ingress",
|
|
16152
15833
|
methods: {
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
stop: method(z.object({}), z.void(), {
|
|
16164
|
-
kind: "mutation",
|
|
16165
|
-
auth: "admin"
|
|
16166
|
-
}),
|
|
16167
|
-
status: method(z.object({}), LlmRuntimeStatusSchema),
|
|
16168
|
-
installModel: method(z.object({ model: ManagedModelRefSchema }), z.void(), {
|
|
16169
|
-
kind: "mutation",
|
|
16170
|
-
auth: "admin"
|
|
16171
|
-
}),
|
|
16172
|
-
deleteModel: method(z.object({ file: z.string() }), z.void(), {
|
|
16173
|
-
kind: "mutation",
|
|
16174
|
-
auth: "admin"
|
|
16175
|
-
}),
|
|
16176
|
-
listLocalModels: method(z.object({}), z.array(LlmNodeModelSchema)),
|
|
16177
|
-
getDiskUsage: method(z.object({}), LlmRuntimeDiskUsageSchema)
|
|
15834
|
+
start: method(z.void(), NetworkEndpointSchema, { kind: "mutation" }),
|
|
15835
|
+
stop: method(z.void(), z.void(), { kind: "mutation" }),
|
|
15836
|
+
getEndpoint: method(z.void(), NetworkEndpointSchema.nullable()),
|
|
15837
|
+
getStatus: method(z.void(), NetworkAccessStatusSchema),
|
|
15838
|
+
/**
|
|
15839
|
+
* Enumerate every active ingress entry. Providers that expose only a
|
|
15840
|
+
* single endpoint may omit this method; callers fall back to
|
|
15841
|
+
* `getEndpoint()` in that case.
|
|
15842
|
+
*/
|
|
15843
|
+
listEndpoints: method(z.void(), z.array(NetworkEndpointEntrySchema).readonly())
|
|
16178
15844
|
}
|
|
16179
15845
|
};
|
|
16180
15846
|
/**
|
|
16181
|
-
*
|
|
16182
|
-
* methods concat-fan across providers; single-row methods route to ONE
|
|
16183
|
-
* provider by the `addonId` in the call input (the notification-output
|
|
16184
|
-
* posture, notification-output.cap.ts:215-250). Provided by `addon-ai`
|
|
16185
|
-
* (hub-placed); the cap stays open for future providers.
|
|
15847
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
16186
15848
|
*
|
|
16187
|
-
*
|
|
16188
|
-
* `
|
|
16189
|
-
*
|
|
15849
|
+
* Apprise-derived model (see
|
|
15850
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
15851
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
15852
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
15853
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
15854
|
+
* message to what the kind supports — callers never special-case a service.
|
|
15855
|
+
*
|
|
15856
|
+
* DESIGN DECISIONS (locked):
|
|
15857
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
15858
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
15859
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
15860
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
15861
|
+
* alternative would fork the UI per addon and cannot host the
|
|
15862
|
+
* discovery→adopt flow.
|
|
15863
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
15864
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
15865
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
15866
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
15867
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
15868
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
15869
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
15870
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
15871
|
+
* base64 fallback needed.
|
|
15872
|
+
*
|
|
15873
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
15874
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
15875
|
+
* admin "Integrations" page.
|
|
16190
15876
|
*/
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
"
|
|
15877
|
+
/**
|
|
15878
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
15879
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
15880
|
+
*/
|
|
15881
|
+
var AttachmentMediaTypeSchema = z.enum([
|
|
15882
|
+
"image",
|
|
15883
|
+
"video",
|
|
15884
|
+
"gif",
|
|
15885
|
+
"audio",
|
|
15886
|
+
"icon"
|
|
16197
15887
|
]);
|
|
16198
|
-
|
|
15888
|
+
/**
|
|
15889
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
15890
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
15891
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
15892
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
15893
|
+
*/
|
|
15894
|
+
var AttachmentSchema = z.object({
|
|
15895
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
15896
|
+
url: z.string().optional(),
|
|
15897
|
+
bytes: z.instanceof(Uint8Array).optional(),
|
|
15898
|
+
mime: z.string().optional(),
|
|
15899
|
+
name: z.string().optional()
|
|
15900
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
15901
|
+
var NotificationFormatSchema = z.enum([
|
|
15902
|
+
"text",
|
|
15903
|
+
"markdown",
|
|
15904
|
+
"html"
|
|
15905
|
+
]);
|
|
15906
|
+
/** A single tap-through action button. */
|
|
15907
|
+
var NotificationActionSchema = z.object({
|
|
16199
15908
|
id: z.string(),
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
16203
|
-
addonId: z.string(),
|
|
16204
|
-
enabled: z.boolean(),
|
|
16205
|
-
/** Vendor model id, or the managed runtime's loaded model. */
|
|
16206
|
-
model: z.string(),
|
|
16207
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
16208
|
-
baseUrl: z.string().optional(),
|
|
16209
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
16210
|
-
apiKey: z.string().optional(),
|
|
16211
|
-
supportsVision: z.boolean(),
|
|
16212
|
-
temperature: z.number().min(0).max(2).optional(),
|
|
16213
|
-
maxTokens: z.number().int().positive().optional(),
|
|
16214
|
-
timeoutMs: z.number().int().positive().default(6e4),
|
|
16215
|
-
extraHeaders: z.record(z.string(), z.string()).optional(),
|
|
16216
|
-
/** kind === 'managed-local' only (spec §4). */
|
|
16217
|
-
runtime: ManagedRuntimeConfigSchema.optional()
|
|
15909
|
+
label: z.string(),
|
|
15910
|
+
url: z.string().optional()
|
|
16218
15911
|
});
|
|
16219
|
-
/**
|
|
16220
|
-
*
|
|
16221
|
-
*
|
|
15912
|
+
/**
|
|
15913
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
15914
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
15915
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
15916
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
15917
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
15918
|
+
* `priority` for that one target.
|
|
15919
|
+
*/
|
|
15920
|
+
var NotificationSchema = z.object({
|
|
15921
|
+
body: z.string(),
|
|
15922
|
+
title: z.string().optional(),
|
|
15923
|
+
format: NotificationFormatSchema.default("text"),
|
|
15924
|
+
priority: z.number().int().min(1).max(5).default(3),
|
|
15925
|
+
level: z.string().optional(),
|
|
15926
|
+
attachments: z.array(AttachmentSchema).optional(),
|
|
15927
|
+
clickUrl: z.string().optional(),
|
|
15928
|
+
actions: z.array(NotificationActionSchema).optional(),
|
|
15929
|
+
sound: z.string().optional(),
|
|
15930
|
+
ttl: z.number().optional(),
|
|
15931
|
+
tag: z.string().optional(),
|
|
15932
|
+
deviceId: z.number().optional(),
|
|
15933
|
+
eventId: z.string().optional(),
|
|
15934
|
+
metadata: z.record(z.string(), z.unknown()).optional()
|
|
15935
|
+
});
|
|
15936
|
+
/** One declared native severity/priority level for a kind. */
|
|
15937
|
+
var TargetKindLevelSchema = z.object({
|
|
15938
|
+
id: z.string(),
|
|
15939
|
+
label: z.string(),
|
|
15940
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
15941
|
+
ordinal: z.number().int().min(1).max(5).nullable(),
|
|
15942
|
+
flags: z.object({
|
|
15943
|
+
critical: z.boolean().optional(),
|
|
15944
|
+
silent: z.boolean().optional(),
|
|
15945
|
+
noPush: z.boolean().optional()
|
|
15946
|
+
}).optional(),
|
|
15947
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
15948
|
+
requires: z.array(z.string()).optional(),
|
|
15949
|
+
description: z.string().optional()
|
|
15950
|
+
});
|
|
15951
|
+
/** Attachment capabilities for a kind (drives the degrade engine + test panel). */
|
|
15952
|
+
var TargetKindAttachmentsCapsSchema = z.object({
|
|
15953
|
+
mediaTypes: z.array(AttachmentMediaTypeSchema),
|
|
15954
|
+
mode: z.enum([
|
|
15955
|
+
"url",
|
|
15956
|
+
"bytes",
|
|
15957
|
+
"both"
|
|
15958
|
+
]),
|
|
15959
|
+
max: z.number().int().nonnegative(),
|
|
15960
|
+
maxBytes: z.number().int().positive().optional()
|
|
15961
|
+
});
|
|
15962
|
+
/** The full capability block consulted before dispatch. */
|
|
15963
|
+
var TargetKindCapsSchema = z.object({
|
|
15964
|
+
attachments: TargetKindAttachmentsCapsSchema,
|
|
15965
|
+
/** Max action buttons (0 = none). */
|
|
15966
|
+
actions: z.number().int().nonnegative(),
|
|
15967
|
+
levels: z.array(TargetKindLevelSchema),
|
|
15968
|
+
format: z.array(NotificationFormatSchema),
|
|
15969
|
+
clickUrl: z.boolean(),
|
|
15970
|
+
sound: z.boolean(),
|
|
15971
|
+
ttl: z.boolean(),
|
|
15972
|
+
bodyMaxLen: z.number().int().positive()
|
|
15973
|
+
});
|
|
15974
|
+
/**
|
|
15975
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
15976
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
15977
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
15978
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
15979
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
15980
|
+
*/
|
|
16222
15981
|
var ConfigSchemaPassthrough = z.unknown();
|
|
16223
|
-
var
|
|
16224
|
-
kind:
|
|
15982
|
+
var TargetKindSchema = z.object({
|
|
15983
|
+
kind: z.string(),
|
|
16225
15984
|
label: z.string(),
|
|
16226
15985
|
icon: z.string(),
|
|
16227
15986
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
16228
15987
|
addonId: z.string(),
|
|
16229
|
-
configSchema: ConfigSchemaPassthrough
|
|
15988
|
+
configSchema: ConfigSchemaPassthrough,
|
|
15989
|
+
supportsDiscovery: z.boolean(),
|
|
15990
|
+
caps: TargetKindCapsSchema
|
|
16230
15991
|
});
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
|
|
16234
|
-
|
|
15992
|
+
/**
|
|
15993
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
15994
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
15995
|
+
* round-trip a stored secret to the UI.
|
|
15996
|
+
*/
|
|
15997
|
+
var TargetSchema = z.object({
|
|
15998
|
+
id: z.string(),
|
|
15999
|
+
name: z.string(),
|
|
16000
|
+
kind: z.string(),
|
|
16001
|
+
addonId: z.string(),
|
|
16002
|
+
enabled: z.boolean(),
|
|
16003
|
+
config: z.record(z.string(), z.unknown())
|
|
16235
16004
|
});
|
|
16236
|
-
/**
|
|
16237
|
-
var
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
calls: z.number(),
|
|
16242
|
-
okCalls: z.number(),
|
|
16243
|
-
errorCalls: z.number(),
|
|
16244
|
-
inputTokens: z.number(),
|
|
16245
|
-
outputTokens: z.number(),
|
|
16246
|
-
avgLatencyMs: z.number()
|
|
16005
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
16006
|
+
var DiscoveredTargetSchema = z.object({
|
|
16007
|
+
kind: z.string(),
|
|
16008
|
+
suggestedName: z.string(),
|
|
16009
|
+
config: z.record(z.string(), z.unknown())
|
|
16247
16010
|
});
|
|
16248
|
-
/**
|
|
16249
|
-
var
|
|
16011
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
16012
|
+
var RenderedAsSchema = z.object({
|
|
16013
|
+
level: z.string(),
|
|
16014
|
+
format: NotificationFormatSchema,
|
|
16015
|
+
attachmentsSent: z.number().int().nonnegative(),
|
|
16016
|
+
actionsSent: z.number().int().nonnegative(),
|
|
16017
|
+
truncated: z.boolean(),
|
|
16018
|
+
dropped: z.array(z.string())
|
|
16019
|
+
});
|
|
16020
|
+
var SendResultSchema = z.object({
|
|
16021
|
+
success: z.boolean(),
|
|
16022
|
+
error: z.string().optional(),
|
|
16023
|
+
renderedAs: RenderedAsSchema.optional()
|
|
16024
|
+
});
|
|
16025
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
16026
|
+
var TestResultSchema = SendResultSchema;
|
|
16027
|
+
var notificationOutputCapability = {
|
|
16028
|
+
name: "notification-output",
|
|
16029
|
+
scope: "system",
|
|
16030
|
+
mode: "collection",
|
|
16031
|
+
methods: {
|
|
16032
|
+
listTargetKinds: method(z.object({}), z.array(TargetKindSchema)),
|
|
16033
|
+
listTargets: method(z.object({}), z.array(TargetSchema)),
|
|
16034
|
+
discoverTargets: method(z.object({
|
|
16035
|
+
kind: z.string(),
|
|
16036
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
16037
|
+
}), z.array(DiscoveredTargetSchema)),
|
|
16038
|
+
send: method(z.object({
|
|
16039
|
+
targetId: z.string(),
|
|
16040
|
+
notification: NotificationSchema
|
|
16041
|
+
}), SendResultSchema, { kind: "mutation" }),
|
|
16042
|
+
testTarget: method(z.object({
|
|
16043
|
+
targetId: z.string(),
|
|
16044
|
+
sample: NotificationSchema.optional()
|
|
16045
|
+
}), TestResultSchema, { kind: "mutation" }),
|
|
16046
|
+
upsertTarget: method(z.object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }),
|
|
16047
|
+
deleteTarget: method(z.object({ targetId: z.string() }), z.void(), { kind: "mutation" }),
|
|
16048
|
+
setTargetEnabled: method(z.object({
|
|
16049
|
+
targetId: z.string(),
|
|
16050
|
+
enabled: z.boolean()
|
|
16051
|
+
}), z.void(), { kind: "mutation" })
|
|
16052
|
+
}
|
|
16053
|
+
};
|
|
16054
|
+
/**
|
|
16055
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
16056
|
+
*
|
|
16057
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
16058
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
16059
|
+
*
|
|
16060
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
16061
|
+
* `notification-center` module), hooked on the durable persistence
|
|
16062
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
16063
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
16064
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
16065
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
16066
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
16067
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
16068
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
16069
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
16070
|
+
* target kind's own caps/degrade engine).
|
|
16071
|
+
*
|
|
16072
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
16073
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
16074
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
16075
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
16076
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
16077
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
16078
|
+
* P2+ (see spec §7).
|
|
16079
|
+
*
|
|
16080
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
16081
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
16082
|
+
* schema/interface drift is explicitly not repeated).
|
|
16083
|
+
*/
|
|
16084
|
+
/**
|
|
16085
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
16086
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
16087
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
16088
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
16089
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
16090
|
+
* change of a LINKED device, one row per linked camera)
|
|
16091
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
16092
|
+
* delivery / pick-up)
|
|
16093
|
+
*
|
|
16094
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
16095
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
16096
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
16097
|
+
* one trigger.
|
|
16098
|
+
*/
|
|
16099
|
+
var NcDeliverySchema = z.enum([
|
|
16100
|
+
"immediate",
|
|
16101
|
+
"track-end",
|
|
16102
|
+
"device-event",
|
|
16103
|
+
"package-event"
|
|
16104
|
+
]);
|
|
16105
|
+
/** One weekly activation window. `startMinute > endMinute` crosses midnight. */
|
|
16106
|
+
var NcScheduleWindowSchema = z.object({
|
|
16107
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
16108
|
+
days: z.array(z.number().int().min(0).max(6)).min(1),
|
|
16109
|
+
startMinute: z.number().int().min(0).max(1439),
|
|
16110
|
+
endMinute: z.number().int().min(0).max(1439)
|
|
16111
|
+
});
|
|
16112
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
16113
|
+
var NcScheduleSchema = z.object({
|
|
16114
|
+
windows: z.array(NcScheduleWindowSchema).min(1),
|
|
16115
|
+
/** IANA timezone; default = hub host timezone. */
|
|
16116
|
+
timezone: z.string().optional(),
|
|
16117
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
16118
|
+
invert: z.boolean().optional()
|
|
16119
|
+
});
|
|
16120
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
16121
|
+
var NcPlateMatcherSchema = z.object({
|
|
16122
|
+
values: z.array(z.string().min(1)).min(1),
|
|
16123
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
16124
|
+
maxDistance: z.number().int().min(0).max(3).default(1)
|
|
16125
|
+
});
|
|
16126
|
+
/**
|
|
16127
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
16128
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
16129
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
16130
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
16131
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
16132
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
16133
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
16134
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
16135
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
16136
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
16137
|
+
* (declared SQLite collection, reseeded on boot).
|
|
16138
|
+
*/
|
|
16139
|
+
var NcOccupancyConditionSchema = z.object({
|
|
16140
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
16141
|
+
zoneId: z.string().optional(),
|
|
16142
|
+
/** Object class to count; absent = any class. */
|
|
16143
|
+
className: z.string().optional(),
|
|
16144
|
+
op: z.enum([
|
|
16145
|
+
"became-occupied",
|
|
16146
|
+
"became-free",
|
|
16147
|
+
">=",
|
|
16148
|
+
"<="
|
|
16149
|
+
]).default("became-occupied"),
|
|
16150
|
+
count: z.number().int().min(0).default(1),
|
|
16151
|
+
sustainSeconds: z.number().int().min(0).max(3600).default(15)
|
|
16152
|
+
});
|
|
16153
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
16154
|
+
var NcZoneConditionSchema = z.object({
|
|
16155
|
+
ids: z.array(z.string().min(1)).min(1),
|
|
16156
|
+
/** Quantifier over `ids` — at least one / every one visited. */
|
|
16157
|
+
match: z.enum(["any", "all"]).default("any")
|
|
16158
|
+
});
|
|
16159
|
+
/**
|
|
16160
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
16161
|
+
* membership lists are OR within the list (spec §2.3).
|
|
16162
|
+
*/
|
|
16163
|
+
var NcConditionsSchema = z.object({
|
|
16164
|
+
/** Device scope — absent = all devices. */
|
|
16165
|
+
devices: z.array(z.number()).optional(),
|
|
16166
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
16167
|
+
classes: z.array(z.string().min(1)).optional(),
|
|
16168
|
+
/** Veto classes — any overlap fails the rule. */
|
|
16169
|
+
classesExclude: z.array(z.string().min(1)).optional(),
|
|
16170
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
16171
|
+
minConfidence: z.number().min(0).max(1).optional(),
|
|
16172
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
16173
|
+
zones: NcZoneConditionSchema.optional(),
|
|
16174
|
+
/** Veto zones — any hit fails the rule. */
|
|
16175
|
+
zonesExclude: z.array(z.string().min(1)).optional(),
|
|
16176
|
+
/**
|
|
16177
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
16178
|
+
* (identity name / plate text / subclass).
|
|
16179
|
+
*/
|
|
16180
|
+
labelEquals: z.array(z.string().min(1)).optional(),
|
|
16181
|
+
/**
|
|
16182
|
+
* Identity matcher. P1 boundary: matched against the record's collapsed
|
|
16183
|
+
* `label` (the identity display name propagated by the face pipeline) —
|
|
16184
|
+
* identity-ID matching rides in P2 when identity ids reach the record.
|
|
16185
|
+
*/
|
|
16186
|
+
identities: z.array(z.string().min(1)).optional(),
|
|
16187
|
+
/** Fuzzy plate matcher against the record's `label` (plate text). */
|
|
16188
|
+
plates: NcPlateMatcherSchema.optional(),
|
|
16189
|
+
/**
|
|
16190
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics.
|
|
16191
|
+
* Same P1 boundary: matched against the record's collapsed `label` (the
|
|
16192
|
+
* identity display name). A record with NO label passes (nothing to
|
|
16193
|
+
* exclude), unlike the include variant which fails on an absent label.
|
|
16194
|
+
*/
|
|
16195
|
+
identitiesExclude: z.array(z.string().min(1)).optional(),
|
|
16196
|
+
/**
|
|
16197
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
16198
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
16199
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
16200
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
16201
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
16202
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
16203
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
16204
|
+
*/
|
|
16205
|
+
minImportance: z.number().min(0).max(1).optional(),
|
|
16206
|
+
/**
|
|
16207
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
16208
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
16209
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
16210
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
16211
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
16212
|
+
*/
|
|
16213
|
+
minDwellSeconds: z.number().min(0).optional(),
|
|
16214
|
+
/**
|
|
16215
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
16216
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
16217
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
16218
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
16219
|
+
* tracks carry `sensor`.
|
|
16220
|
+
*/
|
|
16221
|
+
source: z.enum([
|
|
16222
|
+
"pipeline",
|
|
16223
|
+
"onboard",
|
|
16224
|
+
"sensor",
|
|
16225
|
+
"any"
|
|
16226
|
+
]).optional(),
|
|
16227
|
+
/**
|
|
16228
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
16229
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
16230
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
16231
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
16232
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
16233
|
+
*
|
|
16234
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
16235
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
16236
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
16237
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
16238
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
16239
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
16240
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
16241
|
+
* one track the higher of the two is used. A track that ended with no
|
|
16242
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
16243
|
+
* closed for it (an un-recognized subject).
|
|
16244
|
+
*/
|
|
16245
|
+
minLabelConfidence: z.number().min(0).max(1).optional(),
|
|
16246
|
+
/**
|
|
16247
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
16248
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
16249
|
+
* against the token carried on the device-event subject (extracted from the
|
|
16250
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
16251
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
16252
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
16253
|
+
*/
|
|
16254
|
+
eventTypeTokens: z.array(z.string().min(1)).optional(),
|
|
16255
|
+
/**
|
|
16256
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
16257
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
16258
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
16259
|
+
*/
|
|
16260
|
+
sensorKinds: z.array(z.string().min(1)).optional(),
|
|
16261
|
+
/**
|
|
16262
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
16263
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
16264
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
16265
|
+
* on the package-event trigger).
|
|
16266
|
+
*/
|
|
16267
|
+
packagePhase: z.enum([
|
|
16268
|
+
"delivered",
|
|
16269
|
+
"picked-up",
|
|
16270
|
+
"both"
|
|
16271
|
+
]).optional(),
|
|
16272
|
+
/**
|
|
16273
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
16274
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
16275
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
16276
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
16277
|
+
*/
|
|
16278
|
+
customZones: z.array(MaskPolygonShapeSchema).optional(),
|
|
16279
|
+
/**
|
|
16280
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
16281
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
16282
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
16283
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
16284
|
+
*/
|
|
16285
|
+
occupancy: NcOccupancyConditionSchema.optional()
|
|
16286
|
+
});
|
|
16287
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
16288
|
+
var NcRuleTargetSchema = z.object({
|
|
16289
|
+
/** `notification-output` Target id. */
|
|
16290
|
+
targetId: z.string().min(1),
|
|
16291
|
+
/**
|
|
16292
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
16293
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
16294
|
+
* degrade engine drops what the backend can't render.
|
|
16295
|
+
*/
|
|
16296
|
+
params: z.record(z.string(), z.unknown()).optional()
|
|
16297
|
+
});
|
|
16298
|
+
/**
|
|
16299
|
+
* Media attachment policy (P1 still-image subset).
|
|
16300
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
16301
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
16302
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
16303
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
16304
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
16305
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
16306
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
16307
|
+
* name), so the choice never drifts from the record that fired it.
|
|
16308
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
16309
|
+
* - `none` — no attachment.
|
|
16310
|
+
*/
|
|
16311
|
+
var NcMediaPolicySchema = z.object({ attach: z.enum([
|
|
16312
|
+
"best",
|
|
16313
|
+
"best-matching",
|
|
16314
|
+
"keyFrame",
|
|
16315
|
+
"none"
|
|
16316
|
+
]).default("best") });
|
|
16317
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
16318
|
+
var NcThrottleSchema = z.object({
|
|
16319
|
+
cooldownSec: z.number().int().min(0).max(86400).default(60),
|
|
16320
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
16321
|
+
scope: z.enum(["rule", "rule-device"]).default("rule-device")
|
|
16322
|
+
});
|
|
16323
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
16324
|
+
var NcRuleInputSchema = z.object({
|
|
16325
|
+
name: z.string().min(1).max(200),
|
|
16326
|
+
enabled: z.boolean().default(true),
|
|
16327
|
+
delivery: NcDeliverySchema,
|
|
16328
|
+
conditions: NcConditionsSchema.default({}),
|
|
16329
|
+
schedule: NcScheduleSchema.optional(),
|
|
16330
|
+
targets: z.array(NcRuleTargetSchema).min(1),
|
|
16331
|
+
media: NcMediaPolicySchema.default({ attach: "best" }),
|
|
16332
|
+
throttle: NcThrottleSchema.default({
|
|
16333
|
+
cooldownSec: 60,
|
|
16334
|
+
scope: "rule-device"
|
|
16335
|
+
}),
|
|
16336
|
+
/** `{{var}}` templating over camera/class/label/zones/confidence/time. */
|
|
16337
|
+
template: z.object({
|
|
16338
|
+
title: z.string().max(500).optional(),
|
|
16339
|
+
body: z.string().max(2e3).optional()
|
|
16340
|
+
}).optional(),
|
|
16341
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
16342
|
+
priority: z.number().int().min(1).max(5).default(3),
|
|
16343
|
+
/**
|
|
16344
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
16345
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
16346
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
16347
|
+
*/
|
|
16348
|
+
ownerUserId: z.string().optional()
|
|
16349
|
+
});
|
|
16350
|
+
/**
|
|
16351
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
16352
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
16353
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
16354
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
16355
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
16356
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
16357
|
+
* `updateRule` patch.
|
|
16358
|
+
*/
|
|
16359
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: z.array(z.string()).optional() });
|
|
16360
|
+
/** A persisted rule. */
|
|
16361
|
+
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
16362
|
+
id: z.string(),
|
|
16363
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
16364
|
+
createdBy: z.string(),
|
|
16365
|
+
createdAt: z.number(),
|
|
16366
|
+
updatedAt: z.number(),
|
|
16367
|
+
/**
|
|
16368
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
16369
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
16370
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
16371
|
+
*/
|
|
16372
|
+
disabledTargetIds: z.array(z.string()).default([])
|
|
16373
|
+
});
|
|
16374
|
+
var NcTestResultSchema = z.object({
|
|
16375
|
+
recordId: z.string(),
|
|
16376
|
+
recordKind: z.enum([
|
|
16377
|
+
"object-event",
|
|
16378
|
+
"track",
|
|
16379
|
+
"device-event",
|
|
16380
|
+
"package-event"
|
|
16381
|
+
]),
|
|
16382
|
+
deviceId: z.number(),
|
|
16383
|
+
timestamp: z.number(),
|
|
16384
|
+
wouldFire: z.boolean(),
|
|
16385
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
16386
|
+
failedCondition: z.string().optional(),
|
|
16387
|
+
className: z.string().optional(),
|
|
16388
|
+
label: z.string().optional()
|
|
16389
|
+
});
|
|
16390
|
+
var NcConditionDescriptorSchema = z.object({
|
|
16391
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
16250
16392
|
id: z.string(),
|
|
16393
|
+
group: z.enum([
|
|
16394
|
+
"scope",
|
|
16395
|
+
"class",
|
|
16396
|
+
"zones",
|
|
16397
|
+
"quality",
|
|
16398
|
+
"label",
|
|
16399
|
+
"schedule",
|
|
16400
|
+
"device",
|
|
16401
|
+
"package",
|
|
16402
|
+
"occupancy"
|
|
16403
|
+
]),
|
|
16251
16404
|
label: z.string(),
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16405
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
16406
|
+
valueType: z.enum([
|
|
16407
|
+
"deviceIdList",
|
|
16408
|
+
"stringList",
|
|
16409
|
+
"number01",
|
|
16410
|
+
"number",
|
|
16411
|
+
"sourceSelect",
|
|
16412
|
+
"zoneSelection",
|
|
16413
|
+
"zoneIdList",
|
|
16414
|
+
"schedule",
|
|
16415
|
+
"plateMatcher",
|
|
16416
|
+
"packagePhase",
|
|
16417
|
+
"polygonDraw",
|
|
16418
|
+
"occupancy"
|
|
16419
|
+
]),
|
|
16420
|
+
operator: z.enum([
|
|
16421
|
+
"in",
|
|
16422
|
+
"notIn",
|
|
16423
|
+
"anyOf",
|
|
16424
|
+
"allOf",
|
|
16425
|
+
"gte",
|
|
16426
|
+
"fuzzyIn",
|
|
16427
|
+
"withinSchedule"
|
|
16428
|
+
]),
|
|
16429
|
+
/** Which delivery kinds the condition applies to. */
|
|
16430
|
+
appliesTo: z.array(NcDeliverySchema),
|
|
16431
|
+
phase: z.string(),
|
|
16432
|
+
description: z.string().optional()
|
|
16263
16433
|
});
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
|
|
16434
|
+
/**
|
|
16435
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
16436
|
+
* durable outbox row's own status (single source of truth):
|
|
16437
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
16438
|
+
* - `sent` — delivered (terminal)
|
|
16439
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
16440
|
+
* backend rejection / a deleted target (terminal; carries
|
|
16441
|
+
* the failure `error`)
|
|
16442
|
+
*
|
|
16443
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
16444
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
16445
|
+
*/
|
|
16446
|
+
var NcHistoryStatusSchema = z.enum([
|
|
16447
|
+
"pending",
|
|
16448
|
+
"sent",
|
|
16449
|
+
"dead"
|
|
16450
|
+
]);
|
|
16451
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
16452
|
+
var NcHistoryRecordKindSchema = z.enum([
|
|
16453
|
+
"object-event",
|
|
16454
|
+
"track-end",
|
|
16455
|
+
"device-event",
|
|
16456
|
+
"package-event"
|
|
16457
|
+
]);
|
|
16458
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
16459
|
+
var NcHistorySubjectSchema = z.object({
|
|
16460
|
+
className: z.string(),
|
|
16461
|
+
label: z.string().optional(),
|
|
16462
|
+
confidence: z.number().optional(),
|
|
16463
|
+
zones: z.array(z.string()),
|
|
16464
|
+
timestamp: z.number()
|
|
16270
16465
|
});
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16274
|
-
|
|
16466
|
+
/**
|
|
16467
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
16468
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
16469
|
+
* NO second write path, so history can never drift from delivery state).
|
|
16470
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
16471
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
16472
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
16473
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
16474
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
16475
|
+
* P1 (admin scope only).
|
|
16476
|
+
*/
|
|
16477
|
+
var NcHistoryEntrySchema = z.object({
|
|
16478
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
16479
|
+
id: z.string(),
|
|
16480
|
+
ruleId: z.string(),
|
|
16481
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
16482
|
+
ruleName: z.string(),
|
|
16483
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
16484
|
+
delivery: NcDeliverySchema,
|
|
16485
|
+
targetId: z.string(),
|
|
16486
|
+
deviceId: z.number(),
|
|
16487
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
16488
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
16489
|
+
recordId: z.string(),
|
|
16490
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
16491
|
+
trackId: z.string().optional(),
|
|
16492
|
+
status: NcHistoryStatusSchema,
|
|
16493
|
+
/** Delivery attempts made so far. */
|
|
16494
|
+
attempts: z.number().int(),
|
|
16495
|
+
/** Fire time (outbox enqueue). */
|
|
16496
|
+
createdAt: z.number(),
|
|
16497
|
+
/** Last transition time (terminal for sent / dead). */
|
|
16498
|
+
updatedAt: z.number(),
|
|
16499
|
+
/** Failure detail — present on a `dead` row. */
|
|
16500
|
+
error: z.string().optional(),
|
|
16501
|
+
subject: NcHistorySubjectSchema
|
|
16275
16502
|
});
|
|
16276
|
-
|
|
16277
|
-
|
|
16503
|
+
/**
|
|
16504
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
16505
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
16506
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
16507
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
16508
|
+
*/
|
|
16509
|
+
var NcHistoryFilterSchema = z.object({
|
|
16510
|
+
ruleId: z.string().optional(),
|
|
16511
|
+
deviceId: z.number().optional(),
|
|
16512
|
+
status: NcHistoryStatusSchema.optional(),
|
|
16513
|
+
since: z.number().optional(),
|
|
16514
|
+
until: z.number().optional(),
|
|
16515
|
+
limit: z.number().int().min(1).max(500).default(100)
|
|
16516
|
+
});
|
|
16517
|
+
var notificationRulesCapability = {
|
|
16518
|
+
name: "notification-rules",
|
|
16278
16519
|
scope: "system",
|
|
16279
|
-
mode: "
|
|
16280
|
-
internal: false,
|
|
16281
|
-
providerKind: "ai",
|
|
16282
|
-
/** `nodeId` inputs below are DATA (the hub provider pins itself), never routing. */
|
|
16283
|
-
nodeIdMode: "data",
|
|
16520
|
+
mode: "singleton",
|
|
16284
16521
|
methods: {
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
listProfiles: method(z.object({}), z.array(LlmProfileSchema)),
|
|
16289
|
-
upsertProfile: method(z.object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
16290
|
-
kind: "mutation",
|
|
16291
|
-
auth: "admin"
|
|
16292
|
-
}),
|
|
16293
|
-
deleteProfile: method(ProfileRefInputSchema, z.void(), {
|
|
16294
|
-
kind: "mutation",
|
|
16295
|
-
auth: "admin"
|
|
16296
|
-
}),
|
|
16297
|
-
testProfile: method(ProfileRefInputSchema, LlmGenerateResultSchema, {
|
|
16522
|
+
listRules: method(z.object({}), z.object({ rules: z.array(NcRuleSchema) }), { auth: "admin" }),
|
|
16523
|
+
getRule: method(z.object({ ruleId: z.string() }), z.object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }),
|
|
16524
|
+
createRule: method(z.object({ rule: NcRuleInputSchema }), z.object({ rule: NcRuleSchema }), {
|
|
16298
16525
|
kind: "mutation",
|
|
16299
|
-
auth: "admin"
|
|
16526
|
+
auth: "admin",
|
|
16527
|
+
caller: "required"
|
|
16300
16528
|
}),
|
|
16301
|
-
|
|
16302
|
-
|
|
16303
|
-
|
|
16304
|
-
|
|
16305
|
-
selector: LlmDefaultSelectorSchema,
|
|
16306
|
-
profileId: z.string().nullable()
|
|
16307
|
-
}), z.void(), {
|
|
16529
|
+
updateRule: method(z.object({
|
|
16530
|
+
ruleId: z.string(),
|
|
16531
|
+
patch: NcRulePatchSchema
|
|
16532
|
+
}), z.object({ rule: NcRuleSchema }), {
|
|
16308
16533
|
kind: "mutation",
|
|
16309
|
-
auth: "admin"
|
|
16534
|
+
auth: "admin",
|
|
16535
|
+
caller: "required"
|
|
16310
16536
|
}),
|
|
16311
|
-
|
|
16312
|
-
since: z.number().optional(),
|
|
16313
|
-
until: z.number().optional(),
|
|
16314
|
-
consumer: z.string().optional(),
|
|
16315
|
-
profileId: z.string().optional()
|
|
16316
|
-
}), z.array(LlmUsageRollupSchema)),
|
|
16317
|
-
listModelCatalog: method(z.object({}), z.array(ManagedModelCatalogEntrySchema)),
|
|
16318
|
-
listRuntimeNodes: method(z.object({}), z.array(LlmRuntimeNodeSchema)),
|
|
16319
|
-
listNodeModels: method(z.object({ nodeId: z.string() }), z.array(LlmNodeModelSchema)),
|
|
16320
|
-
installModel: method(z.object({
|
|
16321
|
-
nodeId: z.string(),
|
|
16322
|
-
model: ManagedModelRefSchema
|
|
16323
|
-
}), z.void(), {
|
|
16537
|
+
deleteRule: method(z.object({ ruleId: z.string() }), z.object({ success: z.literal(true) }), {
|
|
16324
16538
|
kind: "mutation",
|
|
16325
16539
|
auth: "admin"
|
|
16326
16540
|
}),
|
|
16327
|
-
|
|
16328
|
-
|
|
16329
|
-
|
|
16330
|
-
}), z.
|
|
16541
|
+
setRuleEnabled: method(z.object({
|
|
16542
|
+
ruleId: z.string(),
|
|
16543
|
+
enabled: z.boolean()
|
|
16544
|
+
}), z.object({ success: z.literal(true) }), {
|
|
16331
16545
|
kind: "mutation",
|
|
16332
16546
|
auth: "admin"
|
|
16333
16547
|
}),
|
|
16334
|
-
|
|
16335
|
-
|
|
16548
|
+
/**
|
|
16549
|
+
* Dry-run a rule against recently persisted records (object events for
|
|
16550
|
+
* `immediate`, closed tracks for `track-end`). Mutation kind only to
|
|
16551
|
+
* carry the full rule object safely; no side effects.
|
|
16552
|
+
*/
|
|
16553
|
+
testRule: method(z.object({
|
|
16554
|
+
rule: NcRuleInputSchema,
|
|
16555
|
+
lookbackMinutes: z.number().int().min(1).max(1440).default(60)
|
|
16556
|
+
}), z.object({ results: z.array(NcTestResultSchema) }), {
|
|
16336
16557
|
kind: "mutation",
|
|
16337
16558
|
auth: "admin"
|
|
16338
16559
|
}),
|
|
16339
|
-
|
|
16340
|
-
|
|
16341
|
-
|
|
16342
|
-
|
|
16560
|
+
getConditionCatalog: method(z.object({}), z.object({ catalog: z.array(NcConditionDescriptorSchema) })),
|
|
16561
|
+
/**
|
|
16562
|
+
* Queryable delivery history — a read-only view over the durable outbox
|
|
16563
|
+
* (fired rule, subject summary, target, status, timestamps, error on a
|
|
16564
|
+
* dead row). Newest-first, bounded by `filter.limit`. Retention follows
|
|
16565
|
+
* the outbox's own terminal-row prune horizon (no separate history
|
|
16566
|
+
* horizon — single collection, single source of truth). Admin-only in
|
|
16567
|
+
* P1 (no user dimension); the P2 viewer History screen adds per-caller
|
|
16568
|
+
* scoping on the same method.
|
|
16569
|
+
*/
|
|
16570
|
+
getHistory: method(z.object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), z.object({ entries: z.array(NcHistoryEntrySchema) }), { auth: "admin" })
|
|
16343
16571
|
}
|
|
16344
16572
|
};
|
|
16345
16573
|
/**
|
|
@@ -17212,76 +17440,6 @@ var pipelineAnalyticsCapability = {
|
|
|
17212
17440
|
}) }
|
|
17213
17441
|
}
|
|
17214
17442
|
};
|
|
17215
|
-
/**
|
|
17216
|
-
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
17217
|
-
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
17218
|
-
* caps into per-camera event-kind descriptors.
|
|
17219
|
-
*
|
|
17220
|
-
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
17221
|
-
* is NOT duplicated here — every entry is derived from the single
|
|
17222
|
-
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
17223
|
-
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
17224
|
-
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
17225
|
-
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
17226
|
-
* eventful cap is missing.
|
|
17227
|
-
*/
|
|
17228
|
-
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
17229
|
-
var LEGACY_ICON = {
|
|
17230
|
-
motion: "motion",
|
|
17231
|
-
audio: "audio",
|
|
17232
|
-
person: "person",
|
|
17233
|
-
vehicle: "vehicle",
|
|
17234
|
-
animal: "animal",
|
|
17235
|
-
package: "package",
|
|
17236
|
-
door: "door",
|
|
17237
|
-
pir: "pir",
|
|
17238
|
-
smoke: "smoke",
|
|
17239
|
-
water: "water",
|
|
17240
|
-
button: "button",
|
|
17241
|
-
generic: "generic",
|
|
17242
|
-
gas: "smoke",
|
|
17243
|
-
vibration: "generic",
|
|
17244
|
-
tamper: "generic",
|
|
17245
|
-
presence: "person",
|
|
17246
|
-
lock: "generic",
|
|
17247
|
-
siren: "generic",
|
|
17248
|
-
switch: "generic",
|
|
17249
|
-
doorbell: "button"
|
|
17250
|
-
};
|
|
17251
|
-
function legacyIcon(iconId) {
|
|
17252
|
-
return LEGACY_ICON[iconId] ?? "generic";
|
|
17253
|
-
}
|
|
17254
|
-
/**
|
|
17255
|
-
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
17256
|
-
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
17257
|
-
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
17258
|
-
*/
|
|
17259
|
-
var CAP_TO_KIND = {
|
|
17260
|
-
contact: "contact",
|
|
17261
|
-
motion: "motion-sensor",
|
|
17262
|
-
smoke: "smoke",
|
|
17263
|
-
flood: "flood",
|
|
17264
|
-
gas: "gas",
|
|
17265
|
-
"carbon-monoxide": "carbon-monoxide",
|
|
17266
|
-
vibration: "vibration",
|
|
17267
|
-
tamper: "tamper",
|
|
17268
|
-
presence: "presence",
|
|
17269
|
-
"enum-sensor": "enum-sensor",
|
|
17270
|
-
"event-emitter": "device-event",
|
|
17271
|
-
"lock-control": "lock",
|
|
17272
|
-
switch: "switch",
|
|
17273
|
-
button: "button",
|
|
17274
|
-
doorbell: "doorbell"
|
|
17275
|
-
};
|
|
17276
|
-
function buildDescriptor(capName, kind) {
|
|
17277
|
-
const t = EVENT_TAXONOMY[kind];
|
|
17278
|
-
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
17279
|
-
return {
|
|
17280
|
-
...t,
|
|
17281
|
-
icon: legacyIcon(t.iconId)
|
|
17282
|
-
};
|
|
17283
|
-
}
|
|
17284
|
-
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
17285
17443
|
var CameraPipelineConfigSchema = z.object({
|
|
17286
17444
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
17287
17445
|
steps: z.array(PipelineStepInputSchema).readonly(),
|
|
@@ -18037,6 +18195,76 @@ var pipelineOrchestratorCapability = {
|
|
|
18037
18195
|
}
|
|
18038
18196
|
};
|
|
18039
18197
|
/**
|
|
18198
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
18199
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
18200
|
+
* caps into per-camera event-kind descriptors.
|
|
18201
|
+
*
|
|
18202
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
18203
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
18204
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
18205
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
18206
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
18207
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
18208
|
+
* eventful cap is missing.
|
|
18209
|
+
*/
|
|
18210
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
18211
|
+
var LEGACY_ICON = {
|
|
18212
|
+
motion: "motion",
|
|
18213
|
+
audio: "audio",
|
|
18214
|
+
person: "person",
|
|
18215
|
+
vehicle: "vehicle",
|
|
18216
|
+
animal: "animal",
|
|
18217
|
+
package: "package",
|
|
18218
|
+
door: "door",
|
|
18219
|
+
pir: "pir",
|
|
18220
|
+
smoke: "smoke",
|
|
18221
|
+
water: "water",
|
|
18222
|
+
button: "button",
|
|
18223
|
+
generic: "generic",
|
|
18224
|
+
gas: "smoke",
|
|
18225
|
+
vibration: "generic",
|
|
18226
|
+
tamper: "generic",
|
|
18227
|
+
presence: "person",
|
|
18228
|
+
lock: "generic",
|
|
18229
|
+
siren: "generic",
|
|
18230
|
+
switch: "generic",
|
|
18231
|
+
doorbell: "button"
|
|
18232
|
+
};
|
|
18233
|
+
function legacyIcon(iconId) {
|
|
18234
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
18235
|
+
}
|
|
18236
|
+
/**
|
|
18237
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
18238
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
18239
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
18240
|
+
*/
|
|
18241
|
+
var CAP_TO_KIND = {
|
|
18242
|
+
contact: "contact",
|
|
18243
|
+
motion: "motion-sensor",
|
|
18244
|
+
smoke: "smoke",
|
|
18245
|
+
flood: "flood",
|
|
18246
|
+
gas: "gas",
|
|
18247
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
18248
|
+
vibration: "vibration",
|
|
18249
|
+
tamper: "tamper",
|
|
18250
|
+
presence: "presence",
|
|
18251
|
+
"enum-sensor": "enum-sensor",
|
|
18252
|
+
"event-emitter": "device-event",
|
|
18253
|
+
"lock-control": "lock",
|
|
18254
|
+
switch: "switch",
|
|
18255
|
+
button: "button",
|
|
18256
|
+
doorbell: "doorbell"
|
|
18257
|
+
};
|
|
18258
|
+
function buildDescriptor(capName, kind) {
|
|
18259
|
+
const t = EVENT_TAXONOMY[kind];
|
|
18260
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
18261
|
+
return {
|
|
18262
|
+
...t,
|
|
18263
|
+
icon: legacyIcon(t.iconId)
|
|
18264
|
+
};
|
|
18265
|
+
}
|
|
18266
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
18267
|
+
/**
|
|
18040
18268
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
18041
18269
|
* package lifecycle (runtime-updatable node packages).
|
|
18042
18270
|
*
|
|
@@ -20164,7 +20392,28 @@ var FaceInfoSchema = z.object({
|
|
|
20164
20392
|
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
|
|
20165
20393
|
* track produced no key frame (e.g. native/onboard source) — the UI falls
|
|
20166
20394
|
* back to the inline `base64` face crop. */
|
|
20167
|
-
keyFrameMediaKey: z.string().optional()
|
|
20395
|
+
keyFrameMediaKey: z.string().optional(),
|
|
20396
|
+
/** Winning identity-match cosine (0..1) for this face's track, when an
|
|
20397
|
+
* identity was auto-confirmed. Lets the UI surface WHY a face was assigned
|
|
20398
|
+
* (confidence badge / low-confidence audit). Absent on legacy rows and on
|
|
20399
|
+
* faces that were never auto-recognized. */
|
|
20400
|
+
bestMatchScore: z.number().optional(),
|
|
20401
|
+
/** Native-scale face short side (px) at recognition time, when the runner
|
|
20402
|
+
* measured it. Lets the UI flag low-resolution auto-assignments. Absent on
|
|
20403
|
+
* legacy rows / runners that reported no native measure. */
|
|
20404
|
+
nativeFaceShortSidePx: z.number().optional(),
|
|
20405
|
+
/** SUGGESTED identity for this face — a plausible-but-not-confident match that
|
|
20406
|
+
* MISSED auto-assignment (cosine in the suggestion band, or above threshold
|
|
20407
|
+
* but blocked only by the recognition size floor). Mutually exclusive with
|
|
20408
|
+
* `recognizedIdentityId` (a suggestion is NEVER an assignment): the face stays
|
|
20409
|
+
* UNASSIGNED and everything else keeps treating it as unrecognized — the UI
|
|
20410
|
+
* merely offers a one-tap "is this <name>?" confirm. Absent on legacy rows and
|
|
20411
|
+
* on faces that were auto-assigned or below the suggestion band. (2026-07-24) */
|
|
20412
|
+
suggestedIdentityId: z.string().optional(),
|
|
20413
|
+
/** Peak identity-match cosine (0..1) for `suggestedIdentityId`, captured at the
|
|
20414
|
+
* same moment as `bestMatchScore` (track peak, at close). Lets the UI rank /
|
|
20415
|
+
* badge suggestion confidence. Present iff `suggestedIdentityId` is. (2026-07-24) */
|
|
20416
|
+
suggestedMatchScore: z.number().optional()
|
|
20168
20417
|
});
|
|
20169
20418
|
var FaceFilterEnum = z.enum([
|
|
20170
20419
|
"unassigned",
|
|
@@ -22770,7 +23019,6 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
22770
23019
|
addonWidgetsSourceCapability,
|
|
22771
23020
|
addonsCapability,
|
|
22772
23021
|
adminUiCapability,
|
|
22773
|
-
advancedNotifierCapability,
|
|
22774
23022
|
airQualitySensorCapability,
|
|
22775
23023
|
alarmPanelCapability,
|
|
22776
23024
|
alertsCapability,
|
|
@@ -23257,36 +23505,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
23257
23505
|
addonId: null,
|
|
23258
23506
|
access: "view"
|
|
23259
23507
|
},
|
|
23260
|
-
"advancedNotifier.deleteRule": {
|
|
23261
|
-
capName: "advanced-notifier",
|
|
23262
|
-
capScope: "system",
|
|
23263
|
-
addonId: null,
|
|
23264
|
-
access: "delete"
|
|
23265
|
-
},
|
|
23266
|
-
"advancedNotifier.getHistory": {
|
|
23267
|
-
capName: "advanced-notifier",
|
|
23268
|
-
capScope: "system",
|
|
23269
|
-
addonId: null,
|
|
23270
|
-
access: "view"
|
|
23271
|
-
},
|
|
23272
|
-
"advancedNotifier.getRules": {
|
|
23273
|
-
capName: "advanced-notifier",
|
|
23274
|
-
capScope: "system",
|
|
23275
|
-
addonId: null,
|
|
23276
|
-
access: "view"
|
|
23277
|
-
},
|
|
23278
|
-
"advancedNotifier.testRule": {
|
|
23279
|
-
capName: "advanced-notifier",
|
|
23280
|
-
capScope: "system",
|
|
23281
|
-
addonId: null,
|
|
23282
|
-
access: "create"
|
|
23283
|
-
},
|
|
23284
|
-
"advancedNotifier.upsertRule": {
|
|
23285
|
-
capName: "advanced-notifier",
|
|
23286
|
-
capScope: "system",
|
|
23287
|
-
addonId: null,
|
|
23288
|
-
access: "create"
|
|
23289
|
-
},
|
|
23290
23508
|
"alarmPanel.arm": {
|
|
23291
23509
|
capName: "alarm-panel",
|
|
23292
23510
|
capScope: "device",
|
|
@@ -25609,6 +25827,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
25609
25827
|
addonId: null,
|
|
25610
25828
|
access: "view"
|
|
25611
25829
|
},
|
|
25830
|
+
"notificationRules.getHistory": {
|
|
25831
|
+
capName: "notification-rules",
|
|
25832
|
+
capScope: "system",
|
|
25833
|
+
addonId: null,
|
|
25834
|
+
access: "view"
|
|
25835
|
+
},
|
|
25612
25836
|
"notificationRules.getRule": {
|
|
25613
25837
|
capName: "notification-rules",
|
|
25614
25838
|
capScope: "system",
|
|
@@ -27965,4 +28189,4 @@ function enumerateInferenceDevices(hw) {
|
|
|
27965
28189
|
return out;
|
|
27966
28190
|
}
|
|
27967
28191
|
//#endregion
|
|
27968
|
-
export {
|
|
28192
|
+
export { storageCapability as $, filesystemBrowseCapability as A, sleep as At, looseSchema as B, deviceStatusCapability as C, hydrateSchema as Ct, enumerateSchemaFields as D, readinessKey as Dt, enumerateItemArrayFields as E, parseJsonUnknown as Et, isVoidInput as F, parseStreamParamsFormPatch as G, nodePin as H, kebabToCamel as I, readNodePin as J, platformProbeCapability as K, lifecycleJobSchema as L, isArrayOutputSchema as M, isCollectionArrayMethod as N, evaluateLinkExpression as O, resolveCapMount as Ot, isObjectInput as P, snapshotCapability as Q, localNetworkCapability as R, deviceStateCapability as S, expandCapMethods as St, enumerateInferenceDevices as T, parseJsonObject as Tt, normalizeUnit as U, metricsProviderCapability as V, objectInputDeclaresAddonId as W, setByPath as X, scoreRuntimes as Y, settingsStoreCapability as Z, applyTransform as _, asNumber as _t, CAP_NAMES_WITH_STATUS as a, errMsg as at, buildStreamParamsConfigSchema as b, emitDownForOwnedCaps as bt, RUNTIME_DEFAULTS as c, DEVICE_SETTINGS_CONTRIBUTION_METHODS as ct, StorageLocationTypeSchema as d, DeviceRole as dt, storageProviderCapability as et, UserRecordSchema as f, DeviceType as ft, alertsCapability as g, asJsonObject as gt, addonWidgetsCapability as h, WELL_KNOWN_TAB_MAP as ht, BatteryStatusSchema as i, validateExpressionSource as it, getByPath as j, EventCategory as jt, extractNestedAddonId as k, scopeKey as kt, STREAM_PROFILE_META as l, DEVICE_STATUS_METHOD as lt, addonSettingsCapability as m, ReadinessTimeoutError as mt, AlertSchema as n, toExpressionValue as nt, DeviceStatusSchema as o, BaseAddon as ot, addonPagesCapability as p, ReadinessRegistry as pt, procedureAuthKey as q, ApiKeyRecordSchema as r, userManagementCapability as rt, METHOD_ACCESS_MAP as s, DATAPLANE_SECRET_HEADER as st, ALL_CAPABILITY_DEFINITIONS as t, streamQualityLabel as tt, ScopedTokenSchema as u, DeviceFeature as ut, authProviderCapability as v, asString as vt, doorbellCapability as w, isDeviceConfigCap as wt, deviceManagerCapability as x, emitReadiness as xt, backupCapability as y, createEvent as yt, logDestinationCapability as z };
|