@camstack/types 1.0.2 → 1.0.4

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/index.js CHANGED
@@ -622,14 +622,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
622
622
  EventCategory["DeviceSleeping"] = "device.sleeping";
623
623
  EventCategory["RetentionCleanup"] = "retention.cleanup";
624
624
  /**
625
- * Progress snapshot emitted by `BulkUpdateCoordinator` on every state
626
- * transition (item status change, phase change, completion, cancel).
627
- * Payload is `BulkUpdateState`. Admin UI subscribes via `useLiveEvent`
628
- * to drive the sticky `BulkUpdateBanner` and per-row `AddonRowBadge`.
629
- *
630
- * Spec: docs/superpowers/specs/2026-05-21-addons-bulk-update-progress-design.md
625
+ * Legacy bulk-update progress snapshot (payload `BulkUpdateState`). No longer
626
+ * emitted F3 removed the coordinator that produced it; "Update all" now runs
627
+ * as one lifecycle engine job (`AddonsJobProgress`/`AddonsJobLog`). Retained
628
+ * (with `BulkUpdateState`) only to avoid regenerating the event maps; removed
629
+ * in F4 once live bulk progress is re-implemented over the engine events.
631
630
  */
632
631
  EventCategory["AddonsBulkUpdateProgress"] = "addons.bulk-update-progress";
632
+ EventCategory["AddonsJobProgress"] = "addons.job-progress";
633
+ EventCategory["AddonsJobLog"] = "addons.job-log";
633
634
  /**
634
635
  * A container's child visibility toggled (hidden/shown). Emitted by the
635
636
  * `accessories` cap when a child device is hidden or revealed.
@@ -13087,10 +13088,6 @@ function createSystemProxy(api) {
13087
13088
  listCapabilityProviders: (input) => dispatch("addons", "listCapabilityProviders", "query", input),
13088
13089
  setCapabilityProviderEnabled: (input) => dispatch("addons", "setCapabilityProviderEnabled", "mutation", input),
13089
13090
  updateFrameworkPackage: (input) => dispatch("addons", "updateFrameworkPackage", "mutation", input),
13090
- startBulkUpdate: (input) => dispatch("addons", "startBulkUpdate", "mutation", input),
13091
- getBulkUpdateState: (input) => dispatch("addons", "getBulkUpdateState", "query", input),
13092
- cancelBulkUpdate: (input) => dispatch("addons", "cancelBulkUpdate", "mutation", input),
13093
- listActiveBulkUpdates: (input) => dispatch("addons", "listActiveBulkUpdates", "query", input),
13094
13091
  getVersions: (input) => dispatch("addons", "getVersions", "query", input),
13095
13092
  restartAddon: (input) => dispatch("addons", "restartAddon", "mutation", input),
13096
13093
  retryLoad: (input) => dispatch("addons", "retryLoad", "mutation", input),
@@ -13100,6 +13097,10 @@ function createSystemProxy(api) {
13100
13097
  setAddonAutoUpdate: (input) => dispatch("addons", "setAddonAutoUpdate", "mutation", input),
13101
13098
  applyAutoUpdateToAll: (input) => dispatch("addons", "applyAutoUpdateToAll", "mutation", input),
13102
13099
  custom: (input) => dispatch("addons", "custom", "mutation", input),
13100
+ startJob: (input) => dispatch("addons", "startJob", "mutation", input),
13101
+ getJob: (input) => dispatch("addons", "getJob", "query", input),
13102
+ listJobs: (input) => dispatch("addons", "listJobs", "query", input),
13103
+ cancelJob: (input) => dispatch("addons", "cancelJob", "mutation", input),
13103
13104
  onAddonLogs: (input, push) => dispatch("addons", "onAddonLogs", "subscription", input, push)
13104
13105
  },
13105
13106
  addonSettings: {
@@ -22098,6 +22099,71 @@ var integrationsCapability = {
22098
22099
  }
22099
22100
  };
22100
22101
  //#endregion
22102
+ //#region src/lifecycle/job.ts
22103
+ var jobKindSchema = zod.z.enum([
22104
+ "install",
22105
+ "update",
22106
+ "uninstall",
22107
+ "restart"
22108
+ ]);
22109
+ var taskPhaseSchema = zod.z.enum([
22110
+ "queued",
22111
+ "fetching",
22112
+ "staged",
22113
+ "validating",
22114
+ "applying",
22115
+ "restarting",
22116
+ "applied",
22117
+ "done",
22118
+ "failed",
22119
+ "skipped"
22120
+ ]);
22121
+ var taskTargetSchema = zod.z.enum(["framework", "addon"]);
22122
+ var taskLogEntrySchema = zod.z.object({
22123
+ tsMs: zod.z.number(),
22124
+ nodeId: zod.z.string(),
22125
+ packageName: zod.z.string(),
22126
+ phase: taskPhaseSchema,
22127
+ message: zod.z.string()
22128
+ });
22129
+ var lifecycleTaskSchema = zod.z.object({
22130
+ taskId: zod.z.string(),
22131
+ nodeId: zod.z.string(),
22132
+ packageName: zod.z.string(),
22133
+ fromVersion: zod.z.string().nullable(),
22134
+ toVersion: zod.z.string(),
22135
+ target: taskTargetSchema,
22136
+ phase: taskPhaseSchema,
22137
+ stagedPath: zod.z.string().nullable(),
22138
+ attempts: zod.z.number(),
22139
+ steps: zod.z.array(taskLogEntrySchema),
22140
+ error: zod.z.string().nullable(),
22141
+ startedAtMs: zod.z.number().nullable(),
22142
+ finishedAtMs: zod.z.number().nullable()
22143
+ });
22144
+ var lifecycleJobStateSchema = zod.z.enum([
22145
+ "running",
22146
+ "completed",
22147
+ "failed",
22148
+ "partially-failed",
22149
+ "cancelled"
22150
+ ]);
22151
+ var lifecycleJobScopeSchema = zod.z.enum([
22152
+ "single",
22153
+ "bulk",
22154
+ "cluster"
22155
+ ]);
22156
+ var lifecycleJobSchema = zod.z.object({
22157
+ jobId: zod.z.string(),
22158
+ kind: jobKindSchema,
22159
+ createdAtMs: zod.z.number(),
22160
+ createdBy: zod.z.string(),
22161
+ scope: lifecycleJobScopeSchema,
22162
+ tasks: zod.z.array(lifecycleTaskSchema),
22163
+ state: lifecycleJobStateSchema,
22164
+ schemaVersion: zod.z.literal(1)
22165
+ });
22166
+ //#endregion
22101
22167
  //#region src/capabilities/addons.cap.ts
22102
22168
  /**
22103
22169
  * addons — system-scoped singleton capability for addon package
@@ -22281,7 +22347,7 @@ var BulkUpdatePhaseSchema = zod.z.enum([
22281
22347
  "restarting",
22282
22348
  "finalizing"
22283
22349
  ]);
22284
- var BulkUpdateStateSchema = zod.z.object({
22350
+ zod.z.object({
22285
22351
  id: zod.z.string(),
22286
22352
  nodeId: zod.z.string(),
22287
22353
  startedAtMs: zod.z.number(),
@@ -22517,54 +22583,6 @@ var addonsCapability = {
22517
22583
  kind: "mutation",
22518
22584
  auth: "admin"
22519
22585
  }),
22520
- /**
22521
- * Kicks off a server-side bulk update operation and returns the bulk
22522
- * id immediately. The operation runs asynchronously; observe progress
22523
- * via the `AddonsBulkUpdateProgress` event or `getBulkUpdateState`.
22524
- * Items with `isSystem: true` use `deferRestart` — the hub restarts
22525
- * ONCE at the end of the system phase, after all system packages are
22526
- * installed.
22527
- *
22528
- * `items[].version` is REQUIRED — callers must pass the resolved
22529
- * version from `listUpdates`. There is no `'latest'` default here
22530
- * (unlike `updatePackage`) to guarantee deterministic bulk rolls.
22531
- */
22532
- startBulkUpdate: method(zod.z.object({
22533
- nodeId: zod.z.string(),
22534
- items: zod.z.array(zod.z.object({
22535
- name: zod.z.string(),
22536
- version: zod.z.string(),
22537
- isSystem: zod.z.boolean()
22538
- })).readonly()
22539
- }), zod.z.object({ id: zod.z.string() }), {
22540
- kind: "mutation",
22541
- auth: "admin"
22542
- }),
22543
- /**
22544
- * Returns the current state of a bulk update by id.
22545
- * Returns `null` if the id is unknown or has been auto-cleaned
22546
- * (5 minutes after `completedAt` the record is evicted from memory).
22547
- */
22548
- getBulkUpdateState: method(zod.z.object({ id: zod.z.string() }), BulkUpdateStateSchema.nullable(), { auth: "admin" }),
22549
- /**
22550
- * Cancels an in-flight bulk update. The update loop exits after the
22551
- * currently-processing item completes — cancellation is not
22552
- * instantaneous. Has no effect once the `restarting` phase has been
22553
- * entered (the hub is already shutting down at that point).
22554
- * Returns `{ cancelled: false }` if the id is unknown, the operation
22555
- * has already completed, or the `restarting` phase is active.
22556
- */
22557
- cancelBulkUpdate: method(zod.z.object({ id: zod.z.string() }), zod.z.object({ cancelled: zod.z.boolean() }), {
22558
- kind: "mutation",
22559
- auth: "admin"
22560
- }),
22561
- /**
22562
- * Lists all currently active (non-completed) bulk updates.
22563
- * If `nodeId` is provided, filters to only bulk updates targeting
22564
- * that node. Useful for restoring an in-progress banner on a fresh
22565
- * page load when the UI reconnects mid-operation.
22566
- */
22567
- listActiveBulkUpdates: method(zod.z.object({ nodeId: zod.z.string().optional() }), zod.z.array(BulkUpdateStateSchema).readonly(), { auth: "admin" }),
22568
22586
  getVersions: method(zod.z.object({ name: zod.z.string() }), zod.z.array(PackageVersionInfoSchema).readonly()),
22569
22587
  restartAddon: method(zod.z.object({ addonId: zod.z.string() }), RestartAddonResultSchema, {
22570
22588
  kind: "mutation",
@@ -22601,6 +22619,51 @@ var addonsCapability = {
22601
22619
  auth: "admin"
22602
22620
  }),
22603
22621
  custom: method(CustomActionInputSchema, zod.z.unknown(), { kind: "mutation" }),
22622
+ /**
22623
+ * Start a lifecycle job (install / update / uninstall / restart) for one
22624
+ * or more addon packages. Returns the `jobId` immediately — the job runs
22625
+ * asynchronously. Observe progress via `EventCategory.AddonsJobProgress` /
22626
+ * `AddonsJobLog` events or poll `getJob`.
22627
+ *
22628
+ * For a single-addon update on the hub the provider also routes
22629
+ * `updatePackage` through this path so the fast swap + atomic-restart
22630
+ * path (`applyStagedAddonUpdate`) is always used.
22631
+ */
22632
+ startJob: method(zod.z.object({
22633
+ kind: zod.z.enum([
22634
+ "install",
22635
+ "update",
22636
+ "uninstall",
22637
+ "restart"
22638
+ ]),
22639
+ targets: zod.z.array(zod.z.object({
22640
+ name: zod.z.string().min(1),
22641
+ version: zod.z.string().min(1)
22642
+ })).min(1),
22643
+ nodeIds: zod.z.array(zod.z.string()).optional()
22644
+ }), zod.z.object({ jobId: zod.z.string() }), {
22645
+ kind: "mutation",
22646
+ auth: "admin"
22647
+ }),
22648
+ /**
22649
+ * Retrieve a lifecycle job by id. Returns `null` when the id is unknown
22650
+ * (e.g. evicted after the retention window).
22651
+ */
22652
+ getJob: method(zod.z.object({ jobId: zod.z.string() }), lifecycleJobSchema.nullable(), { auth: "admin" }),
22653
+ /**
22654
+ * List lifecycle jobs. When `activeOnly` is true, only jobs still in
22655
+ * `running` state are returned.
22656
+ */
22657
+ listJobs: method(zod.z.object({ activeOnly: zod.z.boolean().optional() }), zod.z.array(lifecycleJobSchema), { auth: "admin" }),
22658
+ /**
22659
+ * Cancel a lifecycle job that is queued but not yet actively running.
22660
+ * Returns `{ cancelled: false }` if the job is unknown, already in a
22661
+ * terminal state, or actively executing (cannot abort mid-flight).
22662
+ */
22663
+ cancelJob: method(zod.z.object({ jobId: zod.z.string() }), zod.z.object({ cancelled: zod.z.boolean() }), {
22664
+ kind: "mutation",
22665
+ auth: "admin"
22666
+ }),
22604
22667
  onAddonLogs: method(zod.z.object({
22605
22668
  addonId: zod.z.string(),
22606
22669
  level: LogLevelSchema$1.optional()
@@ -23562,7 +23625,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
23562
23625
  addonId: null,
23563
23626
  access: "create"
23564
23627
  },
23565
- "addons.cancelBulkUpdate": {
23628
+ "addons.cancelJob": {
23566
23629
  capName: "addons",
23567
23630
  capScope: "system",
23568
23631
  addonId: null,
@@ -23592,7 +23655,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
23592
23655
  addonId: null,
23593
23656
  access: "view"
23594
23657
  },
23595
- "addons.getBulkUpdateState": {
23658
+ "addons.getJob": {
23596
23659
  capName: "addons",
23597
23660
  capScope: "system",
23598
23661
  addonId: null,
@@ -23640,19 +23703,19 @@ var METHOD_ACCESS_MAP = Object.freeze({
23640
23703
  addonId: null,
23641
23704
  access: "view"
23642
23705
  },
23643
- "addons.listActiveBulkUpdates": {
23706
+ "addons.listCapabilityProviders": {
23644
23707
  capName: "addons",
23645
23708
  capScope: "system",
23646
23709
  addonId: null,
23647
23710
  access: "view"
23648
23711
  },
23649
- "addons.listCapabilityProviders": {
23712
+ "addons.listFrameworkPackages": {
23650
23713
  capName: "addons",
23651
23714
  capScope: "system",
23652
23715
  addonId: null,
23653
23716
  access: "view"
23654
23717
  },
23655
- "addons.listFrameworkPackages": {
23718
+ "addons.listJobs": {
23656
23719
  capName: "addons",
23657
23720
  capScope: "system",
23658
23721
  addonId: null,
@@ -23736,7 +23799,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
23736
23799
  addonId: null,
23737
23800
  access: "create"
23738
23801
  },
23739
- "addons.startBulkUpdate": {
23802
+ "addons.startJob": {
23740
23803
  capName: "addons",
23741
23804
  capScope: "system",
23742
23805
  addonId: null,
@@ -28023,6 +28086,34 @@ function getCapsByProviderKind(kind) {
28023
28086
  return out;
28024
28087
  }
28025
28088
  //#endregion
28089
+ //#region src/lifecycle/framework-swap.ts
28090
+ var frameworkSwapPackageSchema = zod.z.object({
28091
+ name: zod.z.string(),
28092
+ stagedPath: zod.z.string(),
28093
+ backupPath: zod.z.string(),
28094
+ toVersion: zod.z.string(),
28095
+ fromVersion: zod.z.string().nullable()
28096
+ });
28097
+ var pendingFrameworkSwapSchema = zod.z.object({
28098
+ jobId: zod.z.string(),
28099
+ taskId: zod.z.string(),
28100
+ packages: zod.z.array(frameworkSwapPackageSchema),
28101
+ requestedAtMs: zod.z.number(),
28102
+ schemaVersion: zod.z.literal(1)
28103
+ });
28104
+ var frameworkSwapConfirmSchema = zod.z.object({
28105
+ jobId: zod.z.string(),
28106
+ taskId: zod.z.string(),
28107
+ backups: zod.z.array(zod.z.object({
28108
+ name: zod.z.string(),
28109
+ backupPath: zod.z.string(),
28110
+ livePath: zod.z.string()
28111
+ })),
28112
+ appliedAtMs: zod.z.number(),
28113
+ bootAttempts: zod.z.number(),
28114
+ schemaVersion: zod.z.literal(1)
28115
+ });
28116
+ //#endregion
28026
28117
  //#region src/util/location-match.ts
28027
28118
  /**
28028
28119
  * Pure fuzzy matcher for adoption location import. Normalized
@@ -28914,6 +29005,8 @@ exports.findTimezone = findTimezone;
28914
29005
  exports.floodCapability = floodCapability;
28915
29006
  exports.formatForBackend = formatForBackend;
28916
29007
  exports.formatForRuntime = formatForRuntime;
29008
+ exports.frameworkSwapConfirmSchema = frameworkSwapConfirmSchema;
29009
+ exports.frameworkSwapPackageSchema = frameworkSwapPackageSchema;
28917
29010
  exports.gasCapability = gasCapability;
28918
29011
  exports.getAudioMacroClassIds = getAudioMacroClassIds;
28919
29012
  exports.getByPath = getByPath;
@@ -28929,7 +29022,12 @@ exports.isAgentOnlyPlacement = isAgentOnlyPlacement;
28929
29022
  exports.isDeployableToAgent = isDeployableToAgent;
28930
29023
  exports.isDeviceConfigCap = isDeviceConfigCap;
28931
29024
  exports.isEvent = isEvent;
29025
+ exports.jobKindSchema = jobKindSchema;
28932
29026
  exports.lawnMowerControlCapability = lawnMowerControlCapability;
29027
+ exports.lifecycleJobSchema = lifecycleJobSchema;
29028
+ exports.lifecycleJobScopeSchema = lifecycleJobScopeSchema;
29029
+ exports.lifecycleJobStateSchema = lifecycleJobStateSchema;
29030
+ exports.lifecycleTaskSchema = lifecycleTaskSchema;
28933
29031
  exports.localNetworkCapability = localNetworkCapability;
28934
29032
  exports.locationSimilarity = locationSimilarity;
28935
29033
  exports.lockControlCapability = lockControlCapability;
@@ -28966,6 +29064,7 @@ exports.parseJsonObject = parseJsonObject;
28966
29064
  exports.parseJsonUnknown = parseJsonUnknown;
28967
29065
  exports.parseProfileBrokerId = parseProfileBrokerId;
28968
29066
  exports.parseStreamParamsFormPatch = parseStreamParamsFormPatch;
29067
+ exports.pendingFrameworkSwapSchema = pendingFrameworkSwapSchema;
28969
29068
  exports.pickPreferredRtspEntry = pickPreferredRtspEntry;
28970
29069
  exports.pipelineAnalyticsCapability = pipelineAnalyticsCapability;
28971
29070
  exports.pipelineExecutorCapability = pipelineExecutorCapability;
@@ -29020,6 +29119,9 @@ exports.switchCapability = switchCapability;
29020
29119
  exports.synthesizeSourceInfo = synthesizeSourceInfo;
29021
29120
  exports.systemCapability = systemCapability;
29022
29121
  exports.tamperCapability = tamperCapability;
29122
+ exports.taskLogEntrySchema = taskLogEntrySchema;
29123
+ exports.taskPhaseSchema = taskPhaseSchema;
29124
+ exports.taskTargetSchema = taskTargetSchema;
29023
29125
  exports.temperatureSensorCapability = temperatureSensorCapability;
29024
29126
  exports.toDeviceSummary = toDeviceSummary;
29025
29127
  exports.toStreamSourceEntry = toStreamSourceEntry;