@camstack/addon-model-studio 1.1.309 → 1.1.311

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.
Files changed (19) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{MotionZonesSettings-D9qlMn0i.mjs → MotionZonesSettings-CY7WW9zp.mjs} +2 -2
  3. package/dist/{PrivacyMaskSettings-BgJSIubF.mjs → PrivacyMaskSettings-D4hM1OZ1.mjs} +4 -4
  4. package/dist/{SceneMonitorEditor-CZzBhOoI.mjs → SceneMonitorEditor-CYO0M61_.mjs} +3 -3
  5. package/dist/_stub.js +622 -620
  6. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-Ca8KtYYT.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-i6GpUg0g.mjs} +3 -3
  7. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CGOQ_bPs.mjs +26 -0
  8. package/dist/{hostInit-C4p0TGqg.mjs → hostInit-DMdFkiuC.mjs} +2 -2
  9. package/dist/model-studio.addon.js +649 -70
  10. package/dist/model-studio.addon.mjs +649 -70
  11. package/dist/{player-overlays-C1od7kvL.mjs → player-overlays-_IUEss_N.mjs} +1 -1
  12. package/dist/remoteEntry.js +1 -1
  13. package/dist/{responsive-IwU1xXrH.mjs → responsive-BipqhGVu.mjs} +1 -1
  14. package/dist/{scene-monitor-copy-B_r_xdlw.mjs → scene-monitor-copy-ByM_3HsW.mjs} +1 -1
  15. package/dist/{square-cXunBHEd.mjs → square-ChGVX2QG.mjs} +1 -1
  16. package/dist/{trash-2-CZlLF-tK.mjs → trash-2-7FeqzbpL.mjs} +1 -1
  17. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-CGN2iLLF.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-mVC2N4ad.mjs} +1 -1
  18. package/package.json +1 -1
  19. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CD8IeDkZ.mjs +0 -26
@@ -394,7 +394,7 @@ function buildPluginCatalogRegistryDescriptor(entry) {
394
394
  };
395
395
  }
396
396
  //#endregion
397
- //#region ../types/dist/event-category-CT-hz5Rb.mjs
397
+ //#region ../types/dist/event-category-hdMR7CTW.mjs
398
398
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
399
399
  EventCategory["SystemBoot"] = "system.boot";
400
400
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1159,6 +1159,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1159
1159
  */
1160
1160
  EventCategory["AccessoriesChanged"] = "accessories.onAccessoriesChanged";
1161
1161
  /**
1162
+ * An action run started or ended. Emitted by the `actions` surface.
1163
+ * Payload: `ActionRunChanged` (`{ actionId, runId, isRunning, outcome?, lastRunAt, lastError }`).
1164
+ */
1165
+ EventCategory["ActionsRunChanged"] = "actions.onRunChanged";
1166
+ /**
1162
1167
  * Progress update from a running model conversion job.
1163
1168
  * Payload: `{ kind: 'model-convert', phase, sessionId?, pct?, detail? }`.
1164
1169
  * Emitted by `addon-model-studio` on the converting node.
@@ -5837,7 +5842,7 @@ var ZodIssueCode = {
5837
5842
  var ZodFirstPartyTypeKind;
5838
5843
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5839
5844
  //#endregion
5840
- //#region ../types/dist/sleep-BE7IAR2p.mjs
5845
+ //#region ../types/dist/sleep-BHjNez61.mjs
5841
5846
  /**
5842
5847
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5843
5848
  * window to float samples (D455).
@@ -8967,6 +8972,8 @@ Object.freeze({ "doorbell": "lastPressedAt" });
8967
8972
  /** Every capability name, so addon code can check a name without the schema graph. */
8968
8973
  var CAP_NAMES = Object.freeze([
8969
8974
  "accessories",
8975
+ "action-source",
8976
+ "actions",
8970
8977
  "addon-pages",
8971
8978
  "addon-pages-source",
8972
8979
  "addon-routes",
@@ -15966,7 +15973,23 @@ var AutomationTriggerSchema = discriminatedUnion("kind", [
15966
15973
  kind: literal("schedule"),
15967
15974
  cron: string().min(1).max(120)
15968
15975
  }),
15969
- object({ kind: literal("manual") })
15976
+ object({ kind: literal("manual") }),
15977
+ object({
15978
+ kind: literal("detection"),
15979
+ /** Class names. A macro class (`animal`, `vehicle`, `person`, `package`)
15980
+ * matches every raw class that maps to it; any other name matches
15981
+ * exactly. */
15982
+ classes: array(string().min(1)).min(1),
15983
+ deviceIds: array(number().int().nonnegative()).min(1),
15984
+ /** The track must have visited at least one of these zones. */
15985
+ zones: array(string().min(1)).min(1).optional(),
15986
+ /** Best-so-far confidence the track must reach. */
15987
+ minScore: number().min(0).max(1).optional()
15988
+ }),
15989
+ object({
15990
+ kind: literal("interval"),
15991
+ minutes: number().int().min(1).max(1440)
15992
+ })
15970
15993
  ]);
15971
15994
  /**
15972
15995
  * One action step.
@@ -15986,28 +16009,47 @@ var AutomationTriggerSchema = discriminatedUnion("kind", [
15986
16009
  * is called. The runner still receives a number and is untouched; the
15987
16010
  * resolution is the recipe's job, not the runner's.
15988
16011
  */
16012
+ var AutomationWaitStepSchema = object({
16013
+ kind: literal("wait"),
16014
+ seconds: number().min(0).max(300)
16015
+ });
16016
+ var AutomationCapStepSchema = object({
16017
+ kind: literal("cap"),
16018
+ /**
16019
+ * One device, several same-family devices (locks / climate family / …),
16020
+ * or `{ $var }` for the device that triggered the run. An array is
16021
+ * fan-out at codegen — each id gets the same cap.method call.
16022
+ */
16023
+ deviceId: union([
16024
+ number().int(),
16025
+ array(number().int()).min(1),
16026
+ object({ $var: string().min(1) })
16027
+ ]),
16028
+ cap: string().min(1),
16029
+ method: string().min(1),
16030
+ /** Values may carry `{{vars.x}}` slots, or be exactly `{ $var: 'name' }`, which
16031
+ * SUBSTITUTE and do not evaluate (§3.2.3). Anything beyond substitution is
16032
+ * the expression leaf. */
16033
+ args: record(string(), unknown()).optional()
16034
+ });
16035
+ /**
16036
+ * The steps an internal Action may contain: cap and wait, and nothing that can
16037
+ * call back into an Action — so an Action can never reach itself (no cycles).
16038
+ */
16039
+ var ActionStepSchema = discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
15989
16040
  var AutomationActionSchema = discriminatedUnion("kind", [
16041
+ AutomationWaitStepSchema,
16042
+ AutomationCapStepSchema,
15990
16043
  object({
15991
- kind: literal("wait"),
15992
- seconds: number().min(0).max(300)
15993
- }),
15994
- object({
15995
- kind: literal("cap"),
15996
- /**
15997
- * One device, several same-family devices (locks / climate family / …),
15998
- * or `{ $var }` for the device that triggered the run. An array is
15999
- * fan-out at codegen — each id gets the same cap.method call.
16000
- */
16001
- deviceId: union([
16002
- number().int(),
16003
- array(number().int()).min(1),
16004
- object({ $var: string().min(1) })
16005
- ]),
16006
- cap: string().min(1),
16007
- method: string().min(1),
16008
- /** Values may carry `{{vars.x}}` slots, which SUBSTITUTE and do not
16009
- * evaluate (§3.2.3). Anything beyond substitution is the expression leaf. */
16010
- args: record(string(), unknown()).optional()
16044
+ kind: literal("action"),
16045
+ /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
16046
+ actionId: string().min(1),
16047
+ /** Values for the action's declared variables; the others take their default. */
16048
+ variables: record(string(), union([
16049
+ string(),
16050
+ number(),
16051
+ boolean()
16052
+ ])).optional()
16011
16053
  }),
16012
16054
  object({
16013
16055
  kind: literal("code"),
@@ -16016,10 +16058,356 @@ var AutomationActionSchema = discriminatedUnion("kind", [
16016
16058
  code: string().min(1).max(2e4)
16017
16059
  })
16018
16060
  ]);
16061
+ /**
16062
+ * How a trigger that arrives while the automation is busy (or cooling down) is
16063
+ * handled. One of the automation's execution modes, never a property of its
16064
+ * actions. Absent means `single`.
16065
+ *
16066
+ * - `single` — drop the trigger while a run is in progress (traced + logged).
16067
+ * - `restart` — abort the run in progress (at its next step boundary), start fresh.
16068
+ * - `queued` — queue up to `max` triggers, drop the rest (traced).
16069
+ * - `parallel` — up to `max` runs at once, drop the rest (traced).
16070
+ * - `cooldown` — `single`, and no new run until `minutes` after the last run
16071
+ * STARTED; persisted across a restart. A manual trigger bypasses only this
16072
+ * wait, never the single/queued limits.
16073
+ */
16074
+ var AutomationRunModeSchema = discriminatedUnion("mode", [
16075
+ object({ mode: literal("single") }),
16076
+ object({ mode: literal("restart") }),
16077
+ object({
16078
+ mode: literal("queued"),
16079
+ max: number().int().min(1).max(10)
16080
+ }),
16081
+ object({
16082
+ mode: literal("parallel"),
16083
+ max: number().int().min(1).max(10)
16084
+ }),
16085
+ object({
16086
+ mode: literal("cooldown"),
16087
+ minutes: number().int().min(1).max(1440)
16088
+ })
16089
+ ]);
16019
16090
  var AutomationRecipeSchema = object({
16020
16091
  triggers: array(AutomationTriggerSchema),
16021
16092
  conditions: AutomationConditionSchema.optional(),
16022
- actions: array(AutomationActionSchema)
16093
+ actions: array(AutomationActionSchema),
16094
+ runMode: AutomationRunModeSchema.optional(),
16095
+ /** How many run traces the automation keeps (default {@link DEFAULT_TRACE_KEEP}). */
16096
+ keepTraces: number().int().min(1).max(100).optional()
16097
+ });
16098
+ new Set([
16099
+ {
16100
+ id: "person",
16101
+ name: "Person"
16102
+ },
16103
+ {
16104
+ id: "vehicle",
16105
+ name: "Vehicle"
16106
+ },
16107
+ {
16108
+ id: "animal",
16109
+ name: "Animal"
16110
+ },
16111
+ {
16112
+ id: "package",
16113
+ name: "Package"
16114
+ }
16115
+ ].map((l) => l.id));
16116
+ var COCO_TO_MACRO = {
16117
+ mapping: {
16118
+ person: "person",
16119
+ bicycle: "vehicle",
16120
+ car: "vehicle",
16121
+ motorcycle: "vehicle",
16122
+ airplane: "vehicle",
16123
+ bus: "vehicle",
16124
+ train: "vehicle",
16125
+ truck: "vehicle",
16126
+ boat: "vehicle",
16127
+ bird: "animal",
16128
+ cat: "animal",
16129
+ dog: "animal",
16130
+ horse: "animal",
16131
+ sheep: "animal",
16132
+ cow: "animal",
16133
+ elephant: "animal",
16134
+ bear: "animal",
16135
+ zebra: "animal",
16136
+ giraffe: "animal",
16137
+ suitcase: "package",
16138
+ backpack: "package",
16139
+ handbag: "package"
16140
+ },
16141
+ preserveOriginal: false
16142
+ };
16143
+ new Set(Object.values(COCO_TO_MACRO.mapping));
16144
+ /**
16145
+ * Run traces — what an automation (or, later, an Action run) DID, node by node,
16146
+ * so the editor can paint every block green or red with its reason.
16147
+ *
16148
+ * A trace is data, not a log: it covers the WHOLE tree — the trigger stage,
16149
+ * every condition node (containers and leaves, including the ones a
16150
+ * short-circuit never reached), the run-mode verdict and every action step —
16151
+ * each addressed by a stable path (`conditions.0.1`, `actions.2`, or `steps.N`
16152
+ * for an Action run). Skipped
16153
+ * evaluations are traced too, and identical consecutive skips collapse into a
16154
+ * repeat count so a trigger that fails every 5 minutes cannot flush real runs.
16155
+ *
16156
+ * {@link AutomationStepTraceSchema} is deliberately free of automation
16157
+ * vocabulary so an Action run records the same step shape.
16158
+ */
16159
+ /** A value a trace may show: JSON primitives and short lists, nothing deeper. */
16160
+ var TraceValueSchema = union([
16161
+ string(),
16162
+ number(),
16163
+ boolean(),
16164
+ _null(),
16165
+ array(union([string(), number()]))
16166
+ ]);
16167
+ var AutomationRunOutcomeSchema = _enum([
16168
+ "ran",
16169
+ "skipped-trigger",
16170
+ "skipped-conditions",
16171
+ "skipped-cooldown",
16172
+ "skipped-overlap",
16173
+ "failed",
16174
+ "aborted"
16175
+ ]);
16176
+ /** `not-evaluated` = a short-circuit never reached the node. */
16177
+ var TraceNodeOutcomeSchema = _enum([
16178
+ "pass",
16179
+ "fail",
16180
+ "not-evaluated"
16181
+ ]);
16182
+ var AutomationTriggerTraceSchema = object({
16183
+ kind: string().min(1),
16184
+ outcome: _enum(["pass", "fail"]),
16185
+ /** Why an event was rejected ("class person not in [dog]") or what fired. */
16186
+ reason: string(),
16187
+ /** deviceId, className, trackId, score … — only what the trigger exposes. */
16188
+ vars: record(string(), TraceValueSchema)
16189
+ });
16190
+ var AutomationConditionTraceNodeSchema = object({
16191
+ /** `conditions` for the root, `conditions.<i>` for its i-th child, … */
16192
+ path: string().min(1),
16193
+ kind: _enum([
16194
+ "all",
16195
+ "any",
16196
+ "not",
16197
+ "condition",
16198
+ "expression"
16199
+ ]),
16200
+ outcome: TraceNodeOutcomeSchema,
16201
+ reason: string(),
16202
+ deviceId: number().int().optional(),
16203
+ cap: string().optional(),
16204
+ fieldPath: string().optional(),
16205
+ operator: string().optional(),
16206
+ expected: TraceValueSchema.optional(),
16207
+ /** What the mirror held; `null` when it held nothing (unknown). */
16208
+ observed: TraceValueSchema.optional()
16209
+ });
16210
+ var AutomationRunVerdictSchema = object({
16211
+ mode: AutomationRunModeSchema,
16212
+ decision: _enum([
16213
+ "run",
16214
+ "queued",
16215
+ "restart",
16216
+ "drop",
16217
+ "cooldown",
16218
+ "bypass"
16219
+ ]),
16220
+ reason: string()
16221
+ });
16222
+ /** One executed (or not-run) step — shared by automations and Action runs. */
16223
+ var AutomationStepTraceSchema = object({
16224
+ /** `actions.<i>` */
16225
+ path: string().min(1),
16226
+ kind: string().min(1),
16227
+ cap: string().optional(),
16228
+ method: string().optional(),
16229
+ deviceId: number().int().optional(),
16230
+ startedAt: number().optional(),
16231
+ endedAt: number().optional(),
16232
+ outcome: _enum([
16233
+ "ok",
16234
+ "error",
16235
+ "not-run"
16236
+ ]),
16237
+ message: string().optional()
16238
+ });
16239
+ var AutomationRunTraceSchema = object({
16240
+ runId: string().min(1),
16241
+ startedAt: number(),
16242
+ endedAt: number(),
16243
+ trigger: AutomationTriggerTraceSchema,
16244
+ conditions: array(AutomationConditionTraceNodeSchema),
16245
+ verdict: AutomationRunVerdictSchema.optional(),
16246
+ steps: array(AutomationStepTraceSchema),
16247
+ outcome: AutomationRunOutcomeSchema,
16248
+ /** How many identical consecutive skips this trace stands for (>= 1). */
16249
+ repeat: number().int().min(1),
16250
+ /** When the latest of those repeats happened. */
16251
+ lastAt: number()
16252
+ });
16253
+ /**
16254
+ * What the hub's `runs` ledger holds for one owner (`automation:<blockId>` or
16255
+ * `action:<actionId>`): the cooldown stamp and the trace ring.
16256
+ */
16257
+ var AutomationStateDocSchema = object({
16258
+ version: literal(1),
16259
+ lastRunStartedAt: number().nullable(),
16260
+ traces: array(AutomationRunTraceSchema)
16261
+ });
16262
+ /**
16263
+ * Actions — named, runnable things an operator (or an automation) can start,
16264
+ * declared as LIST ENTRIES, never as devices.
16265
+ *
16266
+ * An entry is either **internal** (a short list of cap/wait steps kept in the
16267
+ * hub's `actions` record kind) or declared by an addon through the
16268
+ * `action-source` collection (a Home Assistant script, a scene …). The one
16269
+ * surface the UI and automations talk to is the `actions` cap; it keeps no
16270
+ * catalog of its own (D3) — every `list` asks the providers live.
16271
+ *
16272
+ * This file is the data half: the entry schema, the variables an entry may
16273
+ * declare, and the pure resolution of the values a run was given. It holds no
16274
+ * runtime.
16275
+ */
16276
+ /** What a variable's value is. `select` takes one of `options`. */
16277
+ var ActionVariableTypeSchema = _enum([
16278
+ "string",
16279
+ "number",
16280
+ "boolean",
16281
+ "select"
16282
+ ]);
16283
+ var ACTION_VARIABLE_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
16284
+ var ActionVariableValueSchema = union([
16285
+ string(),
16286
+ number(),
16287
+ boolean()
16288
+ ]);
16289
+ /**
16290
+ * One declared variable. Steps reference it as `{ $var: 'name' }` (the whole
16291
+ * value) or `{{vars.name}}` (inside a string) in their args.
16292
+ */
16293
+ var ActionVariableSchema = object({
16294
+ name: string().regex(ACTION_VARIABLE_NAME_RE),
16295
+ label: string().min(1).max(120).optional(),
16296
+ type: ActionVariableTypeSchema,
16297
+ required: boolean().optional(),
16298
+ default: ActionVariableValueSchema.optional(),
16299
+ /** The allowed values of a `select`. */
16300
+ options: array(string().min(1)).min(1).optional()
16301
+ }).superRefine((v, ctx) => {
16302
+ if (v.type === "select" && v.options === void 0) ctx.addIssue({
16303
+ code: "custom",
16304
+ message: "a select variable needs options",
16305
+ path: ["options"]
16306
+ });
16307
+ if (v.default !== void 0 && variableValueError(v, v.default) !== null) ctx.addIssue({
16308
+ code: "custom",
16309
+ message: variableValueError(v, v.default) ?? "invalid default",
16310
+ path: ["default"]
16311
+ });
16312
+ });
16313
+ /** Why `value` is not a legal value for the variable, or null when it is. */
16314
+ function variableValueError(variable, value) {
16315
+ switch (variable.type) {
16316
+ case "string": return typeof value === "string" ? null : `variable "${variable.name}" must be a string`;
16317
+ case "number": return typeof value === "number" && Number.isFinite(value) ? null : `variable "${variable.name}" must be a number`;
16318
+ case "boolean": return typeof value === "boolean" ? null : `variable "${variable.name}" must be true or false`;
16319
+ case "select": return typeof value === "string" && (variable.options ?? []).includes(value) ? null : `variable "${variable.name}" must be one of ${(variable.options ?? []).join(", ")}`;
16320
+ }
16321
+ }
16322
+ var ActionSourceKindSchema = _enum(["internal", "addon"]);
16323
+ function isInternalActionId(actionId) {
16324
+ return actionId.startsWith("internal:") && actionId.length > 9;
16325
+ }
16326
+ /** The addon behind a `<addonId>:<localId>` id, or null for anything else (internal included). */
16327
+ function addonIdOfActionId(actionId) {
16328
+ if (isInternalActionId(actionId)) return null;
16329
+ const at = actionId.indexOf(":");
16330
+ return at > 0 && at < actionId.length - 1 ? actionId.slice(0, at) : null;
16331
+ }
16332
+ var ActionStatusSchema = object({
16333
+ isRunning: boolean(),
16334
+ /** Ms epoch the latest run STARTED; null when it never ran. */
16335
+ lastRunAt: number().nullable(),
16336
+ /** The latest run's failure; null on success or when it never ran. */
16337
+ lastError: string().nullable()
16338
+ });
16339
+ var ActionEntrySchema = object({
16340
+ /** `internal:<uuid>` or `<addonId>:<localId>`. */
16341
+ id: string().min(3),
16342
+ name: string().min(1).max(120),
16343
+ /** The addon that declared it; `core-blocks` for an internal one. */
16344
+ addonId: string().min(1),
16345
+ source: ActionSourceKindSchema,
16346
+ /** An addon-declared entry is edited where it was declared. */
16347
+ readOnly: boolean(),
16348
+ /** Internal only: cap and wait steps. No action-in-action, so no cycles. */
16349
+ steps: array(ActionStepSchema).min(1).max(50).optional(),
16350
+ variables: array(ActionVariableSchema).max(20).optional(),
16351
+ status: ActionStatusSchema
16352
+ }).superRefine((entry, ctx) => {
16353
+ if (entry.source === "internal") {
16354
+ if (!isInternalActionId(entry.id)) ctx.addIssue({
16355
+ code: "custom",
16356
+ message: "an internal action id is internal:<uuid>",
16357
+ path: ["id"]
16358
+ });
16359
+ return;
16360
+ }
16361
+ if (entry.steps !== void 0) ctx.addIssue({
16362
+ code: "custom",
16363
+ message: "only an internal action carries steps",
16364
+ path: ["steps"]
16365
+ });
16366
+ if (!entry.readOnly) ctx.addIssue({
16367
+ code: "custom",
16368
+ message: "an addon action is read-only here",
16369
+ path: ["readOnly"]
16370
+ });
16371
+ if (addonIdOfActionId(entry.id) === null) ctx.addIssue({
16372
+ code: "custom",
16373
+ message: "an addon action id is <addonId>:<localId>",
16374
+ path: ["id"]
16375
+ });
16376
+ });
16377
+ /** What an operator writes for an internal action. */
16378
+ var ActionInputSchema = object({
16379
+ name: string().min(1).max(120),
16380
+ steps: array(ActionStepSchema).min(1).max(50),
16381
+ variables: array(ActionVariableSchema).max(20).optional()
16382
+ });
16383
+ /** Who started a run. Absent = the operator pressed it. */
16384
+ var ActionRunOriginSchema = object({
16385
+ /** The automation block whose step started it. */
16386
+ blockId: string().min(1).optional() });
16387
+ /** `started` = the caller did not ask to wait. */
16388
+ var ActionRunOutcomeSchema = union([AutomationRunOutcomeSchema, literal("started")]);
16389
+ var ActionRunResultSchema = object({
16390
+ runId: string().min(1),
16391
+ outcome: ActionRunOutcomeSchema,
16392
+ /** Why it did not run, or what failed. */
16393
+ message: string().optional()
16394
+ });
16395
+ _enum([
16396
+ "not-found",
16397
+ "read-only",
16398
+ "invalid-variables",
16399
+ "invalid-steps",
16400
+ "not-linked",
16401
+ "busy"
16402
+ ]);
16403
+ object({
16404
+ actionId: string(),
16405
+ runId: string(),
16406
+ isRunning: boolean(),
16407
+ /** Set when the run ended. */
16408
+ outcome: AutomationRunOutcomeSchema.optional(),
16409
+ lastRunAt: number().nullable(),
16410
+ lastError: string().nullable()
16023
16411
  });
16024
16412
  /**
16025
16413
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
@@ -19580,7 +19968,18 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
19580
19968
  kind: "mutation",
19581
19969
  auth: "admin",
19582
19970
  access: "view"
19583
- });
19971
+ }), method(object({
19972
+ blockId: string().min(1),
19973
+ trace: AutomationRunTraceSchema.optional(),
19974
+ runStartedAt: number().optional(),
19975
+ keepTraces: number().int().min(1).max(100).optional()
19976
+ }), _void(), {
19977
+ kind: "mutation",
19978
+ auth: "admin"
19979
+ }), method(object({ blockId: string().min(1) }), AutomationStateDocSchema, { auth: "admin" }), method(object({ blockId: string().min(1) }), object({
19980
+ traces: array(AutomationRunTraceSchema),
19981
+ lastError: string().nullable()
19982
+ }), { auth: "admin" });
19584
19983
  /**
19585
19984
  * `custom-model-registry` — collection cap exposing operator-registered
19586
19985
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -44707,51 +45106,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
44707
45106
  kind: "mutation",
44708
45107
  auth: "admin"
44709
45108
  });
44710
- new Set([
44711
- {
44712
- id: "person",
44713
- name: "Person"
44714
- },
44715
- {
44716
- id: "vehicle",
44717
- name: "Vehicle"
44718
- },
44719
- {
44720
- id: "animal",
44721
- name: "Animal"
44722
- },
44723
- {
44724
- id: "package",
44725
- name: "Package"
44726
- }
44727
- ].map((l) => l.id));
44728
- var COCO_TO_MACRO = {
44729
- mapping: {
44730
- person: "person",
44731
- bicycle: "vehicle",
44732
- car: "vehicle",
44733
- motorcycle: "vehicle",
44734
- airplane: "vehicle",
44735
- bus: "vehicle",
44736
- train: "vehicle",
44737
- truck: "vehicle",
44738
- boat: "vehicle",
44739
- bird: "animal",
44740
- cat: "animal",
44741
- dog: "animal",
44742
- horse: "animal",
44743
- sheep: "animal",
44744
- cow: "animal",
44745
- elephant: "animal",
44746
- bear: "animal",
44747
- zebra: "animal",
44748
- giraffe: "animal",
44749
- suitcase: "package",
44750
- backpack: "package",
44751
- handbag: "package"
44752
- },
44753
- preserveOriginal: false
44754
- };
44755
45109
  var AUDIO_MACRO_LABELS = [
44756
45110
  {
44757
45111
  id: "speech",
@@ -57300,6 +57654,84 @@ DeviceType.Camera, method(object({ deviceId: number() }), AudioMetricsSnapshotSc
57300
57654
  * would produce more than `maxPoints` samples. */
57301
57655
  sampleEveryMs: number().int().positive().optional()
57302
57656
  }), AudioMetricsHistorySchema);
57657
+ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
57658
+ actionId: string().min(1),
57659
+ variables: record(string(), ActionVariableValueSchema).optional()
57660
+ }), _void(), {
57661
+ kind: "mutation",
57662
+ auth: "admin"
57663
+ }), method(object({ actionId: string().min(1) }), _void(), {
57664
+ kind: "mutation",
57665
+ auth: "admin"
57666
+ });
57667
+ /**
57668
+ * actions — the ONE surface for runnable actions, for the UI and for
57669
+ * automations. Provided by the core-blocks builtin on the hub.
57670
+ *
57671
+ * An action is a LIST ENTRY, not a device (D883): either internal (cap and wait
57672
+ * steps, kept in the hub's `actions` record kind) or declared by an addon over
57673
+ * `action-source`. `list` asks every `action-source` provider LIVE and overlays
57674
+ * the run status from the hub's `runs` ledger; there is no catalog here to
57675
+ * drift (D3).
57676
+ *
57677
+ * **Permissions follow the camera, as linked devices do.** An action is linked
57678
+ * to cameras by the operator (`setLinks`, D356: nothing links itself). A
57679
+ * non-admin may `get` / `run` an action only through a camera they may see that
57680
+ * links it: they name the camera (`deviceId`, a top-level field so the scope
57681
+ * gate sees it) and the provider refuses an action that camera does not link.
57682
+ * An admin, and an in-process caller (an automation block), may run any action.
57683
+ * Every refusal is typed (`[not-linked] …`) and logged.
57684
+ *
57685
+ * A second `run` of an action that is already running is REFUSED — traced and
57686
+ * logged — never queued.
57687
+ */
57688
+ var ActionIdInput = object({ actionId: string().min(1) });
57689
+ var ActionLinksSchema = object({
57690
+ deviceId: number().int().nonnegative(),
57691
+ actionIds: array(string().min(1)).max(100)
57692
+ });
57693
+ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
57694
+ actionId: string().min(1),
57695
+ deviceId: number().int().nonnegative().optional()
57696
+ }), object({ action: ActionEntrySchema.nullable() }), {
57697
+ role: "viewer",
57698
+ auth: "protected",
57699
+ kind: "query",
57700
+ caller: "required"
57701
+ }), method(object({
57702
+ actionId: string().min(1),
57703
+ variables: record(string(), ActionVariableValueSchema).optional(),
57704
+ wait: boolean().optional(),
57705
+ origin: ActionRunOriginSchema.optional(),
57706
+ deviceId: number().int().nonnegative().optional()
57707
+ }), ActionRunResultSchema, {
57708
+ role: "viewer",
57709
+ auth: "protected",
57710
+ kind: "mutation",
57711
+ caller: "required"
57712
+ }), method(ActionIdInput, _void(), {
57713
+ kind: "mutation",
57714
+ auth: "admin"
57715
+ }), method(ActionIdInput, object({ traces: array(AutomationRunTraceSchema) }), { auth: "admin" }), method(object({ action: ActionInputSchema }), object({ action: ActionEntrySchema }), {
57716
+ kind: "mutation",
57717
+ auth: "admin"
57718
+ }), method(object({
57719
+ actionId: string().min(1),
57720
+ action: ActionInputSchema.partial()
57721
+ }), object({ action: ActionEntrySchema }), {
57722
+ kind: "mutation",
57723
+ auth: "admin"
57724
+ }), method(ActionIdInput, _void(), {
57725
+ kind: "mutation",
57726
+ auth: "admin"
57727
+ }), method(object({ deviceId: number().int().nonnegative() }), array(ActionEntrySchema), {
57728
+ role: "viewer",
57729
+ auth: "protected",
57730
+ kind: "query"
57731
+ }), method(object({ deviceId: number().int().nonnegative() }), ActionLinksSchema, { auth: "admin" }), method(ActionLinksSchema, ActionLinksSchema, {
57732
+ kind: "mutation",
57733
+ auth: "admin"
57734
+ });
57303
57735
  object({
57304
57736
  /** Whether the automation is currently enabled. Disabled automations
57305
57737
  * ignore their trigger block — manual `trigger` still works. */
@@ -66413,6 +66845,104 @@ Object.freeze({
66413
66845
  access: "create",
66414
66846
  role: "admin"
66415
66847
  },
66848
+ "actions.create": {
66849
+ capName: "actions",
66850
+ capScope: "system",
66851
+ addonId: null,
66852
+ access: "create",
66853
+ role: "admin"
66854
+ },
66855
+ "actions.delete": {
66856
+ capName: "actions",
66857
+ capScope: "system",
66858
+ addonId: null,
66859
+ access: "delete",
66860
+ role: "admin"
66861
+ },
66862
+ "actions.get": {
66863
+ capName: "actions",
66864
+ capScope: "system",
66865
+ addonId: null,
66866
+ access: "view",
66867
+ role: "viewer"
66868
+ },
66869
+ "actions.getLinks": {
66870
+ capName: "actions",
66871
+ capScope: "system",
66872
+ addonId: null,
66873
+ access: "view",
66874
+ role: "admin"
66875
+ },
66876
+ "actions.getTraces": {
66877
+ capName: "actions",
66878
+ capScope: "system",
66879
+ addonId: null,
66880
+ access: "view",
66881
+ role: "admin"
66882
+ },
66883
+ "actions.list": {
66884
+ capName: "actions",
66885
+ capScope: "system",
66886
+ addonId: null,
66887
+ access: "view",
66888
+ role: "admin"
66889
+ },
66890
+ "actions.listForCamera": {
66891
+ capName: "actions",
66892
+ capScope: "system",
66893
+ addonId: null,
66894
+ access: "view",
66895
+ role: "viewer"
66896
+ },
66897
+ "actions.run": {
66898
+ capName: "actions",
66899
+ capScope: "system",
66900
+ addonId: null,
66901
+ access: "create",
66902
+ role: "viewer"
66903
+ },
66904
+ "actions.setLinks": {
66905
+ capName: "actions",
66906
+ capScope: "system",
66907
+ addonId: null,
66908
+ access: "create",
66909
+ role: "admin"
66910
+ },
66911
+ "actions.stop": {
66912
+ capName: "actions",
66913
+ capScope: "system",
66914
+ addonId: null,
66915
+ access: "create",
66916
+ role: "admin"
66917
+ },
66918
+ "actions.update": {
66919
+ capName: "actions",
66920
+ capScope: "system",
66921
+ addonId: null,
66922
+ access: "create",
66923
+ role: "admin"
66924
+ },
66925
+ "actionSource.listActions": {
66926
+ capName: "action-source",
66927
+ capScope: "system",
66928
+ addonId: null,
66929
+ access: "view",
66930
+ role: "admin"
66931
+ },
66932
+ "actionSource.runAction": {
66933
+ capName: "action-source",
66934
+ capScope: "system",
66935
+ addonId: null,
66936
+ access: "create",
66937
+ role: "admin"
66938
+ },
66939
+ "actionSource.stopAction": {
66940
+ capName: "action-source",
66941
+ capScope: "system",
66942
+ addonId: null,
66943
+ access: "create",
66944
+ role: "admin"
66945
+ },
66416
66946
  "addonPages.listPages": {
66417
66947
  capName: "addon-pages",
66418
66948
  capScope: "system",
@@ -67694,6 +68224,13 @@ Object.freeze({
67694
68224
  access: "view",
67695
68225
  role: "admin"
67696
68226
  },
68227
+ "coreBlocks.getAutomationRunState": {
68228
+ capName: "core-blocks",
68229
+ capScope: "system",
68230
+ addonId: null,
68231
+ access: "view",
68232
+ role: "admin"
68233
+ },
67697
68234
  "coreBlocks.getBlockSettings": {
67698
68235
  capName: "core-blocks",
67699
68236
  capScope: "system",
@@ -67715,6 +68252,13 @@ Object.freeze({
67715
68252
  access: "view",
67716
68253
  role: "admin"
67717
68254
  },
68255
+ "coreBlocks.getTraces": {
68256
+ capName: "core-blocks",
68257
+ capScope: "system",
68258
+ addonId: null,
68259
+ access: "view",
68260
+ role: "admin"
68261
+ },
67718
68262
  "coreBlocks.getTypeDefs": {
67719
68263
  capName: "core-blocks",
67720
68264
  capScope: "system",
@@ -67750,6 +68294,13 @@ Object.freeze({
67750
68294
  access: "create",
67751
68295
  role: "admin"
67752
68296
  },
68297
+ "coreBlocks.reportAutomationRun": {
68298
+ capName: "core-blocks",
68299
+ capScope: "system",
68300
+ addonId: null,
68301
+ access: "create",
68302
+ role: "admin"
68303
+ },
67753
68304
  "coreBlocks.restart": {
67754
68305
  capName: "core-blocks",
67755
68306
  capScope: "system",
@@ -79904,6 +80455,8 @@ var ML = "model and training machinery — no device action";
79904
80455
  var INTERNAL = "internal plumbing between addons — never operator-facing";
79905
80456
  /** Every system-scoped cap, with why it is not a device's vocabulary. */
79906
80457
  var SYSTEM_CAP_VOCABULARY = {
80458
+ "action-source": system(INTERNAL),
80459
+ actions: system("declared actions — run from the Actions page and from the cameras that link them"),
79907
80460
  "addon-pages": system(UI_PLUMBING),
79908
80461
  "addon-pages-source": system(UI_PLUMBING),
79909
80462
  "addon-routes": system(UI_PLUMBING),
@@ -80100,6 +80653,31 @@ Object.freeze({
80100
80653
  form: "single",
80101
80654
  optional: false
80102
80655
  }],
80656
+ "actions.get": [{
80657
+ name: "deviceId",
80658
+ form: "single",
80659
+ optional: true
80660
+ }],
80661
+ "actions.getLinks": [{
80662
+ name: "deviceId",
80663
+ form: "single",
80664
+ optional: false
80665
+ }],
80666
+ "actions.listForCamera": [{
80667
+ name: "deviceId",
80668
+ form: "single",
80669
+ optional: false
80670
+ }],
80671
+ "actions.run": [{
80672
+ name: "deviceId",
80673
+ form: "single",
80674
+ optional: true
80675
+ }],
80676
+ "actions.setLinks": [{
80677
+ name: "deviceId",
80678
+ form: "single",
80679
+ optional: false
80680
+ }],
80103
80681
  "addonSettings.getDeviceSettings": [{
80104
80682
  name: "deviceId",
80105
80683
  form: "single",
@@ -84181,6 +84759,7 @@ DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
84181
84759
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
84182
84760
  DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
84183
84761
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
84762
+ String.raw`(?<=^|["'(\s>,\[{])`;
84184
84763
  var MB = 1024 * 1024;
84185
84764
  1024 * MB, 3072 * MB;
84186
84765
  //#endregion