@camstack/system 1.2.68 → 1.2.69

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 (53) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/adoption-job-engine.d.ts +89 -0
  14. package/dist/builtins/device-manager/device-manager.addon.d.ts +8 -0
  15. package/dist/builtins/device-manager/device-manager.addon.js +329 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +329 -2
  17. package/dist/builtins/device-manager/device-provider-context.d.ts +3 -0
  18. package/dist/builtins/device-manager/device-queries.d.ts +3 -0
  19. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  20. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  21. package/dist/builtins/hub-forwarder/index.js +1 -1
  22. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  23. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  24. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  25. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  26. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  27. package/dist/builtins/local-network/local-network.addon.js +1 -1
  28. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  29. package/dist/builtins/loki-logging/index.js +1 -1
  30. package/dist/builtins/loki-logging/index.mjs +1 -1
  31. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  32. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  33. package/dist/builtins/platform-probe/index.js +1 -1
  34. package/dist/builtins/platform-probe/index.mjs +1 -1
  35. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  36. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  37. package/dist/builtins/snapshot/index.js +1 -1
  38. package/dist/builtins/snapshot/index.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  40. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  45. package/dist/builtins/system-config/system-config.addon.js +1 -1
  46. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  47. package/dist/builtins/winston-logging/index.js +1 -1
  48. package/dist/builtins/winston-logging/index.mjs +1 -1
  49. package/dist/{dist-D2J8RJ7m.mjs → dist-C-QzFJ8v.mjs} +236 -1
  50. package/dist/{dist-Dhpte164.js → dist-D7wC-S4p.js} +236 -1
  51. package/dist/index.js +1 -1
  52. package/dist/index.mjs +1 -1
  53. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { pt as BaseAddon, q as logDestinationCapability } from "../../dist-D2J8RJ7m.mjs";
1
+ import { pt as BaseAddon, q as logDestinationCapability } from "../../dist-C-QzFJ8v.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  import * as path$1 from "node:path";
4
4
  import path from "node:path";
@@ -3200,6 +3200,104 @@ z.object({
3200
3200
  })
3201
3201
  });
3202
3202
  /**
3203
+ * Adoption job — the background form of `device-adoption.adopt`.
3204
+ *
3205
+ * ## Why this exists
3206
+ *
3207
+ * `adopt({childNativeIds: [...]})` materialises one CamStack device per
3208
+ * candidate PLUS every accessory child, and the whole array shares ONE UDS
3209
+ * request deadline (60s). Measured on the live hub against Home Assistant:
3210
+ * each device the kernel creates costs ~450 ms — `devices.create` pre-seeds
3211
+ * meta with up to eleven SEQUENTIAL round trips (`setName`, `setType`,
3212
+ * `setRole`, … `persistConfig`) before the class is constructed — and an
3213
+ * accessory child costs the same as its parent. So the real unit of work is
3214
+ * the CHILD, not the candidate:
3215
+ *
3216
+ * - 25 candidates averaging 6 children → ~150 devices → **>60s, times out**
3217
+ * - ONE candidate with 217 children → ~217 devices → **>60s, times out**
3218
+ *
3219
+ * That second line is why this is a job and not a smaller batch. No chunking,
3220
+ * no bounded concurrency over candidates and no per-call tuning can fix a
3221
+ * shape where **N=1 already exceeds the deadline** — the count that blows the
3222
+ * budget is the source system's accessory fan-out, which the operator does not
3223
+ * choose and cannot see. A design that only works below some N is the same bug
3224
+ * deferred.
3225
+ *
3226
+ * ## What the timeout did NOT do
3227
+ *
3228
+ * It did not stop the work. The UDS deadline ends the CALLER's wait; the
3229
+ * provider's loop runs to completion. Measured: a 25-candidate adopt that
3230
+ * "failed" at 60s had adopted 17 by 87s and all 25 by ~130s. The operator saw
3231
+ * an error and had no way to learn that. Every field below exists so that
3232
+ * question has an answer.
3233
+ *
3234
+ * ## Idempotency
3235
+ *
3236
+ * Jobs are in-RAM; a restart forgets them. That is safe here because adoption
3237
+ * is keyed by a stable id (`ha:<broker>:dev:<nativeId>` and equivalents), so
3238
+ * re-running a job re-adopts nothing: an already-adopted candidate is SKIPPED
3239
+ * by the engine before any provider call and lands in `alreadyAdopted`. It is
3240
+ * never a duplicate device, and never an error the operator has to interpret.
3241
+ */
3242
+ var AdoptionJobStateSchema = z.enum([
3243
+ "running",
3244
+ "done",
3245
+ "failed",
3246
+ "cancelled"
3247
+ ]);
3248
+ /**
3249
+ * Per-candidate result. Every candidate the job was asked to adopt ends in
3250
+ * exactly one of these buckets — there is no silent drop, and the operator can
3251
+ * always answer "which of my 25 landed?".
3252
+ *
3253
+ * - `adopted` — created now by this job.
3254
+ * - `already-adopted` — a device for this candidate existed before the job
3255
+ * reached it (a re-run, or a retry after a timeout). Not an error.
3256
+ * - `failed` — the provider threw; `error` carries the message.
3257
+ * - `cancelled` — the operator cancelled before this candidate was reached.
3258
+ */
3259
+ var AdoptionOutcomeSchema = z.enum([
3260
+ "adopted",
3261
+ "already-adopted",
3262
+ "failed",
3263
+ "cancelled"
3264
+ ]);
3265
+ var AdoptionCandidateResultSchema = z.object({
3266
+ childNativeId: z.string(),
3267
+ outcome: AdoptionOutcomeSchema,
3268
+ /** The materialised parent device id — null for `failed` / `cancelled`. */
3269
+ parentDeviceId: z.number().int().nonnegative().nullable(),
3270
+ /** Accessory children created for this candidate. */
3271
+ accessoryCount: z.number().int().nonnegative(),
3272
+ /** Failure message; null unless `outcome === 'failed'`. */
3273
+ error: z.string().nullable()
3274
+ });
3275
+ var AdoptionJobSchema = z.object({
3276
+ jobId: z.string(),
3277
+ /** The integration provider this job adopts through (the `addonId` pin). */
3278
+ addonId: z.string(),
3279
+ integrationId: z.string(),
3280
+ state: AdoptionJobStateSchema,
3281
+ /** Candidates the job was asked to adopt. Known up front, so never null. */
3282
+ total: z.number().int().nonnegative(),
3283
+ /** Candidates that have reached a terminal bucket. */
3284
+ processed: z.number().int().nonnegative(),
3285
+ adopted: z.number().int().nonnegative(),
3286
+ alreadyAdopted: z.number().int().nonnegative(),
3287
+ failed: z.number().int().nonnegative(),
3288
+ /** Accessory child devices created across every candidate — the real unit
3289
+ * of work, surfaced so a slow job is legible rather than mysterious. */
3290
+ accessoriesCreated: z.number().int().nonnegative(),
3291
+ /** The candidate currently being adopted; null when idle or finished. */
3292
+ currentChildNativeId: z.string().nullable(),
3293
+ /** One entry per candidate, in the order they were processed. */
3294
+ results: z.array(AdoptionCandidateResultSchema).readonly(),
3295
+ startedAt: z.number(),
3296
+ finishedAt: z.number().nullable(),
3297
+ /** Set only when the job itself broke (not a per-candidate failure). */
3298
+ error: z.string().nullable()
3299
+ });
3300
+ /**
3203
3301
  * Per-camera FUNCTION SWITCHES — the one coherent on/off surface over the
3204
3302
  * pipeline functions an operator thinks in terms of.
3205
3303
  *
@@ -9484,6 +9582,31 @@ var deviceManagerCapability = {
9484
9582
  auth: "admin"
9485
9583
  }),
9486
9584
  /**
9585
+ * Start a background adoption and return its `jobId` immediately. The job
9586
+ * adopts ONE candidate per provider call, so no single request can exceed
9587
+ * the transport deadline, and it skips candidates that are already adopted
9588
+ * — which makes re-submitting a batch after a timeout safe and silent
9589
+ * rather than a wall of duplicate-stableId errors.
9590
+ */
9591
+ adoptionStartJob: method(AdoptInputSchema.extend({ addonId: z.string() }), z.object({ jobId: z.string() }), {
9592
+ kind: "mutation",
9593
+ auth: "admin"
9594
+ }),
9595
+ /**
9596
+ * Adoption jobs for an integration, newest first. This is the answer to
9597
+ * "which of my 25 landed?" — `results` carries one entry per candidate,
9598
+ * every one of them in a named bucket.
9599
+ */
9600
+ adoptionListJobs: method(z.object({
9601
+ addonId: z.string(),
9602
+ integrationId: z.string().optional()
9603
+ }), z.array(AdoptionJobSchema).readonly(), { auth: "admin" }),
9604
+ /** Cooperative cancel: the in-flight candidate finishes, the rest never start. */
9605
+ adoptionCancelJob: method(z.object({ jobId: z.string() }), z.object({ cancelled: z.boolean() }), {
9606
+ kind: "mutation",
9607
+ auth: "admin"
9608
+ }),
9609
+ /**
9487
9610
  * Re-sync a device with its source via the device-adoption provider of the
9488
9611
  * device's OWNING addon (resolved from `camDeviceId`). Unlike the singleton
9489
9612
  * `device-adoption.resync`, this routes to the correct integration so a
@@ -19797,6 +19920,45 @@ onColorChanged: { data: z.object({
19797
19920
  */
19798
19921
  runtimeState: ColorStatusSchema
19799
19922
  };
19923
+ var ConnectionTestOutcomeSchema = z.discriminatedUnion("outcome", [
19924
+ z.object({
19925
+ outcome: z.literal("validated"),
19926
+ /** Round-trip of the sign-in, when the provider measured it. */
19927
+ latencyMs: z.number().nonnegative().optional(),
19928
+ /** Optional human detail worth showing next to the tick
19929
+ * ("3 devices visible on this account"). */
19930
+ detail: z.string().optional()
19931
+ }).strict(),
19932
+ z.object({
19933
+ outcome: z.literal("rejected"),
19934
+ error: z.string()
19935
+ }).strict(),
19936
+ z.object({
19937
+ outcome: z.literal("inconclusive"),
19938
+ error: z.string()
19939
+ }).strict()
19940
+ ]);
19941
+ var ConnectionTestInputSchema = z.object({
19942
+ /** Candidate integration settings, exactly as the create form collected them. */
19943
+ settings: z.record(z.string(), z.unknown()) });
19944
+ /**
19945
+ * What the provider's test actually DOES, so the UI can say it in words before
19946
+ * the operator presses the button ("Signs in to the Dreo cloud"). Purely
19947
+ * descriptive — it never changes routing.
19948
+ */
19949
+ var ConnectionTestDescriptorSchema = z.object({ label: z.string() });
19950
+ var connectionTestCapability = {
19951
+ name: "connection-test",
19952
+ scope: "system",
19953
+ mode: "collection",
19954
+ methods: {
19955
+ testSettings: method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
19956
+ kind: "mutation",
19957
+ auth: "admin"
19958
+ }),
19959
+ describeTest: method(z.void(), ConnectionTestDescriptorSchema, { auth: "admin" })
19960
+ }
19961
+ };
19800
19962
  /**
19801
19963
  * Upstream-system connectivity sensor — distinct from `device-status`,
19802
19964
  * which is the kernel-managed online/offline flag for the device's
@@ -21240,15 +21402,57 @@ var AvailableIntegrationTypeSchema = z.object({
21240
21402
  * flow can import (e.g. HA areas). Drives the adopt modal's "import
21241
21403
  * locations" checkbox. Provider-declared in the addon manifest. */
21242
21404
  supportsLocationImport: z.boolean(),
21405
+ /**
21406
+ * True when this integration DECLARES a pre-creation test (the
21407
+ * `connection-test` cap, or a broker whose settings it stores). Drives the
21408
+ * Test button: an integration that cannot be tested must say so up front
21409
+ * rather than offering a button that always answers the same nonsense.
21410
+ */
21411
+ canTest: z.boolean(),
21243
21412
  existingInstances: z.array(z.object({
21244
21413
  id: z.string(),
21245
21414
  name: z.string()
21246
21415
  })),
21247
21416
  canAdd: z.boolean()
21248
21417
  });
21418
+ /**
21419
+ * Why a test could not be answered as a plain boolean.
21420
+ *
21421
+ * `success` alone collapsed four different situations into one red box, and the
21422
+ * one that mattered most — "nobody ever asked the remote anything" — looked
21423
+ * exactly like "the remote said no". The status is the discriminator:
21424
+ *
21425
+ * - `validated` — a provider-declared test ran and the remote ACCEPTED.
21426
+ * - `rejected` — a provider-declared test ran and the remote REFUSED.
21427
+ * The only status that blocks `integrations.create`.
21428
+ * - `inconclusive` — a test IS declared but could not complete (timeout,
21429
+ * DNS, 5xx). Nothing was observed; not a failure.
21430
+ * - `unsupported` — this integration declares NO test. Nothing was
21431
+ * observed either; not a failure, and not a pass.
21432
+ *
21433
+ * `unsupported` and `inconclusive` both carry `success: false` so an older
21434
+ * client can never read them as a green tick, and both carry an `error` string
21435
+ * that SAYS the test did not run rather than inventing a failure.
21436
+ */
21437
+ var TestConnectionStatusEnum = z.enum([
21438
+ "validated",
21439
+ "rejected",
21440
+ "inconclusive",
21441
+ "unsupported"
21442
+ ]);
21249
21443
  var TestConnectionResultSchema$1 = z.object({
21444
+ /** True ONLY for `validated`. Never true for a test that did not run. */
21250
21445
  success: z.boolean(),
21251
- error: z.string().optional()
21446
+ error: z.string().optional(),
21447
+ /** Optional for wire back-compat with clients built before the tri-state;
21448
+ * the server always sets it. */
21449
+ status: TestConnectionStatusEnum.optional(),
21450
+ /** Addon id whose declared test answered — `null` when none did. Lets the UI
21451
+ * attribute a result instead of blaming "the integration". */
21452
+ testedBy: z.string().nullable().optional(),
21453
+ latencyMs: z.number().nonnegative().optional(),
21454
+ /** Human detail from a `validated` result ("3 devices on this account"). */
21455
+ detail: z.string().optional()
21252
21456
  });
21253
21457
  var CreateIntegrationInputSchema = z.object({
21254
21458
  addonId: z.string(),
@@ -27046,6 +27250,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
27046
27250
  carbonMonoxideCapability,
27047
27251
  climateControlCapability,
27048
27252
  colorCapability,
27253
+ connectionTestCapability,
27049
27254
  connectivityCapability,
27050
27255
  consumablesCapability,
27051
27256
  contactCapability,
@@ -27938,6 +28143,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
27938
28143
  addonId: null,
27939
28144
  access: "create"
27940
28145
  },
28146
+ "connectionTest.describeTest": {
28147
+ capName: "connection-test",
28148
+ capScope: "system",
28149
+ addonId: null,
28150
+ access: "view"
28151
+ },
28152
+ "connectionTest.testSettings": {
28153
+ capName: "connection-test",
28154
+ capScope: "system",
28155
+ addonId: null,
28156
+ access: "create"
28157
+ },
27941
28158
  "consumables.reset": {
27942
28159
  capName: "consumables",
27943
28160
  capScope: "device",
@@ -28328,6 +28545,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28328
28545
  addonId: null,
28329
28546
  access: "create"
28330
28547
  },
28548
+ "deviceManager.adoptionCancelJob": {
28549
+ capName: "device-manager",
28550
+ capScope: "system",
28551
+ addonId: null,
28552
+ access: "create"
28553
+ },
28331
28554
  "deviceManager.adoptionListCandidateFilters": {
28332
28555
  capName: "device-manager",
28333
28556
  capScope: "system",
@@ -28340,6 +28563,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28340
28563
  addonId: null,
28341
28564
  access: "view"
28342
28565
  },
28566
+ "deviceManager.adoptionListJobs": {
28567
+ capName: "device-manager",
28568
+ capScope: "system",
28569
+ addonId: null,
28570
+ access: "view"
28571
+ },
28343
28572
  "deviceManager.adoptionRefresh": {
28344
28573
  capName: "device-manager",
28345
28574
  capScope: "system",
@@ -28358,6 +28587,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28358
28587
  addonId: null,
28359
28588
  access: "create"
28360
28589
  },
28590
+ "deviceManager.adoptionStartJob": {
28591
+ capName: "device-manager",
28592
+ capScope: "system",
28593
+ addonId: null,
28594
+ access: "create"
28595
+ },
28361
28596
  "deviceManager.allocateDeviceId": {
28362
28597
  capName: "device-manager",
28363
28598
  capScope: "system",
@@ -3200,6 +3200,104 @@ zod.z.object({
3200
3200
  })
3201
3201
  });
3202
3202
  /**
3203
+ * Adoption job — the background form of `device-adoption.adopt`.
3204
+ *
3205
+ * ## Why this exists
3206
+ *
3207
+ * `adopt({childNativeIds: [...]})` materialises one CamStack device per
3208
+ * candidate PLUS every accessory child, and the whole array shares ONE UDS
3209
+ * request deadline (60s). Measured on the live hub against Home Assistant:
3210
+ * each device the kernel creates costs ~450 ms — `devices.create` pre-seeds
3211
+ * meta with up to eleven SEQUENTIAL round trips (`setName`, `setType`,
3212
+ * `setRole`, … `persistConfig`) before the class is constructed — and an
3213
+ * accessory child costs the same as its parent. So the real unit of work is
3214
+ * the CHILD, not the candidate:
3215
+ *
3216
+ * - 25 candidates averaging 6 children → ~150 devices → **>60s, times out**
3217
+ * - ONE candidate with 217 children → ~217 devices → **>60s, times out**
3218
+ *
3219
+ * That second line is why this is a job and not a smaller batch. No chunking,
3220
+ * no bounded concurrency over candidates and no per-call tuning can fix a
3221
+ * shape where **N=1 already exceeds the deadline** — the count that blows the
3222
+ * budget is the source system's accessory fan-out, which the operator does not
3223
+ * choose and cannot see. A design that only works below some N is the same bug
3224
+ * deferred.
3225
+ *
3226
+ * ## What the timeout did NOT do
3227
+ *
3228
+ * It did not stop the work. The UDS deadline ends the CALLER's wait; the
3229
+ * provider's loop runs to completion. Measured: a 25-candidate adopt that
3230
+ * "failed" at 60s had adopted 17 by 87s and all 25 by ~130s. The operator saw
3231
+ * an error and had no way to learn that. Every field below exists so that
3232
+ * question has an answer.
3233
+ *
3234
+ * ## Idempotency
3235
+ *
3236
+ * Jobs are in-RAM; a restart forgets them. That is safe here because adoption
3237
+ * is keyed by a stable id (`ha:<broker>:dev:<nativeId>` and equivalents), so
3238
+ * re-running a job re-adopts nothing: an already-adopted candidate is SKIPPED
3239
+ * by the engine before any provider call and lands in `alreadyAdopted`. It is
3240
+ * never a duplicate device, and never an error the operator has to interpret.
3241
+ */
3242
+ var AdoptionJobStateSchema = zod.z.enum([
3243
+ "running",
3244
+ "done",
3245
+ "failed",
3246
+ "cancelled"
3247
+ ]);
3248
+ /**
3249
+ * Per-candidate result. Every candidate the job was asked to adopt ends in
3250
+ * exactly one of these buckets — there is no silent drop, and the operator can
3251
+ * always answer "which of my 25 landed?".
3252
+ *
3253
+ * - `adopted` — created now by this job.
3254
+ * - `already-adopted` — a device for this candidate existed before the job
3255
+ * reached it (a re-run, or a retry after a timeout). Not an error.
3256
+ * - `failed` — the provider threw; `error` carries the message.
3257
+ * - `cancelled` — the operator cancelled before this candidate was reached.
3258
+ */
3259
+ var AdoptionOutcomeSchema = zod.z.enum([
3260
+ "adopted",
3261
+ "already-adopted",
3262
+ "failed",
3263
+ "cancelled"
3264
+ ]);
3265
+ var AdoptionCandidateResultSchema = zod.z.object({
3266
+ childNativeId: zod.z.string(),
3267
+ outcome: AdoptionOutcomeSchema,
3268
+ /** The materialised parent device id — null for `failed` / `cancelled`. */
3269
+ parentDeviceId: zod.z.number().int().nonnegative().nullable(),
3270
+ /** Accessory children created for this candidate. */
3271
+ accessoryCount: zod.z.number().int().nonnegative(),
3272
+ /** Failure message; null unless `outcome === 'failed'`. */
3273
+ error: zod.z.string().nullable()
3274
+ });
3275
+ var AdoptionJobSchema = zod.z.object({
3276
+ jobId: zod.z.string(),
3277
+ /** The integration provider this job adopts through (the `addonId` pin). */
3278
+ addonId: zod.z.string(),
3279
+ integrationId: zod.z.string(),
3280
+ state: AdoptionJobStateSchema,
3281
+ /** Candidates the job was asked to adopt. Known up front, so never null. */
3282
+ total: zod.z.number().int().nonnegative(),
3283
+ /** Candidates that have reached a terminal bucket. */
3284
+ processed: zod.z.number().int().nonnegative(),
3285
+ adopted: zod.z.number().int().nonnegative(),
3286
+ alreadyAdopted: zod.z.number().int().nonnegative(),
3287
+ failed: zod.z.number().int().nonnegative(),
3288
+ /** Accessory child devices created across every candidate — the real unit
3289
+ * of work, surfaced so a slow job is legible rather than mysterious. */
3290
+ accessoriesCreated: zod.z.number().int().nonnegative(),
3291
+ /** The candidate currently being adopted; null when idle or finished. */
3292
+ currentChildNativeId: zod.z.string().nullable(),
3293
+ /** One entry per candidate, in the order they were processed. */
3294
+ results: zod.z.array(AdoptionCandidateResultSchema).readonly(),
3295
+ startedAt: zod.z.number(),
3296
+ finishedAt: zod.z.number().nullable(),
3297
+ /** Set only when the job itself broke (not a per-candidate failure). */
3298
+ error: zod.z.string().nullable()
3299
+ });
3300
+ /**
3203
3301
  * Per-camera FUNCTION SWITCHES — the one coherent on/off surface over the
3204
3302
  * pipeline functions an operator thinks in terms of.
3205
3303
  *
@@ -9484,6 +9582,31 @@ var deviceManagerCapability = {
9484
9582
  auth: "admin"
9485
9583
  }),
9486
9584
  /**
9585
+ * Start a background adoption and return its `jobId` immediately. The job
9586
+ * adopts ONE candidate per provider call, so no single request can exceed
9587
+ * the transport deadline, and it skips candidates that are already adopted
9588
+ * — which makes re-submitting a batch after a timeout safe and silent
9589
+ * rather than a wall of duplicate-stableId errors.
9590
+ */
9591
+ adoptionStartJob: method(AdoptInputSchema.extend({ addonId: zod.z.string() }), zod.z.object({ jobId: zod.z.string() }), {
9592
+ kind: "mutation",
9593
+ auth: "admin"
9594
+ }),
9595
+ /**
9596
+ * Adoption jobs for an integration, newest first. This is the answer to
9597
+ * "which of my 25 landed?" — `results` carries one entry per candidate,
9598
+ * every one of them in a named bucket.
9599
+ */
9600
+ adoptionListJobs: method(zod.z.object({
9601
+ addonId: zod.z.string(),
9602
+ integrationId: zod.z.string().optional()
9603
+ }), zod.z.array(AdoptionJobSchema).readonly(), { auth: "admin" }),
9604
+ /** Cooperative cancel: the in-flight candidate finishes, the rest never start. */
9605
+ adoptionCancelJob: method(zod.z.object({ jobId: zod.z.string() }), zod.z.object({ cancelled: zod.z.boolean() }), {
9606
+ kind: "mutation",
9607
+ auth: "admin"
9608
+ }),
9609
+ /**
9487
9610
  * Re-sync a device with its source via the device-adoption provider of the
9488
9611
  * device's OWNING addon (resolved from `camDeviceId`). Unlike the singleton
9489
9612
  * `device-adoption.resync`, this routes to the correct integration so a
@@ -19797,6 +19920,45 @@ onColorChanged: { data: zod.z.object({
19797
19920
  */
19798
19921
  runtimeState: ColorStatusSchema
19799
19922
  };
19923
+ var ConnectionTestOutcomeSchema = zod.z.discriminatedUnion("outcome", [
19924
+ zod.z.object({
19925
+ outcome: zod.z.literal("validated"),
19926
+ /** Round-trip of the sign-in, when the provider measured it. */
19927
+ latencyMs: zod.z.number().nonnegative().optional(),
19928
+ /** Optional human detail worth showing next to the tick
19929
+ * ("3 devices visible on this account"). */
19930
+ detail: zod.z.string().optional()
19931
+ }).strict(),
19932
+ zod.z.object({
19933
+ outcome: zod.z.literal("rejected"),
19934
+ error: zod.z.string()
19935
+ }).strict(),
19936
+ zod.z.object({
19937
+ outcome: zod.z.literal("inconclusive"),
19938
+ error: zod.z.string()
19939
+ }).strict()
19940
+ ]);
19941
+ var ConnectionTestInputSchema = zod.z.object({
19942
+ /** Candidate integration settings, exactly as the create form collected them. */
19943
+ settings: zod.z.record(zod.z.string(), zod.z.unknown()) });
19944
+ /**
19945
+ * What the provider's test actually DOES, so the UI can say it in words before
19946
+ * the operator presses the button ("Signs in to the Dreo cloud"). Purely
19947
+ * descriptive — it never changes routing.
19948
+ */
19949
+ var ConnectionTestDescriptorSchema = zod.z.object({ label: zod.z.string() });
19950
+ var connectionTestCapability = {
19951
+ name: "connection-test",
19952
+ scope: "system",
19953
+ mode: "collection",
19954
+ methods: {
19955
+ testSettings: method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
19956
+ kind: "mutation",
19957
+ auth: "admin"
19958
+ }),
19959
+ describeTest: method(zod.z.void(), ConnectionTestDescriptorSchema, { auth: "admin" })
19960
+ }
19961
+ };
19800
19962
  /**
19801
19963
  * Upstream-system connectivity sensor — distinct from `device-status`,
19802
19964
  * which is the kernel-managed online/offline flag for the device's
@@ -21240,15 +21402,57 @@ var AvailableIntegrationTypeSchema = zod.z.object({
21240
21402
  * flow can import (e.g. HA areas). Drives the adopt modal's "import
21241
21403
  * locations" checkbox. Provider-declared in the addon manifest. */
21242
21404
  supportsLocationImport: zod.z.boolean(),
21405
+ /**
21406
+ * True when this integration DECLARES a pre-creation test (the
21407
+ * `connection-test` cap, or a broker whose settings it stores). Drives the
21408
+ * Test button: an integration that cannot be tested must say so up front
21409
+ * rather than offering a button that always answers the same nonsense.
21410
+ */
21411
+ canTest: zod.z.boolean(),
21243
21412
  existingInstances: zod.z.array(zod.z.object({
21244
21413
  id: zod.z.string(),
21245
21414
  name: zod.z.string()
21246
21415
  })),
21247
21416
  canAdd: zod.z.boolean()
21248
21417
  });
21418
+ /**
21419
+ * Why a test could not be answered as a plain boolean.
21420
+ *
21421
+ * `success` alone collapsed four different situations into one red box, and the
21422
+ * one that mattered most — "nobody ever asked the remote anything" — looked
21423
+ * exactly like "the remote said no". The status is the discriminator:
21424
+ *
21425
+ * - `validated` — a provider-declared test ran and the remote ACCEPTED.
21426
+ * - `rejected` — a provider-declared test ran and the remote REFUSED.
21427
+ * The only status that blocks `integrations.create`.
21428
+ * - `inconclusive` — a test IS declared but could not complete (timeout,
21429
+ * DNS, 5xx). Nothing was observed; not a failure.
21430
+ * - `unsupported` — this integration declares NO test. Nothing was
21431
+ * observed either; not a failure, and not a pass.
21432
+ *
21433
+ * `unsupported` and `inconclusive` both carry `success: false` so an older
21434
+ * client can never read them as a green tick, and both carry an `error` string
21435
+ * that SAYS the test did not run rather than inventing a failure.
21436
+ */
21437
+ var TestConnectionStatusEnum = zod.z.enum([
21438
+ "validated",
21439
+ "rejected",
21440
+ "inconclusive",
21441
+ "unsupported"
21442
+ ]);
21249
21443
  var TestConnectionResultSchema$1 = zod.z.object({
21444
+ /** True ONLY for `validated`. Never true for a test that did not run. */
21250
21445
  success: zod.z.boolean(),
21251
- error: zod.z.string().optional()
21446
+ error: zod.z.string().optional(),
21447
+ /** Optional for wire back-compat with clients built before the tri-state;
21448
+ * the server always sets it. */
21449
+ status: TestConnectionStatusEnum.optional(),
21450
+ /** Addon id whose declared test answered — `null` when none did. Lets the UI
21451
+ * attribute a result instead of blaming "the integration". */
21452
+ testedBy: zod.z.string().nullable().optional(),
21453
+ latencyMs: zod.z.number().nonnegative().optional(),
21454
+ /** Human detail from a `validated` result ("3 devices on this account"). */
21455
+ detail: zod.z.string().optional()
21252
21456
  });
21253
21457
  var CreateIntegrationInputSchema = zod.z.object({
21254
21458
  addonId: zod.z.string(),
@@ -27046,6 +27250,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
27046
27250
  carbonMonoxideCapability,
27047
27251
  climateControlCapability,
27048
27252
  colorCapability,
27253
+ connectionTestCapability,
27049
27254
  connectivityCapability,
27050
27255
  consumablesCapability,
27051
27256
  contactCapability,
@@ -27938,6 +28143,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
27938
28143
  addonId: null,
27939
28144
  access: "create"
27940
28145
  },
28146
+ "connectionTest.describeTest": {
28147
+ capName: "connection-test",
28148
+ capScope: "system",
28149
+ addonId: null,
28150
+ access: "view"
28151
+ },
28152
+ "connectionTest.testSettings": {
28153
+ capName: "connection-test",
28154
+ capScope: "system",
28155
+ addonId: null,
28156
+ access: "create"
28157
+ },
27941
28158
  "consumables.reset": {
27942
28159
  capName: "consumables",
27943
28160
  capScope: "device",
@@ -28328,6 +28545,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28328
28545
  addonId: null,
28329
28546
  access: "create"
28330
28547
  },
28548
+ "deviceManager.adoptionCancelJob": {
28549
+ capName: "device-manager",
28550
+ capScope: "system",
28551
+ addonId: null,
28552
+ access: "create"
28553
+ },
28331
28554
  "deviceManager.adoptionListCandidateFilters": {
28332
28555
  capName: "device-manager",
28333
28556
  capScope: "system",
@@ -28340,6 +28563,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28340
28563
  addonId: null,
28341
28564
  access: "view"
28342
28565
  },
28566
+ "deviceManager.adoptionListJobs": {
28567
+ capName: "device-manager",
28568
+ capScope: "system",
28569
+ addonId: null,
28570
+ access: "view"
28571
+ },
28343
28572
  "deviceManager.adoptionRefresh": {
28344
28573
  capName: "device-manager",
28345
28574
  capScope: "system",
@@ -28358,6 +28587,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
28358
28587
  addonId: null,
28359
28588
  access: "create"
28360
28589
  },
28590
+ "deviceManager.adoptionStartJob": {
28591
+ capName: "device-manager",
28592
+ capScope: "system",
28593
+ addonId: null,
28594
+ access: "create"
28595
+ },
28361
28596
  "deviceManager.allocateDeviceId": {
28362
28597
  capName: "device-manager",
28363
28598
  capScope: "system",
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-Dhpte164.js");
3
+ const require_dist = require("./dist-D7wC-S4p.js");
4
4
  const require_model_download_service = require("./model-download-service-Caj1kaSi.js");
5
5
  const require_manifest_python_deps = require("./manifest-python-deps-BE6l8Y4W.js");
6
6
  const require_resource_monitor = require("./resource-monitor-DNNomR-i.js");
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
2
- import { $ as objectInputDeclaresAddonId, B as isCollectionArrayMethod, Ct as asJsonObject$1, Dt as emitDownForOwnedCaps, Et as createEvent, Ft as readinessKey, G as lifecycleJobSchema, It as resolveCapMount, J as logLevelAtMost, L as extractNestedAddonId, Lt as scopeKey, Nt as parseJsonObject, Pt as parseJsonUnknown$1, Tt as asString$1, U as isVoidInput, V as isObjectInput, W as kebabToCamel, Y as looseSchema, bt as ReadinessRegistry, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, ft as errMsg$1, gt as DEVICE_STATUS_METHOD, ht as DEVICE_SETTINGS_CONTRIBUTION_METHODS, kt as expandCapMethods, mt as DATAPLANE_SECRET_HEADER$1, nt as procedureAuthKey, t as ALL_CAPABILITY_DEFINITIONS, v as addonSettingsCapability, wt as asNumber, xt as ReadinessTimeoutError, z as isArrayOutputSchema, zt as EventCategory$1 } from "./dist-D2J8RJ7m.mjs";
2
+ import { $ as objectInputDeclaresAddonId, B as isCollectionArrayMethod, Ct as asJsonObject$1, Dt as emitDownForOwnedCaps, Et as createEvent, Ft as readinessKey, G as lifecycleJobSchema, It as resolveCapMount, J as logLevelAtMost, L as extractNestedAddonId, Lt as scopeKey, Nt as parseJsonObject, Pt as parseJsonUnknown$1, Tt as asString$1, U as isVoidInput, V as isObjectInput, W as kebabToCamel, Y as looseSchema, bt as ReadinessRegistry, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, ft as errMsg$1, gt as DEVICE_STATUS_METHOD, ht as DEVICE_SETTINGS_CONTRIBUTION_METHODS, kt as expandCapMethods, mt as DATAPLANE_SECRET_HEADER$1, nt as procedureAuthKey, t as ALL_CAPABILITY_DEFINITIONS, v as addonSettingsCapability, wt as asNumber, xt as ReadinessTimeoutError, z as isArrayOutputSchema, zt as EventCategory$1 } from "./dist-C-QzFJ8v.mjs";
3
3
  import { a as downloadModel, c as getModelFilePath, d as contentTypeFor, f as createAuthenticatedFileServer, h as resolveFilePath, i as downloadFile, l as isModelDownloaded, m as parseTokenizedUrl, n as collectModelFiles, o as ensureModel, p as parseRangeHeader, r as deleteModelFromDisk, s as fetchJson, t as ModelDownloadService, u as createFileDataPlaneHandler } from "./model-download-service-CTBHzORJ.mjs";
4
4
  import { $ as buildNativeCapProxy, A as createHubCapForwardService, B as AGENT_CAP_FWD_ACTION, C as brokerTransportLink, Ct as resolveAddonClass, D as localProviderLink, E as ipcParentLink, F as createUdsLogger, G as callWithServiceDiscovery, H as CapRouteResolver, I as createUdsLoggerWithControl, J as UdsLocalTransportServer, K as createLocalTransport, L as LocalChildClient, M as createUdsEventBridge, N as createUdsEventBus, O as HUB_CAP_FWD_ACTION, P as udsChildLogToWorkerEntry, Q as encodeFrame, R as LocalChildRegistry, S as brokerCallForCap, St as runNpm, T as ipcChildLink, U as CapRouteError, V as AGENT_CAP_FWD_SERVICE, W as classifyCapRoute, X as localEndpointPath, Y as SocketChannel, Z as FrameDecoder, _ as createKernelHwAccel, _t as CapabilityHandle, a as getWorkerDeviceRegistry, b as __resetCapUsageRegistryForTests, bt as installManifestNativeDeps, c as setHubConnected, ct as NATIVE_PROVIDER_SERVICE_INFIX, d as getBrokerEventBus, dt as capBareAction, et as buildUdsNativeCapProxy, f as getMoleculerEventStats, ft as capServiceName, g as AddonDepsManager, gt as DeviceRegistry, h as subscribePassthrough, ht as serializeTypedArrays, i as createUdsAddonContext, it as mountNativeCapService, j as createParentUnownedCallHandler, k as HUB_CAP_FWD_SERVICE, l as EVENT_TOPIC_PREFIX, lt as capActionName, m as setNodeEventInterest, mt as deserializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as createAddonService, p as registerEventBusService, pt as parseCapAction, q as UdsLocalTransportClient, r as createAddonContext, s as getOrInitReadinessRegistryForClient, st as validateProviderRegistrations, t as installManifestPythonDeps, tt as createBrokerDeviceManagerApi, u as clusterEventTopic, ut as capActionSuffix, v as resolveHwAccel, vt as CapabilityUnavailableError, w as buildLinkChain, wt as createAddonDataPlaneFacility, x as getCapUsageRegistry, xt as resolveNpmInvocation, y as CapUsageRegistry, yt as copyBundledNativeModules, z as UDS_NO_ROUTE_PREFIX } from "./manifest-python-deps-Dz1ryHIN.mjs";
5
5
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-BkP504Vq.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.68",
3
+ "version": "1.2.69",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",